Thank you for explanations, it did clear up the picture for me, but I still didn’t resolve the problem that I am having. Looks like problem happens when attributes are involved in a Split. Possible bug?
So here is an example:

I am inserting initially a simple TestValid class that has boolean hasError attribute = false;
insert(new TestValid(false));
INIT ruleflow-group just prints out the facts :
rule "INIT"
ruleflow-group "INIT" no-loop
when
$v : TestValid()
then
System.out.println("INIT : HAS ERROR ? : " + $v.isHasErrors());
end
The “Make Error” ruleflow-group is activated when hasError attribute is flase in estValid fact :
rule "Make Error"
ruleflow-group "Make Error" no-loop
when
$v : TestValid(hasErrors == false)
then
System.out.println("Make Error!!!");
$v.setHasErrors(true);
retract($v);
insert($v);
end
The “Has Error?” XOR Split has the following constraints:
- TestValid(hasErrors == false) // goes to “No Errors” Action
- TestValid(hasErrors == true) // goes to END
The Actions Just print out information :
- System.out.println("Init Action");
- System.out.println("No Errors Action");
When running example I was expecting to see the following events as seen on console:
<START>
Init Action
INIT : HAS ERROR ? : false
No Errors Action
Make Error!!!
Init Action
INIT : HAS ERROR ? : true
<END>
Instead that is what I see:
<START>
Init Action
INIT : HAS ERROR ? : false
No Errors Action
Make Error!!!
Init Action
INIT : HAS ERROR ? : true
No Errors Action
Init Action
No Errors Action
Init Action
…
<infinitely goes like this>
Now is this again expected behavior or a possible bug?
If it is expected then how can I make decisions based on attribute of a fact in a Split…
Thank you,
-Sergey
From: rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On
Behalf Of Mark Proctor
Sent: Friday, September 14, 2007
8:37 PM
To: Rules Users List
Subject: Re: [rules-users] rule
flow
true, damn :)
I did think of an attribute to "re-activate" any rules that are true,
but not currently on the agenda - but not sure about it yet, would have to
think on the negative effects some more.
Mark
Kris Verlaenen wrote:
> use the rule attribute "lock-on-active" to stop this behaviour, it stops a rule re-activating while the ruleflowgroup is active
Well, this won't work for the same reason no-loop isn't working: if you use lock-on-active, it will make sure that the rule is not reactivated, so the execution of the node will end after one increment. But the lock-on-active makes sure that no activation is ever created, so, in the context of looping in ruleflow, even if the RuleSet node is activated again afterwards, it will never increment the integer again (as you prevented reactivation of the rule using lock-on-active), resulting in an endless loop in this case. Currently, as far as I know, the only thing that works is manually deactivating the ruleflow-group.
Kris
_______________________________________________rules-users mailing listrules-users@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users