edu.ucla.belief.io.xmlbif
Class XmlbifParser

Object
  extended by DefaultHandler
      extended by AbstractSaxHandler
          extended by XmlbifParser
All Implemented Interfaces:
RunReadBIF.MonitorableReusableParser, ContentHandler, DTDHandler, EntityResolver, ErrorHandler
Direct Known Subclasses:
UAI06Parser

public class XmlbifParser
extends AbstractSaxHandler
implements RunReadBIF.MonitorableReusableParser

xml bif format described
xml schema validation primer
perl script to convert DTD to schema
updated 20060531 for version 0.3a proposed by Jeff Bilmes 20060529

Since:
20060523
Author:
keith cascio

Nested Class Summary
static class XmlbifParser.BifNode
           
static class XmlbifParser.Definition
           
static class XmlbifParser.Variable
           
static class XmlbifParser.VariableType
           
 
Field Summary
static String[] ARRAY_SAX_AVOIDABLE_PROPERTIES
           
static String[] ARRAY_TAGS_POTENTIAL
           
static String[] ARRAY_VALID_ROOT_ELEMENT
           
static String[] ARRAY_VERSIONS_SUPPORTED
           
static int INT_SIZE_ACCUMULATOR_INITIAL
           
static Matcher MATCHER_COMMENT
           
static Pattern PATTERN_COMMENT
           
static Pattern PATTERN_DATA_DELIMITER
           
static Pattern PATTERN_POSITION
           
static String REGEX_COMMENT
           
static String REGEX_DATA_DELIMITER
           
static String REGEX_POSITION
           
static String STR_ATTR_TYPE_L
           
static String STR_ATTR_TYPE_U
           
static String STR_ATTR_VERSION_L
           
static String STR_ATTR_VERSION_U
           
static String STR_TAG_ANONYMOUS_VALUES
           
static String STR_TAG_DEFINITION_0_3
           
static String STR_TAG_FOR
           
static String STR_TAG_GIVEN
           
static String STR_TAG_NAME
           
static String STR_TAG_NETWORK
           
static String STR_TAG_OBSERVATION
           
static String STR_TAG_OUTCOME
           
static String STR_TAG_PROBABILITY_0_3A
           
static String STR_TAG_PROPERTY
           
static String STR_TAG_ROOT_0_3
           
static String STR_TAG_ROOT_0_3A
           
static String STR_TAG_TABLE
           
static String STR_TAG_VARIABLE
           
static String STR_VERSION_0_3
           
static String STR_VERSION_0_3A
           
 
Fields inherited from class AbstractSaxHandler
theCharactersNoop, theRootCheckHandler
 
Constructor Summary
XmlbifParser()
           
 
Method Summary
 BeliefNetwork beliefNetwork(File input, NodeLinearTask task)
           
 BeliefNetwork beliefNetwork(InputStream input, NodeLinearTask task)
           
static StringBuilder blankOutComments(StringBuilder buff)
           
 void cleanup()
          interface RunReadBIF.MonitorableReusableParser
 void clear()
           
 void configureFactory(SAXParserFactory factory)
          override this method if, e.g., you need to install an xml validation schema
static List<String> createAnonymousOutcomes(String id, int numAnonymousValues)
           
static Schema getSchema()
           
 ElementHandler getValidRootHandler(String qName, Attributes attributes)
           
static String getValue(Attributes attributes, String[] alternates)
           
static String getValueIgnoreCase(Attributes attributes, String name)
           
static Integer intValueOf(StringBuilder accumulator)
           
static boolean isOneOf(String qname, String[] alternatives)
           
 boolean isValidating()
           
 boolean isValidationErrorFatal()
          override this method to make syntax errors non-fatal
 boolean isValidRootElementName(String qname)
           
static void main(String[] args)
          test/debug
static void mainImpl(String pathFileNetwork, XmlbifParser parserLP, XmlbifParser parserHP)
           
 void setHighPerformance(boolean flag)
          interface RunReadBIF.MonitorableReusableParser
static String translateToIdentifier(String name)
           
 boolean versionSupported(String version)
           
 
Methods inherited from class AbstractSaxHandler
characters, cleanupAbstractSaxHandler, endDocument, endElement, error, getCharactersHandler, getElementHandler, getFactory, getSAXParser, getSyntaxErrors, parse, parse, parse, printAll, setCharactersHandler, setElementHandler, startDocument, startElement
 
Methods inherited from class DefaultHandler
endPrefixMapping, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface RunReadBIF.MonitorableReusableParser
getSyntaxErrors
 

Field Detail

STR_TAG_ROOT_0_3

public static final String STR_TAG_ROOT_0_3
See Also:
Constant Field Values

STR_ATTR_VERSION_U

public static final String STR_ATTR_VERSION_U
See Also:
Constant Field Values

STR_ATTR_VERSION_L

public static final String STR_ATTR_VERSION_L
See Also:
Constant Field Values

STR_TAG_NETWORK

public static final String STR_TAG_NETWORK
See Also:
Constant Field Values

STR_TAG_VARIABLE

public static final String STR_TAG_VARIABLE
See Also:
Constant Field Values

STR_ATTR_TYPE_U

public static final String STR_ATTR_TYPE_U
See Also:
Constant Field Values

STR_ATTR_TYPE_L

public static final String STR_ATTR_TYPE_L
See Also:
Constant Field Values

STR_TAG_NAME

public static final String STR_TAG_NAME
See Also:
Constant Field Values

STR_TAG_OUTCOME

public static final String STR_TAG_OUTCOME
See Also:
Constant Field Values

STR_TAG_PROPERTY

public static final String STR_TAG_PROPERTY
See Also:
Constant Field Values

STR_TAG_DEFINITION_0_3

public static final String STR_TAG_DEFINITION_0_3
See Also:
Constant Field Values

STR_TAG_FOR

public static final String STR_TAG_FOR
See Also:
Constant Field Values

STR_TAG_GIVEN

public static final String STR_TAG_GIVEN
See Also:
Constant Field Values

STR_TAG_TABLE

public static final String STR_TAG_TABLE
See Also:
Constant Field Values

STR_VERSION_0_3

public static final String STR_VERSION_0_3
See Also:
Constant Field Values

STR_VERSION_0_3A

public static final String STR_VERSION_0_3A
See Also:
Constant Field Values

STR_TAG_ROOT_0_3A

public static final String STR_TAG_ROOT_0_3A
See Also:
Constant Field Values

STR_TAG_ANONYMOUS_VALUES

public static final String STR_TAG_ANONYMOUS_VALUES
See Also:
Constant Field Values

STR_TAG_OBSERVATION

public static final String STR_TAG_OBSERVATION
See Also:
Constant Field Values

STR_TAG_PROBABILITY_0_3A

public static final String STR_TAG_PROBABILITY_0_3A
See Also:
Constant Field Values

ARRAY_VALID_ROOT_ELEMENT

public static final String[] ARRAY_VALID_ROOT_ELEMENT

ARRAY_VERSIONS_SUPPORTED

public static final String[] ARRAY_VERSIONS_SUPPORTED

ARRAY_TAGS_POTENTIAL

public static final String[] ARRAY_TAGS_POTENTIAL

ARRAY_SAX_AVOIDABLE_PROPERTIES

public static final String[] ARRAY_SAX_AVOIDABLE_PROPERTIES

INT_SIZE_ACCUMULATOR_INITIAL

public static final int INT_SIZE_ACCUMULATOR_INITIAL
See Also:
Constant Field Values

REGEX_POSITION

public static final String REGEX_POSITION
See Also:
Constant Field Values

PATTERN_POSITION

public static final Pattern PATTERN_POSITION

REGEX_DATA_DELIMITER

public static final String REGEX_DATA_DELIMITER
See Also:
Constant Field Values

PATTERN_DATA_DELIMITER

public static final Pattern PATTERN_DATA_DELIMITER

REGEX_COMMENT

public static final String REGEX_COMMENT
See Also:
Constant Field Values

PATTERN_COMMENT

public static final Pattern PATTERN_COMMENT

MATCHER_COMMENT

public static final Matcher MATCHER_COMMENT
Constructor Detail

XmlbifParser

public XmlbifParser()
Method Detail

versionSupported

public boolean versionSupported(String version)

isValidating

public boolean isValidating()
Specified by:
isValidating in class AbstractSaxHandler

isValidationErrorFatal

public boolean isValidationErrorFatal()
Description copied from class: AbstractSaxHandler
override this method to make syntax errors non-fatal

Overrides:
isValidationErrorFatal in class AbstractSaxHandler

isValidRootElementName

public boolean isValidRootElementName(String qname)
Specified by:
isValidRootElementName in class AbstractSaxHandler

isOneOf

public static boolean isOneOf(String qname,
                              String[] alternatives)
Since:
20060614

getValue

public static String getValue(Attributes attributes,
                              String[] alternates)
Since:
20060530

getValueIgnoreCase

public static String getValueIgnoreCase(Attributes attributes,
                                        String name)
Since:
20060530

getValidRootHandler

public ElementHandler getValidRootHandler(String qName,
                                          Attributes attributes)
Specified by:
getValidRootHandler in class AbstractSaxHandler

getSchema

public static Schema getSchema()

setHighPerformance

public void setHighPerformance(boolean flag)
interface RunReadBIF.MonitorableReusableParser

Specified by:
setHighPerformance in interface RunReadBIF.MonitorableReusableParser
Since:
20060622

configureFactory

public void configureFactory(SAXParserFactory factory)
Description copied from class: AbstractSaxHandler
override this method if, e.g., you need to install an xml validation schema

Overrides:
configureFactory in class AbstractSaxHandler

intValueOf

public static Integer intValueOf(StringBuilder accumulator)

createAnonymousOutcomes

public static List<String> createAnonymousOutcomes(String id,
                                                   int numAnonymousValues)

blankOutComments

public static StringBuilder blankOutComments(StringBuilder buff)
Since:
20060531

clear

public void clear()

cleanup

public void cleanup()
interface RunReadBIF.MonitorableReusableParser

Specified by:
cleanup in interface RunReadBIF.MonitorableReusableParser

beliefNetwork

public BeliefNetwork beliefNetwork(File input,
                                   NodeLinearTask task)
                            throws Exception
Specified by:
beliefNetwork in interface RunReadBIF.MonitorableReusableParser
Throws:
Exception

beliefNetwork

public BeliefNetwork beliefNetwork(InputStream input,
                                   NodeLinearTask task)
                            throws Exception
Specified by:
beliefNetwork in interface RunReadBIF.MonitorableReusableParser
Throws:
Exception

translateToIdentifier

public static String translateToIdentifier(String name)
Since:
20060615

main

public static void main(String[] args)
test/debug


mainImpl

public static void mainImpl(String pathFileNetwork,
                            XmlbifParser parserLP,
                            XmlbifParser parserHP)
Since:
20060622


Copyright 2010 UCLA Automated Reasoning Group