|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectJ2OOntologyManager
public class J2OOntologyManager
This class manages the ontologies for the Java2OWL-System.
At compile time, there are usually two ontologies, a background ontology (which may be empty) and an extension ontology. The extension ontology may be filled with translated Java classes and methods. At run time there is the extension ontology or an extension of the original extension ontology.
Although there may be different J2OOntologyManagers with different ontologies in parallel, there is only one global OWL-ontology manager and OWL data factory.
The ontology manager can be in debug mode or run mode (debugMode = false). In debug mode all changes to the ontology are immediately forwarded to the reasoner and consistency is checked immediately. In run mode changes to the ontology are cached until the ontology is accessed in some way.
Notice that most of private variables are not set by the constructor, but when an ontology is loaded.
Thread Safety
All methods which are needed only during compilation and linking phase are not thread safe.
Method Summary | |
---|---|
void |
addIRIMapper(AutoIRIMapper iriMapper)
adds an IRIMapper to the ontology manager. |
boolean |
applyChanges(boolean checkConsistency)
applies the change axioms to the extension ontology. |
void |
finalize()
disposes of the reasoner |
OWLOntology |
getBackgroundOntology()
returns the background ontology. |
Set<Object> |
getDataPropertyValues(OWLNamedIndividual individual,
OWLDataProperty property)
returns all role-fillers for data-properties as Java objects, or null if an error occurred. |
OWLOntology |
getExtensionOntology()
returns the extension ontology. |
OWLDataProperty |
getFirstOWLDataProperty(String name)
returns the first OWLDataProperty in the extensionOntology's import closure whose fragment equals 'name', or null if there is no such property. |
OWLObjectProperty |
getFirstOWLObjectProperty(String name)
returns the first OWLObjectProperty in the extensionOntology's import closure whose fragment equals 'name', or null if there is no such property. |
Set<OWLNamedIndividual> |
getInstances(OWLClassExpression cle)
returns all OWL-instances for the class expression. |
Set<OWLNamedIndividual> |
getInstances(String cles)
returns the OWL-instances for the class expression, or null if an error occurred. |
String |
getName()
returns the name of the ontology manager. |
Set<OWLNamedIndividual> |
getObjectPropertyValues(OWLNamedIndividual individual,
OWLObjectProperty property)
returns all role-fillers for object-properties as OWLNamedindividuals. |
Set<OWLClass> |
getOWLClasses(OWLNamedIndividual individual)
returns the set of lowest OWL-Classes containing the individual, or null if an error occurred. |
ArrayList<OWLClass> |
getOWLClasses(String name)
returns a set of OWLClasses with the given name. |
OWLOntologyManager |
getOWLOntologyManager()
returns the OWL ontology manager (for advances purposes). |
static Set<String> |
getReasoners()
returns the names of all available reasoners. |
boolean |
isConsistent()
returns true if the extension ontology is consistent. |
OWLOntology |
loadBackgroundOntology(String name)
loads the background ontology. |
OWLOntology |
loadExtensionOntology(String name)
loads the extension ontology. |
OWLOntology |
loadOntology(IRI iri,
boolean background)
loads an ontology from an IRI. |
OWLClassExpression |
parseClassExpression(String classExpressionString)
parses a class expression string to obtain a class expression. |
void |
removeAllIndividuals(OWLClass ocl)
creates the change axioms for removing all individuals in the given class. |
void |
removeIndividual(OWLNamedIndividual individual)
creates the change axioms for removing the individual from all ontologies. |
boolean |
saveExtensionOntology()
saves the extension ontology to the same file where it was loaded from OWLOntologyStorageExceptions are logged. |
boolean |
saveExtensionOntology(IRI iri)
saves the extension ontology either to the previously specified IRI, or to the given file. |
boolean |
saveExtensionOntology(String filename)
saves the extension ontology either to the previously specified IRI, or to the given file. |
OWLReasoner |
setReasoner(String reasonerName,
boolean buffering,
boolean monitorProgress,
int timeout)
installs a reasoner for the extension ontology. |
String |
toString()
returns a string representation of the ontology manager. |
Methods inherited from class Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public String getName()
public OWLOntologyManager getOWLOntologyManager()
public OWLOntology getBackgroundOntology()
public OWLOntology getExtensionOntology()
public void addIRIMapper(AutoIRIMapper iriMapper)
public OWLOntology loadOntology(IRI iri, boolean background)
A previously installed ontology is removed (and not saved).
iri
- the document IRI of the ontology.background
- if true, then the background ontology is loaded, otherwise the extension ontology.
public OWLOntology loadBackgroundOntology(String name)
name
- the place to load the ontology from:
- either an IRI as string, stating with http: or file:
- or a pathname of a file where the ontology is stored.
public OWLOntology loadExtensionOntology(String name)
name
- the place to load the ontology from:
- either an IRI as string, stating with http: or file:
- or a pathname of a file where the ontology is stored.
public boolean saveExtensionOntology(IRI iri)
iri
- the IRI where the extension ontology is to be saved.
public boolean saveExtensionOntology(String filename)
filename
- optionally a filename where the ontology is to be stored.
public boolean saveExtensionOntology()
OWLOntologyStorageExceptions are logged.
public void removeIndividual(OWLNamedIndividual individual)
public void removeAllIndividuals(OWLClass ocl)
public OWLDataProperty getFirstOWLDataProperty(String name)
To this end it searches through the imports closure of the extension ontology and the first one it finds with the given name is returned.
public OWLObjectProperty getFirstOWLObjectProperty(String name)
To this end it searches through the imports closure of the extension ontology and the first one it finds with the given name is returned.
public ArrayList<OWLClass> getOWLClasses(String name)
name
- an OWLClass name.
public static Set<String> getReasoners()
public OWLReasoner setReasoner(String reasonerName, boolean buffering, boolean monitorProgress, int timeout)
reasonerName
- the name of the reasoner.buffering
- if true, a buffering reasoner is to be installed.monitorProgress
- if true,a progress monitor is to be installed.timeout
- the timeout (in ms) for complex reasoning tasks.
If there is already an extension ontology then the reasoner is loaded. Otherwise the parameters are stored and the reasoner is loaded after the extension ontology is loaded.
public Set<OWLClass> getOWLClasses(OWLNamedIndividual individual)
individual
- is the OWL-individualpublic Set<OWLNamedIndividual> getInstances(OWLClassExpression cle)
public Set<OWLNamedIndividual> getInstances(String cles) throws ParserException
cles
- an OWL class-expression in Manchester Syntax
ParserException
- if the expression could not be parsed.public OWLClassExpression parseClassExpression(String classExpressionString) throws ParserException
classExpressionString
- The class expression string
ParserException
- if the class expression string is malformed or contains unknown entity names.public boolean isConsistent()
The reasoner may throw a ReasonerInterruptedException or a TimeOutException. In this case an error message is logged and the method returns false.
public boolean applyChanges(boolean checkConsistency)
If the system is in debug mode all changes are flushed to the reasoner and the consistency is checked.
checkConsistency
- causes consistency check in the debug mode.
This method is called either in the compilation phase where no thread safety is implemented, or from methods which are protected by changeAxioms as monitor.
public Set<Object> getDataPropertyValues(OWLNamedIndividual individual, OWLDataProperty property)
OWL-newLiterals which could not be parsed into Java-objects are ignored, only an error message is recorded in the logger.
individual
- the individual whose OWL-role fillers are to he retrieved.property
- the data-property.
public Set<OWLNamedIndividual> getObjectPropertyValues(OWLNamedIndividual individual, OWLObjectProperty property)
individual
- the individual whose OWL-role fillers are to he retrieved.property
- the object-property.
public String toString()
toString
in class Object
public void finalize()
finalize
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |