[rules-users] rule flow --> possible bug?
Kris Verlaenen
kris.verlaenen at cs.kuleuven.be
Mon Sep 17 19:44:28 EDT 2007
Sergey,
I am actually getting your expected behaviour when I recreated your example here.
So could you open up a JIRA and include the example as a self-contained eclipse project, or just email it to me?
I'll take a look at what might be wrong / different.
Kris
----- Original Message -----
From: Manukyan, Sergey
To: Rules Users List
Sent: Monday, September 17, 2007 9:12 PM
Subject: RE: [rules-users] rule flow --> possible bug?
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 listrules-users at lists.jboss.orghttps://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.
------------------------------------------------------------------------------
_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070918/a8d48c64/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 13945 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20070918/a8d48c64/attachment.jpe
More information about the rules-users
mailing list