Here is a simpler example where the behavior differs depending on whether you assert the fact first or load the rules first. This is just a simple fact class with a string variable called field1. I create and assert the fact with the string "hello" for field1, then I load the following rule file:
<br><br>package com.vsasset.rules.isolate;<br>import java.lang.String;<br><br>rule &quot;simpleDependence&quot;<br>no-loop true<br>&nbsp;&nbsp;&nbsp; when<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a: factA(field1==&quot;hello&quot;)<br>&nbsp;&nbsp;&nbsp; then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a.setField1
(&quot;world&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; modify(a);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(&quot;a: &quot; + a.getField1());<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TestCase.fireRules();<br>end<br>rule &quot;simpleRetract&quot;<br>no-loop true<br>&nbsp;&nbsp;&nbsp; when<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a: factA(field1 == &quot;world&quot;)
<br>&nbsp;&nbsp;&nbsp; then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; retract(a);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(&quot;Retracted a&quot;);<br>end<br><br><br>The second rule (simpleRetract) does not print when the initial factA is asserted before the rules are loaded. If the rules are loaded first, then the second rule prints.
<br><br>To be honest, I&#39;m not sure whether to expect the second rule to print -- does it get immediately de-activated upon the retract so that any further statements are not executed?<br><br>In any event, I would expect the behavior to be the same whether I assert factA first or load the rules first. 
<br><br>Am I missing something fundamental? Perhaps I am mis-using the API...<br><br>Thanks,<br>Justine<br><br>