Class QueryableDataDelAtomsWrapper

java.lang.Object
fr.inria.rules.integraal.model.data.readable.QueryableDataDelAtomsWrapper
All Implemented Interfaces:
QueryableData

public class QueryableDataDelAtomsWrapper extends Object implements 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 Details

    • QueryableDataDelAtomsWrapper

      public QueryableDataDelAtomsWrapper(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.
      Parameters:
      queryableData - the underlying queryable data to wrap
      removedAtoms - the set of atoms to be virtually removed
  • Method Details

    • 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