right, so when you modify a specific field on fact you don't want rules to fire that depend on *other* fields.
well there are only 2 options that spring to mind:
1) Break down your object model to be more atomic to match the rules
2) In the first rule, set a field on the fact that indicates that scenario has been dealt with, and modify the LHS to take that into account so it doesn't fire more then its needed to. You just need to then "unset" that field when you do want it to fire again.
Really I think #1 is what you want.
Michael.
Hi, I was wondering what people this might think is good solution to the
following scenario...
I have a Fact that represents a physical piece of equipment in a control
system, this Fact has a number of parameters, param1 and param2. The working
memory is used in a stateful manner. Consider two example rules, cs is a
global vairable that allows calls back to the control system.
rule "Monitor param1"
when
f : Fact( param1 == 1 )
then
cs.DoSomething(f);
end
rule "Monitor param2"
when
f : Fact( param2 == 1)
then
cs.DoSomething(f);
end
If param1 is updated to == 1, the working memory notified (modifyObject) and
the the rules are fired (fireAllRules), consequently the rule "Monitor param1"
will be placed onto the Agenda. Assuming that sometime later param2 is updated
to == 1, notifing the working memory and firing the rules again will result in
rules "Monitor param1" and "Monitor param2" being placed on the agenda. What I
really want is just the change to be detected and not for the "Monitor param1"
rule to fire again.
Is there a pattern to acheive the desired behaviour, I have used agenda-group
but am not sure this is the best solution.
Thanks for your help.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users