com.hp.hpl.jena.rdf.model
Interface InfModel

All Superinterfaces:
Lock, Model, ModelCon, ModelGraphInterface, PrefixMapping, RDFReaderF, RDFWriterF
All Known Subinterfaces:
OntModel

public interface InfModel
extends Model

An extension to the normal Model interface that supports access to any underlying inference capability.

In Jena the primary use of inference is to generate additional entailments from a set of RDF data. These entailments just appear as additional RDF data in the inferred model and are accessed through the normal API. For example, if an inference engine can determine the class of a resource "foo" is "fooClass" then all Model API calls such as listStatements and getProperty should act as if the triple:

 foo rdf:type fooClass .
 
were in the data.

A few reasoner services cannot be made directly available in this way and the InfGraph extension gives access to these - specifically access to validation/consistency checking, derivation traces and find-with-posits.

Note that this interface, and especially the interface onto ValidityReports and Derivations are not yet stable.

Version:
$Revision: 1.1 $ on $Date: 2009/06/29 08:55:38 $
Author:
Dave Reynolds

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.hp.hpl.jena.shared.PrefixMapping
PrefixMapping.Factory, PrefixMapping.IllegalPrefixException, PrefixMapping.JenaLockedException
 
Field Summary
 
Fields inherited from interface com.hp.hpl.jena.shared.PrefixMapping
Extended, Standard
 
Fields inherited from interface com.hp.hpl.jena.shared.Lock
READ, WRITE
 
Method Summary
 Model getDeductionsModel()
          Returns a derivations model.
 java.util.Iterator<Derivation> getDerivation(Statement statement)
          Return the derivation of the given statement (which should be the result of some previous list operation).
 Model getRawModel()
          Return the raw RDF model being processed (i.e.
 Reasoner getReasoner()
          Return the Reasoner which is being used to answer queries to this graph.
 StmtIterator listStatements(Resource subject, Property predicate, RDFNode object, Model posit)
          Find all the statements matching a pattern.
 void prepare()
          Perform any initial processing and caching.
 void rebind()
          Cause the inference model to reconsult the underlying data to take into account changes.
 void reset()
          Reset any internal caches.
 void setDerivationLogging(boolean logOn)
          Switch on/off drivation logging.
 ValidityReport validate()
          Test the consistency of the underlying data.
 
Methods inherited from interface com.hp.hpl.jena.rdf.model.Model
abort, add, add, add, add, add, add, begin, close, commit, contains, contains, contains, containsAll, containsAll, containsAny, containsAny, containsResource, createList, createList, createList, createLiteral, createLiteral, createProperty, createReifiedStatement, createReifiedStatement, createResource, createResource, createResource, createStatement, createTypedLiteral, createTypedLiteral, createTypedLiteral, difference, equals, executeInTransaction, getAnyReifiedStatement, getLock, getProperty, getProperty, getReificationStyle, getRequiredProperty, getResource, independent, intersection, isClosed, isEmpty, isIsomorphicWith, isReified, listNameSpaces, listObjects, listObjectsOfProperty, listObjectsOfProperty, listReifiedStatements, listReifiedStatements, listResourcesWithProperty, listResourcesWithProperty, listStatements, listStatements, listStatements, listSubjects, listSubjectsWithProperty, listSubjectsWithProperty, notifyEvent, query, read, read, read, read, read, read, read, register, remove, remove, remove, removeAll, removeAll, removeAllReifications, removeReification, size, supportsSetOperations, supportsTransactions, union, unregister, write, write, write, write, write, write
 
Methods inherited from interface com.hp.hpl.jena.rdf.model.ModelCon
add, add, add, add, add, addLiteral, addLiteral, addLiteral, addLiteral, addLiteral, addLiteral, addLiteral, addLiteral, contains, contains, containsLiteral, containsLiteral, containsLiteral, containsLiteral, containsLiteral, containsLiteral, containsLiteral, createAlt, createAlt, createBag, createBag, createLiteral, createLiteralStatement, createLiteralStatement, createLiteralStatement, createLiteralStatement, createLiteralStatement, createLiteralStatement, createLiteralStatement, createProperty, createResource, createResource, createResource, createResource, createSeq, createSeq, createStatement, createStatement, createStatement, createStatement, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, getAlt, getAlt, getBag, getBag, getProperty, getRDFNode, getResource, getSeq, getSeq, listLiteralStatements, listLiteralStatements, listLiteralStatements, listLiteralStatements, listLiteralStatements, listResourcesWithProperty, listResourcesWithProperty, listResourcesWithProperty, listResourcesWithProperty, listResourcesWithProperty, listResourcesWithProperty, listStatements, listStatements, listSubjectsWithProperty, listSubjectsWithProperty, remove, remove, remove, remove
 
Methods inherited from interface com.hp.hpl.jena.rdf.model.ModelGraphInterface
asRDFNode, asStatement, getGraph, queryHandler, wrapAsResource
 
Methods inherited from interface com.hp.hpl.jena.rdf.model.RDFReaderF
getReader, getReader, setReaderClassName
 
Methods inherited from interface com.hp.hpl.jena.rdf.model.RDFWriterF
getWriter, getWriter, setWriterClassName
 
Methods inherited from interface com.hp.hpl.jena.shared.PrefixMapping
expandPrefix, getNsPrefixMap, getNsPrefixURI, getNsURIPrefix, lock, qnameFor, removeNsPrefix, samePrefixMappingAs, setNsPrefix, setNsPrefixes, setNsPrefixes, shortForm, withDefaultMappings
 
Methods inherited from interface com.hp.hpl.jena.shared.Lock
enterCriticalSection, leaveCriticalSection
 

Method Detail

getRawModel

Model getRawModel()
Return the raw RDF model being processed (i.e. the argument to the Reasonder.bind call that created this InfModel).


getReasoner

Reasoner getReasoner()
Return the Reasoner which is being used to answer queries to this graph.


rebind

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.


prepare

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 prepration is done rather than just leaving to be done at first query time.


reset

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.


validate

ValidityReport validate()
Test the consistency of the underlying data. This normally tests the validity of the bound instance data against the bound schema data.

Logically inconsistent models will be indicated by a ValidityReport which reports isValid() as false. Additional non.error problems, such as uninstantiatable classes, may be reported as warnings.

Returns:
a ValidityReport structure

listStatements

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.

Parameters:
subject - The subject sought
predicate - The predicate sought
object - The value sought
Returns:
an iterator over the subjects

setDerivationLogging

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!


getDerivation

java.util.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.

Returns:
an iterator over Derivation records or null if there is no derivation information available for this triple.
See Also:
Derviation

getDeductionsModel

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.

Returns:
the deductions model, if relevant for this class of inference engine or null if not.


Copyright © 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP