@Test void testIsGoodMatch() { Map<String, Double> matchedTags = newHashMap(); matchedTags.put("height", 100.0); matchedTags.put("weight", 50.0); assertFalse(semanticSearchService.isGoodMatch(matchedTags, "blood")); assertFalse(semanticSearchService.isGoodMatch(matchedTags, "weight")); assertTrue(semanticSearchService.isGoodMatch(matchedTags, "height")); Map<String, Double> matchedTags2 = newHashMap(); matchedTags2.put("fasting", 100.0); matchedTags2.put("glucose", 100.0); assertTrue(semanticSearchService.isGoodMatch(matchedTags2, "fasting glucose")); }
boolean isGoodMatch(Map<String, Double> matchedTags, String label) { label = label.toLowerCase(); return matchedTags.containsKey(label) && matchedTags.get(label).intValue() == 100 || Sets.newHashSet(label.split(" ")).stream() .allMatch( word -> matchedTags.containsKey(word) && matchedTags.get(word).intValue() == 100); }
SemanticSearchServiceImpl implements SemanticSearchService { boolean isGoodMatch(Map<String, Double> matchedTags, String label) { label = label.toLowerCase(); return matchedTags.containsKey(label) && matchedTags.get(label).intValue() == 100 || Sets.newHashSet(label.split(" ")).stream() .allMatch( word -> matchedTags.containsKey(word) && matchedTags.get(word).intValue() == 100); } }
SemanticSearchServiceImpl implements SemanticSearchService { boolean isGoodMatch(Map<String, Double> matchedTags, String label) { label = label.toLowerCase(); return matchedTags.containsKey(label) && matchedTags.get(label).intValue() == 100 || Sets.newHashSet(label.split(" ")).stream() .allMatch( word -> matchedTags.containsKey(word) && matchedTags.get(word).intValue() == 100); } SemanticSearchServiceImpl(
      DataService dataService,
      OntologyService ontologyService,
      SemanticSearchServiceHelper semanticSearchServiceHelper,
      ElasticSearchExplainService elasticSearchExplainService,
      OntologyTagService ontologyTagService); }
SemanticSearchServiceImpl implements SemanticSearchService { boolean isGoodMatch(Map<String, Double> matchedTags, String label) { label = label.toLowerCase(); return matchedTags.containsKey(label) && matchedTags.get(label).intValue() == 100 || Sets.newHashSet(label.split(" ")).stream() .allMatch( word -> matchedTags.containsKey(word) && matchedTags.get(word).intValue() == 100); } SemanticSearchServiceImpl(
      DataService dataService,
      OntologyService ontologyService,
      SemanticSearchServiceHelper semanticSearchServiceHelper,
      ElasticSearchExplainService elasticSearchExplainService,
      OntologyTagService ontologyTagService); Hits<ExplainedAttribute> findAttributes(
      EntityType sourceEntityType, Set<String> queryTerms, Collection<OntologyTerm> ontologyTerms); @Override EntityTypeSearchResults findAttributes(
      EntityType sourceEntityType, EntityType targetEntityType, Set<String> searchTerms); @Override AttributeSearchResults findAttributes(
      EntityType sourceEntityType,
      EntityType targetEntityType,
      Attribute targetAttribute,
      Set<String> searchTerms); Set<String> createLexicalSearchQueryTerms(
      Attribute targetAttribute, Set<String> searchTerms); Set<ExplainedQueryString> convertAttributeToExplainedAttribute(
      Attribute attribute, Map<String, String> collectExpandedQueryMap, Query<Entity> query); @Override Hits<OntologyTerm> findOntologyTerms(
      Attribute attribute, Collection<Ontology> ontologies); }
SemanticSearchServiceImpl implements SemanticSearchService { boolean isGoodMatch(Map<String, Double> matchedTags, String label) { label = label.toLowerCase(); return matchedTags.containsKey(label) && matchedTags.get(label).intValue() == 100 || Sets.newHashSet(label.split(" ")).stream() .allMatch( word -> matchedTags.containsKey(word) && matchedTags.get(word).intValue() == 100); } SemanticSearchServiceImpl(
      DataService dataService,
      OntologyService ontologyService,
      SemanticSearchServiceHelper semanticSearchServiceHelper,
      ElasticSearchExplainService elasticSearchExplainService,
      OntologyTagService ontologyTagService); Hits<ExplainedAttribute> findAttributes(
      EntityType sourceEntityType, Set<String> queryTerms, Collection<OntologyTerm> ontologyTerms); @Override EntityTypeSearchResults findAttributes(
      EntityType sourceEntityType, EntityType targetEntityType, Set<String> searchTerms); @Override AttributeSearchResults findAttributes(
      EntityType sourceEntityType,
      EntityType targetEntityType,
      Attribute targetAttribute,
      Set<String> searchTerms); Set<String> createLexicalSearchQueryTerms(
      Attribute targetAttribute, Set<String> searchTerms); Set<ExplainedQueryString> convertAttributeToExplainedAttribute(
      Attribute attribute, Map<String, String> collectExpandedQueryMap, Query<Entity> query); @Override Hits<OntologyTerm> findOntologyTerms(
      Attribute attribute, Collection<Ontology> ontologies);  }