[rules-users] Rule firing problem - must be missing something obvious

J Michael Dean mdean77 at comcast.net
Tue Nov 27 08:41:17 EST 2007


I am passing a glucose decision object with a value of 12, and have a  
state object that starts out with its flag set false.  The desired  
behavior is that the value will be recognized as "extremeHypoglycemia"  
by the first rule, and then the second rule will recommend giving a  
glucose bolus.

When I pass both objects in without "true" to cause automatic  
updating, then the first rule fires, the output is

false
Fired detect extreme hypoglycemia
true

and then the program stops.  It does not fire the second rule.

When I add true to the insertion of these objects, then the program  
recurses, and still never hits the second rule. Interestingly, the  
output is

true
Fired detect extreme hypoglycemia
true
true
Fired detect extreme hypoglycemia
true
...
ETC.


rule "First rule: Detect extreme hypoglycemia"
	no-loop true
	when
		decision : GlucoseDecision( serumGlucoseConcentration < 40 )
		decisionState : GlucoseDecisionState(extremeHypoglycemia == false)
	then
		System.out.println("Fired detect extreme hypoglycemia");
		System.out.println(decisionState.isExtremeHypoglycemia());
		decisionState.setExtremeHypoglycemia(true);
		decision.setRationaleText(decision.getRationaleText() +
			"Extreme hypoglycemia (Current glucose is " +
			decision.getSerumGlucoseConcentration() +" mg/dL).\n");
		System.out.println(decisionState.isExtremeHypoglycemia());	
		update(decision);	
end

rule "Second rule: Give glucose bolus for extreme hypoglycemia"
	no-loop true
	when
		decision : GlucoseDecision()
		decisionState : GlucoseDecisionState(extremeHypoglycemia == true )
	then
	System.out.println("Fired glucose bolus rule");
		decisionState.setRecommendedGlucoseBolus(true);
		decision.setRationaleText(decision.getRationaleText() +
			"Glucose bolus recommended because of extreme hypoglycemia.\n");
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20071127/a51872f3/attachment.html 


More information about the rules-users mailing list