Interval Relations - harshtuna/temporal-data GitHub Wiki

Overview

Allen's algebra is industry standard for reasoning about temporal interval relationships. Good overview of Allen's algebra here: http://www.ics.uci.edu/~alspaugh/cls/shr/allen.html For practical purposes it is convenient to use less complicated sub-algebras (e.g. SQL:2011 approach).

Assumptions about a and b where SQL:2008 equivalent is provided:

  • inclusive-exclusive model, i.e. [from, to)
  • from-to interval is not empty, i.e. from < to - follows natural time flow and not empty

Allen's Relations

Relation Name Allen Signature SQL:2011 SQL:2008
before before < <<<< PRECEDES a.to < b.from
meets meets m <=<< IMMEDIATELY PRECEDES a.to = b.from
overlaps overlaps o <><< OVERLAPS a.from < b.from AND b.from < a.to AND a.to < b.to
finished-by finished-by fi <><= CONTAINS a.from < b.from AND a.to = b.to
contains contains di <>>> CONTAINS a.from < b.from AND a.to > b.to
starts starts s =><< OVERLAPS a.from = b.from AND a.to < b.to
equals equals = =><= EQUALS a.from = b.from AND a.to = b.to
started-by started-by si =<<> CONTAINS a.from = b.from AND a.to > b.to
during during d >><< OVERLAPS a.from > b.from AND a.to < b.to
finishes finishes f >><= OVERLAPS a.from > b.from AND a.to = b.to
overlapped-by overlapped-by oi >><> OVERLAPS b.from < a.from AND a.from < b.to AND b.to < a.to
met-by met-by mi >>=> IMMEDIATELY SUCCEEDS a.from = b.to
after after > >>>> SUCCEEDS a.from > b.to

Signature = relation between endpoints a.from-b.from / a.to-b.from / a.from-b.to / a.to-b.to (Kovarik)

source:

  • Asplaugh T. Allen's Interval Algebra http://www.ics.uci.edu/~alspaugh/cls/shr/allen.html
  • Jonhston T. 2014 Bitemporal Data: Theory and Practice. Morgan-Kaufmann. (ISBN: 978-0124080676)
  • Kulkarni K. et al. 2012 Temporal features in SQL:2011 SIGMOD Record
  • Kovarik V. et al. 2000 An interval-based temporal algebra based on binary encoding of point relations IJIS

SQL:2011 Relations

Predicate Allens relation Description SQL:2008 Set Properties
CONTAINS (fi, di, =, si) first interval includes every point of the second a.from <= b.from AND a.to >= b.to reflexive, symmetric
OVERLAPS (o, fi, di, s, =, si, d, f, oi) at least one time point in common a.to > b.from AND a.from < b.to reflexive, antisymmetric
EQUALS (=) intervals equal a.from = b.from AND a.to = b.to reflexive, symmetric, transitive
PRECEDES (<, m) first interval is before the second a.to <= b.from irreflexive, asymmetric, transitive
SUCCEEDS (>, mi) first interval is after the second a.from >= b.to irreflexive, asymmetric, transitive
IMMEDIATELY PRECEDES (m) first interval is before and adjacent to the second a.to = b.from irreflexive, asymmetric
IMMEDIATELY SUCCEEDS (mi) first interval is after and adjacent to the second a.from = b.to irreflexive, asymmetric