Introduction

This tutorial provides an introduction to the temporal features that are available in AllegroGraph. We cover temporal points, temporal intervals, and how to locate each of these on a one-dimensional timeline. We provide a number of example queries demonstrating the supported temporal relations involving points, intervals and datetimes.

First, let's create a triple store and register namespaces for the tutorial. We will also use enable-!-reader to make it easier to type URIs. For more details on getting up and running with AllegroGraph, see the Quick Start. Note that you will need to have the AllegroGraph server running. See if installation guide for more details.

Points and Intervals

AllegroGraph supports Allen's temporal points and intervals. Points are an abstraction used to label moments such as "the moment John arrived". Points exist independently of time, but can be positioned on a timeline if a time is known. Intervals are another abstraction used to label a time period such as "Easter weekend, 2008"; these also exist independently of time but can be positioned on a timeline.

Temporal Properties

AllegroGraph supports the following temporal properties:

http://franz.com/ns/allegrograph/3.0/temporal/time

http://franz.com/ns/allegrograph/3.0/temporal/starttime

http://franz.com/ns/allegrograph/3.0/temporal/endtime

http://franz.com/ns/allegrograph/3.0/temporal/startpoint

http://franz.com/ns/allegrograph/3.0/temporal/endpoint

A Point is positioned on the timeline using the above time properties. Anything having the time property is a Point.

An Interval can be defined by specifying its startpoint and endpoint.Intervals can be positioned on the timeline by positioning their start and end points using the time property, or they can be positioned using the starttime and endtime properties. Anything having a startpoint, endpoint, starttime, or endtime property is an Interval.

In the following sections we provide examples for using these properties.

Situating Points on the Timeline

Use the t:time property to position a point on the timeline. The value must be a :date-time UPI.

Defining Intervals using two Times

Because they have startpoints and endpoints that are themselves situated the intervals above are already indirectly situated on a timeline. Below we show how to situate an interval on the timeline directly, using the t:starttime and t:endtime properties.

Temporal Queries

Given a triple store containing information about datetimes, points, and intervals, AllegroGraph provides a number of Prolog functors for specifying temporal constraints in select queries. (See the Prolog tutorial for more details on querying AllegroGraph using Prolog).

This documentation uses the usual Prolog argument notation. A + prefix on an argument indicates that is must be supplied (it is input to the predicate), a - prefix indicates the argument is output and must not be supplied, and a ± prefix indicates the argument may be either.

In the examples that follow we will use the triple store that was defined in the preceding sections as the basis for demonstrating a number of temporal queries.

Relations between Datetimes specified by Property and Subject

The following relations can be used to efficiently compare two datetimes. Datetimes are specified as the object corresponding to a property ?p and subject ?s, or they can specified as an explicit value.

Xdatetime-simultaneous

(datetime-simultaneous ±p1 ±s1 ±p2 ±s2)

functor

This can be viewed as comparing two datetimes that are each specified by a property-subject pair. The subjects ?s1 and ?s2 can each be a point or an interval. The properties ?p1 and ?p2 can be !t:time (if its subject is a point), or one of !t:starttime or !t:endtime (if its subject is an interval). This functor requires the datetime ?dt1 corresponding to triple (?s1 ?p1 ?dt1) to be simultaneous with the datetime ?dt2 corresponding to triple (?s2 ?p2 ?dt2).

This can be viewed as comparing two datetimes, the first of which is specified by a property-subject pair. The subject ?s can be a point or an interval. The property ?p can be !t:time (if its subject is a point), or one of !t:starttime or !t:endtime (if its subject is an interval). This functor requires the datetime ?dtps corresponding to triple (?s ?p ?dtps) to be simultaneous with the datetime ?dt.

This can be viewed as comparing two datetimes that are each specified by a property-subject pair. The subjects ?s1 and ?s2 can each be a point or an interval. The properties ?p1 and ?p2 can be !t:time (if its subject is a point), or one of !t:starttime or !t:endtime (if its subject is an interval). This functor requires the datetime ?dt1 corresponding to triple (?s1 ?p1 ?dt1) to be before the datetime ?dt2 corresponding to triple (?s2 ?p2 ?dt2).

This can be viewed as comparing two datetimes, the first of which is specified by a property-subject pair. The subject ?s can be a point or an interval. The property ?p can be !t:time (if its subject is a point), or one of !t:starttime or !t:endtime (if its subject is an interval). This functor requires the datetime ?dtps corresponding to triple (?s ?p ?dtps) to be before the datetime ?dt.

This can be viewed as comparing two datetimes that are each specified by a property-subject pair. The subjects ?s1 and ?s2 can each be a point or an interval. The properties ?p1 and ?p2 can be !t:time (if its subject is a point), or one of !t:starttime or !t:endtime (if its subject is an interval). This functor requires the datetime ?dt1 corresponding to triple (?s1 ?p1 ?dt1) to be after the datetime ?dt2 corresponding to triple (?s2 ?p2 ?dt2).

This can be viewed as comparing two datetimes, the first of which is specified by a property-subject pair. The subject ?s can be a point or an interval. The property ?p can be !t:time (if its subject is a point), or one of !t:starttime or !t:endtime (if its subject is an interval). This functor requires the datetime ?dtps corresponding to triple (?s ?p ?dtps) to be after the datetime ?dt.

This can be viewed as comparing three datetimes that are each specified by a property-subject pair. The subjects ?s1, ?s2 and ?s3 can each be a point or an interval. The properties ?p1, ?p2 and ?p3 can be !t:time (if its subject is a point), or one of !t:starttime or !t:endtime (if its subject is an interval). This functor requires the three datetimes ?dti (i=1,2,3) corresponding to triples (?si ?pi ?dti) to be in increasing order.

This can be viewed as comparing three datetimes, one of which is specified by a property-subject pair. The subjects ?s can be a point or an interval. The property ?p can be !t:time (if its subject is a point), or one of !t:starttime or !t:endtime (if its subject is an interval). This functor requires the datetime ?dtps corresponding to triple (?s ?p ?dtps) to be between the provided datetimes ?dt1 and ?dt2.