Interface RulesCompilation


public interface RulesCompilation
Compilation of rules used to accelerate atom rewriting and unification checks.
  • Method Details

    • compile

      void compile(Iterator<Rule> ruleset)
      Extract compilable rules from the specified ruleset and compile them.
      Parameters:
      ruleset - the rules to compile
    • load

      void load(Iterator<Rule> ruleset, Iterator<Rule> compilation)
      Load compilation from a preprocessed ruleset
      Parameters:
      ruleset - the original rules
      compilation - the precomputed compilation rules
    • getSaturation

      Iterable<Rule> getSaturation()
      Returns the saturation produced by the compilation.
      Returns:
      the saturated rules
    • isCompilable

      boolean isCompilable(Rule r)
      Return true if the given rule is compilable by this kind of rules compilation.
      Parameters:
      r - the rule to test
      Returns:
      true if the rule is compilable
    • isMappable

      boolean isMappable(Predicate father, Predicate son)
      Return true iff there is a way to rewrite an atom with the predicate father into an atom with the predicate son.
      Parameters:
      father - the source predicate
      son - the target predicate
      Returns:
      true if the source predicate can rewrite to the target predicate
    • homomorphism

      Collection<Substitution> homomorphism(Atom father, Atom son)
      Return the list of c-homomorphisms of the atom father to the atom son.
      ie. return all the homomorphisms that map father with a fact implied from the atom son with compiled rules.
      Parameters:
      father - the source atom
      son - the target atom
      Returns:
      the matching homomorphisms
    • homomorphism

      Collection<Substitution> homomorphism(Atom father, Atom son, Substitution s)
      Return the list of c-homomorphisms of the atom father to the atom son such that it respects s.
      ie. return all the homomorphisms that map father with a fact implied from the atom son with compiled rules.
      Parameters:
      father - the source atom
      son - the target atom
      s - the substitution that must be respected
      Returns:
      the matching homomorphisms
    • getUnification

      Collection<fr.lirmm.graphik.util.Partition<Term>> getUnification(Atom father, Atom son)
      Return the list of c-unifier from the atom father to the atom son
      Parameters:
      father - the source atom
      son - the target atom
      Returns:
      the unifications between both atoms
    • isImplied

      boolean isImplied(Atom father, Atom son)
      Return true iff the atom father is implied from the atom son with compiled rules (son -> father) i. e. the atom son is a R-rewriting of the atom father by compiled rules
      Parameters:
      father - the source atom
      son - the target atom
      Returns:
      true if the target atom implies the source atom
    • getRewritingOf

      Collection<org.apache.commons.lang3.tuple.Pair<Atom, Substitution>> getRewritingOf(Atom father)
      Return the list of atom that are R-rewriting of the atom father by compiled rules
      Parameters:
      father - the atom to rewrite
      Returns:
      the rewritings of the given atom
    • getUnifiablePredicate

      Collection<Predicate> getUnifiablePredicate(Predicate p)
      Return a collection of predicate unifiable with the given one
      Parameters:
      p - the predicate to compare
      Returns:
      the unifiable predicates
    • getIrredondant

      InMemoryAtomSet getIrredondant(InMemoryAtomSet atomSet)
      Filters redundant atom in the specified atom-set with respect to this rule compilation.
      Parameters:
      atomSet - the atom set to reduce
      Returns:
      an InMemoryAtomSet which is a subset of the specified one and which is equivalent to with respect to this rule compilation.
    • isEmpty

      boolean isEmpty()
      Returns true if this compilation object does not contain any information, false otherwise.
      Returns:
      true if this compilation object does not contain any information, false otherwise.
    • setProfiler

      void setProfiler(fr.lirmm.graphik.util.profiler.Profiler profiler)
    • getProfiler

      fr.lirmm.graphik.util.profiler.Profiler getProfiler()