public class RepositoryFederatedService extends Object implements FederatedService
Repository
to communicate with a SPARQL endpoint.Modifier and Type | Field and Description |
---|---|
protected int |
boundJoinBlockSize
The number of bindings sent in a single subquery in
evaluate(Service, CloseableIteration, String) If
blockSize is set to 0, the entire input stream is used as block input the block size effectively determines the
number of remote requests |
protected boolean |
shutDown |
Constructor and Description |
---|
RepositoryFederatedService(Repository repo) |
RepositoryFederatedService(Repository repo,
boolean shutDown) |
Modifier and Type | Method and Description |
---|---|
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 . |
int |
getBoundJoinBlockSize() |
protected RepositoryConnection |
getConnection()
Retrieve a (re-usable) connection.
|
void |
initialize()
Method to perform any initializations, invoked after construction.
|
protected String |
insertValuesClause(String queryString,
String valuesClause)
Insert the constructed VALUES clause in the beginning of the WHERE block.
|
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 |
setBoundJoinBlockSize(int boundJoinBlockSize) |
void |
setUseFreshConnection(boolean flag) |
void |
shutdown()
Method to perform any shutDown code, invoked at unregistering.
|
protected int boundJoinBlockSize
evaluate(Service, CloseableIteration, String)
If
blockSize is set to 0, the entire input stream is used as block input the block size effectively determines the
number of remote requestsprotected boolean shutDown
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 VALUES
clause, if this yields an exception fall back to the naive implementation. This method deals with SILENT
SERVICEs.QueryEvaluationException
protected String insertValuesClause(String queryString, String valuesClause)
ROW_IDX_VAR
projection if it is not already present.queryString
- the SELECT query string from the SERVICE nodevaluesClause
- the constructed VALUES clausepublic 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 int getBoundJoinBlockSize()
public void setBoundJoinBlockSize(int boundJoinBlockSize)
boundJoinBlockSize
- the bound join block size, 0 to evaluate all in a single requestpublic void setUseFreshConnection(boolean flag)
flag
- whether to use a fresh RepositoryConnection
for each individual querypublic 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
Copyright © 2015-2022 Eclipse Foundation. All Rights Reserved.