[rules-users] Drools Bug: Custom Operator with Maps results in Mvel Error

Uday Kodukula ukodukula at synacor.com
Fri Oct 29 17:42:10 EDT 2010


Thanks Edison,

Looking forward to the update in Mvel.

Unfortunately, I tried the binding but still get an error where the bound
variable cannot be recognized. I should also mention that the Profile fact
is declared and not a pre generated POJO.

So here is the updated rule:

package com.uday.targeting

# explicitly set the dialect to mvel, just in case...
dialect "mvel"

rule "Testing out SynCompare"
	ruleflow-group "udaytesting"
	when
		Profile( $map : pageFreq )
		Integer( this udaycompare[gt] 1 ) from $map["internet"] 
		#conditions
	then
		#actions
		System.out.println("Yippie it works!!");
end

However, this throws the following error where $map cannot be recognized:
 
  [8,40]: [ERR 101] Line 8:40 no viable alternative at input '$map' in rule
"Testing out UdayCompare Operator"
  [8,45]: [ERR 102] Line 8:45 mismatched input '"internet"' expecting ']' in
rule "Testing out UdayCompare Operator" in pattern $map

Also I tried to simply bind a variable to an Integer as such:

when
     Integer( $testBinding : intValue == 1 )
     Integer( this udaycompare[gt] 1 ) from $testBinding
then
    System.out.println("howdy");
end

Now, that approach doesn't give me an error as observed when binding to the
HashMap.

So perhaps this is an issue with not being able to bind to HashMaps that
belong to declared facts, vs. those that are defined in classes already
(such as Integer)?
-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Bug-Custom-Operator-with-Maps-results-in-Mvel-Error-tp1790252p1809395.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list