[rules-users] rules-users Digest, Vol 43, Issue 60

Nikhil S. Kulkarni Nikhil.Kulkarni at mastek.com
Fri Jun 11 08:36:36 EDT 2010


Hi,

Thanks Thomas for Reply for Re: [rules-users] How to break the rules execution if one has
        been    satisfied ??
My Question is like in Java as we have break statement so that we can terminate the loop,
So if there are 1000 rules activated and Rule fired is Rule no 4 then How will I come out of this
Immediately in order to save time of rules execution.


Thanks & Regards,
Nikhil S. Kulkarni




-----Original Message-----
From: rules-users-bounces at lists.jboss.org [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of rules-users-request at lists.jboss.org
Sent: Friday, June 11, 2010 5:16 PM
To: rules-users at lists.jboss.org
Subject: rules-users Digest, Vol 43, Issue 60

Send rules-users mailing list submissions to
        rules-users at lists.jboss.org

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.jboss.org/mailman/listinfo/rules-users
or, via email, send a message with subject or body 'help' to
        rules-users-request at lists.jboss.org

You can reach the person managing the list at
        rules-users-owner at lists.jboss.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of rules-users digest..."


Today's Topics:

   1. Fwd: [drools-user] Write Drools Books - Packt     Publishing.
      (Mark Proctor)
   2. How to break the rules execution if one has been  satisfied ??
      (Nikhil S. Kulkarni)
   3. Re: How to break the rules execution if one has   been
      satisfied ?? (Swindells, Thomas)


----------------------------------------------------------------------

Message: 1
Date: Fri, 11 Jun 2010 12:07:43 +0100
From: Mark Proctor <mproctor at codehaus.org>
Subject: [rules-users] Fwd: [drools-user] Write Drools Books - Packt
        Publishing.
To: Rules Users List <rules-users at lists.jboss.org>,     Rules Dev List
        <rules-dev at lists.jboss.org>
Message-ID: <4C1218FF.8000608 at codehaus.org>
Content-Type: text/plain; charset="iso-8859-1"

-------- Original Message --------Kshipra Singh <kshipras at packtpub.com>

Hello Everybody,
I represent Packt Publishing, the publishers of computer related books.
We are planning to expand our range of Drools books and are currently
inviting Drools experts interested in writing books for Packt.
We do not expect our authors to have any past writing experience. All
that you need to write for Packt is an expert knowledge of your subject,
a passion to share it with others and an ability to communicate clearly
in English.
So, if you love Drools and fancy writing a book, here's an opportunity
for you! Send us your book ideas at author at packtpub.com. Even if you
don't have a book idea and are simply interested in writing a book, we
are keen to hear from you!
More details about this opportunity are available at :
http://authors.packtpub.com/content/packt-invites-drools-book-ideas-authors
Thanks
Kshipra Singh
Author Relationship Manager
Packt Publishing
www.PacktPub.com <http://www.PacktPub.com>

Skype: kshiprasingh15
Twitter: http://twitter.com/packtauthors

Interested in becoming an author? Visit http://authors.packtpub.com for
all the information you need about writing for Packt.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100611/909f7724/attachment-0001.html

------------------------------

Message: 2
Date: Fri, 11 Jun 2010 16:57:09 +0530
From: "Nikhil S. Kulkarni" <Nikhil.Kulkarni at mastek.com>
Subject: [rules-users] How to break the rules execution if one has
        been    satisfied ??
To: "rules-users at lists.jboss.org" <rules-users at lists.jboss.org>
Message-ID:
        <697B15BDCE7BED458A324B1B4D09463D4CE6DBBF57 at IND-MHP1MCL001.mastek.com>
Content-Type: text/plain; charset="us-ascii"

Hi,

In rules, in a particular rule set, all the when's are executed. In technical terms, the activation is first created. For all the rules in a rule set the when condition is first evaluated and if the when condition is satisfied for any rule then the rule is marked as ready to fire. Once all the when part for all the rules are evaluated then all the ones that were marked for fire are fired.
The performance issue that if there are some 1500 rows. Hence, when the rule is fired there are 1500 when conditions that are firstly checked. And only after this the then part is fired. There is no way to break the when checks on successful satisfaction of a particular rule when.

Example:
If I have say a group of 1000 rules as mentioned below

Rule_1
Salience 1000
When
                Some_Conditions_1
Then
                Some_Actions_1

Rule_2
Salience 999
When
                Some_Conditions_2
Then
                Some_Actions_2
.
.
.
Rule_1000
Salience 1
When
                Some_Conditions_1000
Then
                Some_Actions_1000

Let's assume that Some_conditions_2 = true
Now even though I have an ordering using salience, the rule engine will still execute all the when conditions (Some_Conditions_1 .. Some_Conditions_1000)

Is it possible for me to break this when evaluation even if one has been satisfied?



Thanks & Regards,
Nikhil S. Kulkarni

MASTEK LTD.
Mastek is in NASSCOM's 'India Top 20' Software Service Exporters List.
In the US, we're called MAJESCOMASTEK

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from desktop and server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100611/2482cf26/attachment-0001.html

------------------------------

Message: 3
Date: Fri, 11 Jun 2010 12:46:01 +0100
From: "Swindells, Thomas" <TSwindells at nds.com>
Subject: Re: [rules-users] How to break the rules execution if one has
        been    satisfied ??
To: Rules Users List <rules-users at lists.jboss.org>
Message-ID:
        <DAC86F5F3B84F14088F0DB16092558CA0855AE8E0A at UKMA1.UK.NDS.COM>
Content-Type: text/plain; charset="us-ascii"

You technical description isn't at all accurate.
You need to read up on Rete Trees, I'm still a bit vague on them myself but a hopefully slightly more accurate description is as follows:
When the rules are compiled each of their conditions is converted to a node on the graph.  If rules share the same initial set of conditions then they will share those nodes in the tree.  These nodes contain references to the data in the working memory that they match against.  When an object is added or updated in working memory then the knowledge of this allows just the relevant nodes to be re-evaluated trickling down the tree.  If a leaf node is reached with a particular set of Objects then this means that the rule can then be placed on the activation queue with that set of data.

This Rete graph is designed to solve the problem you are describing which is why we have a rules engine rather than doing the naive procedural implementation of 'firing rules'.  Of course if all your rules are disjoint but rely on the same set of Objects then there isn't any choice but to evaluate all the rules, after all they may all do different things and normally you want multiple rules to fire.

How you write your rules can also have a massive impact on performance and the shape of the graph (which you can see in eclipse), are you worrying about this purely from a theoretical viewpoint or are you having a concrete performance problem?

Hope this helps your understanding,

Thomas

From: rules-users-bounces at lists.jboss.org [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Nikhil S. Kulkarni
Sent: 11 June 2010 12:27
To: rules-users at lists.jboss.org
Subject: [rules-users] How to break the rules execution if one has been satisfied ??

Hi,

In rules, in a particular rule set, all the when's are executed. In technical terms, the activation is first created. For all the rules in a rule set the when condition is first evaluated and if the when condition is satisfied for any rule then the rule is marked as ready to fire. Once all the when part for all the rules are evaluated then all the ones that were marked for fire are fired.
The performance issue that if there are some 1500 rows. Hence, when the rule is fired there are 1500 when conditions that are firstly checked. And only after this the then part is fired. There is no way to break the when checks on successful satisfaction of a particular rule when.

Example:
If I have say a group of 1000 rules as mentioned below

Rule_1
Salience 1000
When
                Some_Conditions_1
Then
                Some_Actions_1

Rule_2
Salience 999
When
                Some_Conditions_2
Then
                Some_Actions_2
.
.
.
Rule_1000
Salience 1
When
                Some_Conditions_1000
Then
                Some_Actions_1000

Let's assume that Some_conditions_2 = true
Now even though I have an ordering using salience, the rule engine will still execute all the when conditions (Some_Conditions_1 .. Some_Conditions_1000)

Is it possible for me to break this when evaluation even if one has been satisfied?



Thanks & Regards,
Nikhil S. Kulkarni



MASTEK LTD.
Mastek is in NASSCOM's 'India Top 20' Software Service Exporters List.
In the US, we're called MAJESCOMASTEK

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from desktop and server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



________________________________

**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster at 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
**************************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100611/0da1a60f/attachment.html

------------------------------

_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


End of rules-users Digest, Vol 43, Issue 60
*******************************************


MASTEK LTD.
Mastek is in NASSCOM's 'India Top 20' Software Service Exporters List.
In the US, we're called MAJESCOMASTEK

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from desktop and server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





More information about the rules-users mailing list