[rules-users] Rule problem

Greg Barton greg_barton at yahoo.com
Sun May 3 20:47:07 EDT 2009


Try the attached code.

--- On Sun, 5/3/09, Femke De Backere <femmyke at gmail.com> wrote:

> From: Femke De Backere <femmyke at gmail.com>
> Subject: Re: [rules-users] Rule problem
> To: "Rules Users List" <rules-users at lists.jboss.org>
> Date: Sunday, May 3, 2009, 6:18 PM
> Thx for the answer. I tried this but I doesn't seem to
> work. For a BMI of 20, i get the result
> "ondergewicht", and it should be
> "normal".
> 
> Op 4-mei-09, om 01:04 heeft Ingomar Otter het volgende
> geschreven:
> 
> > Femke,
> > The "Overgewicht| rule matches for _two_ BMIClass
> facts, one with bmi >- 25 and one for BMIClass <30.
> > If you want to apply multiple  constraints to a single
> fact you have to list them as such:
> > 
> >> rule "Overgewicht"
> >> 	when
> >> 		bmiClass : BMIClass(bmi >= 25 && bmi
> <30)
> >> 	then
> >> 		System.out.println("U heeft
> overgewicht");
> >> end
> > 
> > 
> > Cheers,
> >  Ingomar
> > 
> > 
> > Am 04.05.2009 um 00:48 schrieb Femke De Backere:
> > 
> >> Hi!
> >> 
> >> I want to make en BMI rule application, so I need
> to test the BMI values. But in rule "Overgewicht"
> and "Normaal", I need to use an AND, but it
> doesn't seem to work in any way I tried.
> >> 
> >> Does anybody see the problem? The rest of the
> application is based on de sample project (created when
> making a new Drools project).
> >> 
> >> Thx,
> >> 
> >> Femke
> >> 
> >> package bmi
> >> 
> >> import bmi.DroolsTest.BMIClass;
> >> 
> >> rule "Overgewicht"
> >> 	when
> >> 		bmiClass : BMIClass(bmi >= 25)
> >> 		bmiClass : BMIClass(bmi < 30)
> >> 	then
> >> 		System.out.println("U heeft
> overgewicht");
> >> end
> >> 
> >> rule "Obesitas"
> >> 	when
> >> 		bmiClass : BMIClass($bmi : bmi >= 30)
> >> 	then
> >> 		System.out.println("U heeft
> obesitas");
> >> end		
> >> 		
> >> rule "Ondergewicht"
> >> 	when
> >> 		bmiClass : BMIClass($bmi : bmi < 18.5)
> >> 	then
> >> 		System.out.println("U heeft
> ondergewicht");
> >> end	
> >> 		
> >> rule "Normaal"
> >> 	when
> >> 		bmiClass : BMIClass(bmi >= 18.5)
> >> 		bmiClass : BMIClass(bmi < 25)
> >> 	then
> >> 		System.out.println("U heeft een normaal
> gewicht");
> >>
> end		_______________________________________________
> >> rules-users mailing list
> >> rules-users at lists.jboss.org
> >>
> https://lists.jboss.org/mailman/listinfo/rules-users
> > 
> > _______________________________________________
> > rules-users mailing list
> > rules-users at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> 
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users


      
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DroolsTest.java
Type: text/x-java
Size: 2302 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20090503/512e3a38/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Sample.drl
Type: application/octet-stream
Size: 604 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20090503/512e3a38/attachment.obj 


More information about the rules-users mailing list