[rules-users] Parse bug in predicate constraints?

Edson Tirelli tirelli at post.com
Thu Feb 8 18:29:19 EST 2007


   Vlad,

   Yes, we did that in trunk. For performance reasons, we now gracefully 
handle primitive types. Even if you use Java5, we avoid autoboxing.
   Please, see my answer to Justine about it.

   []s
   Edson

Olenin, Vladimir (MOH) wrote:

> 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
>
>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>rules-users mailing list
>rules-users at lists.jboss.org
>https://lists.jboss.org/mailman/listinfo/rules-users
>  
>


-- 
 Edson Tirelli
 Software Engineer - JBoss Rules Core Developer
 Office: +55 11 3124-6000
 Mobile: +55 11 9218-4151
 JBoss, a division of Red Hat @ www.jboss.com





More information about the rules-users mailing list