public List<OntologyTerm> getChildren(OntologyTerm ontologyTerm) {
    Iterable<org.molgenis.ontology.core.meta.OntologyTerm> ontologyTermEntities =
        () ->
            dataService
                .query(ONTOLOGY_TERM, org.molgenis.ontology.core.meta.OntologyTerm.class)
                .eq(ONTOLOGY_TERM_IRI, ontologyTerm.getIRI())
                .findAll()
                .iterator();

    List<OntologyTerm> children = new ArrayList<>();
    for (Entity ontologyTermEntity : ontologyTermEntities) {
      Entity ontologyEntity = ontologyTermEntity.getEntity(OntologyTermMetadata.ONTOLOGY);
      ontologyTermEntity
          .getEntities(OntologyTermMetadata.ONTOLOGY_TERM_NODE_PATH)
          .forEach(
              ontologyTermNodePathEntity ->
                  children.addAll(
                      getChildOntologyTermsByNodePath(ontologyEntity, ontologyTermNodePathEntity)));
    }
    return children;
  }
public List < OntologyTerm > getChildren ( OntologyTerm ontologyTerm ) { Iterable < org . molgenis . ontology . core . meta . OntologyTerm > ontologyTermEntities = ( ) -> dataService . query ( ONTOLOGY_TERM , org . molgenis . ontology . core . meta . OntologyTerm . class ) . eq ( ONTOLOGY_TERM_IRI , ontologyTerm . getIRI ( ) ) . findAll ( ) . iterator ( ) ; List < OntologyTerm > children = new ArrayList < > ( ) ; for ( Entity ontologyTermEntity : ontologyTermEntities ) { Entity ontologyEntity = ontologyTermEntity . getEntity ( OntologyTermMetadata . ONTOLOGY ) ; ontologyTermEntity . getEntities ( OntologyTermMetadata . ONTOLOGY_TERM_NODE_PATH ) . forEach ( ontologyTermNodePathEntity -> children . addAll ( getChildOntologyTermsByNodePath ( ontologyEntity , ontologyTermNodePathEntity ) ) ) ; } return children ; }
Retrieve all descendant ontology terms

@return a list of {@link OntologyTerm}