Compile drools guided decision table into rules

点点圈 提交于 2019-12-05 01:32:50

Ok, so basically, we could very easily generate drools rules from a guided decision table. For example:

// load the data from the GDST file, for example:
String decisionTableXml = new String ( 
  Files.readAllBytes( 
    Paths.get("./someDecisionTable.gdst") ) );

// parse the table model
GuidedDecisionTable52 model = GuidedDTXMLPersistence.getInstance().unmarshal( decisionTableXml );

// compile it into drools rules
String droolsRules = GuidedDTDRLPersistence.getInstance().marshal( model );

// next, save droolsRules into a file and/or load it into drools as a normal rule

This is one simple example for guided decision tables, but the same utils probably exsist for decision trees,... From there, you can orchestrate any Drools Workbench Asset with your Drools Expert runtime. Better solutions are always welcome ;)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!