Class DefaultRule

java.lang.Object
fr.lirmm.graphik.integraal.core.AbstractRule
fr.lirmm.graphik.integraal.core.DefaultRule
All Implemented Interfaces:
Rule, Comparable<Rule>
Direct Known Subclasses:
DefaultNegativeConstraint

public class DefaultRule extends AbstractRule
Default implementation of a rule backed by in-memory atom sets for its body and head.
Author:
Clément Sipieter (INRIA) clement@6pi.f
  • Constructor Details

    • DefaultRule

      public DefaultRule()
      Creates an empty unlabeled rule.
    • DefaultRule

      Creates an unlabeled rule from iterators over its body and head atoms.
      Parameters:
      body - the iterator over body atoms
      head - the iterator over head atoms
    • DefaultRule

      Creates a rule from iterators over its body and head atoms.
      Parameters:
      label - the rule label
      body - the iterator over body atoms
      head - the iterator over head atoms
    • DefaultRule

      public DefaultRule(InMemoryAtomSet body, InMemoryAtomSet head)
      Creates an unlabeled rule from in-memory body and head atom sets.
      Parameters:
      body - the rule body
      head - the rule head
    • DefaultRule

      public DefaultRule(String label, InMemoryAtomSet body, InMemoryAtomSet head)
      Creates a rule from in-memory body and head atom sets.
      Parameters:
      label - the rule label
      body - the rule body
      head - the rule head
    • DefaultRule

      public DefaultRule(Rule rule)
      Creates a copy of the provided rule.
      Parameters:
      rule - the rule to copy
  • Method Details

    • getBody

      public InMemoryAtomSet getBody()
      Description copied from interface: Rule
      Get the body (the hypothesis) of this rule.
      Returns:
      the body of this rule.
    • setBody

      public void setBody(InMemoryAtomSet b)
      Replaces the rule body.
      Parameters:
      b - the new body
    • getLabel

      public String getLabel()
      Description copied from interface: Rule
      Get the label (the name) of this rule.
      Returns:
      the label of this rule.
    • setLabel

      public void setLabel(String label)
      Description copied from interface: Rule
      Set the label (the name) of this rule.
      Parameters:
      label - the new rule label
    • getHead

      public InMemoryAtomSet getHead()
      Description copied from interface: Rule
      Get the head (the conclusion) of this rule.
      Returns:
      the head of this rule.
    • setHead

      public void setHead(InMemoryAtomSet h)
      Replaces the rule head.
      Parameters:
      h - the new head
    • getTerms

      public Set<Term> getTerms()
      Description copied from interface: Rule
      Get all terms of this rule.
      Returns:
      a Set of all Term related to this Rule.
    • getVariables

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

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

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

      @Deprecated public Set<Term> getTerms(Term.Type type)
      Deprecated.
      Description copied from interface: Rule
      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.
    • getFrontier

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

      public Set<Variable> getExistentials()
      Description copied from interface: Rule
      Compute and return the set of existential variables of this rule.
      Returns:
      a Set containing the existential variables of this rule.