Package org.aksw.jena_sparql_api.core
Class QueryExecutionBaseSelect
java.lang.Object
org.aksw.jenax.dataaccess.sparql.execution.query.QueryExecutionWrapperBase<org.apache.jena.query.QueryExecution>
org.aksw.jena_sparql_api.core.QueryExecutionBaseSelect
- All Implemented Interfaces:
AutoCloseable,QueryExecutionWrapper,org.apache.jena.query.QueryExecution
- Direct Known Subclasses:
QueryExecutionAlwaysFail,QueryExecutionSelect
public abstract class QueryExecutionBaseSelect
extends QueryExecutionWrapperBase<org.apache.jena.query.QueryExecution>
implements org.apache.jena.query.QueryExecution
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
org.apache.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
FieldsModifier and TypeFieldDescriptionprotected QueryExecutionFactoryprotected org.apache.jena.query.QueryFields inherited from class org.aksw.jenax.dataaccess.sparql.execution.query.QueryExecutionWrapperBase
decoratee -
Constructor Summary
ConstructorsConstructorDescriptionQueryExecutionBaseSelect(org.apache.jena.query.Query query, QueryExecutionFactory subFactory) -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.jena.rdf.model.ModelcreateModel(Iterator<org.apache.jena.graph.Triple> it) static org.apache.jena.rdf.model.ModelcreateModel(org.apache.jena.rdf.model.Model result, Iterator<org.apache.jena.graph.Triple> it) booleanexecAsk()org.apache.jena.rdf.model.Modelorg.apache.jena.rdf.model.ModelexecConstruct(org.apache.jena.rdf.model.Model result) Iterator<org.apache.jena.graph.Triple>org.apache.jena.rdf.model.Modelorg.apache.jena.rdf.model.ModelexecDescribe(org.apache.jena.rdf.model.Model result) A describe query is translated into a construct query.Iterator<org.apache.jena.graph.Triple>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.org.apache.jena.atlas.json.JsonArrayexecJson()Iterator<org.apache.jena.atlas.json.JsonObject>org.apache.jena.query.ResultSetprotected Iterator<org.apache.jena.graph.Triple>executeConstructStreaming(org.apache.jena.query.Query query) protected org.apache.jena.query.ResultSetCloseableexecuteCoreSelect(org.apache.jena.query.Query query) protected abstract org.apache.jena.query.QueryExecutionexecuteCoreSelectX(org.apache.jena.query.Query query) voidexecuteUpdate(org.apache.jena.update.UpdateRequest updateRequest) static org.apache.jena.graph.NodeextractDescribeNode(org.apache.jena.query.Query query) org.apache.jena.query.QuerygetQuery()Methods inherited from class org.aksw.jenax.dataaccess.sparql.execution.query.QueryExecutionWrapperBase
afterExec, beforeExec, execConstructDataset, execConstructDataset, execConstructQuads, getDelegate, getQueryString, onExceptionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.jena.query.QueryExecution
execConstructDataset, execConstructDataset, execConstructQuads, getQueryStringMethods inherited from interface org.aksw.jenax.dataaccess.sparql.execution.query.QueryExecutionWrapper
abort, close, getContext, getDataset, getTimeout1, getTimeout2, isClosed, tryGetDelegate, unwrap
-
Field Details
-
query
protected org.apache.jena.query.Query query -
parentFactory
-
-
Constructor Details
-
QueryExecutionBaseSelect
public QueryExecutionBaseSelect(org.apache.jena.query.Query query, QueryExecutionFactory subFactory)
-
-
Method Details
-
createModel
public static org.apache.jena.rdf.model.Model createModel(Iterator<org.apache.jena.graph.Triple> it) -
createModel
public static org.apache.jena.rdf.model.Model createModel(org.apache.jena.rdf.model.Model result, Iterator<org.apache.jena.graph.Triple> it) -
executeCoreSelectX
protected abstract org.apache.jena.query.QueryExecution executeCoreSelectX(org.apache.jena.query.Query query) -
executeCoreSelect
protected org.apache.jena.query.ResultSetCloseable executeCoreSelect(org.apache.jena.query.Query query) -
execAsk
public boolean execAsk()- Specified by:
execAskin interfaceorg.apache.jena.query.QueryExecution- Overrides:
execAskin classQueryExecutionWrapperBase<org.apache.jena.query.QueryExecution>
-
execDescribe
public org.apache.jena.rdf.model.Model execDescribe()- Specified by:
execDescribein interfaceorg.apache.jena.query.QueryExecution- Overrides:
execDescribein classQueryExecutionWrapperBase<org.apache.jena.query.QueryExecution>
-
extractDescribeNode
public static org.apache.jena.graph.Node extractDescribeNode(org.apache.jena.query.Query query) -
execDescribeTriples
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:
execDescribeTriplesin interfaceorg.apache.jena.query.QueryExecution- Overrides:
execDescribeTriplesin classQueryExecutionWrapperBase<org.apache.jena.query.QueryExecution>- Returns:
-
execDescribe
public org.apache.jena.rdf.model.Model execDescribe(org.apache.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:
execDescribein interfaceorg.apache.jena.query.QueryExecution- Overrides:
execDescribein classQueryExecutionWrapperBase<org.apache.jena.query.QueryExecution>- Parameters:
result-- Returns:
-
executeConstructStreaming
protected Iterator<org.apache.jena.graph.Triple> executeConstructStreaming(org.apache.jena.query.Query query) -
execConstruct
public org.apache.jena.rdf.model.Model execConstruct(org.apache.jena.rdf.model.Model result) - Specified by:
execConstructin interfaceorg.apache.jena.query.QueryExecution- Overrides:
execConstructin classQueryExecutionWrapperBase<org.apache.jena.query.QueryExecution>
-
execConstruct
public org.apache.jena.rdf.model.Model execConstruct()- Specified by:
execConstructin interfaceorg.apache.jena.query.QueryExecution- Overrides:
execConstructin classQueryExecutionWrapperBase<org.apache.jena.query.QueryExecution>
-
execConstructTriples
- Specified by:
execConstructTriplesin interfaceorg.apache.jena.query.QueryExecution- Overrides:
execConstructTriplesin classQueryExecutionWrapperBase<org.apache.jena.query.QueryExecution>
-
execSelect
public org.apache.jena.query.ResultSet execSelect()- Specified by:
execSelectin interfaceorg.apache.jena.query.QueryExecution- Overrides:
execSelectin classQueryExecutionWrapperBase<org.apache.jena.query.QueryExecution>
-
getQuery
public org.apache.jena.query.Query getQuery()- Specified by:
getQueryin interfaceorg.apache.jena.query.QueryExecution- Specified by:
getQueryin interfaceQueryExecutionWrapper
-
executeUpdate
public void executeUpdate(org.apache.jena.update.UpdateRequest updateRequest) -
execJson
public org.apache.jena.atlas.json.JsonArray execJson()- Specified by:
execJsonin interfaceorg.apache.jena.query.QueryExecution- Overrides:
execJsonin classQueryExecutionWrapperBase<org.apache.jena.query.QueryExecution>
-
execJsonItems
- Specified by:
execJsonItemsin interfaceorg.apache.jena.query.QueryExecution- Overrides:
execJsonItemsin classQueryExecutionWrapperBase<org.apache.jena.query.QueryExecution>
-