[rules-users] Synch Business Object / Working Memory

Anstis, Michael (M.) manstis1 at ford.com
Fri Apr 11 05:39:41 EDT 2008


In essence, yes. Have a look at "update" in the manual (and a read on Shadow
Facts will probably be useful too).


  _____  

From: rules-users-bounces at lists.jboss.org
[mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Jonathan
Guéhenneux
Sent: 11 April 2008 10:24
To: Rules Users List
Subject: RE: [rules-users] Synch Business Object / Working Memory


yes, i made a mistake. its a.setE(...) and not c.setE(...).

I don't call update. If I dont call update, properties of an object are just
read one time for all rules?




  _____  

Subject: RE: [rules-users] Synch Business Object / Working Memory
Date: Fri, 11 Apr 2008 09:47:43 +0100
From: manstis1 at ford.com
To: rules-users at lists.jboss.org


I guess the example is a simplification as "c" (in RHS) has not been bound
to a fact.
 
Anyway, that aside, do you call "update" to ensure WM knows of changes to
facts otherwise properties need to be "time-constant" which in your example
they are not.


  _____  

From: rules-users-bounces at lists.jboss.org
[mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Jonathan
Guéhenneux
Sent: 11 April 2008 09:34
To: Rules Users List
Subject: [rules-users] Synch Business Object / Working Memory


Hi,

I have two rules :

rule "rule 1 - 1"
    
    salience 90
    ruleflow-group "rfg1"
    when
        a : A(
            eComputed == "false",
            c < 15,
            d >= 75)        
    then
        c.setE(0);
end



rule "rule 1 - 2"

    salience 10
    ruleflow-group "rfg1"
    when
        a : A(
            eComputed == "false",
            c >= 15,
            d >= 75)        
    then
        c.setE(1);
end



and part of the corresponding business code :

public class A {

    ...

    public String getEComputed(){
       if(eComputed)
          return "true";
       else
          return "false";
    }

    ...

    public void setE(int e){
        this.e = e;
        eComputed = true;
    }

    ...

}



so, I expected that if the first rule is activated, the second won't be. But
according to my tests, the two rule can be fired on the same object A.
While debugging, I noticed the getEComputed method was only called once. I
suppose that I should write this :


rule "rule 1 - 1"
    
    salience 90
    ruleflow-group "rfg1"
    when
        a : A(
            eComputed == "false",
            c < 15,
            d >= 75)        
    then
        c.setE(0);
        c.setEComputed("true);
end



rule "rule 1 - 2"

    salience 10
    ruleflow-group "rfg1"
    when
        a : A(
            eComputed == "false",
            c >= 15,
            d >= 75)        
    then
        c.setE(1);
        c.setEComputed("true);
end

But I would prefer another solution. Thanks for help.


  _____  

Plus de 15 millions de français utilisent Windows Live Messenger !
Téléchargez  <http://www.windowslive.fr/messenger/> Messenger, c'est gratuit
! 


  _____  

Plus de 15 millions de français utilisent Windows Live Messenger !
Téléchargez Messenger,  <http://www.windowslive.fr/messenger/> c'est gratuit
! 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080411/0c9b6ad8/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 7206 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20080411/0c9b6ad8/attachment.bin 


More information about the rules-users mailing list