[rules-users] Bugs in rule templates?

Wolfgang Laun wolfgang.laun at gmail.com
Thu Nov 3 11:27:28 EDT 2011


It seems that some template/CSV parser expects the parameters in the same
order as the column headers of the CSV. Also, there is no explicit
termination of the parameter list, and therefore the parser appears to rely
on "package" being the first statement of the header text to precede all
expansions.

At least, it should be documented.

-W


2011/11/3 Bruno Freudensprung <bruno.freudensprung at temis.com>

> **
>
> Hi Wolfgang,
>
> Sure. Please find attached a small Maven/Eclipse project containing 3 DRT
> and 3 unit test cases (Java in src/test/java/org/drools/bug, rules in
> src/test/resource/org/drools/bug) :
>
>    - Test1OK(.java/.drt/.csv) is the one working well
>     - Test1KO(.java/.drt/.csv) is the one illustrating the 1) behavior
>    - Test1KO2(.java/.drt/.csv) is the one illustrating the 2) behavior
>
> Regards,
>
> Bruno.
>
> Le 03/11/2011 14:07, Wolfgang Laun a écrit :
>
> Before you work on a JIRA could you please provide an (abbreviated)
> example of a template that causes both errors?
> -W
>
> 2011/11/3 Bruno Freudensprung <bruno.freudensprung at temis.com>
>
>>  Hi all,
>>
>> I am writing rules using Drools Templates and I noticed strange problems
>> (ocurring when I slightly modify a DRT that works well):
>>
>>    1. the template instanciation depends on the declarations order of
>>    the parameters in the template header
>>    2. if the rule template does not contain a package declaration
>>    (default package) the instanciation of the template fails
>>
>> I am working with Drools 5.1.1 but those problems occur in 5.2.0.Final
>> and in 5.3.0.Final as well.
>> Do you think it is worth posting a JIRA?
>>
>> Anyway let me tell you that Drools Templates are great! Our users like
>> that feature a lot! They start writing a rule in DRL format and, once it
>> works, they transform it into a DRT and put data into a tsv file. It is
>> quite a natural way of working. The general perception here is that it is
>> easier to "templatize" an existing DRL than to write a decision table from
>> scratch.
>>
>> Best regards,
>>
>> Bruno.
>>
>> PS:
>>
>> *DRT that works well*:
>>
>> template header
>> *name
>> message
>>
>> package templates;
>> *
>> import org.drools.bug.Entity;
>>
>> template "TestTemplate"
>> rule "Test1 @{row.rowNumber}"
>>     dialect "mvel"
>>     when
>>         Entity( $name : name == "@{name}" )
>>     then
>>         System.out.println("@{message}" + $name);
>>         insert($name);
>> end
>> end template
>>
>> *DRT that does not work* (first case):
>>
>> template header
>> *message
>> name
>>
>> package templates;
>> *
>> import org.drools.bug.Entity;
>>
>> template "TestTemplate"
>> rule "Test1 @{row.rowNumber}"
>>     dialect "mvel"
>>     when
>>         Entity( $name : name == "@{name}" )
>>     then
>>         System.out.println("@{message}" + $name);
>>         insert($name);
>> end
>> end template
>>
>>
>> *DRT that does not work* (second case):
>>
>> template header
>> *name
>> message
>> *
>> import org.drools.bug.Entity;
>>
>> template "TestTemplate"
>> rule "Test1 @{row.rowNumber}"
>>     dialect "mvel"
>>     when
>>         Entity( $name : name == "@{name}" )
>>     then
>>         System.out.println("@{message}" + $name);
>>         insert($name);
>> end
>> end template
>>
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
> _______________________________________________
> rules-users mailing listrules-users at lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20111103/fe5e08a4/attachment.html 


More information about the rules-users mailing list