Class TripleSourceBase
java.lang.Object
org.eclipse.rdf4j.federated.evaluation.TripleSourceBase
- All Implemented Interfaces:
TripleSource
- Direct Known Subclasses:
SailTripleSource
,SparqlTripleSource
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static interface
Interface defining the operation to be perform on the connectionprotected static class
Holder for a result iteration to be used withwithConnection(ConnectionOperation)
. -
Field Summary
Modifier and TypeFieldDescriptionprotected final Endpoint
protected final FederationContext
protected final Monitoring
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
applyMaxExecutionTimeUpperBound
(Operation operation) Apply an upper bound of the maximum execution time usingFedXUtil.applyMaxQueryExecutionTime(Operation, FederationContext)
.protected void
configureInference
(Query query, QueryInfo queryInfo) Set includeInferred depending onQueryInfo.getIncludeInferred()
getStatements
(String preparedQuery, BindingSet bindings, FilterValueExpr filterExpr, QueryInfo queryInfo) Evaluate the prepared query (SPARQL query as String) on the provided endpoint.getStatements
(String preparedQuery, BindingSet queryBindings, QueryType queryType, QueryInfo queryInfo) Evaluate a given SPARQL query of the provided query type at the given source.boolean
hasStatements
(ExclusiveTupleExpr group, BindingSet bindings) Check if the repository can return results for the givenExclusiveTupleExpr
, e.g.boolean
Check if the repository can return results for the given triple pattern represented by subj, pred and objprotected void
protected <T> CloseableIteration<T>
withConnection
(TripleSourceBase.ConnectionOperation<T> operation) Convenience method to perform an operation on aRepositoryConnection
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.rdf4j.federated.evaluation.TripleSource
getStatements, getStatements, getStatements, hasStatements, usePreparedQuery
-
Field Details
-
federationContext
-
monitoringService
-
endpoint
-
-
Constructor Details
-
TripleSourceBase
-
-
Method Details
-
getStatements
public CloseableIteration<BindingSet> getStatements(String preparedQuery, BindingSet queryBindings, QueryType queryType, QueryInfo queryInfo) throws RepositoryException, MalformedQueryException, QueryEvaluationException Description copied from interface:TripleSource
Evaluate a given SPARQL query of the provided query type at the given source.- Specified by:
getStatements
in interfaceTripleSource
- Parameters:
preparedQuery
-queryBindings
- optional query bindings, useEmptyBindingSet
if there are nonequeryType
-queryInfo
-- Returns:
- the statements
- Throws:
RepositoryException
MalformedQueryException
QueryEvaluationException
-
getStatements
public CloseableIteration<BindingSet> getStatements(String preparedQuery, BindingSet bindings, FilterValueExpr filterExpr, QueryInfo queryInfo) throws RepositoryException, MalformedQueryException, QueryEvaluationException Description copied from interface:TripleSource
Evaluate the prepared query (SPARQL query as String) on the provided endpoint.- Specified by:
getStatements
in interfaceTripleSource
- Parameters:
preparedQuery
- a prepared query to evaluate (SPARQL query as String)bindings
- the bindings to usefilterExpr
- the filter expression to apply or null if there is no filter or if it is evaluated already- Returns:
- the resulting iteration
- Throws:
RepositoryException
MalformedQueryException
QueryEvaluationException
-
hasStatements
public boolean hasStatements(Resource subj, IRI pred, Value obj, QueryInfo queryInfo, Resource... contexts) throws RepositoryException Description copied from interface:TripleSource
Check if the repository can return results for the given triple pattern represented by subj, pred and obj- Specified by:
hasStatements
in interfaceTripleSource
- Parameters:
subj
-pred
-obj
-queryInfo
-contexts
-- Returns:
- whether the source can provide results
- Throws:
RepositoryException
-
hasStatements
public boolean hasStatements(ExclusiveTupleExpr group, BindingSet bindings) throws RepositoryException, MalformedQueryException, QueryEvaluationException Description copied from interface:TripleSource
Check if the repository can return results for the givenExclusiveTupleExpr
, e.g. for anExclusiveGroup
with a list of Statements.- Specified by:
hasStatements
in interfaceTripleSource
- Parameters:
bindings
-- Returns:
- whether the repository can return results
- Throws:
RepositoryException
MalformedQueryException
QueryEvaluationException
-
monitorRemoteRequest
protected void monitorRemoteRequest() -
configureInference
Set includeInferred depending onQueryInfo.getIncludeInferred()
- Parameters:
query
-queryInfo
-
-
applyMaxExecutionTimeUpperBound
Apply an upper bound of the maximum execution time usingFedXUtil.applyMaxQueryExecutionTime(Operation, FederationContext)
.- Parameters:
operation
- the operation
-
withConnection
protected <T> CloseableIteration<T> withConnection(TripleSourceBase.ConnectionOperation<T> operation) Convenience method to perform an operation on aRepositoryConnection
. This method takes care for closing resources as well error handling. The resulting iteration has to be supplied to theTripleSourceBase.ResultHolder
.- Parameters:
operation
- theTripleSourceBase.ConnectionOperation
- Returns:
- the resulting iteration
-