public abstract class AbstractOntologyService extends Object implements OntologyService
| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
log |
| Constructor and Description |
|---|
AbstractOntologyService() |
| Modifier and Type | Method and Description |
|---|---|
void |
cancelInitializationThread()
Cancel the initialization thread.
|
void |
closeIndex()
Do not do this except before re-indexing.
|
Collection<OntologyIndividual> |
findIndividuals(String search)
Looks for any OntologyIndividuals that match the given search string.
|
Collection<OntologyResource> |
findResources(String searchString)
Looks for any OntologyIndividuals or ontologyTerms that match the given search string
|
Collection<OntologyTerm> |
findTerm(String search)
Looks for any ontologyTerms that match the given search string.
|
OntologyTerm |
findUsingAlternativeId(String alternativeId) |
Set<String> |
getAllURIs() |
protected abstract String |
getOntologyName()
The simple getOntologyName() of the ontology.
|
protected abstract String |
getOntologyUrl()
Defines the location of the ontology eg: MGED
|
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) |
void |
index(boolean force)
Index the ontology for performing full-text searches.
|
void |
initialize(boolean forceLoad,
boolean forceIndexing)
Initialize this ontology service.
|
boolean |
isEnabled() |
boolean |
isInitializationThreadAlive() |
boolean |
isInitializationThreadCancelled() |
boolean |
isOntologyLoaded()
Used for determining if the Ontology has finished loading into memory.
|
protected abstract com.hp.hpl.jena.ontology.OntModel |
loadModel()
Delegates the call as to load the model into memory or leave it on disk.
|
void |
loadTermsInNameSpace(InputStream is,
boolean forceIndex)
For testing!
|
void |
startInitializationThread(boolean forceLoad,
boolean forceIndexing)
Start the initialization thread.
|
void |
waitForInitializationThread()
Wait for the initialization thread to finish.
|
public void initialize(boolean forceLoad,
boolean forceIndexing)
OntologyServiceinitialize in interface OntologyServicepublic void closeIndex()
public Collection<OntologyIndividual> findIndividuals(String search) throws OntologySearchException
OntologyServicefindIndividuals in interface OntologyServiceOntologySearchExceptionpublic Collection<OntologyResource> findResources(String searchString) throws OntologySearchException
OntologyServicefindResources in interface OntologyServiceOntologySearchExceptionpublic Collection<OntologyTerm> findTerm(String search) throws OntologySearchException
OntologyServicefindTerm in interface OntologyServiceOntologySearchExceptionpublic OntologyTerm findUsingAlternativeId(String alternativeId)
findUsingAlternativeId in interface OntologyServicepublic Set<String> getAllURIs()
getAllURIs in interface OntologyServicepublic OntologyResource getResource(String uri)
OntologyServicegetResource in interface OntologyServicepublic OntologyTerm getTerm(String uri)
OntologyServicegetTerm in interface OntologyServicepublic Collection<OntologyIndividual> getTermIndividuals(String uri)
getTermIndividuals in interface OntologyServicepublic boolean isEnabled()
isEnabled in interface OntologyServicepublic boolean isOntologyLoaded()
OntologyServiceisOntologyLoaded in interface OntologyServicepublic void startInitializationThread(boolean forceLoad,
boolean forceIndexing)
OntologyServiceIf the initialization thread is already running, this method does nothing. If the initialization thread previously completed, the ontology will be reinitialized.
startInitializationThread in interface OntologyServiceforceLoad - 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.public boolean isInitializationThreadAlive()
isInitializationThreadAlive in interface OntologyServicepublic boolean isInitializationThreadCancelled()
isInitializationThreadCancelled in interface OntologyServicepublic void cancelInitializationThread()
cancelInitializationThread in interface OntologyServicepublic void waitForInitializationThread()
throws InterruptedException
OntologyServicewaitForInitializationThread in interface OntologyServiceInterruptedExceptionprotected abstract String getOntologyName()
protected abstract String getOntologyUrl()
protected abstract com.hp.hpl.jena.ontology.OntModel loadModel()
public void index(boolean force)
OntologyServiceindex in interface OntologyServiceOntologyService.findIndividuals(String),
OntologyService.findTerm(String),
OntologyService.findResources(String)public void loadTermsInNameSpace(InputStream is, boolean forceIndex)
OntologyServiceloadTermsInNameSpace in interface OntologyServiceis - 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.