Package ubic.gemma.core.ontology
Class OntologyServiceImpl
java.lang.Object
ubic.gemma.core.ontology.OntologyServiceImpl
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean,OntologyService
@Service
public class OntologyServiceImpl
extends Object
implements OntologyService, org.springframework.beans.factory.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 -
Method Summary
Modifier and TypeMethodDescriptionvoidfindExperimentsCharacteristicTags(String searchQuery, int maxResults, boolean useNeuroCartaOntology, long timeout, TimeUnit timeUnit) Using the ontology and values in the database, for a search searchQuery given by the client give an ordered list of possible choicesfindObsoleteTermUsage(long timeout, TimeUnit timeUnit) Locates usages of obsolete terms in Characteristics, ignoring Gene Ontology annotations.Given a search string will look through the loaded ontologies for terms that match the search term.findTermsInexact(String queryString, int maxResults, Taxon taxon, long timeout, TimeUnit timeUnit) Given a search string will first look through the characteristic database for any entries that have a match.fixOntologyTermLabels(boolean dryRun, long timeout, TimeUnit timeUnit) Check all system uses of ontology terms for the correct label and fix any mismatches based on the ontology OWL files.Obtain terms which are allowed for use in the category of aCharacteristic.getChildren(Collection<OntologyTerm> terms, boolean direct, boolean includeAdditionalProperties, long timeout, TimeUnit timeUnit) Obtain the children of a collection of terms.getDefinition(String uri, long timeout, TimeUnit timeUnit) Obtain a definition for the given URI.getParents(Collection<OntologyTerm> terms, boolean direct, boolean includeAdditionalProperties, long timeout, TimeUnit timeUnit) Obtain the parents of a collection of terms.Obtain terms allowed for the predicate (relationship) in aStatement.Obtain a term for the given URI.getTerms(Collection<String> uris, long timeout, TimeUnit timeUnit) Return all the terms matching the given URIs.voidRecreate the search indices, for ontologies that are loaded.voidReinitialize (and reindex) all the ontologies "from scratch".
-
Constructor Details
-
OntologyServiceImpl
public OntologyServiceImpl()
-
-
Method Details
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
findExperimentsCharacteristicTags
public Collection<CharacteristicValueObject> findExperimentsCharacteristicTags(String searchQuery, int maxResults, boolean useNeuroCartaOntology, long timeout, TimeUnit timeUnit) throws SearchException 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:
findExperimentsCharacteristicTagsin interfaceOntologyService- Parameters:
searchQuery- search queryuseNeuroCartaOntology- use neurocarta ontology- Returns:
- characteristic vos
- Throws:
SearchException
-
findTerms
public Collection<OntologySearchResult<OntologyTerm>> findTerms(String search, int maxResults, long timeout, TimeUnit timeUnit) throws SearchException Description copied from interface:OntologyServiceGiven 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:
findTermsin interfaceOntologyService- Parameters:
search- search query- Returns:
- returns a collection of ontologyTerm's
- Throws:
SearchException
-
findTermsInexact
public Collection<CharacteristicValueObject> findTermsInexact(String queryString, int maxResults, @Nullable Taxon taxon, long timeout, TimeUnit timeUnit) throws SearchException Description copied from interface:OntologyServiceGiven 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:
findTermsInexactin interfaceOntologyService- Parameters:
queryString- 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, long timeout, TimeUnit timeUnit) throws TimeoutException Description copied from interface:OntologyServiceObtain the parents of a collection of terms.- Specified by:
getParentsin interfaceOntologyService- Throws:
TimeoutException- if the timeout is exceeded- See Also:
-
getChildren
public Set<OntologyTerm> getChildren(Collection<OntologyTerm> terms, boolean direct, boolean includeAdditionalProperties, long timeout, TimeUnit timeUnit) throws TimeoutException Description copied from interface:OntologyServiceObtain the children of a collection of terms.- Specified by:
getChildrenin interfaceOntologyService- Throws:
TimeoutException- if the timeout is exceeded- See Also:
-
getCategoryTerms
Description copied from interface:OntologyServiceObtain terms which are allowed for use in the category of aCharacteristic.- Specified by:
getCategoryTermsin interfaceOntologyService
-
getRelationTerms
Description copied from interface:OntologyServiceObtain terms allowed for the predicate (relationship) in aStatement.- Specified by:
getRelationTermsin interfaceOntologyService
-
getDefinition
Description copied from interface:OntologyServiceObtain a definition for the given URI.- Specified by:
getDefinitionin interfaceOntologyService- Throws:
TimeoutException
-
getTerm
Description copied from interface:OntologyServiceObtain a term for the given URI.- Specified by:
getTermin interfaceOntologyService- Throws:
TimeoutException
-
getTerms
public Set<OntologyTerm> getTerms(Collection<String> uris, long timeout, TimeUnit timeUnit) throws TimeoutException Description copied from interface:OntologyServiceReturn all the terms matching the given URIs.- Specified by:
getTermsin interfaceOntologyService- Throws:
TimeoutException- if the timeout is exceeded
-
reindexAllOntologies
public void reindexAllOntologies()Description copied from interface:OntologyServiceRecreate the search indices, for ontologies that are loaded.- Specified by:
reindexAllOntologiesin interfaceOntologyService
-
reinitializeAndReindexAllOntologies
public void reinitializeAndReindexAllOntologies()Description copied from interface:OntologyServiceReinitialize (and reindex) all the ontologies "from scratch". This is necessary if indices are old etc. This should be admin-only.- Specified by:
reinitializeAndReindexAllOntologiesin interfaceOntologyService
-
findObsoleteTermUsage
public Map<OntologyTerm,Long> findObsoleteTermUsage(long timeout, TimeUnit timeUnit) throws TimeoutException Description copied from interface:OntologyServiceLocates 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:
findObsoleteTermUsagein 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.
- Throws:
TimeoutException
-
fixOntologyTermLabels
public Map<String,OntologyTerm> fixOntologyTermLabels(boolean dryRun, long timeout, TimeUnit timeUnit) throws TimeoutException Description copied from interface:OntologyServiceCheck all system uses of ontology terms for the correct label and fix any mismatches based on the ontology OWL files. This should be run periodically along with findObsoleteTerms.- Specified by:
fixOntologyTermLabelsin interfaceOntologyService- Parameters:
dryRun- if true, no changes will be made in the database and just print them out instead.- Returns:
- Throws:
TimeoutException
-