<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3132" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=724234706-24102007><FONT face=Arial
color=#0000ff size=2>Could you not change your rule?</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=724234706-24102007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=724234706-24102007>rule "An item is in the
office" <BR> salience
0<BR> when</SPAN></DIV>
<DIV dir=ltr align=left><SPAN
class=724234706-24102007> $item
: Item(
)<BR> $container
: Container(location.name = "office", items contains
$item)<BR> then<BR> System.out.println("item
in office");<BR>end<BR></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=724234706-24102007><FONT face=Arial
color=#0000ff size=2>[I think] this would only require an update to the
Container.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=724234706-24102007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=724234706-24102007><FONT face=Arial
color=#0000ff size=2>If a object represented by a patten changes you always need
to update the working memory's knowledge of the object.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=724234706-24102007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=724234706-24102007><FONT face=Arial
color=#0000ff size=2>The above requires that Container exposes an Items
collection.</FONT></DIV></SPAN><BR>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px">
<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>Edson
Tirelli<BR><B>Sent:</B> 24 October 2007 00:58<BR><B>To:</B> Rules Users
List<BR><B>Subject:</B> Re: [rules-users] Rules firing with an update of
another object<BR></FONT><BR></DIV>
<DIV></DIV><BR> Hi Fabrice,<BR><BR> That is how it is
supposed to work... no "automatic" way of doing it in another
way.<BR><BR> []s<BR> Edson<BR><BR>
<DIV><SPAN class=gmail_quote>2007/10/23, Fabrice Granzotto < <A
href="mailto:granz@mit.edu">granz@mit.edu</A>>:</SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">Hi
everybody!<BR><BR>Here is my code and my rule. The problem is that the rule
doesn?t detect that <BR>my item ?chocolate? contained in the container has
moved to the<BR>?office?.<BR><BR>I know that if I update the item instead
the container it?s working, but I was<BR>wondering if there is a solution to
detect this movement by this way? Do you <BR>have a
solution?<BR><BR>Thanks!<BR><BR>*******CODE *******<BR>session =
ruleBase.newStatefulSession();<BR>Location kitchen=new
Location("kitchen");<BR>Location office=new Location("office");<BR>Container
container1=new Container("container1",kitchen);
<BR>session.insert(container1);<BR>Item chocolate=new Item("chocolate",
container1);<BR>session.insert(chocolate);<BR>session.fireAllRules();<BR>//No
rules fired => OK<BR>container1.setLocation(office);<BR>session.update
(session.getFactHandle(container1),
container1);<BR>session.fireAllRules();<BR>//Once again, no rules fired
=> Not OK... I want detect this movement<BR><BR>*******RULE
*******<BR>rule "An item is in the office"
<BR> salience
0<BR> when<BR> $itemA
: Item($cont : container,
$cont.location.name=="office")<BR> then<BR> System.out.println("item
in office");<BR>end<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">https://lists.jboss.org/mailman/listinfo/rules-users
</A><BR></BLOCKQUOTE></DIV><BR><BR clear=all><BR>-- <BR> Edson
Tirelli<BR> Software Engineer - JBoss Rules Core
Developer<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">www.jboss.com</A> </BLOCKQUOTE></BODY></HTML>