infosapient.xml
Class KbXMLCompiler

java.lang.Object
  |
  +--infosapient.xml.KbXMLCompiler

public class KbXMLCompiler
extends java.lang.Object

Compile xml nodes into a FzyKnowledgebase.

Version:
$Revision: 1.1.1.1 $

Field Summary
private  java.lang.StringBuffer clauseText
           
private  com.ibm.xml.parsers.NonValidatingDOMParser parser
           
private  org.w3c.dom.Document rootNode
           
private  FzyKnowledgebase theKB
           
private  FzyRule theRule
           
private  boolean trace_enabled
           
private  int trace_indent
           
 
Constructor Summary
KbXMLCompiler()
          KbXMLCompilerconstructor comment.
KbXMLCompiler(com.ibm.xml.parsers.NonValidatingDOMParser p)
           
KbXMLCompiler(java.lang.String uri)
          Construct a Knowledgebase based on xml tagged text from a URL.
 
Method Summary
private  void appendClauseText(java.lang.String newClauseText)
          Append the clause text Creation date: (1/4/00 2:53:47 PM)
private  void appendClauseText(java.lang.StringBuffer newClauseText)
          Append the clause text Creation date: (1/4/00 2:53:47 PM)
 FzyKnowledgebase compileKbXML()
          Insert the method's description here.
 FzyKnowledgebase compileXML(org.w3c.dom.Node rootNode)
          Compile the xml node into a FzyKnowledgebase Creation date: (2/8/00 1:21:48 PM)
private  void debugStatement(java.lang.String s)
           
private  void error(org.xml.sax.SAXParseException ex)
          Error.
private  void fatalError(org.xml.sax.SAXParseException ex)
          Fatal error.
 FzyKnowledgebase getKB()
          Return the current knowledgebase.
private  java.lang.String getLocationString(org.xml.sax.SAXParseException ex)
          Returns a string of the location.
private  com.ibm.xml.parsers.NonValidatingDOMParser getParser()
           
 org.w3c.dom.Document getRootNode()
          Return the root node (Document).
(package private)  FzyRule getRule()
          Return current rule
static void main(java.lang.String[] argv)
          Used in standalone mode Creation date: (12/29/99 3:30:32 PM)
(package private)  void setKB(FzyKnowledgebase newKB)
          Set the knowledgebase for this parse session.
(package private)  void setParser(com.ibm.xml.parsers.NonValidatingDOMParser p)
           
(package private)  void setRootNode(org.w3c.dom.Document newRootNode)
          Insert the method's description here.
(package private)  void setRule(FzyRule newRule)
           
private  void trace_call(java.lang.String s)
           
private  void trace_return(java.lang.String s)
           
(package private)  FzyAttribute visitAttributeNode(org.w3c.dom.Node node)
          Visit "<attribute>" node and create a FzyAttribute.
(package private)  void visitAttributesNode(org.w3c.dom.Node node)
          Collect all the attributes within this knowledgebase.
(package private)  void visitAuthorNode(org.w3c.dom.Node node)
          Visit the author node, pick up first and last name.
(package private)  FzyKnowledgebase visitKbNode(org.w3c.dom.Node node)
          Return a Knowledgebase compiled from XML tagged data.
(package private)  FzyRule visitRuleNode(org.w3c.dom.Node node)
          Visit a rule node and return a compiled rule.
(package private)  void visitRulesNode(org.w3c.dom.Node node)
          Visit the rules node, compile all rules belonging to this node.
(package private)  FzySet visitSetNode(org.w3c.dom.Node node, FzyAttribute attrib)
          Visit the set node and return the FzySet Creation date: (12/29/99 5:25:41 PM)
private  void warning(org.xml.sax.SAXParseException ex)
          Warning.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

theKB

private FzyKnowledgebase theKB

clauseText

private java.lang.StringBuffer clauseText

parser

private com.ibm.xml.parsers.NonValidatingDOMParser parser

rootNode

private org.w3c.dom.Document rootNode

theRule

private FzyRule theRule

trace_enabled

private boolean trace_enabled

trace_indent

private int trace_indent
Constructor Detail

KbXMLCompiler

public KbXMLCompiler()
KbXMLCompilerconstructor comment.

KbXMLCompiler

public KbXMLCompiler(com.ibm.xml.parsers.NonValidatingDOMParser p)

KbXMLCompiler

public KbXMLCompiler(java.lang.String uri)
Construct a Knowledgebase based on xml tagged text from a URL.
Parameters:
String - - uri - the knowledgebase xml file.
Method Detail

appendClauseText

private final void appendClauseText(java.lang.String newClauseText)
Append the clause text Creation date: (1/4/00 2:53:47 PM)
Parameters:
newClauseText - java.lang.StringBuffer

appendClauseText

private final void appendClauseText(java.lang.StringBuffer newClauseText)
Append the clause text Creation date: (1/4/00 2:53:47 PM)
Parameters:
newClauseText - java.lang.StringBuffer

compileKbXML

public FzyKnowledgebase compileKbXML()
                              throws NodeVisitorException
Insert the method's description here. Creation date: (05/03/01 12:17:03 PM)
Parameters:
fileName - java.lang.String
Returns:
infosapient.system.FzyKnowledgebase
Throws:
NodeVisitorException - The exception description.

compileXML

public FzyKnowledgebase compileXML(org.w3c.dom.Node rootNode)
                            throws java.lang.IllegalArgumentException,
                                   NodeVisitorException
Compile the xml node into a FzyKnowledgebase Creation date: (2/8/00 1:21:48 PM)
Parameters:
rootNode - org.w3c.dom.Node - The topmost (root) node of the knowledgebase.
Returns:
infosapient.system.FzyKnowledgebase
Throws:
java.lang.IllegalArgumentException - thrown if rootnode is null
infosapient.xmlvisitor.NodeVisitorException - thrown if compliation errors encountered.

debugStatement

private void debugStatement(java.lang.String s)

error

private void error(org.xml.sax.SAXParseException ex)
Error.

fatalError

private void fatalError(org.xml.sax.SAXParseException ex)
                 throws org.xml.sax.SAXException
Fatal error.

getKB

public final FzyKnowledgebase getKB()
Return the current knowledgebase.
Returns:
infosapient.system.FzyKnowledgebase

getLocationString

private java.lang.String getLocationString(org.xml.sax.SAXParseException ex)
Returns a string of the location.

getParser

private final com.ibm.xml.parsers.NonValidatingDOMParser getParser()
Returns:
com.ibm.xml.parsers.NonvalidatingDOMParser the current parser for this knowledgebase.

getRootNode

public final org.w3c.dom.Document getRootNode()
Return the root node (Document). Creation date: (1/25/00 9:05:05 PM)
Returns:
org.w3c.dom.Document

getRule

final FzyRule getRule()
Return current rule
Returns:
infosapient.system.FzyRule

main

public static void main(java.lang.String[] argv)
Used in standalone mode Creation date: (12/29/99 3:30:32 PM)
Parameters:
argv - java.lang.String[]

setKB

final void setKB(FzyKnowledgebase newKB)
Set the knowledgebase for this parse session.
Parameters:
newKB - infosapient.system.FzyKnowledgebase

setParser

final void setParser(com.ibm.xml.parsers.NonValidatingDOMParser p)

setRootNode

final void setRootNode(org.w3c.dom.Document newRootNode)
Insert the method's description here. Creation date: (1/25/00 9:05:05 PM)
Parameters:
newRootNode - org.w3c.dom.Document

setRule

final void setRule(FzyRule newRule)
Parameters:
newRule - infosapient.system.FzyRule

trace_call

private final void trace_call(java.lang.String s)

trace_return

private final void trace_return(java.lang.String s)

visitAttributeNode

final FzyAttribute visitAttributeNode(org.w3c.dom.Node node)
                               throws NodeVisitorException
Visit "<attribute>" node and create a FzyAttribute. Creation date: (12/29/99 5:25:41 PM)
Parameters:
n - org.w3c.dom.Node
Returns:
infosapient.system.FzySystemComponent

visitAttributesNode

final void visitAttributesNode(org.w3c.dom.Node node)
                        throws NodeVisitorException
Collect all the attributes within this knowledgebase. Creation date: (12/29/99 5:25:41 PM)
Parameters:
n - org.w3c.dom.Node

visitAuthorNode

final void visitAuthorNode(org.w3c.dom.Node node)
                    throws NodeVisitorException
Visit the author node, pick up first and last name.
Parameters:
org.w3c.dom.Node -  

visitKbNode

final FzyKnowledgebase visitKbNode(org.w3c.dom.Node node)
                            throws NodeVisitorException
Return a Knowledgebase compiled from XML tagged data.
Parameters:
org.w3c.dom.Node - - starting node to be parsed
Returns:
infosapient.system.FzyKnowledgebase - contains parsed/completed FzyKnowledgebase Creation date: (12/29/99 5:03:20 PM)

visitRuleNode

final FzyRule visitRuleNode(org.w3c.dom.Node node)
                     throws NodeVisitorException
Visit a rule node and return a compiled rule. Creation date: (12/29/99 5:25:41 PM)
Parameters:
n - org.w3c.dom.Node
Returns:
infosapient.system.FzySystemComponent (FzyRule)

visitRulesNode

final void visitRulesNode(org.w3c.dom.Node node)
                   throws NodeVisitorException
Visit the rules node, compile all rules belonging to this node.
Parameters:
n - org.w3c.dom.Node

visitSetNode

final FzySet visitSetNode(org.w3c.dom.Node node,
                          FzyAttribute attrib)
                   throws NodeVisitorException
Visit the set node and return the FzySet Creation date: (12/29/99 5:25:41 PM)
Parameters:
n - org.w3c.dom.Node
Returns:
infosapient.system.FzySet

warning

private final void warning(org.xml.sax.SAXParseException ex)
Warning.

License to use this program is provided under the TERMS OF THE COMMON PUBLIC LICENSE 0.5. ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.

Copyright (c) 2001, Workplace Performance Tools, All Rights Reserved