[jboss-svn-commits] JBL Code SVN: r25901 - in labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features: Chapter-SlidingWindows and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Mar 31 16:02:53 EDT 2009
Author: tirelli
Date: 2009-03-31 16:02:53 -0400 (Tue, 31 Mar 2009)
New Revision: 25901
Modified:
labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-EventProcessingModes/Section-EventProcessingModes_StreamMode.xml
labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-SlidingWindows/Section-SlidingWindows.xml
labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-SlidingWindows/Section-SlidingWindows_SlidingLengthWindows.xml
labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-SlidingWindows/Section-SlidingWindows_SlidingTimeWindows.xml
Log:
Improving docs
Modified: labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-EventProcessingModes/Section-EventProcessingModes_StreamMode.xml
===================================================================
--- labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-EventProcessingModes/Section-EventProcessingModes_StreamMode.xml 2009-03-31 19:29:01 UTC (rev 25900)
+++ labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-EventProcessingModes/Section-EventProcessingModes_StreamMode.xml 2009-03-31 20:02:53 UTC (rev 25901)
@@ -36,7 +36,7 @@
<programlisting>KnowledgeBaseConfiguration config = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
config.setOption( EventProcessingOption.STREAM );</programlisting>
- <para>Or, the equivalent property:</para>
+ <para>Or, the equivalent property: </para>
<programlisting>drools.eventProcessingMode = stream</programlisting>
@@ -68,7 +68,7 @@
<para>When running the engine in CLOUD mode, the session clock is used
only to time stamp the arriving events that don't have a previously
defined timestamp attribute. Although, in STREAM mode, the Session Clock
- assumes an even more important role. </para>
+ assumes an even more important role.</para>
<para>In STREAM mode, the session clock is responsible for keeping the
current timestamp, and based on it, the engine does all the temporal
Modified: labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-SlidingWindows/Section-SlidingWindows.xml
===================================================================
--- labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-SlidingWindows/Section-SlidingWindows.xml 2009-03-31 19:29:01 UTC (rev 25900)
+++ labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-SlidingWindows/Section-SlidingWindows.xml 2009-03-31 20:02:53 UTC (rev 25901)
@@ -1,17 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<section version="5.0" xmlns="http://docbook.org/ns/docbook"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns:xi="http://www.w3.org/2001/XInclude"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns:m="http://www.w3.org/1998/Math/MathML"
- xmlns:html="http://www.w3.org/1999/xhtml"
- xmlns:db="http://docbook.org/ns/docbook">
- <title>Sliding Windows</title>
-
- <xi:include href="Section-SlidingWindows_SlidingTimeWindows.xml" />
-
- <xi:include href="Section-SlidingWindows_SlidingLengthWindows.xml" />
-
-
-
-</section>
\ No newline at end of file
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns:m="http://www.w3.org/1998/Math/MathML"
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ xmlns:db="http://docbook.org/ns/docbook">
+ <title>Sliding Windows</title>
+
+ <para>Sliding Window is a way to scope the events of interest as a the ones
+ belonging to a window that is constantly moving. The two most common sliding
+ window implementations are time based windows and length based windows.
+ </para>
+
+ <para>The next sections will detail each of them.</para>
+
+ <important>
+ <para>Sliding Windows are only available when running the engine in STREAM
+ mode. Check the Event Processing Mode section for details on how the
+ STREAM mode works.</para>
+ </important>
+
+ <xi:include href="Section-SlidingWindows_SlidingTimeWindows.xml" />
+
+ <xi:include href="Section-SlidingWindows_SlidingLengthWindows.xml" />
+</section>
Modified: labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-SlidingWindows/Section-SlidingWindows_SlidingLengthWindows.xml
===================================================================
--- labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-SlidingWindows/Section-SlidingWindows_SlidingLengthWindows.xml 2009-03-31 19:29:01 UTC (rev 25900)
+++ labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-SlidingWindows/Section-SlidingWindows_SlidingLengthWindows.xml 2009-03-31 20:02:53 UTC (rev 25901)
@@ -1,12 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<section version="5.0" xmlns="http://docbook.org/ns/docbook"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns:xi="http://www.w3.org/2001/XInclude"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns:m="http://www.w3.org/1998/Math/MathML"
- xmlns:html="http://www.w3.org/1999/xhtml"
- xmlns:db="http://docbook.org/ns/docbook">
- <title>Sliding Length Windows</title>
-
-
-</section>
\ No newline at end of file
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns:m="http://www.w3.org/1998/Math/MathML"
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ xmlns:db="http://docbook.org/ns/docbook">
+ <title>Sliding Length Windows</title>
+
+ <para>Sliding Length Windows work the same way as Time Windows, but discard
+ events based on the arrival of new events instead of flow of time.</para>
+
+ <para>For instance, if the user wants to consider only the last 10 IBM Stock
+ Ticks, independent of how old they are, the pattern would look like
+ this:</para>
+
+ <programlisting>StockTick( company == "IBM" ) over window:length( 10 )</programlisting>
+
+ <para>As you can see, the pattern is similar to the one presented in the
+ previous section, but instead of using window:time to define the sliding
+ window, it uses window:length.</para>
+
+ <para>Using a similar example to the one in the previous section, if the
+ user wants to sound an alarm in case the average temperature over the last
+ 100 readings from a sensor is above the threshold value, the rule would look
+ like:</para>
+
+ <para><example>
+ <title>aggregating values over length windows</title>
+
+ <programlisting>rule "Sound the alarm in case temperature rises above threshold"
+when
+ TemperatureThreshold( $max : max )
+ Number( doubleValue > $max ) from accumulate(
+ SensorReading( $temp : temperature ) over window:length( 100 ),
+ average( $temp ) )
+then
+ // sound the alarm
+end</programlisting>
+ </example>The engine will keep only the last 100 readings.</para>
+</section>
Modified: labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-SlidingWindows/Section-SlidingWindows_SlidingTimeWindows.xml
===================================================================
--- labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-SlidingWindows/Section-SlidingWindows_SlidingTimeWindows.xml 2009-03-31 19:29:01 UTC (rev 25900)
+++ labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-SlidingWindows/Section-SlidingWindows_SlidingTimeWindows.xml 2009-03-31 20:02:53 UTC (rev 25901)
@@ -1,12 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<section version="5.0" xmlns="http://docbook.org/ns/docbook"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns:xi="http://www.w3.org/2001/XInclude"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns:m="http://www.w3.org/1998/Math/MathML"
- xmlns:html="http://www.w3.org/1999/xhtml"
- xmlns:db="http://docbook.org/ns/docbook">
- <title>Sliding Time Windows</title>
-
-
-</section>
\ No newline at end of file
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns:m="http://www.w3.org/1998/Math/MathML"
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ xmlns:db="http://docbook.org/ns/docbook">
+ <title>Sliding Time Windows</title>
+
+ <para>Sliding Time Windows allow the user to write rules that will only
+ match events occurring in the last X time units. </para>
+
+ <para>For instance, if the user wants to consider only the Stock Ticks that
+ happened in the last 2 minutes, the pattern would look like this:</para>
+
+ <programlisting>StockTick() over window:time( 2m )</programlisting>
+
+ <para>Drools uses the "over" keyword to associate windows to patterns.
+ </para>
+
+ <para>On a more elaborate example, if the user wants to sound an alarm in
+ case the average temperature over the last 10 minutes read from a sensor is
+ above the threshold value, the rule would look like:</para>
+
+ <para><example>
+ <title>aggregating values over time windows</title>
+
+ <programlisting>rule "Sound the alarm in case temperature rises above threshold"
+when
+ TemperatureThreshold( $max : max )
+ Number( doubleValue > $max ) from accumulate(
+ SensorReading( $temp : temperature ) over window:time( 10m ),
+ average( $temp ) )
+then
+ // sound the alarm
+end
+</programlisting>
+ </example>The engine will automatically discard any SensorReading older
+ than 10 minutes and keep the calculated average consistent.</para>
+</section>
More information about the jboss-svn-commits
mailing list