.. CQL Description #----------------------------------------------------------------------------- # # Project: EOxServer # Authors: Fabian Schindler # #----------------------------------------------------------------------------- # Copyright (C) 2020 EOX IT Services GmbH # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies of this Software or works derived from this Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. #----------------------------------------------------------------------------- .. _CQL: Common Query Language (CQL) =========================== This document describes the basic syntax of the common query language. CQL is the query language defined the `Catalogue Service specification (CSW) `_. CQL support in EOxServer is realized using the external `pycql `_ package. This document is based upon the `(E)CQL documentation of GeoServer `_ with adapations wherever needed. Syntax Specification -------------------- This chapter shows the syntax to define CQL queries. Condition ~~~~~~~~~ .. table:: condition syntax +-----------------------------------------------+-------------------------------------------------------+ | Syntax | Description | +===============================================+=======================================================+ | `Predicate`_ | A single predicate expression | +-----------------------------------------------+-------------------------------------------------------+ | `Condition`_ ``AND`` | ``OR`` `Condition`_ | Logical combination of two conditions | +-----------------------------------------------+-------------------------------------------------------+ | ``NOT`` `Condition`_ | Logical inversion of a condition. | +-----------------------------------------------+-------------------------------------------------------+ | ``(`` | ``[`` `Condition`_ ``]`` | ``)`` | Grouping of conditions regarding evaluation order | +-----------------------------------------------+-------------------------------------------------------+ Predicate ~~~~~~~~~ .. table:: predicate syntax +-----------------------------------------------+-------------------------------------------------------+ | Syntax | Description | +===============================================+=======================================================+ | `Expression`_ ``=`` | ``<>`` | ``<`` | ``<=`` | Comparison of two expression | | | ``>`` | ``>=`` `Expression`_ | | +-----------------------------------------------+-------------------------------------------------------+ | `Expression`_ [ ``NOT`` ] ``BETWEEN`` | Value range Comparison | | `Expression`_ ``AND`` `Expression`_ | | +-----------------------------------------------+-------------------------------------------------------+ | `Expression`_ [ ``NOT`` ] ``LIKE`` | ``ILIKE``| Check whether an expression matches a pattern. The | | ``pattern`` | ``%`` character can be used as a wildcard. | +-----------------------------------------------+-------------------------------------------------------+ | `Expression`_ [ ``NOT`` ] ``IN`` ``(`` | Tests the inclusion of a value in a set of values. | | `Expression`_ { ``,`` `Expression`_ ``)`` | | +-----------------------------------------------+-------------------------------------------------------+ | `Expression`_ ``IS`` [ ``NOT`` ] ``NULL`` | Tests whether the evaluated expression is ``NULL`` | +-----------------------------------------------+-------------------------------------------------------+ | `Expression`_ ``BEFORE`` `Timestamp`_ | | +-----------------------------------------------+-------------------------------------------------------+ | `Expression`_ ``BEFORE`` ``OR`` ``DURING`` | | | `Period`_ | | +-----------------------------------------------+-------------------------------------------------------+ | `Expression`_ ``DURING`` `Period`_ | | +-----------------------------------------------+-------------------------------------------------------+ | `Expression`_ ``DURING`` ``OR`` ``AFTER`` | | | `Period`_ | | +-----------------------------------------------+-------------------------------------------------------+ | `Expression`_ ``AFTER`` `Timestamp`_ | | +-----------------------------------------------+-------------------------------------------------------+ | ``INTERSECTS`` ``(`` `Expression`_ ``,`` | | | `Expression`_ ``)`` | | +-----------------------------------------------+-------------------------------------------------------+ | ``DISJOINT`` ``(`` `Expression`_ ``,`` | | | `Expression`_ ``)`` | | +-----------------------------------------------+-------------------------------------------------------+ | ``CONTAINS`` ``(`` `Expression`_ ``,`` | | | `Expression`_ ``)`` | | +-----------------------------------------------+-------------------------------------------------------+ | ``WITHIN`` ``(`` `Expression`_ ``,`` | | | `Expression`_ ``)`` | | +-----------------------------------------------+-------------------------------------------------------+ | ``TOUCHES`` ``(`` `Expression`_ ``,`` | | | `Expression`_ ``)`` | | +-----------------------------------------------+-------------------------------------------------------+ | ``CROSSES`` ``(`` `Expression`_ ``,`` | | | `Expression`_ ``)`` | | +-----------------------------------------------+-------------------------------------------------------+ | ``OVERLAPS`` ``(`` `Expression`_ ``,`` | | | `Expression`_ ``)`` | | +-----------------------------------------------+-------------------------------------------------------+ | ``EQUALS`` ``(`` `Expression`_ ``,`` | | | `Expression`_ ``)`` | | +-----------------------------------------------+-------------------------------------------------------+ | ``RELATE`` ``(`` `Expression`_ ``,`` | | | `Expression`_ ``,`` pattern ``)`` | | +-----------------------------------------------+-------------------------------------------------------+ | ``DWITHIN`` ``(`` `Expression`_ ``,`` | | | `Expression`_ ``,`` `Number`_ ``,`` units | | | ``)`` | | +-----------------------------------------------+-------------------------------------------------------+ | ``BEYOND`` ``(`` `Expression`_ ``,`` | | | `Expression`_ ``,`` `Number`_ ``,`` units | | | ``)`` | | +-----------------------------------------------+-------------------------------------------------------+ | ``BBOX`` ``(`` `Expression`_ ``,`` | | | `Number`_ ``,`` `Number`_ ``,`` | | | `Number`_ ``,`` `Number`_ [ ``,`` CRS ] ``)`` | | +-----------------------------------------------+-------------------------------------------------------+ Expression ~~~~~~~~~~ .. table:: expression syntax +-----------------------------------------------+-------------------------------------------------------+ | Syntax | Description | +===============================================+=======================================================+ | `Attribute`_ | Name of an objects attribute | +-----------------------------------------------+-------------------------------------------------------+ | `Literal`_ | A literal value | +-----------------------------------------------+-------------------------------------------------------+ | `Expression`_ ``+`` | ``-`` | ``*`` | ``/`` | Arithmetic operations of two expressions | | `Expression`_ | | +-----------------------------------------------+-------------------------------------------------------+ | ``(`` | ``[`` `Expression`_ ``]`` | ``)`` | Grouping of expression regarding evaluation order | +-----------------------------------------------+-------------------------------------------------------+ Literal ~~~~~~~ .. table:: literal values +-----------------------------------------------+-------------------------------------------------------+ | Syntax | Description | +===============================================+=======================================================+ | .. _Number: | A literal number (either floating point or integer | | | | | Number | | +-----------------------------------------------+-------------------------------------------------------+ | .. _Boolean: | A literal booelan value: either `TRUE` or `FALSE` | | | | | Boolean | | +-----------------------------------------------+-------------------------------------------------------+ | .. _Timestamp: | A timestamp literal. Must be in ISO 8601 compliant | | | datetime format. | | Timestamp | | +-----------------------------------------------+-------------------------------------------------------+ | .. _Duration: | A timestamp literal. Must be in ISO 8601 compliant | | | duration format. | | Duration | | +-----------------------------------------------+-------------------------------------------------------+ | .. _Geometry: | A Geometry in WKT format. EPSG:4326 is assumed | | | | | Geometry | | +-----------------------------------------------+-------------------------------------------------------+ Period ~~~~~~ .. table:: period syntax +-----------------------------------------------+-------------------------------------------------------+ | Syntax | Description | +===============================================+=======================================================+ | `Timestamp`_ ``/`` `Timestamp`_ | Period definition using the start and end timestamp. | +-----------------------------------------------+-------------------------------------------------------+ | `Timestamp`_ ``/`` `Duration`_ | Period definition using the start timestamp and a | | | duration afterwards. | +-----------------------------------------------+-------------------------------------------------------+ | `Duration`_ ``/`` `Timestamp`_ | Period definition using the end timestamp and a | | | duration before. | +-----------------------------------------------+-------------------------------------------------------+ Attribute ~~~~~~~~~ Depending on the current query context, the following attributes are available to use in the queries. .. table:: available attributes +-----------------------------------+-----------------------------------+-----------------------------------+ | Attribute name | Field type | Availability | +===================================+===================================+===================================+ | identifier | String | All | +-----------------------------------+-----------------------------------+-----------------------------------+ | beginTime | Timestamp | All | +-----------------------------------+-----------------------------------+-----------------------------------+ | endTime | Timestamp | All | +-----------------------------------+-----------------------------------+-----------------------------------+ | footprint | String | All | +-----------------------------------+-----------------------------------+-----------------------------------+ | inserted | Timestamp | All | +-----------------------------------+-----------------------------------+-----------------------------------+ | updated | Timestamp | All | +-----------------------------------+-----------------------------------+-----------------------------------+ | productType | String | Collection | +-----------------------------------+-----------------------------------+-----------------------------------+ | doi | String | Collection | +-----------------------------------+-----------------------------------+-----------------------------------+ | platform | String | Collection | +-----------------------------------+-----------------------------------+-----------------------------------+ | platformSerialIdentifier | String | Collection | +-----------------------------------+-----------------------------------+-----------------------------------+ | instrument | String | Collection | +-----------------------------------+-----------------------------------+-----------------------------------+ | sensorType | String | Collection | +-----------------------------------+-----------------------------------+-----------------------------------+ | compositeType | String | Collection | +-----------------------------------+-----------------------------------+-----------------------------------+ | processingLevel | String | Collection | +-----------------------------------+-----------------------------------+-----------------------------------+ | orbitType | String | Collection | +-----------------------------------+-----------------------------------+-----------------------------------+ | spectralRange | String | Collection | +-----------------------------------+-----------------------------------+-----------------------------------+ | wavelength | Number | Collection | +-----------------------------------+-----------------------------------+-----------------------------------+ | parentIdentifier | String | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | productionStatus | String | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | acquisitionType | String | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | orbitNumber | Number | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | orbitDirection | Number | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | track | Number | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | frame | Number | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | swathIdentifier | String | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | productVersion | String | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | productQualityStatus | String | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | productQualityDegradationTag | String | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | processorName | String | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | processingCenter | String | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | creationDate | Timestamp | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | modificationDate | Timestamp | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | processingDate | Timestamp | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | sensorMode | String | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | archivingCenter | String | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | processingMode | String | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | availabilityTime | Timestamp | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | acquisitionStation | String | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | acquisitionSubType | String | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | startTimeFromAscendingNode | Number | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | completionTimeFromAscendingNode | Number | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | illuminationAzimuthAngle | Number | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | illuminationZenithAngle | Number | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | illuminationElevationAngle | Number | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | polarisationMode | String | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | polarizationChannels | String | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | antennaLookDirection | String | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | minimumIncidenceAngle | Number | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | maximuIncidenceAngle | Number | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | dopplerFrequency | Number | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | incidenceAngleVariation | Number | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | cloudCover | Number | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | snowCover | Number | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | lowestLocation | Number | Product | +-----------------------------------+-----------------------------------+-----------------------------------+ | highestLocation | Number | Product | +-----------------------------------+-----------------------------------+-----------------------------------+