ai.krr.fol
Class KifKnowledgeBaseAdaptor

java.lang.Object
  extended by ai.krr.fol.KifKnowledgeBaseAdaptor
All Implemented Interfaces:
inf.compilers.SyntaxAdaptor<KnowledgeBase>

public class KifKnowledgeBaseAdaptor
extends java.lang.Object
implements inf.compilers.SyntaxAdaptor<KnowledgeBase>


Field Summary
protected  java.util.Properties props
          the properties used for reading and writing
protected  inf.compilers.LexicalAnalyzer scanner
          the lexical analyzer used for tokenizing the input
 
Constructor Summary
KifKnowledgeBaseAdaptor()
           This constructor creates a SyntaxAdaptor that can be used to read statements in a (propositional) KIF syntax and create a propositional Sentence for it, or it can be used to write out a propositional Sentence in KIF syntax.
 
Method Summary
protected  KifKnowledgeBaseAdaptor clone()
           
 java.lang.Class<KnowledgeBase> getInternalClass()
           
 java.lang.String getProperty(java.lang.String key)
           This function gets the property that is associated with the given key.
 java.lang.String getSyntaxName()
           
static KnowledgeBase parseKnowledgeBase(inf.compilers.LexicalAnalyzer scanner, java.util.Properties props)
           
 void prettyPrint(int indent, KnowledgeBase kb, java.io.Writer w)
           
static void prettyPrintKnowledgeBase(int indent, KnowledgeBase kb, java.io.Writer w, java.util.Properties props)
          
 KnowledgeBase read(java.io.Reader r)
           
 void setProperty(java.lang.String key, java.lang.String value)
           This function sets the property associated with the given key to the given value.
 void write(KnowledgeBase kb, java.io.Writer w)
           
static void writeKnowledgeBase(KnowledgeBase kb, java.io.Writer w, java.util.Properties props)
          
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

scanner

protected inf.compilers.LexicalAnalyzer scanner
the lexical analyzer used for tokenizing the input


props

protected java.util.Properties props
the properties used for reading and writing

Constructor Detail

KifKnowledgeBaseAdaptor

public KifKnowledgeBaseAdaptor()

This constructor creates a SyntaxAdaptor that can be used to read statements in a (propositional) KIF syntax and create a propositional Sentence for it, or it can be used to write out a propositional Sentence in KIF syntax.

Method Detail

clone

protected KifKnowledgeBaseAdaptor clone()
                                 throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

getInternalClass

public java.lang.Class<KnowledgeBase> getInternalClass()
Specified by:
getInternalClass in interface inf.compilers.SyntaxAdaptor<KnowledgeBase>

getSyntaxName

public java.lang.String getSyntaxName()
Specified by:
getSyntaxName in interface inf.compilers.SyntaxAdaptor<KnowledgeBase>

write

public void write(KnowledgeBase kb,
                  java.io.Writer w)
           throws inf.compilers.ExpressivenessException,
                  java.io.IOException
Specified by:
write in interface inf.compilers.SyntaxAdaptor<KnowledgeBase>
Throws:
inf.compilers.ExpressivenessException
java.io.IOException

prettyPrint

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

read

public KnowledgeBase read(java.io.Reader r)
                   throws inf.compilers.ExpressivenessException,
                          java.text.ParseException,
                          java.io.IOException
Specified by:
read in interface inf.compilers.SyntaxAdaptor<KnowledgeBase>
Throws:
inf.compilers.ExpressivenessException
java.text.ParseException
java.io.IOException

getProperty

public java.lang.String getProperty(java.lang.String key)

This function gets the property that is associated with the given key. Not e that the key should not be null.

Specified by:
getProperty in interface inf.compilers.SyntaxAdaptor<KnowledgeBase>
Returns:
the property for the given key (or null if undefined)

setProperty

public void setProperty(java.lang.String key,
                        java.lang.String value)

This function sets the property associated with the given key to the given value. The given key must not be null, but the value may be.

Specified by:
setProperty in interface inf.compilers.SyntaxAdaptor<KnowledgeBase>
Parameters:
key - the key with which the value is associated
value - the associated value

writeKnowledgeBase

public static void writeKnowledgeBase(KnowledgeBase kb,
                                      java.io.Writer w,
                                      java.util.Properties props)
                               throws inf.compilers.ExpressivenessException,
                                      java.io.IOException

Parameters:
stmt - a Sentence in the internal representation
w - the Writer to which the syntactical translation is written
Throws:
inf.compilers.ExpressivenessException - if the syntactical language cannot represent the given statement
java.io.IOException - if writing to the given Writer fails

prettyPrintKnowledgeBase

public static void prettyPrintKnowledgeBase(int indent,
                                            KnowledgeBase kb,
                                            java.io.Writer w,
                                            java.util.Properties props)
                                     throws inf.compilers.ExpressivenessException,
                                            java.io.IOException

Parameters:
stmt - a Sentence in the internal representation
w - the Writer to which the syntactical translation is written
Throws:
inf.compilers.ExpressivenessException - if the syntactical language cannot represent the given statement
java.io.IOException - if writing to the given Writer fails

parseKnowledgeBase

public static KnowledgeBase parseKnowledgeBase(inf.compilers.LexicalAnalyzer scanner,
                                               java.util.Properties props)
                                        throws inf.compilers.ExpressivenessException,
                                               java.text.ParseException,
                                               java.io.IOException
Throws:
inf.compilers.ExpressivenessException
java.text.ParseException
java.io.IOException