<!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><FONT face=Arial color=#0000ff><SPAN
class=008434813-11042008>Do you need ruleflow? Perhaps this is too simple and I
misunderstood.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff><SPAN
class=008434813-11042008></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff><SPAN
class=008434813-11042008>package com.sample;</SPAN></FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff><SPAN
class=008434813-11042008>public class Test {</SPAN></FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff><SPAN
class=008434813-11042008> private Integer
a;<BR> private Integer b;<BR> private
Integer c;</SPAN></FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff><SPAN
class=008434813-11042008> public Integer getA()
{<BR> return a;<BR>
}</SPAN></FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff><SPAN
class=008434813-11042008> public Integer getB()
{<BR> return b;<BR>
}</SPAN></FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff><SPAN
class=008434813-11042008> public Integer getC()
{<BR> return c;<BR>
}</SPAN></FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff><SPAN
class=008434813-11042008> public void setA(Integer a)
{<BR> this.a =
a;<BR> }</SPAN></FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff><SPAN
class=008434813-11042008> public void setB(Integer b)
{<BR> this.b =
b;<BR> }</SPAN></FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff><SPAN
class=008434813-11042008> public void setC(Integer c)
{<BR> this.c =
c;<BR> }</SPAN></FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff><SPAN
class=008434813-11042008>}</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face="Courier New" color=#0000ff>package com.sample</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face="Courier New" color=#0000ff>import
com.sample.Test<BR> <BR>rule "rule 1"<BR> salience
90<BR> when<BR> a :
Test( a != null, b == null )<BR> then<BR>
System.out.println("setting b to
10");<BR>
a.setB(10);<BR>
update(a);<BR>end</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face="Courier New" color=#0000ff>rule "rule 2"<BR>
salience 80<BR>
when<BR> a : Test( b : b != null, c ==
null )<BR> then<BR>
System.out.println("setting c to b x
5");<BR> a.setC(b *
5);<BR> update(a);<BR>end</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face="Courier New" color=#0000ff>rule "rule 3"<BR>
salience 70<BR>
when<BR> a : Test( c != null
)<BR> then<BR> System.out.println("c =
" + a.getC());<BR>end<BR></FONT></DIV>
<DIV><FONT face="Courier New" color=#0000ff></FONT> </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 13:23<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>Indeed, it works but I will have to use such booleans for a lot of
rules.<BR><BR>Cause my rule flow is <SPAN
class=def-example>schematically</SPAN> :<BR><BR>compute A<BR>compute
B(A)<BR>compute C(B)<BR>...<BR><BR>Perhaps I may create several ruleflows, one
per independant computing?<BR><BR>
<BLOCKQUOTE>
<HR>
Subject: RE: [rules-users] Synch Business Object / Working Memory<BR>Date:
Fri, 11 Apr 2008 12:11:32 +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_694480211-11042008><FONT face=Arial
color=#0000ff>I was thinking something more like this:-</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=EC_694480211-11042008><FONT face=Arial
color=#0000ff></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=EC_694480211-11042008><FONT
color=#960000><FONT color=#960000></FONT>
<P align=left><FONT color=#960000><FONT face="Courier New"
color=#0000ff>package com.sample</FONT></FONT></P>
<P align=left><FONT color=#960000><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></FONT></P>
<P align=left><FONT color=#960000><FONT face="Courier New"
color=#0000ff></FONT></FONT> </P>
<P align=left><FONT color=#960000><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=EC_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=EC_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=EC_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=EC_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=EC_694480211-11042008></SPAN> </DIV>
<DIV><BR></DIV>
<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 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>
<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_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_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_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_EC_287464408-11042008><FONT face=Arial
color=#0000ff></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN
class=EC_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_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=_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>