Package org.apache.jena.reasoner

package org.apache.jena.reasoner

The Jena2 reasoner subsystem is designed to allow a range of inference engines to be plugged into Jena. Such reasoners are primarily used to derive additional RDF assertions which are entailed from some base RDF together with any optional ontology information and the axioms and rules associated with the reasoner. In addition, they can be used to test global properties of an RDF graph such as consistency.

This machinery, and the rest of this description, are appropriate for developers working with Graphs and Nodes at the SPI level. Application developers using Models should see the convenience methods built into ModelFactory.

Each available reasoner is represented by an factory object which is an instance of a ReasonerFactory. It is also given a URI through which it can be identified. This URI is used both as the base of a set of RDF assertions which describe the reasoner capabilitiesand as an identifier for registering the reasoner with a central registry. If you only need to access a specific built-in reasoner you can use the factory class directly or the convenience methods built into ModelFactory [TODO: ref]. However, if you need to dynamically check what reasoners are registered with the Jena2 installation and examine their capabilities use the machinery in ReasonerRegistry.

Once you have an appropriate factory you can create a reasoner instance. The instance can then be bound to a set of RDF data for processing. The result of such binding is an InfGraph , this is a specialization of the standard Graph interface - all the RDF assertions entailed from the base data via the reasoner appear as "virtual" triples within this InfGraph. Some additional methods on InfGraph offer access to the reasoner, the raw data and some additional capabilities.

For example, using the SPI all of the steps involved in generated an RDFS closure of a graph are:

  ReasonerFactory rf = RDFSReasonerFactory.theInstance();
  Reasoner reasoner  = rf.create(null);
  InfGraph graph     = reasoner.bindSchema(tbox) // optional
  Model model        = new ModelMem(graph);

For application developers working with the API then this code is accessible through the convenience methods in ModelFactory.

If the resulting graph or model are queried using find/listStatements they contain the sum of all the assertions in the tbox graph, the data graph and the triples entailed from them via RDF+RDFS entailment.

The ability to separately bind rule or ontology information (tbox in the example) and raw assertional information (data in the example) is optional. Some reasoners may require a strict separation of terminology and instance data, others may allow both binds but be lax about the allowed contents of each, others may not support the bindSchema stage.

The existing built-in reasoners allow a single tbox together with a single data bind but the tbox is optional and unrestricted. In the case of the RDFSReasoner in the example, some work is done at bindSchema time to cache information on property and class lattices that may be reused across multiple data sets but the extent of that reuse is lessened if the data graph also contains such schema assertions.

  • Class
    A base level implementation of the InfGraph interface.
    An InfCapabilities notes that size may not be accurate.
    An InfCapabilities notes that size may not be accurate.
    Derivation records are used to determine how an inferred triple was derived from a set of source triples and a reasoner.
    Wrapper round a Graph to implement the slightly modified Finder interface.
    Minimal interface for preforming simple pattern find operations.
    Some simple helper methods used when working with Finders, particularly to compose them into cascade sequences.
    Exception used to signal that a configuration parameter was used (typically in a setParameter call) that was not understood - either because it was not a recognized parameter URI or its value range was incorrect.
    Extends the Graph interface to give additional means to query an inferred graph.
    The minimal interface to which all reasoners (or reasoner adaptors) conform.
    Exception signalling some generic problem with the reasoning subsystem.
    The interface through which a reasoner (inference engine) can be instantiated.
    A global registry of known reasoner modules.
    Default implementation of ValidityReport which simply stores a list of precomputed Report records.
    Datastructure which defines a triple pattern as used in simple rules and in find interfaces.
    Data structure used to report the results of validation or consistency checking operations.