Re: [rules-users] How to update the working memory of a nested object attribute

2011-07-06 Thread Swindells, Thomas
You need a way to differentiate between policy's that have been updated and 
that haven't been updated.
If you have control of your model then you could add an extra field, either as 
a flag or containing the new value - if this field is null you know you need to 
update it.
If you can't change that part of the model you can introduce a new class 
PolicyUpdated(Service policy). When you update the policy you insert one of 
these. You then change your conditions to add not PolicyUpdated(policy == 
$policy) which will then stop you retriggering yourself. Finally you need to 
tell drools that you have modified Client.
It may be more efficient to actually fetch and insert the policy service 
objects into the working memory, then you only need to tell drools/your rules 
that you have updated one small part of your rules rather than getting it to 
reiterate over all the services every update.

Thomas


From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Wishing Carebear
Sent: 06 July 2011 04:47
To: Rules Users List
Subject: [rules-users] How to update the working memory of a nested object 
attribute

Hi,
My rules update the nested object attributes :eligibilityScore which is used in 
another rule downstream.

Only the Client object is sent as fact, the nested object is derived using the 
from keyword (list of services)

rule  Rule 8 EligibilityRating
agenda-group  EligibilityRating
no-loop true
salience 5
//dialect  mvel
when
$client : Client(type == Preferred)
$policy : Service(productType == Vehicle Insurance) from 
$client.service
then
System.out.println( Rule 8 ER = type == preferred:+ $policy.getId() + 
: -50);
int eScore = $policy.getEligibilityScore() - 50;
$policy.setEligibilityScore(eScore); // how to let the downstream rule 
know that this atribute value is updated without letting this current rule go 
into infinite loop
end

Any suggestion is greatly appreciated



**
This message is confidential and intended only for the addressee. If you have 
received this message in error, please immediately notify the 
postmas...@nds.com and delete it from your system as well as any copies. The 
content of e-mails as well as traffic data may be monitored by NDS for 
employment and security purposes. To protect the environment please do not 
print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, 
United Kingdom. A company registered in England and Wales. Registered no. 
3080780. VAT no. GB 603 8808 40-00
**
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] How to update the working memory of a nested object attribute

2011-07-06 Thread Wishing Carebear
Thanks Swindel.
The eligibilityScore is updated on 3 different rules by decrementing the
value if the condition is satisfied. Finally the eligibilityScore value is
used in the downstream. Is there any pattern available for these types of
use cases.



2011/7/6 Swindells, Thomas tswinde...@nds.com

  You need a way to differentiate between policy’s that have been updated
 and that haven’t been updated.

 If you have control of your model then you could add an extra field, either
 as a flag or containing the new value – if this field is null you know you
 need to update it.

 If you can’t change that part of the model you can introduce a new class
 PolicyUpdated(Service policy). When you update the policy you insert one of
 these. You then change your conditions to add “not PolicyUpdated(policy ==
 $policy)” which will then stop you retriggering yourself. Finally you need
 to tell drools that you have modified Client.

 It may be more efficient to actually fetch and insert the policy service
 objects into the working memory, then you only need to tell drools/your
 rules that you have updated one small part of your rules rather than getting
 it to reiterate over all the services every update.

 ** **

 Thomas

 ** **

 ** **

 *From:* rules-users-boun...@lists.jboss.org [mailto:
 rules-users-boun...@lists.jboss.org] *On Behalf Of *Wishing Carebear
 *Sent:* 06 July 2011 04:47
 *To:* Rules Users List
 *Subject:* [rules-users] How to update the working memory of a nested
 object attribute

 ** **

 Hi,
 My rules update the nested object attributes :eligibilityScore which is
 used in another rule downstream.

 Only the Client object is sent as fact, the nested object is derived using
 the from keyword (list of services)

 rule  Rule 8 EligibilityRating
 agenda-group  EligibilityRating
 no-loop true
 salience 5
 //dialect  mvel
 when
 $client : Client(type == Preferred)
 $policy : Service(productType == Vehicle Insurance) from
 $client.service
 then
 System.out.println( Rule 8 ER = type == preferred:+
 $policy.getId() + : -50);
 int eScore = $policy.getEligibilityScore() - 50;
* $policy.setEligibilityScore(eScore);* // how to let the
 downstream rule know that this atribute value is updated without letting
 this current rule go into infinite loop
 end

 Any suggestion is greatly appreciated

 --


 **
 This message is confidential and intended only for the addressee. If you
 have received this message in error, please immediately notify the
 postmas...@nds.com and delete it from your system as well as any copies.
 The content of e-mails as well as traffic data may be monitored by NDS for
 employment and security purposes. To protect the environment please do not
 print this e-mail unless necessary.

 NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18
 4EX, United Kingdom. A company registered in England and Wales. Registered
 no. 3080780. VAT no. GB 603 8808 40-00

 **

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] How to update the working memory of a nested object attribute

2011-07-06 Thread Swindells, Thomas
Add a name into the policyUpdated type - each type of rule which should operate 
separately only references policyUpdates of that given name so you stop those 
from retriggering while allowing the others to trigger.

Thomas

From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Wishing Carebear
Sent: 06 July 2011 14:17
To: Rules Users List
Subject: Re: [rules-users] How to update the working memory of a nested object 
attribute

Thanks Swindel.
The eligibilityScore is updated on 3 different rules by decrementing the value 
if the condition is satisfied. Finally the eligibilityScore value is used in 
the downstream. Is there any pattern available for these types of use cases.


2011/7/6 Swindells, Thomas tswinde...@nds.commailto:tswinde...@nds.com
You need a way to differentiate between policy's that have been updated and 
that haven't been updated.
If you have control of your model then you could add an extra field, either as 
a flag or containing the new value - if this field is null you know you need to 
update it.
If you can't change that part of the model you can introduce a new class 
PolicyUpdated(Service policy). When you update the policy you insert one of 
these. You then change your conditions to add not PolicyUpdated(policy == 
$policy) which will then stop you retriggering yourself. Finally you need to 
tell drools that you have modified Client.
It may be more efficient to actually fetch and insert the policy service 
objects into the working memory, then you only need to tell drools/your rules 
that you have updated one small part of your rules rather than getting it to 
reiterate over all the services every update.

Thomas


From: 
rules-users-boun...@lists.jboss.orgmailto:rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.orgmailto:rules-users-boun...@lists.jboss.org]
 On Behalf Of Wishing Carebear
Sent: 06 July 2011 04:47
To: Rules Users List
Subject: [rules-users] How to update the working memory of a nested object 
attribute

Hi,
My rules update the nested object attributes :eligibilityScore which is used in 
another rule downstream.

Only the Client object is sent as fact, the nested object is derived using the 
from keyword (list of services)

rule  Rule 8 EligibilityRating
agenda-group  EligibilityRating
no-loop true
salience 5
//dialect  mvel
when
$client : Client(type == Preferred)
$policy : Service(productType == Vehicle Insurance) from 
$client.service
then
System.out.println( Rule 8 ER = type == preferred:+ $policy.getId() + 
: -50);
int eScore = $policy.getEligibilityScore() - 50;
$policy.setEligibilityScore(eScore); // how to let the downstream rule 
know that this atribute value is updated without letting this current rule go 
into infinite loop
end

Any suggestion is greatly appreciated



**
This message is confidential and intended only for the addressee. If you have 
received this message in error, please immediately notify the 
postmas...@nds.commailto:postmas...@nds.com and delete it from your system as 
well as any copies. The content of e-mails as well as traffic data may be 
monitored by NDS for employment and security purposes. To protect the 
environment please do not print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, 
United Kingdom. A company registered in England and Wales. Registered no. 
3080780. VAT no. GB 603 8808 40-00
**

___
rules-users mailing list
rules-users@lists.jboss.orgmailto:rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] How to update the working memory of a nested object attribute

2011-07-06 Thread Wishing Carebear
Thanks Thomas.

2011/7/6 Swindells, Thomas tswinde...@nds.com

 Add a name into the policyUpdated type – each type of rule which should
 operate separately only references policyUpdates of that given name so you
 stop those from retriggering while allowing the others to trigger.

 ** **

 Thomas

 ** **

 *From:* rules-users-boun...@lists.jboss.org [mailto:
 rules-users-boun...@lists.jboss.org] *On Behalf Of *Wishing Carebear
 *Sent:* 06 July 2011 14:17
 *To:* Rules Users List
 *Subject:* Re: [rules-users] How to update the working memory of a nested
 object attribute

 ** **

 Thanks Swindel.
 The eligibilityScore is updated on 3 different rules by decrementing the
 value if the condition is satisfied. Finally the eligibilityScore value is
 used in the downstream. Is there any pattern available for these types of
 use cases.


 

 2011/7/6 Swindells, Thomas tswinde...@nds.com

 You need a way to differentiate between policy’s that have been updated and
 that haven’t been updated.

 If you have control of your model then you could add an extra field, either
 as a flag or containing the new value – if this field is null you know you
 need to update it.

 If you can’t change that part of the model you can introduce a new class
 PolicyUpdated(Service policy). When you update the policy you insert one of
 these. You then change your conditions to add “not PolicyUpdated(policy ==
 $policy)” which will then stop you retriggering yourself. Finally you need
 to tell drools that you have modified Client.

 It may be more efficient to actually fetch and insert the policy service
 objects into the working memory, then you only need to tell drools/your
 rules that you have updated one small part of your rules rather than getting
 it to reiterate over all the services every update.

  

 Thomas

  

  

 *From:* rules-users-boun...@lists.jboss.org [mailto:
 rules-users-boun...@lists.jboss.org] *On Behalf Of *Wishing Carebear
 *Sent:* 06 July 2011 04:47
 *To:* Rules Users List
 *Subject:* [rules-users] How to update the working memory of a nested
 object attribute

  

 Hi,
 My rules update the nested object attributes :eligibilityScore which is
 used in another rule downstream.

 Only the Client object is sent as fact, the nested object is derived using
 the from keyword (list of services)

 rule  Rule 8 EligibilityRating
 agenda-group  EligibilityRating
 no-loop true
 salience 5
 //dialect  mvel
 when
 $client : Client(type == Preferred)
 $policy : Service(productType == Vehicle Insurance) from
 $client.service
 then
 System.out.println( Rule 8 ER = type == preferred:+
 $policy.getId() + : -50);
 int eScore = $policy.getEligibilityScore() - 50;
* $policy.setEligibilityScore(eScore);* // how to let the
 downstream rule know that this atribute value is updated without letting
 this current rule go into infinite loop
 end

 Any suggestion is greatly appreciated

 ** **
 --



 **
 This message is confidential and intended only for the addressee. If you
 have received this message in error, please immediately notify the
 postmas...@nds.com and delete it from your system as well as any copies.
 The content of e-mails as well as traffic data may be monitored by NDS for
 employment and security purposes. To protect the environment please do not
 print this e-mail unless necessary.

 NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18
 4EX, United Kingdom. A company registered in England and Wales. Registered
 no. 3080780. VAT no. GB 603 8808 40-00

 **
 


 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

 ** **

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users