[rules-users] Salience not working

sridhar123 sridhar.peddinti at sabre.com
Tue May 13 16:44:41 EDT 2008


It still dosen't work as desired. Here is my code:

      rule A
Salience 10
when
 $data : MyFact( $anotherObj )
then
  modify(  $anotherObj ) {
     setDiscard(true)
   }

rule B
Salience 5
when 
  eval ($anotherObj.isDiscard() == true)
then
 ...

It seems, all When conditions are executed first irrespective of "then"

I also tried with agenda group and having default focus on Rule A and in
Then section setting focus to Rule B - still the condition doesnt match.
When i inspect fact - after Rule A is executed, i see my flag is set to true
- but not visible to Rule B.

Do i need to write seperate drl files. Also, i am using eclipse 3.3 and
ruleflow seems buggy i can not add any rule flow groups. do i need to use
3.2. I am using Drools 4.0.4

thank you





Alessandro Lazarotti wrote:
> 
> 
> 
> 
>   
> 
> 
> rule A
> 	 Salience 10
>  when
> 	  $anotherObject: MyFact(discard != true)
>  then 
> 	  modify($anotherObj){ 
> 		   setDiscard(true)	
> 	  } 
> 
> 
> "Modify" update your fact in the current working memory.
> 
> 
> 
> sridhar123 escreveu:
> 
>   
> It means, I can not fire all rules at once, I need to groups and change
> focus in my java code? 
> 
> I couldn't find any docs or examples to properly use Salience - could you
> please share an example (if you have one)
> 
> thx
> 
> 
> 
> Alessandro Lazarotti wrote:
>   
>   
>     You need upate() the fact $anotherObj in Working Memory.
> 
> sridhar123 escreveu:
>     
>     
>       rule A
> Salience 10
> when
>  $data : MyFact( $anotherObj )
> then
>   $anotherObj.setDiscard(true)
> 
> rule B
> Salience 5
> when 
>   eval ($anotherObj.isDiscard() == true)
> then
>    ...
> 
> 
> I am trying to get Rule A executed before Rule B. So when condition in
> Rule
> B is valid. However i dont see "Saliene" has any effect. How else i can
> do
> the above?
> 
> thank you
> 
>   
>       
>     
>     _______________________________________________
> 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/Salience-not-working-tp17190028p17217969.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list