Assuming that the engine is handling one set of facts at a time, I would
use a single additional fact to collect all decisions. The details of this object
may vary (depending on whether you have a constant number of rules or
not).
enum Decision { UNDEF, GRANTED, DEFERRED,... }
class Collector {
Decision decision = Decision.UNDEF;
Set<String> rules;
//...
}
Here is a sample rule:
rule "rule1"
when
$d : Decision( rules not contains "rule1" )
....
then
modify( $d ){
addRule( "rule1" ),
setDecision( maximumOf( $d.getDecision(), Decision.XYZ ) )
}
end
At the end, the decision object contains the final decision.
-W
Hi,
We have multiple rules defined in Guvnor and we fire all the rules at a
time. There is a decision object set for each rule and I am trying to figure
out a way to aggregate the result using the prirority of the decision object
(kind of logical AND / OR)
For Ex: The priority of the decision would be set as below
Priority:
Priority3 Priority2 Priority1 Exception on any rule
Granted Action not Supported Denied Deferred
After the rules are fired (I am considering 4 rules here) the final decision
should be as follows
Sample Rule result:
Rule Rule1 Rule2 Rule3 Rule4
FinalDecison
Decisions Granted Granted Granted Deferred
Deferred
Granted Granted Action Not Supported Granted Action Not
Supported
Granted Granted Denied Granted
Denied
Granted Granted Granted Granted
Granted
Is there a way to acheive this using rule flow group / any other simple way?
Thanks,
Barani
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/How-to-aggregate-decisions-of-multiple-rules-In-Guvnor-tp1025115p1025115.html
Sent from the Drools - User mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users