Re: [rules-users] Accumulate in Drools
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 tire...@post.com To: Manav manav7...@yahoo.com; Rules Users List rules-users@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 tire...@post.com To: Manav manav7...@yahoo.com; Rules Users List rules-users@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 manav7...@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@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Accumulate in Drools
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 tire...@post.com To: Manav manav7...@yahoo.com; Rules Users List rules-users@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 manav7...@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@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Accumulate in Drools
Which version of MVEL are you using? Edson 2010/8/17 Manav manav7...@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 tire...@post.com *To:* Manav manav7...@yahoo.com; Rules Users List rules-users@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 manav7...@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@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Accumulate in Drools
On 16 August 2010 05:43, Manav manav7...@yahoo.com wrote: Hi, I am trying my hand at the accumulate function in Drools 5.x but the drl fails to compile. Error message, please. -W 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@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
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 manav7...@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@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Accumulate in Drools
Thanks Edson. I don't why but when i am using the below rule in my drl it's failing to compile. Not sure if i am doing something stupid or this is an issue with environment or the drl. I am attaching the drl file with the mail. The error that i get is : - testTestsRulesEngine( at suitability.RulesEngine.init( at suitability.TestsRulesEngine.init( at suitability.TestsRulesEngineTest.setUp( Caused by: suitability.TestsRulesEngineTest)suitability.RulesEngineException: Could not load/compile rules file: testAccumulate.drlRulesEngine.java:39)TestsRulesEngine.java:13)TestsRulesEngineTest.java:72)java.lang.NullPointerExceptionat org.drools.common.AbstractRuleBase.addPackages( at org.drools.reteoo.ReteooRuleBase.addPackage( at suitability.RulesEngine.init( ... 14 moreAbstractRuleBase.java:434)ReteooRuleBase.java:388)RulesEngine.java:36) Regards, Manav From: Edson Tirelli tire...@post.com To: Manav manav7...@yahoo.com; Rules Users List rules-users@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 manav7...@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@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com testAccumulate.drl Description: Binary data ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Accumulate in Drools
knowledgeBuilder.getErrors() Edson 2010/8/16 Manav manav7...@yahoo.com Thanks Edson. I don't why but when i am using the below rule in my drl it's failing to compile. Not sure if i am doing something stupid or this is an issue with environment or the drl. I am attaching the drl file with the mail. The error that i get is : - testTestsRulesEngine( *suitability.TestsRulesEngineTest)suitability.RulesEngineException*: Could not load/compile rules file: testAccumulate.drl at suitability.RulesEngine.init( *RulesEngine.java:39*) at suitability.TestsRulesEngine.init( *TestsRulesEngine.java:13*) at suitability.TestsRulesEngineTest.setUp( *TestsRulesEngineTest.java:72*) Caused by: *java.lang.NullPointerException* at org.drools.common.AbstractRuleBase.addPackages( *AbstractRuleBase.java:434*) at org.drools.reteoo.ReteooRuleBase.addPackage( *ReteooRuleBase.java:388*) at suitability.RulesEngine.init( *RulesEngine.java:36*) ... 14 more Regards, Manav -- *From:* Edson Tirelli tire...@post.com *To:* Manav manav7...@yahoo.com; Rules Users List rules-users@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 manav7...@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@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Accumulate in Drools
This isn't quite right: 2010/8/16 Edson Tirelli tire...@post.com 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() ) ) from accumulate (Client (productTypeExperience.keySet contains $name, $score : productTypeExperience[$name] ) terminate the Client pattern min ( ((ExperienceLevel)$score).value() ) )### here the accumulate ends 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 manav7...@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@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Accumulate in Drools
Sorry for the spam. There was a syntax error in my earlier accumulate function. After fixing that i am getting this error now which looks like some issue with the drl Caused by: $score : productTypeExperience[$name] Regards, Manav From: Edson Tirelli tire...@post.com To: Manav manav7...@yahoo.com; Rules Users List rules-users@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 manav7...@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@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com org.drools.RuntimeDroolsException: [Error: unable to resolve method: java.util.HashMap.$name() [arglength=0]]Looks like the $name() is not being accepted as a valid argument in ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Accumulate in Drools
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@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users