Package ca.uqac.lif.cep.fol
Class Interpretation
java.lang.Object
ca.uqac.lif.cep.fol.Interpretation
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 Summary
ConstructorsConstructorDescriptionCreates a new empty interpretationInterpretation(Interpretation inter) Creates a copy of an interpretationCreates a new interpretation -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a new predicate to this interpretationvoidaddPredicateTuple(PredicateTuple tuple) Adds a new predicate tuple to the definition of some predicate.voidaddToDomain(String domain_name, Object value) Adds a new value to a domainvoidclear()Clears this interpretation of all predicate and domain definitionsbooleancontainsPredicate(String name) Checks if this interpretation contains a predicate with given nameGets the set of values of the given domaingetPredicate(String name) Gets the predicate instance of given name
-
Constructor Details
-
Interpretation
public Interpretation()Creates a new empty interpretation -
Interpretation
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 correspondingPredicateobject.
-
Interpretation
Creates a copy of an interpretation- Parameters:
inter- The interpretation to copy
-
-
Method Details
-
getDomain
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_nameis null.
-
addToDomain
Adds a new value to a domain- Parameters:
domain_name- The name of the domainvalue- The value to add
-
addPredicateTuple
Adds a new predicate tuple to the definition of some predicate. This also updates the domains- Parameters:
tuple- The tuple to add
-
addPredicate
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
Checks if this interpretation contains a predicate with given name- Parameters:
name- The predicate name- Returns:
trueif the interpretation contains such a predicate,falseotherwise
-
getPredicate
Gets the predicate instance of given name- Parameters:
name- The predicate name- Returns:
- The predicate, or
nullif no predicate exists with this name
-