[jboss-jira] [JBoss JIRA] (DROOLS-3510) Decision table unable to generate rule for row with pattern without constraint

Mario Fusco (Jira) issues at jboss.org
Fri Jan 3 12:16:00 EST 2020


    [ https://issues.redhat.com/browse/DROOLS-3510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13941150#comment-13941150 ] 

Mario Fusco commented on DROOLS-3510:
-------------------------------------

I reproduced the problem with the 'MissingConstraint.xls' decision table that I attached (the original provided one was malformed). This dtable generates the following drl

{code}
package rule_table;
//generated from Decision Table
// rule values at B6, header at B1
rule "Test_6"
	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 values at B7, header at B1
rule "Test_7"
	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 values at B8, header at B1
rule "Test_8"
	when
		$numberOfFactsB: Number(this > 2, this <= 3) from accumulate(FactB(x == 1) from $factA.listOfFactsB,count(1))
	then
		insert(Y);
end
{code}

I understand that in the 3rd rule it should add pattern FactA() with no constraint while at the moment is totally skipping it. I need to double check if this change could break any backward compatibility.

> Decision table unable to generate rule for row with pattern without constraint
> ------------------------------------------------------------------------------
>
>                 Key: DROOLS-3510
>                 URL: https://issues.redhat.com/browse/DROOLS-3510
>             Project: Drools
>          Issue Type: Bug
>          Components: decision tables
>    Affects Versions: 7.15.0.Final
>            Reporter: Andre Piwoni
>            Assignee: Mario Fusco
>            Priority: Minor
>         Attachments: MissingConstraint.xls, failingDecisionTable.xlsx
>
>
> 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:
> {code:java}
> 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
> {code}
> Also, there does not seem an alternative way to generate following rule using decision table:
> {code:java}
> rule "Test"
> 	when
> 		$factA:FactA($factsB: listOfFactsB)
> 		$numberOfFactsB: Number(this > 1) from accumulate(FactB(x == 1) from $factsB,count(1))	
> 	then
> 		insert(Y);
> end
> {code}



--
This message was sent by Atlassian Jira
(v7.13.8#713008)


More information about the jboss-jira mailing list