Skip to content

Commit 6f733e1

Browse files
committed
normalize CQL text support to CQL2 (#2015)
1 parent 1eb24cb commit 6f733e1

File tree

8 files changed

+23
-23
lines changed

8 files changed

+23
-23
lines changed

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def __getattr__(cls, name):
9393
# You can specify multiple suffix as a list of string:
9494
#
9595
# source_suffix = ['.rst', '.md']
96-
source_suffix = '.rst'
96+
source_suffix = {'.rst': 'restructuredtext'}
9797

9898
# The master toctree document.
9999
master_doc = 'index'

docs/source/cql.rst renamed to docs/source/cql2.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
.. _cql:
1+
.. _cql2:
22

3-
CQL support
4-
===========
3+
CQL2 support
4+
============
55

6-
OGC Common Query Language (`CQL2`_) is a generic language designed to provide enhanced query and subset/filtering to (primarily) feature and record data.
6+
`OGC Common Query Language`_ (CQL2) is a generic language designed to provide enhanced query and subset/filtering to (primarily) feature and record data.
77

88
Providers
99
---------
@@ -14,7 +14,7 @@ for current provider support.
1414
Limitations
1515
-----------
1616

17-
Support of CQL is limited to `Basic CQL2 <https://docs.ogc.org/is/21-065r2/21-065r2.html#cql2-core>`_ and thus it allows to query with the
17+
Support is limited to `Basic CQL2 <https://docs.ogc.org/is/21-065r2/21-065r2.html#cql2-core>`_ and thus it allows to query with the
1818
following predicates:
1919

2020
* comparison predicates
@@ -24,9 +24,9 @@ following predicates:
2424
Formats
2525
-------
2626

27-
Supported providers leverage the CQL2 dialect with the JSON encoding `CQL-JSON <https://docs.ogc.org/is/21-065r2/21-065r2.html#cql2-json>`_.
27+
Supported providers leverage the CQL2 dialect with the JSON encoding `CQL JSON <https://docs.ogc.org/is/21-065r2/21-065r2.html#cql2-json>`_.
2828

29-
PostgreSQL supports both `CQL2 JSON <https://docs.ogc.org/is/21-065r2/21-065r2.html#cql2-json>`_ and `CQL text <https://docs.ogc.org/is/21-065r2/21-065r2.html#cql2-text>`_ dialects.
29+
PostgreSQL supports both `CQL JSON <https://docs.ogc.org/is/21-065r2/21-065r2.html#cql2-json>`_ and `CQL Text <https://docs.ogc.org/is/21-065r2/21-065r2.html#cql2-text>`_ dialects.
3030

3131
Queries
3232
^^^^^^^
@@ -83,7 +83,7 @@ Or
8383
]
8484
}'
8585
86-
The same ``BETWEEN`` query using HTTP GET request formatted as CQL text and URL encoded as below:
86+
The same ``BETWEEN`` query using HTTP GET request formatted as CQL2 text and URL encoded as below:
8787

8888
.. code-block:: bash
8989
@@ -103,7 +103,7 @@ An ``EQUALS`` example for a specific property:
103103
]
104104
}'
105105
106-
A ``CROSSES`` example via an HTTP GET request. The CQL text is passed via the ``filter`` parameter.
106+
A ``CROSSES`` example via an HTTP GET request. The CQL2 text is passed via the ``filter`` parameter.
107107

108108
.. code-block:: bash
109109
@@ -122,6 +122,6 @@ The same example, but this time providing a geometry in EWKT format:
122122
123123
curl "http://localhost:5000/collections/beni/items?filter=DWITHIN(geometry,SRID=3857;POINT(1392921%205145517),100,meters)"
124124
125-
Note that the CQL text has been URL encoded. This is required in curl commands but when entering in a browser, plain text can be used e.g. ``CROSSES(foo_geom, LINESTRING(28 -2, 30 -4))``.
125+
Note that the CQL2 text has been URL encoded. This is required in curl commands but when entering in a browser, plain text can be used e.g. ``CROSSES(foo_geom, LINESTRING(28 -2, 30 -4))``.
126126

127-
.. _`CQL2`: https://docs.ogc.org/is/21-065r2/21-065r2.html
127+
.. _`OGC Common Query Language`: https://docs.ogc.org/is/21-065r2/21-065r2.html

docs/source/data-publishing/ogcapi-features.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ To publish an Elasticsearch index, the following are required in your index:
112112
The ES provider also has the support for the CQL queries as indicated in the table above.
113113

114114
.. seealso::
115-
:ref:`cql` for more details on how to use Common Query Language (CQL) to filter the collection with specific queries.
115+
:ref:`cql2` for more details on how to use Common Query Language (CQL) to filter the collection with specific queries.
116116

117117
.. _ERDDAP Tabledap Service:
118118

@@ -359,7 +359,7 @@ To publish an OpenSearch index, the following are required in your index:
359359
The OpenSearch provider also has the support for the CQL queries as indicated in the table above.
360360

361361
.. seealso::
362-
:ref:`cql` for more details on how to use Common Query Language (CQL) to filter the collection with specific queries.
362+
:ref:`cql2` for more details on how to use Common Query Language (CQL) to filter the collection with specific queries.
363363

364364
.. _Oracle:
365365

@@ -612,7 +612,7 @@ block contains the necessary socket connection information.
612612
This provider has support for the CQL queries as indicated in the Provider table above.
613613

614614
.. seealso::
615-
:ref:`cql` for more details on how to use Common Query Language (CQL) to filter the collection with specific queries.
615+
:ref:`cql2` for more details on how to use Common Query Language (CQL) to filter the collection with specific queries.
616616

617617
SQLiteGPKG
618618
^^^^^^^^^^

docs/source/data-publishing/ogcapi-records.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ To publish an Elasticsearch index, the following are required in your index:
5454
The ES provider also has the support for the CQL queries as indicated in the table above.
5555

5656
.. seealso::
57-
:ref:`cql` for more details on how to use Common Query Language (CQL) to filter the collection with specific queries.
57+
:ref:`cql2` for more details on how to use Common Query Language (CQL) to filter the collection with specific queries.
5858

5959
TinyDBCatalogue
6060
^^^^^^^^^^^^^^^

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ reference documentation on all aspects of the project.
4444
plugins
4545
html-templating
4646
crs
47-
cql
47+
cql2
4848
language
4949
development
5050
ogc-compliance

pygeoapi/api/itemtypes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
from typing import Any, Tuple, Union, Optional
4444
import urllib.parse
4545

46-
from pygeofilter.parsers.ecql import parse as parse_ecql_text
46+
from pygeofilter.parsers.cql2_text import parse as parse_cql2_text
4747
from pygeofilter.parsers.cql2_json import parse as parse_cql2_json
4848
from pyproj.exceptions import CRSError
4949

@@ -477,7 +477,7 @@ def get_collection_items(
477477

478478
if cql_text is not None:
479479
try:
480-
filter_ = parse_ecql_text(cql_text)
480+
filter_ = parse_cql2_text(cql_text)
481481
filter_ = modify_pygeofilter(
482482
filter_,
483483
filter_crs_uri=filter_crs_uri,

tests/test_postgresql_provider.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
import pyproj
4747
from http import HTTPStatus
4848

49-
from pygeofilter.parsers.ecql import parse
49+
from pygeofilter.parsers.cql2_text import parse
5050

5151
from pygeoapi.api import API
5252
from pygeoapi.api.itemtypes import (
@@ -335,7 +335,7 @@ def test_get_not_existing_item_raise_exception(config):
335335
80835475, 80835478, 80835483, 80835486]),
336336
("osm_id BETWEEN 80800000 AND 80900000 AND waterway = 'stream'",
337337
[80835470]),
338-
("osm_id BETWEEN 80800000 AND 80900000 AND waterway ILIKE 'sTrEam'",
338+
("osm_id BETWEEN 80800000 AND 80900000 AND waterway CASEI 'sTrEam'",
339339
[80835470]),
340340
("osm_id BETWEEN 80800000 AND 80900000 AND waterway LIKE 's%'",
341341
[80835470]),

tests/test_util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# Authors: Tom Kralidis <tomkralidis@gmail.com>
44
#
5-
# Copyright (c) 2021 Tom Kralidis
5+
# Copyright (c) 2025 Tom Kralidis
66
#
77
# Permission is hereby granted, free of charge, to any person
88
# obtaining a copy of this software and associated documentation
@@ -38,7 +38,7 @@
3838
import pytest
3939
from pyproj.exceptions import CRSError
4040
import pygeofilter.ast
41-
from pygeofilter.parsers.ecql import parse
41+
from pygeofilter.parsers.cql2_text import parse
4242
from pygeofilter.values import Geometry
4343
from shapely.geometry import Point
4444

0 commit comments

Comments
 (0)