[rules-users] What's wrong with the connectives?

Edson Tirelli tirelli at post.com
Tue Nov 18 19:50:05 EST 2008


    Ouch.

    Start by removing all those null checks, since things like:

age > 17

    Will always return false if the age field is null, so the null check is
redundant.
    Also, replace top level && by ",", since this will make your constraint
groups clear.
    Then finally, make sure your ()-pairs are all fine and it should work.

    Just taking a quick look here I see an extra ")" here:

bodyFat > 0.31)

    []s
    Edson

    []s
    Edson

2008/11/18 vanshi <nilu.thakur at gmail.com>

>
> Hi all,
>
> Can somebody help me here?? I've a business rule presented in bold here
> that
> I've put in the DRL file in the simplest form but compilation of rule is
> generating this error "line 6:342 required (...)+ loop did not match
> anything at character ' '"
> And any set of value is getting evaluated to TRUE.....that means rule
> validation is not happening.....I understand that I can use helper function
> in java classes and call them in the rule but wanted to know how can I do
> the same entirely in DRL file OR what's wrong with this. I've spent entire
> day to figure out but completely clueless and afraid to try function
> approach due to project deadline. Plz help.
>
> pers: Person(sourceType == 'Insurance' && (age != null  && > 17) &&
> ((cholesterol !=null && >= 200) || (hdlCholesterol !=null && < 60) ||
> (cholesterolToHdlRation !=null && > 4.5) ||
>                 (ldlCholesterol !=null &&  >160) || (vldl !=null && > 40)
> ||
> (triglyceride !=null &&  > 50) || (glucose !=null &&  >130) || (bmi !=null
> && >=25)  ||
>                  (bodyFat > 0. 25 &&  sbjGdrCd !=null &&  == 'F'  &&  age
> !=null && > 17
> && < 40) ||
>                  (bodyFat > 0.30 && sbjGdrCd !=null &&  == 'F' && age
> !=null && > 39 && <
> 60) ||
>                  (bodyFat > 0.31) && sbjGdrCd !=null && == 'F' && age
> !=null && age > 60)
> ||
>                  (bodyFat > 0.19 && sbjGdrCd !=null &&  == 'M' &&  age
> !=null && >17 && <
> 40) ||
>                  (bodyFat > 0.23 && sbjGdrCd !=null && == 'M' && age !=null
> && age > 39 <
> 60) ||
>                  (bodyFat > 0.24  && sbjGdrCd !=null && == 'M'  && age
> !=null && >=60)))
>
>                //Age>=18 AND Total Cholesterol >=200 OR HDL <60 OR
> Cholesterol Ratio
> >4.5 OR LDL >160 OR VLDL >40 OR Triglycerides >150 OR Glucose >130 OR BMI
> >=25 OR Body Fat % greater than the range of  14% and 25% when gender = F
> and age between or equal to 18 and 39 OR Body Fate % greater than the range
> of  18% and 30% when gender = F and age between or equal to 40 and 59 OR
> Body Fat % greater than the range of  21% and 31% when gender = F and age
> >60 OR Body Fat % greater than the range of  7% and 19% when gender = M and
> age between or equal to 18 and 39 OR Body Fat % greater than the range of
> 14% and 23% when gender = M and age between or equal to 40 and 59 OR Body
> Fat % greater than the range of  15% and 24% when gender = M and age >60
> --
> View this message in context:
> http://www.nabble.com/What%27s-wrong-with-the-connectives--tp20571531p20571531.html
> Sent from the drools - user mailing list archive at Nabble.com.
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20081118/9ccf1a11/attachment.html 


More information about the rules-users mailing list