Using TrOWL for Ontology Stream Reasoning

1. Overview

TrOWL (from v0.9.0) includes two reasoners that support stream reasoning (see also Publication page for details). Both of these two reasoners extend the OWLReasoner interface in the OWLAPI; therefore, they provide most frequently used reasoning services.

  • The eu.trowl.owlapi3.rel.tms.reasoner.el.RELReasoner supports tractable TBox stream reasoning for EL+ (sound and complete).
  • The eu.trowl.owlapi3.rel.tms.reasoner.dl.RELReasoner supports sound and tractable approximate ABox stream reasoning for SHIQ.

2. Stream Reasoning with TrOWL

To use stream reasoning, first create a reasoner for the original ontology. Depending on the types of dynamics (TBox vs. ABox) required, select one of the above two reasoner classes:

RELReasonerFactory relfactory = new RELReasonerFactory();
RELReasoner reasoner = relfactory.createReasoner(ontology);

To remove some axioms from the active ontology, the following method can be used, where the parameter is a Set<OWLAxiom>:

reasoner.clean(Set<OWLAxiom> toDel);

To add some axioms into the active ontology, the following method can be used, where the parameter can be either a Set<OWLAxiom> or an OWLOntology:

reasoner.add(Set<OWLAxiom>/OWLOntology toAdd);

The above update can be performed multiple times. After updating the ontology, the following method can be used to update the reasoning results. This method will not re-compute everything, and will reuse existing results and intermediate results:

reasoner.reclassify();

After updating the results, they can be retrieved as in a normal reasoner. In the current release, reasoner APIs only support concept and property expressions in the ontology, but not arbitrary ones.

3.Approximate Justification with TrOWL Stream Reasoning

Thanks to the use of a truth maintenance system, TrOWL is capable of computing and maintaining the approximate justification of all inferred results on-the-fly. So far, TrOWL provides justifications for 3 types of entailments, namely atomic concept subsumption, atomic class assertion and atomic object property assertion. To retrieve the approximate justifications, using the following 3 methods, respectively. They are available in both of the above two reasoner classes.

  • Justifications of atomic concept subsumptions: AxiomPool reasoner.justify(OWLClass subcls, OWLClass supercls);
  • Justifications of atomic class assertion: AxiomPool reasoner.justify(OWLIndividual instance, OWLClass cls);
  • Justifications of atomic object property assertion: AxiomPool reasoner.justify(OWLIndividual subject, OWLObjectProperty prop, OWLIndividual object);

The return type AxiomPool of the above methods contains a HashSet<OWLLogicalAxiom> that constitutes the approximate justification. These axioms can be directly retrieved by AxiomPool.axioms.

The following should be noted regarding the approximate justification:

  • If the entailment is a tautology, the returned result of the justify methods will be null.
  • For each entailment, TrOWL maintains at most one approximate justification, which is the one used to derive the entailment.
  • The returned justifications are approximate ones, which either contain or are equivalant to exact justifications.

More details can be found in the TrOWLTMSTBoxDemo.java and TrOWLTMSABoxDemo.java files (in the release).