<br> Yes, parser error. For Drools 5 we rewrote the parser from scratch with complete new error handling and better error messages, but for 4, we need to live with that.<br><br> Simplified rule then is:<br><br>Person( sourceType=='Insurance',<br>
age >17,<br> ( cholesterol >= 200 ) ||<br> ( hdlCholesterol < 60 ) ||<br> ...<br> ( bodyFat > 0.24 && sbjGdrCd == 'M' && age >=60 ) <br>
)<br><br> Must work.<br><br> Also:<br><br>"even when I'm changing the values of its variables"<br><br> Are you changing the attributes in modify() blocks? or calling update()?<br><br> []s<br>
Edson<br><br><br><div class="gmail_quote">2008/11/18 vanshi <span dir="ltr"><<a href="mailto:nilu.thakur@gmail.com">nilu.thakur@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Thanks Edson for the reply but it didn't work.<br>
<br>
First off, I want to do a null check for age and return false if age or any<br>
variable is null.<br>
Secondly, I tried that "," connective but didn't work either and counted<br>
again..... there is no extra () pair.<br>
<br>
Actually the business rule here is sourceType=='Insurance' && age!=null &&<br>
>17 and after that if any of the bracketted value surrounded by the ( )<br>
validates to true then, rule should validate to TRUE. So, the simplified<br>
rules is:<br>
<br>
sourceType=='Insurance' && (age not null && >17) AND ANY OF FOLLOWING<br>
TRUE...(validation1) || (validation2) || (validation3)...and so on. that's<br>
why I had put another () to surround the set of validations starting from<br>
cholesterol.<br>
<br>
Also, what is this error about?? line 6:342 required (...)+ loop did not<br>
match anything at character ' ' I think this is bcoz rule is not getting<br>
parsed properly by antlr grammer..but I'm not able to see...where the<br>
mistake is.<br>
<br>
Also, I noticed while debugging that person object which I'm inserting in<br>
working memory ...retains the previous value...even when I'm changing the<br>
values of its variables.....why is that?<br>
<br>
Plz people take a look n point out the mistake here. I would really<br>
appreciate any help<br>
<div><div></div><div class="Wj3C7c"><br>
<br>
Edson Tirelli-3 wrote:<br>
><br>
> Ouch.<br>
><br>
> Start by removing all those null checks, since things like:<br>
><br>
> age > 17<br>
><br>
> Will always return false if the age field is null, so the null check<br>
> is<br>
> redundant.<br>
> Also, replace top level && by ",", since this will make your<br>
> constraint<br>
> groups clear.<br>
> Then finally, make sure your ()-pairs are all fine and it should work.<br>
><br>
> Just taking a quick look here I see an extra ")" here:<br>
><br>
> bodyFat > 0.31)<br>
><br>
> []s<br>
> Edson<br>
><br>
> []s<br>
> Edson<br>
><br>
> 2008/11/18 vanshi <<a href="mailto:nilu.thakur@gmail.com">nilu.thakur@gmail.com</a>><br>
><br>
>><br>
>> Hi all,<br>
>><br>
>> Can somebody help me here?? I've a business rule presented in bold here<br>
>> that<br>
>> I've put in the DRL file in the simplest form but compilation of rule is<br>
>> generating this error "line 6:342 required (...)+ loop did not match<br>
>> anything at character ' '"<br>
>> And any set of value is getting evaluated to TRUE.....that means rule<br>
>> validation is not happening.....I understand that I can use helper<br>
>> function<br>
>> in java classes and call them in the rule but wanted to know how can I do<br>
>> the same entirely in DRL file OR what's wrong with this. I've spent<br>
>> entire<br>
>> day to figure out but completely clueless and afraid to try function<br>
>> approach due to project deadline. Plz help.<br>
>><br>
>> pers: Person(sourceType == 'Insurance' && (age != null && > 17) &&<br>
>> ((cholesterol !=null && >= 200) || (hdlCholesterol !=null && < 60) ||<br>
>> (cholesterolToHdlRation !=null && > 4.5) ||<br>
>> (ldlCholesterol !=null && >160) || (vldl !=null && > 40)<br>
>> ||<br>
>> (triglyceride !=null && > 50) || (glucose !=null && >130) || (bmi<br>
>> !=null<br>
>> && >=25) ||<br>
>> (bodyFat > 0. 25 && sbjGdrCd !=null && == 'F' && age<br>
>> !=null && > 17<br>
>> && < 40) ||<br>
>> (bodyFat > 0.30 && sbjGdrCd !=null && == 'F' && age<br>
>> !=null && > 39 && <<br>
>> 60) ||<br>
>> (bodyFat > 0.31) && sbjGdrCd !=null && == 'F' && age<br>
>> !=null && age > 60)<br>
>> ||<br>
>> (bodyFat > 0.19 && sbjGdrCd !=null && == 'M' && age<br>
>> !=null && >17 && <<br>
>> 40) ||<br>
>> (bodyFat > 0.23 && sbjGdrCd !=null && == 'M' && age<br>
>> !=null<br>
>> && age > 39 <<br>
>> 60) ||<br>
>> (bodyFat > 0.24 && sbjGdrCd !=null && == 'M' && age<br>
>> !=null && >=60)))<br>
>><br>
>> //Age>=18 AND Total Cholesterol >=200 OR HDL <60 OR<br>
>> Cholesterol Ratio<br>
>> >4.5 OR LDL >160 OR VLDL >40 OR Triglycerides >150 OR Glucose >130 OR BMI<br>
>> >=25 OR Body Fat % greater than the range of 14% and 25% when gender = F<br>
>> and age between or equal to 18 and 39 OR Body Fate % greater than the<br>
>> range<br>
>> of 18% and 30% when gender = F and age between or equal to 40 and 59 OR<br>
>> Body Fat % greater than the range of 21% and 31% when gender = F and age<br>
>> >60 OR Body Fat % greater than the range of 7% and 19% when gender = M<br>
>> and<br>
>> age between or equal to 18 and 39 OR Body Fat % greater than the range of<br>
>> 14% and 23% when gender = M and age between or equal to 40 and 59 OR Body<br>
>> Fat % greater than the range of 15% and 24% when gender = M and age >60<br>
>> --<br>
>> View this message in context:<br>
>> <a href="http://www.nabble.com/What%27s-wrong-with-the-connectives--tp20571531p20571531.html" target="_blank">http://www.nabble.com/What%27s-wrong-with-the-connectives--tp20571531p20571531.html</a><br>
>> Sent from the drools - user mailing list archive at Nabble.com.<br>
>><br>
>> _______________________________________________<br>
>> rules-users mailing list<br>
>> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
>> <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
>><br>
><br>
><br>
><br>
> --<br>
> Edson Tirelli<br>
> JBoss Drools Core Development<br>
> JBoss, a division of Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a><br>
><br>
> _______________________________________________<br>
> rules-users mailing list<br>
> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
><br>
><br>
<br>
--<br>
</div></div>View this message in context: <a href="http://www.nabble.com/What%27s-wrong-with-the-connectives--tp20571531p20572073.html" target="_blank">http://www.nabble.com/What%27s-wrong-with-the-connectives--tp20571531p20572073.html</a><br>
<div><div></div><div class="Wj3C7c">Sent from the drools - user mailing list archive at Nabble.com.<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>