<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:verdana, helvetica, sans-serif;font-size:10pt"><DIV></DIV>
<DIV>Can I use like this </DIV>
<DIV><FONT size=2> </DIV>
<P> p:Product(productType=="some") </FONT><B><FONT color=#960000 size=2><FONT color=#960000 size=2>from</B></FONT></FONT><FONT size=2> ArrayList<Product> in rule file</P>
<P></FONT> </P>
<P> If I use like above ,what will be the result.</P>
<DIV><BR> </DIV>Thanks<BR>Prasad Raju Sagi<BR>Mobile: 847-644-4103
<DIV><BR></DIV>
<DIV style="FONT-SIZE: 10pt; FONT-FAMILY: verdana, helvetica, sans-serif"><BR>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><FONT face=Tahoma size=2>
<HR SIZE=1>
<B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> prasad raju sagi <prasadrajusagi@yahoo.com><BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Rules Users List <rules-users@lists.jboss.org><BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Wednesday, June 10, 2009 3:59:54 PM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> Re: [rules-users] inserting fact as arraylist in orkingmemory / session<BR></FONT><BR>
<DIV style="FONT-SIZE: 10pt; FONT-FAMILY: verdana, helvetica, sans-serif">
<DIV></DIV>
<DIV>Hi ,</DIV>
<DIV> </DIV>
<DIV>I am trying to insert fact as arraylist and then i wanted to get the objects from the arraylist based on some condition.</DIV>
<DIV> </DIV>
<DIV>like Arryalist<Product> fact was inserted into working memory, I want to get some product from the arrylist based on condition ( productType==??).</DIV>
<DIV> </DIV>
<DIV>Is there any solution for this .</DIV>
<DIV><BR> </DIV>Thanks<BR>Prasad Raju Sagi<BR>Mobile: 847-644-4103
<DIV><BR></DIV>
<DIV style="FONT-SIZE: 10pt; FONT-FAMILY: verdana, helvetica, sans-serif"><BR>
<DIV style="FONT-SIZE: 13px; FONT-FAMILY: arial, helvetica, sans-serif"><FONT face=Tahoma size=2>
<HR SIZE=1>
<B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> Greg Barton <greg_barton@yahoo.com><BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Rules Users List <rules-users@lists.jboss.org><BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Wednesday, June 10, 2009 3:25:39 PM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> RE: [rules-users] Constaint evaluation<BR></FONT><BR><BR>Correct. When there are no more instantiations (a rule plus a set of objects that match the rule's conditions) on the agenda, then rule firing ceases. With version 5 of drools they added the ability to keep the session ready and available to react even when there are no instantiations on the agenda, but you must make a separate method call to do that. (StatefulSession.fireUntilHalt() instead of fireAllRules())<BR><BR>--- On Wed, 6/10/09, Malenfant, Andre <<A href="mailto:andre.malenfant@cgi.com" target=_blank rel=nofollow
ymailto="mailto:andre.malenfant@cgi.com">andre.malenfant@cgi.com</A>> wrote:<BR><BR>> From: Malenfant, Andre <<A href="mailto:andre.malenfant@cgi.com" target=_blank rel=nofollow ymailto="mailto:andre.malenfant@cgi.com">andre.malenfant@cgi.com</A>><BR>> Subject: RE: [rules-users] Constaint evaluation<BR>> To: "Rules Users List" <<A href="mailto:rules-users@lists.jboss.org" target=_blank rel=nofollow ymailto="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A>><BR>> Date: Wednesday, June 10, 2009, 2:55 PM<BR>> Ok, so now I understand that the<BR>> "immutable" is really a concept but not necessarily<BR>> "enforced". So, the rule conditions get evaluated each time<BR>> the working memory is updated (and not globals) and rules<BR>> for which the conditions are true at each evaluation will<BR>> fire. The execution of the rules will end when there is no<BR>> more rules for which the conditions are
true. Am I correct?<BR>> <BR>> Thanks<BR>> <BR>> -----Original Message-----<BR>> From: <A href="mailto:rules-users-bounces@lists.jboss.org" target=_blank rel=nofollow ymailto="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</A><BR>> [mailto:<A href="mailto:rules-users-bounces@lists.jboss.org" target=_blank rel=nofollow ymailto="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</A>]<BR>> On Behalf Of Greg Barton<BR>> Sent: Wednesday, June 10, 2009 3:49 PM<BR>> To: Rules Users List<BR>> Subject: RE: [rules-users] Constaint evaluation<BR>> <BR>> <BR>> The ideas is that objects in working memory are those that<BR>> meant to be tracked: their changes are made visible to the<BR>> rules via the insert/update/retract methods. A global<BR>> is not in working memory, so it's changes cannot be<BR>> tracked. You can change the contents of a
global all<BR>> day long and the rules would never be notified.<BR>> <BR>> It's a similar concept to threads and<BR>> synchronization. You can have unsynchronized access to<BR>> member variables in a class when in a multithreaded<BR>> environment, but the results are unpredictable. <BR>> Likewise, you can use globals in conditions, and change the<BR>> value of the global as you go, but the results are<BR>> unpredictable. <BR>> <BR>> --- On Wed, 6/10/09, Malenfant, Andre <<A href="mailto:andre.malenfant@cgi.com" target=_blank rel=nofollow ymailto="mailto:andre.malenfant@cgi.com">andre.malenfant@cgi.com</A>><BR>> wrote:<BR>> <BR>> > From: Malenfant, Andre <<A href="mailto:andre.malenfant@cgi.com" target=_blank rel=nofollow ymailto="mailto:andre.malenfant@cgi.com">andre.malenfant@cgi.com</A>><BR>> > Subject: RE: [rules-users] Constaint evaluation<BR>> > To: "Kris
Verlaenen" <<A href="mailto:Kris.Verlaenen@cs.kuleuven.be" target=_blank rel=nofollow ymailto="mailto:Kris.Verlaenen@cs.kuleuven.be">Kris.Verlaenen@cs.kuleuven.be</A>><BR>> > Cc: "Rules Users List" <<A href="mailto:rules-users@lists.jboss.org" target=_blank rel=nofollow ymailto="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A>><BR>> > Date: Wednesday, June 10, 2009, 2:20 PM<BR>> > Thanks Kris,<BR>> > <BR>> > I will try with code constraints.<BR>> > <BR>> > But on the globals subject, I read in the<BR>> documentation<BR>> > that one should not use a global in a rule. I have<BR>> trouble<BR>> > understanding why. I don't think drools clones the<BR>> global<BR>> > object (might not be possible anyway). If my rule<BR>> > consequences change the state of a global (this usage<BR>> is<BR>> > considered valid as per the documentation as
well)<BR>> then what<BR>> > is the harm of using it in a condition? I could<BR>> understand<BR>> > with immutable objects like String but...<BR>> > <BR>> > I can change my code to insert that global in the<BR>> working<BR>> > memory but I would like to understand why I should do<BR>> so...<BR>> > And if I do and the state of that object is changed by<BR>> a<BR>> > consequence of my rules, I have to call update? For<BR>> the same<BR>> > reason? I guess I am trying to understand the<BR>> underlying<BR>> > mechanism.<BR>> > <BR>> > Thanks<BR>> > <BR>> > <BR>> > -----Original Message-----<BR>> > From: Kris Verlaenen [mailto:<A href="mailto:Kris.Verlaenen@cs.kuleuven.be" target=_blank rel=nofollow ymailto="mailto:Kris.Verlaenen@cs.kuleuven.be">Kris.Verlaenen@cs.kuleuven.be</A>]<BR>> > <BR>> > Sent: Wednesday, June 10, 2009 11:38
AM<BR>> > To: Rules Users List; Malenfant, Andre<BR>> > Cc: Rules Users List<BR>> > Subject: Re: [rules-users] Constaint evaluation<BR>> > <BR>> > It depends on what type of constraint you are using.<BR>> > <BR>> > If you are using a rule constraint, that constraint<BR>> will be<BR>> > evaluated<BR>> > just the same as normal rules. This means that the<BR>> > constraints are<BR>> > evaluated when data is inserted / updated /<BR>> removed. <BR>> > Note that, if you<BR>> > want to make sure the engine is using up-to-date<BR>> > information, you must<BR>> > notify the engine (using update) when you change the<BR>> data<BR>> > in the working<BR>> > memory. Also note that globals are considered<BR>> > immutable. You should<BR>> > never write rules that depend on the state of a global<BR>> and<BR>> > where
the<BR>> > global can be changed.<BR>> > <BR>> > If you are using code constraints, the constraint is<BR>> > evaluated at the<BR>> > point the code constraint is reached.<BR>> > <BR>> > Kris<BR>> > <BR>> > Quoting "Malenfant, Andre" <<A href="mailto:andre.malenfant@cgi.com" target=_blank rel=nofollow ymailto="mailto:andre.malenfant@cgi.com">andre.malenfant@cgi.com</A>>:<BR>> > <BR>> > > I have some trouble understanding how conditions<BR>> and<BR>> > constraints are<BR>> > > evaluated:<BR>> > > <BR>> > > I have a rule flow split node with constraints on<BR>> a<BR>> > global object.<BR>> > > The split node always takes the same path like if<BR>> the<BR>> > constraints are<BR>> > > evaluated at the beginning of the execution of<BR>> the<BR>> > process and not<BR>> > > when the process flow
reaches that split node.<BR>> What I<BR>> > would expect is<BR>> > > that the split node constraints takes into<BR>> account the<BR>> > state of the<BR>> > > global object as modified by previous rules in<BR>> the<BR>> > flow.<BR>> > > <BR>> > > Am I right to think that rules conditions and<BR>> split<BR>> > nodes constraints<BR>> > > are evaluated only when inserting/updating<BR>> objects in<BR>> > the working<BR>> > > memory? The documentation is not really useful<BR>> (unless<BR>> > I haven't<BR>> > > found the appropriate one).<BR>> > > <BR>> > > Thanks<BR>> > > <BR>> > > André<BR>> > > <BR>> > > -----Original Message-----<BR>> > > From: <A href="mailto:rules-users-bounces@lists.jboss.org" target=_blank rel=nofollow
ymailto="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</A><BR>> > > [mailto:<A href="mailto:rules-users-bounces@lists.jboss.org" target=_blank rel=nofollow ymailto="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</A>]<BR>> > On Behalf Of Malenfant,<BR>> > > Andre<BR>> > > Sent: Wednesday, June 10, 2009 11:07 AM<BR>> > > To: Kris Verlaenen<BR>> > > Cc: Rules Users List<BR>> > > Subject: RE: [rules-users] Globals in ruleflow<BR>> > > <BR>> > > Thanks for trying this for me...<BR>> > > <BR>> > > As it turns out, while I was creating a test<BR>> sample<BR>> > for you I<BR>> > > realized<BR>> > > that my ruleflow was not loading properly and I<BR>> forgot<BR>> > to check for<BR>> > > errors on the builder. Now it works.<BR>> > > <BR>> >
> Still, the behavior is strange. If my rule<BR>> doesn't<BR>> > load and even<BR>> > > though<BR>> > > my DRL loaded, my globals were not available.<BR>> Since<BR>> > the DRL declared<BR>> > > the<BR>> > > same globals it should not have given me that<BR>> error.<BR>> > > <BR>> > > Thanks<BR>> > > <BR>> > > -----Original Message-----<BR>> > > From: Kris Verlaenen [mailto:<A href="mailto:Kris.Verlaenen@cs.kuleuven.be" target=_blank rel=nofollow ymailto="mailto:Kris.Verlaenen@cs.kuleuven.be">Kris.Verlaenen@cs.kuleuven.be</A>]<BR>> > <BR>> > > Sent: Tuesday, June 09, 2009 5:51 PM<BR>> > > To: Rules Users List; Malenfant, Andre<BR>> > > Cc: Rules Users List<BR>> > > Subject: Re: [rules-users] Globals in ruleflow<BR>> > > <BR>> > > Andre,<BR>> > > <BR>> > > There should be no
problem in using the same<BR>> global in<BR>> > both your<BR>> > > rules<BR>> > > and processes.<BR>> > > <BR>> > > I have tried a simple example as you described<BR>> but<BR>> > have not been able<BR>> > > to<BR>> > > reproduce the problem. Could you send me a<BR>> > self-contained example<BR>> > > that<BR>> > > shows the issue?<BR>> > > <BR>> > > Kris<BR>> > > <BR>> > > Quoting "Malenfant, Andre" <<A href="mailto:andre.malenfant@cgi.com" target=_blank rel=nofollow ymailto="mailto:andre.malenfant@cgi.com">andre.malenfant@cgi.com</A>>:<BR>> > > <BR>> > > > I am experimenting with rule flows and I get<BR>> the<BR>> > following error:<BR>> > > > <BR>> > > > Unexpected global [myglobal]<BR>> > > > <BR>> > > > When calling setGlobal on the
session.<BR>> > > > <BR>> > > > This code works without the workflow<BR>> (globals<BR>> > declared in the drl)<BR>> > > > but<BR>> > > > fails when I include the rule flow. I<BR>> declared<BR>> > the same globals in<BR>> > > > the<BR>> > > > rule flow in the header section.<BR>> > > > <BR>> > > ><BR>> _______________________________________________<BR>> > > > rules-users mailing list<BR>> > > > <A href="mailto:rules-users@lists.jboss.org" target=_blank rel=nofollow ymailto="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR>> > > > <A href="https://lists.jboss.org/mailman/listinfo/rules-users" target=_blank rel=nofollow>https://lists.jboss.org/mailman/listinfo/rules-users</A><BR>> > > > <BR>> > > <BR>> > > <BR>> > > <BR>> > > <BR>>
> > Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm<BR>> > > <BR>> > > _______________________________________________<BR>> > > rules-users mailing list<BR>> > > <A href="mailto:rules-users@lists.jboss.org" target=_blank rel=nofollow ymailto="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR>> > > <A href="https://lists.jboss.org/mailman/listinfo/rules-users" target=_blank rel=nofollow>https://lists.jboss.org/mailman/listinfo/rules-users</A><BR>> > > <BR>> > > _______________________________________________<BR>> > > rules-users mailing list<BR>> > > <A href="mailto:rules-users@lists.jboss.org" target=_blank rel=nofollow ymailto="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR>> > > <A href="https://lists.jboss.org/mailman/listinfo/rules-users" target=_blank
rel=nofollow>https://lists.jboss.org/mailman/listinfo/rules-users</A><BR>> > > <BR>> > <BR>> > <BR>> > <BR>> > <BR>> > Disclaimer: <A href="http://www.kuleuven.be/cwis/email_disclaimer.htm" target=_blank rel=nofollow>http://www.kuleuven.be/cwis/email_disclaimer.htm</A><BR>> > <BR>> > _______________________________________________<BR>> > rules-users mailing list<BR>> > <A href="mailto:rules-users@lists.jboss.org" target=_blank rel=nofollow ymailto="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR>> > <A href="https://lists.jboss.org/mailman/listinfo/rules-users" target=_blank rel=nofollow>https://lists.jboss.org/mailman/listinfo/rules-users</A><BR>> > <BR>> <BR>> <BR>> <BR>> <BR>> _______________________________________________<BR>> rules-users mailing list<BR>> <A href="mailto:rules-users@lists.jboss.org"
target=_blank rel=nofollow ymailto="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR>> <A href="https://lists.jboss.org/mailman/listinfo/rules-users" target=_blank rel=nofollow>https://lists.jboss.org/mailman/listinfo/rules-users</A><BR>> <BR>> _______________________________________________<BR>> rules-users mailing list<BR>> <A href="mailto:rules-users@lists.jboss.org" target=_blank rel=nofollow ymailto="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR>> <A href="https://lists.jboss.org/mailman/listinfo/rules-users" target=_blank rel=nofollow>https://lists.jboss.org/mailman/listinfo/rules-users</A><BR>> <BR><BR><BR> <BR><BR>_______________________________________________<BR>rules-users mailing list<BR><A href="mailto:rules-users@lists.jboss.org" target=_blank rel=nofollow ymailto="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR><A
href="https://lists.jboss.org/mailman/listinfo/rules-users" target=_blank rel=nofollow>https://lists.jboss.org/mailman/listinfo/rules-users</A><BR></DIV></DIV></DIV><BR></DIV></DIV></div><br>
</body></html>