Search in sources :

Example 1 with ONTOLOGY_TERM_DYNAMIC_ANNOTATION

use of org.molgenis.ontology.core.meta.OntologyTermDynamicAnnotationMetaData.ONTOLOGY_TERM_DYNAMIC_ANNOTATION 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);
    }
}
Also used : NGramDistanceAlgorithm(org.molgenis.semanticsearch.string.NGramDistanceAlgorithm) Iterables(com.google.common.collect.Iterables) java.util(java.util) COMBINED_SCORE(org.molgenis.ontology.sorta.meta.OntologyTermHitMetaData.COMBINED_SCORE) Operator(org.molgenis.data.QueryRule.Operator) SCORE(org.molgenis.ontology.sorta.meta.OntologyTermHitMetaData.SCORE) QueryImpl(org.molgenis.data.support.QueryImpl) StringUtils(org.apache.commons.lang3.StringUtils) FluentIterable(com.google.common.collect.FluentIterable) Objects.requireNonNull(java.util.Objects.requireNonNull) ONTOLOGY_TERM_DYNAMIC_ANNOTATION(org.molgenis.ontology.core.meta.OntologyTermDynamicAnnotationMetaData.ONTOLOGY_TERM_DYNAMIC_ANNOTATION) Stemmer(org.molgenis.semanticsearch.string.Stemmer) ONTOLOGY_TERM(org.molgenis.ontology.core.meta.OntologyTermMetaData.ONTOLOGY_TERM) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) Stream(java.util.stream.Stream) OntologyTermHitEntity(org.molgenis.ontology.sorta.bean.OntologyTermHitEntity) DataService(org.molgenis.data.DataService) org.molgenis.ontology.core.meta(org.molgenis.ontology.core.meta) OntologyTermHitMetaData(org.molgenis.ontology.sorta.meta.OntologyTermHitMetaData) ONTOLOGY(org.molgenis.ontology.core.meta.OntologyMetaData.ONTOLOGY) QueryRule(org.molgenis.data.QueryRule) Entity(org.molgenis.data.Entity) InformationContentService(org.molgenis.ontology.roc.InformationContentService) SortaService(org.molgenis.ontology.sorta.service.SortaService) OntologyTermHitEntity(org.molgenis.ontology.sorta.bean.OntologyTermHitEntity) Entity(org.molgenis.data.Entity) QueryImpl(org.molgenis.data.support.QueryImpl) QueryRule(org.molgenis.data.QueryRule)

Aggregations

FluentIterable (com.google.common.collect.FluentIterable)1 Iterables (com.google.common.collect.Iterables)1 Sets (com.google.common.collect.Sets)1 java.util (java.util)1 Objects.requireNonNull (java.util.Objects.requireNonNull)1 Collectors (java.util.stream.Collectors)1 Stream (java.util.stream.Stream)1 StringUtils (org.apache.commons.lang3.StringUtils)1 DataService (org.molgenis.data.DataService)1 Entity (org.molgenis.data.Entity)1 QueryRule (org.molgenis.data.QueryRule)1 Operator (org.molgenis.data.QueryRule.Operator)1 QueryImpl (org.molgenis.data.support.QueryImpl)1 org.molgenis.ontology.core.meta (org.molgenis.ontology.core.meta)1 ONTOLOGY (org.molgenis.ontology.core.meta.OntologyMetaData.ONTOLOGY)1 ONTOLOGY_TERM_DYNAMIC_ANNOTATION (org.molgenis.ontology.core.meta.OntologyTermDynamicAnnotationMetaData.ONTOLOGY_TERM_DYNAMIC_ANNOTATION)1 ONTOLOGY_TERM (org.molgenis.ontology.core.meta.OntologyTermMetaData.ONTOLOGY_TERM)1 InformationContentService (org.molgenis.ontology.roc.InformationContentService)1 OntologyTermHitEntity (org.molgenis.ontology.sorta.bean.OntologyTermHitEntity)1 OntologyTermHitMetaData (org.molgenis.ontology.sorta.meta.OntologyTermHitMetaData)1