This PR proposes a Filter API for citydb-tool. It allows for defining filter expressions on feature properties stored in the database using boolean, comparison, and spatial predicates as well as arithmetic expressions and functions. The Filter API is fully compatible with the Common Query Language (CQL2) which serves as building block for OGC API - Features - Part 3: Filtering, and even extends CQL2 for more flexibility.
These are the elements added by this PR:
Java classes and a DSL-like API for fluently creating filter expressions.
Support for two encodings:
A text-based encoding for easily typing filter expressions or sending them via HTTP GET.
A JSON-based encoding for serializing filter expressions or sending them via HTTP POST.
Parsers and writers that can read text/JSON representations into the Java classes and write them out as text/JSON again. This way, you can easily switch between both encodings without information loss.
Both encodings are compatible with CQL2.
Extensions to CQL2 comprise:
The possibility to express filters on nested properties. A JSONPath-like notation is used to define such property paths.
The possibility to express additional predicates at every step of a property path.
The possibility to add more functions beyond those defined by CQL2. A first extension is the index function to be used in step predicates. But more functions like min, max, avg, or buffer may follow.
Note that the Filter API is just a first step on the road to a Query API. A next big step is to develop a full mapping of filter expressions onto SQL statements for querying features based on the 3DCityDB v5 schema. Afterwards, more query parameters beyond filters such as feature types, LoDs, appearance themes, etc. will be added.
This PR proposes a Filter API for citydb-tool. It allows for defining filter expressions on feature properties stored in the database using boolean, comparison, and spatial predicates as well as arithmetic expressions and functions. The Filter API is fully compatible with the Common Query Language (CQL2) which serves as building block for OGC API - Features - Part 3: Filtering, and even extends CQL2 for more flexibility.
These are the elements added by this PR:
index
function to be used in step predicates. But more functions likemin
,max
,avg
, orbuffer
may follow.Note that the Filter API is just a first step on the road to a Query API. A next big step is to develop a full mapping of filter expressions onto SQL statements for querying features based on the 3DCityDB v5 schema. Afterwards, more query parameters beyond filters such as feature types, LoDs, appearance themes, etc. will be added.