Decision trees and rule engines (Drools)

不羁的心 提交于 2019-12-03 06:24:49

Drools expert is definitely the way to go.

If you want to avoid repeating yourself for the higher nodes, then the trick is to use insertLogical (or just insert if you're in a stateless session) and to understand that rules can trigger rules (It's not your father's SQL query). For example:

// we just insert Customer objects in the WM

rule "evaluateRetired"
when
    $c : Customer(age > 65)
then
    insertLogical(new Retiree($c));
end

rule "evaluteRetireeIsFemale"
when
    $r : Retiree(customer.gender == Gender.FEMALE, $c : customer)
then
    ...
end

If the decision diagram frequently changes (and you want non-programmers to edit it), take a look at the documentation on decision tables (and DSL). In that case you'll probably repeat the entire path for each rule, but that's actually ok in most cases.

I had a similiar problem and used Neo4J node database as a simple and very flexible rules engine. You can use is it with a REST service interface so it is independent from the main application. You can also have a separate application to configure the rules (even by end users).

You can try the iLog framework cum rules engine.

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