ai.krr.fol
Class KnowledgeBase

java.lang.Object
  extended by ai.krr.fol.KnowledgeBase
All Implemented Interfaces:
inf.compilers.SyntaxAdaptable

public class KnowledgeBase
extends java.lang.Object
implements inf.compilers.SyntaxAdaptable

A KnowledgeBase is effectively a set of Sentences believed to be true.

Author:
Gerhard Wickler

Field Summary
protected  java.util.List<Sentence> beliefs
          the List of Sentences that hold in this KB
 
Constructor Summary
KnowledgeBase()
           
 
Method Summary
 void add(Sentence stmt)
           This function asserts the given Sentence in this KnowledgeBase.
 boolean entails(Sentence stmt)
           This function tests whether the given Sentence holds in this KnowledgeBase.
 boolean falsifies(Sentence stmt)
           This function tests whether the given Sentence does not hold in this KnowledgeBase.
 void prettyPrint(int indent, java.io.Writer w, inf.compilers.SyntaxAdaptor sa)
           
static KnowledgeBase read(java.io.Reader r, inf.compilers.SyntaxAdaptor<KnowledgeBase> sa)
           
 void retract(Sentence stmt)
           This function deletes the given Sentence from this KnowledgeBase.
 void write(java.io.Writer w, inf.compilers.SyntaxAdaptor sa)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

beliefs

protected java.util.List<Sentence> beliefs
the List of Sentences that hold in this KB

Constructor Detail

KnowledgeBase

public KnowledgeBase()
Method Detail

write

public void write(java.io.Writer w,
                  inf.compilers.SyntaxAdaptor sa)
           throws inf.compilers.ExpressivenessException,
                  java.io.IOException
Specified by:
write in interface inf.compilers.SyntaxAdaptable
Throws:
inf.compilers.ExpressivenessException
java.io.IOException

prettyPrint

public void prettyPrint(int indent,
                        java.io.Writer w,
                        inf.compilers.SyntaxAdaptor sa)
                 throws inf.compilers.ExpressivenessException,
                        java.io.IOException
Specified by:
prettyPrint in interface inf.compilers.SyntaxAdaptable
Throws:
inf.compilers.ExpressivenessException
java.io.IOException

add

public void add(Sentence stmt)

This function asserts the given Sentence in this KnowledgeBase.

Parameters:
stmt - the Sentence that is to hold in this KnowledgeBase

retract

public void retract(Sentence stmt)

This function deletes the given Sentence from this KnowledgeBase.

Parameters:
stmt - the Sentence that is not to hold in this KnowledgeBase

entails

public boolean entails(Sentence stmt)

This function tests whether the given Sentence holds in this KnowledgeBase.

Parameters:
stmt - the Sentence that may or may not be true
Returns:
true iff the given Sentence is entailed by this KnowledgeBase

falsifies

public boolean falsifies(Sentence stmt)

This function tests whether the given Sentence does not hold in this KnowledgeBase.

Parameters:
stmt - the Sentence that may or may not be true
Returns:
true iff the negation of the given Sentence is entailed by this KnowledgeBase

read

public static KnowledgeBase read(java.io.Reader r,
                                 inf.compilers.SyntaxAdaptor<KnowledgeBase> sa)
                          throws inf.compilers.ExpressivenessException,
                                 java.text.ParseException,
                                 java.io.IOException
Throws:
inf.compilers.ExpressivenessException
java.text.ParseException
java.io.IOException