def get_parents(cur, term_id):
    """Return a set of parents for a given term ID."""
    cur.execute(
        f"""SELECT DISTINCT object FROM statements
            WHERE stanza = '{term_id}' AND predicate IN ('rdfs:subClassOf', 'rdfs:subPropertyOf')
            AND object NOT LIKE '_:%'"""
    )
    return set([x[0] for x in cur.fetchall()])