[rules-users] Accumulate in Drools

Manav manav7574 at yahoo.com
Wed Aug 18 14:00:35 EDT 2010



Am using 2.0.10 (mvel2-2.0.10.jar) . That's giving the issue below.

Also tried it with other versions mvel2-2.0.16.jar , mvel2-2.0.17.jar but no 
luck.

regards,
Manav
  
________________________________
From: Edson Tirelli <tirelli at post.com>
To: Manav <manav7574 at yahoo.com>; Rules Users List <rules-users at lists.jboss.org>
Subject: Re: [rules-users] Accumulate in Drools

>   Which version of MVEL are you using?
>
>  Edson
>
>2010/8/17 Manav <manav7574 at yahoo.com>
>
> Here's the modified rule :
>
> rule "Test Accumulate Function"
> when
>  $p : ProductType ($name : name)
>  $min_score : Number ()
>      from accumulate (Client (productTypeExperience.keySet contains $name,
>                    $score : productTypeExperience[$name]),
>                        min (((ExperienceLevel)$score).value()))
>
> then
>  System.out.println ("$min_score" + $min_score);
> end
>
> and the runtime exception that i am getting is
> Caused by: org.drools.RuntimeDroolsException:
>  [Error: unable to resolve method: java.util.HashMap.$name() [arglength=0]]
> [Near : {... Unknown ....}]
>
> Regards,
> Manav
>




________________________________
From: Edson Tirelli <tirelli at post.com>
To: Manav <manav7574 at yahoo.com>; Rules Users List <rules-users at lists.jboss.org>
Sent: Mon, August 16, 2010 7:46:54 PM
Subject: Re: [rules-users] Accumulate in Drools


     You can't use the cast and the method call in a regular constraint. You can 
use it as part of an expression. So:

 $min_score : Number ()
   from accumulate (Client (productTypeExperience.keySet contains $name,
                     $score : productTypeExperience[$name],
                     min ( ((ExperienceLevel)$score).value() ) )

     We are working on the support of free form expressions on constraints for 
Drools 6 (not sure we can make it for 5.2).

     Edson


2010/8/15 Manav <manav7574 at yahoo.com>

Hi,
>I am trying my hand at the accumulate function in Drools 5.x but the drl fails
>to compile.
>Not sure what's wrong with it. Please help.
>This is the sample that i am working with
>
>rule "Test Accumulate Function"
>when
> $p : ProductType ($name : name)
> $min_score : Number ()
>   from accumulate (Client (productTypeExperience.keySet contains $name,
>                     $score :
>((ExperienceLevel)productTypeExperience[$name]).value()),
>              min ($score))
>then
> System.out.println ("$min_score" + $min_score);
>end
>Regards,
>Manav
>
>
>
>
>
>_______________________________________________
>rules-users mailing list
>rules-users at lists.jboss.org
>https://lists.jboss.org/mailman/listinfo/rules-users
>


-- 
  Edson Tirelli
  JBoss Drools Core Development
  JBoss by Red Hat @ www.jboss.com



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100818/1219350b/attachment.html 


More information about the rules-users mailing list