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 voidafterPropertiesSet()Collection<CharacteristicValueObject>findExperimentsCharacteristicTags(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 choicesMap<OntologyTerm,Long>findObsoleteTermUsage(long timeout, TimeUnit timeUnit)Locates usages of obsolete terms in Characteristics, ignoring Gene Ontology annotations.Collection<OntologySearchResult<OntologyTerm>>findTerms(String search, int maxResults, long timeout, TimeUnit timeUnit)Given a search string will look through the loaded ontologies for terms that match the search term.Collection<CharacteristicValueObject>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.Map<String,OntologyTerm>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.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, long timeout, TimeUnit timeUnit)Obtain the children of a collection of terms.StringgetDefinition(String uri, long timeout, TimeUnit timeUnit)Obtain a definition for the given URI.Set<OntologyTerm>getParents(Collection<OntologyTerm> terms, boolean direct, boolean includeAdditionalProperties, long timeout, TimeUnit timeUnit)Obtain the parents of a collection of terms.Set<OntologyProperty>getRelationTerms()Obtain terms allowed for the predicate (relationship) in aStatement.OntologyTermgetTerm(String uri, long timeout, TimeUnit timeUnit)Obtain a term for the given URI.Set<OntologyTerm>getTerms(Collection<String> uris, long timeout, TimeUnit timeUnit)Return all the terms matching the given URIs.voidreindexAllOntologies()Recreate the search indices, for ontologies that are loaded.voidreinitializeAndReindexAllOntologies()Reinitialize (and reindex) all the ontologies "from scratch".
-
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet() throws Exception- Specified by:
afterPropertiesSetin interfaceInitializingBean- 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:
SearchTimeoutException- if the search times outSearchException
-
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:
SearchTimeoutException- if the search times outSearchException
-
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:
SearchTimeoutException- if the search times outSearchException
-
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:
OntologyTerm.getParents(boolean, boolean)
-
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:
OntologyTerm.getChildren(boolean, boolean)
-
getCategoryTerms
public Set<OntologyTerm> getCategoryTerms()
Description copied from interface:OntologyServiceObtain terms which are allowed for use in the category of aCharacteristic.- Specified by:
getCategoryTermsin interfaceOntologyService
-
getRelationTerms
public Set<OntologyProperty> getRelationTerms()
Description copied from interface:OntologyServiceObtain terms allowed for the predicate (relationship) in aStatement.- Specified by:
getRelationTermsin interfaceOntologyService
-
getDefinition
public String getDefinition(String uri, long timeout, TimeUnit timeUnit) throws TimeoutException
Description copied from interface:OntologyServiceObtain a definition for the given URI.- Specified by:
getDefinitionin interfaceOntologyService- Throws:
TimeoutException
-
getTerm
public OntologyTerm getTerm(String uri, long timeout, TimeUnit timeUnit) throws TimeoutException
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
-
-