Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »


CQL Parser

Module Maintainer:

Gabriel Roldán

Email Help:



IP: (red star), Releasable: (star), QA: (star), Stability: (star) Supported: (red star)

Gold Star Quality Assurance Check:

(red star) IP Check: need to ensure all headers are in place
(r) Releasable: no blocking issues
(star) Quality Assurance: 84.9% test coverage reported by clover
(star) Stability: based on reviewed GeoAPI Filter interfaces and reviewed CSW 2.0.1 BNF for CQL
(red star) Supported: pending publication of user and design docs. Module maintainer does watches user list, answers email.


A module dedicated to fully support the OGC Common Query Language, version 2.0.1, as a query predicate language inside GeoTools.


Axios have developed, for the Diputación Foral de Gipuzkoa, Department of Land Planning, an implementation of the OGC Catalog Service for Web 2.0.1 specification, based on GeoAPI medatada interfaces and Geotools implementation to support the ISO-19115/19139 profile.

The CSW specification, in section 6.2.2 defines the complete BNF for a constraint language to use as query predicates in a CSW implementation, named OGC Common Query Language, CQL for short.

As the CSW implementation worked on uses exclusively org.opengis.filter.Filter, it was needed a converter from an input query in CQL format to an equivalent predicate in the form of a Filter object.

Target Audience

By being part of the GeoTools library, this little module would just allow for any client code to easily construct a filter from a more human friendly predicate language.

In particular, the GeoServer community is currently willing to use it to add friendly filtering capabilities in WMS GetMap requests, and I guess it could be used in WFS GetFeature too.

An example usage would be:

Ofcourse the quoted text after CONSTRAINT= should be properly encoded for HTTP


The module is derived from the old org.geotools.filter.ExpressionBuilder parser by Ian Schneider.

The focus was to fully support the 2.0.1 version of the BNF as defined in the CSW spec. This implies, among other improvements:

  • support for nested and prefixed property names (for example, gmd:MD_Metadata.identificationInfo.gmd:MD_DataIdentification.abstract)
  • support for spatial predicates (intersect, touches, etc). Note the BNF oddly suppressed the trailing 's' from these predicates, so TOUCH(ATTR1, POINT(1 2)) instead of TOUCHES(ATTR1, POINT(1 2))
  • temporal predicates (BEFORE, AFTER, DURING, etc)

Quality Assurance

Unit test coverage

The module targets a high level code coverage for unit testing, 80% minimum.

Unit testing strategy

We made a full test coverage. Had to throw away the unit tests of the old ExpressionBuilder since they were testing that the resulting Filter or Expression evaluates to an expected value, which was a wrong way of testing the parser. The correct way is to ensure that the Filter is built as expected. For example:
Old test:

This doesn't asserts the built Filter is a "att is less than 10" Filter.
New way:


We decided to upload the module even if there were a couple transient bugs in the library that prevented three unit tests to pass. So the module is currently out of the build until those tests are resolved. We thought it was a better decision than just commenting out our tests and hide the bugs. We're working on fixing the bugs in the other modules that make ours not to work as expected.

Currently the only remaining bug to fix in order to get CQL Parser in the build is:

  • No labels