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

Forbid constant <op> constant comparisons for strings #229

Merged
merged 5 commits into from
Dec 23, 2019
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions optimade.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1258,16 +1258,22 @@ Numeric and String comparisons
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Comparisons involving Numeric and String properties can be expressed using the usual comparison operators: '<', '>', '<=', '>=', '=', '!='.
Implementations MUST support comparisons on the form::
Implementations MUST support comparisons in the forms::

identifier <operator> constant
constant <operator> identifier

Where 'identifier' is a property name and 'constant' is either a numerical or string type constant. However, implementations MAY OPTIONALLY support comparisons with identifiers also on both sides, and comparisons with values on both sides, i.e., on the forms::
Where :filter-fragment:`identifier` is a property name and :filter-fragment:`constant` is either a numerical or string type constant.

Implementations MAY also support comparisons with identifiers also on both sides, and comparisons with numerical type constants on both sides, i.e., in the forms::
rartino marked this conversation as resolved.
Show resolved Hide resolved

identifier <operator> identifier
constant <operator> constant

However, the latter form, :filter-fragment:`constant <operator> constant` where the constants are strings MUST return the error :http-error:`501 Not Implemented`.
The reason is that filter language strings can refer to data of different data types (e.g., strings and timestamps), and thus this construct is not unambigous.
rartino marked this conversation as resolved.
Show resolved Hide resolved
The OPTiMaDe specification will strive to address this issue in a future version.

Examples:

- :filter:`nelements > 3`
Expand Down