Question

I am new to drools and guvnor.

I have basic question for rule flow.

I have created 3 rules using guided editor on guvnor plugin. Now I want to invoke the 2nd or 3rd rule based on the outcome of 1st rule.

e.g. If the patient's age is less than 18 go for 2nd rule for minor checks otherwise invoke 3rd rule for check from senior physician.

So can this be achieved using rule flow? If yes how? Are there any example links, documents demonstrating it? Any help very much appreciated.

Thanks

Was it helpful?

Solution

I'm a bit new to Drools and Guvnor myself, but I think I can make a suggestion.

You might want to consider inserting a new fact (say "IsMinor", or whatever) to as a consequence of your first rule. Then, you can have other rules use IsMinor as a condition, which will cause them to fire. And so on. That's how I'm handling a case where I need to produce a given "Widget" based on the outcome of a rule that produces a different Widget.

I had originally modeled it differently, but then I realized that inserting new facts and reasoning upon them is a key to unleashing the power of rules effectively (at least I think so :-)).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top