public class BigdataRDFContext extends BigdataBaseContext
QueryServlet
(s) for the same
IIndexManager
.Modifier and Type | Class and Description |
---|---|
class |
BigdataRDFContext.AbstractQueryTask
Abstract base class for running queries handles the timing, pipe,
reporting, obtains the connection, and provides the finally {} semantics
for each type of query task.
|
Modifier and Type | Field and Description |
---|---|
protected static String |
ANALYTIC
URL Query parameter used to request the "analytic" query hints.
|
protected static String |
CONTEXT_URI
URL query parameter used to specify the default context(s) for INSERT
(POST-WITH-URIs, POST-WITH-BODY).
|
protected static String |
DEFAULT_GRAPH_URI
URL query parameter used to specify a URI in the default graph for SPARQL
query (but not for SPARQL update).
|
protected static String |
DEFAULT_XSL_STYLESHEET
The default XSL style sheet.
|
protected static String |
EXPLAIN
URL Query parameter used to request the explanation of a query rather
than its results.
|
protected static String |
EXPLAIN_DETAILS
Optional value for the
EXPLAIN URL query parameter that may be
used to request more detail in the "EXPLAIN" of a query. |
static String |
HTTP_HEADER_BIGDATA_MAX_QUERY_MILLIS
HTTP header may be used to specify the timeout for a query.
|
static String |
HTTP_HEADER_ECHO_BACK_QUERY
HTTP header may be used to echo back the query.
|
protected static String |
MONITOR
URL Query parameter used to request an incremental XHTML representation
reporting on the progress of a SPARQL UPDATE.
|
protected static String |
NAMED_GRAPH_URI
URL query parameter used to specify a URI in the set of named graphs for
SPARQL query (but not for SPARQL update).
|
protected static String |
NAMESPACE
URL query parameter used to specify a non-default KB namespace (as an
alternative to having it in the URL path).
|
protected static String |
RTO
URL Query parameter used to request the use of the Runtime Query
Optimizer.
|
protected static String |
URI
URL query parameter used to specify the URI(s) from which data will be
loaded for INSERT (POST-WITH-URIs.
|
protected static String |
USING_GRAPH_URI
URL query parameter used to specify a URI in the default graph for SPARQL
UPDATE.
|
protected static String |
USING_NAMED_GRAPH_URI
URL query parameter used to specify a URI in the set of named graphs for
SPARQL UPDATE.
|
protected static String |
XHTML
URL Query parameter used to request an XHTML response for SPARQL
QUERY or SPARQL UPDATE.
|
protected static String |
XSL_STYLESHEET
URL Query parameter used to specify an XSL style sheet to be associated
with the response in combination with the
XHTML URL query
parameter. |
Constructor and Description |
---|
BigdataRDFContext(SparqlEndpointConfig config,
IIndexManager indexManager) |
Modifier and Type | Method and Description |
---|---|
void |
abortTx(long tx)
Abort a transaction obtained by
newTx(long) . |
static void |
addHtmlHeader(XMLBuilder.Node current,
String charset)
Utility method to consolidate header into a single location.
|
void |
commitTx(long tx)
Commit a transaction obtained by
newTx(long) |
static String |
getBaseURI(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Return the effective baseURI for the request.
|
SparqlEndpointConfig |
getConfig() |
protected static Boolean |
getEffectiveBooleanValue(String s,
Boolean defaultValue)
Return the effective boolean value of a URL query parameter such as
"analytic".
|
protected static String |
getEffectiveStringValue(String s,
String defaultValue)
Return the effective string value of a URL query parameter.
|
List<String> |
getNamespacesTx(long tx) |
AtomicLong |
getQueryIdFactory() |
BigdataRDFContext.AbstractQueryTask |
getQueryTask(BigdataSailRepositoryConnection cxn,
String namespace,
long timestamp,
String queryStr,
String baseURI,
ASTContainer astContainer,
boolean includeInferred,
Map<String,org.openrdf.model.Value> bindings,
String acceptOverride,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
OutputStream os)
Return the task which will execute the SPARQL Query -or- SPARQL UPDATE.
|
ThreadPoolExecutorBaseStatisticsTask |
getSampleTask() |
AbstractTripleStore |
getTripleStore(String namespace,
long timestamp)
Return a read-only view of the
AbstractTripleStore for the given
namespace will read from the commit point associated with the given
timestamp. |
long |
newTx(long timestamp)
Obtain a new transaction to protect operations against the specified view
of the database.
|
getIndexManager, isScaleOut
protected static final String EXPLAIN
protected static final String EXPLAIN_DETAILS
EXPLAIN
URL query parameter that may be
used to request more detail in the "EXPLAIN" of a query.protected static final String ANALYTIC
null
, in which case we do not set
QueryHints.ANALYTIC
query hint.protected static final String RTO
protected static final String XHTML
protected static final String XSL_STYLESHEET
XHTML
URL query
parameter.protected static final String DEFAULT_XSL_STYLESHEET
XSL_STYLESHEET
protected static final String MONITOR
Note: When this option is specified, the SPARQL UPDATE will use an HTTP status code of 200 (Ok) even if the UPDATE fails. In the event of an UPDATE failure, the stack trace will be formatted into the response.
protected static final String DEFAULT_GRAPH_URI
protected static final String NAMED_GRAPH_URI
protected static final String USING_GRAPH_URI
protected static final String URI
InsertServlet
,
Constant Field Valuesprotected static final String CONTEXT_URI
InsertServlet
,
Constant Field Valuesprotected static final String USING_NAMED_GRAPH_URI
protected static final String NAMESPACE
public static final String HTTP_HEADER_BIGDATA_MAX_QUERY_MILLIS
(Set timeout on remote query)
,
Constant Field Valuespublic static final String HTTP_HEADER_ECHO_BACK_QUERY
public BigdataRDFContext(SparqlEndpointConfig config, IIndexManager indexManager)
public final AtomicLong getQueryIdFactory()
public SparqlEndpointConfig getConfig()
public ThreadPoolExecutorBaseStatisticsTask getSampleTask()
public static String getBaseURI(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
req
- The request.resp
- The response.protected static Boolean getEffectiveBooleanValue(String s, Boolean defaultValue)
&analytic
, then
it will be reported as true
.s
- The value of the URL query parameter.defaultValue
- The default value to return if the parameter was not given.protected static String getEffectiveStringValue(String s, String defaultValue)
s
- The value of the URL query parameter.defaultValue
- The default value to return if the parameter was not given or
given without an explicit value.public BigdataRDFContext.AbstractQueryTask getQueryTask(BigdataSailRepositoryConnection cxn, String namespace, long timestamp, String queryStr, String baseURI, ASTContainer astContainer, boolean includeInferred, Map<String,org.openrdf.model.Value> bindings, String acceptOverride, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, OutputStream os) throws org.openrdf.query.MalformedQueryException, IOException
Note: The OutputStream
is passed in rather than the
HttpServletResponse
in order to permit operations such as
"DELETE WITH QUERY" where this method is used in a context which writes
onto an internal pipe rather than onto the HttpServletResponse
.
namespace
- The namespace associated with the AbstractTripleStore
view.timestamp
- The timestamp associated with the AbstractTripleStore
view.queryStr
- The query (for log messages).baseURI
- The baseURI (since BLZG-2039).astContainer
- The ASTContainer for the already parsed query (since BLZG-2039).includeInferred
- acceptOverride
- Override the Accept header (optional). This is used by UPDATE
and DELETE so they can control the RDFFormat
of the
materialized query results.req
- The request.resp
- The response.os
- Where to write the results. Note: This is NOT always the
OutputStream associated with the response! For
DELETE-WITH-QUERY and UPDATE-WITH-QUERY this is a
PipedOutputStream.IOException
org.openrdf.query.MalformedQueryException
public AbstractTripleStore getTripleStore(String namespace, long timestamp)
AbstractTripleStore
for the given
namespace will read from the commit point associated with the given
timestamp.namespace
- The namespace.timestamp
- A timestamp -or- a tx identifier.AbstractTripleStore
-or- null
if none is
found for that namespace and timestamp.
FIXME GROUP_COMMIT: Review all callers. They are suspect. The
code will sometimes resolve the KB as of the timestamp, but,
given that the default is to read against the lastCommitTime,
that does NOT prevent a concurrent destroy or create of a KB that
invalidates such a pre-condition test. The main reason for such
pre-condition tests is to provide nice HTTP status code responses
when an identified namespace does (or does not) exist. The better
way to handle this is by pushing the pre-condition test down into
the AbstractRestApiTask
and then throwning out an appropriate
marked exception that gets correctly converted into an HTTP
BAD_REQUEST message rather than sending back a stack trace.public long newTx(long timestamp)
BigdataSail.BigdataSailConnection
for what would otherwise amount to dirty
reads. This is especially critical for reads on the global row store
since it can not be protected by the BigdataSail.BigdataSailConnection
for
cases where the KB instance does not yet exist. The presence of such a tx
does NOT prevent concurrent commits. It only prevents recycling during
such commits (and even then only on the RWStore backend).timestamp
- The timestamp for the desired view.timestamp
if the
IIndexManager
is not a Journal
.ITransactionService.newTx(long)
,
NSS concurrency
problem with list namespaces and create namespace public void abortTx(long tx)
newTx(long)
. This decements the
native active transaction counter for the RWStore. Once that counter
reaches zero, recycling will occur the next time an unisolated mutation
goes through a commit on the journal.tx
- The transaction identifier.public void commitTx(long tx)
newTx(long)
tx
- The transaction identifier.public static void addHtmlHeader(XMLBuilder.Node current, String charset) throws IOException
current
- IOException
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.