com.hp.hpl.jena.reasoner.dig
Class DIGInfGraph

java.lang.Object
  extended by com.hp.hpl.jena.graph.impl.GraphBase
      extended by com.hp.hpl.jena.reasoner.BaseInfGraph
          extended by com.hp.hpl.jena.reasoner.dig.DIGInfGraph
All Implemented Interfaces:
Graph, GraphAdd, com.hp.hpl.jena.graph.impl.GraphWithPerform, InfGraph

public class DIGInfGraph
extends BaseInfGraph

An InfGraph that performs reasoning via a DIG interface to an external reasoner.

Version:
CVS $Id: DIGInfGraph.java,v 1.11 2004/12/07 09:56:35 andy_seaborne Exp $
Author:
Ian Dickinson, HP Labs (email)

Nested Class Summary
 
Nested classes/interfaces inherited from class com.hp.hpl.jena.reasoner.BaseInfGraph
BaseInfGraph.InfCapabilities, BaseInfGraph.InfFindSafeCapabilities
 
Field Summary
 
Fields inherited from interface com.hp.hpl.jena.graph.Graph
emptyGraph
 
Constructor Summary
DIGInfGraph(Graph data, DIGReasoner reasoner)
          Constructor
 
Method Summary
 ExtendedIterator find(Node subject, Node property, Node object, Graph param)
          An extension of the Graph.find(com.hp.hpl.jena.graph.TripleMatch) interface which allows the caller to encode complex expressions in RDF and then refer to those expressions within the query triple.
 ExtendedIterator findWithContinuation(TriplePattern pattern, Finder continuation)
          Extended find interface used in situations where the implementator may or may not be able to answer the complete query.
 Graph getSchemaGraph()
          Return the schema graph, if any, bound into this inference graph.
 void performAdd(Triple t)
          Add one triple to the data graph, mark the graph not-prepared, but don't run prepare() just yet.
 void performDelete(Triple t)
          Delete one triple from the data graph, mark the graph not-prepared, but don't run prepare() just yet.
 void prepare()
          Perform any initial processing and caching.
 void rebind(Graph data)
          Replace the underlying data graph for this inference graph and start any inferences over again.
 void setDerivationLogging(boolean logOn)
          Switch on/off drivation logging - not supported with DIG reasoner
 ValidityReport validate()
          Test the consistency of the model.
 
Methods inherited from class com.hp.hpl.jena.reasoner.BaseInfGraph
cloneWithPremises, close, find, getBulkUpdateHandler, getCapabilities, getDeductionsGraph, getDerivation, getGlobalProperty, getPrefixMapping, getRawGraph, getReasoner, getReifier, graphBaseFind, graphBaseFind, graphBaseSize, isEmpty, rebind, reset, testGlobalProperty
 
Methods inherited from class com.hp.hpl.jena.graph.impl.GraphBase
add, contains, contains, delete, dependsOn, find, find, getEventManager, getTransactionHandler, isIsomorphicWith, notifyAdd, notifyDelete, queryHandler, size, toString, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.hp.hpl.jena.graph.Graph
contains, contains, delete, dependsOn, find, find, getEventManager, getTransactionHandler, isIsomorphicWith, queryHandler, size
 
Methods inherited from interface com.hp.hpl.jena.graph.GraphAdd
add
 

Constructor Detail

DIGInfGraph

public DIGInfGraph(Graph data,
                   DIGReasoner reasoner)
Constructor

Parameters:
data - the raw data file to be augmented with entailments
reasoner - the engine, with associated tbox data, whose find interface can be used to extract all entailments from the data.
Method Detail

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 prepration is done.

Specified by:
prepare in interface InfGraph
Overrides:
prepare in class BaseInfGraph

findWithContinuation

public ExtendedIterator findWithContinuation(TriplePattern pattern,
                                             Finder continuation)

Extended find interface used in situations where the implementator may or may not be able to answer the complete query. It will attempt to answer the pattern but if its answers are not known to be complete then it will also pass the request on to the nested Finder to append more results.

DIG implementation note: the default call into this method from the base inference graph makes the continuation a query of the base graph. Since DIGAdapter already queries the base graph, there is no futher need to query it through the continuation. Consequently, this implementation does not call the continuation. Client code that wishes to provide a non-default continuation should sub-class DIGInfGraph and provide a suitable call to the continuation.find().

Specified by:
findWithContinuation in class BaseInfGraph
Parameters:
pattern - a TriplePattern to be matched against the data
continuation - Not used in this implementation

find

public ExtendedIterator find(Node subject,
                             Node property,
                             Node object,
                             Graph param)

An extension of the Graph.find(com.hp.hpl.jena.graph.TripleMatch) interface which allows the caller to encode complex expressions in RDF and then refer to those expressions within the query triple. For example, one might encode a class expression and then ask if there are any instances of this class expression in the InfGraph. In the case of the DIGInfGraph, this is exactly the use case we assume. In particular, we expect that the object node is the subject of one or more sentences in param which completely define the class description.

Specified by:
find in interface InfGraph
Overrides:
find in class BaseInfGraph
Parameters:
subject - the subject Node of the query triple, may be a Node in the graph or a node in the parameter micro-graph or null
property - the property to be retrieved or null
object - the object Node of the query triple, may be a Node in the graph or a node in the parameter micro-graph.
param - a small graph encoding an expression which the subject and/or object nodes refer.

getSchemaGraph

public Graph getSchemaGraph()
Return the schema graph, if any, bound into this inference graph.

Specified by:
getSchemaGraph in class BaseInfGraph

performAdd

public void performAdd(Triple t)

Add one triple to the data graph, mark the graph not-prepared, but don't run prepare() just yet.

Specified by:
performAdd in interface com.hp.hpl.jena.graph.impl.GraphWithPerform
Overrides:
performAdd in class BaseInfGraph
Parameters:
t - A triple to add to the graph

performDelete

public void performDelete(Triple t)

Delete one triple from the data graph, mark the graph not-prepared, but don't run prepare() just yet.

Specified by:
performDelete in interface com.hp.hpl.jena.graph.impl.GraphWithPerform
Overrides:
performDelete in class BaseInfGraph
Parameters:
t - A triple to remove from the graph

rebind

public void rebind(Graph data)
Replace the underlying data graph for this inference graph and start any inferences over again. This is primarily using in setting up ontology imports processing to allow an imports multiunion graph to be inserted between the inference graph and the raw data, before processing.

Specified by:
rebind in interface InfGraph
Overrides:
rebind in class BaseInfGraph
Parameters:
data - the new raw data graph

setDerivationLogging

public void setDerivationLogging(boolean logOn)
Switch on/off drivation logging - not supported with DIG reasoner

Specified by:
setDerivationLogging in interface InfGraph
Overrides:
setDerivationLogging in class BaseInfGraph

validate

public ValidityReport validate()

Test the consistency of the model. This looks for overall inconsistency, and for any unsatisfiable classes.

Specified by:
validate in interface InfGraph
Overrides:
validate in class BaseInfGraph
Returns:
a ValidityReport structure


Copyright © 2000, 2001, 2002, 2003, 2004 Hewlett-Packard Development Company, LP