[rules-users] Please help - losing hair

Mark Proctor mproctor at codehaus.org
Thu Aug 16 07:21:04 EDT 2007


in theory for nested accessors it should switch to the MVEL dialect 
automatically. You only need to specify the MVEL dialect explicitely for 
eval, return value and consequences.

Mark
Manjax23 wrote:
> I think you should use dialect "mvel" when accessing the nested accessors.
> and I had some trouble with "mvel" dialect in 4M2 release.
>
> Please let me know if it works for you..
>
> Thanks,
> Manjax23
>
>
> Richard Hoberman wrote:
>   
>> I'm using Drools 4 (M2), which is supposed to support nested accessors*
>>
>> This works: when Claim( submissionInfo == null), but not this: when
>> Claim( submissionInfo.date == null)
>>
>> Rule file, SubmissionInfo.java and exception are below.
>>
>> What am I missing?
>>
>> Richard
>>
>>
>>
>>
>> * See
>> http://article.gmane.org/gmane.comp.java.drools.user/8079/match=nested+properties,
>> which states "Support to nested accessors, property navigation and
>> simplified collection, arrays and maps syntax"
>>
>> Rule File
>>
>> ---------------------------------------------------------------------------------------
>> package mvanamibia.claim;
>>
>> import java.lang.Object;
>> import java.lang.String;
>> import java.lang.Double;
>> import java.util.Date;
>> import java.util.List;
>> import java.util.ArrayList;
>> import com.sadalbari.mvanamibia.beans.Claim;
>> import com.sadalbari.mvanamibia.beans.Mandate;
>> import com.sadalbari.mvanamibia.beans.SubmissionInfo;
>> import com.sadalbari.mvanamibia.inspector.ClaimEvaluation;
>>
>> global ClaimEvaluation evaluation;
>>
>> rule "hasDateReceived"
>>
>>     when
>>         Claim( submissionInfo.date == null )
>>     then
>>         evaluation.getFailures().add("missing: date received");
>> end
>>
>> -----------------------------------------------------------------------------------
>>
>> Exception
>> -----------------------------------------------------------------------------------
>> org.drools.rule.InvalidRulePackage: [19,23]: unknown:19:23 mismatched
>> token: [@137,471:471='.',<69>,19:23]; expecting type RIGHT_PAREN
>>     at org.drools.rule.Package.checkValidity(Package.java:368)
>>     at
>> org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:250)
>>     at
>> com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.setupWorkingMemory(UnregisteredClaimValidationTest.java:33)
>>     at
>> com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.testMandateClaim(UnregisteredClaimValidationTest.java:56)
>> ... Removed 22 stack frames
>> FAILED: testEmptyClaim
>> org.drools.rule.InvalidRulePackage: [19,23]: unknown:19:23 mismatched
>> token: [@137,471:471='.',<69>,19:23]; expecting type RIGHT_PAREN
>>     at org.drools.rule.Package.checkValidity(Package.java:368)
>>     at
>> org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:250)
>>     at
>> com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.setupWorkingMemory(UnregisteredClaimValidationTest.java:33)
>>     at
>> com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.testEmptyClaim(UnregisteredClaimValidationTest.java:42)
>> ... Removed 22 stack frames
>>
>>
>> ------------------------------------------------------
>> SubmissionInfo (relevant bits)
>>
>> public class SubmissionInfo implements Serializable {
>>
>>     private Date date;
>>
>>     public Date getDate() {
>>         return date;
>>     }
>>
>>     public void setDate(Date date) {
>>         this.date = date;
>>     }
>>
>>
>> _______________________________________________
>> 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/20070816/95121472/attachment.html 


More information about the rules-users mailing list