Class LegacyBacktrackEvaluator<QD extends QueryableData>
java.lang.Object
fr.inria.rules.integraal.query_evaluation.conjunction.backtrack.legacy.LegacyBacktrackEvaluator<QD>
- Type Parameters:
QD- the type of queryable data evaluated by this backtracker
- All Implemented Interfaces:
FOQueryEvaluator<FOFormulaConjunction, QD>, QueryEvaluator<FOQuery<? extends FOFormulaConjunction>, QD>
public class LegacyBacktrackEvaluator<QD extends QueryableData>
extends Object
implements FOQueryEvaluator<FOFormulaConjunction, QD>
Evaluates a query with a conjunctive formula by using homomorphism computing using
backtrack algorithm to aggregate the result of each sub-query
To evaluate a given query, a sub-query is chosen and evaluated. The first result is assumed correct and the next sub-query is evaluated. If the results of the second sub-query are consistent with the first (assumed correct) result, the next sub-query is evaluated and so on. When a sub-query result is not consistent with the previous results, a step of backtrack is used to go back on the assumed result and take the next answer. If there is no more answer to go back to, it is also considered inconsistent.
This Backtrack algorithm is inspired by the Baget Jean-François Thesis (Chapter 5) See ... for more information
To evaluate a given query, a sub-query is chosen and evaluated. The first result is assumed correct and the next sub-query is evaluated. If the results of the second sub-query are consistent with the first (assumed correct) result, the next sub-query is evaluated and so on. When a sub-query result is not consistent with the previous results, a step of backtrack is used to go back on the assumed result and take the next answer. If there is no more answer to go back to, it is also considered inconsistent.
This Backtrack algorithm is inspired by the Baget Jean-François Thesis (Chapter 5) See ... for more information
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classThe BacktrackIterator is used to redefine the iterator return as an answer to the query. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final FOQueryEvaluator<FOFormula, QD> Query evaluator used to evaluate the sub-queriesprotected BiFunction<FOQuery<? extends FOFormulaConjunction>, QD, Scheduler> Function for creating Scheduler instances based on the query and queryableData -
Constructor Summary
ConstructorsConstructorDescriptionLegacyBacktrackEvaluator(FOQueryEvaluator<FOFormula, QD> evaluator) Creates a new evaluator using the given evaluator to evaluate sub-queriesLegacyBacktrackEvaluator(FOQueryEvaluator<FOFormula, QD> evaluator, BiFunction<FOQuery<? extends FOFormulaConjunction>, QD, Scheduler> schedulerBuilder) Creates a new evaluator using the given evaluator to evaluate sub-queries and a function to create Schedulers -
Method Summary
Modifier and TypeMethodDescriptionevaluate(FOQuery<? extends FOFormulaConjunction> query, QD queryableData, Collection<Variable> vars, Substitution preHomomorphism) //////////////////////////////////////////////Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface FOQueryEvaluator
prepareQuery, prepareQueryMethods inherited from interface QueryEvaluator
countAnswers, countHomomorphism, evaluate, evaluate, existAnswer, existAnswer, existHomomorphism, existHomomorphism, homomorphism, homomorphism, postprocessResult, postprocessResult
-
Field Details
-
evaluator
Query evaluator used to evaluate the sub-queries -
schedulerBuilder
protected BiFunction<FOQuery<? extends FOFormulaConjunction>, QD extends QueryableData, Scheduler> schedulerBuilderFunction for creating Scheduler instances based on the query and queryableData
-
-
Constructor Details
-
LegacyBacktrackEvaluator
public LegacyBacktrackEvaluator(FOQueryEvaluator<FOFormula, QD> evaluator, BiFunction<FOQuery<? extends FOFormulaConjunction>, QD, Scheduler> schedulerBuilder) Creates a new evaluator using the given evaluator to evaluate sub-queries and a function to create Schedulers- Parameters:
evaluator- the query evaluator to use for recursive callsschedulerBuilder- the function to create Scheduler instances based on the query and queryableData
-
LegacyBacktrackEvaluator
Creates a new evaluator using the given evaluator to evaluate sub-queries- Parameters:
evaluator- the query evaluator to use for recursive calls
-
-
Method Details
-
evaluate
public Stream<Substitution> evaluate(FOQuery<? extends FOFormulaConjunction> query, QD queryableData, Collection<Variable> vars, Substitution preHomomorphism) //////////////////////////////////////////////- 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 evaluatedvars- variables constrained to constant answerspreHomomorphism- a partial substitution to extend- Returns:
- a stream of substitutions answering the query
-