Class FederatedFactBase

java.lang.Object
fr.inria.rules.dlgpemodel.HasItemInfoImpl
fr.inria.rules.dlgpemodel.SentenceImpl
fr.inria.rules.integraal.views.FederatedFactBase
All Implemented Interfaces:
fr.inria.rules.dlgpemodel.api.sentences.HasItemInfo, fr.inria.rules.dlgpemodel.api.sentences.IFact, fr.inria.rules.dlgpemodel.api.sentences.IPrintable, fr.inria.rules.dlgpemodel.api.sentences.ISentence, Labeled, Printable, Sentence, MaterializedData, QueryableData, Writable, FactBase, TermCompound, Iterable<Atom>

@Deprecated public class FederatedFactBase extends fr.inria.rules.dlgpemodel.SentenceImpl implements FactBase
Deprecated.
A factBase made of several FactBases. This storage system assumes that the Predicate of the Atom is enough to determine to which sub-storage-system we need to delegate the queries
Author:
Florent Tornil
  • Constructor Details

    • FederatedFactBase

      public FederatedFactBase(FactBase default_base)
      Deprecated.
      Constructor with only a local storage
      Parameters:
      default_base - the default storage in writing mode
    • FederatedFactBase

      public FederatedFactBase(FactBase default_base, Predicate p, QueryableData storage)
      Deprecated.
      Constructor with a local storage and another storage
      Parameters:
      default_base - the default storage in writing mode
      p - a predicate
      storage - a storage associated with p
    • FederatedFactBase

      public FederatedFactBase(FactBase default_base, Collection<DataSource<String,?>> views)
      Deprecated.
      Constructor with a local storage and a colelction of view wrappers
      Parameters:
      default_base - the default storage in writing mode
      views - the views
    • FederatedFactBase

      public FederatedFactBase(FactBase default_base, Map<Predicate, QueryableData> facts_by_storage)
      Deprecated.
      Constructor with multiple storages associated to predicates
      Parameters:
      default_base - the default storage in writing mode
      facts_by_storage - a map of storage by predicate
  • Method Details

    • addStorage

      public void addStorage(Predicate p, QueryableData s)
      Deprecated.
      Add the given association
      Parameters:
      p - the predicate
      s - the storage
    • getDefaultStorage

      public FactBase getDefaultStorage()
      Deprecated.
      Returns the default writable storage used by this federated fact base.
      Returns:
      the default storage
    • setDefaultStorage

      public void setDefaultStorage(FactBase s)
      Deprecated.
      Add the given storage as default storage. Replace the existing one is any exists
      Parameters:
      s - the storage
    • getViewDefinitions

      public Map<Predicate, QueryableData> getViewDefinitions()
      Deprecated.
      Returns the view definitions registered in this federated fact base.
      Returns:
      the mappings
    • add

      public boolean add(Atom atom)
      Deprecated.
      //////////////////////////////////////////////
      Specified by:
      add in interface Writable
      Parameters:
      atom - to add
      Returns:
      true iff the atom is new
    • add

      public boolean add(FOFormula atoms)
      Deprecated.
      Description copied from interface: Writable
      Stores the given atoms
      Specified by:
      add in interface Writable
      Parameters:
      atoms - to add
      Returns:
      true iff at least one atom is new
    • addAll

      public boolean addAll(Collection<Atom> atoms)
      Deprecated.
      Description copied from interface: Writable
      Stores the given atoms
      Specified by:
      addAll in interface Writable
      Parameters:
      atoms - to add
      Returns:
      true iff at least one atom is new
    • remove

      public boolean remove(Atom atom)
      Deprecated.
      Description copied from interface: Writable
      Removes the given atom
      Specified by:
      remove in interface Writable
      Parameters:
      atom - to remove
      Returns:
      true iff the atom is removed
    • remove

      public boolean remove(FOFormula atoms)
      Deprecated.
      Description copied from interface: Writable
      Removes the given atoms
      Specified by:
      remove in interface Writable
      Parameters:
      atoms - to remove
      Returns:
      true iff at least one atom is removed
    • removeAll

      public boolean removeAll(Collection<Atom> atoms)
      Deprecated.
      Description copied from interface: Writable
      Removes the given atoms
      Specified by:
      removeAll in interface Writable
      Parameters:
      atoms - to remove
      Returns:
      true iff at least one atom is removed
    • size

      public long size()
      Deprecated.
      Description copied from interface: MaterializedData
      Counts the atoms contained in this data source.
      Specified by:
      size in interface MaterializedData
      Returns:
      the number of atoms
    • stream

      public Stream<Atom> stream()
      Deprecated.
      //////////////////////////////////////////////
      Specified by:
      stream in interface MaterializedData
      Returns:
      a stream over all the atoms of the source
    • getAtomsByPredicate

      public Stream<Atom> getAtomsByPredicate(Predicate predicate)
      Deprecated.
      Description copied from interface: MaterializedData
      Returns an iterator over all atoms with the specified predicate.
      Specified by:
      getAtomsByPredicate in interface MaterializedData
      Parameters:
      predicate - to search
      Returns:
      an iterator over all atoms with the specified predicate
    • getPredicates

      public Stream<Predicate> getPredicates()
      Deprecated.
      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)
      Deprecated.
      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
      Deprecated.
      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)
      Deprecated.
      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)
      Deprecated.
      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
    • getTermsByPredicatePosition

      public Stream<Term> getTermsByPredicatePosition(Predicate p, int position)
      Deprecated.
      Description copied from interface: MaterializedData
      Returns a stream over terms which are in a specific position in at least one atom with the given predicate.
      Specified by:
      getTermsByPredicatePosition in interface MaterializedData
      Parameters:
      p - predicate
      position - the position of the term in atoms, positions starts from 0.
      Returns:
      a stream over terms which appear in the specified position of the specified predicate.
    • getDescription

      public FactBaseDescription getDescription(Predicate viewPredicate)
      Deprecated.
      Description copied from interface: FactBase
      Returns the storage description associated with a predicate.
      Specified by:
      getDescription in interface FactBase
      Parameters:
      viewPredicate - a predicate
      Returns:
      the description of the storage
    • getType

      public FactBaseType getType(Predicate viewPredicate)
      Deprecated.
      Description copied from interface: FactBase
      Returns the storage type associated with a predicate.
      Specified by:
      getType in interface FactBase
      Parameters:
      viewPredicate - a predicate
      Returns:
      the type of storage used for the given predicate
    • getTerms

      public Stream<Term> getTerms()
      Deprecated.
      Description copied from interface: TermCompound
      Streams the first-level terms contained in this object.
      Specified by:
      getTerms in interface TermCompound
      Returns:
      a stream over all the non-nested terms (i.e., all terms that are not themselves in a compound term) For instance, for p(a,g(b)), it returns a and g(b) but not b.
    • toDLGP

      public String toDLGP()
      Deprecated.
      Description copied from interface: Printable
      Renders this object in DLGP form.
      Specified by:
      toDLGP in interface Printable
      Returns:
      the DLGP serialization