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.
Simplified rule then is:
Person( sourceType=='Insurance',
age >17,
( cholesterol >= 200 ) ||
( hdlCholesterol < 60 ) ||
...
( bodyFat > 0.24 && sbjGdrCd == 'M' && age >=60
)
)
Must work.
Also:
"even when I'm changing the values of its variables"
Are you changing the attributes in modify() blocks? or calling update()?
[]s
Edson
2008/11/18 vanshi <nilu.thakur(a)gmail.com>
Thanks Edson for the reply but it didn't work.
First off, I want to do a null check for age and return false if age or any
variable is null.
Secondly, I tried that "," connective but didn't work either and counted
again..... there is no extra () pair.
Actually the business rule here is sourceType=='Insurance' && age!=null
&&
>17 and after that if any of the bracketted value surrounded by the ( )
validates to true then, rule should validate to TRUE. So, the simplified
rules is:
sourceType=='Insurance' && (age not null && >17) AND ANY OF
FOLLOWING
TRUE...(validation1) || (validation2) || (validation3)...and so on. that's
why I had put another () to surround the set of validations starting from
cholesterol.
Also, what is this error about?? line 6:342 required (...)+ loop did not
match anything at character ' ' I think this is bcoz rule is not getting
parsed properly by antlr grammer..but I'm not able to see...where the
mistake is.
Also, I noticed while debugging that person object which I'm inserting in
working memory ...retains the previous value...even when I'm changing the
values of its variables.....why is that?
Plz people take a look n point out the mistake here. I would really
appreciate any help
Edson Tirelli-3 wrote:
>
> 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(a)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--tp20571531p205...
>> Sent from the drools - user mailing list archive at
Nabble.com.
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)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
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
>
--
View this message in context:
http://www.nabble.com/What%27s-wrong-with-the-connectives--tp20571531p205...
Sent from the drools - user mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
JBoss Drools Core Development
JBoss, a division of Red Hat @