<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<STYLE>.hmmessage P {
        PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px
}
BODY.hmmessage {
        FONT-SIZE: 10pt; FONT-FAMILY: Tahoma
}
</STYLE>
<META content="MSHTML 6.00.2900.3132" name=GENERATOR></HEAD>
<BODY class=hmmessage>
<DIV dir=ltr align=left><SPAN class=694480211-11042008><FONT face=Arial
color=#0000ff>I was thinking something more like this:-</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=694480211-11042008><FONT face=Arial
color=#0000ff></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=694480211-11042008><FONT color=#960000><FONT
color=#960000>
<P align=left><FONT face="Courier New" color=#0000ff>package
com.sample</FONT></P>
<P align=left><FONT face="Courier New" color=#0000ff>import
com.sample.Test<BR> <BR>rule "rule 1 - 1"<BR> salience
90<BR> when<BR> a :
Test(<BR> computed ==
"false",<BR> c
< 15,<BR> d
>= 75) <BR>
then<BR> System.out.println("setting e to
0");<BR>
a.setE(0);<BR>
update(a);<BR>end</FONT></P>
<P align=left><FONT face="Courier New" color=#0000ff></FONT> </P>
<P align=left><FONT face="Courier New" color=#0000ff>rule "rule 1 -
2"<BR> salience 10<BR>
when<BR> a :
Test(<BR>
computed ==
"false",<BR> c
< 15,<BR> d
>= 75) <BR>
then<BR> System.out.println("setting e to
1");<BR>
a.setE(1);<BR>end<BR></FONT></FONT></P></FONT><FONT color=#960000>
<P align=left><FONT face=Arial color=#0000ff><SPAN class=694480211-11042008>Note
rule "rule 1 - 2" deliberately uses the same patterns as rule "rule 1 -
1".</SPAN></FONT></P></FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><FONT face="Courier New" color=#0000ff>package com.sample;</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New" color=#0000ff>public class <SPAN
class=694480211-11042008>Test</SPAN> {<BR>
<BR> private boolean computed =false;<BR>
private int c=0;<BR> private int d=80;<BR>
private int e;</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New" color=#0000ff> public String
getComputed(){<BR>
if(computed)<BR> return
"true";<BR>
else<BR> return
"false";<BR> }</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New" color=#0000ff> public int getC()
{<BR> return c;<BR>
}</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New" color=#0000ff> public int getD()
{<BR> return d;<BR>
}</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New" color=#0000ff> public void
setE(int e){<BR> this.e =
e;<BR> computed =
true;<BR> }</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New" color=#0000ff>}<BR></FONT></DIV>
<DIV><SPAN class=694480211-11042008><FONT face=Arial color=#0000ff>Rule "rule 1
- 1" is the only rule to run (and runs once); the second activatino being
cancelled due to the update to "computed". Here's the audit
view:-</FONT></SPAN></DIV>
<DIV><SPAN class=694480211-11042008><FONT face=Arial
color=#0000ff></FONT></SPAN> </DIV><FONT face="Courier New"
color=#0000ff><object-stream><BR> <list><BR>
<org.drools.audit.event.ActivationLogEvent><BR>
<activationId>rule 1 - 1
[1]</activationId><BR> <rule>rule 1 -
1</rule><BR>
<declarations>a=com.sample.Test@67126712(1)</declarations><BR>
<type>4</type><BR>
</org.drools.audit.event.ActivationLogEvent><BR>
<org.drools.audit.event.ActivationLogEvent><BR>
<activationId>rule 1 - 2
[1]</activationId><BR> <rule>rule 1 -
2</rule><BR>
<declarations>a=com.sample.Test@67126712(1)</declarations><BR>
<type>4</type><BR>
</org.drools.audit.event.ActivationLogEvent><BR>
<org.drools.audit.event.ObjectLogEvent><BR>
<factId>1</factId><BR>
<objectToString>com.sample.Test@67126712</objectToString><BR>
<type>1</type><BR>
</org.drools.audit.event.ObjectLogEvent><BR>
<org.drools.audit.event.ActivationLogEvent><BR>
<activationId>rule 1 - 1
[1]</activationId><BR> <rule>rule 1 -
1</rule><BR>
<declarations>a=com.sample.Test@67126712(1)</declarations><BR>
<type>6</type><BR>
</org.drools.audit.event.ActivationLogEvent><BR>
<org.drools.audit.event.ActivationLogEvent><BR>
<activationId>rule 1 - 2
[1]</activationId><BR> <rule>rule 1 -
2</rule><BR>
<declarations>a=com.sample.Test@67126712(1)</declarations><BR>
<type>5</type><BR>
</org.drools.audit.event.ActivationLogEvent><BR>
<org.drools.audit.event.ObjectLogEvent><BR>
<factId>1</factId><BR>
<objectToString>com.sample.Test@67126712</objectToString><BR>
<type>2</type><BR>
</org.drools.audit.event.ObjectLogEvent><BR>
<org.drools.audit.event.ActivationLogEvent><BR>
<activationId>rule 1 - 1
[1]</activationId><BR> <rule>rule 1 -
1</rule><BR>
<declarations>a=com.sample.Test@67126712(1)</declarations><BR>
<type>7</type><BR>
</org.drools.audit.event.ActivationLogEvent><BR>
</list><BR></object-stream></FONT>
<DIV><SPAN class=694480211-11042008></SPAN> </DIV>
<DIV><BR></DIV>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma><B>From:</B> rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] <B>On Behalf Of </B>Jonathan
Guéhenneux<BR><B>Sent:</B> 11 April 2008 11:33<BR><B>To:</B> Rules Users
List<BR><B>Subject:</B> RE: [rules-users] Synch Business Object / Working
Memory<BR></FONT><BR></DIV>
<DIV></DIV>Ok, I think I understood well. I modified my business code, now I
call if<BR><BR>(wm != null)<BR>
wm.update(wm.getFactHandle(this), this);<BR><BR>each time a
properties is modified.<BR><BR>But it is worse. Rules that sould be activated
only once actually loop, even if I add the no-loop clause.<BR><BR>I understand
why they loop, assuming update = (rectact + insert), but I dont get a solution
to my problem. I just want to notify an object changement in order to read
again the properties, but I dont want to restart the ruleflow.<BR><BR>Sorry,
but I find hard to say it in english because even in french, it's not very
clear ;)<BR>
<BLOCKQUOTE>
<HR>
Subject: RE: [rules-users] Synch Business Object / Working Memory<BR>Date:
Fri, 11 Apr 2008 10:39:41 +0100<BR>From: manstis1@ford.com<BR>To:
rules-users@lists.jboss.org<BR><BR>
<META content="Microsoft SafeHTML" name=Generator>
<STYLE>.ExternalClass .EC_hmmessage P {
        PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px
}
.ExternalClass BODY.EC_hmmessage {
        FONT-SIZE: 10pt; FONT-FAMILY: Tahoma
}
</STYLE>
<DIV dir=ltr align=left><SPAN class=EC_208223809-11042008><FONT face=Arial
color=#0000ff>In essence, yes. Have a look at "update" in the manual (and a
read on Shadow Facts will probably be useful too).</FONT></SPAN></DIV><BR>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px">
<DIV class=EC_OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR>
<FONT face=Tahoma><B>From:</B> rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] <B>On Behalf Of </B>Jonathan
Guéhenneux<BR><B>Sent:</B> 11 April 2008 10:24<BR><B>To:</B> Rules Users
List<BR><B>Subject:</B> RE: [rules-users] Synch Business Object / Working
Memory<BR></FONT><BR></DIV>
<DIV></DIV>yes, i made a mistake. its a.setE(...) and not
c.setE(...).<BR><BR>I don't call update. If I dont call update, properties
of an object are just read one time for all rules?<BR><BR><BR>
<BLOCKQUOTE>
<HR>
Subject: RE: [rules-users] Synch Business Object / Working
Memory<BR>Date: Fri, 11 Apr 2008 09:47:43 +0100<BR>From:
manstis1@ford.com<BR>To: rules-users@lists.jboss.org<BR><BR>
<STYLE>.ExternalClass .EC_hmmessage P {
        PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px
}
.ExternalClass BODY.EC_hmmessage {
        FONT-SIZE: 10pt; FONT-FAMILY: Tahoma
}
</STYLE>
<DIV dir=ltr align=left><SPAN class=EC_EC_287464408-11042008><FONT
face=Arial color=#0000ff>I guess the example is a simplification as "c"
(in RHS) has not been bound to a fact.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=EC_EC_287464408-11042008><FONT
face=Arial color=#0000ff></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=EC_EC_287464408-11042008><FONT
face=Arial color=#0000ff>Anyway, that aside, do you call "update" to
ensure WM knows of changes to facts otherwise properties need to be
"time-constant" which in your example they are
not.</FONT></SPAN></DIV><BR>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px">
<DIV class=EC_EC_OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR>
<FONT face=Tahoma><B>From:</B> rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] <B>On Behalf Of
</B>Jonathan Guéhenneux<BR><B>Sent:</B> 11 April 2008
09:34<BR><B>To:</B> Rules Users List<BR><B>Subject:</B> [rules-users]
Synch Business Object / Working Memory<BR></FONT><BR></DIV>
<DIV></DIV>Hi,<BR><BR>I have two rules :<BR><BR>rule "rule 1 -
1"<BR> <BR> salience
90<BR> ruleflow-group "rfg1"<BR>
when<BR> a :
A(<BR>
eComputed == "false",<BR>
c < 15,<BR>
d >= 75)
<BR> then<BR>
c.setE(0);<BR>end<BR><BR><BR><BR>rule "rule 1 -
2"<BR><BR> salience 10<BR>
ruleflow-group "rfg1"<BR> when<BR>
a : A(<BR>
eComputed == "false",<BR>
c >=
15,<BR> d
>= 75) <BR>
then<BR>
c.setE(1);<BR>end<BR><BR><BR><BR>and part of the corresponding
business code :<BR><BR>public class A {<BR><BR>
...<BR><BR> public String
getEComputed(){<BR>
if(eComputed)<BR> return
"true";<BR> else<BR>
return "false";<BR>
}<BR><BR> ...<BR><BR> public void
setE(int e){<BR> this.e =
e;<BR> eComputed =
true;<BR> }<BR><BR>
...<BR><BR>}<BR><BR><BR><BR>so, I expected that if the first rule is
activated, the second won't be. But according to my tests, the two
rule can be fired on the same object A.<BR>While debugging, I noticed
the getEComputed method was only called once. I suppose that I should
write this :<BR><BR><BR>rule "rule 1 - 1"<BR>
<BR> salience 90<BR>
ruleflow-group "rfg1"<BR> when<BR>
a : A(<BR>
eComputed == "false",<BR>
c < 15,<BR>
d >= 75)
<BR> then<BR>
c.setE(0);<BR>
c.setEComputed("true);<BR>end<BR><BR><BR><BR>rule "rule 1 -
2"<BR><BR> salience 10<BR>
ruleflow-group "rfg1"<BR> when<BR>
a : A(<BR>
eComputed == "false",<BR>
c >=
15,<BR> d
>= 75) <BR>
then<BR>
c.setE(1);<BR>
c.setEComputed("true);<BR>end<BR><BR>But I would prefer another
solution. Thanks for help.<BR><BR>
<HR>
Plus de 15 millions de français utilisent Windows Live Messenger ! <A
href="http://www.windowslive.fr/messenger/" target=_blank>Téléchargez
Messenger, c'est gratuit !</A> </BLOCKQUOTE></BLOCKQUOTE><BR>
<HR>
Plus de 15 millions de français utilisent Windows Live Messenger ! <A
href="http://www.windowslive.fr/messenger/" target=_blank>Téléchargez
Messenger, c'est gratuit !</A> </BLOCKQUOTE></BLOCKQUOTE><BR>
<HR>
Tous vos amis discutent sur Messenger, et vous ? <A
href="http://www.windowslive.fr/messenger/" target=_new>Téléchargez Messenger,
c'est gratuit !</A> </BLOCKQUOTE></BODY></HTML>