edu.ksu.cis.bnj.bbn.converter.spo
Class SPOParser

java.lang.Object
  extended byedu.ksu.cis.bnj.bbn.converter.spo.SPOParser
All Implemented Interfaces:
Converter

public class SPOParser
extends java.lang.Object
implements Converter

University of Kentucky's SPO Parser
Description:
This class is used to parse XML data of SPO format from University of Kentucky This is a DOM implementation

This format is courtesy of Dr. Alexander Dekhtyar, Zhao Wenzhong, and Judy Goldsmith of University of Kentucky

Current version: We assume that ALL probability distributions and ALL values are explicitly mentioned. The only exception is that we may omit the nodes with no parents. In this case, we assume uniform distribution across the values assuming that ALL values are mentioned.

Version:
0.1.0
Author:
Roby Joehanes

Field Summary
protected  java.util.Hashtable cptCache
           
protected  BBNGraph graph
           
protected static java.lang.String ln
           
protected  java.util.Hashtable nodeCache
           
protected  TableSet parentsCache
           
protected  TableSet parentValuesCache
           
protected static java.lang.String SPODTD
           
protected  TableSet valueCache
           
 
Constructor Summary
SPOParser()
           
 
Method Summary
protected  BBNNode createNode(java.lang.String name)
          Create a node with the specified name if the node hasn't been created before.
protected  java.lang.String getElementValue(org.w3c.dom.Node parent)
           
 void initialize()
           
 BBNGraph load(java.io.InputStream stream)
           
static void main(java.lang.String[] args)
          Driver for testing this parser
protected  java.lang.String processNode(BBNNode node, java.util.Hashtable parentValues, int counter)
           
protected  void processNode(BBNNode node, java.util.LinkedList parents, java.util.Hashtable curParentValues, java.lang.StringBuffer buf)
           
protected  java.lang.String processNode(BBNNode node, java.util.List parents)
           
 void save(java.io.OutputStream stream, BBNGraph graph)
          This routine is supposed to save the BBN Graph into SPO format.
protected  java.util.List visitConditional(org.w3c.dom.Node parent, java.util.Hashtable condTable)
           
protected  void visitDocument(org.w3c.dom.Node parent)
           
protected  void visitDynamicPropertyXML(org.w3c.dom.Node parent, java.util.Hashtable prop, java.lang.String prefix)
           
protected  void visitElem(org.w3c.dom.Node parent, java.util.Hashtable elemTable)
           
protected  void visitRows(org.w3c.dom.Node parent, java.lang.String var, java.util.Hashtable probTable)
           
protected  void visitSPO(org.w3c.dom.Node parent)
           
protected  void visitTable(org.w3c.dom.Node parent, java.util.List parentNodes, java.util.Hashtable parentTable)
           
protected  java.util.List visitVariables(org.w3c.dom.Node parent)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

graph

protected BBNGraph graph

nodeCache

protected java.util.Hashtable nodeCache

valueCache

protected TableSet valueCache

parentsCache

protected TableSet parentsCache

parentValuesCache

protected TableSet parentValuesCache

cptCache

protected java.util.Hashtable cptCache

ln

protected static java.lang.String ln

SPODTD

protected static java.lang.String SPODTD
Constructor Detail

SPOParser

public SPOParser()
Method Detail

initialize

public void initialize()
Specified by:
initialize in interface Converter
See Also:
Converter.initialize()

save

public void save(java.io.OutputStream stream,
                 BBNGraph graph)
This routine is supposed to save the BBN Graph into SPO format.

Specified by:
save in interface Converter
See Also:
edu.ksu.cis.bnj.bbn.converter.Converter#save(java.io.Writer, edu.ksu.cis.bnj.bbn.BBNGraph)

processNode

protected java.lang.String processNode(BBNNode node,
                                       java.util.Hashtable parentValues,
                                       int counter)

processNode

protected java.lang.String processNode(BBNNode node,
                                       java.util.List parents)

processNode

protected void processNode(BBNNode node,
                           java.util.LinkedList parents,
                           java.util.Hashtable curParentValues,
                           java.lang.StringBuffer buf)

load

public BBNGraph load(java.io.InputStream stream)
Specified by:
load in interface Converter
See Also:
edu.ksu.cis.bnj.bbn.converter.Converter#load(java.io.Reader)

visitDocument

protected void visitDocument(org.w3c.dom.Node parent)

visitSPO

protected void visitSPO(org.w3c.dom.Node parent)

visitTable

protected void visitTable(org.w3c.dom.Node parent,
                          java.util.List parentNodes,
                          java.util.Hashtable parentTable)

visitConditional

protected java.util.List visitConditional(org.w3c.dom.Node parent,
                                          java.util.Hashtable condTable)

visitElem

protected void visitElem(org.w3c.dom.Node parent,
                         java.util.Hashtable elemTable)

visitVariables

protected java.util.List visitVariables(org.w3c.dom.Node parent)

visitRows

protected void visitRows(org.w3c.dom.Node parent,
                         java.lang.String var,
                         java.util.Hashtable probTable)

createNode

protected BBNNode createNode(java.lang.String name)
Create a node with the specified name if the node hasn't been created before.

Parameters:
name -

getElementValue

protected java.lang.String getElementValue(org.w3c.dom.Node parent)

visitDynamicPropertyXML

protected void visitDynamicPropertyXML(org.w3c.dom.Node parent,
                                       java.util.Hashtable prop,
                                       java.lang.String prefix)

main

public static void main(java.lang.String[] args)
Driver for testing this parser

Parameters:
args -