开发者

How to retrieve fact objects from decision tables in Drools 4.x

Our team is using Drools ruleflows for evaluations. Now we are planning to migrate to decision tables instead.

In the Drools ruleflow version, we used to have DRL files that have query component to extract objects created within the context of DRL files from working memory.

I'm stuck on doing the same in Decision Table? We are using StatefulSession for firing rules. Also, these facts are inserted in the RHS of the rules; we do not have have the FactHandles at the time of firing them.

The code used to bootstrap Drools rule engine is as follows:

RuleBase ruleBase = RuleBaseFactory.newRuleBase();
StatefulSessi开发者_JS百科on session = ruleBase.newStatefulSession(); 
MyFacts nmrs = new MyFacts();
session.insert(nmrs);
session.fireAllRules();

The drools file used to retrieve query looked as follows:

query "resultQuery"
    response :  Outcome()
end

Thanks


There is no direct support for queries in XLS decision tables at this time. However, decision tables compile down to drl itself - so it is possible to programmatically add queries after the fact to the drl (perhaps in a separate DRL file).

You can also get a collection of all fact handles and (ugly) iterate through looking for instanceof Outcome, etc...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜