Class InfModelImpl

All Implemented Interfaces:
InfModel, Model, ModelCon, ModelGraphInterface, RDFReaderF, RDFWriterF, Lock, PrefixMapping

public class InfModelImpl extends ModelCom implements InfModel
Default implementation of the InfModel interface which simply wraps up an InfGraph.
  • Constructor Details

    • InfModelImpl

      public InfModelImpl(InfGraph infgraph)
      infgraph - the InfGraph, as generated by a reasoner.bind operation, to be packaged up.
  • Method Details

    • getInfGraph

      public InfGraph getInfGraph()
      Return the underlying inference graph for this model.
    • getRawModel

      public Model getRawModel()
      Return the raw RDF model being processed (i.e. the argument to the Reasoner.bind call that created this InfModel).
      Specified by:
      getRawModel in interface InfModel
    • getReasoner

      public Reasoner getReasoner()
      Return the Reasoner which is being used to answer queries to this graph.
      Specified by:
      getReasoner in interface InfModel
    • rebind

      public void rebind()
      Cause the inference model to reconsult the underlying data to take into account changes. Normally changes are made through the InfModel's add and remove calls are will be handled appropriately. However, in some cases changes are made "behind the InfModels's back" and this forces a full reconsult of the changed data.
      Specified by:
      rebind in interface InfModel
    • prepare

      public void prepare()
      Perform any initial processing and caching. This call is optional. Most engines either have negligable set up work or will perform an implicit "prepare" if necessary. The call is provided for those occasions where substantial preparation work is possible (e.g. running a forward chaining rule system) and where an application might wish greater control over when this preparation is done rather than just leaving to be done at first query time.
      Specified by:
      prepare in interface InfModel
    • reset

      public void reset()
      Reset any internal caches. Some systems, such as the tabled backchainer, retain information after each query. A reset will wipe this information preventing unbounded memory use at the expense of more expensive future queries. A reset does not cause the raw data to be reconsulted and so is less expensive than a rebind.
      Specified by:
      reset in interface InfModel
    • validate

      public ValidityReport validate()
      Test the consistency of the underlying data. This normally tests the validity of the bound instance data against the bound schema data.
      Specified by:
      validate in interface InfModel
      a ValidityReport structure
    • listStatements

      public StmtIterator listStatements(Resource subject, Property predicate, RDFNode object, Model posit)
      Find all the statements matching a pattern.

      Return an iterator over all the statements in a model that match a pattern. The statements selected are those whose subject matches the subject argument, whose predicate matches the predicate argument and whose object matchesthe object argument. If an argument is null it matches anything.

      The s/p/o terms may refer to resources which are temporarily defined in the "posit" model. This allows one, for example, to query what resources are of type CE where CE is a class expression rather than a named class - put CE in the posit arg.

      Specified by:
      listStatements in interface InfModel
      subject - The subject sought
      predicate - The predicate sought
      object - The value sought
      an iterator over the subjects
    • setDerivationLogging

      public void setDerivationLogging(boolean logOn)
      Switch on/off drivation logging. If this is switched on then every time an inference is a made that fact is recorded and the resulting record can be access through a later getDerivation call. This may consume a lot of space!
      Specified by:
      setDerivationLogging in interface InfModel
    • getDerivation

      public Iterator<Derivation> getDerivation(Statement statement)
      Return the derivation of the given statement (which should be the result of some previous list operation). Not all reasoneers will support derivations.
      Specified by:
      getDerivation in interface InfModel
      an iterator over Derivation records or null if there is no derivation information available for this triple.
      See Also:
    • getDeductionsModel

      public Model getDeductionsModel()
      Returns a derivations model. The rule reasoners typically create a graph containing those triples added to the base graph due to rule firings. In some applications it can useful to be able to access those deductions directly, without seeing the raw data which triggered them. In particular, this allows the forward rules to be used as if they were rewrite transformation rules.
      Specified by:
      getDeductionsModel in interface InfModel
      the deductions model, if relevant for this class of inference engine or null if not.