public abstract class FederationEvalStrategy extends StrictEvaluationStrategy
SailFederationEvalStrategy
,
SparqlFederationEvalStrategy
Modifier and Type | Field and Description |
---|---|
protected SourceSelectionCache |
cache |
protected Executor |
executor |
protected FederationContext |
federationContext |
dataset, serviceResolver, tripleSource
Constructor and Description |
---|
FederationEvalStrategy(FederationContext federationContext) |
evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, getLimit, getService, getUUID, getVarValue, getZeroLengthPathIterator, isReducedOrDistinct, isTrue, isUnbound, setFederatedServiceResolver, setOptimizerPipeline, setTrackResultSize, setTrackTime
protected Executor executor
protected SourceSelectionCache cache
protected FederationContext federationContext
public FederationEvalStrategy(FederationContext federationContext)
protected SourceSelectionCache createSourceSelectionCache()
SourceSelectionCache
SourceSelectionCache
FedXConfig.getSourceSelectionCacheSpec()
public TupleExpr optimize(TupleExpr expr, EvaluationStatistics evaluationStatistics, BindingSet bindings)
StrictEvaluationStrategy
QueryOptimizerPipeline
on the given TupleExpr
to optimize its execution plan.optimize
in interface EvaluationStrategy
optimize
in class StrictEvaluationStrategy
expr
- the TupleExpr
to optimize.evaluationStatistics
- this param is ignored!bindings
- a-priori bindings supplied for the query, which can potentially be inlined.TupleExpr
.StrictEvaluationStrategy.setOptimizerPipeline(QueryOptimizerPipeline)
protected Set<Endpoint> performSourceSelection(List<Endpoint> members, SourceSelectionCache cache, QueryInfo queryInfo, GenericInfoOptimizer info)
members
- cache
- queryInfo
- info
- protected void optimizeJoinOrder(TupleExpr query, QueryInfo queryInfo, GenericInfoOptimizer info)
protected boolean propagateServices(List<Service> serviceNodes)
SingleSourceQuery
containing SERVICE clauses. By default, the query is always
evaluated within the FedX engine if it contains a SERVICE clause.
Customized implementation may propagate a SingleSourceQuery
including the SERVICE clause (e.g. for
Wikidata the Label service can only be accessed in the wikidata endpoint.
serviceNodes
- true
, a SingleSourceQuery
containing SERVICE clauses is propagated as-isprotected void optimizeExclusiveExpressions(TupleExpr query, QueryInfo queryInfo, GenericInfoOptimizer info)
ExclusiveTupleExpr
, e.g. restructure the exclusive parts of the query AST.query
- queryInfo
- info
- public CloseableIteration<BindingSet,QueryEvaluationException> evaluate(TupleExpr expr, BindingSet bindings) throws QueryEvaluationException
EvaluationStrategy
evaluate
in interface EvaluationStrategy
evaluate
in class StrictEvaluationStrategy
expr
- The Tuple Expression to evaluatebindings
- The variables bindings to use for evaluating the expression, if applicable.QueryEvaluationException
public CloseableIteration<Statement,QueryEvaluationException> getStatements(QueryInfo queryInfo, Resource subj, IRI pred, Value obj, Resource... contexts) throws RepositoryException, MalformedQueryException, QueryEvaluationException
For a bound statement, i.e. a statement with no free variables, the statement itself is returned if some member has this statement, an empty iteration otherwise.
If the statement has free variables, i.e. one of the provided arguments in null
, the union of
results from relevant statement sources is constructed.
subj
- pred
- obj
- contexts
- RepositoryException
MalformedQueryException
QueryEvaluationException
public CloseableIteration<BindingSet,QueryEvaluationException> evaluateService(FedXService service, BindingSet bindings) throws QueryEvaluationException
QueryEvaluationException
public CloseableIteration<BindingSet,QueryEvaluationException> evaluateSingleSourceQuery(SingleSourceQuery query, BindingSet bindings) throws QueryEvaluationException
QueryEvaluationException
public CloseableIteration<BindingSet,QueryEvaluationException> evaluateNJoin(NJoin join, BindingSet bindings) throws QueryEvaluationException
QueryEvaluationException
protected CloseableIteration<BindingSet,QueryEvaluationException> evaluateLeftJoin(FedXLeftJoin leftJoin, BindingSet bindings) throws QueryEvaluationException
FedXLeftJoin
(i.e. an OPTIONAL clause)leftJoin
- bindings
- QueryEvaluationException
StrictEvaluationStrategy.evaluate(org.eclipse.rdf4j.query.algebra.LeftJoin, BindingSet)
public CloseableIteration<BindingSet,QueryEvaluationException> evaluateNaryUnion(NUnion union, BindingSet bindings) throws QueryEvaluationException
QueryEvaluationException
protected abstract CloseableIteration<BindingSet,QueryEvaluationException> executeJoin(ControlledWorkerScheduler<BindingSet> joinScheduler, CloseableIteration<BindingSet,QueryEvaluationException> leftIter, TupleExpr rightArg, Set<String> joinVariables, BindingSet bindings, QueryInfo queryInfo) throws QueryEvaluationException
SynchronousJoin
- SynchronousBoundJoin
-
ControlledWorkerJoin
- ControlledWorkerBoundJoin
For endpoint federation use controlled worker bound join, for local federation use controlled worker join. The
other operators are there for completeness.
Use executor
to execute the join (it is a runnable).joinScheduler
- leftIter
- rightArg
- joinVariables
- bindings
- QueryEvaluationException
public abstract CloseableIteration<BindingSet,QueryEvaluationException> evaluateExclusiveGroup(ExclusiveGroup group, BindingSet bindings) throws RepositoryException, MalformedQueryException, QueryEvaluationException
protected CloseableIteration<BindingSet,QueryEvaluationException> evaluateExclusiveTupleExpr(ExclusiveTupleExpr expr, BindingSet bindings) throws RepositoryException, MalformedQueryException, QueryEvaluationException
ExclusiveTupleExpr
. The default implementation converts the given expression to a SELECT
query string and evaluates it at the source.expr
- bindings
- RepositoryException
MalformedQueryException
QueryEvaluationException
public abstract CloseableIteration<BindingSet,QueryEvaluationException> evaluateBoundJoinStatementPattern(StatementTupleExpr stmt, List<BindingSet> bindings) throws QueryEvaluationException
stmt
- bindings
- QueryEvaluationException
public abstract CloseableIteration<BindingSet,QueryEvaluationException> evaluateGroupedCheck(CheckStatementPattern stmt, List<BindingSet> bindings) throws QueryEvaluationException
stmt
- bindings
- QueryEvaluationException
public CloseableIteration<BindingSet,QueryEvaluationException> evaluateService(FedXService service, List<BindingSet> bindings) throws QueryEvaluationException
ControlledWorkerBoundJoin
and FedXConfig.getEnableServiceAsBoundJoin()
service
- bindings
- QueryEvaluationException
public Value evaluate(ValueExpr expr, BindingSet bindings) throws ValueExprEvaluationException, QueryEvaluationException
EvaluationStrategy
evaluate
in interface EvaluationStrategy
evaluate
in class StrictEvaluationStrategy
bindings
- The variables bindings to use for evaluating the expression, if applicable.ValueExprEvaluationException
QueryEvaluationException
public Value evaluate(FilterExpr node, BindingSet bindings) throws ValueExprEvaluationException, QueryEvaluationException
public Value evaluate(ConjunctiveFilterExpr node, BindingSet bindings) throws ValueExprEvaluationException, QueryEvaluationException
protected CloseableIteration<BindingSet,QueryEvaluationException> evaluateAtStatementSources(Object preparedQuery, List<StatementSource> statementSources, QueryInfo queryInfo) throws QueryEvaluationException
QueryEvaluationException
protected CloseableIteration<BindingSet,QueryEvaluationException> evaluateAtStatementSources(String preparedQuery, List<StatementSource> statementSources, QueryInfo queryInfo) throws QueryEvaluationException
QueryEvaluationException
protected CloseableIteration<BindingSet,QueryEvaluationException> evaluateAtStatementSources(TupleExpr preparedQuery, List<StatementSource> statementSources, QueryInfo queryInfo) throws QueryEvaluationException
QueryEvaluationException
Copyright © 2015-2022 Eclipse Foundation. All Rights Reserved.