<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16587" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>ok</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>But i think I do not need to differentiate 
them.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I try to explain it better.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</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><FONT face=Arial size=2></FONT>&nbsp;</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><FONT face=Arial size=2></FONT>&nbsp;</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><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I should write rules like the 
followings:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</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>&nbsp;&nbsp;&nbsp; $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>&nbsp;&nbsp;&nbsp; #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>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2><EM>when</EM></FONT></DIV>
  <DIV><FONT face=Arial size=2><EM>&nbsp;&nbsp; $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>&nbsp;&nbsp; #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&nbsp;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><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Should I make them "globals" and&nbsp;"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><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Thank u anyway.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Massi</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<BLOCKQUOTE 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
  <A title=tirelli@post.com href="mailto:tirelli@post.com">Edson Tirelli</A> 
  </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A title=rules-users@lists.jboss.org 
  href="mailto:rules-users@lists.jboss.org">Rules Users List</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Saturday, January 05, 2008 12:00 
  PM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [rules-users] Checking fact 
  "id"</DIV>
  <DIV><BR></DIV><BR>&nbsp;&nbsp; What attribute differentiates A1 from A2? 
  <BR>&nbsp;&nbsp; Such scenarios usually are solved by an additional 
  constraint...<BR><BR>&nbsp;&nbsp; []s<BR>&nbsp;&nbsp; Edson<BR><BR>
  <DIV><SPAN class=gmail_quote>2008/1/4, Massi Gmail &lt;<A 
  href="mailto:mmquelo@gmail.com"> mmquelo@gmail.com</A>&gt;:</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><FONT face=Arial size=2></FONT>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>Hi guys,</FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>Now I am strugglin' with "fact id 
    checking"&nbsp; or whatever we can call it.... :D</FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>Let's take into account the followong 
    scenario:</FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</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><FONT face=Arial size=2></FONT>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>I define two objects of class A: A1 and 
    A2.</FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</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><FONT face=Arial size=2></FONT>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>Then I define two different rules R1 and R2 
    that reason over class "A" facts&nbsp; (let's say R1 and R2 are in the same 
    package) .</FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>The point is....&nbsp; I want R1 to fire only 
    on A1 and R2 only on A2.</FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</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><FONT face=Arial size=2></FONT>&nbsp;</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><FONT face=Arial size=2></FONT>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>Let me know.</FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>Massi</FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
    <DIV><FONT face=Arial 
    size=2></FONT>&nbsp;</DIV></DIV><BR>_______________________________________________<BR>rules-users 
    mailing list<BR><A onclick="return top.js.OpenExtLink(window,event,this)" 
    href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR><A 
    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>&nbsp;&nbsp;Edson Tirelli<BR>&nbsp;&nbsp;JBoss Drools 
  Core Development<BR>&nbsp;&nbsp;Office: +55 11 
  3529-6000<BR>&nbsp;&nbsp;Mobile: +55 11 9287-5646 <BR>&nbsp;&nbsp;JBoss, a 
  division of Red Hat @ <A href="http://www.jboss.com">www.jboss.com</A> 
  <P>
  <HR>

  <P></P>_______________________________________________<BR>rules-users mailing 
  list<BR>rules-users@lists.jboss.org<BR>https://lists.jboss.org/mailman/listinfo/rules-users<BR></BLOCKQUOTE></BODY></HTML>