<div> DroolsWorkingMemory is our custom class which contains asserted facts and other custom objects based on our project requirement. It should not be confused with <font size="2">&quot;WorkingMemory&quot; of Drools.</font></div>

<div> </div>
<div>For issue 1, I assume that if I overwrite one field in ConcreteType1 to a different value than that in BaseType, they are treated as diferrent objects. Consider the xml snapshot of the two objects for eg:</div>
<div><font size="2">
<p align="left"><strong>BaseType</strong> object:</p>
<p align="left">&lt;com.parentchild.BaseType&gt;<br>    &lt;Boolean&gt;false&lt;/Boolean&gt;<br>    &lt;Date&gt;2010-04-09T00:00:00&lt;/Date&gt;<br>    &lt;String&gt;a&lt;/String&gt;<br>    &lt;Double&gt;0.0&lt;/Double&gt;<br>
&lt;/com.parentchild.BaseType&gt;</p>
<p align="left"><strong>ConcreteType1</strong> object:</p>
<p align="left">&lt;com.parentchild.ConcreteType1&gt;<br>    &lt;Boolean&gt;false&lt;/Boolean&gt;<br>    &lt;Date&gt;2010-04-09T00:00:00&lt;/Date&gt;<br>    &lt;String&gt;b&lt;/String&gt;<br>    &lt;Double&gt;0.0&lt;/Double&gt;<br>
    &lt;ConcreteType1Boolean&gt;false&lt;/ConcreteType1Boolean&gt;<br>&lt;/com.parentchild.ConcreteType1&gt;</p>
<p align="left">so I assume I have two objects BaseType(with value of String as &quot;a&quot;) and ConcreteType1 object (with value of String as &quot;b&quot;). The rule should evaluate to false on the above assumption.</p>

<p align="left">For issue 2, Sorry If i have misled, my only question was why does the Tuple inside Agenda Item show only ConcreteType1 and not the BaseType, If both of them are inserted in WorkingMemory. Doesn&#39;t the tuple contain all the objects inserted in WM.</p>

<p align="left"></p></font><br clear="all">Regards,<br><br>Rajnikant Gupta<br><br><br><br></div>
<div class="gmail_quote">2010/4/9 Wolfgang Laun <span dir="ltr">&lt;<a href="mailto:wolfgang.laun@gmail.com">wolfgang.laun@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Regarding Issue 1:<br>Even if you do have different objects of ConcreteType1, the rule is fired for each of them, since each of these is equal to itself in terms of the BaseType.<br>
<br>I also fail to understand Issue 2. But perhaps your misconception about base type and subtype matching is also responsible for that.<br><br>Rule &quot;s&quot; looks strange for more than one reason. What is the DroolsWorkingMemory() pattern supposed to achieve? Is it a general trigger so that the rule only fires if one such object is present?<br>
<br>Leaving base and extended types aside, testing for the equality of two objects of the same type must be done much more carefully. Assuming three objects of TypeX, x1, x2, x3 with x1.equals(x2) and NOT x1.equals(x3) and a rule like this:<br>
<br>rule &quot;xxx&quot;<br>when<br>   o1 : TypeX()<br>   o2 : TypeX()<br>   eval( o1.equals( o2 ) )<br>then<br>  ...<br><br>This rule will fire 5 times, with the following activations:<br>   &lt;x1,x1&gt;, &lt;x2,x2&gt;, &lt;x3,x3&gt;, &lt;x1,x2&gt;, &lt;x2,x1&gt;.<br>
<br>Using, e.g.,<br>   o2:TypeX( this != o1 ) <br>reduces this to two firings.<br><br>-W<br><br><br>
<div class="gmail_quote">2010/4/9 Rajnikant Gupta <span dir="ltr">&lt;<a href="mailto:capricorn.raj@gmail.com" target="_blank">capricorn.raj@gmail.com</a>&gt;</span> 
<div>
<div></div>
<div class="h5"><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid"><font size="1">
<div align="left"><font face="arial,helvetica,sans-serif" size="2">Hi,</font></div>
<div align="left"><b></b> </div>
<div align="left"><font face="arial,helvetica,sans-serif" size="2">Sorry for not being very clear. Here&#39;s the rule which I run:</font></div>
<div align="left"><b></b> </div>
<div align="left"><b></b> </div>
<div align="left"><b>package rr</b></div>
<div align="left"><b>import com.thirdpillar.common.util.DroolsWorkingMemoryimport com.parentchild.BaseType</b></div>
<div align="left"><b>import com.parentchild.ConcreteType1 </b></div>
<div align="left"><b></b> </div>
<div align="left"><b>rule &quot;s&quot;</b></div>
<div align="left"><b>no-loop true </b></div>
<div align="left"><b>salience 999999 </b></div>
<div align="left"><b></b> </div>
<div align="left"><b>when</b></div>
<div align="left"><b>DroolsWorkingMemory:DroolsWorkingMemory()</b></div>
<div align="left"><b>BaseType:BaseType()</b></div>
<div align="left"><b>ConcreteType1:ConcreteType1()</b></div>
<div align="left"><b>eval (</b></div>
<div align="left"><b>(</b></div>
<div align="left"><b>((BaseType.equals(ConcreteType1)))</b></div>
<div align="left"><b>)</b></div>
<div align="left"><b>)</b></div>
<div align="left"><b>then</b></div>
<div align="left"><b>BaseType.setString(&quot;Blah Blah!&quot;);</b></div>
<div align="left"><b>end </b></div></font>
<div> </div>
<div><font face="arial,helvetica,sans-serif">where <b>ConcreteType1 </b>extends </font><b><font face="arial,helvetica,sans-serif">BaseType.</font> </b></div>
<div><b></b> </div>
<div><u>Issues:</u></div>
<div>1. Even for different values for fields in <b>ConcreteType1</b> and <b>BaseType, </b>the rule gets fired. </div>
<div> </div>
<div>2. I also do audit for the rules for which i need tuples so that I can extract the objects out of it and evaluate the expression against Mvel. But the tuple shows me only the <b>ConcreteType1</b> instance not the <b>BaseType. </b>Thus getting wrong audit.</div>

<div><br clear="all">Regards,<br><br>Rajnikant Gupta<br>Sr. Software Engineer<br>GlobalLogic,Noida<br>09899530562<br><br><a href="http://rkthinks.wordpress.com/" target="_blank">http://rkthinks.wordpress.com/</a><br><br>
<br></div>
<div class="gmail_quote">2010/4/9 Greg Barton <span dir="ltr">&lt;<a href="mailto:greg_barton@yahoo.com" target="_blank">greg_barton@yahoo.com</a>&gt;</span> 
<div>
<div></div>
<div><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<table cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td valign="top">We need some rule code to get a better idea of what&#39;s going on.  Can you post some?<br><br>--- On <b>Thu, 4/8/10, Rajnikant Gupta <i>&lt;<a href="mailto:capricorn.raj@gmail.com" target="_blank">capricorn.raj@gmail.com</a>&gt;</i></b> wrote:<br>

<blockquote style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solid"><br>From: Rajnikant Gupta &lt;<a href="mailto:capricorn.raj@gmail.com" target="_blank">capricorn.raj@gmail.com</a>&gt;<br>Subject: [rules-users] Tuples in Agenda Item.<br>
To: <a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>Date: Thursday, April 8, 2010, 1:36 PM 
<div>
<div></div>
<div><br><br>
<div>
<div> </div>
<div>Hi,</div>
<div> <br>I have a doubt regarding tuples. I created a rule using complex types objects. I am comparing two complex type objecs which have parent-child relationship eg. &quot;ParentType.equals(ChildType)&quot;. I expect this to follow java rule which allows such comparision. Now when I run the rules with different values for fields in ParentType and ChildType (which means the rule should fail) to my surprise it evals to TRUE. Also upon inspection, the tuple shows me only the ChildType instance not the ParentType. <br>
 <br>I would appreciate any help on this.</div>
<div> </div>
<div><br clear="all">Regards,<br><br>Rajnikant</div></div><br></div></div>-----Inline Attachment Follows-----<br><br>
<div>_______________________________________________<br>rules-users mailing list<br><a href="http://mc/compose?to=rules-users@lists.jboss.org" target="_blank">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>
</div></blockquote></td></tr></tbody></table><br><br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org" target="_blank">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></div></div><br><br>_______________________________________________<br>
rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org" target="_blank">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></div></div><br><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>