Class SparqlFederationEvalStrategy
java.lang.Object
org.eclipse.rdf4j.query.algebra.evaluation.impl.DefaultEvaluationStrategy
org.eclipse.rdf4j.query.algebra.evaluation.impl.StrictEvaluationStrategy
org.eclipse.rdf4j.federated.evaluation.FederationEvalStrategy
org.eclipse.rdf4j.federated.evaluation.SparqlFederationEvalStrategy
- All Implemented Interfaces:
EvaluationStrategy, FederatedServiceResolver, FederatedServiceResolverClient
@Deprecated(forRemoval=true)
public class SparqlFederationEvalStrategy
extends FederationEvalStrategy
Deprecated, for removal: This API element is subject to removal in a future version.
Implementation of a federation evaluation strategy which provides some special optimizations for SPARQL (remote)
endpoints. The most important optimization is to used prepared SPARQL Queries that are already created using Strings.
Joins are executed using ControlledWorkerBindJoin.
This implementation uses the SPARQL 1.1 VALUES operator for the bound-join evaluation
s- Author:
- Andreas Schwarte
-
Field Summary
Fields inherited from class FederationEvalStrategy
cache, executor, federationContextModifier and TypeFieldDescriptionprotected SourceSelectionCacheprotected Executorprotected FederationContextFields inherited from class DefaultEvaluationStrategy
dataset, serviceResolver, tripleSourceModifier and TypeFieldDescriptionprotected final Datasetprotected FederatedServiceResolverprotected final TripleSource -
Constructor Summary
ConstructorsConstructorDescriptionSparqlFederationEvalStrategy(FederationContext federationContext) Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionevaluateBoundJoinStatementPattern(StatementTupleExpr stmt, List<BindingSet> bindings) Deprecated, for removal: This API element is subject to removal in a future version.Evaluate a bound join at the relevant endpoint, i.e. i.e. for a group of bindings retrieve results for the bound statement from the relevant endpointsprotected CloseableIteration<BindingSet> evaluateBoundJoinStatementPattern_UNION(StatementTupleExpr stmt, List<BindingSet> bindings) Deprecated, for removal: This API element is subject to removal in a future version.no longer usedevaluateExclusiveGroup(ExclusiveGroup group, BindingSet bindings) Deprecated, for removal: This API element is subject to removal in a future version.evaluateGroupedCheck(CheckStatementPattern stmt, List<BindingSet> bindings) Deprecated, for removal: This API element is subject to removal in a future version.Perform a grouped check at the relevant endpoints, i.e. for a group of bindings keep only those for which at least one endpoint provides a result to the bound statement.executeJoin(ControlledWorkerScheduler<BindingSet> joinScheduler, CloseableIteration<BindingSet> leftIter, TupleExpr rightArg, Set<String> joinVars, BindingSet bindings, QueryInfo queryInfo) Deprecated, for removal: This API element is subject to removal in a future version.Execute the join in a separate thread using some join executor.protected CloseableIteration<BindingSet> executeLeftJoin(ControlledWorkerScheduler<BindingSet> joinScheduler, CloseableIteration<BindingSet> leftIter, LeftJoin leftJoin, BindingSet bindings, QueryInfo queryInfo) Deprecated, for removal: This API element is subject to removal in a future version.Execute the left join in a separate thread using some join executor.Methods inherited from class FederationEvalStrategy
evaluate, evaluate, evaluate, evaluate, evaluate, evaluateArbitrayLengthPath, evaluateAtStatementSources, evaluateAtStatementSources, evaluateAtStatementSources, evaluateExclusiveTupleExpr, evaluateLeftBoundJoinStatementPattern, evaluateLeftJoin, evaluateNaryUnion, evaluateNJoin, evaluateService, evaluateService, evaluateSingleSourceQuery, evaluateZeroLengthPath, getAccessibleFederationMembers, getMembersFromContext, getStatements, hasStatements, optimize, optimizeExclusiveExpressions, optimizeJoinOrder, performSourceSelection, performSourceSelection, precompile, precompile, prepare, prepare, prepare, prepare, prepare, prepareExclusiveTupleExpr, prepareLeftJoin, prepareNaryUnion, prepareNJoin, propagateServicesModifier and TypeMethodDescriptionevaluate(ConjunctiveFilterExpr node, BindingSet bindings) evaluate(FilterExpr node, BindingSet bindings) evaluate(DescribeOperator operator, BindingSet bindings) evaluate(TupleExpr expr, BindingSet bindings) Deprecated, for removal: This API element is subject to removal in a future version.evaluate(ValueExpr expr, BindingSet bindings) Deprecated, for removal: This API element is subject to removal in a future version.protected CloseableIteration<BindingSet> evaluateArbitrayLengthPath(FedXArbitraryLengthPath alp, BindingSet bindings) protected CloseableIteration<BindingSet> evaluateAtStatementSources(Object preparedQuery, List<StatementSource> statementSources, QueryInfo queryInfo) protected CloseableIteration<BindingSet> evaluateAtStatementSources(String preparedQuery, List<StatementSource> statementSources, QueryInfo queryInfo) protected CloseableIteration<BindingSet> evaluateAtStatementSources(TupleExpr preparedQuery, List<StatementSource> statementSources, QueryInfo queryInfo) protected CloseableIteration<BindingSet> evaluateExclusiveTupleExpr(ExclusiveTupleExpr expr, BindingSet bindings) Evaluate anExclusiveTupleExpr.evaluateLeftBoundJoinStatementPattern(StatementTupleExpr stmt, List<BindingSet> bindings) Evaluate the left bind join for the givenStatementTupleExprand bindings at the relevant endpoints.protected CloseableIteration<BindingSet> evaluateLeftJoin(FedXLeftJoin leftJoin, BindingSet bindings) Evaluate aFedXLeftJoin(i.e. an OPTIONAL clause)evaluateNaryUnion(NUnion union, BindingSet bindings) evaluateNJoin(NJoin join, BindingSet bindings) evaluateService(FedXService service, List<BindingSet> bindings) Evaluate a SERVICE using vectored evaluation, taking the provided bindings as input.evaluateService(FedXService service, BindingSet bindings) evaluateSingleSourceQuery(SingleSourceQuery query, BindingSet bindings) protected CloseableIteration<BindingSet> evaluateZeroLengthPath(FedXZeroLengthPath zlp, BindingSet bindings) getAccessibleFederationMembers(QueryInfo queryInfo) Returns the accessible federation members in the context of the query.getMembersFromContext(FederationEvaluationStatistics evaluationStatisticss) Returns the federation members that are active in the current federation.Retrieve the statements matching the provided subject, predicate and object value from the federation members.booleanReturns true if the federation has statementsoptimize(TupleExpr expr, EvaluationStatistics evaluationStatistics, BindingSet bindings) Execute theQueryOptimizerPipelineon the givenTupleExprto optimize its execution plan.protected voidoptimizeExclusiveExpressions(TupleExpr query, QueryInfo queryInfo, GenericInfoOptimizer info) OptimizeExclusiveTupleExpr, e.g. restructure the exclusive parts of the query AST.protected voidoptimizeJoinOrder(TupleExpr query, QueryInfo queryInfo, GenericInfoOptimizer info) performSourceSelection(List<Endpoint> members, SourceSelectionCache cache, QueryInfo queryInfo, GenericInfoOptimizer info) Perform source selection for all statements of the query.performSourceSelection(FedXArbitraryLengthPath pathExpr, StatementPattern stmt, List<Endpoint> members, SourceSelectionCache cache, QueryInfo queryInfo) Perform source selection on the statement pattern representing the path expression.precompile(TupleExpr expr, QueryEvaluationContext context) precompile(ValueExpr expr, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(ConjunctiveFilterExpr node, QueryEvaluationContext context) protected QueryEvaluationStepprepare(FedXArbitraryLengthPath alp, QueryEvaluationContext context) protected QueryEvaluationStepprepare(FedXZeroLengthPath zlp, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(FilterExpr node, QueryEvaluationContext context) protected QueryEvaluationStepprepare(DescribeOperator operator, QueryEvaluationContext context) protected QueryEvaluationStepprepareExclusiveTupleExpr(ExclusiveTupleExpr expr, QueryEvaluationContext context) protected QueryEvaluationStepprepareLeftJoin(FedXLeftJoin leftJoin, QueryEvaluationContext context) prepareNaryUnion(NUnion union, QueryEvaluationContext context) protected QueryEvaluationStepprepareNJoin(NJoin join, QueryEvaluationContext context) protected booleanpropagateServices(List<Service> serviceNodes) Whether to propagate aSingleSourceQuerycontaining SERVICE clauses.Methods inherited from class DefaultEvaluationStrategy
evaluate, evaluate, evaluate, getCollectionFactory, getFederatedServiceResolver, getLimit, getQueryEvaluationMode, getService, getVarValue, isReducedOrDistinct, isTrackResultSize, isTrackTime, isTrue, isTrue, precompile, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, setCollectionFactory, setFederatedServiceResolver, setOptimizerPipeline, setQueryEvaluationMode, setTrackResultSize, setTrackTime, supplyBinaryValueEvaluation, supplyUnaryValueEvaluationModifier and TypeMethodDescriptionprotected static CloseableIteration<BindingSet> evaluate(TupleFunction func, List<Var> resultVars, BindingSet bindings, ValueFactory valueFactory, Value... argValues) evaluate(Regex node, BindingSet bindings) Deprecated, for removal: This API element is subject to removal in a future version.evaluate(TripleRef ref, BindingSet bindings) evaluates a TripleRef node returning bindingsets from the matched Triple nodes in the dataset (or explore standard reification)Gets theFederatedServiceResolverused by this client.protected longgetLimit(QueryModelNode node) Returns the limit of the current variable bindings before any further projection.getService(String serviceUrl) Retrieve theFederatedServiceregistered for serviceUrl.static ValuegetVarValue(Var var, BindingSet bindings) protected booleanbooleanEnable or disable results size tracking for the query plan.booleanEnable or disable time tracking for the query plan.booleanisTrue(QueryValueEvaluationStep expr, BindingSet bindings) booleanisTrue(ValueExpr expr, BindingSet bindings) Evaluates the boolean expression on the supplied TripleSource object.precompile(TupleExpr expr) Prepare a QueryEvaluationStep that tries to do as much work once per query avoiding repeated calls to the same code as much as possible.protected QueryEvaluationStepprepare(ArbitraryLengthPath alp, QueryEvaluationContext context) protected QueryEvaluationStepprepare(BinaryTupleOperator expr, QueryEvaluationContext context) protected QueryEvaluationStepprepare(BindingSetAssignment node, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(BNodeGenerator node, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(Bound node, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(Coalesce node, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(CompareAll node, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(CompareAny node, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(Compare node, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(Datatype node, QueryEvaluationContext context) protected QueryEvaluationStepprepare(Difference node, QueryEvaluationContext context) protected QueryEvaluationStepprepare(Distinct node, QueryEvaluationContext context) protected QueryEvaluationStepprepare(EmptySet emptySet, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(Now node, QueryEvaluationContext context) During the execution of a single query NOW() should always return the same result and is in practical terms a constant during evaluation.protected QueryValueEvaluationStepprepare(Exists node, QueryEvaluationContext context) protected QueryEvaluationStepprepare(Extension node, QueryEvaluationContext context) protected QueryEvaluationStepprepare(Filter node, QueryEvaluationContext context) prepare(FunctionCall node, QueryEvaluationContext context) protected QueryEvaluationStepprepare(Group node, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(If node, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(In node, QueryEvaluationContext context) protected QueryEvaluationStepprepare(Intersection node, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(IRIFunction node, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(IsBNode node, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(IsLiteral node, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(IsNumeric node, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(IsResource node, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(IsURI node, QueryEvaluationContext context) protected QueryEvaluationStepprepare(Join node, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(Label node, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(LangMatches node, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(Lang node, QueryEvaluationContext context) protected QueryEvaluationStepprepare(LeftJoin node, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(ListMemberOperator node, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(LocalName node, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(MathExpr node, QueryEvaluationContext context) protected QueryEvaluationStepprepare(MultiProjection node, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(Namespace node, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(Not node, QueryEvaluationContext context) protected QueryEvaluationStepprepare(Order node, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(Or node, QueryEvaluationContext context) protected QueryEvaluationStepprepare(Projection node, QueryEvaluationContext context) protected QueryEvaluationStepprepare(QueryRoot node, QueryEvaluationContext context) protected QueryEvaluationStepprepare(Reduced node, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(Regex node, QueryEvaluationContext context) Determines whether the two operands match according to theregexoperator.protected QueryValueEvaluationStepprepare(SameTerm node, QueryEvaluationContext context) protected QueryEvaluationStepprepare(Service service, QueryEvaluationContext context) protected QueryEvaluationStepprepare(SingletonSet singletonSet, QueryEvaluationContext context) protected QueryEvaluationStepprepare(Slice node, QueryEvaluationContext context) protected QueryEvaluationStepprepare(StatementPattern node, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(Str node, QueryEvaluationContext context) protected QueryEvaluationStepprepare(TripleRef ref, QueryEvaluationContext context) protected QueryEvaluationStepprepare(TupleFunctionCall expr, QueryEvaluationContext context) protected QueryEvaluationStepprepare(UnaryTupleOperator expr, QueryEvaluationContext context) protected QueryEvaluationStepprepare(Union node, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(ValueConstant valueConstant, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(ValueExprTripleRef node, QueryEvaluationContext context) protected QueryValueEvaluationStepprepare(Var var, QueryEvaluationContext context) protected QueryEvaluationStepprepare(ZeroLengthPath zlp, QueryEvaluationContext context) voidSet the collection factory that will create the collections to use during query evaluaton.voidSets theFederatedServiceResolverto use for this client.voidsetOptimizerPipeline(QueryOptimizerPipeline pipeline) Set theQueryOptimizerPipelineto use for optimizing any incoming queries.voidsetQueryEvaluationMode(QueryEvaluationMode queryEvaluationMode) voidsetTrackResultSize(boolean trackResultSize) Enable or disable results size tracking for the query plan.voidsetTrackTime(boolean trackTime) Enable or disable time tracking for the query plan.protected QueryValueEvaluationStepsupplyBinaryValueEvaluation(BinaryValueOperator node, BiFunction<Value, Value, Value> operation, QueryEvaluationContext context) Supply a QueryValueEvalationStep that will invoke the function (operator passed in).protected QueryValueEvaluationStepsupplyUnaryValueEvaluation(UnaryValueOperator node, Function<Value, Value> operation, QueryEvaluationContext context) Return a QueryEvaluationStep that applies constant propegation.
-
Constructor Details
-
SparqlFederationEvalStrategy
Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Method Details
-
evaluateBoundJoinStatementPattern
public CloseableIteration<BindingSet> evaluateBoundJoinStatementPattern(StatementTupleExpr stmt, List<BindingSet> bindings) throws QueryEvaluationException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from class:FederationEvalStrategyEvaluate a bound join at the relevant endpoint, i.e. i.e. for a group of bindings retrieve results for the bound statement from the relevant endpoints- Specified by:
evaluateBoundJoinStatementPatternin classFederationEvalStrategy- Parameters:
stmt-bindings-- Returns:
- the result iteration
- Throws:
QueryEvaluationException
-
evaluateBoundJoinStatementPattern_UNION
@Deprecated(forRemoval=true) protected CloseableIteration<BindingSet> evaluateBoundJoinStatementPattern_UNION(StatementTupleExpr stmt, List<BindingSet> bindings) throws QueryEvaluationException Deprecated, for removal: This API element is subject to removal in a future version.no longer usedAlternative evaluation implementation using UNION. Nowadays we use a VALUES clause based implementation- Throws:
QueryEvaluationException
-
evaluateGroupedCheck
public CloseableIteration<BindingSet> evaluateGroupedCheck(CheckStatementPattern stmt, List<BindingSet> bindings) throws QueryEvaluationException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from class:FederationEvalStrategyPerform a grouped check at the relevant endpoints, i.e. for a group of bindings keep only those for which at least one endpoint provides a result to the bound statement.- Specified by:
evaluateGroupedCheckin classFederationEvalStrategy- Parameters:
stmt-bindings-- Returns:
- the result iteration
- Throws:
QueryEvaluationException
-
executeJoin
public CloseableIteration<BindingSet> executeJoin(ControlledWorkerScheduler<BindingSet> joinScheduler, CloseableIteration<BindingSet> leftIter, TupleExpr rightArg, Set<String> joinVars, BindingSet bindings, QueryInfo queryInfo) throws QueryEvaluationException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from class:FederationEvalStrategyExecute the join in a separate thread using some join executor. Join executors are for instance: For endpoint federation use controlled worker bound join, for local federation use controlled worker join. The other operators are there for completeness. UseFederationEvalStrategy.executorto execute the join (it is a runnable).- Specified by:
executeJoinin classFederationEvalStrategy- Parameters:
joinScheduler-leftIter-rightArg-joinVars-bindings-- Returns:
- the result
- Throws:
QueryEvaluationException
-
executeLeftJoin
protected CloseableIteration<BindingSet> executeLeftJoin(ControlledWorkerScheduler<BindingSet> joinScheduler, CloseableIteration<BindingSet> leftIter, LeftJoin leftJoin, BindingSet bindings, QueryInfo queryInfo) throws QueryEvaluationException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from class:FederationEvalStrategyExecute the left join in a separate thread using some join executor.- Specified by:
executeLeftJoinin classFederationEvalStrategy- Parameters:
joinScheduler-leftIter-leftJoin-bindings-- Returns:
- the result
- Throws:
QueryEvaluationException
-
evaluateExclusiveGroup
public CloseableIteration<BindingSet> evaluateExclusiveGroup(ExclusiveGroup group, BindingSet bindings) throws RepositoryException, MalformedQueryException, QueryEvaluationException Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
evaluateExclusiveGroupin classFederationEvalStrategy- Throws:
RepositoryExceptionMalformedQueryExceptionQueryEvaluationException
-