Interface Rule

All Superinterfaces:
Comparable<Rule>
All Known Subinterfaces:
NegativeConstraint
All Known Implementing Classes:
AbstractRule, ConjunctiveQueryRuleAdapter, DefaultNegativeConstraint, DefaultRule

public interface Rule extends Comparable<Rule>
This interface represents an existential rule. An existential rule is a positive rule of the form B -> H, where B and H are conjunctions of atoms; it is interpreted as the formula ∀X(∃Y B[X,Y] -> ∃Z H[X,Z]), or equivalently ∀X∀Y(B[X,Y] -> ∃Z H[X,Z]), where X are the variables shared by B and H, Y are the variables that occur only in B and Z the ones that occur only in H. Note that Z are existentially quantified.
Author:
Clément Sipieter (INRIA) <clement@6pi.fr>
  • Method Details

    • getLabel

      String getLabel()
      Get the label (the name) of this rule.
      Returns:
      the label of this rule.
    • setLabel

      void setLabel(String label)
      Set the label (the name) of this rule.
      Parameters:
      label - the new rule label
    • getBody

      InMemoryAtomSet getBody()
      Get the body (the hypothesis) of this rule.
      Returns:
      the body of this rule.
    • getHead

      InMemoryAtomSet getHead()
      Get the head (the conclusion) of this rule.
      Returns:
      the head of this rule.
    • getFrontier

      Set<Variable> getFrontier()
      Compute and return the set of frontier variables of this rule.
      Returns:
      a Set containing the frontier variables of this rule.
    • getExistentials

      Set<Variable> getExistentials()
      Compute and return the set of existential variables of this rule.
      Returns:
      a Set containing the existential variables of this rule.
    • getTerms

      @Deprecated Set<Term> getTerms(Term.Type type)
      Deprecated.
      Get terms by Type.
      Parameters:
      type - the term type to collect
      Returns:
      a Set of all Term of the specified type related to this Rule.
    • getVariables

      Set<Variable> getVariables()
      Get all variables of this rule.
      Returns:
      a Set of all variables related to this Rule.
    • getConstants

      Set<Constant> getConstants()
      Get all constants of this rule.
      Returns:
      a Set of all constants related to this Rule.
    • getLiterals

      Set<Literal> getLiterals()
      Get all literals of this rule.
      Returns:
      a Set of all literals related to this Rule.
    • getTerms

      Set<Term> getTerms()
      Get all terms of this rule.
      Returns:
      a Set of all Term related to this Rule.
    • appendTo

      void appendTo(StringBuilder sb)
      Appends this object representation to the provided builder.
      Parameters:
      sb - the target builder