public void collectOntologyTermQueryMap( Map<String, String> expanedQueryMap, OntologyTerm ontologyTerm) { if (ontologyTerm != null) { getOtLabelAndSynonyms(ontologyTerm) .forEach( term -> expanedQueryMap.put(stemmer.cleanStemPhrase(term), ontologyTerm.getLabel())); for (OntologyTerm childOntologyTerm : ontologyService.getChildren(ontologyTerm)) { getOtLabelAndSynonyms(childOntologyTerm) .forEach( term -> expanedQueryMap.put(stemmer.cleanStemPhrase(term), ontologyTerm.getLabel())); } } }
/** * Create a list of string queries based on the information collected from current ontologyterm * including label, synonyms and child ontologyterms * * @param ontologyTerm * @return */ public List<String> parseOntologyTermQueries(OntologyTerm ontologyTerm) { List<String> queryTerms = getOtLabelAndSynonyms(ontologyTerm) .stream() .map(term -> parseQueryString(term)) .collect(Collectors.<String>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; }