Class BN2Prism

java.lang.Object
  extended by BN2Prism

public class BN2Prism
extends java.lang.Object

The main class of the translator. The name of the input network file should be "BASENAME.xml".

 [Usage] java BN2Prism [-f FORMAT][-o][-t][-r][-e][-z][-n][-v][-h] BASENAME
 

Command line options:

FORMAT is either xmlbif (for XMLBIF) or xbif (for XBIF). The default is XMLBIF. XMLBIF used here is basically based on XMLBIF 0.3, but the entries in each CPT have a different order from those in XMLBIF 0.3 (actually, the order is same as that of XMLBIF 0.5). We can switch the entry order by the -t option. XBIF, on the other hand, is the format adopted in UAI-06 Evaluation Workshop. When XMLBIF is specified, a separate evidence file (in so-called XMLBIF-EVIDENCE format) "BASENAME_evid.xml" is required to take evidences into account.

After running the command, the network spacification is translated into a PRISM file named "BASENAME.psm" The evidences (if given) are translated into a separate file named "BASENAME_evid.psm". If the -e option is specified, the translator generates a couple of files each of which contains randomly generated evidences.

For example, the ALARM network is specified in "alarm.xml" in the XMLBIF format, we can get the join-tree PRISM program for the ALARM network by running:

 java BN2Prism -f xmlbif alarm
 
(we can omit "-f xmlbif" since it is the default). Please note here that we need to prepare the evidence file named "alarm_evid.xml" unless we assign the random probabilities to CPTs (with the -r option) or have no evidences. Even if alarm.xml have CPTs with the transposed form, we can force the translator to accept such CPTs by specifying the -t option:
 java BN2Prism -f xmlbif -t alarm
 
On the other hand, when the network is provided in the XBIF format, the -f option is mandatory. In this case, the evidences are buried in the network specification, so no separate evidence file is required.
 java BN2Prism -f xbif alarm
 


Field Summary
private  BNSetting setting
          Settings for the translator.
static java.lang.String USAGE
          Message on usage
static java.lang.String VERSION
          String representation of the version number
 
Constructor Summary
BN2Prism()
          The default setting will be set.
 
Method Summary
 BayesNet buildBN()
          Parse the input XMLBIF file, and store the information to the intermediate data structure.
 java.lang.String getNodeString(org.w3c.dom.Node n)
          Get the string which denotes the contents of a node.
 BNSetting getSetting()
          Returns the current setting of the translator.
static void main(java.lang.String[] args)
          Main method.
private  void parseArgs(java.lang.String[] args)
           
private  void printDocument(org.w3c.dom.Document document)
          Display the contents in a DOM tree.
private  void traverse(org.w3c.dom.Node n, int indent)
          Display the contents of a DOM tree recursively.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USAGE

public static final java.lang.String USAGE
Message on usage

See Also:
Constant Field Values

VERSION

public static final java.lang.String VERSION
String representation of the version number

See Also:
Constant Field Values

setting

private BNSetting setting
Settings for the translator.

Constructor Detail

BN2Prism

public BN2Prism()
The default setting will be set.

Method Detail

getSetting

public BNSetting getSetting()
Returns the current setting of the translator.


main

public static void main(java.lang.String[] args)
Main method.

Parameters:
args - An array of strings which contains command arguments. It is assumed that args[0] is the filename of the input file.

parseArgs

private void parseArgs(java.lang.String[] args)
                throws B2PException
Throws:
B2PException

buildBN

public BayesNet buildBN()
Parse the input XMLBIF file, and store the information to the intermediate data structure.


printDocument

private void printDocument(org.w3c.dom.Document document)
Display the contents in a DOM tree.

Parameters:
document - DOM tree to be displayed.

traverse

private void traverse(org.w3c.dom.Node n,
                      int indent)
Display the contents of a DOM tree recursively.

Parameters:
n - the node we are visiting at.
indent - the width of indentation.

getNodeString

public java.lang.String getNodeString(org.w3c.dom.Node n)
Get the string which denotes the contents of a node.

Parameters:
n - a node in DOM.
Returns:
the string which denotes the contents of the node.