[jboss-jira] [JBoss JIRA] Created: (JBRULES-837) Collect keyword matches two conflicting rules
Viktor Nordling (JIRA)
jira-events at lists.jboss.org
Wed May 2 07:48:30 EDT 2007
Collect keyword matches two conflicting rules
---------------------------------------------
Key: JBRULES-837
URL: http://jira.jboss.com/jira/browse/JBRULES-837
Project: JBoss Rules
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: 3.1-m1
Environment: java 1.5
Reporter: Viktor Nordling
Assigned To: Mark Proctor
If you have two rules:
rule "A"
when
$a : ArrayList( size:size == 2 ) from collect (Car())
then
System.out.println("A: size = " + size);
end
rule "B"
when
$b : ArrayList( size:size == 3 ) from collect (Car())
then
System.out.println("B: size = " + size);
end
And you put two Cars in working memory, both A and B will be fired. Since there are two cars in working memory, only rule A should be fired.
If you change the order of the rules, or make rule A match size == 3 and rule B match size == 2, no rules will be fired instead.
The only workaround found is to add some criteria for the Car, in ONE of the rules. If rule A for example is:
rule "A"
when
$a : ArrayList( size:size == 2 ) from collect (Car(color == "RED"))
then
System.out.println("A: size = " + size);
end
Then only rule A will be fired. If the same criteria is also added in rule B, both rules will be fired again.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list