[jboss-jira] [JBoss JIRA] Closed: (JBRULES-744) New elements added to a Shadow Fact's List do not trigger activations on rules using contains

Edson Tirelli (JIRA) jira-events at lists.jboss.org
Thu May 3 17:15:30 EDT 2007


     [ http://jira.jboss.com/jira/browse/JBRULES-744?page=all ]

Edson Tirelli closed JBRULES-744.
---------------------------------

    Resolution: Rejected

Michael,

Remember that if you want the engine to react to a change in a fact, you must call modify() on the fact so the engine knows it was modified. 
Add a modify() call to your rule:

rule "Test 1a (Fired)"
    no-loop true
when
	$m : Machine ( )
then
	System.out.println("DEBUG [Rule 1a]---> Adding new Attribute(\"TEST3\") to Machine");
	Attribute a = new Attribute("TEST3", 100);
	$m.addAttribute(a);
	modify( $m );
	assert(a);
end

And it will work as expected. For this specific case, the no-loop attribute avoids the infinite loop.




> New elements added to a Shadow Fact's List do not trigger activations on rules using contains
> ---------------------------------------------------------------------------------------------
>
>                 Key: JBRULES-744
>                 URL: http://jira.jboss.com/jira/browse/JBRULES-744
>             Project: JBoss Rules
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 3.1-m1, 3.0.5
>         Environment: Windows XP SP2, Java 1.5
>            Reporter: Michael Anstis
>         Assigned To: Edson Tirelli
>         Attachments: drools-jira.jar
>
>
> Example scenario: A Fact X has a property C which is a collection. Rule 1 operates on Fact X and adds (and asserts) a new element Y to collection C. Another Rule 2 which has a pattern "X ( C contains Y) does not get activated. Rules which have a pattern "Y" do activate. See attached example code to replicate.

-- 
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