[rules-users] Parse bug in predicate constraints?

Olenin, Vladimir (MOH) Vladimir.Olenin at moh.gov.on.ca
Thu Feb 8 15:56:42 EST 2007


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?  



Not a DROOLS expert, but from what I understand this is already possible now
as long as you are using Java 1.5 (which has autoboxing/autounboxing as part
of the language spec).

 

Vlad

 

 

  _____  

From: rules-users-bounces at lists.jboss.org
[mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Justine Hlista
Sent: 08 February 2007 15:12
To: rules-users at lists.jboss.org
Subject: [rules-users] Parse bug in predicate constraints?

 

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






-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070208/af8c80d9/attachment.html 


More information about the rules-users mailing list