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

Filter Extension - add Accent and Case-insensitive Comparison conform… #235

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v1.0.0-rc.1] - TBD

### Added

- The CQL2 Accent and Case-insensitive Comparison
(`http://www.opengis.net/spec/cql2/1.0/conf/accent-case-insensitive-comparison`) conformance class
adds the ACCENTI and CASEI functions for case-insensitive comparison. These replace the UPPER and
LOWER psuedo-functions that were previously part of the Advanced Comparison Operators class.

### Changed

### Deprecated

### Removed

### Fixed

## [v1.0.0-beta.5] - 2022-01-14

### Added
Expand Down
1 change: 1 addition & 0 deletions extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ the service supports. This are listed at the top of each extension description,
- <http://www.opengis.net/spec/cql2/1.0/conf/arithmetic>
- <http://www.opengis.net/spec/cql2/1.0/conf/array-operators>
- <http://www.opengis.net/spec/cql2/1.0/conf/property-property>
- <http://www.opengis.net/spec/cql2/1.0/conf/accent-case-insensitive-comparison>
- [Context](item-search/README.md#context-extension)
- <https://api.stacspec.org/v1.0.0-beta.5/item-search#context>
- <https://api.stacspec.org/v1.0.0-beta.5/ogcapi-features#context>
Expand Down
79 changes: 67 additions & 12 deletions fragments/filter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- Arithmetic Expressions: <http://www.opengis.net/spec/cql2/1.0/conf/arithmetic>
- Array Operators: <http://www.opengis.net/spec/cql2/1.0/conf/array-operators>
- Property-Property Comparisons: <http://www.opengis.net/spec/cql2/1.0/conf/property-property>
- Accent and Case-insensitive Comparison: <http://www.opengis.net/spec/cql2/1.0/conf/accent-case-insensitive-comparison>
- **Extension [Maturity Classification](../../README.md#maturity-classification):** Pilot
- **Dependents:**
- [Item Search](../../item-search)
Expand Down Expand Up @@ -62,6 +63,12 @@
- [Example 11: Using LIKE](#example-11-using-like)
- [Example 11: cql2-text (GET)](#example-11-cql2-text-get)
- [Example 11: cql2-json (POST)](#example-11-cql2-json-post)
- [Example 12: Using the CASEI Case-insensitive Comparison Function](#example-12-using-the-casei-case-insensitive-comparison-function)
- [Example 12: cql2-text (GET)](#example-12-cql2-text-get)
- [Example 12: cql2-json (POST)](#example-12-cql2-json-post)
- [Example 13: Using the ACCENTI Accent-insensitive Comparison Function](#example-13-using-the-accenti-accent-insensitive-comparison-function)
- [Example 13: cql2-text (GET)](#example-13-cql2-text-get)
- [Example 13: cql2-json (POST)](#example-13-cql2-json-post)

## Overview

Expand Down Expand Up @@ -187,8 +194,10 @@ For additional capabilities, the following classes can be implemented:
defines array operators (`A_EQUALS`, `A_CONTAINS`, `A_CONTAINED_BY`, and `A_OVERLAPS`).
- Property-Property Comparisons: (`http://www.opengis.net/spec/cql2/1.0/conf/property-property`)
allows the use of queryables (e.g., properties) in both positions of a clause, not just in the
first position. This allows predicates like `property1 == property2` be expressed, whereas the
first position. This allows predicates like `property1 = property2` be expressed, whereas the
Basic CQL2 conformance class only requires comparisons against right-hand-side literals.
- Accent and Case-insensitive Comparison: (`http://www.opengis.net/spec/cql2/1.0/conf/accent-case-insensitive-comparison`)
defines the UPPER and LOWER functions that can be used for case-insensitive comparison.

Additionally, if an API implements the OGC API Features endpoint, it is **recommended** that the OAFeat Part 3 Filter,
Features Filter, and Basic CQL2 conformance classes be implemented, which allow use of CQL2 filters against the
Expand Down Expand Up @@ -985,18 +994,23 @@ filter=mission LIKE 'sentinel%'
}
```

<!-- ### Example 12: Using Case-insensitive Comparison Functions
### Example 12: Using the CASEI Case-insensitive Comparison Function

The predefined function `CASEI` allows for case-insensitive comparisons.
The predefined function `CASEI` allows for case-insensitive comparisons. This function is
defined in the Accent and Case-insensitive Comparison conformance class.

In the example using 'Straße', both the capitalized 'S' and Eszett ('ß') are converted to an
insensitive representation whereby the expressions `CASEI('Straße')`, `CASEI('straße')`,
`CASEI('Strasse')`, and `CASEI('strasse')` are all equal.

#### Example 12: cql2-text (GET)

```http
filter=CASEI(provider) = 'coolsat'
filter=CASEI(provider) = CASEI('coolsat')
```

```http
filter=CASEI(provider) = 'NASA'
filter=CASEI(provider) = CASEI('Straße')
```

#### Example 12: cql2-json (POST)
Expand All @@ -1007,10 +1021,14 @@ filter=CASEI(provider) = 'NASA'
"filter": {
"op": "=",
"args": [
{
"lower" : { "property": "provider" }
{
"function" : "casei",
"args" : [ { "property": "provider" } ]
},
"coolsat"
{
"function" : "casei",
"args" : [ "coolsat" ]
}
]
}
}
Expand All @@ -1022,11 +1040,48 @@ filter=CASEI(provider) = 'NASA'
"filter": {
"op": "=",
"args": [
{
"upper": { "property": "provider" }
{
"function" : "casei",
"args" : [ { "property": "provider" } ]
},
{
"function" : "casei",
"args" : [ "Straße" ]
}
]
}
}
```

### Example 13: Using the ACCENTI Accent-insensitive Comparison Function

The predefined function `ACCENTI` allows for accent-insensitive comparisons. This function is
defined in the Accent and Case-insensitive Comparison conformance class. In the example below,
`ACCENTI('tiburon')` and `ACCENTI('tiburón')` evaluate to be equal.

#### Example 13: cql2-text (GET)

```http
filter=ACCENTI(provider) = ACCENTI('tiburón')
philvarner marked this conversation as resolved.
Show resolved Hide resolved
```

#### Example 13: cql2-json (POST)

```json
{
"filter-lang": "cql2-json",
"filter": {
"op": "=",
"args": [
{
"function" : "accenti",
"args" : [ { "property": "provider" } ]
},
"NASA"
{
"function" : "accenti",
"args" : [ "tiburón" ]
}
]
}
}
``` -->
```