edu.cs.ai.kreator.logic
Class GeneralizedAtom

java.lang.Object
  extended by edu.cs.ai.kreator.logic.Literal
      extended by edu.cs.ai.kreator.logic.SpiritGrammarConform
          extended by edu.cs.ai.kreator.logic.GeneralizedAtom
All Implemented Interfaces:
Latexable, java.lang.Comparable<Literal>

public class GeneralizedAtom
extends SpiritGrammarConform

This class models a generalized atom, i.e., it encapsulates a predicate symbol and a list of parameters. In contrast to ordinary atoms in first-order logic, the predicate may be a generalized predicate with range space different to {true,false}.

Author:
Matthias Thimm, Sebastian Loh

Nested Class Summary
 
Nested classes/interfaces inherited from class edu.cs.ai.kreator.logic.Literal
Literal.TruthValue
 
Constructor Summary
GeneralizedAtom(GeneralizedPredicate predicate)
          Constructs a generalized atom with the given predicate and empty parameter list.
GeneralizedAtom(GeneralizedPredicate predicate, java.util.List<? extends Term> parameters)
          Constructs a generalized atom with the given predicate and list of parameters.
 
Method Summary
 int compareTo(Literal other)
           
 boolean equals(java.lang.Object obj)
          compares if this literals is equal to the other literal.
 java.util.Map<Variable,Term> extendUnifier(Literal l, java.util.Map<Variable,Term> unifier)
          Extends the given unifier "u" to a unifier "u2" such that "u2" transforms this literal into the one given.
 GeneralizedAtom getAtom()
          Returns the atom of this literal.
 Literal getComplement()
          Returns the complement (negation) of this literal.
 java.util.Set<Constant> getConstants()
          Returns the set of constants, that appear in this literal.
 java.util.Set<Literal> getInstantiations(LanguageFactory language)
          Computes all ground literals of this literal with the language, i.e.
 java.util.List<Term> getParameters()
          Returns the list of parameters of that literal.
 GeneralizedPredicate getPredicate()
          Returns the predicate of this literal.
 java.util.Set<Variable> getVariables()
          Returns the set of variables, that appear in this literal.
 int hashCode()
           
 Literal substitute(java.util.Map<? extends Variable,? extends Term> substitution)
          This method substitutes each occurrence of a variable that is a key in the given substitution map by its value in the same given substitution map.
 java.lang.String toLatex()
          Returns a Latex grammar conform string to generate variables, rules (conditionals) etc.
 java.lang.String toSPIRITgrammar()
          Returns a SPIRIT grammar conform string to generate variables and SPIRIT rules (conditionals).
 java.lang.String toString()
           
 
Methods inherited from class edu.cs.ai.kreator.logic.Literal
extendUnifier, extendUnifiers, getUnifier, getUnifiers, isConsistent, substituteAll
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GeneralizedAtom

public GeneralizedAtom(GeneralizedPredicate predicate)
Constructs a generalized atom with the given predicate and empty parameter list.

Parameters:
predicate - a predicate

GeneralizedAtom

public GeneralizedAtom(GeneralizedPredicate predicate,
                       java.util.List<? extends Term> parameters)
                throws java.lang.IllegalArgumentException
Constructs a generalized atom with the given predicate and list of parameters.

Parameters:
predicate - a predicate.
parameters - a list of terms
Throws:
java.lang.IllegalArgumentException
Method Detail

getVariables

public java.util.Set<Variable> getVariables()
Description copied from class: Literal
Returns the set of variables, that appear in this literal.

Specified by:
getVariables in class Literal
Returns:
the set of variables, that appear in this literal.

getConstants

public java.util.Set<Constant> getConstants()
Description copied from class: Literal
Returns the set of constants, that appear in this literal.

Specified by:
getConstants in class Literal
Returns:
the set of constants, that appear in this literal.

getAtom

public GeneralizedAtom getAtom()
Description copied from class: Literal
Returns the atom of this literal.

Specified by:
getAtom in class Literal
Returns:
the atom of this literal.

substitute

public Literal substitute(java.util.Map<? extends Variable,? extends Term> substitution)
This method substitutes each occurrence of a variable that is a key in the given substitution map by its value in the same given substitution map.

Specified by:
substitute in class Literal
Parameters:
substitution - a map from variables to constants.
Returns:
a atom.

getInstantiations

public java.util.Set<Literal> getInstantiations(LanguageFactory language)
Description copied from class: Literal
Computes all ground literals of this literal with the language, i.e. with all constants appearing in the given language. If the given set of terms is empty and this literal has at least one free variable, the set returned will be empty.

Specified by:
getInstantiations in class Literal
Parameters:
language - a language.
Returns:
a set of ground literals of this literal.

getPredicate

public GeneralizedPredicate getPredicate()
Description copied from class: Literal
Returns the predicate of this literal.

Specified by:
getPredicate in class Literal
Returns:
a bayesian predicate.

getParameters

public java.util.List<Term> getParameters()
Description copied from class: Literal
Returns the list of parameters of that literal.

Specified by:
getParameters in class Literal
Returns:
the list of parameters of that literal.

toSPIRITgrammar

public java.lang.String toSPIRITgrammar()
Description copied from class: SpiritGrammarConform
Returns a SPIRIT grammar conform string to generate variables and SPIRIT rules (conditionals).

Specified by:
toSPIRITgrammar in class SpiritGrammarConform
Returns:
a SPIRIT grammar conform string.

toLatex

public java.lang.String toLatex()
Description copied from interface: Latexable
Returns a Latex grammar conform string to generate variables, rules (conditionals) etc.

Returns:
a Latex grammar conform string.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

compareTo

public int compareTo(Literal other)

getComplement

public Literal getComplement()
Description copied from class: Literal
Returns the complement (negation) of this literal.

Specified by:
getComplement in class Literal
Returns:
the complement (negation) of this literal.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Description copied from class: Literal
compares if this literals is equal to the other literal. Two Literals are equal if they are both positive or negative and have the same predicates incl. the same arguments and sorts.

Specified by:
equals in class Literal

extendUnifier

public java.util.Map<Variable,Term> extendUnifier(Literal l,
                                                  java.util.Map<Variable,Term> unifier)
Description copied from class: Literal
Extends the given unifier "u" to a unifier "u2" such that "u2" transforms this literal into the one given.

Specified by:
extendUnifier in class Literal
Parameters:
l - a literal
unifier - a (partial) unifier.
Returns:
a (complete) unifier.