|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.fluxion.utils.ReasonerSessionManager
public class ReasonerSessionManager
A singleton class for acquiring ReasonerSession
s, thereby providing
access to a pre-classified ontology. To use this class, you should use
OWLOntology ontology = ...
ReasonerSessionManager.createManager().acquireReasonerSession(ontology);
ReasonerSession
that can classify this ontology.
If the ontology you're requesting has been previously classified, and a
reasoner for it is available, a ReasonerSession that has pre-classified this
ontology will be supplied. If not, a new ReasonerSession may be created and
the ontology supplied classified up front.
Note that a ReasonerSession is considered to be available if it can be leased
in
Method Summary | |
---|---|
ReasonerSession |
acquireReasonerSession(org.semanticweb.owl.model.OWLOntology ontology)
Acquire any available reasoner session that supplies a reasoned-over version of the given ontology. |
ReasonerSession |
acquireReasonerSession(org.semanticweb.owl.model.OWLOntology ontology,
int timeout)
Acquire any available reasoner session that supplies a reasoned-over version of the given ontology. |
static ReasonerSessionManager |
createManager()
|
void |
destroy()
Attempts to reclaim all resources this ReasonerSessionManager is currently using, removes all ontologies and reasoners from memory, and shuts down any threads being used to harvest stale results. |
int |
getDefaultTimeout()
Gets the default period of time that this ReasonerSessionManager will wait before creating a new ReasonerSession, whenever acquireReasonerSession(org.semanticweb.owl.model.OWLOntology) is called. |
int |
getMaxNumberOfSessions()
Gets the default maximum number of sessions that can be created. |
int |
getRecycleAfter()
Gets the number of seconds ReasonerSession s
are allowed to remain idle before getting recycled. |
void |
setDefaultTimeout(int defaultTimeout)
Sets the default period of time that this ReasonerSessionManager will wait before creating a new ReasonerSession, whenever acquireReasonerSession(org.semanticweb.owl.model.OWLOntology) is called. |
void |
setMaxNumberOfSessions(int maxSessions)
Sets the default maximum number of sessions that can be created. |
void |
setRecycleAfter(int recycleAfter)
Sets the number of seconds ReasonerSession s
are allowed to remain idle before getting recycled. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static ReasonerSessionManager createManager()
public int getDefaultTimeout()
acquireReasonerSession(org.semanticweb.owl.model.OWLOntology)
is called.
public void setDefaultTimeout(int defaultTimeout)
acquireReasonerSession(org.semanticweb.owl.model.OWLOntology)
is called.
defaultTimeout
- the default timeout period for this reasoner session
managerpublic int getMaxNumberOfSessions()
public int getRecycleAfter()
ReasonerSession
s
are allowed to remain idle before getting recycled. -1 is the default,
meaning ReasonerSessions managed by this manager never get recycled.
Setting this value to a non-negative value will cause ReasonerSessions that
were last leased more than this time period ago to be recycled, reclaiming
any resources they were using.
public void setRecycleAfter(int recycleAfter)
ReasonerSession
s
are allowed to remain idle before getting recycled. -1 is the default,
meaning ReasonerSessions managed by this manager never get recycled.
Setting this value to a non-negative value will cause ReasonerSessions that
were last leased more than this time period ago to be recycled, reclaiming
any resources they were using.
recycleAfter
- the number of seconds to wait before idle reasoner
sessions are recycled and their resources reclaimed.public void setMaxNumberOfSessions(int maxSessions)
maxSessions
- the maximum number of sessions allowedpublic void destroy()
public ReasonerSession acquireReasonerSession(org.semanticweb.owl.model.OWLOntology ontology)
acquireReasonerSession(org.semanticweb.owl.model.OWLOntology, int)
,
substituting a default timeoout period (normally five seconds).
ontology
- the ontology to obtain a reasoner session for
public ReasonerSession acquireReasonerSession(org.semanticweb.owl.model.OWLOntology ontology, int timeout) throws java.lang.RuntimeException
ReasonerSession
can be
obtained within the timeout period specified, it will be returned, and if
not a new ReasonerSession will be fetched and added to the collection of
reasoner sessions for this ontology.
It is important to note that this class imposes no restrictions on
modifications that may be made on the underlying ontology. If you're
application allows scope for programmatically modifying the ontology,
reusing pre-reasoned data may give unexpected or out-of-date results. If
there is a possibility that this has occurred since classification, you
should always re-classify data. If available, you can use incremental
reasoner updates, but this is not managed for you by either this class or
ReasonerSession
.
ontology
- the ontology to obtain a reasoner session fortimeout
- the maximum amount of time to wait before creating a new
reasoner session
java.lang.RuntimeException
- if the maximum number of reasoner sessiosn for
this ontology is exceeded
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |