Class FolSignature

All Implemented Interfaces:
Cloneable, Signature
Direct Known Subclasses:
ActionSignature

public class FolSignature extends QuadrupleSetSignature<Constant,Predicate,Functor,Sort>
This class captures the signature of a specific first-order language.
Author:
Matthias Thimm
  • Constructor Details

    • FolSignature

      public FolSignature()
      Creates an empty signature
    • FolSignature

      public FolSignature(boolean containsEquality)
      Creates an empty signature or an otherwise empty signature with equality.
      Parameters:
      containsEquality - if true, the equality predicate is added to the signature
    • FolSignature

      public FolSignature(Collection<?> c) throws IllegalArgumentException
      Creates a signature with the given objects (should be sorts, constants, predicates, functors, or formulas).
      Parameters:
      c - a collection of items to be added.
      Throws:
      IllegalArgumentException - if at least one of the given objects is neither a constant, a sort, a predicate, a functor, or a formula.
    • FolSignature

      public FolSignature(Collection<?> c, boolean containsEquality) throws IllegalArgumentException
      Creates a signature with the given objects (should be sorts, constants, predicates, functors, or formulas) and, if desired, equality.
      Parameters:
      c - a collection of items to be added.
      containsEquality - if true, the equality predicate is added to the signature
      Throws:
      IllegalArgumentException - if at least one of the given objects is neither a constant, a sort, a predicate, a functor, or a formula.
  • Method Details

    • getConstants

      public Set<Constant> getConstants()
      Returns the constants of this first-order logic signature.
      Returns:
      set of constants
    • getPredicates

      public Set<Predicate> getPredicates()
      Returns the predicates of this first-order logic signature.
      Returns:
      set of predicates
    • getFunctors

      public Set<Functor> getFunctors()
      Returns the functors of this first-order logic signature.
      Returns:
      set of functors
    • getSorts

      public Set<Sort> getSorts()
      Returns the sorts of this first-order logic signature.
      Returns:
      set of sorts
    • add

      public void add(Object obj) throws IllegalArgumentException
      Adds the given object, either a constant, a sort, a predicate, or a functor, to this signature. If a constant is added its sort is added as well, the same is for any sort mentioned in predicates and functors. Alternatively, you can pass over a formula, then all predicates, sorts, constants, and functors of this formula are added to the signature.
      Parameters:
      obj - the object to be added, either a constant, a sort, a predicate, a functor, or a formula.
      Throws:
      IllegalArgumentException - if the given object is neither a constant, a sort, a predicate, a functor, or a formula.
    • addAll

      public void addAll(Collection<?> c) throws IllegalArgumentException
      Adds items of the given collection to this signature. These should be either constants, sorts, predicates, or functors. Alternatively, you can pass over formulas, then all predicates, sorts, constants, and functors of this formula are added t the signature.
      Specified by:
      addAll in interface Signature
      Overrides:
      addAll in class QuadrupleSetSignature<Constant,Predicate,Functor,Sort>
      Parameters:
      c - the collection of items to be added
      Throws:
      IllegalArgumentException - if at least one of the given objects is neither a constant, a sort, a predicate, a functor, or a formula.
    • isRepresentable

      public boolean isRepresentable(FolFormula folFormula)
      Checks whether the given formula can be represented by this signature.
      Parameters:
      folFormula - A formula to be checked.
      Returns:
      "true" if the given formula is representable, "false" otherwise.
    • getConstant

      public Constant getConstant(String s)
      Get the constant with the given name.
      Parameters:
      s - name of constant
      Returns:
      the constant with the given name if it is part of the signature, null otherwise
    • getPredicate

      public Predicate getPredicate(String s)
      Get the predicate with the given name.
      Parameters:
      s - name of predicate
      Returns:
      the predicate with the given name if it is part of the signature, null otherwise
    • getFunctor

      public Functor getFunctor(String s)
      Get the functor with the given name.
      Parameters:
      s - name of functor
      Returns:
      the functor with the given name if it is part of the signature, null otherwise
    • getSort

      public Sort getSort(String s)
      Get the sort with the given name.
      Parameters:
      s - name of sort
      Returns:
      the sort with the given name if it is part of the signature, null otherwise
    • contains

      public boolean contains(Object o)
      Returns true if this signature contains the specified constant, predicate, functor, sort or all constants, predicates, functors and sorts in the specified FolFormula.
      Parameters:
      o - either a constant, predicate, functor, sort or FolFormula
      Returns:
      true if the signature contains the specified formula
    • containsConstant

      public boolean containsConstant(String s)
      Returns true if this signature contains the constant of the given name.
      Parameters:
      s - name of constant
      Returns:
      true if the signature contains the constant
    • containsPredicate

      public boolean containsPredicate(String s)
      Returns true if this signature contains the predicate of the given name.
      Parameters:
      s - name of predicate
      Returns:
      true if the signature contains the predicate
    • containsFunctor

      public boolean containsFunctor(String s)
      Returns true if this signature contains the functor of the given name.
      Parameters:
      s - name of functor
      Returns:
      true if the signature contains the functor
    • containsSort

      public boolean containsSort(String s)
      Returns true if this signature contains the sort of the given name.
      Parameters:
      s - name of sort
      Returns:
      true if the signature contains the sort
    • toString

      public String toString()
      Returns a string representation of this first-order logic signature.
      Specified by:
      toString in interface Signature
      Overrides:
      toString in class QuadrupleSetSignature<Constant,Predicate,Functor,Sort>
      Returns:
      a string consisting of the sorts with their constants followed by the predicates and functors of the signature.
    • remove

      public void remove(Object obj)
      Description copied from interface: Signature
      Removes the given formula from this signature, if it is present (optional operation).
      Parameters:
      obj - some object
    • clone

      public FolSignature clone()
      Description copied from interface: Signature
      clones signature
      Specified by:
      clone in interface Signature
      Specified by:
      clone in class QuadrupleSetSignature<Constant,Predicate,Functor,Sort>
      Returns:
      clone