Class QueryableRelationalFunctions
java.lang.Object
fr.inria.rules.integraal.model.functions.QueryableRelationalFunctions
- All Implemented Interfaces:
QueryableData
Exposes evaluable functions as synthetic queryable predicates.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionestimateBound(BasicQuery query) 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.evaluate(BasicQuery query) Try to evaluate a basic queryBuilds an atom representing the supplied evaluable function with a fresh result variable.getAtomFromFunction(EvaluableFunction ef, Term resultTerm) Builds an atom representing the supplied evaluable function.getAtomicPattern(Predicate predicate) Get the basic pattern for a given predicateReturns a collection of all predicates in this Readable.booleanAllows checking if this QueryableData provides the predicate pMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface QueryableData
estimateBound, evaluate, getSupportedOperations
-
Constructor Details
-
QueryableRelationalFunctions
public QueryableRelationalFunctions()Creates a queryable function registry.
-
-
Method Details
-
getAtomFromFunction
Builds an atom representing the supplied evaluable function.- Parameters:
ef- the evaluable function to exposeresultTerm- the term receiving the function result- Returns:
- an atom encoding the function call
-
getAtomFromFunction
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
Description copied from interface:QueryableDataReturns a collection of all predicates in this Readable.- Specified by:
getPredicatesin interfaceQueryableData- Returns:
- a collection of all predicates.
-
hasPredicate
Description copied from interface:QueryableDataAllows checking if this QueryableData provides the predicate p- Specified by:
hasPredicatein interfaceQueryableData- Parameters:
p- the predicate to look up- Returns:
- boolean that is true iff the QueryableData provides this predicate
-
evaluate
Description copied from interface:QueryableDataTry to evaluate a basic query- Specified by:
evaluatein interfaceQueryableData- 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
Description copied from interface:QueryableDataEstimate 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:
estimateBoundin interfaceQueryableData- 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
Description copied from interface:QueryableDataGet the basic pattern for a given predicate- Specified by:
getAtomicPatternin interfaceQueryableData- Parameters:
predicate- the predicate for which we want to know the basic pattern- Returns:
- a basic pattern for predicate
-