Details
-
Feature Request
-
Resolution: Done
-
Major
-
None
-
5.5.0.Final
-
None
-
None
Description
I have quite a few rules that look like this:
rule "if foo then bar" when Foo($a : a, $b : b) not Bar(a == $a, b == $b) then insert(new Bar($a, $b)); end
This is a fairly common pattern for me: a rule should not activate if the facts generated by its consequence were already asserted. It's a pattern I use extensively to generate linear (i.e. non-repeating) workflows.
Ideally I'd be able to express it as follows:
rule "if foo then bar" condition-on-inverse-of-consequence when Foo($a : a, $b : b) then insert(new Bar($a, $b)); end
And condition-on-inverse-of-consequence would cause Drools to generate the right kind of condition, which would be the inverse of the fact changes made by the consequence.
I think lock-on-active is similar but harsher: it prevents the rule from firing a second time altogether, regardless of input. At least, that's based on my reading of the docs. In my example, that would be equivalent to not Bar() condition in the rule, which is stricter than not Bar(a == $a, b == $b).
Attachments
Issue Links
- is incorporated by
-
DROOLS-370 Declarative Agenda control does not support all possible constraints
- Resolved