Class DefaultGenericQueryEvaluator<Q extends Query, QD extends QueryableData>
java.lang.Object
fr.inria.rules.integraal.query_evaluation.generic.DefaultGenericQueryEvaluator<Q,QD>
- Type Parameters:
Q- the query type handled by this evaluatorQD- the queryable data type used for evaluation
- All Implemented Interfaces:
QueryEvaluator<Q,QD>
public class DefaultGenericQueryEvaluator<Q extends Query, QD extends QueryableData>
extends Object
implements QueryEvaluator<Q,QD>
DefaultGenericQueryEvaluator is a default implementation of the
QueryEvaluator interface. It handles the evaluation of various query
types over a given FactBase.
This evaluator supports:
- First-order/Formula queries (
FOQuery) usingGenericFOQueryEvaluator - Union of first-order queries (
UnionFOQuery) usingUnionFOQueryEvaluator
IllegalArgumentException.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DefaultGenericQueryEvaluatorThe default instance is used to give a default behavior to the evaluator when one doesn't want to configure it.evaluate(Q query, QD queryableData, Collection<Variable> variablesThatMustBeMappedToConstants, Substitution preHomomorphism) Evaluates the given query over the specified fact base, applying a pre-existing substitution and ensuring that specified variables are mapped to constants.prepareQuery(Q query, QD queryableData, Collection<Variable> variablesThatMustBeMappedToGroundTerms) Creates a prepared 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 QueryEvaluator
countAnswers, countHomomorphism, evaluate, evaluate, existAnswer, existAnswer, existHomomorphism, existHomomorphism, homomorphism, homomorphism, postprocessResult, postprocessResult, prepareQuery
-
Constructor Details
-
DefaultGenericQueryEvaluator
public DefaultGenericQueryEvaluator()Creates the default generic query evaluator.
-
-
Method Details
-
defaultInstance
The default instance is used to give a default behavior to the evaluator when one doesn't want to configure it.- Returns:
- the default instance of the evaluator
-
evaluate
public Stream<Substitution> evaluate(Q query, QD queryableData, Collection<Variable> variablesThatMustBeMappedToConstants, Substitution preHomomorphism) throws EvaluationException Evaluates the given query over the specified fact base, applying a pre-existing substitution and ensuring that specified variables are mapped to constants.- Specified by:
evaluatein interfaceQueryEvaluator<Q extends Query, QD extends QueryableData>- Parameters:
query- The query to evaluate.queryableData- The fact base used for evaluation.variablesThatMustBeMappedToConstants- A collection of variables that must be mapped to constants.preHomomorphism- A pre-existing substitution to be applied during evaluation.- Returns:
- An iterator over the resulting
Substitutionobjects. - Throws:
IllegalArgumentException- If the query type is unsupported.EvaluationException- if the evaluation cannot be completed
-
prepareQuery
public PreparedQuery<Q, QD, Substitution, Substitution> prepareQuery(Q query, QD queryableData, Collection<Variable> variablesThatMustBeMappedToGroundTerms) Description copied from interface:QueryEvaluatorCreates a prepared query bound to a data source and ground-term policy.- Specified by:
prepareQueryin interfaceQueryEvaluator<Q extends Query, QD extends QueryableData>- Parameters:
query- the query to preparequeryableData- the data source against which the query will runvariablesThatMustBeMappedToGroundTerms- variables constrained to ground answers- Returns:
- a prepared query wrapper
-