Real Allen's interval algebra over DateTime-bounded half-open intervals
[start, end), implemented with plain DateTime comparisons — no
third-party interval package. (Previously backed by the interval hex
package's Interval.DateTimeInterval; that package pins decimal ~> 2.0
with no newer release, which is irreconcilable with explorer's
decimal ~> 3.1 requirement and would force an unpublishable
override: true dependency. Allen's relations reduce to straightforward
endpoint comparisons on plain DateTime values, so no library was needed
for this.)
Given two OCEL-shaped event pairs (each a {start, end} DateTime tuple),
computes which one of Allen's 13 base relations holds between them:
| `:before | :after | :meets | :met_by | :overlaps | :overlapped_by | |
| :starts | :started_by | :during | :contains | :finishes | :finished_by | :equals` |
Intervals are half-open [start, end) (left-inclusive, right-exclusive) —
the conventional representation for event intervals, under which two
intervals "meet" exactly when one's end equals the other's start.
Summary
Functions
Build a {start, end} interval from an OCEL-shaped event pair
%{start: DateTime.t(), end: DateTime.t()} (or a {start, end} tuple).
Compute the real Allen relation between two {start, end} intervals (or
two OCEL-shaped event pairs, which are converted first).
Types
@type interval() :: {DateTime.t(), DateTime.t()}
@type relation() ::
:before
| :after
| :meets
| :met_by
| :overlaps
| :overlapped_by
| :starts
| :started_by
| :during
| :contains
| :finishes
| :finished_by
| :equals
Functions
@spec interval_of(%{start: DateTime.t(), end: DateTime.t()} | interval()) :: interval()
Build a {start, end} interval from an OCEL-shaped event pair
%{start: DateTime.t(), end: DateTime.t()} (or a {start, end} tuple).
@spec relation( interval() | %{start: DateTime.t(), end: DateTime.t()}, interval() | %{start: DateTime.t(), end: DateTime.t()} ) :: relation()
Compute the real Allen relation between two {start, end} intervals (or
two OCEL-shaped event pairs, which are converted first).