Skip to content

Function: allen()

@kortexya/reasoninglayer


@kortexya/reasoninglayer / allen

allen(relation, intervalA, intervalBTermId): ConstraintInputDto

Defined in: src/builders/allen.ts:39

Create an Allen temporal constraint.

AllenRelation

One of the 13 Allen interval relations.

string

The first interval identifier (variable or feature path).

string

The term ID (UUID) containing the second interval.

ConstraintInputDto

A ConstraintInputDto of type Allen.

Serialization format: Tagged (ConstraintInputDto).

Produces the following JSON:

{
"type": "Allen",
"interval_a": "start_time",
"interval_b_term_id": "uuid",
"relation": "before"
}

The 13 Allen relations are: before, after, meets, met_by, overlaps, overlapped_by, during, contains, starts, started_by, finishes, finished_by, equals.

import { allen } from '@kortexya/reasoninglayer';
// Event A must happen before Event B:
const constraint = allen("before", "event_a_time", "event-b-term-uuid");
// Meeting must overlap with work hours:
const overlap = allen("overlaps", "meeting_time", "work-hours-term-uuid");