Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change of terminology and consequently of API #50

Closed
estebanzimanyi opened this issue Feb 7, 2021 · 1 comment
Closed

Change of terminology and consequently of API #50

estebanzimanyi opened this issue Feb 7, 2021 · 1 comment

Comments

@estebanzimanyi
Copy link
Member

estebanzimanyi commented Feb 7, 2021

Overview

Currently, MobilityDB uses the term duration to refer to the "temporal type", which can be 'Instant', 'InstantSet', 'Sequence', 'SequenceSet'. This is not in accordance with the equivalent functionality in PostGIS which provides the function GeometryType to determine the type of a geometry as text, such as 'POINT', 'LINESTRING', etc. This prevents the use of "duration" for the usual meaning, e.g., as defined by the Cambridge dictionary:

the length of time that something lasts. He planned a stay of two years’ duration.

For this reason, currently MobilityDB provides a function timespan which correspond to the duration in the dictionary sense described above. Examples of usage are as follows

select timespan('{[2000-01-01 08:00, 2000-01-01 08:20], [2000-01-01 08:30, 2000-01-01 08:40]}'::periodset);
-- 00:30:00
select timespan('{[1@2000-01-01 08:00, 5@2000-01-01 08:20], [5@2000-01-01 08:30, 1@2000-01-01 08:40]}'::tfloat);
-- 00:30:00

However, there are two possible interpretations of such a function depending on whether the time gaps are included or not in the calculation.

Proposed solution

The proposed solution would be as follows

  • Use the function temporalType for obtaining the temporal type, which is one of 'Instant', 'InstantSet', 'Sequence', 'SequenceSet'.
  • Use the function duration for obtaining the duration without taking time gaps into consideration
  • Use the function timespan for obtaining the duration taking time gaps into consideration

The proposed change in API would then be as follows

select temporalType('{[1@2000-01-01 08:00, 5@2000-01-01 08:20], [5@2000-01-01 08:30, 1@2000-01-01 08:40]}'::tfloat);
-- 'SequenceSet'

select duration('{[2000-01-01 08:00, 2000-01-01 08:20], [2000-01-01 08:30, 2000-01-01 08:40]}'::periodset);
-- 00:30:00
select duration('{[1@2000-01-01 08:00, 5@2000-01-01 08:20], [5@2000-01-01 08:30, 1@2000-01-01 08:40]}'::tfloat);
-- 00:30:00

select timespan('{[2000-01-01 08:00, 2000-01-01 08:20], [2000-01-01 08:30, 2000-01-01 08:40]}'::periodset);
-- 00:40:00
select timespan('{[1@2000-01-01 08:00, 5@2000-01-01 08:20], [5@2000-01-01 08:30, 1@2000-01-01 08:40]}'::tfloat);
-- 00:40:00
estebanzimanyi added a commit to estebanzimanyi/MobilityDB that referenced this issue Feb 7, 2021
estebanzimanyi added a commit to estebanzimanyi/MobilityDB that referenced this issue Feb 7, 2021
estebanzimanyi added a commit to estebanzimanyi/MobilityDB that referenced this issue Feb 7, 2021
estebanzimanyi added a commit to estebanzimanyi/MobilityDB that referenced this issue Feb 7, 2021
mahmsakr added a commit that referenced this issue Feb 15, 2021
estebanzimanyi added a commit to estebanzimanyi/MobilityDB that referenced this issue Feb 22, 2021
mschoema added a commit that referenced this issue Feb 23, 2021
Implement duration and timespan functions wrt Issue #50
@mschoema
Copy link
Member

Solved in Pull Request #54

estebanzimanyi added a commit to estebanzimanyi/MobilityDB that referenced this issue Feb 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants