<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
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 cite="mid:E68CB37372DD4239806E345C6ABB6E70@vaiommquelo"
type="cite">
<meta http-equiv="Content-Type" content="text/html; ">
<meta content="MSHTML 6.00.6000.16587" name="GENERATOR">
<style></style>
<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="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div
style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">-----
Original Message ----- </div>
<div
style="background: rgb(228, 228, 228) none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>From:</b>
<a moz-do-not-send="true" title="tirelli@post.com"
href="mailto:tirelli@post.com">Edson Tirelli</a> </div>
<div
style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>To:</b>
<a moz-do-not-send="true" title="rules-users@lists.jboss.org"
href="mailto:rules-users@lists.jboss.org">Rules Users List</a> </div>
<div
style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Sent:</b>
Saturday, January 05, 2008 12:00 PM</div>
<div
style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; 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
moz-do-not-send="true" href="mailto:mmquelo@gmail.com">
mmquelo@gmail.com</a>>:</span>
<blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<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 moz-do-not-send="true"
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a moz-do-not-send="true"
onclick="return top.js.OpenExtLink(window,event,this)"
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 moz-do-not-send="true"
href="http://www.jboss.com">www.jboss.com</a>
<p> </p>
<hr> _______________________________________________<br>
rules-users mailing list<br>
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote>
<pre wrap="">
<hr size="4" width="90%">
_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
</blockquote>
<br>
</body>
</html>