[rules-users] Jboss rules: or with binding issue?

Rahul Phadnis rahul.phadnis at yahoo.com
Tue Oct 23 15:09:24 EDT 2007


I am using Jboss Rules 4.0.2 version.

I am trying to using or with binding. However the
following doesn't work
rule "RulesTest"
    # the if part
    activation-group  "ActivationGroup1"
    salience 50
    when
        $eventType: EventType(id ==
Constants.EVENT_DEVCOM_ID) 
        $result : Result()
        $param  : Parameter($thresh:threshold)
        		  # difference exceeds threshold value and
it is still day time
        context: (or DevContext(difference > $thresh,
dayTime == true) 
        		     DevContext(difference > $thresh, sleepy
== false, dayTime == false) ) 
        		  
    then
        # do something here
        
end

I get rule compilation errors:
SEVERE: CheckedDroolsException
org.drools.CheckedDroolsException: There were errors
in the rule source: [320,18]: unknown:320:18
mismatched token:
[@1949,12142:12143='or',<34>,320:18]; expecting type
ID[321,15]: unknown:321:15 mismatched token:
[@1967,12215:12227='DevContext',<7>,321:15]; expecting
type RIGHT_PAREN[321,86]: unknown:321:86 mismatched
token: [@1990,12286:12286=')',<12>,321:86]; expecting
type THEN
	at
org.drools.compiler.RuleBaseLoader.makeRuleBase(RuleBaseLoader.java:6

Is this a known bug ?

I can work around by using the alternate syntax
suggested in the documentation which is:

or $context : DevContext(difference > $thresh, dayTime
== true) 
   $context : DevComContext(difference > $thresh,
sleepy == false, dayTime == false) ) 

Rahul.





More information about the rules-users mailing list