public class RepositoryFederatedService extends Object implements FederatedService
Repository
to communicate with a
SPARQL endpoint.Modifier and Type | Field and Description |
---|---|
protected RepositoryConnection |
conn |
protected Repository |
rep |
protected boolean |
shutDown |
Constructor and Description |
---|
RepositoryFederatedService(Repository repo) |
RepositoryFederatedService(Repository repo,
boolean shutDown) |
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) |
boolean |
ask(Service service,
BindingSet bindings,
String baseUri)
Evaluate the provided sparqlQueryString at the initialized
Repository of this FederatedService . |
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.
|
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
Repository of this FederatedService . |
protected RepositoryConnection |
getConnection() |
void |
initialize()
Method to perform any initializations, invoked after construction.
|
boolean |
isInitialized()
Method to check if
FederatedService.initialize() had been called. |
CloseableIteration<BindingSet,QueryEvaluationException> |
select(Service service,
Set<String> projectionVars,
BindingSet bindings,
String baseUri)
Evaluate the provided sparqlQueryString at the initialized
Repository of this FederatedService . |
void |
shutdown()
Method to perform any shutDown code, invoked at unregistering.
|
protected final Repository rep
protected boolean shutDown
protected RepositoryConnection conn
public RepositoryFederatedService(Repository repo)
repo
- the repository to be usedpublic RepositoryFederatedService(Repository repo, boolean shutDown)
repo
- the repository to be usedshutDown
- a flag indicating whether the repository shall be closed in shutdown()
public CloseableIteration<BindingSet,QueryEvaluationException> select(Service service, Set<String> projectionVars, BindingSet bindings, String baseUri) throws QueryEvaluationException
Repository
of this FederatedService
. Insert bindings
into SELECT query and evaluateselect
in interface FederatedService
service
- the reference to the service node, contains additional meta
information (vars, prefixes)projectionVars
- The variables with unknown value that should be projected from this
evaluationbindings
- the bindings serving as additional constraintsQueryEvaluationException
- If there was an exception generated while evaluating the query.public boolean ask(Service service, BindingSet bindings, String baseUri) throws QueryEvaluationException
Repository
of this FederatedService
. Insert
bindings, send ask query and return final resultask
in interface FederatedService
service
- the reference to the service node, contains additional meta
information (vars, prefixes)bindings
- the bindings serving as additional constraintstrue
if at least one result existsQueryEvaluationException
- If there was an exception generated while evaluating the query.public CloseableIteration<BindingSet,QueryEvaluationException> evaluate(Service service, CloseableIteration<BindingSet,QueryEvaluationException> bindings, String baseUri) throws QueryEvaluationException
FederatedService
Contracts:
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
- If there was an exception generated while evaluating the query.protected CloseableIteration<BindingSet,QueryEvaluationException> evaluateInternal(Service service, CloseableIteration<BindingSet,QueryEvaluationException> bindings, String baseUri) throws QueryEvaluationException
Repository
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 QueryEvaluationException
FederatedService
initialize
in interface FederatedService
QueryEvaluationException
- If there was an exception generated while initializing the
service.public boolean isInitialized()
FederatedService
FederatedService.initialize()
had been called.isInitialized
in interface FederatedService
public void shutdown() throws QueryEvaluationException
FederatedService
shutdown
in interface FederatedService
QueryEvaluationException
- If there was an exception generated while shutting down the
service.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-2016 Aduna. All Rights Reserved.