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

Uday Kodukula ukodukula at synacor.com
Fri Oct 29 12:39:26 EDT 2010


Edison, 

Thanks for your prompt reply! 

I'm trying to incorporate the workaround that you've suggested but I keep
getting an error with the use of the from clause. I based this off of the
documentation provided on drools.org for drools expert on how to use the
from clause. 

So I declared a custom type called FreqValue, who has an attribute called
freqCount that is an in. 

I store that FreqValue type in my hashMap and set it's value to 2 in my
TestDriver. 

The following is my rule: 

--- 

declare FreqValue 
        freqCount: int 
end 

rule "Testing out UdayCompare Operator" 
        ruleflow-group "udaytesting" 
        when 
                profile : Profile() 
                FreqValue( freqCount udaycompare[gt] 1 ) from
profile.pageFreq["internet"] 
        then 
                System.out.println("Yippie it works!!"); 
end 

Note that the profile.pageFreq["internet"] value contains an instance of the
FreqValue object. So, the types match. I was hoping that I didn't have to
create a separate type, since the hashMap pageFreq just contains Integers.
But I can't say Integer( "internal attribute for Integer to store value?"
udaycompare[gt] 1)... 

Anyways, when running this I get the following error about an error in the
from clause: 

    Unable to build expression for 'from' : 1 'profile.pageFreq["internet"]'
: [Rule name='Testing out UdayCompare Operator']

Any idea what is wrong? It's a pretty ambiguous error message...
-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Bug-Custom-Operator-with-Maps-results-in-Mvel-Error-tp1790252p1793445.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list