Currently there is not. Apart from functions, it should be easy enough.
Drools 2.x is a subset of drools 3.0. Each 2.x condition maps to a 3.0
eval - hence why Drools 2.x is not as efficient as 3.0, when rules are
written properly. Drools 3.0 will now only match againts JavaBeans -
that means String, Integer etc cannot be asserted as facts; which we
have always claimed is bad practice anyway.
<rule name="Hello World">
<parameter identifier="person">
<class>Person</class>
</parameter>
<java:condition>person.getName().equals("Stilton")</java:condition>
<java:consequence>
System.out.println( "Hello Stilton, did you konw you are named after a
smelly piece of cheese?" );
</java:consequence>
</rule>
So we bind the parameter and put conditions into evals:
rule "hello world"
when
person : Person // This line is equivalent to the parameter section
eval( person.getName().equals("Stilton") )
then
System.out.println( "Hello Stilton, did you konw you are named after a smelly piece of cheese?" )
end
However I must stress that the above is a very bad way to write rules in 3.0.
Instead whenver possible you should use Field Constraints:
rule "hello world"
when
Person( name == "Stilton" )
then
System.out.println( "Hello Stilton, did you konw you are named after a smelly piece of cheese?" )
end
In Drools 3.0 it is possible to bind both Facts and the Fact's fields:
person : Person( personName : name )
Please look over the intergration tests to see how Drools 3.0 is used
http://anonsvn.labs.jboss.com/trunk/labs/jbossrules/drools-compiler/src/test/java/org/drools/integrationtests/IntegrationCases.java
http://anonsvn.labs.jboss.com/trunk/labs/jbossrules/drools-compiler/src/test/resources/org/drools/integrationtests/
Functions will need some sort of parser/processor. In Drools 2.x it was
one big block for all functions. In 3.0 we need to pull out each
individual function, along with their parameters.
There is a Drools NoPrize to the person how creates the first complete,
including functions, translator for 2.x to 3.0 :)
Mark
Ronald R. DiFrango wrote:
Mark,
I may have missed it in previous posts, but is there a translation mechanism
from 2.1/2.5 style rules to the new style?
Ron
On 3/28/06, Michael Neale <[EMAIL PROTECTED]> wrote:
Info and downloads from here:
http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossRules
Much improved over beta 1, thanks for all the folks testing it, and for
the
feedback.
Michael