[jboss-jira] [JBoss JIRA] (DROOLS-3853) Ability to override existing rules with rules

Vaclav Carnogursky (Jira) issues at jboss.org
Wed Apr 3 11:12:02 EDT 2019


Vaclav Carnogursky created DROOLS-3853:
------------------------------------------

             Summary: Ability to override existing rules with rules
                 Key: DROOLS-3853
                 URL: https://issues.jboss.org/browse/DROOLS-3853
             Project: Drools
          Issue Type: Feature Request
          Components: core engine
            Reporter: Vaclav Carnogursky
            Assignee: Mario Fusco


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.



--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the jboss-jira mailing list