[rules-users] Temporal operators for point-in-time events

2011-12-13 Thread Mike Melton
Apologies for the stupid question, but I haven't seen anything in the
documentation regarding this and I want to verify my solution. Say I
have a point-in-time event (i.e., duration of 0) that I want to
correlate to another point-in-time event. I want a rule that will
activate if the timestamp of one is greater than or equal to the
other, basically after or coincides. I wrote a test using the
following rule and it seemed to work:

rule Greater Than or Equal
  when
$e1 : TestEvent( $id : id )
$e2 : TestEvent( id != id, this after[0ms] $e1 )
  then
System.out.println($e2 +  is greater than or equal to  + $e1);
end

I realize this rule will fire twice if the event timestamps are equal,
but it's just for demonstration purposes; my question is specifically
about the after[0ms] part. Is this the way to go to accomplish what
I need? It seems so simple but I have this annoying feeling that I'm
missing something.

On a slightly related topic, is there an updated version of the
temporal operators image from the Drools Fusion homepage? It is a
great visual description of the operators and I want to print it out
and post it at my desk, but it doesn't include all of the operators.

Image: 
http://www.jboss.org/drools/drools-fusion/mainColumnParagraphs/02/imageBinary/temporal-operators.png
From page: http://www.jboss.org/drools/drools-fusion.html

Thanks
Mike
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Temporal operators for point-in-time events

2011-12-13 Thread Edson Tirelli
   Your use of the after operator is correct. The documentation tells you
about that, although in textual form:

http://docs.jboss.org/drools/release/5.3.0.Final/drools-fusion-docs/html_single/index.html#d0e611

   This presentation has the 2 tables of operators:

http://www.slideshare.net/ge0ffrey/applying-cep-drools-fusion-drools-jbpm-bootcamps-2011

Edson

On Tue, Dec 13, 2011 at 12:11 PM, Mike Melton mike.mel...@gmail.com wrote:

 Apologies for the stupid question, but I haven't seen anything in the
 documentation regarding this and I want to verify my solution. Say I
 have a point-in-time event (i.e., duration of 0) that I want to
 correlate to another point-in-time event. I want a rule that will
 activate if the timestamp of one is greater than or equal to the
 other, basically after or coincides. I wrote a test using the
 following rule and it seemed to work:

 rule Greater Than or Equal
  when
$e1 : TestEvent( $id : id )
$e2 : TestEvent( id != id, this after[0ms] $e1 )
  then
System.out.println($e2 +  is greater than or equal to  + $e1);
 end

 I realize this rule will fire twice if the event timestamps are equal,
 but it's just for demonstration purposes; my question is specifically
 about the after[0ms] part. Is this the way to go to accomplish what
 I need? It seems so simple but I have this annoying feeling that I'm
 missing something.

 On a slightly related topic, is there an updated version of the
 temporal operators image from the Drools Fusion homepage? It is a
 great visual description of the operators and I want to print it out
 and post it at my desk, but it doesn't include all of the operators.

 Image:
 http://www.jboss.org/drools/drools-fusion/mainColumnParagraphs/02/imageBinary/temporal-operators.png
 From page: http://www.jboss.org/drools/drools-fusion.html

 Thanks
 Mike
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 
  Edson Tirelli
  JBoss Drools Core Development
  JBoss by Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Temporal operators for point-in-time events

2011-12-13 Thread Mike Melton
Thank you, Edson.

I saw the written documentation but since the default after interval
is [1ms, infinity], I wanted to check for the specific [0, infinity]
case that there wasn't a better suited operator.

I do have a (somewhat related) question about the documentation when
compared to the diagram(s). Take, for example, the finishedby
operator. The documentation says A finishedby B means A starts
before B and A and B finish at the same time. However, the diagram
shows A starting *after* B and A and B finishing at the same time. The
other related operators (finishes, starts, startedby) all have the
same discrepancy. (Additionally, the second diagram in the
presentation includes a different definition for the finishes operator
than the first diagram. Maybe it should be startedby?)

My tests show me that the written documentation is correct and the
diagram is not. Unless I am reading the diagram incorrectly; if that
is the case, can someone explain it?

Thanks.


2011/12/13 Edson Tirelli ed.tire...@gmail.com:

    Your use of the after operator is correct. The documentation tells you
 about that, although in textual form:

 http://docs.jboss.org/drools/release/5.3.0.Final/drools-fusion-docs/html_single/index.html#d0e611

    This presentation has the 2 tables of operators:

 http://www.slideshare.net/ge0ffrey/applying-cep-drools-fusion-drools-jbpm-bootcamps-2011

     Edson

 On Tue, Dec 13, 2011 at 12:11 PM, Mike Melton mike.mel...@gmail.com wrote:

 Apologies for the stupid question, but I haven't seen anything in the
 documentation regarding this and I want to verify my solution. Say I
 have a point-in-time event (i.e., duration of 0) that I want to
 correlate to another point-in-time event. I want a rule that will
 activate if the timestamp of one is greater than or equal to the
 other, basically after or coincides. I wrote a test using the
 following rule and it seemed to work:

 rule Greater Than or Equal
  when
    $e1 : TestEvent( $id : id )
    $e2 : TestEvent( id != id, this after[0ms] $e1 )
  then
    System.out.println($e2 +  is greater than or equal to  + $e1);
 end

 I realize this rule will fire twice if the event timestamps are equal,
 but it's just for demonstration purposes; my question is specifically
 about the after[0ms] part. Is this the way to go to accomplish what
 I need? It seems so simple but I have this annoying feeling that I'm
 missing something.

 On a slightly related topic, is there an updated version of the
 temporal operators image from the Drools Fusion homepage? It is a
 great visual description of the operators and I want to print it out
 and post it at my desk, but it doesn't include all of the operators.

 Image:
 http://www.jboss.org/drools/drools-fusion/mainColumnParagraphs/02/imageBinary/temporal-operators.png
 From page: http://www.jboss.org/drools/drools-fusion.html

 Thanks
 Mike
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




 --
   Edson Tirelli
   JBoss Drools Core Development
   JBoss by Red Hat @ www.jboss.com

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users