[rules-users] no-loop & lock-on-active clarification

Edson Tirelli tirelli at post.com
Wed Nov 12 09:20:05 EST 2008


   Your findings are consistent with the behavior.

"no-loop" prevents only the rule to activate itself.

"lock-on-active" prevents the rule to activate when the focus is set to the
same agenda-group or ruleflow-group of the rule. If no agenda-group or
ruleflow-group is declared for a rule, it belongs to the MAIN agenda-group.

    So, scenarios #3 and #4 look consistent to me.

    []s
    Edson



2008/11/11 techy <techluver007 at gmail.com>

>
> Thanks Greg.
>
> >As for lock-on-active, it should be used in conjunction with a
> ruleflow-group or agenda-group.  It's >basically no-loop for the entire
> group, as I understand it.  I don't see either a ruleflow-group or
> >agenda-group defined for those rules.  Did you do that?
> - no. I'm not using a ruleflow-group or agenda-group.
> 1. Even if I dont use agenda-group explicitly, all rules are in "main"
> agenda group right. shouldn't we use lock-on-active without explicit
> agenda-group or rule-flow group?
>
> I can understand result #1 & #2.
>
> It would be nice if some one clarify result # 3 & #4 of my example. here
> both rules have 'update'.
>
> > 3. when lock-on-active for rule "1 precondition" and no-loop for rule "1
> > main condition" used, both rule got fired correctly.
> > 4. when lock-on-active for rule "1 maincondition" and no-loop for rule "1
> > precondition" used, only rule "1 , then only precondition" got executed
> > for  all facts.
>
> Thanks again!
>
>
> Greg Barton wrote:
> >
> > You certainly need no-loop for rule "1 precondition" as it stands because
> > the Foo is updaetd, but not in a way that prevents the rule from firing
> > again. One way to prevent that would be to put a condition in the rule
> > that is the antithesis of some update you make:
> >
> > rule "1 precondition"
> >  when
> >   foo : Foo( preconditionPassedRule not contains "1 precondition", f1 !=
> > null, f2 != null)
> >  then
> >   foo.addPreconditionPassedRule("1 precondition");
> >   update(foo)
> > end
> >
> > As for lock-on-active, it should be used in conjunction with a
> > ruleflow-group or agenda-group.  It's basically no-loop for the entire
> > group, as I understand it.  I don't see either a ruleflow-group or
> > agenda-group defined for those rules.  Did you do that?
> >
> > --- On Tue, 11/11/08, techy <techluver007 at gmail.com> wrote:
> >
> >> From: techy <techluver007 at gmail.com>
> >> Subject: [rules-users] no-loop & lock-on-active clarification
> >> To: rules-users at lists.jboss.org
> >> Date: Tuesday, November 11, 2008, 10:25 AM
> >> I tried following rules as given below and result
> >> are:(assumes facts which
> >> I tried are qualified for both rules)
> >>
> >> 1. when lock-on-active used with both rule, only rule
> >> "1 precondition" got
> >> executed for all facts.
> >> 2. when no-loop used with both rules, infinite loop
> >> 3. when lock-on-active for rule "1 precondition"
> >> and no-loop for rule "1
> >> main condition" used, both rule got fired correctly.
> >> 4. for vice versa of 3 scenario, only rule "1
> >> precondition" got executed for
> >> all facts.
> >> Can someone please clarify about this scenario and also
> >> diff between no-loop
> >> & lock-on-active? when we should use one and when
> >> should not?
> >> I went thru documentation and still could not understand
> >> the difference.
> >>
> >> public class Foo
> >> {
> >>     private Set<String> preConditionPassedRules ;
> >>
> >>     private Integer f1;
> >>     private Integer f2;
> >>
> >> }
> >>
> >> rule "1 precondition"
> >>      salience 100
> >>
> >>      when
> >>              foo : Foo( f1 != null && f2 != null)
> >>      then
> >>              foo.addPreconditionPassedRule("1
> >> precondition");
> >>                 update(foo)
> >>
> >> end
> >>
> >> rule "1 main condition"
> >>      salience 100
> >>
> >>      when
> >>              foo : Foo( preconditionPassedRule contains "1
> >> precondition",f1 > 1000,f2
> >> < 1000)
> >>      then
> >>              #actions
> >>
> >> end
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/no-loop---lock-on-active-clarification-tp20443036p20443036.html
> >> Sent from the drools - user mailing list archive at
> >> Nabble.com.
> >>
> >> _______________________________________________
> >> 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
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/no-loop---lock-on-active-clarification-tp20443036p20444712.html
> Sent from the drools - user mailing list archive at Nabble.com.
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20081112/64570a7b/attachment.html 


More information about the rules-users mailing list