Hi Mike,<br><br>I suggest using the Audit view in eclipse (documented in the help) which will allow you to see what rules are being added to and removed from the agenda.<br><br>cheers<br>Steve<br><br><div><span class="gmail_quote">
On 1/27/07, <b class="gmail_sendername">Anstis, Michael (M.)</b> <<a href="mailto:manstis1@ford.com">manstis1@ford.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Thanks Jeff - I guess Rules Engines were common New Years
resolution (I'm about 2 weeks in too) ;-)</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">I understood that the LHS side was operated upon when Facts
were asserted which, I think, creates the RHS Activation in the Agenda.
However I also thought that if the RHS modified Facts in the Working Memory (by
retracting, asserting or modifying them) the "Two Phase Execution" (Agenda,
Section 1.6.5) reassessed which rules needed "firing" (activation?) and hence
some of the "Cost - calculate cost for 'Stamping process' on a process" rules
(in my example below) would be disposed of. Is the activation not being dropped
(perhaps because the "machine == ( m )" condition is still met all be it that
the Price to which it relates as been disposed of?). </font></span><span><font color="#0000ff" face="Arial" size="2">I thought we were
encouraged to write rules that didn't need to be ran in any particular order
whereas I now find myself having to run some before others?</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">I'm not ranting at you Jeff, I'm just
confused.</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Cheers,</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Mike</font></span></div><br>
<blockquote style="margin-right: 0px;">
<div dir="ltr" align="left" lang="en-us">
<hr>
<font face="Tahoma" size="2"><b>From:</b> <a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">rules-users-bounces@lists.jboss.org</a>
[mailto:<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">rules-users-bounces@lists.jboss.org</a>] <b>On Behalf Of </b>Grimshaw,
Jeffrey<br><b>Sent:</b> 26 January 2007 16:34<br><b>To:</b> Rules Users
List<br><b>Subject:</b> RE: [rules-users] RE: Why not
retracting?<br></font><br></div><div><span class="e" id="q_1105f5d80b9e5274_1">
<div></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Hi Michael. I've only been using JBoss Rules for
about 2 weeks, so keep that in mind when reading my reply.
</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">The way I understand it works is that facts are evaluated
against the LHS of all the rules in the ruleset as they are
asserted. That is, when a fact is added to the WorkingMemory, the engine
determines which rules apply to that fact. You may expect
that evaluation to take place when the rules are "run". This may
have something to do with the behavior you are seeing.</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">For more info on what I'm talking about, see section
<a href="http://1.6.4.2" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">1.6.4.2</a> of the user docs. </font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"><a href="http://labs.jboss.com/file-access/default/members/jbossrules/freezone/docs/3.0.5/html/index.html" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://labs.jboss.com/file-access/default/members/jbossrules/freezone/docs/3.0.5/html/index.html</a></font></span></div>
<div><font color="#0000ff" face="Arial" size="2"></font> </div>
<div><span><font color="#0000ff" face="Arial" size="2">Cheers,</font></span></div>
<p><span lang="en-us"><font color="#0000ff" face="Arial" size="2">--Jeff</font></span>
</p>
<div> </div><br>
<div dir="ltr" align="left" lang="en-us">
<hr>
<font face="Tahoma" size="2"><b>From:</b> <a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">rules-users-bounces@lists.jboss.org</a>
[mailto:<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">rules-users-bounces@lists.jboss.org</a>] <b>On Behalf Of </b>Anstis,
Michael (M.)<br><b>Sent:</b> Friday, January 26, 2007 8:08 AM<br><b>To:</b>
Rules Users List<br><b>Subject:</b> [rules-users] RE: Why not
retracting?<br></font><br></div>
<div></div>
<p><font color="#0000ff" face="Arial" size="2">By way of an update; if the
retraction is made within a different Agenda Group the rules work as
expected.</font> </p>
<p><font color="#0000ff" face="Arial" size="2">However the problem of the retraction
having no obvious affect when operated within the same Agenda Group
remains.</font> </p>
<p><font color="#0000ff" face="Arial" size="2">Is this a bug?</font> </p>
<ul>
<p><font face="Tahoma" size="1">_____________________________________________
</font><br><b><font face="Tahoma" size="1">From: </font></b> <font face="Tahoma" size="1">Anstis, Michael (M.) </font><br><b><font face="Tahoma" size="1">Sent: </font></b> <font face="Tahoma" size="1">26
January 2007 11:32</font> <br><b><font face="Tahoma" size="1">To: </font></b> <font face="Tahoma" size="1">'Rules Users List'</font> <br><b><font face="Tahoma" size="1">Subject: </font></b> <font face="Tahoma" size="1">
Why not retracting?</font> </p>
<p><font face="Arial" size="2">Hello,</font> </p>
<p><font face="Arial" size="2">I have the following rules; one removes "Prices"
that do not have the required "Economic Level" from working memory, the
other calculates a "Costs":-</font></p>
<ul>
<p><font face="Courier New" size="2">rule "Cost - remove prices that do not
have the required 'Economic Level'"</font> <br><font face="Courier New" size="2">agenda-group "stamping-costs"</font> <br><font face="Courier New" size="2">//</font><font face="Courier New" size="2">
salience 1</font>
<br><font face="Courier New" size="2">when</font>
<br> <font face="Courier New" size="2">p : Price ( economicLevel != ( Utilities.makeDate(1, 1, 2007) )
)</font> <br><font face="Courier New" size="2">then</font>
<br> <font face="Courier New" size="2">System.out.println("Retracting "+p.toString());</font>
<br> <font face="Courier New" size="2">retract(p);</font> <br><font face="Courier New" size="2">end</font>
</p>
<p><font face="Courier New" size="2">rule "Cost - calculate cost for
'Stamping process' on a process"</font> <br><font face="Courier New" size="2">agenda-group "stamping-costs"</font> <br><font face="Courier New" size="2">//</font><font face="Courier New" size="2">
salience</font> <font face="Courier New" size="2">2</font> <br><font face="Courier New" size="2">when</font> <br> <font face="Courier New" size="2">r : ResourceEntry ( m : machine )</font>
<br> <font face="Courier New" size="2">//</font><font face="Courier New" size="2">p : Price ( economicLevel
== ( Utilities.makeDate(1, 1, 2007) ), machine == ( m ) )</font>
<br> <font face="Courier New" size="2">p : Price ( machine == ( m ) )</font> <br><font face="Courier New" size="2">then</font> <br> <font face="Courier New" size="2">Cost cost = new Cost(r, p);</font>
<br> <font face="Courier New" size="2">cost.setCost((float) (r.getUsage() * p.getRate()));</font>
<br> <font face="Courier New" size="2">assert(cost);</font> <br><font face="Courier New" size="2">end</font>
</p></ul>
<p><font face="Arial" size="2">The problem is that the "Cost" rule still works
upon ALL "Prices" (even those with an incorrect "Economic Level").</font>
</p>
<p><font face="Arial" size="2">If I change the line in the "Cost" rule to also
check the "Economic Level" the rules work as expected (i.e. "Costs" are only
calculated using "Prices" with an "Economic Level" of
01/01/2007).</font></p>
<p><font face="Arial" size="2">I've tried using "salience" levels too (as
commented in the above Rules) but this doesn't have any effect
either.</font> </p>
<p><font face="Arial" size="2">What am I doing wrong?</font> </p>
<p><font face="Arial" size="2">Cheers,</font> </p>
<p><font face="Arial" size="2">Mike</font> </p></ul></span></div></blockquote></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><br></blockquote></div><br><br clear="all"><br>-- <br>Steven Williams<br><br>Supervising Consultant<br><br>Object Consulting<br>Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
<br><a href="mailto:stevenw@objectconsulting.com.au">stevenw@objectconsulting.com.au</a><br><a href="http://www.objectconsulting.com.au">www.objectconsulting.com.au</a><br><br>consulting | development | training | support
<br>our experience makes the difference