Backward Mapping¶
When performing queries, using CQL filters, against layers that support a templated output, it will be possible to reference the template attributes in the CQL expressions. The plugin will take care of interpreting the CQL filter and translate it, when possible, to a data source native filter. For example, if that data source is a relational database, the CQL filter will be translated to one or multiple SQL queries that will be used to retrieve only the needed data.
Consider the following JSON-LD output example:
{
"@context": {
"gsp": "http://www.opengis.net/ont/geosparql#",
"sf": "http://www.opengis.net/ont/sf#",
"schema": "https://schema.org/",
"dc": "http://purl.org/dc/terms/",
"Feature": "gsp:Feature",
"FeatureCollection": "schema:Collection",
"Point": "sf:Point",
"wkt": "gsp:asWKT",
"features": {
"@container": "@set",
"@id": "schema:hasPart"
},
"geometry": "sf:geometry",
"description": "dc:description",
"title": "dc:title",
"name": "schema:name"
},
"type": "FeatureCollection",
"features": [
{
"@id": "mf2",
"@type": [
"Feature",
"gsml:MappedFeature",
"http://vocabulary.odm2.org/samplingfeaturetype/mappedFeature"
],
"name": "MERCIA MUDSTONE GROUP",
"gsml:positionalAccuracy":{
"value":"100",
"valueArray": ["100","someStaticVal"]
},
"gsml:GeologicUnit": {
"@id": "gu.25678",
"description": "Olivine basalt, tuff, microgabbro, minor sedimentary rocks",
"gsml:geologicUnitType": "urn:ogc:def:nil:OGC::unknown",
"gsml:composition": [
{
"gsml:compositionPart": [
{
"gsml:role": {
"value": "interbedded component",
"@codeSpace": "urn:cgi:classi..."
},
"proportion": {
"@dataType": "CGI_ValueProperty",
"CGI_TermValue": {
"@dataType": "CGI_TermValue",
"value": {
"value": "significant",
"@codeSpace": "some:uri"
}
}
},
"lithology": [
{
"@id": "cc.3",
"name": {
"value": "name_cc_3",
"@lang": "en"
},
"vocabulary": {
"@href": "urn:ogc:def:nil:OGC::missing"
}
}
]
}
]
},
{
"gsml:compositionPart": [
{
"gsml:role": {
"value": "interbedded component",
"@codeSpace": "urn:cgi:class..."
},
"proportion": {
"@dataType": "CGI_ValueProperty",
"CGI_TermValue": {
"@dataType": "CGI_TermValue",
"value": {
"value": "minor",
"@codeSpace": "some:uri"
}
}
},
"lithology": [
{
"@id": "cc.4",
"name": {
"value": "name_cc_4",
"@lang": "en"
},
"vocabulary": {
"@href": "urn:ogc:def:nil:OGC::missing"
}
}
]
}
]
}
],
"geometry": {
"@type": "Polygon",
"wkt": "POLYGON ((52.5 -1.3, 52.6 -1.3, 52.6 -1.2,...))"
}
}
}
]
}
The following are example of valid CQL filters:
features.gsml:GeologicUnit.description = ‘some string value’
features.”@id” = “3245”
features.name in (“MERCIA MUDSTONE”, “UKNOWN”)
features.gsml:positionalAccuracy.valueArray1 = “100”
As the last example shows, to refer to elements in arrays listing simple attributes, the index of the attribute is needed, starting from 1, in the form {attributeName}{index}
, as in features.gsml:positionalAccuracy.valueArray1.
Is worth mentioning that, as demonstrated in the examples above, ""
can be used to escape the attributes path components.