[jboss-svn-commits] JBL Code SVN: r25762 - in labs/jbossrules/trunk: drools-api/src/main/java/org/drools/runtime/conf and 7 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Mar 20 05:57:33 EDT 2009


Author: tirelli
Date: 2009-03-20 05:57:33 -0400 (Fri, 20 Mar 2009)
New Revision: 25762

Added:
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/conf/
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/conf/ClockTypeOption.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/conf/KnowledgeSessionOption.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/conf/KnowledgeSessionOptionsConfiguration.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/conf/MultiValueKnowledgeSessionOption.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/conf/SingleValueKnowledgeSessionOption.java
   labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/conf/KnowledgeSessionConfigurationTest.java
Modified:
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/KnowledgeSessionConfiguration.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/rule/WorkingMemory.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaConsequenceBuilder.java
   labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/CepEspTest.java
   labs/jbossrules/trunk/drools-docs/doc-authoring-guideline-and-cheatsheet.txt
   labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-SessionClock/Section-SessionClock.xml
   labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-SessionClock/Section-SessionClock_AvailableClockImplementations.xml
   labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-TemporalReasoning/Section-TemporalReasoning.xml
   labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-TemporalReasoning/Section-TemporalReasoning_TemporalOperators.xml
Log:
Improving fusion docs

Modified: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/KnowledgeSessionConfiguration.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/KnowledgeSessionConfiguration.java	2009-03-20 05:31:17 UTC (rev 25761)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/KnowledgeSessionConfiguration.java	2009-03-20 09:57:33 UTC (rev 25762)
@@ -1,6 +1,7 @@
 package org.drools.runtime;
 
 import org.drools.PropertiesConfiguration;
+import org.drools.runtime.conf.KnowledgeSessionOptionsConfiguration;
 
 /**
  * KnowledgeSessionConfiguration
@@ -22,10 +23,11 @@
  * 
  * 
  * drools.keepReference = <true|false>
- * drools.clockType = <pseudo|realtime|heartbeat|implicit>
+ * drools.clockType = <pseudo|realtime>
  */
 public interface KnowledgeSessionConfiguration
     extends
-    PropertiesConfiguration {
+    PropertiesConfiguration,
+    KnowledgeSessionOptionsConfiguration {
 
 }

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/conf/ClockTypeOption.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/conf/ClockTypeOption.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/conf/ClockTypeOption.java	2009-03-20 09:57:33 UTC (rev 25762)
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2008 Red Hat
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.drools.runtime.conf;
+
+
+/**
+ * A class for the session clock configuration.
+ * 
+ * @author etirelli
+ */
+public class ClockTypeOption implements SingleValueKnowledgeSessionOption {
+
+    private static final long serialVersionUID = -8461267995706982981L;
+
+    /**
+     * The property name for the clock type configuration
+     */
+    public static final String PROPERTY_NAME = "drools.clockType";
+    
+    /**
+     * clock type
+     */
+    private final String clockType;
+    
+    /**
+     * Private constructor to enforce the use of the factory method
+     * @param clockType
+     */
+    private ClockTypeOption( String clockType ) {
+        this.clockType = clockType;
+    }
+    
+    /**
+     * This is a factory method for this Clock Type configuration.
+     * The factory method is a best practice for the case where the 
+     * actual object construction is changed in the future.
+     * 
+     * @param clockType the identifier for the clock type
+     * 
+     * @return the actual type safe default clock type configuration.
+     */
+    public static ClockTypeOption get( String clockType ) {
+        return new ClockTypeOption( clockType );
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String getPropertyName() {
+        return PROPERTY_NAME;
+    }
+    
+    /**
+     * Returns the configured clock type
+     * 
+     * @return
+     */
+    public String getClockType() {
+        return clockType;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + (( clockType == null) ? 0 :  clockType.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if ( this == obj ) return true;
+        if ( obj == null ) return false;
+        if ( getClass() != obj.getClass() ) return false;
+        ClockTypeOption other = (ClockTypeOption) obj;
+        if (  clockType == null ) {
+            if ( other. clockType != null ) return false;
+        } else if ( ! clockType.equals( other.clockType ) ) return false;
+        return true;
+    }
+    
+    @Override
+    public String toString() {
+        return "ClockTypeOption( "+ clockType +" )";
+    }
+}


Property changes on: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/conf/ClockTypeOption.java
___________________________________________________________________
Name: svn:executable
   + *

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/conf/KnowledgeSessionOption.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/conf/KnowledgeSessionOption.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/conf/KnowledgeSessionOption.java	2009-03-20 09:57:33 UTC (rev 25762)
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2008 Red Hat
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.drools.runtime.conf;
+
+import org.drools.conf.Option;
+
+/**
+ * A markup interface for KnowledgeSessionConfiguration options
+ * 
+ * @author etirelli
+ */
+public interface KnowledgeSessionOption
+    extends
+    Option {
+
+}


Property changes on: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/conf/KnowledgeSessionOption.java
___________________________________________________________________
Name: svn:executable
   + *

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/conf/KnowledgeSessionOptionsConfiguration.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/conf/KnowledgeSessionOptionsConfiguration.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/conf/KnowledgeSessionOptionsConfiguration.java	2009-03-20 09:57:33 UTC (rev 25762)
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2008 Red Hat
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.drools.runtime.conf;
+
+/**
+ * A base interface for type safe configurations
+ * 
+ * @author etirelli
+ */
+public interface KnowledgeSessionOptionsConfiguration {
+    
+    /**
+     * Sets an option
+     * 
+     * @param option the option to be set. As options are type safe, the option
+     *               itself contains the option key, and so a single parameter
+     *               is enough.
+     */
+    public <T extends KnowledgeSessionOption> void setOption( T option );
+
+    /**
+     * Gets an option value
+     * 
+     * @param option the option class for the option being requested
+     * 
+     * @return the Option value for the given option. Returns null if option is 
+     *         not configured.
+     */
+    public <T extends SingleValueKnowledgeSessionOption> T getOption( Class<T> option );
+    
+    
+    /**
+     * Gets an option value for the given option + key. This method should
+     * be used for multi-value options where one option has multiple values, 
+     * distinguished by a sub-key.
+     * 
+     * @param option the option class for the option being requested
+     * @param key the key for the option being requested
+     * 
+     * @return the Option value for the given option + key. Returns null if option is 
+     *         not configured.
+     */
+    public <T extends MultiValueKnowledgeSessionOption> T getOption( Class<T> option, String key );
+    
+
+}


Property changes on: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/conf/KnowledgeSessionOptionsConfiguration.java
___________________________________________________________________
Name: svn:executable
   + *

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/conf/MultiValueKnowledgeSessionOption.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/conf/MultiValueKnowledgeSessionOption.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/conf/MultiValueKnowledgeSessionOption.java	2009-03-20 09:57:33 UTC (rev 25762)
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2008 Red Hat
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.drools.runtime.conf;
+
+
+/**
+ * A markup interface for MultiValueKnowledgeSessionConfiguration options
+ * 
+ * @author etirelli
+ */
+public interface MultiValueKnowledgeSessionOption
+    extends
+    KnowledgeSessionOption {
+
+}


Property changes on: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/conf/MultiValueKnowledgeSessionOption.java
___________________________________________________________________
Name: svn:executable
   + *

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/conf/SingleValueKnowledgeSessionOption.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/conf/SingleValueKnowledgeSessionOption.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/conf/SingleValueKnowledgeSessionOption.java	2009-03-20 09:57:33 UTC (rev 25762)
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2008 Red Hat
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.drools.runtime.conf;
+
+
+/**
+ * A markup interface for SingleValueKnowledgeSessionConfiguration options
+ * 
+ * @author etirelli
+ */
+public interface SingleValueKnowledgeSessionOption
+    extends
+    KnowledgeSessionOption {
+
+}


Property changes on: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/conf/SingleValueKnowledgeSessionOption.java
___________________________________________________________________
Name: svn:executable
   + *

Modified: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/rule/WorkingMemory.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/rule/WorkingMemory.java	2009-03-20 05:31:17 UTC (rev 25761)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/rule/WorkingMemory.java	2009-03-20 09:57:33 UTC (rev 25762)
@@ -32,7 +32,7 @@
      * Returns the session clock instance assigned to this session
      * @return
      */
-    public SessionClock getSessionClock();
+    public <T extends SessionClock> T getSessionClock();
 
     /**
      * Returns the fact handle associated with the given object. It is important to note that this 

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaConsequenceBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaConsequenceBuilder.java	2009-03-20 05:31:17 UTC (rev 25761)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaConsequenceBuilder.java	2009-03-20 09:57:33 UTC (rev 25762)
@@ -110,7 +110,7 @@
         final Boolean[] notPatterns = new Boolean[declarations.length];
         for ( int i = 0, length = declarations.length; i < length; i++ ) {
             indexes[i] = new Integer( list.indexOf( declarations[i] ) );
-            notPatterns[i] = (declarations[i].getExtractor() instanceof PatternExtractor) ? new Boolean( false ) : new Boolean( true );
+            notPatterns[i] = (declarations[i].getExtractor() instanceof PatternExtractor) ? Boolean.FALSE : Boolean.TRUE ;
             if ( (indexes[i]).intValue() == -1 ) {
                 context.getErrors().add( new DescrBuildError( context.getParentDescr(),
                                                               ruleDescr,

Added: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/conf/KnowledgeSessionConfigurationTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/conf/KnowledgeSessionConfigurationTest.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/conf/KnowledgeSessionConfigurationTest.java	2009-03-20 09:57:33 UTC (rev 25762)
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2008 Red Hat
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.drools.conf;
+
+import junit.framework.TestCase;
+
+import org.drools.KnowledgeBaseFactory;
+import org.drools.runtime.KnowledgeSessionConfiguration;
+import org.drools.runtime.conf.ClockTypeOption;
+
+/**
+ * @author etirelli
+ *
+ */
+public class KnowledgeSessionConfigurationTest extends TestCase {
+
+    private KnowledgeSessionConfiguration config;
+
+    /* (non-Javadoc)
+     * @see junit.framework.TestCase#setUp()
+     */
+    protected void setUp() throws Exception {
+        super.setUp();
+        config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
+    }
+
+    public void testClockTypeConfiguration() {
+        // setting the option using the type safe method
+        config.setOption( ClockTypeOption.get("pseudo") );
+
+        // checking the type safe getOption() method
+        assertEquals( ClockTypeOption.get("pseudo"),
+                      config.getOption( ClockTypeOption.class ) );
+        // checking the string based getProperty() method
+        assertEquals( "pseudo",
+                      config.getProperty( ClockTypeOption.PROPERTY_NAME ) );
+
+        // setting the options using the string based setProperty() method
+        config.setProperty( ClockTypeOption.PROPERTY_NAME,
+                            "realtime" );
+        
+        // checking the type safe getOption() method
+        assertEquals( ClockTypeOption.get("realtime"),
+                      config.getOption( ClockTypeOption.class ) );
+        // checking the string based getProperty() method
+        assertEquals( "realtime",
+                      config.getProperty( ClockTypeOption.PROPERTY_NAME ) );
+    }
+    
+
+}

Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/CepEspTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/CepEspTest.java	2009-03-20 05:31:17 UTC (rev 25761)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/CepEspTest.java	2009-03-20 09:57:33 UTC (rev 25762)
@@ -11,6 +11,8 @@
 import junit.framework.TestCase;
 
 import org.drools.ClockType;
+import org.drools.KnowledgeBase;
+import org.drools.KnowledgeBaseFactory;
 import org.drools.OrderEvent;
 import org.drools.RuleBase;
 import org.drools.RuleBaseConfiguration;
@@ -20,15 +22,23 @@
 import org.drools.StockTick;
 import org.drools.RuleBaseConfiguration.EventProcessingMode;
 import org.drools.base.evaluators.TimeIntervalParser;
+import org.drools.builder.KnowledgeBuilder;
+import org.drools.builder.KnowledgeBuilderFactory;
+import org.drools.builder.ResourceType;
 import org.drools.common.EventFactHandle;
 import org.drools.common.InternalFactHandle;
 import org.drools.common.InternalRuleBase;
 import org.drools.compiler.DrlParser;
 import org.drools.compiler.DroolsParserException;
 import org.drools.compiler.PackageBuilder;
+import org.drools.io.ResourceFactory;
 import org.drools.lang.descr.PackageDescr;
 import org.drools.rule.Package;
 import org.drools.rule.Rule;
+import org.drools.runtime.KnowledgeSessionConfiguration;
+import org.drools.runtime.StatefulKnowledgeSession;
+import org.drools.runtime.conf.ClockTypeOption;
+import org.drools.time.SessionClock;
 import org.drools.time.SessionPseudoClock;
 import org.drools.time.impl.PseudoClockScheduler;
 
@@ -77,13 +87,18 @@
 
     public void testEventAssertion() throws Exception {
         // read in the source
-        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_CEP_SimpleEventAssertion.drl" ) );
-        RuleBase ruleBase = loadRuleBase( reader );
+        KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
+        kbuilder.add( ResourceFactory.newInputStreamResource( getClass().getResourceAsStream( "test_CEP_SimpleEventAssertion.drl" ) ), 
+                      ResourceType.DRL );
+        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
+        kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
 
-        SessionConfiguration conf = new SessionConfiguration();
-        conf.setClockType( ClockType.PSEUDO_CLOCK );
-        StatefulSession session = ruleBase.newStatefulSession( conf, null );
-
+        KnowledgeSessionConfiguration conf = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
+        conf.setOption( ClockTypeOption.get( "pseudo" ) );
+        StatefulKnowledgeSession session = kbase.newStatefulKnowledgeSession( conf, null );
+        
+        SessionPseudoClock clock = session.getSessionClock();
+        
         final List results = new ArrayList();
 
         session.setGlobal( "results",
@@ -107,9 +122,13 @@
                                          11000 );
 
         InternalFactHandle handle1 = (InternalFactHandle) session.insert( tick1 );
+        clock.advanceTime( 10, TimeUnit.SECONDS );
         InternalFactHandle handle2 = (InternalFactHandle) session.insert( tick2 );
+        clock.advanceTime( 30, TimeUnit.SECONDS );
         InternalFactHandle handle3 = (InternalFactHandle) session.insert( tick3 );
+        clock.advanceTime( 20, TimeUnit.SECONDS );
         InternalFactHandle handle4 = (InternalFactHandle) session.insert( tick4 );
+        clock.advanceTime( 10, TimeUnit.SECONDS );
 
         assertNotNull( handle1 );
         assertNotNull( handle2 );
@@ -121,8 +140,6 @@
         assertTrue( handle3.isEvent() );
         assertTrue( handle4.isEvent() );
 
-        session = SerializationHelper.getSerialisedStatefulSession( session,
-                                                                    ruleBase );
         session.fireAllRules();
 
         assertEquals( 2,

Modified: labs/jbossrules/trunk/drools-docs/doc-authoring-guideline-and-cheatsheet.txt
===================================================================
--- labs/jbossrules/trunk/drools-docs/doc-authoring-guideline-and-cheatsheet.txt	2009-03-20 05:31:17 UTC (rev 25761)
+++ labs/jbossrules/trunk/drools-docs/doc-authoring-guideline-and-cheatsheet.txt	2009-03-20 09:57:33 UTC (rev 25762)
@@ -154,5 +154,28 @@
 ---------
 TODO
 
-  
-   
+  ======================================
+
+I guess the "reference section" would be somehow like a bibliography
+section in a book or paper. Here is the information I found for
+bibliography markup:
+
+http://www.docbook.org/tdg5/en/html/bibliography.html
+
+But I'm not sure whether it is working with the JBoss customized XSLT
+and CSS. If it looks too complex for you, just don't waste your time
+and I'll try it out later and add the relevant information to the
+cheatsheet.
+
+For the "Definition/Concept", I found the <termdef> tag that might be
+what you want:
+
+http://www.docbook.org/tdg5/en/html/termdef.html
+
+The example in the page looks not that complex. You can give it a try.
+Be warned I've not tested it yet (have much to do in the office for
+now), if this markup breaks the build, please let me know. (If it does
+not break the build, but you do not see any obvious visual effect,
+that means this tag is not defined the css. This is small problem and
+you can keep using the markup. I'm into CSS these days and will sooner
+or later update the Drools css for documentation.)

Modified: labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-SessionClock/Section-SessionClock.xml
===================================================================
--- labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-SessionClock/Section-SessionClock.xml	2009-03-20 05:31:17 UTC (rev 25761)
+++ labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-SessionClock/Section-SessionClock.xml	2009-03-20 09:57:33 UTC (rev 25762)
@@ -52,6 +52,4 @@
   </itemizedlist>
 
   <xi:include href="Section-SessionClock_AvailableClockImplementations.xml" />
-
-  <xi:include href="Section-SessionClock_HowToImplementNewClocks.xml" />
 </section>

Modified: labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-SessionClock/Section-SessionClock_AvailableClockImplementations.xml
===================================================================
--- labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-SessionClock/Section-SessionClock_AvailableClockImplementations.xml	2009-03-20 05:31:17 UTC (rev 25761)
+++ labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-SessionClock/Section-SessionClock_AvailableClockImplementations.xml	2009-03-20 09:57:33 UTC (rev 25762)
@@ -1,19 +1,61 @@
 <?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>Available Clock Implementations</title>
+         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>Available Clock Implementations</title>
 
+  <para>Drools 5 provides 2 clock implementations out of the box. The default
+  real time clock, based on the system clock, and an optional pseudo clock,
+  controlled by the application.</para>
 
-	<section>
-		<title>Real Time Clock</title>
-	</section>
-	<section>
-		<title>Pseudo Clock</title>
-	</section>
+  <section>
+    <title>Real Time Clock</title>
 
+    <para>By default, Drools uses a real time clock implementation that
+    internally uses the system clock to determine the current
+    timestamp.</para>
+
+    <para>To explicitly configure the engine to use the real time clock, just
+    set the session configuration parameter to real time:</para>
+
+    <programlisting>KnowledgeSessionConfiguration config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
+config.setOption( ClockTypeOption.get("realtime") );
+</programlisting>
+  </section>
+
+  <section>
+    <title>Pseudo Clock</title>
+
+    <para>Drools also offers out of the box an implementation of a clock that
+    is controlled by the application that is called Pseudo Clock. This clock
+    is specially useful for unit testing temporal rules since it can be
+    controled by the application and so the results become
+    deterministic.</para>
+
+    <para>To configure the pseudo session clock, do:</para>
+
+    <programlisting>KnowledgeSessionConfiguration config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
+config.setOption( ClockTypeOption.get("realtime") );</programlisting>
+
+    <para>As an example of how to control the pseudo session clock:</para>
+
+    <programlisting>KnowledgeSessionConfiguration conf = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
+conf.setOption( ClockTypeOption.get( "pseudo" ) );
+StatefulKnowledgeSession session = kbase.newStatefulKnowledgeSession( conf, null );
+        
+SessionPseudoClock clock = session.getSessionClock();
+
+// then, while inserting facts, advance the clock as necessary:
+FactHandle handle1 = session.insert( tick1 );
+clock.advanceTime( 10, TimeUnit.SECONDS );
+FactHandle handle2 = session.insert( tick2 );
+clock.advanceTime( 30, TimeUnit.SECONDS );
+FactHandle handle3 = session.insert( tick3 );
+
+</programlisting>
+  </section>
 </section>

Modified: labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-TemporalReasoning/Section-TemporalReasoning.xml
===================================================================
--- labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-TemporalReasoning/Section-TemporalReasoning.xml	2009-03-20 05:31:17 UTC (rev 25761)
+++ labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-TemporalReasoning/Section-TemporalReasoning.xml	2009-03-20 09:57:33 UTC (rev 25762)
@@ -1,15 +1,92 @@
 <?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>Temporal Reasoning</title>	
-	
-	<xi:include href="Section-TemporalReasoning_TemporalOperators.xml" />
-	
-	<xi:include href="Section-TemporalReasoning_AvailableTemporalOperators.xml" />
-		
+         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>Temporal Reasoning</title>
+
+  <para>Temporal reasoning is another requirement of any CEP system. As
+  discussed previously, one of the distinguishing characteristics of events is
+  their strong temporal relationships.</para>
+
+  <para>Temporal reasoning is an extensive field of research, from its roots
+  on Temporal Modal Logic to its more practical applications in business
+  systems. There are hundreds of papers and thesis written and approches are
+  described for several applications. Drools once more takes a pragmatic and
+  simple approach based on several sources, but specially worth noting the
+  following papers:</para>
+
+  <bibliolist>
+    <biblioentry>
+      <abbrev>ALLEN81</abbrev>
+
+      <author>
+        <personname>Allen, J.F.</personname>
+      </author>
+
+      <title>An Interval-based Representation of Temporal Knowledge</title>
+
+      <pubdate>1981</pubdate>
+    </biblioentry>
+
+    <biblioentry>
+      <abbrev>ALLEN83</abbrev>
+
+      <author>
+        <personname>Allen, J.F.</personname>
+      </author>
+
+      <title>Maintaining knowledge about temporal intervals</title>
+
+      <pubdate>1983</pubdate>
+    </biblioentry>
+
+    <biblioentry>
+      <abbrev>BENNE00</abbrev>
+
+      <authorgroup>
+        <author>
+          <personname>Bennet, Brandon</personname>
+        </author>
+
+        <author>
+          <personname>Galton, Antony P.</personname>
+        </author>
+      </authorgroup>
+
+      <title>A Unifying Semantics for Time and Events</title>
+
+      <pubdate>2005</pubdate>
+    </biblioentry>
+
+    <biblioentry>
+      <abbrev>YONEK05</abbrev>
+
+      <authorgroup>
+        <author>
+          <personname>Yoneki, Eiko</personname>
+        </author>
+
+        <author>
+          <personname>Bacon, Jean</personname>
+        </author>
+      </authorgroup>
+
+      <title>Unified Semantics for Event Correlation Over Time and Space in
+      Hybrid Network Environments</title>
+
+      <pubdate>2005</pubdate>
+    </biblioentry>
+  </bibliolist>
+
+  <blockquote></blockquote>
+
+  <para>Drools implements the Interval-based Time Event Semantics described by
+  Allen, and represents Point-in-Time Events as Interval-based evens with
+  duration 0 (zero).</para>
+
+  <xi:include href="Section-TemporalReasoning_TemporalOperators.xml" />
 </section>

Modified: labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-TemporalReasoning/Section-TemporalReasoning_TemporalOperators.xml
===================================================================
--- labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-TemporalReasoning/Section-TemporalReasoning_TemporalOperators.xml	2009-03-20 05:31:17 UTC (rev 25761)
+++ labs/jbossrules/trunk/drools-docs/drools-docs-fusion/src/main/docbook/en-US/Chapter-Features/Chapter-TemporalReasoning/Section-TemporalReasoning_TemporalOperators.xml	2009-03-20 09:57:33 UTC (rev 25762)
@@ -1,12 +1,636 @@
 <?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>Temporal Operators</title>	
-	
-	
+         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>Temporal Operators</title>
+
+  <para>Drools implements all 13 operators defined by Allen and also their
+  logical complement (negation). This section details each of the operators
+  and their parameters.</para>
+
+  <section>
+    <title>After</title>
+
+    <para>The after evaluator correlates two events and matches when the
+    temporal distance from the current event to the event being correlated
+    belongs to the distance range declared for the operator. </para>
+
+    <para>Lets look at an example: </para>
+
+    <programlisting>$eventA : EventA( this after[ 3m30s, 4m ] $eventB ) </programlisting>
+
+    <para>The previous pattern will match if and only if the temporal distance
+    between the time when $eventB finished and the time when $eventA started
+    is between ( 3 minutes and 30 seconds ) and ( 4 minutes ). In other
+    words:</para>
+
+    <programlisting> 3m30s &lt;= $eventA.startTimestamp - $eventB.endTimeStamp &lt;= 4m </programlisting>
+
+    <para>The temporal distance interval for the after operator is optional:
+    </para>
+
+    <itemizedlist>
+      <listitem>
+        <para>If two values are defined (like in the example bellow), the
+        interval starts on the first value and finishes on the second. </para>
+      </listitem>
+
+      <listitem>
+        <para>If only one value is defined, the interval starts on the value
+        and finishes on the positive infinity. </para>
+      </listitem>
+
+      <listitem>
+        <para>If no value is defined, it is assumed that the initial value is
+        1ms and the final value is the positive infinity. </para>
+      </listitem>
+    </itemizedlist>
+
+    <tip>
+      <para>It is possible to define negative distances for this operator.
+      Example: </para>
+
+      <programlisting>$eventA : EventA( this after[ -3m30s, -2m ] $eventB ) </programlisting>
+    </tip>
+
+    <note>
+      <para>If the first value is greater than the second value, the engine
+      automatically reverses them, as there is no reason to have the first
+      value greater than the second value. Example: the following two patterns
+      are considered to have the same semantics: </para>
+
+      <programlisting>$eventA : EventA( this after[ -3m30s, -2m ] $eventB ) 
+$eventA : EventA( this after[ -2m, -3m30s ] $eventB ) </programlisting>
+    </note>
+  </section>
+
+  <section>
+    <title>Before</title>
+
+    <para>The before evaluator correlates two events and matches when the
+    temporal distance from the event being correlated to the current
+    correlated belongs to the distance range declared for the operator.
+    </para>
+
+    <para>Lets look at an example: </para>
+
+    <programlisting>$eventA : EventA( this before[ 3m30s, 4m ] $eventB ) </programlisting>
+
+    <para>The previous pattern will match if and only if the temporal distance
+    between the time when $eventA finished and the time when $eventB started
+    is between ( 3 minutes and 30 seconds ) and ( 4 minutes ). In other
+    words:</para>
+
+    <programlisting> 3m30s &lt;= $eventB.startTimestamp - $eventA.endTimeStamp &lt;= 4m </programlisting>
+
+    <para>The temporal distance interval for the before operator is optional:
+    </para>
+
+    <itemizedlist>
+      <listitem>
+        <para>If two values are defined (like in the example bellow), the
+        interval starts on the first value and finishes on the second. </para>
+      </listitem>
+
+      <listitem>
+        <para>If only one value is defined, then the interval starts on the
+        value and finishes on the positive infinity. </para>
+      </listitem>
+
+      <listitem>
+        <para>If no value is defined, it is assumed that the initial value is
+        1ms and the final value is the positive infinity.</para>
+      </listitem>
+    </itemizedlist>
+
+    <tip>
+      <para>It is possible to define negative distances for this operator.
+      Example: </para>
+
+      <programlisting>$eventA : EventA( this before[ -3m30s, -2m ] $eventB ) </programlisting>
+    </tip>
+
+    <note>
+      <para>If the first value is greater than the second value, the engine
+      automatically reverses them, as there is no reason to have the first
+      value greater than the second value. Example: the following two patterns
+      are considered to have the same semantics: </para>
+
+      <programlisting>$eventA : EventA( this before[ -3m30s, -2m ] $eventB ) 
+$eventA : EventA( this before[ -2m, -3m30s ] $eventB ) </programlisting>
+    </note>
+  </section>
+
+  <section>
+    <title>Coincides</title>
+
+    <para>The coincides evaluator correlates two events and matches when both
+    happen at the same time. Optionally, the evaluator accept thresholds for
+    the distance between events' start and finish timestamps. </para>
+
+    <para>Lets look at an example: </para>
+
+    <programlisting>$eventA : EventA( this coincides $eventB ) </programlisting>
+
+    <para>The previous pattern will match if and only if the start timestamps
+    of both $eventA and $eventB are the same AND the end timestamp of both
+    $eventA and $eventB also are the same. </para>
+
+    <para>Optionally, this operator accepts one or two parameters. These
+    parameters are the thresholds for the distance between matching
+    timestamps. </para>
+
+    <itemizedlist>
+      <listitem>
+        <para>If only one paratemer is given, it is used for both start and
+        end timestamps.</para>
+      </listitem>
+
+      <listitem>
+        <para>If two parameters are given, then the first is used as a
+        threshold for the start timestamp and the second one is used as a
+        threshold for the end timestamp.</para>
+      </listitem>
+    </itemizedlist>
+
+    <para>In other words: </para>
+
+    <programlisting>$eventA : EventA( this coincides[15s, 10s] $eventB ) </programlisting>
+
+    <para>Above pattern will match if and only if: </para>
+
+    <programlisting>abs( $eventA.startTimestamp - $eventB.startTimestamp ) &lt;= 15s &amp;&amp; 
+abs( $eventA.endTimestamp - $eventB.endTimestamp ) &lt;= 10s </programlisting>
+
+    <caution>
+      <para>It makes no sense to use negative interval values for the
+      parameters and the engine will raise an error if that happens.</para>
+    </caution>
+  </section>
+
+  <section>
+    <title>During</title>
+
+    <para>The during evaluator correlates two events and matches when the
+    current event happens during the occurrence of the event being correlated.
+    </para>
+
+    <para>Lets look at an example: </para>
+
+    <programlisting>$eventA : EventA( this during $eventB ) </programlisting>
+
+    <para>The previous pattern will match if and only if the $eventA starts
+    after $eventB starts and finishes before $eventB finishes. </para>
+
+    <para>In other words: </para>
+
+    <programlisting>$eventB.startTimestamp &lt; $eventA.startTimestamp &lt;= $eventA.endTimestamp &lt; $eventB.endTimestamp </programlisting>
+
+    <para>The during operator accepts 1, 2 or 4 optional parameters as follow:
+    </para>
+
+    <itemizedlist>
+      <listitem>
+        <para>If one value is defined, this will be the maximum distance
+        between the start timestamp of both event and the maximum distance
+        between the end timestamp of both events in order to operator match.
+        Example:</para>
+
+        <programlisting>$eventA : EventA( this during[ 5s ] $eventB )</programlisting>
+
+        <para>Will match if and only if:</para>
+
+        <programlisting>0 &lt; $eventA.startTimestamp - $eventB.startTimestamp &lt;= 5s &amp;&amp; 
+0 &lt; $eventB.endTimestamp - $eventA.endTimestamp &lt;= 5s</programlisting>
+      </listitem>
+    </itemizedlist>
+
+    <itemizedlist>
+      <listitem>
+        <para>If two values are defined, the first value will be the minimum
+        distance between the timestamps of both events, while the second value
+        will be the maximum distance between the timestamps of both events.
+        Example: </para>
+
+        <programlisting>$eventA : EventA( this during[ 5s, 10s ] $eventB )</programlisting>
+
+        <para>Will match if and only if:</para>
+
+        <programlisting>5s &lt;= $eventA.startTimestamp - $eventB.startTimestamp &lt;= 10s &amp;&amp; 
+5s &lt;= $eventB.endTimestamp - $eventA.endTimestamp &lt;= 10s</programlisting>
+      </listitem>
+    </itemizedlist>
+
+    <itemizedlist>
+      <listitem>
+        <para>If four values are defined, the first two values will be the
+        minimum and maximum distances between the start timestamp of both
+        events, while the last two values will be the minimum and maximum
+        distances between the end timestamp of both events. Example:</para>
+
+        <programlisting>$eventA : EventA( this during[ 2s, 6s, 4s, 10s ] $eventB )</programlisting>
+
+        <para>Will match if and only if:</para>
+
+        <programlisting>2s &lt;= $eventA.startTimestamp - $eventB.startTimestamp &lt;= 6s &amp;&amp; 
+4s &lt;= $eventB.endTimestamp - $eventA.endTimestamp &lt;= 10s</programlisting>
+      </listitem>
+    </itemizedlist>
+  </section>
+
+  <section>
+    <title>Finishes</title>
+
+    <para>The finishes evaluator correlates two events and matches when the
+    current event's start timestamp happens after the correlated event's start
+    timestamp, but both end timestamps occur at the same time. </para>
+
+    <para>Lets look at an example: </para>
+
+    <programlisting>$eventA : EventA( this finishes $eventB ) </programlisting>
+
+    <para>The previous pattern will match if and only if the $eventA starts
+    after $eventB starts and finishes at the same time $eventB finishes.
+    </para>
+
+    <para>In other words: </para>
+
+    <programlisting>$eventB.startTimestamp &lt; $eventA.startTimestamp &amp;&amp; 
+$eventA.endTimestamp == $eventB.endTimestamp </programlisting>
+
+    <para>The finishes evaluator accepts one optional parameter. If it is
+    defined, it determines the maximum distance between the end timestamp of
+    both events in order for the operator to match. Example: </para>
+
+    <programlisting>$eventA : EventA( this finishes[ 5s ] $eventB ) </programlisting>
+
+    <para>Will match if and only if: </para>
+
+    <programlisting>$eventB.startTimestamp &lt; $eventA.startTimestamp &amp;&amp; 
+abs( $eventA.endTimestamp - $eventB.endTimestamp ) &lt;= 5s </programlisting>
+
+    <caution>
+      <para>It makes no sense to use a negative interval value for the
+      parameter and the engine will raise an exception if that happens.</para>
+    </caution>
+  </section>
+
+  <section>
+    <title>Finished By</title>
+
+    <para>The finishedby evaluator correlates two events and matches when the
+    current event start timestamp happens before the correlated event start
+    timestamp, but both end timestamps occur at the same time. This is the
+    symmetrical opposite of finishes evaluator. </para>
+
+    <para>Lets look at an example: </para>
+
+    <programlisting>$eventA : EventA( this finishedby $eventB ) </programlisting>
+
+    <para>The previous pattern will match if and only if the $eventA starts
+    before $eventB starts and finishes at the same time $eventB finishes.
+    </para>
+
+    <para>In other words: </para>
+
+    <programlisting>$eventA.startTimestamp &lt; $eventB.startTimestamp &amp;&amp; 
+$eventA.endTimestamp == $eventB.endTimestamp </programlisting>
+
+    <para>The finishedby evaluator accepts one optional parameter. If it is
+    defined, it determines the maximum distance between the end timestamp of
+    both events in order for the operator to match. Example: </para>
+
+    <programlisting>$eventA : EventA( this finishedby[ 5s ] $eventB ) </programlisting>
+
+    <para>Will match if and only if: </para>
+
+    <programlisting>$eventA.startTimestamp &lt; $eventB.startTimestamp &amp;&amp; 
+abs( $eventA.endTimestamp - $eventB.endTimestamp ) &lt;= 5s </programlisting>
+
+    <caution>
+      <para>It makes no sense to use a negative interval value for the
+      parameter and the engine will raise an exception if that happens.</para>
+    </caution>
+  </section>
+
+  <section>
+    <title>Includes</title>
+
+    <para>The includes evaluator correlates two events and matches when the
+    event being correlated happens during the current event. It is the
+    symmetrical opposite of during evaluator. </para>
+
+    <para>Lets look at an example:</para>
+
+    <programlisting>$eventA : EventA( this includes $eventB ) </programlisting>
+
+    <para>The previous pattern will match if and only if the $eventB starts
+    after $eventA starts and finishes before $eventA finishes. </para>
+
+    <para>In other words: </para>
+
+    <programlisting>$eventA.startTimestamp &lt; $eventB.startTimestamp &lt;= $eventB.endTimestamp &lt; $eventA.endTimestamp </programlisting>
+
+    <para>The includes operator accepts 1, 2 or 4 optional parameters as
+    follow: </para>
+
+    <itemizedlist>
+      <listitem>
+        <para>If one value is defined, this will be the maximum distance
+        between the start timestamp of both event and the maximum distance
+        between the end timestamp of both events in order to operator match.
+        Example:</para>
+
+        <programlisting>$eventA : EventA( this includes[ 5s ] $eventB )</programlisting>
+
+        <para>Will match if and only if:</para>
+
+        <programlisting>0 &lt; $eventB.startTimestamp - $eventA.startTimestamp &lt;= 5s &amp;&amp; 
+0 &lt; $eventA.endTimestamp - $eventB.endTimestamp &lt;= 5s</programlisting>
+      </listitem>
+    </itemizedlist>
+
+    <itemizedlist>
+      <listitem>
+        <para>If two values are defined, the first value will be the minimum
+        distance between the timestamps of both events, while the second value
+        will be the maximum distance between the timestamps of both events.
+        Example:</para>
+
+        <programlisting>$eventA : EventA( this includes[ 5s, 10s ] $eventB )</programlisting>
+
+        <para>Will match if and only if:</para>
+
+        <programlisting>5s &lt;= $eventB.startTimestamp - $eventA.startTimestamp &lt;= 10s &amp;&amp; 
+5s &lt;= $eventA.endTimestamp - $eventB.endTimestamp &lt;= 10s</programlisting>
+      </listitem>
+    </itemizedlist>
+
+    <itemizedlist>
+      <listitem>
+        <para>If four values are defined, the first two values will be the
+        minimum and maximum distances between the start timestamp of both
+        events, while the last two values will be the minimum and maximum
+        distances between the end timestamp of both events. Example:</para>
+
+        <programlisting>$eventA : EventA( this includes[ 2s, 6s, 4s, 10s ] $eventB )</programlisting>
+
+        <para>Will match if and only if: </para>
+
+        <programlisting>2s &lt;= $eventB.startTimestamp - $eventA.startTimestamp &lt;= 6s &amp;&amp; 
+4s &lt;= $eventA.endTimestamp - $eventB.endTimestamp &lt;= 10s </programlisting>
+      </listitem>
+    </itemizedlist>
+  </section>
+
+  <section>
+    <title>Meets</title>
+
+    <para>The meets evaluator correlates two events and matches when the
+    current event's end timestamp happens at the same time as the correlated
+    event's start timestamp. </para>
+
+    <para>Lets look at an example: </para>
+
+    <programlisting>$eventA : EventA( this meets $eventB ) </programlisting>
+
+    <para>The previous pattern will match if and only if the $eventA finishes
+    at the same time $eventB starts.</para>
+
+    <para>In other words: </para>
+
+    <programlisting>abs( $eventB.startTimestamp - $eventA.endTimestamp ) == 0 </programlisting>
+
+    <para>The meets evaluator accepts one optional parameter. If it is
+    defined, it determines the maximum distance between the end timestamp of
+    current event and the start timestamp of the correlated event in order for
+    the operator to match. Example: </para>
+
+    <programlisting>$eventA : EventA( this meets[ 5s ] $eventB ) </programlisting>
+
+    <para>Will match if and only if: </para>
+
+    <programlisting>abs( $eventB.startTimestamp - $eventA.endTimestamp) &lt;= 5s </programlisting>
+
+    <caution>
+      <para>It makes no sense to use a negative interval value for the
+      parameter and the engine will raise an exception if that happens.</para>
+    </caution>
+  </section>
+
+  <section>
+    <title>Met By</title>
+
+    <para>The metby evaluator correlates two events and matches when the
+    current event's start timestamp happens at the same time as the correlated
+    event's end timestamp. </para>
+
+    <para>Lets look at an example: </para>
+
+    <programlisting>$eventA : EventA( this metby $eventB ) </programlisting>
+
+    <para>The previous pattern will match if and only if the $eventA starts at
+    the same time $eventB finishes. </para>
+
+    <para>In other words: </para>
+
+    <programlisting>abs( $eventA.startTimestamp - $eventB.endTimestamp ) == 0 </programlisting>
+
+    <para>The metby evaluator accepts one optional parameter. If it is
+    defined, it determines the maximum distance between the end timestamp of
+    the correlated event and the start timestamp of the current event in order
+    for the operator to match. Example: </para>
+
+    <programlisting>$eventA : EventA( this metby[ 5s ] $eventB ) </programlisting>
+
+    <para>Will match if and only if: </para>
+
+    <programlisting>abs( $eventA.startTimestamp - $eventB.endTimestamp) &lt;= 5s </programlisting>
+
+    <caution>
+      <para>It makes no sense to use a negative interval value for the
+      parameter and the engine will raise an exception if that happens.</para>
+    </caution>
+  </section>
+
+  <section>
+    <title>Overlaps</title>
+
+    <para>The overlaps evaluator correlates two events and matches when the
+    current event starts before the correlated event starts and finishes after
+    the correlated event starts, but before the correlated event finishes. In
+    other words, both events have an overlapping period. </para>
+
+    <para>Lets look at an example: </para>
+
+    <programlisting>$eventA : EventA( this overlaps $eventB ) </programlisting>
+
+    <para>The previous pattern will match if and only if: </para>
+
+    <programlisting>$eventA.startTimestamp &lt; $eventB.startTimestamp &lt; $eventA.endTimestamp &lt; $eventB.endTimestamp </programlisting>
+
+    <para>The overlaps operator accepts 1 or 2 optional parameters as
+    follow:</para>
+
+    <itemizedlist>
+      <listitem>
+        <para>If one parameter is defined, this will be the maximum distance
+        between the start timestamp of the correlated event and the end
+        timestamp of the current event. Example:</para>
+
+        <programlisting>$eventA : EventA( this overlaps[ 5s ] $eventB )</programlisting>
+
+        <para>Will match if and only if:</para>
+
+        <programlisting>$eventA.startTimestamp &lt; $eventB.startTimestamp &lt; $eventA.endTimestamp &lt; $eventB.endTimestamp &amp;&amp; 
+0 &lt;= $eventA.endTimestamp - $eventB.startTimestamp &lt;= 5s</programlisting>
+      </listitem>
+    </itemizedlist>
+
+    <itemizedlist>
+      <listitem>
+        <para>If two values are defined, the first value will be the minimum
+        distance and the second value will be the maximum distance between the
+        start timestamp of the correlated event and the end timestamp of the
+        current event. Example:</para>
+
+        <programlisting>$eventA : EventA( this overlaps[ 5s, 10s ] $eventB )</programlisting>
+
+        <para>Will match if and only if:</para>
+
+        <programlisting>$eventA.startTimestamp &lt; $eventB.startTimestamp &lt; $eventA.endTimestamp &lt; $eventB.endTimestamp &amp;&amp; 
+5s &lt;= $eventA.endTimestamp - $eventB.startTimestamp &lt;= 10s </programlisting>
+      </listitem>
+    </itemizedlist>
+  </section>
+
+  <section>
+    <title>Overlapped By</title>
+
+    <para>The overlappedby evaluator correlates two events and matches when
+    the correlated event starts before the current event starts and finishes
+    after the current event starts, but before the current event finishes. In
+    other words, both events have an overlapping period. </para>
+
+    <para>Lets look at an example: </para>
+
+    <programlisting>$eventA : EventA( this overlappedby $eventB ) </programlisting>
+
+    <para>The previous pattern will match if and only if: </para>
+
+    <programlisting>$eventB.startTimestamp &lt; $eventA.startTimestamp &lt; $eventB.endTimestamp &lt; $eventA.endTimestamp </programlisting>
+
+    <para>The overlappedby operator accepts 1 or 2 optional parameters as
+    follow: </para>
+
+    <itemizedlist>
+      <listitem>
+        <para>If one parameter is defined, this will be the maximum distance
+        between the start timestamp of the current event and the end timestamp
+        of the correlated event. Example: </para>
+
+        <programlisting>$eventA : EventA( this overlappedby[ 5s ] $eventB )</programlisting>
+
+        <para>Will match if and only if:</para>
+
+        <programlisting>$eventB.startTimestamp &lt; $eventA.startTimestamp &lt; $eventB.endTimestamp &lt; $eventA.endTimestamp &amp;&amp; 
+0 &lt;= $eventB.endTimestamp - $eventA.startTimestamp &lt;= 5s</programlisting>
+      </listitem>
+    </itemizedlist>
+
+    <itemizedlist>
+      <listitem>
+        <para>If two values are defined, the first value will be the minimum
+        distance and the second value will be the maximum distance between the
+        start timestamp of the current event and the end timestamp of the
+        correlated event. Example: </para>
+
+        <programlisting>$eventA : EventA( this overlappedby[ 5s, 10s ] $eventB )</programlisting>
+
+        <para>Will match if and only if:</para>
+
+        <programlisting>$eventB.startTimestamp &lt; $eventA.startTimestamp &lt; $eventB.endTimestamp &lt; $eventA.endTimestamp &amp;&amp; 
+5s &lt;= $eventB.endTimestamp - $eventA.startTimestamp &lt;= 10s</programlisting>
+      </listitem>
+    </itemizedlist>
+
+    <para> </para>
+  </section>
+
+  <section>
+    <title>Starts</title>
+
+    <para>The starts evaluator correlates two events and matches when the
+    current event's end timestamp happens before the correlated event's end
+    timestamp, but both start timestamps occur at the same time. </para>
+
+    <para>Lets look at an example: </para>
+
+    <programlisting>$eventA : EventA( this starts $eventB ) </programlisting>
+
+    <para>The previous pattern will match if and only if the $eventA finishes
+    before $eventB finishes and starts at the same time $eventB starts.
+    </para>
+
+    <para>In other words: </para>
+
+    <programlisting>$eventA.startTimestamp == $eventB.startTimestamp &amp;&amp; 
+$eventA.endTimestamp &lt; $eventB.endTimestamp </programlisting>
+
+    <para>The starts evaluator accepts one optional parameter. If it is
+    defined, it determines the maximum distance between the start timestamp of
+    both events in order for the operator to match. Example: </para>
+
+    <programlisting>$eventA : EventA( this starts[ 5s ] $eventB ) </programlisting>
+
+    <para>Will match if and only if: </para>
+
+    <programlisting>abs( $eventA.startTimestamp - $eventB.startTimestamp ) &lt;= 5s &amp;&amp; 
+$eventA.endTimestamp &lt; $eventB.endTimestamp </programlisting>
+
+    <caution>
+      <para>It makes no sense to use a negative interval value for the
+      parameter and the engine will raise an exception if that happens.</para>
+    </caution>
+  </section>
+
+  <section>
+    <title>Started By</title>
+
+    <para>The startedby evaluator correlates two events and matches when the
+    correlating event's end timestamp happens before the current event's end
+    timestamp, but both start timestamps occur at the same time. Lets look at
+    an example: </para>
+
+    <programlisting>$eventA : EventA( this startedby $eventB ) </programlisting>
+
+    <para>The previous pattern will match if and only if the $eventB finishes
+    before $eventA finishes and starts at the same time $eventB starts.
+    </para>
+
+    <para>In other words: </para>
+
+    <programlisting>$eventA.startTimestamp == $eventB.startTimestamp &amp;&amp; 
+$eventA.endTimestamp &gt; $eventB.endTimestamp </programlisting>
+
+    <para>The startedby evaluator accepts one optional parameter. If it is
+    defined, it determines the maximum distance between the start timestamp of
+    both events in order for the operator to match. Example: </para>
+
+    <programlisting>$eventA : EventA( this starts[ 5s ] $eventB ) </programlisting>
+
+    <para>Will match if and only if: </para>
+
+    <programlisting>abs( $eventA.startTimestamp - $eventB.startTimestamp ) &lt;= 5s &amp;&amp; 
+$eventA.endTimestamp &gt; $eventB.endTimestamp </programlisting>
+
+    <caution>
+      <para>It makes no sense to use a negative interval value for the
+      parameter and the engine will raise an exception if that happens.</para>
+    </caution>
+  </section>
 </section>




More information about the jboss-svn-commits mailing list