Hi,
As you suggested I tried to upgrade to Drools 5.0.0.M4 (the latest on
Maven repo) with mvel 2.0.5. No problem with java dialect. But it
doesn't work with mvel dialect. It looks like a problem with functions
: for any function I add to the package, I have the following stack
trace.
java.lang.NullPointerException
at org.drools.rule.builder.dialect.mvel.MVELDialect.compile(MVELDialect.java:516)
at org.drools.rule.builder.dialect.mvel.MVELDialect.addFunction(MVELDialect.java:338)
at org.drools.compiler.PackageBuilder.addFunction(PackageBuilder.java:1089)
at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:603)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:284)
at t4.test.drools.TestRuleBase.executeRule(TestRuleBase.java:27)
at t4.test.drools.Test1.testDebug(Test1.java:57)
I donwloaded 5.0.0.M4 sources and for what I understood, there is a
problem when retrieving functions for the package.
Any idea ?
Regards,
Olivier
2008/12/16 Matt Geis <mgeis(a)yahoo.com>:
>>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
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Seules 2 choses sont infinies : l'univers et la bêtise humaine ; et
encore pour l'univers, je ne suis pas sûr … (Einstein)