@Test void testVisitChildrenOf() { Set<TermId> children = new TreeSet<>(); OntologyTerms.visitChildrenOf( idRootVegetable, ontology, (ontology, termId) -> { children.add(termId); return true; }); assertEquals( ImmutableSet.of( TermId.of("VO:0000002"), TermId.of("VO:0000004"), TermId.of("VO:0000005"), TermId.of("VO:0000006"), TermId.of("VO:0000007")), children); }
public static <O extends Ontology> void visitChildrenOf( TermId termId, O ontology, TermVisitor<O> termVisitor) { BreadthFirstSearch<TermId, IdLabeledEdge> bfs = new BreadthFirstSearch<>(); DefaultDirectedGraph<TermId, IdLabeledEdge> graph = ontology.getGraph(); bfs.startFromReverse( graph, termId, new VertexVisitor<TermId, IdLabeledEdge>() { @Override public boolean visit(DefaultDirectedGraph<TermId, IdLabeledEdge> g, TermId v) { return termVisitor.visit(ontology, v); } }); }
OntologyTerms { public static <O extends Ontology> void visitChildrenOf( TermId termId, O ontology, TermVisitor<O> termVisitor) { BreadthFirstSearch<TermId, IdLabeledEdge> bfs = new BreadthFirstSearch<>(); DefaultDirectedGraph<TermId, IdLabeledEdge> graph = ontology.getGraph(); bfs.startFromReverse( graph, termId, new VertexVisitor<TermId, IdLabeledEdge>() { @Override public boolean visit(DefaultDirectedGraph<TermId, IdLabeledEdge> g, TermId v) { return termVisitor.visit(ontology, v); } }); } }
OntologyTerms { public static <O extends Ontology> void visitChildrenOf( TermId termId, O ontology, TermVisitor<O> termVisitor) { BreadthFirstSearch<TermId, IdLabeledEdge> bfs = new BreadthFirstSearch<>(); DefaultDirectedGraph<TermId, IdLabeledEdge> graph = ontology.getGraph(); bfs.startFromReverse( graph, termId, new VertexVisitor<TermId, IdLabeledEdge>() { @Override public boolean visit(DefaultDirectedGraph<TermId, IdLabeledEdge> g, TermId v) { return termVisitor.visit(ontology, v); } }); }  }
OntologyTerms { public static <O extends Ontology> void visitChildrenOf( TermId termId, O ontology, TermVisitor<O> termVisitor) { BreadthFirstSearch<TermId, IdLabeledEdge> bfs = new BreadthFirstSearch<>(); DefaultDirectedGraph<TermId, IdLabeledEdge> graph = ontology.getGraph(); bfs.startFromReverse( graph, termId, new VertexVisitor<TermId, IdLabeledEdge>() { @Override public boolean visit(DefaultDirectedGraph<TermId, IdLabeledEdge> g, TermId v) { return termVisitor.visit(ontology, v); } }); }  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); }
OntologyTerms { public static <O extends Ontology> void visitChildrenOf( TermId termId, O ontology, TermVisitor<O> termVisitor) { BreadthFirstSearch<TermId, IdLabeledEdge> bfs = new BreadthFirstSearch<>(); DefaultDirectedGraph<TermId, IdLabeledEdge> graph = ontology.getGraph(); bfs.startFromReverse( graph, termId, new VertexVisitor<TermId, IdLabeledEdge>() { @Override public boolean visit(DefaultDirectedGraph<TermId, IdLabeledEdge> g, TermId v) { return termVisitor.visit(ontology, v); } }); }  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);  }