Package ubic.gemma.core.ontology
Class OntologyServiceImpl
- java.lang.Object
-
- ubic.gemma.core.ontology.OntologyServiceImpl
-
- All Implemented Interfaces:
InitializingBean
,OntologyService
@Service public class OntologyServiceImpl extends Object implements OntologyService, InitializingBean
Has a static method for finding out which ontologies are loaded into the system and a general purpose find method that delegates to the many ontology services. NOTE: Logging messages from this service are important for tracking changes to annotations.- Author:
- pavlidis
-
-
Constructor Summary
Constructors Constructor Description OntologyServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
Collection<CharacteristicValueObject>
findExperimentsCharacteristicTags(String searchQueryString, boolean useNeuroCartaOntology)
Using the ontology and values in the database, for a search searchQuery given by the client give an ordered list of possible choicesMap<Characteristic,Long>
findObsoleteTermUsage()
Locates usages of obsolete terms in Characteristics, ignoring Gene Ontology annotations.Collection<OntologyTerm>
findTerms(String search)
Given a search string will look through the loaded ontologies for terms that match the search term.Collection<CharacteristicValueObject>
findTermsInexact(String givenQueryString, Taxon taxon)
Given a search string will first look through the characteristic database for any entries that have a match.Set<OntologyTerm>
getCategoryTerms()
Obtain terms which are allowed for use in the category of aCharacteristic
.Set<OntologyTerm>
getChildren(Collection<OntologyTerm> terms, boolean direct, boolean includeAdditionalProperties)
Obtain the children of a collection of terms.String
getDefinition(String uri)
Obtain a definition for the given URI.Set<OntologyTerm>
getParents(Collection<OntologyTerm> terms, boolean direct, boolean includeAdditionalProperties)
Obtain the parents of a collection of terms.Set<OntologyProperty>
getRelationTerms()
Obtain terms allowed for the predicate (relationship) in aStatement
.OntologyTerm
getTerm(String uri)
Obtain a term for the given URI.Set<OntologyTerm>
getTerms(Collection<String> uris)
Return all the terms matching the given URIs.void
reindexAllOntologies()
Recreate the search indices, for ontologies that are loaded.void
reinitializeAndReindexAllOntologies()
Reinitialize (and reindex) all the ontologies "from scratch".
-
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet() throws Exception
- Specified by:
afterPropertiesSet
in interfaceInitializingBean
- Throws:
Exception
-
findExperimentsCharacteristicTags
public Collection<CharacteristicValueObject> findExperimentsCharacteristicTags(String searchQueryString, boolean useNeuroCartaOntology) throws BaseCodeOntologySearchException
Using the ontology and values in the database, for a search searchQuery given by the client give an ordered list of possible choices- Specified by:
findExperimentsCharacteristicTags
in interfaceOntologyService
- Parameters:
searchQueryString
- search queryuseNeuroCartaOntology
- use neurocarta ontology- Returns:
- characteristic vos
- Throws:
BaseCodeOntologySearchException
-
findTerms
public Collection<OntologyTerm> findTerms(String search) throws BaseCodeOntologySearchException
Description copied from interface:OntologyService
Given a search string will look through the loaded ontologies for terms that match the search term. If the query looks like a URI, it just retrieves the term. For other queries, this a lucene backed search, is inexact and for general terms can return a lot of results.- Specified by:
findTerms
in interfaceOntologyService
- Parameters:
search
- search query- Returns:
- returns a collection of ontologyTerm's
- Throws:
BaseCodeOntologySearchException
-
findTermsInexact
public Collection<CharacteristicValueObject> findTermsInexact(String givenQueryString, @Nullable Taxon taxon) throws SearchException
Description copied from interface:OntologyService
Given a search string will first look through the characteristic database for any entries that have a match. If a ontologyTermURI is given it will add all the individuals from that URI that match the search term criteria to the returned list also.- Specified by:
findTermsInexact
in interfaceOntologyService
- Parameters:
givenQueryString
- query stringtaxon
- Only used if we're going to search for genes or taxon is otherwise relevant; if null, restriction is not used.- Returns:
- characteristic vos
- Throws:
SearchException
-
getParents
public Set<OntologyTerm> getParents(Collection<OntologyTerm> terms, boolean direct, boolean includeAdditionalProperties)
Description copied from interface:OntologyService
Obtain the parents of a collection of terms.- Specified by:
getParents
in interfaceOntologyService
- See Also:
OntologyTerm.getParents(boolean, boolean)
-
getChildren
public Set<OntologyTerm> getChildren(Collection<OntologyTerm> terms, boolean direct, boolean includeAdditionalProperties)
Description copied from interface:OntologyService
Obtain the children of a collection of terms.- Specified by:
getChildren
in interfaceOntologyService
- See Also:
OntologyTerm.getChildren(boolean, boolean)
-
getCategoryTerms
public Set<OntologyTerm> getCategoryTerms()
Description copied from interface:OntologyService
Obtain terms which are allowed for use in the category of aCharacteristic
.- Specified by:
getCategoryTerms
in interfaceOntologyService
-
getRelationTerms
public Set<OntologyProperty> getRelationTerms()
Description copied from interface:OntologyService
Obtain terms allowed for the predicate (relationship) in aStatement
.- Specified by:
getRelationTerms
in interfaceOntologyService
-
getDefinition
public String getDefinition(String uri)
Description copied from interface:OntologyService
Obtain a definition for the given URI.- Specified by:
getDefinition
in interfaceOntologyService
-
getTerm
public OntologyTerm getTerm(String uri)
Description copied from interface:OntologyService
Obtain a term for the given URI.- Specified by:
getTerm
in interfaceOntologyService
-
getTerms
public Set<OntologyTerm> getTerms(Collection<String> uris)
Description copied from interface:OntologyService
Return all the terms matching the given URIs.- Specified by:
getTerms
in interfaceOntologyService
-
reindexAllOntologies
public void reindexAllOntologies()
Description copied from interface:OntologyService
Recreate the search indices, for ontologies that are loaded.- Specified by:
reindexAllOntologies
in interfaceOntologyService
-
reinitializeAndReindexAllOntologies
public void reinitializeAndReindexAllOntologies()
Description copied from interface:OntologyService
Reinitialize (and reindex) all the ontologies "from scratch". This is necessary if indices are old etc. This should be admin-only.- Specified by:
reinitializeAndReindexAllOntologies
in interfaceOntologyService
-
findObsoleteTermUsage
public Map<Characteristic,Long> findObsoleteTermUsage()
Description copied from interface:OntologyService
Locates usages of obsolete terms in Characteristics, ignoring Gene Ontology annotations. Requires the ontologies are loaded into memory.Will also find terms that are no longer in an ontology we use.
- Specified by:
findObsoleteTermUsage
in interfaceOntologyService
- Returns:
- map of value URI to a representative characteristic using the term. The latter will contain a count of how many occurrences there were.
-
-