org.openrdf.sesame.query
Class QueryResultsGraphBuilder

java.lang.Object
  extended byorg.openrdf.sesame.query.QueryResultsGraphBuilder
All Implemented Interfaces:
GraphQueryResultListener

public class QueryResultsGraphBuilder
extends Object
implements GraphQueryResultListener

An implementation of GraphQueryResultListener that can be used to create a Graph from a query result.

Version:
$Revision: 1.5.2.2 $
Author:
Jeen Broekstra, Arjohn Kampman

Constructor Summary
QueryResultsGraphBuilder()
          Creates a new QueryResultsGraphBuilder.
 
Method Summary
 void endGraphQueryResult()
          Indicates the end of a graph-like query result.
 Graph getGraph()
          Gets the graph that has been build from the query result.
 void namespace(String prefix, String name)
          Reports a namespace and its (preferred) prefix that might be used in the query result.
 void reportError(String msg)
          Reports an error that has occurred during the query evaluation.
 void startGraphQueryResult()
          Indicates the start of a graph-like query result.
 void triple(Resource subj, URI pred, Value obj)
          Delivers the next triple in the query result.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryResultsGraphBuilder

public QueryResultsGraphBuilder()
Creates a new QueryResultsGraphBuilder.

Method Detail

getGraph

public Graph getGraph()
Gets the graph that has been build from the query result.

Returns:
A Graph object, or null if the query result has not yet been processed.

startGraphQueryResult

public void startGraphQueryResult()
                           throws IOException
Description copied from interface: GraphQueryResultListener
Indicates the start of a graph-like query result.

Specified by:
startGraphQueryResult in interface GraphQueryResultListener
Throws:
IOException

endGraphQueryResult

public void endGraphQueryResult()
Description copied from interface: GraphQueryResultListener
Indicates the end of a graph-like query result.

Specified by:
endGraphQueryResult in interface GraphQueryResultListener

namespace

public void namespace(String prefix,
                      String name)
Description copied from interface: GraphQueryResultListener
Reports a namespace and its (preferred) prefix that might be used in the query result. Namespaces will be reported before the start of the query result as much as possible to accomodate listeners that need these mapping beforehand (like an RDF/XML document writer).

Specified by:
namespace in interface GraphQueryResultListener

triple

public void triple(Resource subj,
                   URI pred,
                   Value obj)
            throws IOException
Description copied from interface: GraphQueryResultListener
Delivers the next triple in the query result.

Specified by:
triple in interface GraphQueryResultListener
Throws:
IOException

reportError

public void reportError(String msg)
                 throws IOException
Description copied from interface: GraphQueryResultListener
Reports an error that has occurred during the query evaluation.

Specified by:
reportError in interface GraphQueryResultListener
Throws:
IOException


Copyright © 2002-2006 Aduna BV, GNU LGPL License applies.