Class TripleSourceBase
- java.lang.Object
-
- org.eclipse.rdf4j.federated.evaluation.TripleSourceBase
-
- All Implemented Interfaces:
TripleSource
- Direct Known Subclasses:
SailTripleSource,SparqlTripleSource
public abstract class TripleSourceBase extends Object implements TripleSource
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interfaceTripleSourceBase.ConnectionOperation<T>Interface defining the operation to be perform on the connectionprotected static classTripleSourceBase.ResultHolder<T>Holder for a result iteration to be used withwithConnection(ConnectionOperation).
-
Field Summary
Fields Modifier and Type Field Description protected Endpointendpointprotected FederationContextfederationContextprotected MonitoringmonitoringService
-
Constructor Summary
Constructors Constructor Description TripleSourceBase(FederationContext federationContext, Endpoint endpoint)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidapplyMaxExecutionTimeUpperBound(Operation operation)Apply an upper bound of the maximum execution time usingFedXUtil.applyMaxQueryExecutionTime(Operation, FederationContext).protected voidconfigureInference(Query query, QueryInfo queryInfo)Set includeInferred depending onQueryInfo.getIncludeInferred()CloseableIteration<BindingSet,QueryEvaluationException>getStatements(String preparedQuery, BindingSet bindings, FilterValueExpr filterExpr, QueryInfo queryInfo)Evaluate the prepared query (SPARQL query as String) on the provided endpoint.CloseableIteration<BindingSet,QueryEvaluationException>getStatements(String preparedQuery, BindingSet queryBindings, QueryType queryType, QueryInfo queryInfo)Evaluate a given SPARQL query of the provided query type at the given source.booleanhasStatements(ExclusiveTupleExpr group, BindingSet bindings)Check if the repository can return results for the givenExclusiveTupleExpr, e.g.booleanhasStatements(Resource subj, IRI pred, Value obj, QueryInfo queryInfo, Resource... contexts)Check if the repository can return results for the given triple pattern represented by subj, pred and objprotected voidmonitorRemoteRequest()protected <T> CloseableIteration<T,QueryEvaluationException>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, getStatements, hasStatements, usePreparedQuery, usePreparedQuery
-
-
-
-
Field Detail
-
federationContext
protected final FederationContext federationContext
-
monitoringService
protected final Monitoring monitoringService
-
endpoint
protected final Endpoint endpoint
-
-
Constructor Detail
-
TripleSourceBase
public TripleSourceBase(FederationContext federationContext, Endpoint endpoint)
-
-
Method Detail
-
getStatements
public CloseableIteration<BindingSet,QueryEvaluationException> getStatements(String preparedQuery, BindingSet queryBindings, QueryType queryType, QueryInfo queryInfo) throws RepositoryException, MalformedQueryException, QueryEvaluationException
Description copied from interface:TripleSourceEvaluate a given SPARQL query of the provided query type at the given source.- Specified by:
getStatementsin interfaceTripleSourcequeryBindings- optional query bindings, useEmptyBindingSetif there are none- Returns:
- the statements
- Throws:
RepositoryExceptionMalformedQueryExceptionQueryEvaluationException
-
getStatements
public CloseableIteration<BindingSet,QueryEvaluationException> getStatements(String preparedQuery, BindingSet bindings, FilterValueExpr filterExpr, QueryInfo queryInfo) throws RepositoryException, MalformedQueryException, QueryEvaluationException
Description copied from interface:TripleSourceEvaluate the prepared query (SPARQL query as String) on the provided endpoint.- Specified by:
getStatementsin 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:
RepositoryExceptionMalformedQueryExceptionQueryEvaluationException
-
hasStatements
public boolean hasStatements(Resource subj, IRI pred, Value obj, QueryInfo queryInfo, Resource... contexts) throws RepositoryException
Description copied from interface:TripleSourceCheck if the repository can return results for the given triple pattern represented by subj, pred and obj- Specified by:
hasStatementsin interfaceTripleSource- 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:TripleSourceCheck if the repository can return results for the givenExclusiveTupleExpr, e.g. for anExclusiveGroupwith a list of Statements.- Specified by:
hasStatementsin interfaceTripleSource- Returns:
- whether the repository can return results
- Throws:
RepositoryExceptionMalformedQueryExceptionQueryEvaluationException
-
monitorRemoteRequest
protected void monitorRemoteRequest()
-
configureInference
protected void configureInference(Query query, QueryInfo queryInfo)
Set includeInferred depending onQueryInfo.getIncludeInferred()- Parameters:
query-queryInfo-
-
applyMaxExecutionTimeUpperBound
protected void applyMaxExecutionTimeUpperBound(Operation operation)
Apply an upper bound of the maximum execution time usingFedXUtil.applyMaxQueryExecutionTime(Operation, FederationContext).- Parameters:
operation- the operation
-
withConnection
protected <T> CloseableIteration<T,QueryEvaluationException> 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
-
-