public class SPARQLFederatedService extends Object implements FederatedService
SPARQLRepository
to communicate with a
SPARQL endpoint.FederatedService.QueryType
Modifier and Type | Field and Description |
---|---|
protected RepositoryConnection |
conn |
protected SPARQLRepository |
rep |
Constructor and Description |
---|
SPARQLFederatedService(String serviceUrl) |
Modifier and Type | Method and Description |
---|---|
protected static StringBuilder |
appendLiteral(StringBuilder sb,
Literal lit)
Append the literal to the stringbuilder: "myLiteral"^^
|
protected static StringBuilder |
appendURI(StringBuilder sb,
URI uri)
Append the uri to the stringbuilder, i.e.
|
protected StringBuilder |
appendValueAsString(StringBuilder sb,
Value value) |
CloseableIteration<BindingSet,QueryEvaluationException> |
evaluate(Service service,
CloseableIteration<BindingSet,QueryEvaluationException> bindings,
String baseUri)
Evaluate the provided SPARQL query at this federated service,
possibilities for vectored evaluation.
|
CloseableIteration<BindingSet,QueryEvaluationException> |
evaluate(String sparqlQueryString,
BindingSet bindings,
String baseUri,
FederatedService.QueryType type,
Service service)
Evaluate the provided sparqlQueryString at the initialized
SPARQLRepository of this FederatedService . |
protected CloseableIteration<BindingSet,QueryEvaluationException> |
evaluateInternal(Service service,
CloseableIteration<BindingSet,QueryEvaluationException> bindings,
String baseUri)
Evaluate the SPARQL query that can be constructed from the SERVICE node at
the initialized
SPARQLRepository of this FederatedService . |
protected RepositoryConnection |
getConnection() |
void |
initialize()
Method to perform any initializations, invoked after construction.
|
void |
shutdown()
Method to perform any shutDown code, invoked at unregistering.
|
protected final SPARQLRepository rep
protected RepositoryConnection conn
public SPARQLFederatedService(String serviceUrl)
serviceUrl
- the serviceUrl use to initialize the inner SPARQLRepository
public CloseableIteration<BindingSet,QueryEvaluationException> evaluate(String sparqlQueryString, BindingSet bindings, String baseUri, FederatedService.QueryType type, Service service) throws QueryEvaluationException
SPARQLRepository
of this FederatedService
. Dependent on
the type (ASK/SELECT) different evaluation is necessary: SELECT: insert
bindings into SELECT query and evaluate ASK: insert bindings, send ask
query and return final resultevaluate
in interface FederatedService
sparqlQueryString
- a SPARQL query (either SELECT or ASK, compare type parameter)bindings
- the bindings serving as additional constraintstype
- the FederatedService.QueryType
, either ASK or SELECTservice
- the reference to the service node, contains additional meta
information (vars, prefixes)QueryEvaluationException
public CloseableIteration<BindingSet,QueryEvaluationException> evaluate(Service service, CloseableIteration<BindingSet,QueryEvaluationException> bindings, String baseUri) throws QueryEvaluationException
FederatedService
Contracts:
InsertBindingSetCursor
.
Compare SPARQLFederatedService
for a reference implementation
evaluate
in interface FederatedService
service
- the reference to the service node, contains information to
construct the querybindings
- the bindings serving as additional constraints (for vectored
evaluation)baseUri
- the baseUriQueryEvaluationException
protected CloseableIteration<BindingSet,QueryEvaluationException> evaluateInternal(Service service, CloseableIteration<BindingSet,QueryEvaluationException> bindings, String baseUri) throws QueryEvaluationException
SPARQLRepository
of this FederatedService
.
Use specified bindings as constraints to the query. Try to evaluate using
BINDINGS clause, if this yields an exception fall back to the naive
implementation. This method deals with SILENT SERVICEs.QueryEvaluationException
public void initialize() throws RepositoryException
FederatedService
initialize
in interface FederatedService
RepositoryException
public void shutdown() throws RepositoryException
FederatedService
shutdown
in interface FederatedService
RepositoryException
protected RepositoryConnection getConnection() throws RepositoryException
RepositoryException
protected StringBuilder appendValueAsString(StringBuilder sb, Value value)
protected static StringBuilder appendURI(StringBuilder sb, URI uri)
sb
- uri
- protected static StringBuilder appendLiteral(StringBuilder sb, Literal lit)
sb
- lit
- Copyright © 2001-2013 Aduna. All Rights Reserved.