Provide functional extensibility Precedence

...CONSTRAINTLANGUAGE=CQL_TEXTCONSTRAINT=”prop1=10”... The value of the CONSTRAINT parameter in the KVP encoding may also include an XML encoded Filter expression although some clients may impose length limitations. 10.8.4.11 OGC filter syntax 10.8.4.11.1 Introduction The XML implementation of the BNF in Subclause 6.3.2 may be found in OGC document 04-095, Filter Encoding Implementation Specification. The intent of the XML encoding of the OGC common query language is that it be easily parsable using readily available XML parsers and be easily translatable into a target predicate language such as a SQL where clause or an XQuery predicate.

10.8.4.11.2 Provide functional extensibility

One feature of the OGC common query language and the XML implementation is that the predicate language is functionally extensible. This means that functions may be added to the filter predicate language without having to change the underlying schema. The relevant schema fragment from OGC 04-095 is: xsd:element name=Function type=ogc:FunctionType substitutionGroup=ogc:expression xsd:complexType name=FunctionType xsd:complexContent xsd:extension base=ogc:ExpressionType xsd:sequence xsd:element ref=ogc:expression minOccurs=0 maxOccurs=unbounded xsd:sequence xsd:attribute name=name type=xsd:string use=required xsd:extension xsd:complexContent xsd:complexType According to the schema fragment, any function may added to the filter predicate language simply by specifying its name and including zero or more ogc expressions as content of the Function element which represent the arguments of the function. The following example shows how a function may be called using the filter syntax: Function name=”MAX” PropertyNameDEPTHPropertyName Function In this example, the MAX function is invoked to find the maximum value of the property DEPTH. Any function may be called using the filter syntax as long as the function is advertised in the filter capabilities section Clause 16 of OGC 04-095 of an OGC capabilities document. 152 Copyright © 2007 Open Geospatial Consortium, Inc. All Rights Reserved.

10.8.4.11.3 Precedence

The XML notation does not provide parentheses to indicate operator precedence as specified in the BNF. The Filter Specification uses the nested structure of the XML notation to indicate this relationship. In this example, a more complex scalar predicate is encoded using the logical operators AND and OR. The example is equivalent to the expression FIELD1=10 OR FIELD1=20 AND STATUS=VALID: Filter xmlns=http:http:www.opengis.netogc xmlns:foo=“http:www.someverser.comfoo” And Or PropertyIsEqualTo PropertyNamefoo:FIELD1PropertyName Literal10Literal PropertyIsEqualTo PropertyIsEqualTo PropertyNamefoo:FIELD1PropertyName Literal20Literal PropertyIsEqualTo Or PropertyIsEqualTo PropertyNamefoo:STATUSPropertyName LiteralVALIDLiteral PropertyIsEqualTo And Filter

10.8.4.11.4 Tight and loose queries