Franz Inc, AllegroGraph

com.franz.agraph.repository
Class AGStreamTupleQuery

java.lang.Object
  extended by org.openrdf.query.impl.AbstractOperation
      extended by org.openrdf.query.impl.AbstractQuery
          extended by com.franz.agraph.repository.AGQuery
              extended by com.franz.agraph.repository.AGTupleQuery
                  extended by com.franz.agraph.repository.AGStreamTupleQuery
All Implemented Interfaces:
org.openrdf.query.Operation, org.openrdf.query.Query, org.openrdf.query.TupleQuery

public class AGStreamTupleQuery
extends AGTupleQuery
implements org.openrdf.query.TupleQuery

Wraps an AGTupleQuery to provide streaming results. The default, TupleQueryResultParser and TupleQueryResultBuilder use SAX to parse and an ArrayList to collect results, so AGTupleQuery.evaluate() does not return until the entire stream is parsed.

AGStreamTupleQuery uses XMLStreamReader, so the result is pulled from the http response stream as methods such as TupleQueryResult.hasNext() are called.

Usage:

 AGTupleQuery query = conn.prepareTupleQuery(QueryLanguage.SPARQL, "SELECT ...");
 query = new AGStreamTupleQuery(query);
 TupleQueryResult results = query.evaluate();
 ...
 

Since:
v4.3
See Also:
AGRepositoryConnection.prepareTupleQuery(org.openrdf.query.QueryLanguage, String)

Field Summary
 
Fields inherited from class com.franz.agraph.repository.AGQuery
RDFS_PLUS_PLUS, RESTRICTION, SPARQL_COVERAGE_PLANNER, SPARQL_IDENTITY_PLANNER
 
Constructor Summary
AGStreamTupleQuery(AGTupleQuery query)
          Wraps a query with this object that will stream the response.
 
Method Summary
 org.openrdf.query.TupleQueryResult evaluate()
          Returns a result object that will read from the http response as results are requested, by TupleQueryResult.hasNext().
 void evaluate(org.openrdf.query.TupleQueryResultHandler handler)
           
 
Methods inherited from class com.franz.agraph.repository.AGTupleQuery
count
 
Methods inherited from class com.franz.agraph.repository.AGQuery
analyze, getBaseURI, getBindingsArray, getEngine, getEntailmentRegime, getLanguage, getLimit, getName, getOffset, getPlanner, getQueryString, isCheckVariables, isLoggingEnabled, isPrepared, setCheckVariables, setEngine, setEntailmentRegime, setIncludeInferred, setLimit, setLoggingEnabled, setOffset, setPlanner, setPrepared, setSaveName, toString
 
Methods inherited from class org.openrdf.query.impl.AbstractQuery
getMaxQueryTime, setMaxQueryTime
 
Methods inherited from class org.openrdf.query.impl.AbstractOperation
clearBindings, getBindings, getDataset, getIncludeInferred, removeBinding, setBinding, setDataset
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.openrdf.query.Query
getMaxQueryTime, setMaxQueryTime
 
Methods inherited from interface org.openrdf.query.Operation
clearBindings, getBindings, getDataset, getIncludeInferred, removeBinding, setBinding, setDataset, setIncludeInferred
 

Constructor Detail

AGStreamTupleQuery

public AGStreamTupleQuery(AGTupleQuery query)
Wraps a query with this object that will stream the response.

Parameters:
query - to wrap
Method Detail

evaluate

public org.openrdf.query.TupleQueryResult evaluate()
                                            throws org.openrdf.query.QueryEvaluationException
Returns a result object that will read from the http response as results are requested, by TupleQueryResult.hasNext(). (Note that TupleQueryResult.next() does not actually do the work if hasNext() is called first.)

Specified by:
evaluate in interface org.openrdf.query.TupleQuery
Overrides:
evaluate in class AGTupleQuery
Throws:
org.openrdf.query.QueryEvaluationException

evaluate

public void evaluate(org.openrdf.query.TupleQueryResultHandler handler)
              throws org.openrdf.query.QueryEvaluationException,
                     org.openrdf.query.TupleQueryResultHandlerException
Specified by:
evaluate in interface org.openrdf.query.TupleQuery
Overrides:
evaluate in class AGTupleQuery
Throws:
org.openrdf.query.QueryEvaluationException
org.openrdf.query.TupleQueryResultHandlerException

Copyright © 2008-2012 Franz Inc.