Interface EvaluationStrategy
-
- All Superinterfaces:
FederatedServiceResolver
- All Known Implementing Classes:
DefaultEvaluationStrategy,ExtendedEvaluationStrategy,FederationEvalStrategy,SailFederationEvalStrategy,SparqlFederationEvalStrategy,StrictEvaluationStrategy,TupleFunctionEvaluationStrategy
public interface EvaluationStrategy extends FederatedServiceResolver
- Author:
- Arjohn Kampman, James Leigh
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description CloseableIteration<BindingSet>evaluate(TupleExpr expr, BindingSet bindings)Evaluates the tuple expression against the supplied triple source with the specified set of variable bindings as input.Valueevaluate(ValueExpr expr, BindingSet bindings)Gets the value of this expression.default Supplier<CollectionFactory>getCollectionFactory()QueryEvaluationModegetQueryEvaluationMode()FederatedServicegetService(String serviceUrl)Retrieve theFederatedServiceregistered for serviceUrl.default booleanisTrackResultSize()Enable or disable results size tracking for the query plan.booleanisTrue(QueryValueEvaluationStep expr, BindingSet bindings)booleanisTrue(ValueExpr expr, BindingSet bindings)Evaluates the boolean expression on the supplied TripleSource object.TupleExproptimize(TupleExpr expr, EvaluationStatistics evaluationStatistics, BindingSet bindings)Execute theQueryOptimizerPipelineon the givenTupleExprto optimize its execution plan.QueryEvaluationStepprecompile(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.QueryEvaluationStepprecompile(TupleExpr expr, QueryEvaluationContext context)default QueryValueEvaluationStepprecompile(ValueExpr arg, QueryEvaluationContext context)default voidsetCollectionFactory(Supplier<CollectionFactory> collectionFactory)Set the collection factory that will create the collections to use during query evaluaton.voidsetOptimizerPipeline(QueryOptimizerPipeline pipeline)Set theQueryOptimizerPipelineto use for optimizing any incoming queries.voidsetQueryEvaluationMode(QueryEvaluationMode queryEvaluationMode)default voidsetTrackResultSize(boolean trackResultSize)Enable or disable results size tracking for the query plan.default voidsetTrackTime(boolean trackTime)Enable or disable time tracking for the query plan.
-
-
-
Method Detail
-
getService
FederatedService getService(String serviceUrl) throws QueryEvaluationException
Retrieve theFederatedServiceregistered for serviceUrl. If there is no service registered for serviceUrl, a newSPARQLFederatedServiceis created and registered.- Specified by:
getServicein interfaceFederatedServiceResolver- Parameters:
serviceUrl- URL of the service.- Returns:
- the
FederatedServiceregistered for the serviceUrl. - Throws:
QueryEvaluationException- See Also:
FederatedServiceResolver.getService(java.lang.String)
-
setOptimizerPipeline
void setOptimizerPipeline(QueryOptimizerPipeline pipeline)
Set theQueryOptimizerPipelineto use for optimizing any incoming queries.- Parameters:
pipeline- theQueryOptimizerPipeline.- Since:
- 3.0
- See Also:
optimize(TupleExpr, EvaluationStatistics, BindingSet)
-
optimize
TupleExpr optimize(TupleExpr expr, EvaluationStatistics evaluationStatistics, BindingSet bindings)
Execute theQueryOptimizerPipelineon the givenTupleExprto optimize its execution plan.- Parameters:
expr- theTupleExprto optimize.evaluationStatistics- theEvaluationStatisticsof the data source, to be used for query planning.bindings- a-priori bindings supplied for the query, which can potentially be inlined.- Returns:
- the optimized
TupleExpr. - Since:
- 3.0
- See Also:
setOptimizerPipeline(QueryOptimizerPipeline)
-
evaluate
CloseableIteration<BindingSet> evaluate(TupleExpr expr, BindingSet bindings) throws QueryEvaluationException
Evaluates the tuple expression against the supplied triple source with the specified set of variable bindings as input.- Parameters:
expr- The Tuple Expression to evaluatebindings- The variables bindings to use for evaluating the expression, if applicable.- Returns:
- A closeable iterator over the variable binding sets that match the tuple expression.
- Throws:
QueryEvaluationException
-
precompile
QueryEvaluationStep 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. This depends on java invoke dynamic for performance.- Parameters:
expr- that is to be evaluated later- Returns:
- a QueryEvaluationStep that may avoid doing repeating the same work over and over.
-
precompile
QueryEvaluationStep precompile(TupleExpr expr, QueryEvaluationContext context)
-
evaluate
Value evaluate(ValueExpr expr, BindingSet bindings) throws ValueExprEvaluationException, QueryEvaluationException
Gets the value of this expression.- Parameters:
expr-bindings- The variables bindings to use for evaluating the expression, if applicable.- Returns:
- The Value that this expression evaluates to, or null if the expression could not be evaluated.
- Throws:
ValueExprEvaluationExceptionQueryEvaluationException
-
isTrue
boolean isTrue(ValueExpr expr, BindingSet bindings) throws ValueExprEvaluationException, QueryEvaluationException
Evaluates the boolean expression on the supplied TripleSource object.- Parameters:
expr-bindings- The variables bindings to use for evaluating the expression, if applicable.- Returns:
- The result of the evaluation.
- Throws:
ValueExprEvaluationException- If the value expression could not be evaluated, for example when comparing two incompatible operands. When thrown, the result of the boolean expression is neither true nor false , but unknown.QueryEvaluationException
-
isTrue
boolean isTrue(QueryValueEvaluationStep expr, BindingSet bindings) throws ValueExprEvaluationException, QueryEvaluationException
-
setTrackResultSize
@Experimental default void setTrackResultSize(boolean trackResultSize)
Enable or disable results size tracking for the query plan. Useful to determine which parts of a query plan generated the most data.- Parameters:
trackResultSize- true to enable tracking.
-
isTrackResultSize
@Experimental default boolean isTrackResultSize()
Enable or disable results size tracking for the query plan.
-
setTrackTime
@Experimental default void setTrackTime(boolean trackTime)
Enable or disable time tracking for the query plan. Useful to determine which parts of a query plan take the most time to evaluate.- Parameters:
trackTime- true to enable tracking.
-
getQueryEvaluationMode
QueryEvaluationMode getQueryEvaluationMode()
-
setQueryEvaluationMode
void setQueryEvaluationMode(QueryEvaluationMode queryEvaluationMode)
-
precompile
default QueryValueEvaluationStep precompile(ValueExpr arg, QueryEvaluationContext context)
-
setCollectionFactory
@Experimental default void setCollectionFactory(Supplier<CollectionFactory> collectionFactory)
Set the collection factory that will create the collections to use during query evaluaton.- Parameters:
collectionFactory- CollectionFactory that should be used during future query evaluations
-
getCollectionFactory
@Experimental default Supplier<CollectionFactory> getCollectionFactory()
-
-