No. I would use XSLT to do the main converstion, that would be a simple
task. The functions would be more difficult, you would need an ANTL
parser, drools uses antlr 3.0. But it should be possible to take the
function body, run it through antlr and get an AST that you can string
template to turn in functions. I'd start getting standard drools, sans
functions, to work first with XSLT. Then worry about functions after.
Mark
Ronald R. DiFrango wrote:
Mark,
Just curious if one were to develop such a thing are there any guidelines on
the conversion process already documetned some where?
Ron
On 3/28/06, Mark Proctor <[EMAIL PROTECTED]> wrote:
Simply a lack of time. If no user contributes the conversion utility I
will get round to it eventually.
Mark
Ronald R. DiFrango wrote:
Mark,
Thanks for the update. It is a real bummer that there is not support
for
the 2.x form in 3.0. Any reason why no backwards compatitbility?
BTW...that Drools NoPrize for a coversion utility sounds outstanding :-)
Ron
On 3/28/06, Mark Proctor <[EMAIL PROTECTED]> wrote:
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