Re: [rules-users] Initialize Global

2007-10-31 Thread Joshua Undesser
uot;1"); > objectList.add("2"); > drools.getWorkingMemory().setGlobal("objectList", objectList); > end > > Kris > > - Original Message - > From: "drools_user" <[EMAIL PROTECTED]> > To: > Sent: Wednesday, October 24

RE: [rules-users] Initialize Global

2007-10-30 Thread java_user_
LHS of the rule. > > This should provide the condition you request and prevent the rule from > firing after the global has been initialised. > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of java_user_ > Sent: 30 October 20

RE: [rules-users] Initialize Global

2007-10-30 Thread Anstis, Michael (M.)
rom: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of java_user_ Sent: 30 October 2007 16:06 To: rules-users@lists.jboss.org Subject: Re: [rules-users] Initialize Global Hi Kris, I am using a JSR94 stateful session. My design is to initialize the global list once and reuse it within the s

Re: [rules-users] Initialize Global

2007-10-30 Thread java_user_
Hi Kris, I am using a JSR94 stateful session. My design is to initialize the global list once and reuse it within the same session. The init-global rule is being executed each execution because there is no conditional statement. Can I disable the rule for future executions? Thanks Kris V

Re: [rules-users] Initialize Global

2007-10-30 Thread Waruzjan Shahbazian
d rule "end" salience 97 when $g : MyGlobalObject( list != null ) then System.out.println("End objectList: " + $g.getList()); end -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Waruzjan Shahbazian Sent: 3

RE: [rules-users] Initialize Global

2007-10-30 Thread Anstis, Michael (M.)
>> $g : MyGlobalObject( list != null ) >> then >> System.out.println("End objectList: " + $g.getList()); >> end -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Waruzjan Shahbazian Sent: 30 October 2

Re: [rules-users] Initialize Global

2007-10-30 Thread Waruzjan Shahbazian
Thanks, that sounds logical to me. I guess I just have to "trust" that the rule where the array gets initialised activates earlier than the rule where I need the array. That shouldn't be a problem since I use salience and to avoid nullpoint exceptions I can use the if(objectList != null) in th

Re: [rules-users] Initialize Global

2007-10-30 Thread vdelbart
It's normal. Globally, the rule engine works in two steps : - first : the activation (the "when" statement) - second : the execution (the "then" statement) with salience, ruleflow ... In your test, you have in the first step objectList = null and in the second step objectList = [1, 2]. If you

Re: [rules-users] Initialize Global

2007-10-30 Thread vdelbart
;, objectList); >> end >> >> Kris >> >> - Original Message - >> From: "drools_user" <[EMAIL PROTECTED]> >> To: >> Sent: Wednesday, October 24, 2007 7:35 PM >> Subject: [rules-users] Initialize Global >> &g

Re: [rules-users] Initialize Global

2007-10-30 Thread Waruzjan Shahbazian
I have the same "problem", but eval(objectList == null) doesn't work. If I don't execute "drools.getWorkingMemory().setGlobal()" it "works fine", as if the rule activates and the object is null. global List objectList; rule "Start" salience 101 when #conditions then obje

Re: [rules-users] Initialize Global

2007-10-29 Thread Kris Verlaenen
That initialized my global but the rule still runs every execution. Can I disable the rule after the first execution? What do you mean by "every execution". A rule should only be executed once, unless it gets reactivated (which should not be the case in this situation). I would like to use (i

Re: [rules-users] Initialize Global

2007-10-29 Thread java_user_
t.add("2"); > drools.getWorkingMemory().setGlobal("objectList", objectList); > end > > Kris > > - Original Message - > From: "drools_user" <[EMAIL PROTECTED]> > To: > Sent: Wednesday, October 24, 2007 7:35 PM > Subjec

Re: [rules-users] Initialize Global

2007-10-25 Thread vdelbart
Beware, 2.5.4.5. Globals "If you use a global on the LHS of a rule, make sure it is immutable." regards, V. java_user_ wrote: > > How do I initialize a global fact in the drl file? I want use the JSR94 > API and avoid using the Drools API inside the Java code. I would like to > access the

Re: [rules-users] Initialize Global

2007-10-25 Thread Kris Verlaenen
s.getWorkingMemory().setGlobal("objectList", objectList); end Kris - Original Message - From: "drools_user" <[EMAIL PROTECTED]> To: Sent: Wednesday, October 24, 2007 7:35 PM Subject: [rules-users] Initialize Global How do I initialize a global fact in the

RE: [rules-users] Initialize Global

2007-10-25 Thread Anstis, Michael (M.)
When $f : MyFact() Then $f.doSomethingToInitialiseIt(); End -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of drools_user Sent: 24 October 2007 18:35 To: rules-users@lists.jboss.org Subject: [rules-users] Initialize Global How

[rules-users] Initialize Global

2007-10-24 Thread drools_user
How do I initialize a global fact in the drl file? I want use the JSR94 API and avoid using the Drools API inside the Java code. I would like to access the same variable every execution of a stateful session without having to reinstantiate the variable after each execution? Basically I want to