[rules-users] Please help - losing hair

Manjax23 manjunatha.n at coreobjects.com
Thu Aug 16 08:22:07 EDT 2007


I had same problem with 4M2 release. Please upgrade it to either 4.0.0 GA or
4M3 release.
You can also find a sample example ShoppingExample.java and Shopping.drl,
which is self-explanatory.
However, I was not able to test few MVEL features like projections, which i
think if added would make drools even more dynamic.

Thanks,
manjax23


Richard Hoberman wrote:
> 
> 1. I can't find any mention of dialects anywhere in the Drools 4
> manual.  Am I missing something?
> 
> 2. I've tried the following after finding a snippet in the archives for
> this list:
> 
>     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"
>         dialect "mvel"
>         when
>             Claim( submissionInfo == null )
>         then
>             evaluation.getViolations().add("missing: date received");
>     end
> 
> 
> but it gives the following exception:
> 
>     java.lang.NullPointerException
>         at
>    
> org.drools.rule.builder.RuleBuildContext.<init>(RuleBuildContext.java:115)
>         at
>     org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:350)
>         at
>     org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:233)
>         at
>    
> org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:157)
>         at
>    
> com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.setupWorkingMemory(UnregisteredClaimValidationTest.java:29)
>         at
>    
> com.sadalbari.mvanamibia.model.UnregisteredClaimValidationTest.testEmptyClaim(UnregisteredClaimValidationTest.java:42)
>     ... Removed 22 stack frames
> 
> 
> Thanks
> 
> Richard
> 
> 
> Mark Proctor wrote:
>> 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
>>>>
>>>>
>>>>     
>>>
>>>   
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://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
> 
> 

-- 
View this message in context: http://www.nabble.com/Please-help---losing-hair-tf4278339.html#a12180147
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list