public abstract class BigdataRDFContext.AbstractQueryTask extends Object implements Callable<Void>
Modifier and Type | Field and Description |
---|---|
protected ASTContainer |
astContainer
The
ASTContainer provides access to the original SPARQL
query, the query model, the query plan, etc. |
protected String |
baseURI
The baseURI is set from the effective request URI.
|
protected Map<String,org.openrdf.model.Value> |
bindings
Bindings provided for query execution
|
protected Charset |
charset
The character encoding to use with the negotiated
mimeType
-or- null (it will be null for a binary
encoding). |
protected String |
fileExt
The file extension (without the leading ".") to use with the
negotiated
mimeType -or- null if this is a
SPARQL UPDATE request |
protected boolean |
includeInferred
Controls returning inferred triples.
|
protected String |
mimeType
The negotiated MIME type to be used for the query response (this
does not include the charset encoding) -or-
null if
this is a SPARQL UPDATE request. |
protected OutputStream |
os
Where to write the response.
|
protected Long |
queryId
The queryId as assigned by the SPARQL end point (rather than the
QueryEngine ). |
protected UUID |
queryId2
The queryId used by the
QueryEngine . |
protected QueryType |
queryType
A symbolic constant indicating the type of query.
|
protected javax.servlet.http.HttpServletRequest |
req
The request.
|
protected javax.servlet.http.HttpServletResponse |
resp
The response.
|
protected org.openrdf.query.impl.AbstractOperation |
sailQueryOrUpdate
The parsed query.
|
long |
timestamp
The timestamp of the view for that namespace against which the query
will be run.
|
protected boolean |
update
true iff this is a SPARQL UPDATE request. |
protected Future<Void> |
updateFuture
The
Future of the UpdateTask and null if
this is not a SPARQL UPDATE or if the UpdateTask has not
begun execution. |
Modifier | Constructor and Description |
---|---|
protected |
BigdataRDFContext.AbstractQueryTask(BigdataSailRepositoryConnection cxn,
String namespace,
long timestamp,
String baseURI,
boolean includeInferred,
Map<String,org.openrdf.model.Value> bindings,
ASTContainer astContainer,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
OutputStream os)
Version for SPARQL UPDATE.
|
protected |
BigdataRDFContext.AbstractQueryTask(BigdataSailRepositoryConnection cxn,
String namespace,
long timestamp,
String baseURI,
boolean includeInferred,
Map<String,org.openrdf.model.Value> bindings,
ASTContainer astContainer,
QueryType queryType,
String mimeType,
Charset charset,
String fileExt,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
OutputStream os)
Version for SPARQL QUERY.
|
Modifier and Type | Method and Description |
---|---|
Void |
call() |
protected abstract void |
doQuery(BigdataSailRepositoryConnection cxn,
OutputStream os)
Execute the query.
|
long |
getElapsedExecutionMillis()
Return the elapsed execution time in milliseconds.
|
protected void |
overrideDataset(org.openrdf.query.impl.AbstractOperation queryOrUpdate)
If the
HttpServletRequest included one or more of
then the Dataset for the query is replaced by the
Dataset constructed from those protocol parameters (the
parameters which are recognized are different for query and SPARQL
update). |
protected void |
setBindings(org.openrdf.query.impl.AbstractOperation queryOrUpdate) |
protected UUID |
setQueryId(ASTContainer astContainer)
Determines the
UUID which will be associated with the
IRunningQuery . |
public final long timestamp
protected final String baseURI
protected final boolean includeInferred
(getStatements ignored includeInferred)
protected final Map<String,org.openrdf.model.Value> bindings
protected final ASTContainer astContainer
ASTContainer
provides access to the original SPARQL
query, the query model, the query plan, etc.protected final boolean update
true
iff this is a SPARQL UPDATE request.protected final QueryType queryType
protected final String mimeType
null
if
this is a SPARQL UPDATE request.protected final Charset charset
mimeType
-or- null
(it will be null
for a binary
encoding).protected final String fileExt
mimeType
-or- null
if this is a
SPARQL UPDATE requestprotected final javax.servlet.http.HttpServletRequest req
protected final javax.servlet.http.HttpServletResponse resp
protected final OutputStream os
protected final Long queryId
QueryEngine
).protected volatile UUID queryId2
QueryEngine
. If the application has
not specified this using QueryHints.QUERYID
then this is
assigned and set on the query using QueryHints.QUERYID
. This
decision can not be made until we parse the query so the behavior is
handled by the subclasses. This also means that queryId2
is
NOT available until the BigdataRDFContext.AbstractQueryTask
begins to execute.
Note: Even though a SPARQL UPDATE request does not execute on the
QueryEngine
, a UUID
will also be bound for the SPARQL
UPDATE request. This provides us with a consistent identifier that
can be used by clients and in the XHTML UI on the status page to
refer to a SPARQL UPDATE request.
setQueryId(ASTContainer)
protected org.openrdf.query.impl.AbstractOperation sailQueryOrUpdate
BigdataSailQuery
implementations or BigdataSailUpdate
. They all extend
AbstractOperation
.
Note: This field is made visible by the volatile write on
queryId2
.
protected BigdataRDFContext.AbstractQueryTask(BigdataSailRepositoryConnection cxn, String namespace, long timestamp, String baseURI, boolean includeInferred, Map<String,org.openrdf.model.Value> bindings, ASTContainer astContainer, QueryType queryType, String mimeType, Charset charset, String fileExt, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, OutputStream os)
cxn
- The connection used to isolate the query or update
request.namespace
- The namespace against which the query will be run.timestamp
- The timestamp of the view for that namespace against which
the query will be run.baseURI
- The base URI.astContainer
- The container with all the information about the submitted
query, including the original SPARQL query, the parse
tree, etc.queryType
- The QueryType
.mimeType
- The MIME type to be used for the response. The caller must
verify that the MIME Type is appropriate for the query
type.charset
- The character encoding to use with the negotiated MIME
type (this is null
for binary encodings).fileExt
- The file extension (without the leading ".") to use with
that MIME Type.req
- The request.os
- Where to write the data for the query result.protected BigdataRDFContext.AbstractQueryTask(BigdataSailRepositoryConnection cxn, String namespace, long timestamp, String baseURI, boolean includeInferred, Map<String,org.openrdf.model.Value> bindings, ASTContainer astContainer, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, OutputStream os)
namespace
- The namespace against which the query will be run.timestamp
- The timestamp of the view for that namespace against which
the query will be run.baseURI
- The base URI.includeInferred
- when true
inferences will be included in the
visited access paths.astContainer
- The container with all the information about the submitted
query, including the original SPARQL query, the parse
tree, etc.req
- The request.resp
- The response.os
- Where to write the data for the query result.public long getElapsedExecutionMillis()
Note: This is used to report the elapsed time for the execution of
SPARQL UPDATE requests. Since SPARQL UPDATE requests are not run on
the QueryEngine
, IRunningQuery.getElapsed()
can not
be used for UPDATEs. It could also be used for QUERYs, but those are
run on the QueryEngine
and IRunningQuery.getElapsed()
may be used instead.
protected void overrideDataset(org.openrdf.query.impl.AbstractOperation queryOrUpdate)
HttpServletRequest
included one or more of
Dataset
for the query is replaced by the
Dataset
constructed from those protocol parameters (the
parameters which are recognized are different for query and SPARQL
update).queryOrUpdate
- The query.protected void setBindings(org.openrdf.query.impl.AbstractOperation queryOrUpdate)
protected UUID setQueryId(ASTContainer astContainer)
UUID
which will be associated with the
IRunningQuery
. If QueryHints.QUERYID
has already been
used by the application to specify the UUID
then that
UUID
is noted. Otherwise, a random UUID
is generated
and assigned to the query by binding it on the query hints.
Note: The ability to provide metadata from the ASTContainer
in the StatusServlet
or the "EXPLAIN" page depends on the
ability to cross walk the queryIds as established by this method.
query
- The query.UUID
which will be associated with the
IRunningQuery
and never null
.protected abstract void doQuery(BigdataSailRepositoryConnection cxn, OutputStream os) throws Exception
cxn
- The connection.os
- Where the write the query results.Exception
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.