OntologyTerms { public static <O extends Ontology> Set<TermId> parentsOf(TermId termId, O ontology) { Set<TermId> result = new HashSet<>(); visitParentsOf( termId, ontology, new TermVisitor<O>() { @Override public boolean visit(O ontology, TermId termId) { result.add(termId); return true; } }); return result; }  static void visitChildrenOf(
    TermId termId, O ontology, TermVisitor<O> termVisitor); static Set<TermId> childrenOf(TermId termId, O ontology); static void visitParentsOf(
    TermId termId, O ontology, TermVisitor<O> termVisitor); static Set<TermId> parentsOf(TermId termId, O ontology);  }
@Test void testParentsOf() { assertEquals(ImmutableSet.of( TermId.of("VO:0000004"), TermId.of("VO:0000007"), TermId.of("VO:0000001"), TermId.of("VO:0000002")), OntologyTerms.parentsOf(idBlueCarrot, ontology)); }