10

I am wondering how I could use a guided decision table from the Drools Workbench inside a Java application using the drools runtime. The idea is that a user would work defining rules, processes and some decision tables in the workbench, which will be picked up by the drools runtime.

Still, for some reason, I can't figure out how to execute this in drools, since it stored the table as a gdst file and it does not seem to compile to drools.

With drools, is there a way to: - execute the gdst file as I would with an excel decision table? - or compile a gdst file in rules?

I've been looking for a solution, but can't find a concrete example... :/

4

1 回答 1

7

好的,所以基本上,我们可以很容易地从引导决策表中生成流口水规则。例如:

// 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

这是指导决策表的一个简单示例,但决策树可能存在相同的实用程序,...从那里,您可以使用 Drools Expert 运行时编排任何 Drools Workbench 资产。更好的解决方案总是受欢迎的;)

于 2015-05-29T15:37:26.987 回答