de.fuberlin.wiwiss.wiqa
Class AcceptedGraph

java.lang.Object
  extended bycom.hp.hpl.jena.graph.impl.GraphBase
      extended byde.fuberlin.wiwiss.wiqa.AcceptedGraph
All Implemented Interfaces:
Graph, GraphAdd, GraphWithPerform

public class AcceptedGraph
extends GraphBase

A virtual Jena Graph that shows a filtered view on a Dataset. Only statements matching a Policy are in the graph. Additionally, the explain(com.hp.hpl.jena.graph.Triple) method can generate an explanation that states why a triple was accepted into the graph.

The graph is “live”. Changes to the unfiltered dataset will be reflected in the graph.

Explanations are cached. clearCachedExplanations() should be called occassionally to free all previously cached explanations for garbage collection.

Version:
$Id: AcceptedGraph.java,v 1.6 2006/06/12 20:10:15 cyganiak Exp $
Author:
Richard Cyganiak (richard@cyganiak.de)

Field Summary
 
Fields inherited from class com.hp.hpl.jena.graph.impl.GraphBase
bulkHandler, capabilities, closed, gem, pm, queryHandler, reifier, style
 
Fields inherited from interface com.hp.hpl.jena.graph.Graph
emptyGraph
 
Constructor Summary
AcceptedGraph(Dataset dataset, Policy policy)
          Creates a new AcceptedGraph.
AcceptedGraph(Dataset dataset, Policy policy, Binding contextVariables)
          Creates a new AcceptedGraph.
 
Method Summary
 void clearCachedExplanations()
          Frees all previously cached explanations for garbage collection.
 Explanation explain(Triple t)
          Explains why a triple was accepted.
 Graph explainAsGraph(Triple t)
          Explains why a triple was accepted.
protected  ExtendedIterator graphBaseFind(TripleMatch m)
           
 Policy policy()
           
 
Methods inherited from class com.hp.hpl.jena.graph.impl.GraphBase
add, checkOpen, close, contains, contains, containsByFind, delete, dependsOn, find, find, forTestingOnly_graphBaseFind, getBulkUpdateHandler, getCapabilities, getEventManager, getPrefixMapping, getReifier, getTransactionHandler, graphBaseContains, graphBaseFind, graphBaseSize, isEmpty, isIsomorphicWith, notifyAdd, notifyDelete, performAdd, performDelete, queryHandler, reifierContains, reifierSize, reifierTriples, size, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AcceptedGraph

public AcceptedGraph(Dataset dataset,
                     Policy policy)
Creates a new AcceptedGraph.

Parameters:
dataset - The unfiltered dataset
policy - The policy to be used

AcceptedGraph

public AcceptedGraph(Dataset dataset,
                     Policy policy,
                     Binding contextVariables)
Creates a new AcceptedGraph.

Parameters:
dataset - The unfiltered dataset
policy - The policy to be used
contextVariables - A set of context variables that are available in queries
Method Detail

graphBaseFind

protected ExtendedIterator graphBaseFind(TripleMatch m)

policy

public Policy policy()
Returns:
The policy in use by the graph

explain

public Explanation explain(Triple t)
Explains why a triple was accepted. The triple must have been the result of a find call after clearCachedExplanations() was called the last time.

Parameters:
t - The triple to be explained
Returns:
The matching explanation, or null if the triple doesn't match or is not known

explainAsGraph

public Graph explainAsGraph(Triple t)
Explains why a triple was accepted. The triple must have been the result of a find call after clearCachedExplanations() was called the last time. TODO: Implement GraphExplanations

Parameters:
t - The triple to be explained
Returns:
The matching explanation, or null if the triple doesn't match or is not known

clearCachedExplanations

public void clearCachedExplanations()
Frees all previously cached explanations for garbage collection.