<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><DIV>Great stuff. Things are very clear now . It raised&nbsp;some more questions&nbsp;though :-</DIV>
<DIV>&nbsp;</DIV>
<DIV>--&nbsp;Say we use the one shot insert at the very start of the rule.&nbsp;And i am using this rule to validate some </DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp; 100,000 User facts . Will these inserts be done only once or as many times as new facts are inserted</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp; in WM.&nbsp;&nbsp;Is there something that we can use to determine this as per the need.</DIV>
<DIV>&nbsp;</DIV>
<DIV>-- As done in the example below there will be as many UserResult objects inserted in the memory as there are User facts. We insert them in the WM at the start and update them as the rule executes . At the very end should we retract them as well from the WM . Is that a suggested practice or doesn't really matter . </DIV>
<DIV>&nbsp;</DIV>
<DIV>-- Does WM automatically remove objects if they have not been used for long time or it's&nbsp;the responsibility of the application developer to keep track of what's goes in and out.</DIV>
<DIV>&nbsp;</DIV>
<DIV>-- Instead of inserting one fact at a time if we insert a collection at one go in the WM how does this rule get applied . Sequentially to all the objects or in parallel ?<BR></DIV>
<DIV>Regards,</DIV>
<DIV>Manav</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, 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> Wolfgang Laun &lt;wolfgang.laun@gmail.com&gt;<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Manav &lt;manav7574@yahoo.com&gt;<BR><B><SPAN style="FONT-WEIGHT: bold">Cc:</SPAN></B> rules-users@lists.jboss.org<BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Fri, August 13, 2010 11:41:53 PM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> Re: [rules-users] Caching results in temperory variables<BR></FONT><BR>On 13 August 2010 18:36, Manav <SPAN dir=ltr>&lt;<A href="mailto:manav7574@yahoo.com" target=_blank rel=nofollow ymailto="mailto:manav7574@yahoo.com">manav7574@yahoo.com</A>&gt;</SPAN> wrote:<BR>
<DIV class=gmail_quote>
<BLOCKQUOTE class=gmail_quote style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">
<DIV>Your explanation is absolutely superb.&nbsp; I modified my drl as per your suggestions and it's just been completely transformed. Just one question regarding one suggestion below :</DIV>
<DIV>&nbsp;</DIV>
<DIV>-- is this something like a for each loop in java . This is the first example i have seen in&nbsp;drl </DIV></DIV></DIV></BLOCKQUOTE>
<DIV><BR>In a way, yes. Since<BR>&nbsp;&nbsp; Foo( ... )&nbsp;&nbsp; # match any Foo according to constraints, if any<BR>&nbsp;&nbsp; Bar( ... )&nbsp;&nbsp; # match any Bar according to constraints, if any<BR>these two patterns produce the Cartesian product, such as a nested loop does. BUT, the order of the pairings is indeterministic, and changes in WM might influence this loop, even make it infinitive. Therefore, "in a way".&nbsp; <BR><BR></DIV>
<BLOCKQUOTE class=gmail_quote style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">
<DIV>-- will this automatically iterate over as many languages as have been inserted ? </DIV></DIV></DIV></BLOCKQUOTE>
<DIV><BR>That's the whole idea :-)<BR>&nbsp;</DIV>
<BLOCKQUOTE class=gmail_quote style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">
<DIV>-- the inserts .. don't they have to be within a rule block ? or did you just omit other things to keep it simple<BR></DIV></DIV></DIV></BLOCKQUOTE>
<DIV><BR>You can do it in the Java application framework. You can also write a high-salience one-shot rule such as<BR><BR>rule "1st shot"<BR>when<BR>then&nbsp;&nbsp; <BR></DIV>
<BLOCKQUOTE class=gmail_quote style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">
<DIV></DIV>
<DIV class=im>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">insert( new Language( "Japanese" ) ); <BR>insert( new Language( "French" ) ); <BR>// more of the same<BR></DIV></DIV></DIV></DIV></BLOCKQUOTE>
<DIV>end<BR><BR>Cheers<BR>Wolfgang <BR><BR></DIV></DIV><BR></DIV></DIV></div><br>







      </body></html>