Skip to content

Commit

Permalink
Merge pull request #790 from pvretano/issue-788
Browse files Browse the repository at this point in the history
Change names of some "literal" production because they are not stricly literals.

Meeting 2023-03-13: Decision to merge.
  • Loading branch information
cportele committed Mar 13, 2023
2 parents 5bec8e3 + 6af6a09 commit fba9810
Show file tree
Hide file tree
Showing 15 changed files with 82 additions and 84 deletions.
12 changes: 6 additions & 6 deletions cql2/standard/clause_6_basic_cql2.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ encodings of CQL2.
A CQL2 filter expression is an expression that defines a logically connected
set of predicates that are evaluated for each item of a collection. Each
predicate is an operator with operands where the number of operands depends
on the operator. An operand is either a literal, a standardized or custom function
on the operator. An operand is either a literal, a property, a standardized or custom function
or an arithmetic expression.

A predicate is an expression that evaluates to the Boolean values of `TRUE`
Expand Down Expand Up @@ -80,11 +80,11 @@ specifying the requirements class.

The scalar data types are:

* "string": character strings (literal rule `characterLiteral`);
* "number": numbers including integers and floating point values (literal rule `numericLiteral`);
* "boolean": booleans (literal rule `booleanLiteral`);
* "timestamp": an instant with a granularity of a second or smaller (literal rule: `timestampLiteral`)
* "date": an instant with a granularity of a day (literal rule: `dateLiteral`)
* "string": character strings (rule `characterLiteral`);
* "number": numbers including integers and floating point values (rule `numericLiteral`);
* "boolean": booleans (rule `booleanLiteral`);
* "timestamp": an instant with a granularity of a second or smaller (rule `timestampInstant`)
* "date": an instant with a granularity of a day (rule `dateInstant`)

For character string, numeric and boolean literals, the standard representations are used. For character string literals, embeded quotes are escaped using two consecutive single quotes (i.e. `''`).

Expand Down
8 changes: 4 additions & 4 deletions cql2/standard/clause_7_enhanced.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ A _spatial predicate_ evaluates two geometry-valued expressions to determine if
[[basic-spatial-data-types]]
==== Basic spatial data types and literal values

The basic spatial data types are (part of rule `spatialLiteral`):
The basic spatial data types are (part of rule `spatialInstance`):

* "Point": a point;
* "BBox": a bounding rectangle or box.
Expand Down Expand Up @@ -454,11 +454,11 @@ A temporal predicate evaluates two time-valued expressions to determine, if the

The operands in a temporal predicate are temporal geometries. A temporal geometry is either an instant or an interval.

==== Temporal data types and literal values
==== Temporal data types and instances

An instant is either a date (rule `dateInstant`) or a timestamp (rule `timestampInstant`) in accordance with <<rfc3339,RFC 3339>> (RFC 3339 rules `full-date` or `date-time`). Note that since time is continuous, every instant has a duration and a start/end. Nevertheless, the geometry can be considered an instant in the temporal resolution that is applicable for the specific property.

An interval is the time between a start instant and an end instant, including both bounding instances (rule `intervalLiteral`). Unbounded interval ends are represented by a double-dot string ("..") based on the convention specified in ISO 8601-2.
An interval is the time between a start instant and an end instant, including both bounding instances (rule `intervalInstance`). Unbounded interval ends are represented by a double-dot string ("..") based on the convention specified in ISO 8601-2.

CQL2 follows ISO 8601-1/ISO 8601-2 in defining intervals as closed at both start and end. Note that some implementations and other specifications use a different definition and it may be necessary to convert between the interval representations. For example, SQL uses half-closed intervals - closed at the start, open at the end.

Expand Down Expand Up @@ -604,7 +604,7 @@ include::requirements/requirements_class_array-operators.adoc[]

This clause specifies requirements for supporting array expression in CQL2.

==== Arrays and literal values
==== Arrays

An array is a bracket-delimited, comma-separated list of array elements. An array element is either a scalar value,
a geometry, an interval, or another array.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
[width="90%",cols="2,6a"]
|===
^|*Permission {counter:per-id}* |*/per/advanced-comparison-operators/in-predicate*
^|A |The server MAY not support `characterLiteral`, `numericLiteral`, `booleanLiteral` or `instantLiteral` as the value to be tested (rule `scalarExpression`, i.e., the left hand side of the predicate).
^|A |The server MAY not support `characterLiteral`, `numericLiteral`, `booleanLiteral` or `instantInstance` as the value to be tested (rule `scalarExpression`, i.e., the left hand side of the predicate).
^|B |The server MAY not support `propertyName` as the items in the list of an in-list predicate (rule `inList`, i.e., the items on the right hand side of the predicate).
|===
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
[width="90%",cols="2,6a"]
|===
^|*Permission {counter:per-id}* |*/per/arrays/array-predicates*
^|A |The server MAY not support an `arrayLiteral` as the first operand (rule `arrayExpression`) in rule `arrayPredicate`.
^|A |The server MAY not support an `array` as the first operand (rule `arrayExpression`) in rule `arrayPredicate`.
^|B |The server MAY not support a `propertyName` as the second operand (rule `arrayExpression`) in rule `arrayPredicate`.
|===
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[width="90%",cols="2,6a"]
|===
^|*Permission {counter:per-id}* |*/per/basic-cql2/cql2-filter*
^|A |In the rule `binaryComparisonPredicate` the server MAY only support `propertyName` in the first `scalarExpression` rule as well as `characterLiteral`, `numericLiteral`, `booleanLiteral`, and `instantLiteral` in the second `scalarExpression` rule.
^|A |In the rule `binaryComparisonPredicate` the server MAY only support `propertyName` in the first `scalarExpression` rule as well as `characterLiteral`, `numericLiteral`, `booleanLiteral`, and `instantInstance` in the second `scalarExpression` rule.
^|B |In the rule `isNullPredicate` the server MAY only support `propertyName` in the `scalarExpression` rule.
|===

Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
[width="90%",cols="2,6a"]
|===
^|*Permission {counter:per-id}* |*/per/spatial-data-types*
^|A |The server MAY only support `pointTaggedText` and `bboxTaggedText` in rule `spatialLiteral`.
^|A |The server MAY only support `pointTaggedText` and `bboxTaggedText` in rule `spatialInstance`.
|===
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
[width="90%",cols="2,6a"]
|===
^|*Permission {counter:per-id}* |*/per/spatial-operators*
^|A |The server MAY not support a `spatialLiteral` as the first operand (rule `geomExpression`) in rule `spatialPredicate`.
^|A |The server MAY not support a `spatialInstance` as the first operand (rule `geomExpression`) in rule `spatialPredicate`.
^|B |The server MAY not support a `propertyName` as the second operand (rule `geomExpression`) in rule `spatialPredicate`.
|===
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
^|A |The server MAY not support

* the schema component "#/$defs/propertyRef" in an operand of a comparison operator, standardized spatial, temporal or array comparison functions starting with the second operand,
* the schema components "\#/$defs/scalarLiteral", "#/$defs/spatialLiteral", "\#/$defs/temporalLiteral" or "#/$defs/arrayLiteral" in the first operand of a comparison operator, standardized spatial, temporal or array comparison function.
* the schema components "\#/$defs/scalarLiteral", "#/$defs/spatialInstance", "\#/$defs/temporalInstance" or "#/$defs/array" in the first operand of a comparison operator, standardized spatial, temporal or array comparison function.
|===
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
[width="90%",cols="2,6a"]
|===
^|*Permission {counter:per-id}* |*/per/temporal-operators/temporal-operators*
^|A |The server MAY not support a `temporalLiteral` as the first operand (rule `temporalExpression`) in rule `temporalPredicate`.
^|A |The server MAY not support a `temporalInstance` as the first operand (rule `temporalExpression`) in rule `temporalPredicate`.
^|B |The server MAY not support a `propertyName` as the second operand (rule `temporalExpression`) in rule `temporalPredicate`.
|===
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
^|A |The server SHALL be able to parse and evaluate filter expressions encoded as JSON that use the following schema components:

* "#/$defs/spatialPredicate" where property "op" has the value "s_intersects"
* "#/$defs/spatialLiteral" where the value is either "#/$defs/point" or "#/$defs/bboxLiteral"
* "#/$defs/spatialInstance" where the value is either "#/$defs/point" or "#/$defs/bboxLiteral"
|===
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
^|A |In addition to the <<req_cql2-json_basic-cql2,Basic CQL2>> requirement, the server SHALL be able to parse and evaluate filter expressions encoded as JSON that use

* the schema component "#/$defs/propertyRef" in an operand of a comparison operator, standardized spatial, temporal or array comparison function starting with the second operand,
* the schema components "\#/$defs/scalarLiteral", "#/$defs/spatialLiteral", "\#/$defs/temporalLiteral" or "#/$defs/arrayLiteral" in the first operand of a comparison operator, standardized spatial, temporal or array comparison function.
* the schema components "\#/$defs/scalarLiteral", "#/$defs/spatialInstance", "\#/$defs/temporalInstance" or "#/$defs/array" in the first operand of a comparison operator, standardized spatial, temporal or array comparison function.
|===
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
[width="90%",cols="2,6a"]
|===
^|*Requirement {counter:req-id}* |*/req/spatial-operators/spatial-data-types*
^|A |The server SHALL support all spatial literals as defined by the BNF rule `spatialLiteral` in <<cql2-bnf>>.
^|A |The server SHALL support all spatial literals as defined by the BNF rule `spatialInstance` in <<cql2-bnf>>.
|===
56 changes: 27 additions & 29 deletions cql2/standard/schema/cql2.bnf
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ binaryComparisonPredicate = scalarExpression

scalarExpression = characterClause
| numericLiteral
| instantLiteral
| instantInstance
| arithmeticExpression
| booleanExpression
| propertyName
Expand Down Expand Up @@ -95,8 +95,8 @@ isNullPredicate = isNullOperand "IS" ["NOT"] "NULL";

isNullOperand = characterClause
| numericLiteral
| temporalLiteral
| spatialLiteral
| temporalInstance
| spatialInstance
| arithmeticExpression
| booleanExpression
| propertyName
Expand Down Expand Up @@ -127,7 +127,7 @@ spatialFunction = "S_INTERSECTS"
# a geometric literal (expressed as WKT) or a function that returns a
# geometric value.
#
geomExpression = spatialLiteral
geomExpression = spatialInstance
| propertyName
| function;

Expand All @@ -140,7 +140,7 @@ geomExpression = spatialLiteral
temporalPredicate = temporalFunction
"(" temporalExpression "," temporalExpression ")";

temporalExpression = temporalLiteral
temporalExpression = temporalInstance
| propertyName
| function;

Expand Down Expand Up @@ -169,23 +169,23 @@ temporalFunction = "T_AFTER"
arrayPredicate = arrayFunction
"(" arrayExpression "," arrayExpression ")";

arrayExpression = arrayLiteral
arrayExpression = array
| propertyName
| function;

# An array literal is a bracket-delimited, comma-separated list of array
# An array literal is a parentheses-delimited, comma-separated list of array
# elements.
arrayLiteral = "(" ")"
| "(" arrayElement [ { "," arrayElement } ] ")";

# An array element is either a character literal, a numeric literal,
# a geometric literal, a temporal literal, a property name, a function, an
# arithmetic expression or an array.
# a geometric literal, a temporal instance, a property name, a function,
# an arithmetic expression or an array.
arrayElement = characterClause
| numericLiteral
| temporalLiteral
| spatialLiteral
| arrayLiteral
| temporalInstance
| spatialInstance
| array
| arithmeticExpression
| booleanExpression
| propertyName
Expand Down Expand Up @@ -345,9 +345,9 @@ argumentList = argument [ { "," argument } ];

argument = characterClause
| numericLiteral
| temporalLiteral
| spatialLiteral
| arrayLiteral
| temporalInstance
| spatialInstance
| array
| arithmeticExpression
| booleanExpression
| propertyName
Expand Down Expand Up @@ -468,14 +468,14 @@ booleanLiteral = "TRUE" | "FALSE";
# NOTE: This is basically BNF that define WKT encoding. It would be nice
# to instead reference some normative BNF for WKT.
#=============================================================================#
spatialLiteral = pointTaggedText
| linestringTaggedText
| polygonTaggedText
| multipointTaggedText
| multilinestringTaggedText
| multipolygonTaggedText
| geometryCollectionTaggedText
| bboxTaggedText;
spatialInstance = pointTaggedText
| linestringTaggedText
| polygonTaggedText
| multipointTaggedText
| multilinestringTaggedText
| multipolygonTaggedText
| geometryCollectionTaggedText
| bboxTaggedText;

pointTaggedText = "POINT" pointText;

Expand Down Expand Up @@ -511,8 +511,7 @@ multiLineStringText = "(" lineStringText {"," lineStringText} ")";

multiPolygonText = "(" polygonText {"," polygonText} ")";

geometryCollectionText = "("
spatialLiteral {"," spatialLiteral} ")";
geometryCollectionText = "(" spatialLiteral {"," spatialLiteral} ")";

bboxTaggedText = "BBOX" bboxText;

Expand All @@ -530,9 +529,9 @@ minElev = signedNumericLiteral;

maxElev = signedNumericLiteral;

temporalLiteral = instantLiteral | intervalLiteral;
temporalInstance = instantInstance | intervalInstance;

instantLiteral = dateInstant | timestampInstant;
instantInstance = dateInstant | timestampInstant;

dateInstant = "DATE"
"(" dateInstantString ")";
Expand All @@ -544,8 +543,7 @@ timestampInstant = "TIMESTAMP"

timestampInstantString = "'" fullDate "T" utcTime "'";

intervalLiteral = "INTERVAL"
"(" instantParameter "," instantParameter ")";
intervalLiteral = "INTERVAL" "(" instantParameter "," instantParameter ")";

instantParameter = dateInstantString
| timestampInstantString
Expand Down
Loading

0 comments on commit fba9810

Please sign in to comment.