Class TransitiveReasoner

java.lang.Object
org.apache.jena.reasoner.transitiveReasoner.TransitiveReasoner
All Implemented Interfaces:
Reasoner

public class TransitiveReasoner extends Object implements Reasoner
A simple "reasoner" used to help with API development.

This reasoner caches a transitive closure of the subClass and subProperty graphs. The generated infGraph allows both the direct and closed versions of these properties to be retrieved. The cache is built when the tbox is bound in but if the final data graph contains additional subProperty/subClass declarations then the cache has to be rebuilt.

The triples in the tbox (if present) will also be included in any query. Any of tbox or data graph are allowed to be null.

  • Field Details

    • directSubPropertyOf

      public static final Node directSubPropertyOf
      The direct (minimal) version of the subPropertyOf property
    • directSubClassOf

      public static final Node directSubClassOf
      The direct (minimal) version of the subClassOf property
    • subPropertyOf

      public static final Node subPropertyOf
      The normal subPropertyOf property
    • subClassOf

      public static final Node subClassOf
      The normal subClassOf property
  • Constructor Details

    • TransitiveReasoner

      public TransitiveReasoner()
      Constructor
  • Method Details

    • getReasonerCapabilities

      public Model getReasonerCapabilities()
      Return a description of the capabilities of this reasoner encoded in RDF. These capabilities may be static or may depend on configuration information supplied at construction time. May be null if there are no useful capabilities registered.
      Specified by:
      getReasonerCapabilities in interface Reasoner
    • addDescription

      public void addDescription(Model configSpec, Resource base)
      Add a configuration description for this reasoner into a partial configuration specification model.
      Specified by:
      addDescription in interface Reasoner
      Parameters:
      configSpec - a Model into which the configuration information should be placed
      base - the Resource to which the configuration parameters should be added.
    • supportsProperty

      public boolean supportsProperty(Property property)
      Determine whether the given property is recognized and treated specially by this reasoner. This is a convenience packaging of a special case of getCapabilities.
      Specified by:
      supportsProperty in interface Reasoner
      Parameters:
      property - the property which we want to ask the reasoner about, given as a Node since this is part of the SPI rather than API
      Returns:
      true if the given property is handled specially by the reasoner.
    • bindSchema

      public Reasoner bindSchema(Graph tbox) throws ReasonerException
      Extracts all of the subClass and subProperty declarations from the given schema/tbox and caches the resultant graphs. It can only be used once, can't stack up multiple tboxes this way. This limitation could be lifted - the only difficulty is the need to reprocess all the earlier tboxes if a new subPropertyOf subPropertyOf subClassOf is discovered.
      Specified by:
      bindSchema in interface Reasoner
      Parameters:
      tbox - schema containing the property and class declarations
      Returns:
      a reasoner instace which can be used to process a data graph
      Throws:
      ReasonerException - if the reasoner cannot be bound to a rule set in this way, for example if the underlying engine can only accept a single rule set in this way and one rule set has already been bound in of if the ruleset is illformed.
    • bindSchema

      public Reasoner bindSchema(Model tbox) throws ReasonerException
      Extracts all of the subClass and subProperty declarations from the given schema/tbox and caches the resultant graphs. It can only be used once, can't stack up multiple tboxes this way. This limitation could be lifted - the only difficulty is the need to reprocess all the earlier tboxes if a new subPropertyOf subPropertyOf subClassOf is discovered.
      Specified by:
      bindSchema in interface Reasoner
      Parameters:
      tbox - schema containing the property and class declarations
      Returns:
      a reasoner instace which can be used to process a data graph
      Throws:
      ReasonerException - if the reasoner cannot be bound to a rule set in this way, for example if the underlying engine can only accept a single rule set in this way and one rule set has already been bound in of if the ruleset is illformed.
    • bind

      public InfGraph bind(Graph data) throws ReasonerException
      Attach the reasoner to a set of RDF ddata to process. The reasoner may already have been bound to specific rules or ontology axioms (encoded in RDF) through earlier bindRuleset calls.
      Specified by:
      bind in interface Reasoner
      Parameters:
      data - the RDF data to be processed, some reasoners may restrict the range of RDF which is legal here (e.g. syntactic restrictions in OWL).
      Returns:
      an inference graph through which the data+reasoner can be queried.
      Throws:
      ReasonerException - if the data is ill-formed according to the constraints imposed by this reasoner.
    • setDerivationLogging

      public void setDerivationLogging(boolean logOn)
      Switch on/off drivation logging. If set to true then the InfGraph created from the bind operation will start life with recording of derivations switched on. This is currently only of relevance to rule-based reasoners.

      Default - false.

      Specified by:
      setDerivationLogging in interface Reasoner
    • setParameter

      public void setParameter(Property parameter, Object value)
      Set a configuration paramter for the reasoner. In the case of the this reasoner there are no configuration parameters and this method is simply here to meet the interfaces specification
      Specified by:
      setParameter in interface Reasoner
      Parameters:
      parameter - the property identifying the parameter to be changed
      value - the new value for the parameter, typically this is a wrapped java object like Boolean or Integer.
    • getSubPropertyCache

      public TransitiveGraphCache getSubPropertyCache()
      Accessor used during infgraph construction - return the cached version of the subProperty lattice.
    • getSubClassCache

      public TransitiveGraphCache getSubClassCache()
      Accessor used during infgraph construction - return the cached version of the subClass lattice.
    • getTbox

      public Finder getTbox()
      Accessor used during infgraph construction - return the partially bound tbox, if any.
    • getGraphCapabilities

      public Capabilities getGraphCapabilities()
      Return the Jena Graph Capabilties that the inference graphs generated by this reasoner are expected to conform to.
      Specified by:
      getGraphCapabilities in interface Reasoner