de.fuberlin.wiwiss.marbles
Class SameAsInferencer

java.lang.Object
  extended by org.openrdf.sail.helpers.SailWrapper
      extended by de.fuberlin.wiwiss.marbles.SameAsInferencer
All Implemented Interfaces:
org.openrdf.sail.Sail, org.openrdf.sail.StackableSail

public class SameAsInferencer
extends org.openrdf.sail.helpers.SailWrapper

Mirrors statements among URI aliases that are linked by owl:sameAs triples. In automatic mode (setAutoInference(true); default), new statements are processed as they are added: New statements with owl:sameAs predicates cause statements pertaining to the two resources (i.e. subject and object) to be applied to one another. New triples with predicates other than owl:sameAs initiate a lookup for URI Aliases, to whom the statement will then be applied. In manual mode (setAutoInference(false)), the method addInferredForResource may be used to selectively initiate inferencing for a given resource. Note: Because the inferencer does not implement handling for the removal of triples, inferred statements are not removed.

Author:
Christian Becker

Constructor Summary
SameAsInferencer(org.openrdf.sail.Sail baseSail)
          Constructor
 
Method Summary
 void addInferredForResource(org.openrdf.model.Resource base)
          Manually initiates inferencing for a given resource
 boolean doInferencing(org.openrdf.sail.inferencer.InferencerConnection con)
           
 org.openrdf.sail.SailConnection getConnection()
           
 boolean hasNewStatements()
           
 void processRegularStatement(org.openrdf.sail.inferencer.InferencerConnection con, org.openrdf.model.Statement st)
          Processes statements other than owl:sameAs
 void processSameAs(org.openrdf.sail.inferencer.InferencerConnection con, org.openrdf.model.Resource base, org.openrdf.model.Resource alias)
          Processes an owl:sameAs statement
 void setAutoInference(boolean autoInference)
           
 void setContext(org.openrdf.model.Resource... context)
          Limits the generation of inferred statements to specific contexts
 
Methods inherited from class org.openrdf.sail.helpers.SailWrapper
addSailChangedListener, getBaseSail, getDataDir, getValueFactory, initialize, isWritable, removeSailChangedListener, setBaseSail, setDataDir, shutDown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SameAsInferencer

public SameAsInferencer(org.openrdf.sail.Sail baseSail)
Constructor

Parameters:
baseSail -
Method Detail

setContext

public void setContext(org.openrdf.model.Resource... context)
Limits the generation of inferred statements to specific contexts

Parameters:
context - List of contexts. An empty list may be passed to permit all contexts.

getConnection

public org.openrdf.sail.SailConnection getConnection()
                                              throws org.openrdf.sail.SailException
Specified by:
getConnection in interface org.openrdf.sail.Sail
Overrides:
getConnection in class org.openrdf.sail.helpers.SailWrapper
Throws:
org.openrdf.sail.SailException

hasNewStatements

public boolean hasNewStatements()

doInferencing

public boolean doInferencing(org.openrdf.sail.inferencer.InferencerConnection con)
                      throws org.openrdf.sail.SailException
Throws:
org.openrdf.sail.SailException

addInferredForResource

public void addInferredForResource(org.openrdf.model.Resource base)
                            throws org.openrdf.sail.SailException,
                                   org.openrdf.repository.RepositoryException
Manually initiates inferencing for a given resource

Parameters:
base - The resource for which aliases are to be found
Throws:
org.openrdf.sail.SailException
org.openrdf.repository.RepositoryException

processSameAs

public void processSameAs(org.openrdf.sail.inferencer.InferencerConnection con,
                          org.openrdf.model.Resource base,
                          org.openrdf.model.Resource alias)
                   throws org.openrdf.sail.SailException
Processes an owl:sameAs statement

Parameters:
con -
base -
alias -
Throws:
org.openrdf.sail.SailException

processRegularStatement

public void processRegularStatement(org.openrdf.sail.inferencer.InferencerConnection con,
                                    org.openrdf.model.Statement st)
                             throws org.openrdf.sail.SailException
Processes statements other than owl:sameAs

Parameters:
con -
st -
Throws:
org.openrdf.sail.SailException

setAutoInference

public void setAutoInference(boolean autoInference)