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 evaluator
QD - 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:

Unsupported query types will result in an IllegalArgumentException.
  • Constructor Details

    • DefaultGenericQueryEvaluator

      public DefaultGenericQueryEvaluator()
      Creates the default generic query evaluator.
  • Method Details

    • defaultInstance

      public static DefaultGenericQueryEvaluator 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:
      evaluate in interface QueryEvaluator<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 Substitution objects.
      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: QueryEvaluator
      Creates a prepared query bound to a data source and ground-term policy.
      Specified by:
      prepareQuery in interface QueryEvaluator<Q extends Query, QD extends QueryableData>
      Parameters:
      query - the query to prepare
      queryableData - the data source against which the query will run
      variablesThatMustBeMappedToGroundTerms - variables constrained to ground answers
      Returns:
      a prepared query wrapper