Class Pred

All Implemented Interfaces:
LogicalFormula, Term, ToDOM, ToJson, Serializable, Cloneable, Comparable<Term>
Direct Known Subclasses:
LiteralImpl

public class Pred extends Structure
A Pred extends a Structure with annotations, e.g.: a(1)[an1,an2].
See Also:
  • Constructor Details

  • Method Details

    • parsePred

      public static Pred parsePred(String spread)
    • isPred

      public boolean isPred()
      Specified by:
      isPred in interface Term
      Overrides:
      isPred in class DefaultTerm
    • isAtom

      public boolean isAtom()
      Specified by:
      isAtom in interface Term
      Overrides:
      isAtom in class Structure
    • isGround

      public boolean isGround()
      Specified by:
      isGround in interface Term
      Overrides:
      isGround in class Structure
    • setAnnots

      public Literal setAnnots(ListTerm l)
      Overrides:
      setAnnots in class Literal
    • addAnnot

      public boolean addAnnot(Term t)
      Overrides:
      addAnnot in class Literal
    • addAnnots

      public Literal addAnnots(List<Term> l)
      Description copied from class: Literal
      adds some annots and return this
      Overrides:
      addAnnots in class Literal
    • addAnnots

      public Literal addAnnots(Term... l)
      Description copied from class: Literal
      adds some annots and return this
      Overrides:
      addAnnots in class Literal
    • delAnnot

      public boolean delAnnot(Term t)
      Overrides:
      delAnnot in class Literal
    • clearAnnots

      public Literal clearAnnots()
      Description copied from class: Literal
      removes all annotations and returns itself
      Overrides:
      clearAnnots in class Literal
    • getAnnots

      public ListTerm getAnnots()
      Description copied from class: Literal
      returns all annotations of the literal
      Overrides:
      getAnnots in class Literal
    • capplyAnnots

      public ListTerm capplyAnnots(Unifier u)
    • hasAnnot

      public boolean hasAnnot(Term t)
      Description copied from class: Literal
      returns true if there is some annotation t in the literal
      Overrides:
      hasAnnot in class Literal
    • getAnnot

      public Literal getAnnot(String functor)
      find the first annotation with a given functor (only literal annots are considered)
      Overrides:
      getAnnot in class Literal
    • hasAnnot

      public boolean hasAnnot()
      Description copied from class: Literal
      returns true if the pred has at least one annot
      Overrides:
      hasAnnot in class Literal
    • hasVar

      public boolean hasVar(VarTerm t, Unifier u)
      Specified by:
      hasVar in interface Term
      Overrides:
      hasVar in class Structure
    • countVars

      public void countVars(Map<VarTerm,Integer> c)
      Specified by:
      countVars in interface Term
      Overrides:
      countVars in class Structure
    • importAnnots

      public boolean importAnnots(Literal p)
      Description copied from class: Literal
      "import" annots from another predicate p. p will be changed to contain only the annots actually imported (for Event), for example: p = b[a,b] this = b[b,c] after import, p = b[a] It is used to generate event invalid input: '<'+b[a]>.
      Overrides:
      importAnnots in class Literal
      Returns:
      true if some annot was imported.
    • delAnnots

      public boolean delAnnots(List<Term> l)
      Description copied from class: Literal
      removes all annots in this pred that are in the list l.
      Overrides:
      delAnnots in class Literal
      Returns:
      true if some annot was removed.
    • getAnnots

      public ListTerm getAnnots(String functor)
      Description copied from class: Literal
      returns all annots with the specified functor e.g.: from annots [t(a), t(b), source(tom)] and functor "t", it returns [t(a),t(b)] in case that there is no such an annot, it returns an empty list.
      Overrides:
      getAnnots in class Literal
    • hasSubsetAnnot

      public boolean hasSubsetAnnot(Literal p)
      Description copied from class: Literal
      returns true if all this predicate annots are in p's annots
      Overrides:
      hasSubsetAnnot in class Literal
    • hasSubsetAnnot

      public boolean hasSubsetAnnot(Literal p, Unifier u)
      Description copied from class: Literal
      Returns true if all this predicate's annots are in p's annots using the unifier u. if p annots has a Tail, p annots's Tail will receive this predicate's annots, e.g.: this[a,b,c] = p[x,y,b|T] unifies and T is [a,c] (this will be a subset if p has a and c in its annots). if this annots has a tail, the Tail will receive all necessary term to be a subset, e.g.: this[b|T] = p[x,y,b] unifies and T is [x,y] (this will be a subset if T is [x,y].
      Overrides:
      hasSubsetAnnot in class Literal
    • addSource

      public Literal addSource(Term agName)
      Description copied from class: Literal
      adds the annotation source(agName)
      Overrides:
      addSource in class Literal
    • delSource

      public boolean delSource(Term agName)
      Description copied from class: Literal
      deletes one source(agName) annotation, return true if deleted
      Overrides:
      delSource in class Literal
    • createSource

      public static Pred createSource(Term source)
    • getSources

      public ListTerm getSources()
      Description copied from class: Literal
      returns the sources of this literal as a new list. e.g.: from annots [source(a), source(b)], it returns [a,b]
      Overrides:
      getSources in class Literal
    • delSources

      public void delSources()
      Description copied from class: Literal
      deletes all source annotations
      Overrides:
      delSources in class Literal
    • hasSource

      public boolean hasSource()
      Description copied from class: Literal
      returns true if this literal has some source annotation
      Overrides:
      hasSource in class Literal
    • hasSource

      public boolean hasSource(Term agName)
      Description copied from class: Literal
      returns true if this literal has a "source(agName)"
      Overrides:
      hasSource in class Literal
    • makeVarsAnnon

      public Literal makeVarsAnnon(Unifier un)
      Description copied from class: Literal
      replaces all variables of the term for unnamed variables (_).
      Overrides:
      makeVarsAnnon in class Structure
      Parameters:
      un - is the unifier that contains the map of replacements
    • equals

      public boolean equals(Object o)
      Specified by:
      equals in interface Term
      Overrides:
      equals in class Structure
    • equalsAsStructure

      public boolean equalsAsStructure(Object p)
      Overrides:
      equalsAsStructure in class Literal
    • capply

      public Term capply(Unifier u)
      Description copied from interface: Term
      clone and applies together (and faster than clone and then apply)
      Specified by:
      capply in interface Term
      Overrides:
      capply in class Structure
    • clone

      public Term clone()
      Description copied from class: Structure
      make a deep copy of the terms
      Specified by:
      clone in interface Term
      Overrides:
      clone in class Structure
    • cloneNS

      public Literal cloneNS(Atom newnamespace)
      Description copied from interface: Term
      clone in another namespace
      Specified by:
      cloneNS in interface Term
      Overrides:
      cloneNS in class Structure
    • toStringAsTerm

      public String toStringAsTerm()
    • getAsDOM

      public Element getAsDOM(Document document)
      get as XML
      Specified by:
      getAsDOM in interface ToDOM
      Overrides:
      getAsDOM in class Structure