public abstract class StoredQueryService extends AbstractServiceFactoryBase
IVs from the application.
In order to use a stored query, a concrete instance of this class must be
registered against the ServiceRegistry. The choice of the SERVICE URI
is up to the application. The effective value of the baseURI during query
evaluation will be the SERVICE URI.
final URI serviceURI = new URIImpl(
"http://www.bigdata.com/rdf/stored-query#my-stored-query");
ServiceRegistry.getInstance().add(serviceURI, new MyStoredQueryService());
Thereafter, the stored query may be referenced from SPARQL using its assigned
service URI:
SELECT * {
SERVICE { }
}
The SERVICE invocation may include a group graph pattern that will be parsed
and made accessible to the stored query service as a ServiceParams
object. For example:
SELECT * {
SERVICE {
bd:serviceParam :color :"blue" .
bd:serviceParam :color :"green" .
bd:serviceParam :size :"large" .
}
}
will provide the stored query with two bindings for the
:color = {"blue", "green"} and one binding for
:size = {"large"}. The value key names, the allowed value types
for each key name, and the interpretation of those values are all specific to
a given stored query service implementation class. They will be provided to
that class as a ServiceParams object.SELECT * { SERVICE bsq:my-service {} }| Modifier and Type | Class and Description |
|---|---|
static interface |
StoredQueryService.Options |
| Constructor and Description |
|---|
StoredQueryService() |
| Modifier and Type | Method and Description |
|---|---|
ExternalServiceCall |
create(ServiceCallCreateParams params)
Create a service invocation object.
|
ExternalServiceCall |
create(ServiceCallCreateParams createParams,
ServiceParams serviceParams) |
protected abstract org.openrdf.query.TupleQueryResult |
doQuery(BigdataSailRepositoryConnection cxn,
ServiceCallCreateParams createParams,
ServiceParams serviceParams)
Abstract method for core application logic.
|
IServiceOptions |
getServiceOptions()
Return options for the service end point.
|
getDesiredBound, getRequiredBoundpublic IServiceOptions getServiceOptions()
ServiceFactorypublic final ExternalServiceCall create(ServiceCallCreateParams params)
ServiceFactoryparams - The pararameters, which are encapsulated by this interface.public ExternalServiceCall create(ServiceCallCreateParams createParams, ServiceParams serviceParams)
protected abstract org.openrdf.query.TupleQueryResult doQuery(BigdataSailRepositoryConnection cxn, ServiceCallCreateParams createParams, ServiceParams serviceParams) throws Exception
cxn - The connection that should be used to read on the SPARQL
database. The connection will be closed by the caller.createParams - The SERVICE creation parameters.serviceParams - The SERVICE invocation parameters.ExceptionCopyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.