<br>   Hi<br><br>   The description you have bellow is ambiguous, so I can&#39;t give you a definitive answer. But it seems to be that you don&#39;t need sliding windows for that. Simple temporal operators will do.<br><br>
&gt; <font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">Secondly if the window is large and number of records coming
in is high then could there be a memory issue?<br>   Yes, Drools does not manages persistence by itself. So, if your design must support more data than it would fit in your running environment memory, you need to design a solution that comprises persistence.<br>
<br></span></font><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">&gt; Also since every record is getting stored in database, can I
not use the database directly instead of sliding window?</span></font><br>   Yes, you can fetch data on demand from external sources, be it databases or anything else. Look at the &quot;from&quot; CE.<br><br>    []s<br>    Edson<br>
<br><br><div class="gmail_quote">2009/6/1 Bhushan Bhangale <span dir="ltr">&lt;<a href="mailto:bhushan_bhangale@kaleconsultants.com">bhushan_bhangale@kaleconsultants.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">












<div link="blue" vlink="purple" lang="EN-US">

<div>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">I am using Drools 5. I am struggling to write rule for this
logic -</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">If a stock price changes more than 10% within an hour then
report the change.</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">I understand I have to use sliding window feature but unable
to write the rule.</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">For example I got an update for IBM stock @ </span></font><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">12:30</span></font><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> for price
100 and then another update IBM stock @ </span></font><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">12:35</span></font><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> for price
111. Since the time difference is within an hour and the change is also greater
than 10% I want to report this price change.</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">Stock class -</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">Public class Stock {</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">   Private String stock;</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">   Private double price;</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">   Private Date time;</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">   Private double priceChange;</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">   Private Boolean highlight;</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">}</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">rule &quot;Stock Price change more than 10% within an
hour&quot;</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">when</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">then</span></font></p>

<p style="text-indent: 0.5in;"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">set the priceChange attribute of
Stock object</span></font></p>

<p style="text-indent: 0.5in;"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">set highlight to true   
 </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">end</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">Secondly if the window is large and number of records coming
in is high then could there be a memory issue?</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">Also since every record is getting stored in database, can I
not use the database directly instead of sliding window?</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">Thanks</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<table style="width: 240pt;" border="0" cellpadding="0" cellspacing="0" width="320">
 <tbody><tr>
  <td style="padding: 0in;">
  <p><b><font color="#4e81c4" size="1" face="Verdana"><span style="font-size: 8pt; font-family: Verdana; color: rgb(78, 129, 196); font-weight: bold;">Mr.
  Bhangale Bhushan</span></font></b><font color="#4e81c4" size="1" face="Verdana"><span style="font-size: 8pt; font-family: Verdana; color: rgb(78, 129, 196);"><br>
  <i><span style="font-style: italic;">Associate Manager</span></i><br>
  <b><b><font face="Verdana"><span style="font-family: Verdana;">Kale
  Consultants Ltd.</span></font></b></b><br>
  <a href="mailto:bhushan_bhangale@kaleconsultants.com" target="_blank"><font color="#4e81c4"><span style="color: rgb(78, 129, 196); text-decoration: none;">bhushan_bhangale@kaleconsultants.com</span></font></a><br>
  tel: <a href="http://www.plaxo.com/click_to_call?lang=en&amp;src=jj_signature&amp;To=%2B91+%280%29206+608+3777&amp;Email=bhushan_bhangale@kaleconsultants.com" title="Click to call. Cheap rates &amp; no headset required!" target="_blank"><font color="#4e81c4"><span style="color: rgb(78, 129, 196); text-decoration: none;">+91 (0)206
  608 3777</span></font></a><br>
  <a href="http://www.kaleconsultants.com" target="_blank"><font color="#4e81c4"><span style="color: rgb(78, 129, 196); text-decoration: none;">http://www.kaleconsultants.com</span></font></a>
  </span></font></p>
  </td>
  <td style="padding: 0in;">
  <p><font size="3" face="Times New Roman"><span style="font-size: 12pt;"> </span></font></p>
  </td>
 </tr>
 <tr style="height: 7.5pt;" height="10">
  <td colspan="2" style="padding: 0in; height: 7.5pt;" height="10">
  <p><font size="1" face="Times New Roman"><span style="font-size: 8pt;"> </span></font></p>
  </td>
 </tr>
 <tr>
  <td colspan="2" style="padding: 0in;">
  <p><font size="3" face="Times New Roman"><span style="font-size: 12pt;"> </span></font></p>
  </td>
 </tr>
</tbody></table>

<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;"> </span></font></p>

</div>

<br><pre>Disclaimer: This email (including any attachments) is intended for the sole
use of the recipient/s and may contain material that is CONFIDENTIAL. Any
unauthorized disclosure / copying / distribution or forwarding of this message 
or part is STRICTLY PROHIBITED. If you have erroneously received this message,
please delete it immediately and notify the sender. No liability is assumed for
any errors and/or omissions in the contents of this message. Information in 
this message that does not relate to the official business of this Company
shall be understood as neither given nor endorsed by it. If verification is
required please request a hard-copy version. 

To know more about Kale Consultants, visit <a href="http://www.kaleconsultants.com" target="_blank">www.kaleconsultants.com</a> 

----------


</pre><br></div>


<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="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">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>