How to convert Drools decision table (excel spread sheet) to a (.drl) file in Drools?

Let us try to create convert Drools decision table (excel spread sheet) to a (.drl) file in Drools.
The SpreadsheetCompiler class is used to convert the input XLS and CSV file to a (.drl) tập tin. The required package is “org.drools.decisiontable.SpreadsheetCompiler”.You need to use the compile () method of this class to do the conversion. Following example shows the processs.



Example program:-

nhập khẩu java.io.FileInputStream;
nhập khẩu java.io.FileNotFoundException;
nhập khẩu java.io.InputStream;
nhập khẩu org.drools.decisiontable.InputType;
nhập khẩu org.drools.decisiontable.SpreadsheetCompiler;

public class ExcelToDrlDemo {
public static void main(String args[]) {
// create an input stream
InputStream is = null;
thử {
// assign the excel to the input stream
// mention the local directory path where your excel is kept
// you can take any decision table (excel sheet) for testing
= new FileInputStream(“D:/Workspace/TestProj/src/ExamplePolicyPricing.xls”);
} bắt (FileNotFoundException e) {
e.printStackTrace();
}
// create compiler class instance
SpreadsheetCompiler sc = new SpreadsheetCompiler();
// compile the excel to generate the (.drl) tập tin
String drl=sc.compile(là, InputType.XLS);
// check the generated (.drl) tập tin
System.out.println(“Generate DRL file is –: “);
System.out.println(drl);
}
}


============================================= ============================================== Mua sách Techalpine tốt nhất trên Amazon,en,Thợ điện CT Hạt dẻ,en
============================================== ---------------------------------------------------------------- electrician ct chestnutelectric
error

Thưởng thức blog này,,en,làm ơn mở rộng vốn từ,,en,techalpine.com/apache-mahout-and-machine-learning,,en? Please spread the word :)

Follow by Email
LinkedIn
LinkedIn
Share