[rules-users] How Can a Drools Rule call another Drools Rule?
Swindells, Thomas
TSwindells at nds.com
Fri Aug 20 04:27:40 EDT 2010
Why are you trying to call a specific rule? It doesn't really make sense to talk about calling a rule to begin with and probably shows that you are still thinking imperatively not declaratively.
Rules do not get called. Rules have conditions which determine when they can be activated. Activated rules are then sorted into a priority queue and each in turn has its consequence applied, updating the priority queue as necessary.
If you explain your use case in a bit more detail we may be able to help you structure a more appropriate solution,
Thomas
From: rules-users-bounces at lists.jboss.org [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Sanjib Karmakar
Sent: 20 August 2010 08:44
To: rules-users at lists.jboss.org
Subject: Re: [rules-users] How Can a Drools Rule call another Drools Rule?
Sir
Thank you very much for your reply.
In fact what I wanted to execute the specific rule out of say 10 rules.
I have tried
ksession.fireAllRules(2);
Then only first 2 rules get executed.
Please let me know if there is any way-out to call specific rules out of bunch of rules.
It would be extremely helpful if you please share a code snippet regarding this.
Regards
Sanjib Karmakar
SkyTech Solutions Pvt. Ltd
Please consider the environment before printing this email.
"Wolfgang Laun-2 [via Drools - Java Rules Engine]" <[hidden email]</user/SendEmail.jtp?type=node&node=1238924&i=0>>
08/19/2010 07:45 PM
To
Sanjib Karmakar <[hidden email]</user/SendEmail.jtp?type=node&node=1238924&i=1>>
cc
Subject
Re: How Can a Drools Rule call another Drools Rule?
Rules are never "called". Changes in WM create (and also delete)
"activations": tuples consisting of a rule and the fact objects
matching the left hand side patterns. From this set of activations,
rule right hand sides are executed according to salience (and other
criteria).
Perhaps if you describe the actual problem...?
-W
On 19 August 2010 06:58, Sanjib Karmakar <[hidden email]</user/SendEmail.jtp?type=node&node=1225490&i=0&by-user=t>> wrote:
>
> Hi friends
>
> I would like to execute a rule say Rule-1 from inside another rule say
> Rule-2.
> In project I am using xml and not drl, and I am using Drools 5.0
>
> Please let me know how to call a rule from another rule.
>
> Thanks
> Sanjib
> --
> View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/How-Can-a-Drools-Rule-call-another-Drools-Rule-tp1219190p1219190.html<http://drools-java-rules-engine.46999.n3.nabble.com/How-Can-a-Drools-Rule-call-another-Drools-Rule-tp1219190p1219190.html?by-user=t&by-user=t>
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> [hidden email]</user/SendEmail.jtp?type=node&node=1225490&i=1&by-user=t>
> https://lists.jboss.org/mailman/listinfo/rules-users
>
_______________________________________________
rules-users mailing list
[hidden email]</user/SendEmail.jtp?type=node&node=1225490&i=2&by-user=t>
https://lists.jboss.org/mailman/listinfo/rules-users
________________________________
View message @ http://drools-java-rules-engine.46999.n3.nabble.com/How-Can-a-Drools-Rule-call-another-Drools-Rule-tp1219190p1225490.html<http://drools-java-rules-engine.46999.n3.nabble.com/How-Can-a-Drools-Rule-call-another-Drools-Rule-tp1219190p1225490.html?by-user=t>
To unsubscribe from How Can a Drools Rule call another Drools Rule?, click here<http://drools-java-rules-engine.46999.n3.nabble.com/template/NodeServlet.jtp?tpl=unsubscribe_by_code&node=1219190&code=c2Fuamlia0Bza3l0ZWNoc29sdXRpb25zLmNvLmlufDEyMTkxOTB8MTQzMDExODQ0MA==&by-user=t>.
________________________________
View this message in context: Re: How Can a Drools Rule call another Drools Rule?<http://drools-java-rules-engine.46999.n3.nabble.com/How-Can-a-Drools-Rule-call-another-Drools-Rule-tp1219190p1238924.html>
Sent from the Drools - User mailing list archive<http://drools-java-rules-engine.46999.n3.nabble.com/Drools-User-f47000.html> at Nabble.com.
________________________________
**************************************************************************************
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/20100820/a8ec556f/attachment.html
More information about the rules-users
mailing list