Class SemanticSearchServiceHelper
- java.lang.Object
-
- org.molgenis.semanticsearch.service.impl.SemanticSearchServiceHelper
-
public class SemanticSearchServiceHelper extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static intMAX_NUM_TAGS
-
Constructor Summary
Constructors Constructor Description SemanticSearchServiceHelper(org.molgenis.data.DataService dataService, org.molgenis.ontology.core.service.OntologyService ontologyService, org.molgenis.ontology.core.ic.TermFrequencyService termFrequencyService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,String>collectExpandedQueryMap(Set<String> queryTerms, Collection<org.molgenis.ontology.core.model.OntologyTerm> ontologyTerms)voidcollectOntologyTermQueryMap(Map<String,String> expanedQueryMap, org.molgenis.ontology.core.model.OntologyTerm ontologyTerm)org.molgenis.data.QueryRulecreateBoostedDisMaxQueryRuleForTerms(List<String> queryTerms, Double boostValue)Create a disMaxQueryRule with corresponding boosted valueorg.molgenis.data.QueryRulecreateDisMaxQueryRuleForAttribute(Set<String> searchTerms, Collection<org.molgenis.ontology.core.model.OntologyTerm> ontologyTerms)Create a disMaxJunc query rule based on the given search terms as well as the information from given ontology termsorg.molgenis.data.QueryRulecreateDisMaxQueryRuleForTerms(List<String> queryTerms)Create disMaxJunc query rule based a list of queryTerm.org.molgenis.data.QueryRulecreateShouldQueryRule(String multiOntologyTermIri)Create a boolean should query for composite tags containing multiple ontology termsStringescapeCharsExcludingCaretChar(String string)List<org.molgenis.ontology.core.model.OntologyTerm>findTags(String description, List<String> ontologyIds)List<String>getAttributeIdentifiers(org.molgenis.data.meta.model.EntityType sourceEntityType)A helper function that gets identifiers of all the attributes from one EntityTypeSet<String>getOtLabelAndSynonyms(org.molgenis.ontology.core.model.OntologyTerm ontologyTerm)A helper function to collect synonyms as well as label of ontologytermStringparseBoostQueryString(String queryString, double boost)List<String>parseOntologyTermQueries(org.molgenis.ontology.core.model.OntologyTerm ontologyTerm)Create a list of string queries based on the information collected from current ontologyterm including label, synonyms and child ontologytermsStringprocessQueryString(String queryString)Set<String>removeStopWords(String description)
-
-
-
Field Detail
-
MAX_NUM_TAGS
public static final int MAX_NUM_TAGS
- See Also:
- Constant Field Values
-
-
Method Detail
-
createDisMaxQueryRuleForAttribute
public org.molgenis.data.QueryRule createDisMaxQueryRuleForAttribute(Set<String> searchTerms, Collection<org.molgenis.ontology.core.model.OntologyTerm> ontologyTerms)
Create a disMaxJunc query rule based on the given search terms as well as the information from given ontology terms- Returns:
- disMaxJunc queryRule
-
createDisMaxQueryRuleForTerms
public org.molgenis.data.QueryRule createDisMaxQueryRuleForTerms(List<String> queryTerms)
Create disMaxJunc query rule based a list of queryTerm. All queryTerms are lower cased and stop words are removed- Returns:
- disMaxJunc queryRule
-
createBoostedDisMaxQueryRuleForTerms
public org.molgenis.data.QueryRule createBoostedDisMaxQueryRuleForTerms(List<String> queryTerms, Double boostValue)
Create a disMaxQueryRule with corresponding boosted value- Returns:
- a disMaxQueryRule with boosted value
-
createShouldQueryRule
public org.molgenis.data.QueryRule createShouldQueryRule(String multiOntologyTermIri)
Create a boolean should query for composite tags containing multiple ontology terms- Returns:
- return a boolean should queryRule
-
parseOntologyTermQueries
public List<String> parseOntologyTermQueries(org.molgenis.ontology.core.model.OntologyTerm ontologyTerm)
Create a list of string queries based on the information collected from current ontologyterm including label, synonyms and child ontologyterms
-
getOtLabelAndSynonyms
public Set<String> getOtLabelAndSynonyms(org.molgenis.ontology.core.model.OntologyTerm ontologyTerm)
A helper function to collect synonyms as well as label of ontologyterm- Returns:
- a list of synonyms plus label
-
collectExpandedQueryMap
public Map<String,String> collectExpandedQueryMap(Set<String> queryTerms, Collection<org.molgenis.ontology.core.model.OntologyTerm> ontologyTerms)
-
collectOntologyTermQueryMap
public void collectOntologyTermQueryMap(Map<String,String> expanedQueryMap, org.molgenis.ontology.core.model.OntologyTerm ontologyTerm)
-
getAttributeIdentifiers
public List<String> getAttributeIdentifiers(org.molgenis.data.meta.model.EntityType sourceEntityType)
A helper function that gets identifiers of all the attributes from one EntityType
-
findTags
public List<org.molgenis.ontology.core.model.OntologyTerm> findTags(String description, List<String> ontologyIds)
-
-