ai.krr.fol
Class XfolSentenceAdaptor

java.lang.Object
  extended by inf.compilers.XmlAdaptor<Sentence>
      extended by ai.krr.fol.XfolSentenceAdaptor
All Implemented Interfaces:
inf.compilers.SyntaxAdaptor<Sentence>

public class XfolSentenceAdaptor
extends inf.compilers.XmlAdaptor<Sentence>

This class is an adaptor between the ai.krr.propositions.Sentence class that can be used as an internal representation for reasoning and its external form in an XML Syntax. The XMLSchema defining the XFOL format ....

Writing

Reading

property possible values default
case-sensitive true, false true

Author:
Gerhard Wickler

Field Summary
 
Fields inherited from class inf.compilers.XmlAdaptor
indentStr, props
 
Constructor Summary
XfolSentenceAdaptor()
           This constructor creates a SyntaxAdaptor that can be used to read statements in an XML syntax for propositional logic (XFOL) and create a propositional Sentence for it, or it can be used to write out a propositional Sentence in XFOL syntax.
 
Method Summary
protected  XfolSentenceAdaptor clone()
           This function returns a copy of this SyntaxAdaptor that contains a (shallow) copy of the properties.
protected  org.w3c.dom.Element generateAtomNode(org.w3c.dom.Document doc, Atom atom, java.util.Set<NameSpace> nss)
           
protected  org.w3c.dom.Element generateCharacterNode(org.w3c.dom.Document doc, CharacterSymbol charSy)
           
protected  org.w3c.dom.Element generateConnectedSentenceNode(org.w3c.dom.Document doc, ConnectedSentence stmt, java.util.Set<NameSpace> nss)
           
protected  org.w3c.dom.Element generateConstantTermNode(org.w3c.dom.Document doc, Constant cTerm)
           
protected  org.w3c.dom.Element generateFunctionTermNode(org.w3c.dom.Document doc, FunctionTerm fTerm)
           
protected  org.w3c.dom.Element generateIntegerNode(org.w3c.dom.Document doc, IntegerSymbol intSy)
           
protected  org.w3c.dom.Element generateLiteralNode(org.w3c.dom.Document doc, Literal lit, java.util.Set<NameSpace> nss)
           
protected  org.w3c.dom.Element generateNegatedSentenceNode(org.w3c.dom.Document doc, NegatedSentence stmt, java.util.Set<NameSpace> nss)
           
 org.w3c.dom.Element generateNodeTree(org.w3c.dom.Document doc, Sentence content)
           This function generates an Element Node that is the root for the given content.
protected  org.w3c.dom.Element generatePrefixNode(org.w3c.dom.Document doc, QuantifiedSentence stmt)
           
protected  org.w3c.dom.Element generateQuantifiedSentenceNode(org.w3c.dom.Document doc, QuantifiedSentence stmt, java.util.Set<NameSpace> nss)
           
protected  org.w3c.dom.Element generateRealNumberNode(org.w3c.dom.Document doc, RealNumberSymbol realSy)
           
 org.w3c.dom.Element generateSentenceNode(org.w3c.dom.Document doc, Sentence content, java.util.Set<NameSpace> nss)
           This function generates an Element Node that is the root for the given content.
protected  org.w3c.dom.Element generateStringNode(org.w3c.dom.Document doc, StringSymbol strSy)
           
protected  org.w3c.dom.Element generateSymbolNode(org.w3c.dom.Document doc, java.lang.String tag, NamedSymbol nSy)
           
protected  org.w3c.dom.Element generateTermNode(org.w3c.dom.Document doc, Term term)
           
protected  org.w3c.dom.Element generateTruthValueNode(org.w3c.dom.Document doc, TruthValue tValue, java.util.Set<NameSpace> nss)
           
protected  org.w3c.dom.Element generateVariableNode(org.w3c.dom.Document doc, Variable var)
           
 java.lang.Class<Sentence> getInternalClass()
           This function returns the Class that holds the internal representation this adaptor translates to and from.
 java.lang.String getSyntaxName()
           This function returns the name that should identify the syntactical language that this adaptor translates to and from.
protected  Atom parseAtom(org.w3c.dom.Element node, java.util.Map<java.lang.String,NameSpace> proxies)
           
protected  Constant parseCharacter(org.w3c.dom.Element node, java.util.Map<java.lang.String,NameSpace> proxies)
           
protected  ConnectedSentence parseConnectedSentence(org.w3c.dom.Element node, java.util.Map<java.lang.String,NameSpace> proxies)
           
protected  Constant parseConstant(org.w3c.dom.Element node, java.util.Map<java.lang.String,NameSpace> proxies)
           
protected  FunctionTerm parseFunctionTerm(org.w3c.dom.Element node, java.util.Map<java.lang.String,NameSpace> proxies)
           
protected  Constant parseInteger(org.w3c.dom.Element node, java.util.Map<java.lang.String,NameSpace> proxies)
           
protected  Literal parseLiteral(org.w3c.dom.Element node, java.util.Map<java.lang.String,NameSpace> proxies)
           
protected  NegatedSentence parseNegatedSentence(org.w3c.dom.Element node, java.util.Map<java.lang.String,NameSpace> proxies)
           
 Sentence parseNodeTree(org.w3c.dom.Element root)
           This function takes a DOM Document and generates an internal representation of the statement in the representation R that represents the content of the given Document.
protected  QuantifiedSentence parseQuantifiedSentence(org.w3c.dom.Element node, java.util.Map<java.lang.String,NameSpace> proxies)
           
protected  Constant parseRealNumber(org.w3c.dom.Element node, java.util.Map<java.lang.String,NameSpace> proxies)
           
protected  Sentence parseSentence(org.w3c.dom.Element node, java.util.Map<java.lang.String,NameSpace> proxies)
           
protected  Constant parseString(org.w3c.dom.Element node, java.util.Map<java.lang.String,NameSpace> proxies)
           
protected  Term parseTerm(org.w3c.dom.Element node, java.util.Map<java.lang.String,NameSpace> proxies)
           
protected  TruthValue parseTruthValue(org.w3c.dom.Element node)
           
protected  Variable parseVariable(org.w3c.dom.Element node, java.util.Map<java.lang.String,NameSpace> proxies)
           
 
Methods inherited from class inf.compilers.XmlAdaptor
addContentText, generateContentNodeTree, generateDocument, getContentText, getProperty, parseContentNodeTree, parseDocument, prettyPrint, read, setProperty, setSyntaxAdaptors, write
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XfolSentenceAdaptor

public XfolSentenceAdaptor()

This constructor creates a SyntaxAdaptor that can be used to read statements in an XML syntax for propositional logic (XFOL) and create a propositional Sentence for it, or it can be used to write out a propositional Sentence in XFOL syntax. The given properties must not be null.

Parameters:
props - the Properties that determine how to perform the reading and writing
Method Detail

clone

protected XfolSentenceAdaptor clone()

This function returns a copy of this SyntaxAdaptor that contains a (shallow) copy of the properties.

Overrides:
clone in class java.lang.Object
Returns:
a copy of this SyntaxAdaptor

getInternalClass

public java.lang.Class<Sentence> getInternalClass()

This function returns the Class that holds the internal representation this adaptor translates to and from.

Returns:
the internal representation Class adapted to

getSyntaxName

public java.lang.String getSyntaxName()

This function returns the name that should identify the syntactical language that this adaptor translates to and from.

Returns:
the name of the language adapted to

parseNodeTree

public Sentence parseNodeTree(org.w3c.dom.Element root)
                       throws inf.compilers.ExpressivenessException,
                              java.text.ParseException

This function takes a DOM Document and generates an internal representation of the statement in the representation R that represents the content of the given Document. No validation will be performed here.

Specified by:
parseNodeTree in class inf.compilers.XmlAdaptor<Sentence>
Parameters:
doc - the Document to be transformed here
Returns:
the internal representation of that Document in the representation R
Throws:
inf.compilers.ExpressivenessException
java.text.ParseException

generateNodeTree

public org.w3c.dom.Element generateNodeTree(org.w3c.dom.Document doc,
                                            Sentence content)
                                     throws inf.compilers.ExpressivenessException

This function generates an Element Node that is the root for the given content. The way it is generated depends on the type of sentence this is.

Specified by:
generateNodeTree in class inf.compilers.XmlAdaptor<Sentence>
Parameters:
doc - the Document to which the Node will belong
content - a statement in the internal representation language
Throws:
inf.compilers.ExpressivenessException - if the XML cannot represent the given statement

generateSentenceNode

public org.w3c.dom.Element generateSentenceNode(org.w3c.dom.Document doc,
                                                Sentence content,
                                                java.util.Set<NameSpace> nss)
                                         throws inf.compilers.ExpressivenessException

This function generates an Element Node that is the root for the given content. The way it is generated depends on the type of sentence this is.

Parameters:
doc - the Document to which the Node will belong
content - a statement in the internal representation language
nss - the set of all NameSpaces used in the given Sentence
Throws:
inf.compilers.ExpressivenessException - if any contained NamedSymbol is internal

generateQuantifiedSentenceNode

protected org.w3c.dom.Element generateQuantifiedSentenceNode(org.w3c.dom.Document doc,
                                                             QuantifiedSentence stmt,
                                                             java.util.Set<NameSpace> nss)
                                                      throws inf.compilers.ExpressivenessException
Throws:
inf.compilers.ExpressivenessException

generatePrefixNode

protected org.w3c.dom.Element generatePrefixNode(org.w3c.dom.Document doc,
                                                 QuantifiedSentence stmt)
                                          throws inf.compilers.ExpressivenessException
Throws:
inf.compilers.ExpressivenessException

generateConnectedSentenceNode

protected org.w3c.dom.Element generateConnectedSentenceNode(org.w3c.dom.Document doc,
                                                            ConnectedSentence stmt,
                                                            java.util.Set<NameSpace> nss)
                                                     throws inf.compilers.ExpressivenessException
Throws:
inf.compilers.ExpressivenessException

generateNegatedSentenceNode

protected org.w3c.dom.Element generateNegatedSentenceNode(org.w3c.dom.Document doc,
                                                          NegatedSentence stmt,
                                                          java.util.Set<NameSpace> nss)
                                                   throws inf.compilers.ExpressivenessException
Throws:
inf.compilers.ExpressivenessException

generateLiteralNode

protected org.w3c.dom.Element generateLiteralNode(org.w3c.dom.Document doc,
                                                  Literal lit,
                                                  java.util.Set<NameSpace> nss)
                                           throws inf.compilers.ExpressivenessException
Throws:
inf.compilers.ExpressivenessException

generateAtomNode

protected org.w3c.dom.Element generateAtomNode(org.w3c.dom.Document doc,
                                               Atom atom,
                                               java.util.Set<NameSpace> nss)
                                        throws inf.compilers.ExpressivenessException
Throws:
inf.compilers.ExpressivenessException

generateTruthValueNode

protected org.w3c.dom.Element generateTruthValueNode(org.w3c.dom.Document doc,
                                                     TruthValue tValue,
                                                     java.util.Set<NameSpace> nss)
                                              throws inf.compilers.ExpressivenessException
Throws:
inf.compilers.ExpressivenessException

generateTermNode

protected org.w3c.dom.Element generateTermNode(org.w3c.dom.Document doc,
                                               Term term)
                                        throws inf.compilers.ExpressivenessException
Throws:
inf.compilers.ExpressivenessException

generateFunctionTermNode

protected org.w3c.dom.Element generateFunctionTermNode(org.w3c.dom.Document doc,
                                                       FunctionTerm fTerm)
                                                throws inf.compilers.ExpressivenessException
Throws:
inf.compilers.ExpressivenessException

generateVariableNode

protected org.w3c.dom.Element generateVariableNode(org.w3c.dom.Document doc,
                                                   Variable var)
                                            throws inf.compilers.ExpressivenessException
Throws:
inf.compilers.ExpressivenessException

generateConstantTermNode

protected org.w3c.dom.Element generateConstantTermNode(org.w3c.dom.Document doc,
                                                       Constant cTerm)
                                                throws inf.compilers.ExpressivenessException
Throws:
inf.compilers.ExpressivenessException

generateSymbolNode

protected org.w3c.dom.Element generateSymbolNode(org.w3c.dom.Document doc,
                                                 java.lang.String tag,
                                                 NamedSymbol nSy)
                                          throws inf.compilers.ExpressivenessException
Throws:
inf.compilers.ExpressivenessException

generateStringNode

protected org.w3c.dom.Element generateStringNode(org.w3c.dom.Document doc,
                                                 StringSymbol strSy)
                                          throws inf.compilers.ExpressivenessException
Throws:
inf.compilers.ExpressivenessException

generateCharacterNode

protected org.w3c.dom.Element generateCharacterNode(org.w3c.dom.Document doc,
                                                    CharacterSymbol charSy)
                                             throws inf.compilers.ExpressivenessException
Throws:
inf.compilers.ExpressivenessException

generateRealNumberNode

protected org.w3c.dom.Element generateRealNumberNode(org.w3c.dom.Document doc,
                                                     RealNumberSymbol realSy)
                                              throws inf.compilers.ExpressivenessException
Throws:
inf.compilers.ExpressivenessException

generateIntegerNode

protected org.w3c.dom.Element generateIntegerNode(org.w3c.dom.Document doc,
                                                  IntegerSymbol intSy)
                                           throws inf.compilers.ExpressivenessException
Throws:
inf.compilers.ExpressivenessException

parseSentence

protected Sentence parseSentence(org.w3c.dom.Element node,
                                 java.util.Map<java.lang.String,NameSpace> proxies)
                          throws java.text.ParseException
Throws:
java.text.ParseException

parseQuantifiedSentence

protected QuantifiedSentence parseQuantifiedSentence(org.w3c.dom.Element node,
                                                     java.util.Map<java.lang.String,NameSpace> proxies)
                                              throws java.text.ParseException
Throws:
java.text.ParseException

parseConnectedSentence

protected ConnectedSentence parseConnectedSentence(org.w3c.dom.Element node,
                                                   java.util.Map<java.lang.String,NameSpace> proxies)
                                            throws java.text.ParseException
Throws:
java.text.ParseException

parseNegatedSentence

protected NegatedSentence parseNegatedSentence(org.w3c.dom.Element node,
                                               java.util.Map<java.lang.String,NameSpace> proxies)
                                        throws java.text.ParseException
Throws:
java.text.ParseException

parseLiteral

protected Literal parseLiteral(org.w3c.dom.Element node,
                               java.util.Map<java.lang.String,NameSpace> proxies)
                        throws java.text.ParseException
Throws:
java.text.ParseException

parseAtom

protected Atom parseAtom(org.w3c.dom.Element node,
                         java.util.Map<java.lang.String,NameSpace> proxies)
                  throws java.text.ParseException
Throws:
java.text.ParseException

parseTruthValue

protected TruthValue parseTruthValue(org.w3c.dom.Element node)

parseTerm

protected Term parseTerm(org.w3c.dom.Element node,
                         java.util.Map<java.lang.String,NameSpace> proxies)
                  throws java.text.ParseException
Throws:
java.text.ParseException

parseFunctionTerm

protected FunctionTerm parseFunctionTerm(org.w3c.dom.Element node,
                                         java.util.Map<java.lang.String,NameSpace> proxies)
                                  throws java.text.ParseException
Throws:
java.text.ParseException

parseVariable

protected Variable parseVariable(org.w3c.dom.Element node,
                                 java.util.Map<java.lang.String,NameSpace> proxies)
                          throws java.text.ParseException
Throws:
java.text.ParseException

parseConstant

protected Constant parseConstant(org.w3c.dom.Element node,
                                 java.util.Map<java.lang.String,NameSpace> proxies)
                          throws java.text.ParseException
Throws:
java.text.ParseException

parseString

protected Constant parseString(org.w3c.dom.Element node,
                               java.util.Map<java.lang.String,NameSpace> proxies)
                        throws java.text.ParseException
Throws:
java.text.ParseException

parseCharacter

protected Constant parseCharacter(org.w3c.dom.Element node,
                                  java.util.Map<java.lang.String,NameSpace> proxies)
                           throws java.text.ParseException
Throws:
java.text.ParseException

parseRealNumber

protected Constant parseRealNumber(org.w3c.dom.Element node,
                                   java.util.Map<java.lang.String,NameSpace> proxies)
                            throws java.text.ParseException
Throws:
java.text.ParseException

parseInteger

protected Constant parseInteger(org.w3c.dom.Element node,
                                java.util.Map<java.lang.String,NameSpace> proxies)
                         throws java.text.ParseException
Throws:
java.text.ParseException