Class QueryableDataDelAtomsWrapper
java.lang.Object
fr.inria.rules.integraal.model.data.readable.QueryableDataDelAtomsWrapper
- All Implemented Interfaces:
QueryableData
This class is a wrapper around a queryable data that allows virtual deletions of atoms.
Atoms are not physically removed from the wrapped queryable data, but are virtually
marked as removed.
When querying the queryable data through this wrapper, any atom
marked as removed will be excluded from the results.
This class is useful for scenarios where you want to simulate the removal of facts from a knowledge base without actually deleting the data, allowing flexible "undo" operations or temporary filters.
- Author:
- Guillaume Pérution-Kihli
-
Constructor Summary
ConstructorsConstructorDescriptionQueryableDataDelAtomsWrapper(QueryableData queryableData, Set<Atom> removedAtoms) Constructs a new QueryableDataDelAtomsWrapper instance, wrapping the provided queryable data and initializing the set of atoms to be virtually removed. -
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 querygetAtomicPattern(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
-
QueryableDataDelAtomsWrapper
Constructs a new QueryableDataDelAtomsWrapper instance, wrapping the provided queryable data and initializing the set of atoms to be virtually removed.- Parameters:
queryableData- the underlying queryable data to wrapremovedAtoms- the set of atoms to be virtually removed
-
-
Method Details
-
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
-