Class BacktrackEvaluator<QD extends QueryableData>
java.lang.Object
fr.inria.rules.integraal.query_evaluation.conjunction.backtrack.BacktrackEvaluator<QD>
- Type Parameters:
QD- concreteQueryableDatatype
- All Implemented Interfaces:
FOQueryEvaluator<FOFormulaConjunction, QD>, QueryEvaluator<FOQuery<? extends FOFormulaConjunction>, QD>
public class BacktrackEvaluator<QD extends QueryableData>
extends Object
implements FOQueryEvaluator<FOFormulaConjunction, QD>
Generic back-tracking evaluator for conjunctive first-order queries.
The implementation follows the algorithm introduced in chapter 5 of
Jean-François Baget thesis (see http://www.lirmm.fr/~baget/publications/
thesis.pdf). All context-independent routines (equalities, function
extraction, answer rebuilding) are delegated to the shared utility classes
in fr.inria.rules.integraal.query_evaluation.util.
- Author:
- Guillaume Perution-Kihli
-
Constructor Summary
ConstructorsConstructorDescriptionBacktrackEvaluator(FOQueryEvaluator<FOFormula, QueryableData> evaluator) Creates a backtrack evaluator using the default dynamic scheduler.BacktrackEvaluator(FOQueryEvaluator<FOFormula, QueryableData> evaluator, Function<List<PreparedFOQuery<? extends FOFormula, QD>>, Scheduler<QD>> schedulerProvider) Creates a backtrack evaluator with an explicit scheduler provider. -
Method Summary
Modifier and TypeMethodDescriptionevaluate(FOQuery<? extends FOFormulaConjunction> query, QD queryableData, Collection<Variable> mustBeGround, Substitution preHomomorphism) Evaluates a first-order query against a data source.PreparedFOQuery<? extends FOFormulaConjunction, QD> prepareQuery(FOQuery<? extends FOFormulaConjunction> query, QD queryableData, Collection<Variable> mustBeGround) Creates a prepared first-order query bound to a data source and ground-term policy.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface FOQueryEvaluator
prepareQueryMethods inherited from interface QueryEvaluator
countAnswers, countHomomorphism, evaluate, evaluate, existAnswer, existAnswer, existHomomorphism, existHomomorphism, homomorphism, homomorphism, postprocessResult, postprocessResult
-
Constructor Details
-
BacktrackEvaluator
public BacktrackEvaluator(FOQueryEvaluator<FOFormula, QueryableData> evaluator, Function<List<PreparedFOQuery<? extends FOFormula, QD>>, Scheduler<QD>> schedulerProvider) Creates a backtrack evaluator with an explicit scheduler provider.- Parameters:
evaluator- the delegated evaluator used for subqueriesschedulerProvider- the factory creating schedulers for prepared subqueries
-
BacktrackEvaluator
Creates a backtrack evaluator using the default dynamic scheduler.- Parameters:
evaluator- the delegated evaluator used for subqueries
-
-
Method Details
-
evaluate
public Stream<Substitution> evaluate(FOQuery<? extends FOFormulaConjunction> query, QD queryableData, Collection<Variable> mustBeGround, Substitution preHomomorphism) throws EvaluationException Description copied from interface:FOQueryEvaluatorEvaluates a first-order query against a data source.- Specified by:
evaluatein interfaceFOQueryEvaluator<FOFormulaConjunction, QD extends QueryableData>- Specified by:
evaluatein interfaceQueryEvaluator<FOQuery<? extends FOFormulaConjunction>, QD extends QueryableData>- Parameters:
query- the query to evaluatequeryableData- the data source against which the query is evaluatedmustBeGround- variables constrained to constant answerspreHomomorphism- a partial substitution to extend- Returns:
- a stream of substitutions answering the query
- Throws:
EvaluationException- if the evaluation cannot be completed
-
prepareQuery
public PreparedFOQuery<? extends FOFormulaConjunction, QD> prepareQuery(FOQuery<? extends FOFormulaConjunction> query, QD queryableData, Collection<Variable> mustBeGround) Description copied from interface:FOQueryEvaluatorCreates a prepared first-order query bound to a data source and ground-term policy.- Specified by:
prepareQueryin interfaceFOQueryEvaluator<FOFormulaConjunction, QD extends QueryableData>- Specified by:
prepareQueryin interfaceQueryEvaluator<FOQuery<? extends FOFormulaConjunction>, QD extends QueryableData>- Parameters:
query- the query to preparequeryableData- the data source against which the query will runmustBeGround- variables constrained to ground answers- Returns:
- a prepared query wrapper
-