[rules-users] How to make a "Loop-Ruleflow"????

mmquelo massi mmquelo at gmail.com
Thu Nov 22 20:07:48 EST 2007


Thank U again Kris.

I Think I misunderstood How a ruleflow works... for "parallelism" I meant
two rules that are activated in the same time
but I know that it is a non-sense cause the ruleflow itself remove any
ambiguity concerning the agenda.

Sorry about that!

Hopefully next time I will post something a bit more interesting.... :(
;-)

Thank You again!

massi

On Nov 23, 2007 12:22 AM, Kris Verlaenen <kris.verlaenen at cs.kuleuven.be>
wrote:

>  Massi,
>
> Why do you want to use a ruleflow?  If you simply remove the
> ruleflow-group statements from your rule definitions, you will get your
> expected behaviour, as rule_ab will execute first, updating your user fact,
> which will then trigger rule_ba to execute, updating the user fact again,
> which will trigger rule_ba again, etc.
>
> I'm not sure where you see any parallelism here, as it is always the first
> rule, then the second, then the first one again, etc.
>
> But if you really want to know, you can create a loop in a ruleflow by
> putting whatever you would like to see repeated in between an XOR-join in
> front and an XOR-split at the end, and linking one of the outgoing
> connections of the XOR-split back to the first join :)
>
> Kris
>
>
>   ----- Original Message -----
> *From:* mmquelo massi <mmquelo at gmail.com>
> *To:* Rules Users List <rules-users at lists.jboss.org>
> *Sent:* Thursday, November 22, 2007 5:15 PM
> *Subject:* [rules-users] How to make a "Loop-Ruleflow"????
>
>  Hi everybody.
>
>  I am trying to make a ruleflow that, once processed, causes the rule
> engine to infinitely loop.
> I have got a *User* Object in my object model. It has got a *getLogin()*and
> *setLogin(*) methods.
>
> The login field stands for the "User name", so it is a String.
>
> First I insert an Object in the WM, with login==A.
>
>  Then I generate the following rule-flow-groups:
>
> *rule "rule_ab" *
> *   ruleflow-group "ab" *
> *    when *
> *       u:User( login == "A" ) *
> *   then *
> *      u.setLogin("B"); *
> *      System.out.println("a - > b"); *
> *     update(u); *
> *end *
> **
> *rule "rule_ba" *
> *   ruleflow-group "ba" *
> *     when *
> *        u:User( login == "B" ) *
> *     then *
> *        u.setLogin("A"); *
> *        System.out.println("b - > a"); *
> *        update(u); *
> *end *
>
> I'd like to define a ruleflow that gives me in output something like this:
>
>  a - > b
> b - > a
> a - > b
> b - > a a - > b
> b - > a
> a - > b
> b - > a a - > b
> b - > a
> a - > b
> b - > a
> .... looping...
>
> How can I do it?
>
> In other words I want those rules to be executed in parallel and I want to
> define
> this "parallelism" using the ruleflow graph, Is It Possible???
>
> Thank You Again!
>
> Massi.
>
> P.S.
>
> Ah.... I solved that matter with the rule.package...
>
> ------------------------------
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> _______________________________________________
> 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/20071123/6594823a/attachment.html 


More information about the rules-users mailing list