Class QueryableRelationalFunctions

java.lang.Object
fr.inria.rules.integraal.model.functions.QueryableRelationalFunctions
All Implemented Interfaces:
QueryableData

public class QueryableRelationalFunctions extends Object implements QueryableData
Exposes evaluable functions as synthetic queryable predicates.
  • Constructor Details

    • QueryableRelationalFunctions

      public QueryableRelationalFunctions()
      Creates a queryable function registry.
  • Method Details

    • getAtomFromFunction

      public Atom getAtomFromFunction(EvaluableFunction ef, Term resultTerm)
      Builds an atom representing the supplied evaluable function.
      Parameters:
      ef - the evaluable function to expose
      resultTerm - the term receiving the function result
      Returns:
      an atom encoding the function call
    • getAtomFromFunction

      public Atom getAtomFromFunction(EvaluableFunction ef)
      Builds an atom representing the supplied evaluable function with a fresh result variable.
      Parameters:
      ef - the evaluable function to expose
      Returns:
      an atom encoding the function call
    • getPredicates

      public Stream<Predicate> getPredicates()
      Description copied from interface: QueryableData
      Returns a collection of all predicates in this Readable.
      Specified by:
      getPredicates in interface QueryableData
      Returns:
      a collection of all predicates.
    • hasPredicate

      public boolean hasPredicate(Predicate p)
      Description copied from interface: QueryableData
      Allows checking if this QueryableData provides the predicate p
      Specified by:
      hasPredicate in interface QueryableData
      Parameters:
      p - the predicate to look up
      Returns:
      boolean that is true iff the QueryableData provides this predicate
    • evaluate

      public Stream<List<Term>> evaluate(BasicQuery query) throws EvaluationException
      Description copied from interface: QueryableData
      Try to evaluate a basic query
      Specified by:
      evaluate in interface QueryableData
      Parameters:
      query - the query to evaluate
      Returns:
      Empty if the query is not evaluable, otherwise a stream containing substitutions that are the answers to the query
      Throws:
      EvaluationException - if query evaluation fails
    • estimateBound

      public Optional<Long> estimateBound(BasicQuery query)
      Description copied from interface: QueryableData
      Estimate the number of answers to a query The estimation is the upper bound, meaning the actual number of answers will not exceed this number. Implementations may return an empty Optional if they cannot provide an estimation.
      Specified by:
      estimateBound in interface QueryableData
      Parameters:
      query - the query for which we want to know the upper bound
      Returns:
      an Optional containing the estimated upper bound of answers, or an empty Optional if estimation is not possible
    • getAtomicPattern

      public AtomicPattern getAtomicPattern(Predicate predicate)
      Description copied from interface: QueryableData
      Get the basic pattern for a given predicate
      Specified by:
      getAtomicPattern in interface QueryableData
      Parameters:
      predicate - the predicate for which we want to know the basic pattern
      Returns:
      a basic pattern for predicate