de.fuberlin.wiwiss.wiqa
Class ExplainableExtension

java.lang.Object
  extended byde.fuberlin.wiwiss.wiqa.ExplainableExtension
All Implemented Interfaces:
Extension

public abstract class ExplainableExtension
extends Object
implements Extension

Abstract base class for ARQ extensions that can generate explanations.

In fact, any class implementing Extension can return explanations. This class merely provides a convenience method returnExplanation(de.fuberlin.wiwiss.wiqa.ExplanationPart) to simplify the process.

Extensions transform iterators over Bindings. This is extremely flexible. Extension instances are not recycled; they are discarded after processing one iterator. An extension can generate only one explanation.

For each input binding, exec(com.hp.hpl.jena.query.engine.QueryIterator, java.util.List, java.lang.String, com.hp.hpl.jena.query.engine1.ExecutionContext) is called. Finally, finish(java.util.List) is called. Each call returns a QueryIterator with some of the output bindings. The implementation is free to chunk the output bindings in any way -- it can return some for each exec call, or all on the finish call.

The ARQ classes QueryIterPlainWrapper, QueryIterSingleton and QueryIterNullIterator might be useful as return values of exec and finish.

Version:
$Id: ExplainableExtension.java,v 1.7 2006/06/12 21:06:25 cyganiak Exp $
Author:
Richard Cyganiak (richard@cyganiak.de)

Field Summary
static Node EQUAL
           
static Node GREATER_THAN
           
static Node GREATER_THAN_OR_EQUAL
           
static Node LESS_THAN
           
static Node LESS_THAN_OR_EQUAL
           
static Node NOT_EQUAL
           
 
Constructor Summary
ExplainableExtension()
           
 
Method Summary
abstract  QueryIterator exec(List args, Binding binding)
          Called for each binding in the input binding stream.
 QueryIterator exec(QueryIterator input, List args, String uri, ExecutionContext execCxt)
           
abstract  QueryIterator finish(List args)
          Called after all bindings in the input binding stream have passed through.
 ExecutionContext getContext()
          Provides the extension with access to the ExecutionContext.
 DatasetGraph getDataset()
          Provides the extension with access to the unfiltered dataset.
 void returnExplanation(ExplanationPart explanation)
          Returns an explanation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.hp.hpl.jena.query.extension.Extension
build
 

Field Detail

GREATER_THAN

public static final Node GREATER_THAN

GREATER_THAN_OR_EQUAL

public static final Node GREATER_THAN_OR_EQUAL

EQUAL

public static final Node EQUAL

LESS_THAN_OR_EQUAL

public static final Node LESS_THAN_OR_EQUAL

LESS_THAN

public static final Node LESS_THAN

NOT_EQUAL

public static final Node NOT_EQUAL
Constructor Detail

ExplainableExtension

public ExplainableExtension()
Method Detail

exec

public QueryIterator exec(QueryIterator input,
                          List args,
                          String uri,
                          ExecutionContext execCxt)
Specified by:
exec in interface Extension

exec

public abstract QueryIterator exec(List args,
                                   Binding binding)
Called for each binding in the input binding stream.

Parameters:
args - A list of NodeValue representing the arguments passed to the extension, evaluated for the current binding
binding - The current binding
Returns:
Some result bindings

finish

public abstract QueryIterator finish(List args)
Called after all bindings in the input binding stream have passed through.

Parameters:
args - A list of NodeValue representing the arguments passed to the extension
Returns:
Some result bindings

getContext

public ExecutionContext getContext()
Provides the extension with access to the ExecutionContext.

Returns:
The ExecutionContext

getDataset

public DatasetGraph getDataset()
Provides the extension with access to the unfiltered dataset.

Returns:
The unfiltered dataset

returnExplanation

public void returnExplanation(ExplanationPart explanation)
Returns an explanation.

Parameters:
explanation -