Should predicate constraints be sensitive to whitespace?? I have the following rule with a predicate constraint:
rule "test"
when
valObj : MyValuesObject(a:aVal, b:bVal, c:cVal ->
((a.intValue() < (1/780) * (b.intValue() + c.intValue()) &&
(b.intValue() + c.intValue()) > 500000)
then
System.out.println("Alert condition met on obj:" + valObj);
end
Inserting whitespace into the predicate results in the following exception:
org.drools.rule.InvalidRulePackage: unknown:155:85 mismatched token:
[@1723,5226:5227='\r\n',<4>,155:85]; expecting type ')'
unknown:156:28 mismatched token: [@1752,5256:5256='(',<23>,156:28]; expecting type ')'
If instead I use an eval on the LHS, I can insert whitespace without an exception.
In addition, I would like to know if there are any plans to simplify the syntax for similar types of rules, as the above is extremely unwieldy for the non-expert.
For instance, I would vastly prefer to write the following:
rule "test"
when
valObj : MyValuesObject(a:aVal, b:bVal, c:cVal)
(a < (1/780)*(b+c))
((b + c) > 500000)
then
System.out.println("Alert condition met on obj:" + valObj);
end
Also, since everything in rules needs to be an Object, is there any plan to make the operators deal with said Objects? That is, so I do not always have to de-reference with my eval or predicate objects with intValue() or floatValue() or whatever?
In our application, the user (i.e. not a drools or java expert) will be writing the rules. The current syntax requirements for encoding the above simple rule makes me very nervous about our users ever being able to use the rules effectively.
Thanks,
Justine