org.aksw.commons.sparql.api.core
Class QueryExecutionBaseSelect

java.lang.Object
  extended by org.aksw.commons.sparql.api.core.QueryExecutionDecorator
      extended by org.aksw.commons.sparql.api.core.QueryExecutionBaseSelect
All Implemented Interfaces:
com.hp.hpl.jena.query.QueryExecution, QueryExecutionStreaming

public abstract class QueryExecutionBaseSelect
extends QueryExecutionDecorator
implements QueryExecutionStreaming

A Sparqler-class that implements ask, describe, and construct based on the executeCoreSelect(Query) method. Also, works on String and Query level. Some of the code has been taken from com.hp.hpl.jena.sparql.engine.QueryExecutionBase, which is a class with a similar purpose but not as reusable as this one (This class reduces all operations to a single executeCoreSelect call) NOTE: executeCoreSelect will close this query execution once the ResultSet is consumed.

Author:
raven

Field Summary
 
Fields inherited from class org.aksw.commons.sparql.api.core.QueryExecutionDecorator
decoratee
 
Constructor Summary
QueryExecutionBaseSelect(com.hp.hpl.jena.query.Query query, QueryExecutionFactory<QueryExecutionStreaming> subFactory)
           
 
Method Summary
static com.hp.hpl.jena.rdf.model.Model createModel(Iterator<com.hp.hpl.jena.graph.Triple> it)
           
static com.hp.hpl.jena.rdf.model.Model createModel(com.hp.hpl.jena.rdf.model.Model result, Iterator<com.hp.hpl.jena.graph.Triple> it)
           
 boolean execAsk()
           
 com.hp.hpl.jena.rdf.model.Model execConstruct(com.hp.hpl.jena.rdf.model.Model result)
           
 Iterator<com.hp.hpl.jena.graph.Triple> execConstructStreaming()
           
 com.hp.hpl.jena.rdf.model.Model execDescribe()
           
 com.hp.hpl.jena.rdf.model.Model execDescribe(com.hp.hpl.jena.rdf.model.Model result)
          A describe query is translated into a construct query.
 Iterator<com.hp.hpl.jena.graph.Triple> execDescribeStreaming()
          We use this query execution for retrieving the result set of the where clause, but we neet the subFactory to describe the individual resources then.
 com.hp.hpl.jena.query.ResultSet execSelect()
           
protected  com.hp.hpl.jena.query.ResultSet executeCoreSelect(com.hp.hpl.jena.query.Query query)
           
protected abstract  com.hp.hpl.jena.query.QueryExecution executeCoreSelectX(com.hp.hpl.jena.query.Query query)
           
 void executeUpdate(com.hp.hpl.jena.update.UpdateRequest updateRequest)
           
static com.hp.hpl.jena.graph.Node extractDescribeNode(com.hp.hpl.jena.query.Query query)
           
 
Methods inherited from class org.aksw.commons.sparql.api.core.QueryExecutionDecorator
abort, close, execConstruct, getContext, getDataset, getDecoratee, getQuery, setDecoratee, setFileManager, setInitialBinding, setTimeout, setTimeout, setTimeout, setTimeout
 
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.QueryExecution
abort, close, execConstruct, getContext, getDataset, getQuery, setFileManager, setInitialBinding, setTimeout, setTimeout, setTimeout, setTimeout
 

Constructor Detail

QueryExecutionBaseSelect

public QueryExecutionBaseSelect(com.hp.hpl.jena.query.Query query,
                                QueryExecutionFactory<QueryExecutionStreaming> subFactory)
Method Detail

createModel

public static com.hp.hpl.jena.rdf.model.Model createModel(Iterator<com.hp.hpl.jena.graph.Triple> it)

createModel

public static com.hp.hpl.jena.rdf.model.Model createModel(com.hp.hpl.jena.rdf.model.Model result,
                                                          Iterator<com.hp.hpl.jena.graph.Triple> it)

executeCoreSelectX

protected abstract com.hp.hpl.jena.query.QueryExecution executeCoreSelectX(com.hp.hpl.jena.query.Query query)

executeCoreSelect

protected com.hp.hpl.jena.query.ResultSet executeCoreSelect(com.hp.hpl.jena.query.Query query)

execAsk

public boolean execAsk()
Specified by:
execAsk in interface com.hp.hpl.jena.query.QueryExecution
Overrides:
execAsk in class QueryExecutionDecorator

execDescribe

public com.hp.hpl.jena.rdf.model.Model execDescribe()
Specified by:
execDescribe in interface com.hp.hpl.jena.query.QueryExecution
Overrides:
execDescribe in class QueryExecutionDecorator

extractDescribeNode

public static com.hp.hpl.jena.graph.Node extractDescribeNode(com.hp.hpl.jena.query.Query query)

execDescribeStreaming

public Iterator<com.hp.hpl.jena.graph.Triple> execDescribeStreaming()
We use this query execution for retrieving the result set of the where clause, but we neet the subFactory to describe the individual resources then.

Specified by:
execDescribeStreaming in interface QueryExecutionStreaming
Returns:

execDescribe

public com.hp.hpl.jena.rdf.model.Model execDescribe(com.hp.hpl.jena.rdf.model.Model result)
A describe query is translated into a construct query. Lets see... Describe ?a ?b ... <x><y> Where Pattern { ... } becomes ...? Construct { ?a ?ap ?ao . ?b ?bp ?bo . } Where Pattern { } Union {} Ah, lets just query every resource individually for now TODO Add support for concise bounded descriptions...

Specified by:
execDescribe in interface com.hp.hpl.jena.query.QueryExecution
Overrides:
execDescribe in class QueryExecutionDecorator
Parameters:
result -
Returns:

execConstruct

public com.hp.hpl.jena.rdf.model.Model execConstruct(com.hp.hpl.jena.rdf.model.Model result)
Specified by:
execConstruct in interface com.hp.hpl.jena.query.QueryExecution
Overrides:
execConstruct in class QueryExecutionDecorator

execConstructStreaming

public Iterator<com.hp.hpl.jena.graph.Triple> execConstructStreaming()
Specified by:
execConstructStreaming in interface QueryExecutionStreaming

execSelect

public com.hp.hpl.jena.query.ResultSet execSelect()
Specified by:
execSelect in interface com.hp.hpl.jena.query.QueryExecution
Overrides:
execSelect in class QueryExecutionDecorator

executeUpdate

public void executeUpdate(com.hp.hpl.jena.update.UpdateRequest updateRequest)


Copyright © 2012. All Rights Reserved.