2009/11/26 Leonardo Gomes <span dir="ltr">&lt;<a href="mailto:leonardo.f.gomes@gmail.com">leonardo.f.gomes@gmail.com</a>&gt;</span><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br><br><div class="gmail_quote">On Tue, Nov 24, 2009 at 10:42 PM, Leonardo Gomes <span dir="ltr">&lt;<a href="mailto:leonardo.f.gomes@gmail.com" target="_blank">leonardo.f.gomes@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">H<br>Now, let&#39;s say FactA(1) indicates a fact of type FactA and id = 1.<br>

<br>- Then, in the beginning, I insert FactA(1) and FactA(2) in my working memory and fire the rules.<br><br>rule &quot;test non existence&quot;<br>when<br>    not FactA( id == 4 )<br>then<br>    output.add(&quot;there&#39;s no FactA id 4&quot;);<br>
<br>- This rule is fired and the message is added to my output object.<br><br>

Later on, I have a notification that a FactA has changed, then I:<br>- retract all FactAs from my working memory<br>- clear all FactA-related messages from my output object<br>- reload FactAs (let&#39;s say now I have FactA(1), FactA(3), but NOT FactA(4))<br>


- reinsert them in the WM<br>- fire the rules<br><br>The rule that checks that there&#39;s no FactA(4) doesn&#39;t refire. </blockquote></div></blockquote><div><br>Why should it? The truth of the non-existance of FactA(4) has been established, and this truth never changed, certainly not by removing any FactA(n) and also not by inserting any FactA(x) with x!= 4.<br>
<br>As a solution, you could<br>- establish an explicit fact, asserted in rule &quot;test non existence&quot; and retracted by a rule checking the negated condition;<br>- add a Trigger fact to rule &quot;test non existence&quot; which you modify after each reload of the FactA set<br>
- do something else which I&#39;m not clever enough to think about at the moment<br><br>-W<br><br><br> </div></div><br>