@Test void testFindExcatOntologyTerms() { Entity synonymEntity1 = mock(Entity.class); when(synonymEntity1.get(OntologyTermSynonymMetadata.ID)).thenReturn("synonym-1"); when(synonymEntity1.get(OntologyTermSynonymMetadata.ONTOLOGY_TERM_SYNONYM_ATTR)) .thenReturn("Weight Reduction Diet"); Entity synonymEntity2 = mock(Entity.class); when(synonymEntity2.get(OntologyTermSynonymMetadata.ID)).thenReturn("synonym-2"); when(synonymEntity2.get(OntologyTermSynonymMetadata.ONTOLOGY_TERM_SYNONYM_ATTR)) .thenReturn("Weight loss Diet"); Entity synonymEntity3 = mock(Entity.class); when(synonymEntity3.get(OntologyTermSynonymMetadata.ID)).thenReturn("synonym-3"); when(synonymEntity3.get(OntologyTermSynonymMetadata.ONTOLOGY_TERM_SYNONYM_ATTR)) .thenReturn("Diet, Reducing"); Entity ontologyTermEntity1 = mock(Entity.class); when(ontologyTermEntity1.getString(ID)).thenReturn("1"); when(ontologyTermEntity1.get(ONTOLOGY)).thenReturn("34"); when(ontologyTermEntity1.getString(ONTOLOGY_TERM_IRI)).thenReturn("http: when(ontologyTermEntity1.getString(ONTOLOGY_TERM_NAME)).thenReturn("Diet, Reducing"); when(ontologyTermEntity1.get(ONTOLOGY_TERM_SYNONYM)) .thenReturn(asList(synonymEntity1, synonymEntity2, synonymEntity3)); Entity synonymEntity4 = mock(Entity.class); when(synonymEntity4.get(OntologyTermSynonymMetadata.ID)).thenReturn("synonym-4"); when(synonymEntity4.get(OntologyTermSynonymMetadata.ONTOLOGY_TERM_SYNONYM_ATTR)) .thenReturn("Weight"); Entity ontologyTermEntity2 = mock(Entity.class); when(ontologyTermEntity2.getString(ID)).thenReturn("12"); when(ontologyTermEntity2.get(ONTOLOGY)).thenReturn("34"); when(ontologyTermEntity2.getString(ONTOLOGY_TERM_IRI)).thenReturn("http: when(ontologyTermEntity2.getString(ONTOLOGY_TERM_NAME)).thenReturn("Weight"); when(ontologyTermEntity2.get(ONTOLOGY_TERM_SYNONYM)).thenReturn(singletonList(synonymEntity4)); @SuppressWarnings("unchecked") ArgumentCaptor<Query<Entity>> queryCaptor = forClass(Query.class); when(dataService.findAll(eq(ONTOLOGY_TERM), queryCaptor.capture())) .thenReturn(Stream.of(ontologyTermEntity1, ontologyTermEntity2)); List<OntologyTerm> exactOntologyTerms = ontologyTermRepository.findExcatOntologyTerms(asList("1", "2"), of("weight"), 100); assertEquals( singletonList(create("http: exactOntologyTerms); }
public List<OntologyTerm> findExcatOntologyTerms( List<String> ontologyIds, Set<String> terms, int pageSize) { List<OntologyTerm> findOntologyTerms = findOntologyTerms(ontologyIds, terms, pageSize); return findOntologyTerms.stream() .filter(ontologyTerm -> isOntologyTermExactMatch(terms, ontologyTerm)) .collect(Collectors.toList()); }
OntologyTermRepository { public List<OntologyTerm> findExcatOntologyTerms( List<String> ontologyIds, Set<String> terms, int pageSize) { List<OntologyTerm> findOntologyTerms = findOntologyTerms(ontologyIds, terms, pageSize); return findOntologyTerms.stream() .filter(ontologyTerm -> isOntologyTermExactMatch(terms, ontologyTerm)) .collect(Collectors.toList()); } }
OntologyTermRepository { public List<OntologyTerm> findExcatOntologyTerms( List<String> ontologyIds, Set<String> terms, int pageSize) { List<OntologyTerm> findOntologyTerms = findOntologyTerms(ontologyIds, terms, pageSize); return findOntologyTerms.stream() .filter(ontologyTerm -> isOntologyTermExactMatch(terms, ontologyTerm)) .collect(Collectors.toList()); } OntologyTermRepository(DataService dataService); }
OntologyTermRepository { public List<OntologyTerm> findExcatOntologyTerms( List<String> ontologyIds, Set<String> terms, int pageSize) { List<OntologyTerm> findOntologyTerms = findOntologyTerms(ontologyIds, terms, pageSize); return findOntologyTerms.stream() .filter(ontologyTerm -> isOntologyTermExactMatch(terms, ontologyTerm)) .collect(Collectors.toList()); } OntologyTermRepository(DataService dataService); List<OntologyTerm> findExcatOntologyTerms(
      List<String> ontologyIds, Set<String> terms, int pageSize); List<OntologyTerm> findOntologyTerms(
      List<String> ontologyIds, Set<String> terms, int pageSize); List<OntologyTerm> getAllOntologyTerms(String ontologyId); OntologyTerm getOntologyTerm(String[] iris); int getOntologyTermDistance(OntologyTerm ontologyTerm1, OntologyTerm ontologyTerm2); int calculateNodePathDistance(String nodePath1, String nodePath2); List<OntologyTerm> getChildren(OntologyTerm ontologyTerm); List<OntologyTerm> getChildOntologyTermsByNodePath(
      Entity ontologyEntity, Entity nodePathEntity); }
OntologyTermRepository { public List<OntologyTerm> findExcatOntologyTerms( List<String> ontologyIds, Set<String> terms, int pageSize) { List<OntologyTerm> findOntologyTerms = findOntologyTerms(ontologyIds, terms, pageSize); return findOntologyTerms.stream() .filter(ontologyTerm -> isOntologyTermExactMatch(terms, ontologyTerm)) .collect(Collectors.toList()); } OntologyTermRepository(DataService dataService); List<OntologyTerm> findExcatOntologyTerms(
      List<String> ontologyIds, Set<String> terms, int pageSize); List<OntologyTerm> findOntologyTerms(
      List<String> ontologyIds, Set<String> terms, int pageSize); List<OntologyTerm> getAllOntologyTerms(String ontologyId); OntologyTerm getOntologyTerm(String[] iris); int getOntologyTermDistance(OntologyTerm ontologyTerm1, OntologyTerm ontologyTerm2); int calculateNodePathDistance(String nodePath1, String nodePath2); List<OntologyTerm> getChildren(OntologyTerm ontologyTerm); List<OntologyTerm> getChildOntologyTermsByNodePath(
      Entity ontologyEntity, Entity nodePathEntity);  }