Details
-
Feature Request
-
Resolution: Unresolved
-
Minor
-
None
-
None
-
None
-
NEW
-
NEW
Description
I would be nice to have ability to override a rule defined in one KIE base with a rule defined in another KIE base. In Drools 5 it was possible to misuse a bug which didn't check for identical rules named to override them by using the same rule name with an appropriate drl file load order.
This has already been brought up here but I think an actual feature
request was never created https://groups.google.com/forum/#!searchin/drools-usage/overriding%7Csort:date/drools-usage/mvpBoVFZblk/FX-vkYxHBQAJ
Use case
Need to build a layered set of rules where extending layers may need to
override existing rules in the lower layers. I want to avoid rule duplication
(majority of rules would have to be duplicated) so prefer the layers.
Usage
Annotate a rule with @Override.
Workaround
Beyond the obvious rule packaging change to copy all rules instead of building layers I think it would be possible to do following:
To override a conflicting rule the resulting facts must be inserted logically
and rules annotated as @Defeasible. An overriding rule must have @Defeats("base rule").
This approach might not work for all scenarios.