Class ASPBodyElement

java.lang.Object
org.tweetyproject.lp.asp.syntax.ASPElement
org.tweetyproject.lp.asp.syntax.ASPBodyElement
All Implemented Interfaces:
Formula, ComplexLogicalFormula, LogicStructure, SimpleLogicalFormula
Direct Known Subclasses:
AggregateAtom, ASPLiteral, ComparativeAtom, DefaultNegation, OptimizationStatement

public abstract class ASPBodyElement extends ASPElement
This class is a common base class for ASP formulas that can be part of an ASP rule body (premise of a rule):
  • Literals (i.e. atoms or strictly negated atoms)
  • Built-in atoms (i.e. terms connected by comparative operators like == and !=)
  • Aggregate atoms
  • Default negations of literals or aggregates (i.e. 'not a' a for a literal or aggregate a)
Note: In the ASP-Core-2 standard, the formulas represented by this class are also referred to as 'Literals'. In the TweetyProject ASP library, literals are only atoms or the strict negations of atoms.
Author:
Tim Janus, Anna Gessler
  • Constructor Details

    • ASPBodyElement

      public ASPBodyElement()
  • Method Details

    • getLiterals

      public abstract SortedSet<ASPLiteral> getLiterals()
      Returns all literals in this element in form of a SortedSet. Literals are atoms or strict negations of atoms.
      Returns:
      all the literals used in the rule element
    • substitute

      public abstract ASPBodyElement substitute(Term<?> t, Term<?> v)
      Description copied from interface: ComplexLogicalFormula
      Substitutes all occurrences of term "v" in this formula by term "t" and returns the new formula.
      Specified by:
      substitute in interface ComplexLogicalFormula
      Specified by:
      substitute in class ASPElement
      Parameters:
      t - the term to be substituted.
      v - the term to substitute.
      Returns:
      a formula where every occurrence of "v" is replaced by "t".