Skip to content

Commit

Permalink
update temporal literals
Browse files Browse the repository at this point in the history
closes #483
closes #546
  • Loading branch information
cportele committed Jul 19, 2021
1 parent bf45981 commit 0b7e5fd
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 40 deletions.
2 changes: 2 additions & 0 deletions extensions/cql/standard/annex_bibliography.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@
* [[ogc-link-relations]] Open Geospatial Consortium (OGC). **OGC Link Relation Type Register** [online, viewed 2021-06-10], Available at http://www.opengis.net/def/rel
* [[OpenAPI]] OpenAPI Initiative (OAI). **OpenAPI Specification 3.0** [online]. 2020 [viewed 2020-03-16]. The latest patch version at the time of publication of this standard was 3.0.3, available at http://spec.openapis.org/oas/v3.0.3
* [[rfc3986]] Internet Engineering Task Force (IETF). RFC 3986: **Uniform Resource Identifier (URI): Generic Syntax** [online]. Edited by T. Berners-Lee, R. Fielding, L. Masinter. [viewed 2020-03-16]. Available at http://tools.ietf.org/rfc/rfc3986.txt
* [[iso8601-1]] ISO 8601-1:2019, **Date and time — Representations for information interchange — Part 1: Basic rules**
* [[iso8601-2]] ISO 8601-2:2019, **Date and time — Representations for information interchange — Part 2: Extensions**
4 changes: 0 additions & 4 deletions extensions/cql/standard/clause_3_references.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,5 @@ The following normative documents contain provisions that, through reference in
* [[rfc3339]] Internet Engineering Task Force (IETF). RFC 3339: **Date and Time on the Internet: Timestamps** [online]. Edited by G. Klyne, C. Newman. 2002 [viewed 2020-03-16]. Available at http://tools.ietf.org/rfc/rfc3339.txt
* [[iso8601-1]] ISO 8601-1:2019, **Date and time — Representations for information interchange — Part 1: Basic rules**
* [[iso8601-2]] ISO 8601-2:2019, **Date and time — Representations for information interchange — Part 2: Extensions**
* [[json-schema]] Internet Engineering Task Force (IETF). draft-handrews-json-schema-02: **JSON Schema: A Media Type for Describing JSON Documents** [online]. Edited by A. Wright, H. Andrews, B. Hutton, G. Dennis. 2019 [viewed 2020-11-22]. Available at https://tools.ietf.org/id/draft-handrews-json-schema-02.txt
34 changes: 17 additions & 17 deletions extensions/cql/standard/clause_8_simple_cql.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -111,43 +111,43 @@ POLYGON((43.5845 -79.5442, 43.6079 -79.4893, 43.5677 -79.4632, 43.6129 -79.3925,
----
* temporal geometry (instants, text)
----
1969-07-20
1969-07-20T20:17:40Z
DATE("1969-07-20")
TIMESTAMP("1969-07-20T20:17:40Z")
----
* temporal geometry (instants, JSON)
[source,JSON]
----
"1969-07-20"
"1969-07-20T20:17:40Z"
{ "date": "1969-07-20" }
{ "timestamp": "1969-07-20T20:17:40Z" }
----
* temporal geometry (intervals, text)
----
1969-07-16/1969-07-24
1969-07-16T05:32:00Z/1969-07-24T16:50:35Z
2019-09-09/..
INTERVAL("1969-07-16", "1969-07-24")
INTERVAL("1969-07-16T05:32:00Z", "1969-07-24T16:50:35Z")
INTERVAL("2019-09-09", "..")
----
* temporal geometry (intervals, JSON)
[source,JSON]
----
[ "1969-07-16", "1969-07-24" ]
[ "1969-07-16T05:32:00Z", "1969-07-24T16:50:35Z" ]
[ "2019-09-09", ".." ]
{ "interval": [ "1969-07-16", "1969-07-24" ] }
{ "interval": [ "1969-07-16T05:32:00Z", "1969-07-24T16:50:35Z" ] }
{ "interval": [ "2019-09-09", ".." ] }
----
====

For spatial and temporal geometries existing representations are used:

* Spatial geometry:
* Text: an OGC Well-Known Text (WKT) literal
* JSON: a GeoJSON geometry object
** Text: an OGC Well-Known Text (WKT) literal
** JSON: a GeoJSON geometry object
* Temporal instant:
* Text: an RFC 3339 literal
* JSON: a string of a RFC 3339 literal
** Text: a `DATE` or `TIMESTAMP` function with a RFC 3339 literal string
** JSON: an object with a `date` or `timestamp` member with a RFC 3339 literal string value
* Temporal interval:
* Text: an ISO 8601-2 interval literal
* JSON: an array from an ISO 8601-2 interval literal that is split at the solidus
** Text: an `INTERVAL` function with two temporal instants as parameters
** JSON: an object with an `interval` member with an array of RFC 3339 literal string values (or ".." for an open end)

NOTE: The current BNF rule for temporal literals supports timestamps in any time zone. Should this be restricted to UTC ("Z"), at least in Simple CQL? See https://github.com/opengeospatial/ogcapi-features/issues/483[issue 483].
All temporal literals are in UTC ("Z").

[[simple-cql_property]]
=== Property references
Expand Down
16 changes: 8 additions & 8 deletions extensions/cql/standard/clause_9_enhanced.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -271,15 +271,15 @@ include::requirements/temporal-operators/REQ_temporal-operators.adoc[]
.Examples of temporal predicate using T_INTERSECTS
====
----
event_date T_INTERSECTS 1969-07-16T05:32:00Z/1969-07-24T16:50:35Z
T_INTERSECTS(event_date, INTERVAL("1969-07-16T05:32:00Z", "1969-07-24T16:50:35Z"))
----
[source,JSON]
----
{
"t_intersects": [
{ "property": "event_date" },
[ "1969-07-16T05:32:00Z", "1969-07-24T16:50:35Z" ]
{ "interval": [ "1969-07-16T05:32:00Z", "1969-07-24T16:50:35Z" ] }
]
}
----
Expand All @@ -289,14 +289,14 @@ event_date T_INTERSECTS 1969-07-16T05:32:00Z/1969-07-24T16:50:35Z
.Examples of temporal relationships using temporal literals.
====
----
1969-07-20T20:17:40Z T_DURING 1969-07-16T13:32:00Z/1969-07-24T16:50:35Z
T_DURING(DATE("1969-07-20T20:17:40Z"), INTERVAL("1969-07-16T13:32:00Z", "1969-07-24T16:50:35Z"))
----
[source,JSON]
----
{
"t_during": ["1969-07-20T20:17:40Z",["1969-07-16T13:32:00Z",
"1969-07-24T16:50:35Z"]]
"t_during": [ { "timestamp": "1969-07-20T20:17:40Z" },
{ "interval": ["1969-07-16T13:32:00Z", "1969-07-24T16:50:35Z"] } ]
}
----
====
Expand All @@ -305,14 +305,14 @@ event_date T_INTERSECTS 1969-07-16T05:32:00Z/1969-07-24T16:50:35Z
.Examples of temporal relationships using a property and a temporal literal.
====
----
touchdown T_DURING 1969-07-16T13:32:00Z/1969-07-24T16:50:35Z
T_DURING(touchdown, INTERVAL("1969-07-16T13:32:00Z", "1969-07-24T16:50:35Z"))
----
[source,JSON]
----
{
"t_during": [{"property": "touchdown"},["1969-07-16T13:32:00Z",
"1969-07-24T16:50:35Z"]]
"t_during": [ {"property": "touchdown"},
{"interval": [ "1969-07-16T13:32:00Z", "1969-07-24T16:50:35Z"] } ]
}
----
====
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,5 @@
|Dependency |<<ogc06-103r4,OGC Simple feature access - Part 1: Common architecture, Architecture>>
|Dependency |<<owl-time,W3C/OGC Time Ontology in OWL>>
|Dependency |<<rfc3339,RFC 3339 (Date and Time on the Internet: Timestamps)>>
|Dependency |<<iso8601-1,ISO 8601-1, Time interval>>
|Dependency |<<iso8601-2,ISO 8601-2, Extended time interval representations>>
|Dependency |<<json-schema,JSON Schema: A Media Type for Describing JSON Documents>>
|===
10 changes: 1 addition & 9 deletions extensions/cql/standard/schema/cql.bnf
Original file line number Diff line number Diff line change
Expand Up @@ -505,12 +505,6 @@ minElev = signedNumericLiteral;

maxElev = signedNumericLiteral;

#=============================================================================#
# Definition of TEMPORAL literals
#
# NOTE: Is the fact the time zones are supported too complicated for a
# simple CQL? Perhaps the "core" of CQL should just support UTC.
#=============================================================================#
temporalLiteral = instantLiteral | intervalLiteral;

instantLiteral = dateInstant | timestampInstant;
Expand Down Expand Up @@ -545,9 +539,7 @@ dateMonth = digit digit;

dateDay = digit digit;

utcTime = timeHour ":" timeMinute ":" timeSecond [timeZoneOffset];

timeZoneOffset = "Z" | sign timeHour [[colon] timeMinute];
utcTime = timeHour ":" timeMinute ":" timeSecond "Z";

timeHour = digit digit;

Expand Down

0 comments on commit 0b7e5fd

Please sign in to comment.