[rules-users] Use only first matching rule
nechukin
nechukin at gmail.com
Tue Oct 30 09:12:44 EDT 2007
This could be an option. I will give a try.
Thank you.
Dr. Gernot Starke wrote:
>
> Georgy,
>
> one (simple) way to achieve this is to assert a "stop"-fact on the
> right-hand-side
> of the executing rule (e.g. by setting an appropriate attribute) AND
> querying that attribute on the LHS of every rule.
>
> Example (pseudo-code)
>
> rule 1
> when (business-conditions...)
> st: StopFact ( done == false )
> then
> st.setDone( true ); // make ALL other rules fail
> // all other actions...
> end
>
> IMHO this is expressive in a way that the "single-rule-only" approach
> is clearly visible in all rules...
>
> But: Don't forget to set the StopFact to "not-done" after evaluation...
>
> regards from Cologne,
> Gernot
>
--
View this message in context: http://www.nabble.com/Use-only-first-matching-rule-tf4710521.html#a13488278
Sent from the drools - user mailing list archive at Nabble.com.
More information about the rules-users
mailing list