<!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>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Hi everybody,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I followed all the topics about globals and the
fact that they are immutables.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I also understood that once we decide to reason
over globals, it's</FONT></DIV>
<DIV><FONT face=Arial size=2>time we no more use them and we start to use simple
WM facts.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Now...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I tell you my scenario.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I have got two globals.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>A "request" global and a "reply" global. The first
one is a "Request" java instance </FONT></DIV>
<DIV><FONT face=Arial size=2>and the second one is a "Reply" java instance. They
belong to the Object model</FONT></DIV>
<DIV><FONT face=Arial size=2>I designed.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>My application makes a request to the rule
engine passing it a "request" as global,<BR>and get back a reply from it
receiving a modified "reply" global.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I use a ruleflow to execute the rules.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I think everything would be perfect and smooth if I
had not the need to reason</FONT></DIV>
<DIV><FONT face=Arial size=2>over the reply during the rule
session....</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><STRONG>That's the point!</STRONG></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I do not just need to modify the "reply" global in
order to get the final value <U>outside</U></FONT></DIV>
<DIV><FONT face=Arial size=2><U>the rule engine</U>, but I DO need to reason
over it <U>INSIDE</U> the rule session.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><STRONG>So.... what should I do in order to reason
over the reply <U>INSIDE AND OUTSIDE</U> </STRONG></FONT></DIV>
<DIV><FONT face=Arial size=2><STRONG>the Rule Session?</STRONG></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Should I insert the "reply" global into the
WM?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Let assume I do that, what happen if I pass the
"reply" global to</FONT></DIV>
<DIV><FONT face=Arial size=2>a drools function which alters the
"reply"?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Imagine a rule as follows and imagine I previously
inserted the "reply" global into the WM:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>----</FONT></DIV>
<DIV><FONT face=Arial size=2>...</FONT></DIV>
<DIV><FONT face=Arial size=2>global my.object.model.Reply reply</FONT></DIV>
<DIV><FONT face=Arial size=2>...</FONT></DIV>
<DIV><FONT face=Arial size=2>rule "addcriminal_2_reply"</FONT></DIV>
<DIV><FONT face=Arial size=2> when</FONT></DIV>
<DIV><FONT face=Arial size=2> $p:
Person(job=="criminal")</FONT></DIV>
<DIV><FONT face=Arial size=2> then</FONT></DIV>
<DIV><FONT face=Arial size=2> addCriminaltoReply(reply,
$p );</FONT></DIV>
<DIV><FONT face=Arial size=2>end</FONT></DIV>
<DIV><FONT face=Arial size=2>----</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Will this alteration affect the corresponding
Reply() fact in the WM as well?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Now let see this other rule:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>(Same, let imagine i previously inserted:
insert(reply); )</FONT></DIV>
<DIV><FONT face=Arial size=2>----</FONT></DIV>
<DIV><FONT face=Arial size=2>global my.object.model.Reply reply</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial size=2>rule "FullFill_replyCode"</FONT></DIV>
<DIV><FONT face=Arial size=2> when</FONT></DIV>
<DIV><FONT face=Arial size=2> $r:
Reply(code=="john.wayne") from reply</FONT></DIV>
<DIV><FONT face=Arial size=2> then</FONT></DIV>
<DIV><FONT face=Arial size=2> $r.code.name =
john;</FONT></DIV>
<DIV> $r.code.lastname = wayne;</DIV>
<DIV><FONT face=Arial size=2>end</FONT></DIV>
<DIV><FONT face=Arial size=2>----</FONT></DIV></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>If I execute this rule in a ruleflow, do i need to
"update($r)"</FONT></DIV>
<DIV><FONT face=Arial size=2>in order to get the modified $r value in the
next ruleflow node?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>And what happens to the global??? Will it get
modified as well?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I am sure you can help me.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Bye bye.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Massi</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV></BODY></HTML>