Class Interpretation

java.lang.Object
ca.uqac.lif.cep.fol.Interpretation

public class Interpretation extends Object
A context in which predicates can be evaluated.

An Interpretation implements the corresponding concept from first-order logic. It defines sets of values, each associated with a name, called the domains. It also defines a set of predicates, each.

Author:
Sylvain Hallé
  • Constructor Details

    • Interpretation

      public Interpretation()
      Creates a new empty interpretation
    • Interpretation

      public Interpretation(Map<String,Set<Object>> domains, Map<String,Predicate> predicates)
      Creates a new interpretation
      Parameters:
      domains - The domains defined for this interpretation. The key of this map is the name of each domain, and the corresponding value is the set of values in this domain.
      predicates - The predicates defined for this interpretation. The key of this map is the name of each predicate, and the value is the corresponding Predicate object.
    • Interpretation

      public Interpretation(Interpretation inter)
      Creates a copy of an interpretation
      Parameters:
      inter - The interpretation to copy
  • Method Details

    • getDomain

      public Set<Object> getDomain(String domain_name)
      Gets the set of values of the given domain
      Parameters:
      domain_name - The name of the domain
      Returns:
      The set of values. An empty set is returned if no domain with given name exists, or if domain_name is null.
    • addToDomain

      public void addToDomain(String domain_name, Object value)
      Adds a new value to a domain
      Parameters:
      domain_name - The name of the domain
      value - The value to add
    • addPredicateTuple

      public void addPredicateTuple(PredicateTuple tuple)
      Adds a new predicate tuple to the definition of some predicate. This also updates the domains
      Parameters:
      tuple - The tuple to add
    • addPredicate

      public void addPredicate(Predicate p)
      Adds a new predicate to this interpretation
      Parameters:
      p - The predicate to add
    • clear

      public void clear()
      Clears this interpretation of all predicate and domain definitions
    • containsPredicate

      public boolean containsPredicate(String name)
      Checks if this interpretation contains a predicate with given name
      Parameters:
      name - The predicate name
      Returns:
      true if the interpretation contains such a predicate, false otherwise
    • getPredicate

      public Predicate getPredicate(String name)
      Gets the predicate instance of given name
      Parameters:
      name - The predicate name
      Returns:
      The predicate, or null if no predicate exists with this name