Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-330

Rule Inheritance using Extends keyword fails when the Sub Rule Appears before the Super Rule

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Minor
    • 5.5.1.Final, 6.0.0.Final
    • 5.5.0.Final
    • None
    • None
    • Hide

      I have a junit test packaged for Maven and Eclipse, but I don't see any place to add the file.

      Setup 2 .drl files where rule sub extends rule super. Setup a boolean that is true for the sub, but false for the super.

      In the first file, place the sub before the super. In the second file, reverse the two.

      Observe that the sub fires when it is in the file before the super, but not after.

      Show
      I have a junit test packaged for Maven and Eclipse, but I don't see any place to add the file. Setup 2 .drl files where rule sub extends rule super. Setup a boolean that is true for the sub, but false for the super. In the first file, place the sub before the super. In the second file, reverse the two. Observe that the sub fires when it is in the file before the super, but not after.
    • Workaround Exists
    • Hide

      A temporary workaround is to list all SubRules after the SuperRules.

      Show
      A temporary workaround is to list all SubRules after the SuperRules.

    Description

      In Drools 5.5.0.Final the extends keyword allows one rule (SubRule) to extend another rule (SuperRule). SubRule should only fire if all of the conditions for SubRule and SuperRule are met.

      If SubRule is listed after SuperRule after in the .drl file, then it works correctly. However, if SubRule is listed before SuperRule in the .drl file, then only the SubRule's conditions need to be met for the rule to fire.

      A temporary workaround is to list all SubRules after the SuperRules.

      This might be related to: https://issues.jboss.org/browse/DROOLS-100

      To reproduce:
      I have a junit test packaged for Maven and Eclipse, but I don't see any place to add the file.

      Create 2 .drl files where rule "sub" extends rule "super". Setup a boolean that is true for the sub, but false for the super.

      In the first file, place the sub before the super. In the second file, reverse the two.

      Observe that the sub fires when it is in the file before the super, but not after. It should not fire either time.

      Attachments

        Activity

          People

            mfusco@redhat.com Mario Fusco
            mikefauzy Mike Fauzy (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: