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)
OntologyService
initialize
in interface OntologyService
public void closeIndex()
public Collection<OntologyIndividual> findIndividuals(String search) throws OntologySearchException
OntologyService
findIndividuals
in interface OntologyService
OntologySearchException
public Collection<OntologyResource> findResources(String searchString) throws OntologySearchException
OntologyService
findResources
in interface OntologyService
OntologySearchException
public Collection<OntologyTerm> findTerm(String search) throws OntologySearchException
OntologyService
findTerm
in interface OntologyService
OntologySearchException
public OntologyTerm findUsingAlternativeId(String alternativeId)
findUsingAlternativeId
in interface OntologyService
public Set<String> getAllURIs()
getAllURIs
in interface OntologyService
public OntologyResource getResource(String uri)
OntologyService
getResource
in interface OntologyService
public OntologyTerm getTerm(String uri)
OntologyService
getTerm
in interface OntologyService
public Collection<OntologyIndividual> getTermIndividuals(String uri)
getTermIndividuals
in interface OntologyService
public boolean isEnabled()
isEnabled
in interface OntologyService
public boolean isOntologyLoaded()
OntologyService
isOntologyLoaded
in interface OntologyService
public void startInitializationThread(boolean forceLoad, boolean forceIndexing)
OntologyService
If the initialization thread is already running, this method does nothing. If the initialization thread previously completed, the ontology will be reinitialized.
startInitializationThread
in interface OntologyService
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.public boolean isInitializationThreadAlive()
isInitializationThreadAlive
in interface OntologyService
public boolean isInitializationThreadCancelled()
isInitializationThreadCancelled
in interface OntologyService
public void cancelInitializationThread()
cancelInitializationThread
in interface OntologyService
public void waitForInitializationThread() throws InterruptedException
OntologyService
waitForInitializationThread
in interface OntologyService
InterruptedException
protected abstract String getOntologyName()
protected abstract String getOntologyUrl()
protected abstract com.hp.hpl.jena.ontology.OntModel loadModel()
public void index(boolean force)
OntologyService
index
in interface OntologyService
OntologyService.findIndividuals(String)
,
OntologyService.findTerm(String)
,
OntologyService.findResources(String)
public void loadTermsInNameSpace(InputStream is, boolean forceIndex)
OntologyService
loadTermsInNameSpace
in interface OntologyService
is
- 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.