<div> </div>
<div>Thank You guys.</div>
<div> </div>
<div>I worked it out. I have the contracts (main and related) encapsulated within a parent object.</div>
<div>So, once I did the assertion I checked the "pattern matched" fact agains the parent object.</div>
<div> </div>
<div>Thank You again.</div>
<div> </div>
<div>This ML is always usefull as usual!</div>
<div> </div>
<div>I really hope to be usefull as well to the few I can answer back.</div>
<div> </div>
<div>Bye</div>
<div> </div>
<div>Massi</div>
<div><br><br> </div>
<div class="gmail_quote">On Jan 7, 2008 9:27 PM, Mark Proctor <<a href="mailto:mproctor@codehaus.org">mproctor@codehaus.org</a>> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div text="#000000" bgcolor="#ffffff">rules are just querries over data, like a database view.<br>Ask yourself this. If you asserted those two objects, A1 and A2, into a database and you had two views V1 and V2. How would you make V1 select A1 and V2 select A2?
<br><br>When you have the answer for that, it'll apply to Drools too.<br><br>Mark<br>Massi Gmail wrote:
<blockquote type="cite">
<div>
<div></div>
<div class="Wj3C7c">
<div><font face="Arial" size="2">ok</font></div>
<div> </div>
<div><font face="Arial" size="2">But i think I do not need to differentiate them.</font></div>
<div> </div>
<div><font face="Arial" size="2">I try to explain it better.</font></div>
<div> </div>
<div><font face="Arial" size="2">I have got a set of "Contract" class Facts. All of them inserted into the working memory.</font></div>
<div> </div>
<div><font face="Arial" size="2">But Just one of them is the "main contract", all the others all "related contracts".</font></div>
<div> </div>
<div><font face="Arial" size="2">So , when i write a rule I need to distinguish between a "main contract" (which is unique along the session) </font></div>
<div><font face="Arial" size="2">and a "related contract".</font></div>
<div> </div>
<div><font face="Arial" size="2">I should write rules like the followings:</font></div>
<div> </div>
<blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
<div><font face="Arial" size="2"><em>when</em></font></div>
<div><font face="Arial" size="2"><em> $mc: Contract() from maincontract</em></font></div>
<div><font face="Arial" size="2"><em>then</em></font></div>
<div><font face="Arial" size="2"><em> #rule fired over "the" main contract</em></font></div>
<div><font face="Arial" size="2"><em>end</em></font></div>
<div><font face="Arial" size="2"><em></em></font> </div>
<div><font face="Arial" size="2"><em>when</em></font></div>
<div><font face="Arial" size="2"><em> $rc: Contract() from relatedcontract</em></font></div>
<div><font face="Arial" size="2"><em>then</em></font></div>
<div><font face="Arial" size="2"><em> #rule fired over "a" related contract</em></font></div>
<div><font face="Arial" size="2"><em>end</em></font></div></blockquote>
<div><font face="Arial" size="2">I think the only solution to do that is to make "maincontract" and "relatedcontracr" globals.</font></div>
<div><font face="Arial" size="2">But, if I make them globals, then the rule engine will not be notified about their changes and</font></div>
<div><font face="Arial" size="2">I do want it to be notified about it. </font></div>
<div> </div>
<div><font face="Arial" size="2">Should I make them "globals" and "facts" as well?</font></div>
<div><font face="Arial" size="2">Can globals be inserted into the WM as well? Is it too horrible? :D</font></div>
<div> </div>
<div><font face="Arial" size="2">Thank u anyway.</font></div>
<div> </div>
<div><font face="Arial" size="2">Massi</font></div>
<div> </div>
<blockquote style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(0,0,0) 2px solid; MARGIN-RIGHT: 0px">
<div style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal">----- Original Message ----- </div>
<div style="BACKGROUND: rgb(228,228,228) 0% 50%; FONT: 10pt arial; font-size-adjust: none; font-stretch: normal"><b>From:</b> <a title="tirelli@post.com" href="mailto:tirelli@post.com" target="_blank">Edson Tirelli</a> </div>
<div style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal"><b>To:</b> <a title="rules-users@lists.jboss.org" href="mailto:rules-users@lists.jboss.org" target="_blank">Rules Users List</a> </div>
<div style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal"><b>Sent:</b> Saturday, January 05, 2008 12:00 PM</div>
<div style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal"><b>Subject:</b> Re: [rules-users] Checking fact "id"</div>
<div><br></div><br> What attribute differentiates A1 from A2? <br> Such scenarios usually are solved by an additional constraint...<br><br> []s<br> Edson<br><br>
<div><span class="gmail_quote">2008/1/4, Massi Gmail <<a href="mailto:mmquelo@gmail.com" target="_blank"> mmquelo@gmail.com</a>>:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<div bgcolor="#ffffff">
<div> </div>
<div><font face="Arial" size="2">Hi guys,</font></div>
<div> </div>
<div><font face="Arial" size="2">Now I am strugglin' with "fact id checking" or whatever we can call it.... :D</font></div>
<div> </div>
<div><font face="Arial" size="2">Let's take into account the followong scenario:</font></div>
<div> </div>
<div><font face="Arial" size="2">I have class A (it's just a name) javabeans to be inserted into the WM.</font></div>
<div> </div>
<div><font face="Arial" size="2">I define two objects of class A: A1 and A2.</font></div>
<div> </div>
<div><font face="Arial" size="2">Somewhere I do "insert(A1)" and "insert(A2)" ( let's say I do it in the same package of R1 and R2..see below...) </font></div>
<div> </div>
<div><font face="Arial" size="2">Then I define two different rules R1 and R2 that reason over class "A" facts (let's say R1 and R2 are in the same package) .</font></div>
<div> </div>
<div><font face="Arial" size="2">The point is.... I want R1 to fire only on A1 and R2 only on A2.</font></div>
<div> </div>
<div><font face="Arial" size="2">Is that possible in drools? Is there a sort of "fact id" I can reason over?</font></div>
<div> </div>
<div><font face="Arial" size="2">I do not think globals will be of any help, cause in the guide i have read that globals should never be used within LHS.</font></div>
<div><font face="Arial" size="2">We should never reason over globals. </font></div>
<div> </div>
<div><font face="Arial" size="2">Let me know.</font></div>
<div> </div>
<div><font face="Arial" size="2">Massi</font></div>
<div> </div>
<div> </div></div><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><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646
<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com/" target="_blank">www.jboss.com</a>
<p></p>
<hr>
_______________________________________________<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></blockquote></div></div><pre><hr width="90%" size="4"><div class="Ih2E3d">
_______________________________________________
rules-users mailing list
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</div></pre></blockquote><br></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>