Package ubic.gemma.core.ontology
Interface OntologyService
-
- All Known Implementing Classes:
OntologyServiceImpl
public interface OntologyService
- Author:
- Paul
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description Collection<CharacteristicValueObject>
findExperimentsCharacteristicTags(String searchQuery, int maxResults, boolean useNeuroCartaOntology, long timeout, TimeUnit timeUnit)
Deprecated.Map<OntologyTerm,Long>
findObsoleteTermUsage(long timeout, TimeUnit timeUnit)
Locates usages of obsolete terms in Characteristics, ignoring Gene Ontology annotations.Collection<OntologySearchResult<OntologyTerm>>
findTerms(String query, 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 givenQueryString, 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> matchingTerms, boolean direct, boolean includeAdditionalProperties, long timeout, TimeUnit timeUnit)
Obtain the children of a collection of terms.String
getDefinition(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
.OntologyTerm
getTerm(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.void
reindexAllOntologies()
Recreate the search indices, for ontologies that are loaded.void
reinitializeAndReindexAllOntologies()
Reinitialize (and reindex) all the ontologies "from scratch".
-
-
-
Method Detail
-
findObsoleteTermUsage
Map<OntologyTerm,Long> findObsoleteTermUsage(long timeout, TimeUnit timeUnit) throws TimeoutException
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.
- 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
-
findExperimentsCharacteristicTags
@Deprecated Collection<CharacteristicValueObject> findExperimentsCharacteristicTags(String searchQuery, int maxResults, boolean useNeuroCartaOntology, long timeout, TimeUnit timeUnit) throws SearchException
Deprecated.Using the ontology and values in the database, for a search searchQuery given by the client give an ordered list of possible choices- Parameters:
searchQuery
- search queryuseNeuroCartaOntology
- use neurocarta ontology- Returns:
- characteristic vos
- Throws:
SearchTimeoutException
- if the search times outSearchException
-
findTerms
Collection<OntologySearchResult<OntologyTerm>> findTerms(String query, int maxResults, long timeout, TimeUnit timeUnit) throws SearchException
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.- Parameters:
query
- search query- Returns:
- returns a collection of ontologyTerm's
- Throws:
SearchTimeoutException
- if the search times outSearchException
-
findTermsInexact
Collection<CharacteristicValueObject> findTermsInexact(String givenQueryString, int maxResults, @Nullable Taxon taxon, long timeout, TimeUnit timeUnit) throws SearchException
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.- Parameters:
taxon
- Only used if we're going to search for genes or taxon is otherwise relevant; if null, restriction is not used.givenQueryString
- query string- Returns:
- characteristic vos
- Throws:
SearchTimeoutException
- if the search times outSearchException
-
getCategoryTerms
Set<OntologyTerm> getCategoryTerms()
Obtain terms which are allowed for use in the category of aCharacteristic
.
-
getRelationTerms
Set<OntologyProperty> getRelationTerms()
Obtain terms allowed for the predicate (relationship) in aStatement
.
-
getParents
Set<OntologyTerm> getParents(Collection<OntologyTerm> terms, boolean direct, boolean includeAdditionalProperties, long timeout, TimeUnit timeUnit) throws TimeoutException
Obtain the parents of a collection of terms.- Throws:
TimeoutException
- if the timeout is exceeded- See Also:
OntologyTerm.getParents(boolean, boolean)
-
getChildren
Set<OntologyTerm> getChildren(Collection<OntologyTerm> matchingTerms, boolean direct, boolean includeAdditionalProperties, long timeout, TimeUnit timeUnit) throws TimeoutException
Obtain the children of a collection of terms.- Throws:
TimeoutException
- if the timeout is exceeded- See Also:
OntologyTerm.getChildren(boolean, boolean)
-
getDefinition
@Nullable String getDefinition(String uri, long timeout, TimeUnit timeUnit) throws TimeoutException
Obtain a definition for the given URI.- Throws:
TimeoutException
-
getTerm
@Nullable OntologyTerm getTerm(String uri, long timeout, TimeUnit timeUnit) throws TimeoutException
Obtain a term for the given URI.- Throws:
TimeoutException
-
getTerms
Set<OntologyTerm> getTerms(Collection<String> uris, long timeout, TimeUnit timeUnit) throws TimeoutException
Return all the terms matching the given URIs.- Throws:
TimeoutException
- if the timeout is exceeded
-
reindexAllOntologies
void reindexAllOntologies()
Recreate the search indices, for ontologies that are loaded.
-
reinitializeAndReindexAllOntologies
void reinitializeAndReindexAllOntologies()
Reinitialize (and reindex) all the ontologies "from scratch". This is necessary if indices are old etc. This should be admin-only.
-
fixOntologyTermLabels
Map<String,OntologyTerm> fixOntologyTermLabels(boolean dryRun, long timeout, TimeUnit timeUnit) throws TimeoutException
Check 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.- Parameters:
dryRun
- if true, no changes will be made in the database and just print them out instead.- Returns:
- Throws:
TimeoutException
-
-