public interface OntologyService
Modifier and Type | Interface and Description |
---|---|
static class |
OntologyService.InferenceMode |
Modifier and Type | Method and Description |
---|---|
void |
cancelInitializationThread()
Cancel a running initialization thread.
|
default Collection<OntologyIndividual> |
findIndividuals(String search)
Looks for any individuals that match the given search string.
|
Collection<OntologyIndividual> |
findIndividuals(String search,
boolean keepObsoletes)
Looks for any individuals that match the given search string.
|
default Collection<OntologyResource> |
findResources(String searchString)
Looks for any resources (terms or individuals) that match the given search string
|
Collection<OntologyResource> |
findResources(String search,
boolean keepObsoletes)
Looks for any resources (terms or individuals) that match the given search string
|
default Collection<OntologyTerm> |
findTerm(String search)
Looks for any terms that match the given search string.
|
Collection<OntologyTerm> |
findTerm(String search,
boolean keepObsoletes)
Looks for any terms that match the given search string.
|
OntologyTerm |
findUsingAlternativeId(String alternativeId)
Find a term using an alternative ID.
|
Set<String> |
getAllURIs()
Obtain all the resource URIs in this ontology.
|
default Set<OntologyTerm> |
getChildren(Collection<OntologyTerm> terms,
boolean direct,
boolean includeAdditionalProperties)
Obtain all the children of a given set of terms, excluding obsolete terms.
|
Set<OntologyTerm> |
getChildren(Collection<OntologyTerm> terms,
boolean direct,
boolean includeAdditionalProperties,
boolean keepObsoletes)
Obtain all the children of a given set of terms.
|
OntologyService.InferenceMode |
getInferenceMode()
Obtain the inference mode used for this ontology.
|
default Set<OntologyTerm> |
getParents(Collection<OntologyTerm> terms,
boolean direct,
boolean includeAdditionalProperties)
Obtain all the parents of a given set of terms, excluding obsolete terms.
|
Set<OntologyTerm> |
getParents(Collection<OntologyTerm> terms,
boolean direct,
boolean includeAdditionalProperties,
boolean keepObsoletes)
Obtain all the parents of a given set of terms.
|
boolean |
getProcessImports() |
OntologyResource |
getResource(String uri)
Looks through both Terms and Individuals for a OntologyResource that has a uri matching the uri given.
|
OntologyTerm |
getTerm(String uri)
Looks for a OntologyTerm that has the match in URI given
|
Collection<OntologyIndividual> |
getTermIndividuals(String uri)
Obtain all the individuals for a given term URI.
|
void |
index(boolean force)
Index the ontology for performing full-text searches.
|
void |
initialize(boolean forceLoad,
boolean forceIndexing)
Initialize this ontology service.
|
void |
initialize(InputStream stream,
boolean forceIndexing)
Initialize this ontology service from a stream.
|
boolean |
isEnabled()
Check if this ontology is enabled.
|
boolean |
isInitializationThreadAlive()
Check if the initialization thread is alive.
|
boolean |
isInitializationThreadCancelled()
Check if the initialization thread is cancelled.
|
boolean |
isOntologyLoaded()
Used for determining if the Ontology has finished loading into memory.
|
boolean |
isSearchEnabled() |
void |
loadTermsInNameSpace(InputStream is,
boolean forceIndex)
Deprecated.
use
initialize(InputStream, boolean) instead and possibly cancelInitializationThread()
prior to get any running initialization thread out of the way |
void |
setInferenceMode(OntologyService.InferenceMode inferenceMode)
Set the inference mode used for this ontology.
|
void |
setProcessImports(boolean processImports) |
void |
setSearchEnabled(boolean searchEnabled) |
void |
startInitializationThread(boolean forceLoad,
boolean forceIndexing)
Start the initialization thread.
|
void |
waitForInitializationThread()
Wait for the initialization thread to finish.
|
boolean getProcessImports()
void setProcessImports(boolean processImports)
OntologyService.InferenceMode getInferenceMode()
void setInferenceMode(OntologyService.InferenceMode inferenceMode)
Changes are applicable only if the service is re-initialized.
boolean isSearchEnabled()
void setSearchEnabled(boolean searchEnabled)
void initialize(boolean forceLoad, boolean forceIndexing)
forceLoad
- Force loading of ontology, even if it is already loadedforceIndexing
- If forceLoad is also true, indexing will be performed. If you know the index is up-to-date,
there's no need to do it again. Normally indexing is only done if there is no index, or if
the ontology has changed since last loaded.void initialize(InputStream stream, boolean forceIndexing)
Note that when this method of initialization is used, the ontology cache is not created on-disk.
default Collection<OntologyIndividual> findIndividuals(String search) throws OntologySearchException
Obsolete terms are filtered out.
OntologySearchException
Collection<OntologyIndividual> findIndividuals(String search, boolean keepObsoletes) throws OntologySearchException
search
- search querykeepObsoletes
- retain obsolete termsOntologySearchException
default Collection<OntologyResource> findResources(String searchString) throws OntologySearchException
Obsolete terms are filtered out.
OntologySearchException
Collection<OntologyResource> findResources(String search, boolean keepObsoletes) throws OntologySearchException
search
- search querykeepObsoletes
- retain obsolete termsOntologySearchException
default Collection<OntologyTerm> findTerm(String search) throws OntologySearchException
Obsolete terms are filtered out.
OntologySearchException
Collection<OntologyTerm> findTerm(String search, boolean keepObsoletes) throws OntologySearchException
search
- search querykeepObsoletes
- retain obsolete termsOntologySearchException
@Nullable OntologyTerm findUsingAlternativeId(String alternativeId)
@Nullable OntologyResource getResource(String uri)
@Nullable OntologyTerm getTerm(String uri)
Collection<OntologyIndividual> getTermIndividuals(String uri)
default Set<OntologyTerm> getParents(Collection<OntologyTerm> terms, boolean direct, boolean includeAdditionalProperties)
Set<OntologyTerm> getParents(Collection<OntologyTerm> terms, boolean direct, boolean includeAdditionalProperties, boolean keepObsoletes)
terms
- set of terms whose parents are retrieveddirect
- only retain direct parentsincludeAdditionalProperties
- also include parents matched via additional propertieskeepObsoletes
- retain obsolete termsdefault Set<OntologyTerm> getChildren(Collection<OntologyTerm> terms, boolean direct, boolean includeAdditionalProperties)
Set<OntologyTerm> getChildren(Collection<OntologyTerm> terms, boolean direct, boolean includeAdditionalProperties, boolean keepObsoletes)
terms
- set of terms whose children are retrieveddirect
- only retain direct childrenincludeAdditionalProperties
- also include children matched via additional propertieskeepObsoletes
- retain obsolete termsboolean isEnabled()
boolean isOntologyLoaded()
void startInitializationThread(boolean forceLoad, boolean forceIndexing)
If the initialization thread is already running, this method does nothing. If the initialization thread previously completed, the ontology will be reinitialized.
forceLoad
- Force loading of ontology, even if it is already loadedforceIndexing
- If forceLoad is also true, indexing will be performed. If you know the index is
up to date, there's no need to do it again. Normally indexing is only done if there is no
index, or if the ontology has changed since last loaded.boolean isInitializationThreadAlive()
boolean isInitializationThreadCancelled()
void cancelInitializationThread()
void waitForInitializationThread() throws InterruptedException
InterruptedException
void index(boolean force)
force
- if true, perform indexing even if an index already existsfindIndividuals(String)
,
findTerm(String)
,
findResources(String)
@Deprecated void loadTermsInNameSpace(InputStream is, boolean forceIndex)
initialize(InputStream, boolean)
instead and possibly cancelInitializationThread()
prior to get any running initialization thread out of the wayis
- input stream from which the ontology model is loadedforceIndex
- initialize the index. Otherwise it will only be initialized if it doesn't exist.Copyright © 2003–2023 UBC Michael Smith Laboratories. All rights reserved.