Thanks Steve,
That worked a treat; it was a PEBKAC issue ;-)
The wonders a weekend can work!!
________________________________
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Steven
Williams
Sent: 27 January 2007 21:34
To: Rules Users List
Subject: Re: [rules-users] RE: Why not retracting?
Hi Mike,
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.
cheers
Steve
On 1/27/07, Anstis, Michael (M.) <manstis1(a)ford.com> wrote:
Thanks Jeff - I guess Rules Engines were common New
Years resolution (I'm about 2 weeks in too) ;-)
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?). 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?
I'm not ranting at you Jeff, I'm just confused.
Cheers,
Mike
________________________________
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Grimshaw,
Jeffrey
Sent: 26 January 2007 16:34
To: Rules Users List
Subject: RE: [rules-users] RE: Why not
retracting?
Hi Michael. I've only been using JBoss Rules
for about 2 weeks, so keep that in mind when reading my reply.
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.
For more info on what I'm talking about, see
section 1.6.4.2 of the user docs.
http://labs.jboss.com/file-access/default/members/jbossrules/freezone/do
cs/3.0.5/html/index.html
Cheers,
--Jeff
________________________________
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Anstis,
Michael (M.)
Sent: Friday, January 26, 2007 8:08 AM
To: Rules Users List
Subject: [rules-users] RE: Why not retracting?
By way of an update; if the retraction is made
within a different Agenda Group the rules work as expected.
However the problem of the retraction having no
obvious affect when operated within the same Agenda Group remains.
Is this a bug?
_____________________________________________
From: Anstis, Michael (M.)
Sent: 26 January 2007 11:32
To: 'Rules Users List'
Subject: Why not retracting?
Hello,
I have the following rules; one removes
"Prices" that do not have the required "Economic Level" from working
memory, the other calculates a "Costs":-
rule "Cost - remove prices that
do not have the required 'Economic Level'"
agenda-group "stamping-costs"
// salience 1
when
p : Price ( economicLevel != (
Utilities.makeDate(1, 1, 2007) ) )
then
System.out.println("Retracting
"+p.toString());
retract(p);
end
rule "Cost - calculate cost for
'Stamping process' on a process"
agenda-group "stamping-costs"
// salience 2
when
r : ResourceEntry ( m : machine
)
//p : Price ( economicLevel == (
Utilities.makeDate(1, 1, 2007) ), machine == ( m ) )
p : Price ( machine == ( m ) )
then
Cost cost = new Cost(r, p);
cost.setCost((float)
(r.getUsage() * p.getRate()));
assert(cost);
end
The problem is that the "Cost" rule
still works upon ALL "Prices" (even those with an incorrect "Economic
Level").
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).
I've tried using "salience" levels too
(as commented in the above Rules) but this doesn't have any effect
either.
What am I doing wrong?
Cheers,
Mike
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Steven Williams
Supervising Consultant
Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
stevenw(a)objectconsulting.com.au
www.objectconsulting.com.au
consulting | development | training | support
our experience makes the difference