Adhir,
   Im facing the same challenge using rules in a ETL process where performance is a main concern (some millisecs do the different when you have
millions of executions), so I'm using Globals to keep data in the session. You can add a global object as a global variable in the session scope and all
the rules will have access to it in conditions and actions.

            MyHelperClass helper = new MyHelperClass();
            StatelessKnowledgeSession statelessSession  = kb.newStatelessKnowledgeSession();
            if (statelessSession == null){
                log.error("Session was not created.");
                return;
            }
            statelessSession.setGlobal("myHelper", helper);

In the DRL you import the class and define the global. You can also define some static (or not) methods in the helper class to assit you and use them
as functions in your rules (if used as functions, methods needs to be static, if no static, then they can be used as methods of the global instance in
the consequence block)

             import com.mycompany.rules.helpers.MyHelperClass;
             import function com.mycompany.helpers.MyHelperClass.SOME_FUNCTION;

             global com.emycompany.helpers.MyHelperClass helper;      

This solution is not ideal, because you relay on java classes (code outside of the rules and RETE) to perform evaluations (functions with evals in conditions) and
the consequence hide some code in java classes, which is not so good because one of the main features of a rule engine is the separation of the logic from the
static code... but it works and it helps sometimes.

Good luck.
   

On Wed, Mar 23, 2011 at 7:55 AM, Adhir Mehta <adhirmehta21@gmail.com> wrote:
Thanks for the reply.

I think I was not up to the point. Modifying facts re-executes the rules to maintain the truth. In my case, I want to pass the data between the rules and also do not want rules to execute again. I know if no-loop option is specified, it will not be re-executed however I do not want rule engine to even go & check for no-loop option (which is additional work).

I may be wrong as I am new to drools.

Thanks,
Adhir


On Wed, Mar 23, 2011 at 11:48 AM, Mark Proctor <mproctor@codehaus.org> wrote:
On 23/03/2011 05:46, Adhir Mehta wrote:
Hi,

I have written the rule DRL file having around 30 rules in it. Some of the rules do intermediate calculation and those calculation result is expected in the other rules in same DRL file. I can do this by modifying the facts objects in one rule and get the value in other rule. However, modifying the facts object rebuild the RETE tree and affects the performance. Is there any way by which I can pass the data across the rules in same DRL file without rebuilding the RETE tree. (I am more concerned about the performance)
Please continue this conversation on the USER mailing list
http://www.jboss.org/drools/lists.html

Modifying facts does not rebuild the rete. Adding/Removing rules causes changes to Rete tree.

Thanks,
Adhir
_______________________________________________ rules-dev mailing list rules-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-dev


_______________________________________________
rules-dev mailing list
rules-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev



_______________________________________________
rules-dev mailing list
rules-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev




--
-----------------------------
Felipe Piccolini
felipe.piccolini@gmail.com