[rules-users] Re: DSL: Problem of having 2 DSL statements that endsdiffer

Matt Geis mgeis at yahoo.com
Tue Dec 16 13:09:28 EST 2008



>>Actually Drools processes DSL a similar way it process rules, doesn't it ?

Not quite.  DSL matching is a brute-force process.  The engine will iterate across all appropriate entries in the DSL mapping file for each
line of custom rule "code."   Changes to the state of the code line do not cause a reset/restart of the matching.  At the end, you should have a line of drl code.

Rule execution and matching is different.  For one, the consequence of a matched rule can modify and then update a fact, and as a result cause all rules to be tested again against the modified state of working memory.  In theory, you could do this infinitely.  Secondly, if you look at a RETE tree, you'll see that not every node is reached (it's not an exhaustive graph traversal).  Indexing of the data before firing the rules allows the algorithm to eliminate entire branches of tests during evaluation.

>>I couldn't find any documentation about Drools 5 (I downloaded it but it looks like it it the same as 4.0.7). Where could I find it ?

The info on the latest docs are at...
http://blog.athico.com/2008/11/drools-live-documentation.html

DSL's haven't changed much and Drools 5 is backward compatible.  The only changes are that we now use a lexer and parser instead of doing regex pattern matching, and you can be uber-restrictive in your matching by using regular expressions for your bound variables.

Example:

There is a person with a social security number of {ssn:\d{3}-\d{2}-\d{4}} = Person(socialSecurityNumber=='{ssn}')

This feature, while of not so much value in longer sentences, is powerful in creating a chain of transforming mapping entries, and allows you to build the kind of rule transformation engine I was referring to in my earlier emails.

As Drools 5 is not yet final, and efforts are more on bug fixes than on documentation at the moment, my advice (for this feature and others) is to go back through the archives of the drools blog (blog.athico.com) and this listserv.

Matt


      



More information about the rules-users mailing list