@Test void testCollectQueryTermsFromOntologyTerm() { OntologyTerm ontologyTerm1 = OntologyTerm.create( "http: "Standing height", "Description is not used", singletonList("body_length")); List<String> actual_1 = semanticSearchServiceHelper.parseOntologyTermQueries(ontologyTerm1); assertEquals(asList("length body", "standing height"), actual_1); OntologyTerm ontologyTerm2 = OntologyTerm.create( "http: OntologyTerm ontologyTerm3 = OntologyTerm.create( "http: when(ontologyService.getChildren(ontologyTerm2)).thenReturn(singletonList(ontologyTerm3)); when(ontologyService.getOntologyTermDistance(ontologyTerm2, ontologyTerm3)).thenReturn(1); List<String> actual_2 = semanticSearchServiceHelper.parseOntologyTermQueries(ontologyTerm2); assertEquals(asList("height", "length^0.5 body^0.5", "length^0.5"), actual_2); }
public List<String> parseOntologyTermQueries(OntologyTerm ontologyTerm) { List<String> queryTerms = getOtLabelAndSynonyms(ontologyTerm).stream() .map(this::processQueryString) .collect(Collectors.toList()); for (OntologyTerm childOt : ontologyService.getChildren(ontologyTerm)) { double boostedNumber = Math.pow(0.5, ontologyService.getOntologyTermDistance(ontologyTerm, childOt)); getOtLabelAndSynonyms(childOt) .forEach(synonym -> queryTerms.add(parseBoostQueryString(synonym, boostedNumber))); } return queryTerms; }
SemanticSearchServiceHelper { public List<String> parseOntologyTermQueries(OntologyTerm ontologyTerm) { List<String> queryTerms = getOtLabelAndSynonyms(ontologyTerm).stream() .map(this::processQueryString) .collect(Collectors.toList()); for (OntologyTerm childOt : ontologyService.getChildren(ontologyTerm)) { double boostedNumber = Math.pow(0.5, ontologyService.getOntologyTermDistance(ontologyTerm, childOt)); getOtLabelAndSynonyms(childOt) .forEach(synonym -> queryTerms.add(parseBoostQueryString(synonym, boostedNumber))); } return queryTerms; } }
SemanticSearchServiceHelper { public List<String> parseOntologyTermQueries(OntologyTerm ontologyTerm) { List<String> queryTerms = getOtLabelAndSynonyms(ontologyTerm).stream() .map(this::processQueryString) .collect(Collectors.toList()); for (OntologyTerm childOt : ontologyService.getChildren(ontologyTerm)) { double boostedNumber = Math.pow(0.5, ontologyService.getOntologyTermDistance(ontologyTerm, childOt)); getOtLabelAndSynonyms(childOt) .forEach(synonym -> queryTerms.add(parseBoostQueryString(synonym, boostedNumber))); } return queryTerms; } SemanticSearchServiceHelper(
      DataService dataService,
      OntologyService ontologyService,
      TermFrequencyService termFrequencyService); }
SemanticSearchServiceHelper { public List<String> parseOntologyTermQueries(OntologyTerm ontologyTerm) { List<String> queryTerms = getOtLabelAndSynonyms(ontologyTerm).stream() .map(this::processQueryString) .collect(Collectors.toList()); for (OntologyTerm childOt : ontologyService.getChildren(ontologyTerm)) { double boostedNumber = Math.pow(0.5, ontologyService.getOntologyTermDistance(ontologyTerm, childOt)); getOtLabelAndSynonyms(childOt) .forEach(synonym -> queryTerms.add(parseBoostQueryString(synonym, boostedNumber))); } return queryTerms; } SemanticSearchServiceHelper(
      DataService dataService,
      OntologyService ontologyService,
      TermFrequencyService termFrequencyService); QueryRule createDisMaxQueryRuleForAttribute(
      Set<String> searchTerms, Collection<OntologyTerm> ontologyTerms); QueryRule createDisMaxQueryRuleForTerms(List<String> queryTerms); QueryRule createBoostedDisMaxQueryRuleForTerms(
      List<String> queryTerms, Double boostValue); QueryRule createShouldQueryRule(String multiOntologyTermIri); List<String> parseOntologyTermQueries(OntologyTerm ontologyTerm); Set<String> getOtLabelAndSynonyms(OntologyTerm ontologyTerm); Map<String, String> collectExpandedQueryMap(
      Set<String> queryTerms, Collection<OntologyTerm> ontologyTerms); void collectOntologyTermQueryMap(
      Map<String, String> expanedQueryMap, OntologyTerm ontologyTerm); List<String> getAttributeIdentifiers(EntityType sourceEntityType); List<OntologyTerm> findTags(String description, List<String> ontologyIds); String processQueryString(String queryString); String parseBoostQueryString(String queryString, double boost); String escapeCharsExcludingCaretChar(String string); Set<String> removeStopWords(String description); }
SemanticSearchServiceHelper { public List<String> parseOntologyTermQueries(OntologyTerm ontologyTerm) { List<String> queryTerms = getOtLabelAndSynonyms(ontologyTerm).stream() .map(this::processQueryString) .collect(Collectors.toList()); for (OntologyTerm childOt : ontologyService.getChildren(ontologyTerm)) { double boostedNumber = Math.pow(0.5, ontologyService.getOntologyTermDistance(ontologyTerm, childOt)); getOtLabelAndSynonyms(childOt) .forEach(synonym -> queryTerms.add(parseBoostQueryString(synonym, boostedNumber))); } return queryTerms; } SemanticSearchServiceHelper(
      DataService dataService,
      OntologyService ontologyService,
      TermFrequencyService termFrequencyService); QueryRule createDisMaxQueryRuleForAttribute(
      Set<String> searchTerms, Collection<OntologyTerm> ontologyTerms); QueryRule createDisMaxQueryRuleForTerms(List<String> queryTerms); QueryRule createBoostedDisMaxQueryRuleForTerms(
      List<String> queryTerms, Double boostValue); QueryRule createShouldQueryRule(String multiOntologyTermIri); List<String> parseOntologyTermQueries(OntologyTerm ontologyTerm); Set<String> getOtLabelAndSynonyms(OntologyTerm ontologyTerm); Map<String, String> collectExpandedQueryMap(
      Set<String> queryTerms, Collection<OntologyTerm> ontologyTerms); void collectOntologyTermQueryMap(
      Map<String, String> expanedQueryMap, OntologyTerm ontologyTerm); List<String> getAttributeIdentifiers(EntityType sourceEntityType); List<OntologyTerm> findTags(String description, List<String> ontologyIds); String processQueryString(String queryString); String parseBoostQueryString(String queryString, double boost); String escapeCharsExcludingCaretChar(String string); Set<String> removeStopWords(String description); static final int MAX_NUM_TAGS; }