# Interval

Temporal reasoning functions based on Allen’s interval algebra

## after(A, B)

evaluates A and B and return true when A is after B, false otherwise.

Parameters
Name Required Type Description

A

Yes

Interval | Point

B

Yes

Interval | Point

 Boolean
Examples
``````after( 10, 1 ) => true

after( 1, [1..10] ) => false

after( [1..10], [15..20] ) => false

after( [date and time("2017‐09‐23T21:15:00")..date and time("2018‐04‐11T09:55:00")], date and time("2016‐05‐21T19:45:00")) => true``````

## before(A, B)

evaluates A and B and return true when A is before B, false otherwise.

Parameters
Name Required Type Description

A

Yes

Interval | Point

B

Yes

Interval | Point

 Boolean
Examples
``````before( 10, 1 ) => false

before( 1, [2..10] ) => true

before( [1..10], [15..20] ) => true

before( date and time("2017‐11‐24T23:45:00"), [date and time("2018‐09‐23T21:15:00")..date and time("2019‐04‐11T09:55:00")]) => true``````

## coincides(A, B)

evaluates A and B and return true when A coincides B, false otherwise.

Parameters
Name Required Type Description

A

Yes

Interval | Point

B

Yes

Interval | Point

 Boolean
Examples
``````coincides( 5, 5 ) => true

coincides( 3, 4 ) => false

coincides( [1..5], [1..5] ) => true

coincides( [date("2017‐09‐23")..date("2018‐04‐11")], [date("2017‐09‐23")..date("2018‐04‐11")] ) => true``````

## during(A, B)

evaluates A and B and return true when A is during B, false otherwise.

Parameters
Name Required Type Description

A

Yes

Interval | Point

B

Yes

Interval

 Boolean
Examples
``````during( 5, [1..10] ) => true

during( 12, [1..10] ) => false

during( [4..6], [1..10] ) => true

during( time("15:15:00"), [time("10:25:00")..time("23:42:00")] ) => true``````

## finished by(A, B)

evaluates A and B and return true when A is finished by B, false otherwise.

Parameters
Name Required Type Description

A

Yes

Interval

B

Yes

Interval | Point

 Boolean
Examples
``````finished by( [1..10], 10 ) => true

finished by( [1..10], [5..10] ) => true

finished by( [1..10], [1..10] ) => true

finished by( [time("10:11:00")..time("15:15:00")], time("15:15:00") ) => true``````

## finishes(A, B)

evaluates A and B and return true when A finishes B, false otherwise.

Parameters
Name Required Type Description

A

Yes

Interval | Point

B

Yes

Interval

 Boolean
Examples
``````finishes( 10, [1..10] ) => true

finishes( [5..10], [1..10] ) => true

finishes( [1..10], [1..10] ) => true

finishes( [time("10:11:00")..time("15:15:00")], (time("08:23:00")..time("15:15:00")]) => true``````

## includes(A, B)

evaluates A and B and return true when A includes B, false otherwise.

Parameters
Name Required Type Description

A

Yes

Interval

B

Yes

Interval | Point

 Boolean
Examples
``````includes( [1..10], 5 ) => true

includes( [1..10], 12 ) => false

includes( [1..10], [4..6] ) => true

includes( [date and time("2018‐04‐11T09:55:00")..date and time("2019‐04‐11T18:55:00")], date and time("2018‐11‐11T08:25:00") ) => true``````

## meets(A, B)

evaluates A and B and return true when A meets B, false otherwise.

Parameters
Name Required Type Description

A

Yes

Interval

B

Yes

Interval

 Boolean
Examples
``````meets( [1..5], [5..10] ) => true

meets( [1..5], [7..10] ) => false

meets( [1..5], [6..10] ) => false

meets( [time("10:15:00")..time("15:15:00")], [time("15:15:00")..time("22:05:00")] ) => true``````

## met by(A, B)

evaluates A and B and return true when A is met by B, false otherwise.

Parameters
Name Required Type Description

A

Yes

Interval

B

Yes

Interval

 Boolean
Examples
``````met by( [5..10], [1..5] ) => true

met by( [7..10], [1..5] ) => false

met by( [6..10], [1..6] ) => true

met by( [date and time("2018‐04‐11T09:55:00")..date and time("2018‐08‐15T07:45:00")], [date and time("2017‐09‐23T21:15:00")..date and time("2018‐04‐11T09:55:00")] ) => true``````

## overlaps(A, B)

evaluates A and B and return true when they overlap, false otherwise.

Parameters
Name Required Type Description

A

Yes

Interval

B

Yes

Interval

 Boolean
Examples
``````overlaps( [1..5], [4..8] ) => true

overlaps( [1..5], [7..9] ) => false

overlaps( [date("2012-12-25")..date("2013-09-18")], [date("2013-04-25")..date("2018-05-30")] ) => true``````

## overlaps after(A, B)

evaluates A and B and return true when they overlap and A is after B, false otherwise.

Parameters
Name Required Type Description

A

Yes

Interval

B

Yes

Interval

 Boolean
Examples
``````overlaps after( [3..8], [1..5] ) => true

overlaps after( [1..5], [5..8]) => false

overlaps after( (1..5], [1..5] ) => true

overlaps after( [date("2017‐12‐25")..date("2019‐07‐21")], [date("2017‐09‐23")..date("2018‐04‐11")]) => true``````

## overlaps before(A, B)

evaluates A and B and return true when they overlap and A is before B, false otherwise.

Parameters
Name Required Type Description

A

Yes

Interval

B

Yes

Interval

 Boolean
Examples
``````overlaps before( [1..5], [3..8] ) => true

overlaps before( [1..5], [5..8] ) => true

overlaps before( [5..10], [1..5] ) => false

overlaps before( [date("2017‐09‐23")..date("2018‐04‐11")], [date("2017‐12‐25")..date("2019‐07‐21")] ) => true``````

## started by(A, B)

evaluates A and B and return true when A is started by B, false otherwise.

Parameters
Name Required Type Description

A

Yes

Interval

B

Yes

Interval | Point

 Boolean
Examples
``````started by( [1..10], 1 ) => true

started by( (1..10], [1..5] ) => true

started by( [1..10], [4..6] ) => false

started by( [date and time("2018‐04‐11T09:55:00")..date and time("2019‐04‐11T18:55:00")], date and time("2018‐04‐11T09:55:00") ) => true``````

## starts(A, B)

evaluates A and B and return true when A starts B, false otherwise.

Parameters
Name Required Type Description

A

Yes

Interval | Point

B

Yes

Interval

 Boolean
Examples
``````starts( 1, [1..10] ) => true

starts( [1..5], [1..10] ) => true

starts( [4..6], [1..10] ) => false

starts( [date("2017‐09‐23")..date("2018‐04‐11")], [date("2017‐09‐23")..date("2019‐07‐21")] ) => true``````