Skip to content

SWRLTemporalBuiltinsAdvanced

zippyrate edited this page Sep 10, 2014 · 1 revision

The SWRL Temporal Built-In Library is one of the SWRLAPI's built-in libraries. 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.

Table of Contents

Advanced Mode

In this mode the temporal built-ins in this library work with temporal information specified by a valid-time temporal model. It operates on temporal information encoded using this model and determines if this information satisfies the relevant temporal predicate at a particular granularity. Details of this temporal model can be found here.

The following built-ins are defined in this library:

duration

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 temporal:ValidInstant or XML Schema dateTime arguments or as a single temporal: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.

durationLessThan, durationEqualTo, durationGreaterThan

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 temporal:ValidInstant or XML Schema dateTime arguments or as a single temopral:ValidPeriod argument. All arguments must be bound and a granularity argument is required for this built-in.

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

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 final 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.

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

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

notDurationLessThan, notDurationEqualTo, notDurationGreaterThan

These built-ins simply implement the inverse of their namesake duration operators.

add

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 temporal:ValidInstant or XML Schema 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.

In addition to operating on interval-based arguments, XML Schema date and dateTime arguments can also be intermixed in some built-ins.

Examples

Assume we have two temporal: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 temopral: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.

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

temporal:duration(2, p1, temporal:Years)

temporal:before(i1, i2)

temporal:equal(i1, i2, temporal:Months)

temporal:meets(p1, p2, temporal:Days)

temporal:before(i1, p3)

temporal:before(i1, "2005-12-12")

temporal:contains(p1, p2, temporal:Days)