[rules-users] rule flow --> possible bug?
Manukyan, Sergey
SManukyan at lear.com
Mon Sep 17 15:12:12 EDT 2007
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 at lists.jboss.org
[mailto:rules-users-bounces at 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 list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
**********************
** LEGAL DISCLAIMER **
**********************
This E-mail message and any attachments may contain
legally privileged, confidential or proprietary
information. If you are not the intended recipient(s),
or the employee or agent responsible for delivery of
this message to the intended recipient(s), you are
hereby notified that any dissemination, distribution
or copying of this E-mail message is strictly
prohibited. If you have received this message in
error, please immediately notify the sender and
delete this E-mail message from your computer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070917/7ce0eb76/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 13945 bytes
Desc: image002.jpg
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20070917/7ce0eb76/attachment.jpe
More information about the rules-users
mailing list