[rules-users] Salience Problem

Edson Tirelli tirelli at post.com
Wed Feb 28 08:47:37 EST 2007


   The salience attribute will make no difference in your rules bellow, 
since your conditions will force the rules to execute in sequence.
   So, if you have no LoadBean initially (before firing rules) in 
working memory, rule A will fire, assert the bean and then rule B will 
fire. If you already have a LoanBean with loanId == 1 in your working 
memory, before firing rules, then only rule B will fire. If you already 
have a LoadBean with loadId != 1 in working memory, before firing the 
rules, then no rule will fire. So, in any case, salience makes no 
difference.

   []s
   Edson

Micheal John wrote:

> *
>
> rule
>
> * "A Rule"
> *        when* *             not* LoanBean(); *        then*
>
>            LoanBean loan =
>
> *new* LoanBean();
>
>            loan.setLoanId(
>
> "1");
>
>            System.out.println(
>
> "A rule");
>
>            loan.setLoanId(
>
> "1");            *assert*(loan);*
>
> end
>
>  
>
> **rule* "B Rule" *    salience* 10 *    when*
>
>           a:LoanBean(loanId ==
>
> "1"); *       then*
>
>      System.out.println(
>
> "B Rule");
>
> *end*
>
>  
>
> I have given sailence 10 for "B Rule". So it has to fire first, then 
> only "A Rule" should fire. And also If B Rule is firing first, 
> obviously it won't fire, since it won't match loanId == "1", which is 
> set by A rule. But for me it's displaying as "A Rule" and then "B 
> Rule".. how is it possible? Why salience has no effect on rule B?
>
>
>  
> ------------------------------------------------------------------------
> Get email for your site ---> http://www.everyone.net
>
>------------------------------------------------------------------------
>
>_______________________________________________
>rules-users mailing list
>rules-users at lists.jboss.org
>https://lists.jboss.org/mailman/listinfo/rules-users
>  
>


-- 
 Edson Tirelli
 Software Engineer - JBoss Rules Core Developer
 Office: +55 11 3124-6000
 Mobile: +55 11 9218-4151
 JBoss, a division of Red Hat @ www.jboss.com





More information about the rules-users mailing list