- All Implemented Interfaces:
AutoCloseable,QueryExecution
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidabort()Stop in mid execution.voidclose()Close the query execution and stop query evaluation as soon as convenient.static QueryExecutioncompatibility(QueryExecMod qExec, Dataset dataset, Query query, String queryString) booleanexecAsk()Execute an ASK queryExecute a CONSTRUCT queryexecConstruct(Model model) Execute a CONSTRUCT query, putting the statements into a graph.Execute a CONSTRUCT query, putting the statements into 'dataset'.execConstructDataset(Dataset dataset) Execute a CONSTRUCT query, putting the statements into 'dataset'.Execute a CONSTRUCT query, returning the results as an iterator ofQuad.Execute a CONSTRUCT query, returning the results as an iterator ofTriple.Execute a DESCRIBE queryexecDescribe(Model model) Execute a DESCRIBE query, putting the statements into a graph.Execute a DESCRIBE query, returning the results as an iterator ofTriple.execJson()Execute a JSON query and return a json arrayExecute a JSON query and return an iteratorExecute a SELECT queryThe properties associated with a query execution - implementation specific parameters This includes Java objects (so it is not an RDF graph).The dataset against which the query will execute.getQuery()The query associated with a query execution.longReturn the first timeout (time to first result), in milliseconds: negative if unsetlongReturn the second timeout (overall query execution after first result), in milliseconds: negative if unsetbooleanisClosed()Answer whether this QueryExecution object has been closed or not.voidsetInitialBinding(QuerySolution querySolution) Set the initial association of variables and values.voidsetInitialBinding(Binding binding) Set the initial association of variables and values.voidsetTimeout(long timeout) Set time, in millisecondsvoidsetTimeout(long timeout1, long timeout2) Set time, in millisecondsvoidsetTimeout(long timeout, TimeUnit timeoutUnits) Set a timeout on the query execution.voidsetTimeout(long timeout1, TimeUnit timeUnit1, long timeout2, TimeUnit timeUnit2) Set timeouts on the query execution; the first timeout refers to time to first result, the second refers to overall query execution after the first result.Methods inherited from class org.apache.jena.sparql.exec.QueryExecutionAdapter
adapt, getQueryString
-
Method Details
-
compatibility
public static QueryExecution compatibility(QueryExecMod qExec, Dataset dataset, Query query, String queryString) -
setInitialBinding
Description copied from class:QueryExecutionAdapterSet the initial association of variables and values. May not be supported by all QueryExecution implementations.- Specified by:
setInitialBindingin interfaceQueryExecution- Overrides:
setInitialBindingin classQueryExecutionAdapter
-
getDataset
Description copied from class:QueryExecutionAdapterThe dataset against which the query will execute. May be null, implying it is expected that the query itself has a dataset description.- Specified by:
getDatasetin interfaceQueryExecution- Overrides:
getDatasetin classQueryExecutionAdapter
-
getContext
Description copied from class:QueryExecutionAdapterThe properties associated with a query execution - implementation specific parameters This includes Java objects (so it is not an RDF graph). Keys should be URIs as strings. May be null (this implementation does not provide any configuration).- Specified by:
getContextin interfaceQueryExecution- Overrides:
getContextin classQueryExecutionAdapter
-
getQuery
Description copied from class:QueryExecutionAdapterThe query associated with a query execution. May be null (QueryExecution may have been created by other means)- Specified by:
getQueryin interfaceQueryExecution- Overrides:
getQueryin classQueryExecutionAdapter
-
execSelect
Description copied from class:QueryExecutionAdapterExecute a SELECT queryImportant: The name of this method is somewhat of a misnomer in that depending on the underlying implementation this typically does not execute the SELECT query but rather answers a wrapper over an internal data structure that can be used to answer the query. In essence calling this method only returns a plan for executing this query which only gets evaluated when you actually start iterating over the results.
- Specified by:
execSelectin interfaceQueryExecution- Overrides:
execSelectin classQueryExecutionAdapter
-
execConstruct
Description copied from class:QueryExecutionAdapterExecute a CONSTRUCT query- Specified by:
execConstructin interfaceQueryExecution- Overrides:
execConstructin classQueryExecutionAdapter
-
execConstruct
Description copied from class:QueryExecutionAdapterExecute a CONSTRUCT query, putting the statements into a graph.- Specified by:
execConstructin interfaceQueryExecution- Overrides:
execConstructin classQueryExecutionAdapter- Returns:
- Graph The model argument for cascaded code.
-
execConstructTriples
Description copied from class:QueryExecutionAdapterExecute a CONSTRUCT query, returning the results as an iterator ofTriple.Caution: This method may return duplicate Triples. This method may be useful if you only need the results for stream processing, as it can avoid having to place the results in a Model.
Important: The name of this method is somewhat of a misnomer in that depending on the underlying implementation this typically does not execute the CONSTRUCT query but rather answers a wrapper over an internal data structure that can be used to answer the query. In essence calling this method only returns a plan for executing this query which only gets evaluated when you actually start iterating over the results.
- Specified by:
execConstructTriplesin interfaceQueryExecution- Overrides:
execConstructTriplesin classQueryExecutionAdapter- Returns:
- An iterator of Triple objects (possibly containing duplicates) generated by applying the CONSTRUCT template of the query to the bindings in the WHERE clause.
-
execConstructQuads
Description copied from class:QueryExecutionAdapterExecute a CONSTRUCT query, returning the results as an iterator ofQuad.Caution: This method may return duplicate Quads. This method may be useful if you only need the results for stream processing, as it can avoid having to place the results in a Model.
An iterator of Quad objects (possibly containing duplicates) generated by applying the CONSTRUCT template of the query to the bindings in the WHERE clause.
See
QueryExecutionAdapter.execConstructTriples()for usage and features.- Specified by:
execConstructQuadsin interfaceQueryExecution- Overrides:
execConstructQuadsin classQueryExecutionAdapter- Returns:
- An iterator of Quad objects (possibly containing duplicates) generated by applying the CONSTRUCT template of the query to the bindings in the WHERE clause.
-
execConstructDataset
Description copied from class:QueryExecutionAdapterExecute a CONSTRUCT query, putting the statements into 'dataset'. This maybe an extended syntax query (if supported).- Specified by:
execConstructDatasetin interfaceQueryExecution- Overrides:
execConstructDatasetin classQueryExecutionAdapter
-
execConstructDataset
Description copied from class:QueryExecutionAdapterExecute a CONSTRUCT query, putting the statements into 'dataset'. This may be an extended syntax query (if supported).- Specified by:
execConstructDatasetin interfaceQueryExecution- Overrides:
execConstructDatasetin classQueryExecutionAdapter
-
execDescribe
Description copied from class:QueryExecutionAdapterExecute a DESCRIBE query- Specified by:
execDescribein interfaceQueryExecution- Overrides:
execDescribein classQueryExecutionAdapter
-
execDescribe
Description copied from class:QueryExecutionAdapterExecute a DESCRIBE query, putting the statements into a graph.- Specified by:
execDescribein interfaceQueryExecution- Overrides:
execDescribein classQueryExecutionAdapter- Returns:
- Graph The model argument for cascaded code.
-
execDescribeTriples
Description copied from class:QueryExecutionAdapterExecute a DESCRIBE query, returning the results as an iterator ofTriple.Caution: This method may return duplicate Triples. This method may be useful if you only need the results for stream processing, as it can avoid having to place the results in a Model.
Important: The name of this method is somewhat of a misnomer in that depending on the underlying implementation this typically does not execute the DESCRIBE query but rather answers a wrapper over an internal data structure that can be used to answer the query. In essence calling this method only returns a plan for executing this query which only gets evaluated when you actually start iterating over the results.
- Specified by:
execDescribeTriplesin interfaceQueryExecution- Overrides:
execDescribeTriplesin classQueryExecutionAdapter- Returns:
- An iterator of Triple objects (possibly containing duplicates) generated as the output of the DESCRIBE query.
-
execAsk
public boolean execAsk()Description copied from class:QueryExecutionAdapterExecute an ASK query- Specified by:
execAskin interfaceQueryExecution- Overrides:
execAskin classQueryExecutionAdapter
-
execJson
Description copied from class:QueryExecutionAdapterExecute a JSON query and return a json array- Specified by:
execJsonin interfaceQueryExecution- Overrides:
execJsonin classQueryExecutionAdapter
-
execJsonItems
Description copied from class:QueryExecutionAdapterExecute a JSON query and return an iterator- Specified by:
execJsonItemsin interfaceQueryExecution- Overrides:
execJsonItemsin classQueryExecutionAdapter
-
abort
public void abort()Description copied from class:QueryExecutionAdapterStop in mid execution. This method can be called in parallel with other methods on the QueryExecution object. There is no guarantee that the concrete implementation actual will stop or that it will do so immediately. No operations on the query execution or any associated result set are permitted after this call and may cause exceptions to be thrown.- Specified by:
abortin interfaceQueryExecution- Overrides:
abortin classQueryExecutionAdapter
-
close
public void close()Description copied from class:QueryExecutionAdapterClose the query execution and stop query evaluation as soon as convenient. QueryExecution objects, and aResultSetfromQueryExecutionAdapter.execSelect(), can not be used once the QueryExecution is closed. Model results fromQueryExecutionAdapter.execConstruct()andQueryExecutionAdapter.execDescribe()are still valid. It is important to close query execution objects in order to release resources such as working memory and to stop the query execution. Some storage subsystems require explicit ends of operations and this operation will cause those to be called where necessary. No operations on the query execution or any associated result set are permitted after this call.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceQueryExecution- Overrides:
closein classQueryExecutionAdapter
-
isClosed
public boolean isClosed()Description copied from class:QueryExecutionAdapterAnswer whether this QueryExecution object has been closed or not.- Specified by:
isClosedin interfaceQueryExecution- Overrides:
isClosedin classQueryExecutionAdapter- Returns:
- boolean
-
setTimeout
Description copied from class:QueryExecutionAdapterSet a timeout on the query execution. Processing will be aborted after the timeout (which starts when the appropriate exec call is made). Not all query execution systems support timeouts. A timeout of less than zero means no timeout.- Specified by:
setTimeoutin interfaceQueryExecution- Overrides:
setTimeoutin classQueryExecutionAdapter- See Also:
-
setTimeout
public void setTimeout(long timeout) Description copied from class:QueryExecutionAdapterSet time, in milliseconds- Specified by:
setTimeoutin interfaceQueryExecution- Overrides:
setTimeoutin classQueryExecutionAdapter- See Also:
-
setTimeout
Description copied from class:QueryExecutionAdapterSet timeouts on the query execution; the first timeout refers to time to first result, the second refers to overall query execution after the first result. Processing will be aborted if a timeout expires. Not all query execution systems support timeouts. A timeout of less than zero means no timeout; this can be used for timeout1 or timeout2.- Specified by:
setTimeoutin interfaceQueryExecution- Overrides:
setTimeoutin classQueryExecutionAdapter
-
setTimeout
public void setTimeout(long timeout1, long timeout2) Description copied from class:QueryExecutionAdapterSet time, in milliseconds- Specified by:
setTimeoutin interfaceQueryExecution- Overrides:
setTimeoutin classQueryExecutionAdapter- See Also:
-
getTimeout1
public long getTimeout1()Description copied from class:QueryExecutionAdapterReturn the first timeout (time to first result), in milliseconds: negative if unset- Specified by:
getTimeout1in interfaceQueryExecution- Overrides:
getTimeout1in classQueryExecutionAdapter
-
getTimeout2
public long getTimeout2()Description copied from class:QueryExecutionAdapterReturn the second timeout (overall query execution after first result), in milliseconds: negative if unset- Specified by:
getTimeout2in interfaceQueryExecution- Overrides:
getTimeout2in classQueryExecutionAdapter
-
setInitialBinding
Description copied from interface:QueryExecutionSet the initial association of variables and values. May not be supported by all QueryExecution implementations.The preferred way is to use
QueryExecutionDatasetBuilder.substitution(QuerySolution)which is supported uniformly for local and remote queries.- Specified by:
setInitialBindingin interfaceQueryExecution- Overrides:
setInitialBindingin classQueryExecutionAdapter
-