Working with time points
A time point is a time instant that can be represented by an event or a time. In a rule, you can write operations to compare time points, or check that something happens before or after a time point.
- An event, for example an airport closed event, is an object with an attribute that represents the time instant at which the event occurred. You can refer implicitly or explicitly to this time stamp attribute. For example, if a purchase event has a time stamp attribute called "date", this purchase event is equivalent to the date of 'the purchase event'.
- An attribute of type date and time, for example the departure time of 'the flight'
- A date and time, for example 2/11/2013 10:40:00 PM
- A date, for example 2/11/2013, which indicates the start of a calendar day.
The precision of an event time stamp is measured in nanoseconds. The precision is preserved when the time stamp is copied to an entity or another event. However, the precision of the business language is measured in seconds. When a rule evaluates time comparisons, the time is truncated to the second and does not include the nanoseconds.
Time point in a time scale
The business language provides expressions to describe the time period in a time scale that contains a time point. For example, the calendar year of the departure time of 'the flight' or the hour of the departure time of 'the flight'.
the calendar month of 2/11/2013 10:40:00 PM refers to the time period that starts on February 1st, 2013 00:00:00 AM and ends on March 1st, 2013 00:00:00 AM.
Time point in a different time zone
The following rule checks the time of a meeting in a specified time zone.
when a meeting event occurs
where the time of day of the local time of this meeting event in "Europe/Paris" is after 5:00 PM
then
print "Meeting at the end of the working day in France.";
Collection of events
You can filter collections of objects that have a time point, for example, to detect all the events that happened over a certain period. A temporal filter applies a condition to each element of a collection and selects the elements that satisfy the condition.
- before
- after
- during
- before
- after
- at
- before or at
- at or after
Aggregation operators can be used on collections of events. In the following example, bid events is a collection of events:
the number of elements in bid events is at least 10.
In the following example, all purchase events represent a collection of purchase events, and the temporal filter selects the purchase events that occurred during November 2012:
all purchase events during November 2012
The filtered collection can be used in an aggregation, for example:
the total amount of all purchase events during November 2012.