Reference > Rule Languages > ILOG Rule Language > IRL Keywords > after

Summary

A binary temporal constraint in an event condition. This keyword is used in rule conditions.

Syntax

[?var:] event className (?eventVar1 after [interval] ?eventVar2);

Description

The after keyword is used in the condition part of a rule in an event condition. A temporal constraint between two events is expressed using the after and before keywords. An interval is of the form [lowerBound, upperBound], where a bound is either an expression evaluating to an integer, or the $ sign which denotes infinity.

Consider that the timestamp of ?event1 is t1 and that the timestamp of ?event2 is t2. The after operator can be expressed as follows:

Example

rule ReportAlarmPairsToUsers {
   when {
      ?u: User();
      ?a1: event Alarm();
      ?a2: event Alarm(?this after[1, 4] ?a1);
   } 
   then {
      ?u.report(?a1, ?a2);
   }
};

Assume that a User instance is in the working memory and that an Alarm instance is inserted. A partial instance of the ReportAlarmPairsToUsers rule will be created and maintained for four ticks. If the User instance is then retracted, the partial instance of the rule will be immediately deleted. An instance of the ReportAlarmsToUsers rule is created on each instance of the User class in the working memory when a second alarm event ?a2 is inserted no greater than four ticks after ?a1.

See Also

before, event (in rule conditions), occursin, timeof