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

Decision table unable to generate rule for row with pattern without constraint

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Explained
    • Affects Version/s: 7.15.0.Final
    • Fix Version/s: None
    • Component/s: decision tables
    • Labels:
      None

      Description

      When second condition refers to a field of a variable bound in first condition and there exists row/rule without condition constraint than decision table compiler fails to generate rules. See attachment.

      Expected rules to be generated:

      rule "Test_1"
      	when
      		$factA:FactA(hasSomething == "true")
      		$numberOfFactsB: Number(this > 0, this <= 1) from accumulate(FactB(x == 1) from $factA.listOfFactsB,count(1))	
      	then
      		insert(X);
      end
      
      rule "Test_2"
      	when
      		$factA:FactA(hasSomething == "true")
      		$numberOfFactsB: Number(this > 1, this <= 2) from accumulate(FactB(x == 1) from $factA.listOfFactsB,count(1))	
      	then
      		insert(X);
      end
      
      rule "Test_3"
      	when
      		$factA:FactA()
      		$numberOfFactsB: Number(this > 2, this <= 3) from accumulate(FactB(x == 1) from $factA.listOfFactsB,count(1))	
      	then
      		insert(Y);
      end
      
      

      Also, there does not seem an alternative way to generate following rule using decision table:

      rule "Test"
      	when
      		$factA:FactA($factsB: listOfFactsB)
      		$numberOfFactsB: Number(this > 1) from accumulate(FactB(x == 1) from $factsB,count(1))	
      	then
      		insert(Y);
      end
      

        Attachments

        1. DummyConstraint.xls
          7 kB
        2. failingDecisionTable.xlsx
          25 kB
        3. MissingConstraint.xls
          6 kB

          Activity

            People

            Assignee:
            mfusco@redhat.com Mario Fusco
            Reporter:
            apiwoni Andre Piwoni (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: