Allen's interval algebra
Allen's interval algebra is a calculus for temporal reasoning that was introduced by James F. Allen in 1983. The calculus defines possible relations between time intervals and provides a composition table that can be used as a basis
for reasoning about temporal descriptions of events. Formal description

Relations 

The following 13 base relations capture the possible relations between two intervals. Using this calculus, given facts can be formalized and then used for automatic reasoning. Relations between intervals are formalized as sets of base relations. The sentence
 During dinner, Peter reads the newspaper. Afterwards, he goes to bed. is formalized in Allen's Interval Algebra as follows:

In general, the number of different relations between n intervals, starting with n = 0, is 1, 1, 13, 409, 23917, 2244361... OEIS A055203. The special case shown above is for n = 2. Composition of relations between intervals
For reasoning about the relations between temporal intervals, Allen's interval algebra provides a composition table. Given the relation between  and  and the relation between  and , the composition table allows for concluding about the relation between  and . Together with a converse operation, this turns Allen's interval algebra into a relation algebra. For the example, one can infer . Extensions
Allen's interval algebra can be used for the description of both temporal intervals and spatial configurations. For the latter use, the relations are interpreted as describing the relative position of spatial objects. This also works for three-dimensional objects by listing the relation for each coordinate separately. The study of overlapping markup uses a similar algebra (see ). Its models have more variations depending on whether endpoints of document structures are permitted to be truly co-located, or merely [tangent]. Implementations 
 A simple java library implementing the concept of Allen's temporal relations and the path consistency algorithm
 Java library implementing Allen's Interval Algebra (incl. data and index structures, e.g., interval tree)
 OWL-Time Time Ontology in OWL an OWL-2 DL ontology of temporal concepts, for describing the temporal properties of resources in the world or described in Web pages. GQR is a reasoner for Allen's interval algebra (and many others)
 qualreas is a Python framework for qualitative reasoning over networks of relation algebras, such as RCC-8, Allen's interval algebra, and Allen's algebra integrated with Time Points and situated in either Left- or Right-Branching Time. SparQ is a reasoner for Allen's interval algebra (and many others)
 EveXL is a small domain-specific language for the detection of events that implements the Interval Algebra's operators via ASCII art patterns. See also
 Temporal logic
 Logic
 Region connection calculus
 Spatial relation (analog)
 Commonsense reasoning

References

Sources
 
 
 

Knowledge representation
Constraint programming