The SWRL Temporal Built-In Library is one of the SWRLTabBuiltInLibraries. It defines a set of built-ins that can be used in SWRL rules to perform temporal operations. This library supports both basic and advanced modes for working with temporal information. This document describes the use these temporal built-ins in the advanced mode. Details of the basic mode can be found here.    (AUP)

Advanced Mode    (AUQ)

In this mode the temporal built-ins in this library work with temporal information specified by the SWRL Temporal Model and determine if this information satisfies the relevant temporal predicate at a particular granularity.    (AUR)

In addition to supporting interval-based modeling, the built-ins in this ontology can be used with basic XML Schema date and dateTime types. A description of this simpler usage can be found here. As described below, temporal:ValidTime arguments can be intermixed with XML Schema date and dateTime arguments in some built-ins.    (AVB)

The following built-ins are defined in this library:    (ATR)

duration    (ATS)

A predicate that is satisfied if the first duration argument is equal to the difference between two timestamps at the granularity specified by the final argument. The timestamps are specified as either a mixture of two ValidInstant or XML Schema dateTime arguments or as a single ValidPeriod argument. If the duration argument is unbound, it is assigned to the time difference between the two timestamps at the granularity specified by the final argument. A granularity argument is required for this built-in.    (ATV)

durationLessThan, durationEqualTo, durationGreaterThan    (ATU)

This predicate is satisfied if the the first duration argument is less than, equal to, or greater than the difference between two timestamps at the granularity specified by the final argument. The timestamps are specified as either a mixture of two ValidInstant or XML Schema datetime arguments or as a single ValidPeriod argument. All arguments must be bound and a granularity argument is required for this built-in.    (ATV)

equals, before, after, meets, metBy, overlaps, overlappedBy, contains, during, starts, startedBy, finishes, finishedBy    (ATX)

These built-ins implement the standard Allen temporal operators. They take two or three arguments. The first two arguments representing either instants or intervals and apply the relevant temporal operation to those arguments. A third optional argument specifies the granularity of the operation. If no granularity is specified, either the finest granularity of any instant or period argument is used, or, if there are no instants or periods arguments, the finest granularity supported by the library (i.e., milliseconds) is used.    (AO2)

notEquals, notBefore, notAfter, notMeets, notMetBy, notOverlaps, notOverlappedBy, notContains, notDuring, notStarts, notStartedBy, notFinishes, notFinishedBy    (ATX)

These built-ins simply implement the inverse of the standard Allen operators.    (AU0)

notDurationLessThan, notDurationEqualTo, notDurationGreaterThan    (ATZ)

These built-ins simply implement the inverse of the duration operators.    (AU0)

add    (AU1)

This built-in returns true if the first timestamp argument is equal to the second timestamps argument plus the third count argument at the granularity specified by the fourth argument. The timestamps are specified as either a ValidInstant or datetime arguments. If the first argument is unbound, it is assigned the result of the addition. A granularity argument is required for this built-in. E.g., temporal:add(?t, "1999-11-01T10:00", 4, temporal:Years). A negative count argument can be used to perform subtraction.    (AU2)

Examples    (AU3)

Assume we have two ValidInstant individuals named i1, and i2. The instants have time values 2003-12-01T12:00:00.000 and 2003-12-22T02:00:00.000 and both are accurate to a granularity of days. Assume also that we have three ValidPeriod individuals p1, p2, and p3. The periods represent intervals (2001-12-22T000:00:00.000, 2003-12-25T00:00:00.000), (2001-12-26T02:00:00.000, 2001-12-26T04:00:00.000), and (2003-12-01T12:00:23.000, 2004-02-00T02:01:00.000), with a recorded granularity of days, hours, and seconds, respectively.    (AU4)

The following are some example uses of the built-ins defined in this library, all of which evaluate to true.    (AU5)