org.openrdf.sail.inferencer
Class InferencerConnectionWrapper

java.lang.Object
  extended by org.openrdf.sail.helpers.SailConnectionWrapper
      extended by org.openrdf.sail.inferencer.InferencerConnectionWrapper
All Implemented Interfaces:
InferencerConnection, SailConnection

public class InferencerConnectionWrapper
extends SailConnectionWrapper
implements InferencerConnection

An extension of ConnectionWrapper that implements the InferencerConnection interface.

Author:
Arjohn Kampman

Constructor Summary
InferencerConnectionWrapper(InferencerConnection con)
          Creates a new InferencerConnectionWrapper object that wraps the supplied transaction.
 
Method Summary
 boolean addInferredStatement(Resource subj, URI pred, Value obj, Resource... contexts)
          Adds an inferred statement to a specific context.
 void clearInferred(Resource... contexts)
          Removes all inferred statements from the specified/all contexts.
 void commit()
          Calls flushUpdates() before forwarding the call to the wrapped connection.
 CloseableIteration<? extends BindingSet,QueryEvaluationException> evaluate(TupleExpr tupleExpr, Dataset dataset, BindingSet bindings, boolean includeInferred)
          Calls flushUpdates() before forwarding the call to the wrapped connection.
 void flushUpdates()
          Flushes any pending updates to be processed and the resulting changes to be reported to registered SailConnectionListeners.
 CloseableIteration<? extends Resource,SailException> getContextIDs()
          Calls flushUpdates() before forwarding the call to the wrapped connection.
 CloseableIteration<? extends Statement,SailException> getStatements(Resource subj, URI pred, Value obj, boolean includeInferred, Resource... contexts)
          Calls flushUpdates() before forwarding the call to the wrapped connection.
protected  InferencerConnection getWrappedConnection()
          Gets the connection that is wrapped by this object.
 boolean removeInferredStatement(Resource subj, URI pred, Value obj, Resource... contexts)
          Removes an inferred statement from a specific context.
 long size(Resource... contexts)
          Calls flushUpdates() before forwarding the call to the wrapped connection.
 
Methods inherited from class org.openrdf.sail.helpers.SailConnectionWrapper
addConnectionListener, addStatement, clear, clearNamespaces, close, getNamespace, getNamespaces, isOpen, removeConnectionListener, removeNamespace, removeStatements, rollback, setNamespace, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.openrdf.sail.SailConnection
addConnectionListener, addStatement, clear, clearNamespaces, close, getNamespace, getNamespaces, isOpen, removeConnectionListener, removeNamespace, removeStatements, rollback, setNamespace
 

Constructor Detail

InferencerConnectionWrapper

public InferencerConnectionWrapper(InferencerConnection con)
Creates a new InferencerConnectionWrapper object that wraps the supplied transaction.

Method Detail

getWrappedConnection

protected InferencerConnection getWrappedConnection()
Gets the connection that is wrapped by this object.

Overrides:
getWrappedConnection in class SailConnectionWrapper
Returns:
The connection that was supplied to the constructor of this class.

addInferredStatement

public boolean addInferredStatement(Resource subj,
                                    URI pred,
                                    Value obj,
                                    Resource... contexts)
                             throws SailException
Description copied from interface: InferencerConnection
Adds an inferred statement to a specific context.

Specified by:
addInferredStatement in interface InferencerConnection
Parameters:
subj - The subject of the statement to add.
pred - The predicate of the statement to add.
obj - The object of the statement to add.
Throws:
SailException - If the statement could not be added.

removeInferredStatement

public boolean removeInferredStatement(Resource subj,
                                       URI pred,
                                       Value obj,
                                       Resource... contexts)
                                throws SailException
Description copied from interface: InferencerConnection
Removes an inferred statement from a specific context.

Specified by:
removeInferredStatement in interface InferencerConnection
Parameters:
subj - The subject of the statement that should be removed.
pred - The predicate of the statement that should be removed.
obj - The object of the statement that should be removed.
Throws:
SailException - If the statement could not be removed.

clearInferred

public void clearInferred(Resource... contexts)
                   throws SailException
Description copied from interface: InferencerConnection
Removes all inferred statements from the specified/all contexts. If no contexts are specified the method operates on the entire repository.

Specified by:
clearInferred in interface InferencerConnection
Parameters:
contexts - The context(s) from which to remove the statements. Note that this parameter is a vararg and as such is optional. If no contexts are supplied the method operates on the entire repository.
Throws:
SailException - If the statements could not be removed.

flushUpdates

public void flushUpdates()
                  throws SailException
Description copied from interface: InferencerConnection
Flushes any pending updates to be processed and the resulting changes to be reported to registered SailConnectionListeners.

Specified by:
flushUpdates in interface InferencerConnection
Throws:
SailException - If the updates could not be processed.

commit

public void commit()
            throws SailException
Calls flushUpdates() before forwarding the call to the wrapped connection.

Specified by:
commit in interface SailConnection
Overrides:
commit in class SailConnectionWrapper
Throws:
SailException - If the SailConnection could not be committed.

evaluate

public CloseableIteration<? extends BindingSet,QueryEvaluationException> evaluate(TupleExpr tupleExpr,
                                                                                  Dataset dataset,
                                                                                  BindingSet bindings,
                                                                                  boolean includeInferred)
                                                                           throws SailException
Calls flushUpdates() before forwarding the call to the wrapped connection.

Specified by:
evaluate in interface SailConnection
Overrides:
evaluate in class SailConnectionWrapper
dataset - The dataset to use for evaluating the query, null to use the Sail's default dataset.
bindings - A set of input parameters for the query evaluation. The keys reference variable names that should be bound to the value they map to.
includeInferred - Indicates whether inferred triples are to be considered in the query result. If false, no inferred statements are returned; if true, inferred statements are returned if available
Returns:
The TupleQueryResult.
Throws:
SailException - If the Sail object encountered an error or unexpected situation internally.

getContextIDs

public CloseableIteration<? extends Resource,SailException> getContextIDs()
                                                                   throws SailException
Calls flushUpdates() before forwarding the call to the wrapped connection.

Specified by:
getContextIDs in interface SailConnection
Overrides:
getContextIDs in class SailConnectionWrapper
Returns:
An iterator over the context identifiers, should not contain any duplicates.
Throws:
SailException

getStatements

public CloseableIteration<? extends Statement,SailException> getStatements(Resource subj,
                                                                           URI pred,
                                                                           Value obj,
                                                                           boolean includeInferred,
                                                                           Resource... contexts)
                                                                    throws SailException
Calls flushUpdates() before forwarding the call to the wrapped connection.

Specified by:
getStatements in interface SailConnection
Overrides:
getStatements in class SailConnectionWrapper
Parameters:
subj - A Resource specifying the subject, or null for a wildcard.
pred - A URI specifying the predicate, or null for a wildcard.
obj - A Value specifying the object, or null for a wildcard.
includeInferred - if false, no inferred statements are returned; if true, inferred statements are returned if available
contexts - The context(s) to get the data from. Note that this parameter is a vararg and as such is optional. If no contexts are supplied the method operates on the entire repository.
Returns:
The statements matching the specified pattern.
Throws:
SailException - If the Sail object encountered an error or unexpected situation internally.

size

public long size(Resource... contexts)
          throws SailException
Calls flushUpdates() before forwarding the call to the wrapped connection.

Specified by:
size in interface SailConnection
Overrides:
size in class SailConnectionWrapper
Returns:
The number of explicit statements in this Sail.
Throws:
SailException


Copyright © 2001-2007 Aduna. All Rights Reserved.