[rules-users] Could anyone suggest alternate approach

Greg Barton greg_barton at yahoo.com
Mon Nov 23 15:05:58 EST 2009


Hm, I thought Drools had specificity conflict resolution on by default.  Has that changed, or am I just getting old? :)

--- On Mon, 11/23/09, Edson Tirelli <ed.tirelli at gmail.com> wrote:

> From: Edson Tirelli <ed.tirelli at gmail.com>
> Subject: Re: [rules-users] Could anyone suggest alternate approach
> To: "Rules Users List" <rules-users at lists.jboss.org>
> Date: Monday, November 23, 2009, 1:44 PM
> 
>     Also, if each of your steps involve multiple rules,
> the best way to coordinate "phased" execution is
> to use ruleflow.
> 
>     Edson
> 
> 2009/11/23 Wolfgang Laun <wolfgang.laun at gmail.com>
> 
> Without salience, there is no
> guarantee that rule 1 will fire before rule 2.
> 
> 
> 
> Seeing only part of the problem makes it difficult to shell
> out good advice.
> 
> 
> 
> -W
> 
> 
> 
> On 11/23/09, Greg Barton <greg_barton at yahoo.com>
> wrote:
> 
> > The reason rule 2 is executed even though rule 1 has
> fired is because you're
> 
> > not notifying the engine that the CustomerDetail has
> been changed.  You need
> 
> > the statement "update(d)" in the rule
> action. (And this is generally true
> 
> > when you modify matched objects in a rule.  Only
> leave it out in the rare
> 
> > circumstance when you do NOT want other rules to be
> triggered by a change.)
> 
> >
> 
> > Also, an alternative to your approach is using
> agenda-group.  Check the
> 
> > docs.
> 
> >
> 
> > --- On Mon, 11/23/09, Lindy hagan <lindyhagan at gmail.com>
> wrote:
> 
> >
> 
> >> From: Lindy hagan <lindyhagan at gmail.com>
> 
> >> Subject: [rules-users] Could anyone suggest
> alternate approach
> 
> >> To: "Rules Users List" <rules-users at lists.jboss.org>
> 
> >> Date: Monday, November 23, 2009, 11:56 AM
> 
> >> Please ignore my previous email as I
> 
> >> did not include subject.
> 
> >>
> 
> >> I have 4 drl files in my app. Loading all the 4
> during
> 
> >> application startup.
> 
> >> If any rule is satisfied in File 1,I don't
> want File 2
> 
> >> be called.Should execute File 3 and 4.
> 
> >> Similarly If rules in File 1 is not satisfied,want
> to call
> 
> >> File 2 then File 3 and 4.
> 
> >>
> 
> >> At present I am doing this way.Please let me know
> if
> 
> >> this is ok or if there is any better solution.
> 
> >> Set an attribute when a rule is satisfied.
> (attribute is
> 
> >> not dummy,I need it in my app)
> 
> >> Attribute is checked in each and every if it is
> null.
> 
> >>
> 
> >> Example File1.drl contains 2 rules.If first rule
> is
> 
> >> satisfied, don't want to execute second
> rule.So setting
> 
> >> rule with a valid number.
> 
> >>
> 
> >> File1.drl
> 
> >> rule "1.Age Factor and Junior"
> 
> >>      when
> 
> >>           d : CustomerDetail( rule ==
> ""
> 
> >> && sale == 'Junior' && age
> in
> 
> >> ("16","17"))
> 
> >>      then
> 
> >>
> 
> >>      System.out.println("Junior and Age
> Satisfied
> 
> >> ");
> 
> >>       d.setRule("1");
> 
> >> end
> 
> >> rule "2.Junior only Age Factor"
> 
> >>      when
> 
> >>           m : CustomerDetail( rule ==
> ""
> 
> >> && age in
> ("16","17"))
> 
> >>      then
> 
> >>       System.out.println("Only junior Age
> 
> >> satisfied.");
> 
> >>
> 
> >>       m.setRule("2");
> 
> >> end
> 
> >>
> 
> >> File2.drl
> 
> >> rule "3.Age Factor and Senior"
> 
> >>      when
> 
> >>           d : CustomerDetail( rule ==
> ""
> 
> >> && sale == 'Senior' && age
> in
> 
> >> ("70","75"))
> 
> >>      then
> 
> >>
> 
> >>      System.out.println("Senior and Age
> Satisfied
> 
> >> ");
> 
> >>       d.setRule("10");
> 
> >> end
> 
> >> rule "4.Senior only Age Factor "
> 
> >>      when
> 
> >>           m : CustomerDetail( rule ==
> ""
> 
> >> && age in
> ("70","75"))
> 
> >>      then
> 
> >>       System.out.println("Only senior Age
> 
> >> satisfied.");
> 
> >>
> 
> >>       m.setRule("11");
> 
> >> end
> 
> >> This one works but I see these disadvantages:
> 
> >> 1)If the rule 1 is satisfied, rule2 is still
> 
> >> executed.Similary all the rules in File2.drl.
> 
> >> 2)Might impact performance all the 4 rules are
> called all
> 
> >> time.
> 
> >> Any suggestions?
> 
> >>
> 
> >> -----Inline Attachment Follows-----
> 
> >>
> 
> >> _______________________________________________
> 
> >> 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
> 
> >
> 
> _______________________________________________
> 
> 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 by Red Hat @ www.jboss.com
> 
> 
> -----Inline Attachment Follows-----
> 
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 


      




More information about the rules-users mailing list