Since last year, I was conducting a bit of research about rule engines, specially in Java:
http://delicious.com/ajlopez/ruleengine
I reviewed JBoss Drools Expert (see http://delicious.com/ajlopez/drools). Past December, I assisted to Buenos Aires JBoss Meetup (see Spanish post)
In the old eighties, I met Rete Algorithm (see The Rete Matching Algorithm, Dr.Dobb’s). After all that, I decide to implement my own rule engine, in C#. You can check my progress at:
https://github.com/ajlopez/AjRools
This is the current solution:
As usual, it was coded using TDD.
I have facts, that are asserted, like Temperature = 38. And rules, that based on the asserted facts, produce other asserted facts (I plan to add actions, too, beyond fact assertions). A rule example:
# Rules example rules # Rule for Child Fever rule when Temperature > 38 Age <= 12 then HasFever is true end # Rule for Adult Fever rule when Temperature > 37 Age > 12 then HasFever is true end endI have ideas to extend the rule engine to support objects with properties, not only variables:
rule when p is_a Patient p.Temperature is 39 then p.HasFever is true endbut this feature is still in progress. I didn’t adopt the Rete algorithm, yet, or something similar. I want to have a running implementation, with tests. Then, changing internal algorithm is like an exercise on refactoring.
Pending work: more object+properties support, session (client use of the internal implementation), etc.
Keep tuned!
Angel “Java” Lopez
http://www.ajlopez.com