[rules-users] DRL - Accessors that take arguments

2009-06-01 Thread Vidya Chandrasekaran
Hi,

I am fairly new to Drools and am just getting my feet wet with writing
rules.

In my work, I have to integrate drools with classes that do not expose all
properties via getXXX/ isXXX accessor methods but require a call of the form
someMethod(keyvalue). I have been using the MVEL dialect and do not see a
way to call a function with arguments on the LHS side of a rule either in
the documentation or the mailing list.


In fact, I have been trying something like

rule rulename
agenda-group evaluation
when
$d: VO( computePrice(key)  10) from entry-point Inventory
stream
then
#
end

This fails with a 'no viable alternative at input 'key' in rule. Is there
a way this can be accomplished?

Thanks,
Vidya
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] DRL - Accessors that take arguments

2009-06-01 Thread Edson Tirelli
   For arbitrary method calls, the only way is to use an eval:

VO( eval( computePrice(key)  10 ) )

   Although, if you have a method that returns a map, you can use simplified
Map syntax:

class VO {
   ...
   public Map getComputeMap() {...}
}

   Then:

VO( computeMap[key]  10 )


   []s
   Edson

2009/6/1 Vidya Chandrasekaran aydi...@gmail.com


 Hi,

 I am fairly new to Drools and am just getting my feet wet with writing
 rules.

 In my work, I have to integrate drools with classes that do not expose all
 properties via getXXX/ isXXX accessor methods but require a call of the form
 someMethod(keyvalue). I have been using the MVEL dialect and do not see a
 way to call a function with arguments on the LHS side of a rule either in
 the documentation or the mailing list.


 In fact, I have been trying something like

 rule rulename
 agenda-group evaluation
 when
 $d: VO( computePrice(key)  10) from entry-point Inventory
 stream
 then
 #
 end

 This fails with a 'no viable alternative at input 'key' in rule. Is there
 a way this can be accomplished?

 Thanks,
 Vidya

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss, a division of Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users