<html><body>
<DIV>The default - identity.</DIV>
<DIV>&nbsp;</DIV>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">-------------- Original message -------------- <BR>From: "Fenderbosch, Eric" &lt;Eric.Fenderbosch@fedex.com&gt; <BR>
<META content="MSHTML 6.00.2900.3354" name=GENERATOR>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN class=750571814-04082008>How is your rule base configured, with identity or equality assert behavior?</SPAN></FONT></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] <B>On Behalf Of </B>ringsah@comcast.net<BR><B>Sent:</B> Monday, August 04, 2008 9:59 AM<BR><B>To:</B> Rules Users List<BR><B>Subject:</B> Re: [rules-users] "Not" Non-Existential Quantifier<BR></FONT><BR></DIV>
<DIV>&nbsp;</DIV>
<DIV>
<DIV>Edson,</DIV>
<DIV>&nbsp;</DIV>
<DIV>I finally succeeded in coming up with a simple test case that shows the problem. I have attached the necessary files, which include a test case, three fact objects, and the drl.</DIV>
<DIV>&nbsp;</DIV>
<DIV>One&nbsp;key to this test are the fact that the Applicant fact object has an "equals" method that tests for equality of its attributes, rather than identity.&nbsp;A second&nbsp;key is that the applicant object is updated after it is inserted.</DIV>
<DIV>&nbsp;</DIV>
<DIV>It appears that what is happening is that an activation is created for the rule that uses "not" when the applicant is inserted. Then, when the applicant is updated, a second activation is created for that rule. It should be cancelling the previous activation, but doesn't find it because the Applicant instance no longer "equals" the fact object that caused the activation.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks!</DIV>
<DIV>-Hans</DIV>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">-------------- Original message -------------- <BR>From: "Edson Tirelli" &lt;tirelli@post.com&gt; <BR>
<DIV dir=ltr><BR>&nbsp;&nbsp; Hans, <BR><BR>&nbsp;&nbsp; Your reasoning is correct. There should not be 2 instances of ApplicantStatus in the working memory. <BR><BR>&nbsp;&nbsp; Can you provide a test case showing the problem? we have test cases here using "not" and logical assertions, and it works properly.<BR><BR>&nbsp;&nbsp; Thanks,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Edson<BR><BR>
<DIV class=gmail_quote>2008/7/31 <SPAN dir=ltr>&lt;<A href="mailto:ringsah@comcast.net">ringsah@comcast.net</A>&gt;</SPAN><BR>
<BLOCKQUOTE class=gmail_quote style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV><FONT size=2>
<P>How is "</P></FONT><FONT face="Courier New" size=2>not</FONT><FONT size=2>" supposed to work with </FONT><FONT face="Courier New" size=2>insertLogical</FONT><FONT size=2>? Assume I have two different rules whose conditions are mutually exclusive, like the following:</FONT><B><FONT face="Courier New" color=#960000 size=2> 
<P>rule</P></FONT></B><FONT face="Courier New" size=2></FONT><FONT face="Courier New" color=#008000 size=2>"</FONT><FONT face="Courier New" color=#008000 size=2>Rule One</FONT><FONT face="Courier New" color=#008000 size=2>"</FONT><FONT face="Courier New" size=2> 
<P></P></FONT><B><FONT face="Courier New" color=#960000 size=2>when</FONT></B><FONT face="Courier New" size=2> 
<P></P></FONT><FONT face="Courier New" size=2>not NegativeResult()</FONT><FONT face="Courier New" size=2> 
<P></P></FONT><B><FONT face="Courier New" color=#960000 size=2>then</FONT></B><FONT face="Courier New" size=2> 
<P></P></FONT><B><FONT face="Courier New" color=#960000 size=2>insertLogical</FONT></B><FONT face="Courier New" size=2>(</FONT><FONT face="Courier New" size=2>new ApplicantStatus("Approved")</FONT><FONT face="Courier New" size=2>);</FONT><B><FONT face="Courier New" color=#960000 size=2> 
<P>end</P></FONT></B><FONT face="Courier New" size=2></FONT><B><FONT face="Courier New" color=#960000 size=2>
<P>rule</P></FONT></B><FONT face="Courier New" size=2></FONT><FONT face="Courier New" color=#008000 size=2>"</FONT><FONT face="Courier New" color=#008000 size=2>Rule Two</FONT><FONT face="Courier New" color=#008000 size=2>"</FONT><FONT face="Courier New" size=2> 
<P></P></FONT><B><FONT face="Courier New" color=#960000 size=2>when</FONT></B><FONT face="Courier New" size=2> 
<P></P></FONT><FONT face="Courier New" size=2>NegativeResult()</FONT><FONT face="Courier New" size=2> 
<P></P></FONT><B><FONT face="Courier New" color=#960000 size=2>then</FONT></B><FONT face="Courier New" size=2> 
<P></P></FONT><B><FONT face="Courier New" color=#960000 size=2>insertLogical</FONT></B><FONT face="Courier New" size=2>(</FONT><FONT face="Courier New" size=2>new ApplicantStatus("Denied")</FONT><FONT face="Courier New" size=2>);</FONT><B><FONT face="Courier New" color=#960000 size=2> 
<P>end</P></FONT></B><FONT face="Courier New" size=2></FONT><FONT size=2>
<P>Assume that the above two rules are the only way an </P></FONT><FONT face="Courier New" size=2>ApplicantStatus</FONT><FONT size=2> fact can be inserted into working memory. I would expect, after all rules are run, that it would be impossible for there to be one </FONT><FONT face="Courier New" size=2>ApplicantStatus</FONT><FONT size=2> with </FONT><FONT face="Courier New" size=2>"Approved"</FONT><FONT size=2> as its reason, and another with </FONT><FONT face="Courier New" size=2>"Denied"</FONT><FONT size=2> as its reason, in the working memory. 
<P>I would expect that, before any </P></FONT><FONT face="Courier New" size=2>NegativeResult</FONT><FONT size=2> is inserted, that rule one could run, and insert an </FONT><FONT face="Courier New" size=2>ApplicantStatus</FONT><FONT size=2> fact with an </FONT><FONT face="Courier New" size=2>"Approved"</FONT><FONT size=2> reason. Then, after a </FONT><FONT face="Courier New" size=2>NegativeResult</FONT><FONT size=2> is inserted, that rule two could run, and insert an </FONT><FONT face="Courier New" size=2>ApplicantStatus</FONT><FONT size=2> fact with a </FONT><FONT face="Courier New" size=2>"Denied"</FONT><FONT size=2> reason. At this point I would expect that the original </FONT><FONT face="Courier New" size=2>ApplicantStatus</FONT><FONT size=2> fact, with an </FONT><FONT face="Courier New" size=2>"Approved"</FONT><FONT size=2> reason, would be retracted, since the conditions under which it was inserted are no lon! ger true. 
<P>This is not what I am observing, however. I am finding </P></FONT><FONT face="Courier New" size=2>ApplicantStatus</FONT><FONT size=2> facts with both reasons in working memory at the end of the rules run. Should "not" work as I expect with regard to inserting a fact via </FONT><FONT face="Courier New" size=2>insertLogical()</FONT><FONT size=2>? Or is this a known limitation, or simply the way it is designed to work? 
<P>Thanks,</P>
<P>-Hans</P></FONT></DIV></DIV><BR>_______________________________________________<BR>rules-users mailing list<BR><A href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR><A href="https://lists.jboss.org/mailman/listinfo/rules-users" target=_blank>https://lists.jboss.org/mailman/listinfo/rules-users</A><BR><BR></BLOCKQUOTE></DIV><BR><BR clear=all><BR>-- <BR>Edson Tirelli<BR>JBoss Drools Core Development<BR>JBoss, a division of Red Hat @ <A href="http://www.jboss.com/">www.jboss.com</A><BR></DIV></BLOCKQUOTE></DIV></BLOCKQUOTE></body></html>