Skip to content

2.3. Methods of a Descriptor object

Luca Buoncompagni edited this page Apr 8, 2024 · 2 revisions

Once a descriptor is instantiated with a specific ground (i.e., OWLEntity) and reference to an ontology file (i.e., using Java-class OntologyReference), it offers the following methods:

  • add(): adds axioms (i.e, entitySet) to the internal state of the descriptor, based on the ground and a particular expression. An example shows how to add axioms.
  • remove(): removes axioms (i.e, entitySet) from the internal state of the descriptor, based on the ground and a particular expression. An example shows how to remove axioms.
  • build(): allows to build one descriptor from another. For example, if the ground of an individual descriptor is corridor1 and this individual descriptor implements the Type expression, which allows to find the ontological type of the individual corridor1. Then, by using the build() method we get a class descriptor whose ground is the ontological type of the individual corridor1. An example shows how to build one descriptor from another.
  • readExpressionAxioms(): modifies the descriptor's internal state (the representation of the ontology within the OOP domain) to be equal to the state of the ontology. It reads the asserted and inferred axioms from the ontology. Furthermore, this method returns the modifications it makes, to its internal state. Note that, by default it does not call the reasoning task (this can be changed by a flag).
  • writeExpressionAxioms(): modifies the state of the ontology to be equal to the the descriptor's internal state. Furthermore, this method returns the modifications it makes, to the state of the ontology. Note that, by default it does not call the reasoning task.
  • get(): gets the axioms (i.e, entitySet) based on the ground and expression. Based on the most recent readExpressionAxioms() or writeExpressionAxioms().
  • query(): gets the axioms (i.e, entitySet) based on the ground and expression. By doing readExpressionAxioms().
  • reason(): it synchronizes the reasoner to obtain the latest inferences in the ontology.
  • saveOntology(pathToOntoFile): it allows to save the current state of the ontology in the path provided in the method's parameter.
  • load(): the methods in OWLOOP that allow to "load" an ontology into the program memory start with the word new. For example, newOWLReferencesCreatedWithPellet() and newOWLReferencesFromWithPellet(). Notice that an ontology is loaded into program memory by already associating it with a reasoner. In the methods mentioned previously the reasoner is Pellet.

Access to OWL-API from OWLOOP API

Apart from the above commonly used Descriptor methods, each Descriptor provides getOntologyReference() method. This Descriptor method returns reference to the ontology file (i.e., an object of the class OWLReference) with which it is associated. Using OWLReference you have access to classes provided by OWL-API via methods in aMOR. Note that, helper methods in aMOR allow access to the OWL-API classes OWLOntologyManager, OWLDataFactory, OWLOntology and OWLReasoner.

Hint

You may want to use Protege to add sophisticated axioms or rules, that do not change in the ontology at run time and load that ontology as a starting point for your system.