Menu

How to use SemanticDecisionTable from an xml file?

get all columns from an XML file and pass the parameters into a vector of String array, or a String matrix [ ] [ ]

      /**
 * Gets the all columns test.
 * @author: Yan Tang, VUB, 2009
 * @return the all columns test
 */

public static void getAllColumnsTest() {
    openSDTfile file = new openSDTfile();
    String filePathName = "C:\\SDT\\DT in XML files\\Nokeos_ERM_exampleRearrange00.xml";
    SDT sdt = file.openSDTXMLFile(filePathName);
    SemanticDecisionTable table = new SemanticDecisionTable(sdt);
    Vector<String[]> columns = table.getAllColumns();
    for (int i = 0; i < columns.size(); i++) {
        String[] array = columns.get(i);
        StringArray sa = new StringArray(array);
        sa.printArrayToConsole();
    }
    System.out.println(table.getProcessInfo());

}

/**
 * Gets the all decision rules test.
 * 
 * @return the all decision rules test
 */
public static void getAllDecisionRulesTest() {
    openSDTfile file = new openSDTfile();
    String filePathName = "C:\\SDT\\DT in XML files\\Nokeos_ERM_08_inconsist_with_meta_SDT.xml";
    SDT sdt = file.openSDTXMLFile(filePathName);
    SemanticDecisionTable table = new SemanticDecisionTable(sdt);
    Vector<DecisionRule> rules = table.getAllDecisionRules();
    for (int i = 0; i < rules.size(); i++)
        rules.get(i).printToConsole();
}

/**
 * Builds the matrix test.
 */
public static void buildMatrixTest() {
    openSDTfile file = new openSDTfile();
    String filePathName = "C:\\SDT\\DT in XML files\\Nokeos_ERM_08_inconsist_with_meta_SDT.xml";
    SDT sdt = file.openSDTXMLFile(filePathName);
    SemanticDecisionTable table = new SemanticDecisionTable(sdt);
    String[][] t = table.buildMatrix();
    for (int i = 0; i < t.length; i++) {
        System.out.print("Row " + i + " - ");
        for (int j = 0; j < t[i].length; j++)
            System.out.print(t[i][j] + ",");
        System.out.println();
    }
}
Posted by Yan Tang Demey 2012-10-18

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.