use of org.molgenis.ontology.core.meta.OntologyTermMetaData.ONTOLOGY_TERM in project molgenis by molgenis.
the class SortaServiceImpl method annotationMatchOntologyTerms.
private void annotationMatchOntologyTerms(Entity inputEntity, Entity ontologyEntity, List<Entity> relevantEntities, List<QueryRule> rulesForOtherFields) {
List<Entity> ontologyTermAnnotationEntities = dataService.findAll(ONTOLOGY_TERM_DYNAMIC_ANNOTATION, new QueryImpl<>(rulesForOtherFields).pageSize(Integer.MAX_VALUE)).collect(Collectors.toList());
if (!ontologyTermAnnotationEntities.isEmpty()) {
List<QueryRule> rules = Arrays.asList(new QueryRule(OntologyTermMetaData.ONTOLOGY, EQUALS, ontologyEntity), new QueryRule(AND), new QueryRule(OntologyTermMetaData.ONTOLOGY_TERM_DYNAMIC_ANNOTATION, IN, ontologyTermAnnotationEntities));
Stream<Entity> ontologyTermEntities = dataService.findAll(ONTOLOGY_TERM, new QueryImpl<>(rules).pageSize(Integer.MAX_VALUE));
List<Entity> relevantOntologyTermEntities = ontologyTermEntities.map(ontologyTermEntity -> calculateNGromOTAnnotations(inputEntity, ontologyTermEntity)).collect(Collectors.toList());
relevantEntities.addAll(relevantOntologyTermEntities);
}
}
Aggregations