KVP encoding Sort processing

42 Copyright © 2010 Open Geospatial Consortium 7.9.3 Stored query expression 7.9.3.1 Request Semantics A stored query expression may be used in a GetPropertyValue see Clause 10, GetFeature see Clause 11, GetFeatureWithLock see Clause 13 or LockFeature see Clause 12 operation to identify a set of features to be operated upon. A stored query expression see Figure 11 is a persistent, parameterized, identifiable query expression. A stored query can be repeatedly invoked using its identifier with different values bound to its parameters each time. All servers shall implement the ability to list, describe and execute stored queries. All server implementations shall offer a stored query that fetches features based on their identifier. Additional stored queries that are packaged with the server may also be offered. Clause 14 describes a set of operations for managing stored query expressions. StoredQuery + id : URI + parameter [ 0..] : Parameter Parameter + name : LocalName + value : Any QueryExpression + handle [0..1] : CharacterString from ISO 19143 Filter Encoding Figure 11 — StoredQuery 7.9.3.2 XML encoding The following XML Schema fragment defines the XML encoding of a stored query expression: xsd:element name=StoredQuery type=wfs:StoredQueryType substitutionGroup=fes:AbstractQueryExpression xsd:complexType name=StoredQueryType xsd:complexContent xsd:extension base=fes:AbstractQueryExpressionType xsd:sequence xsd:element name=Parameter type=wfs:ParameterType minOccurs=0 maxOccurs=unbounded xsd:sequence Copyright © 2010 Open Geospatial Consortium 43 xsd:attribute name=id type=xsd:anyURI use=required xsd:extension xsd:complexContent xsd:complexType xsd:complexType name=ParameterType mixed=true xsd:sequence xsd:any namespace=other processContents=lax minOccurs=0 maxOccurs=1 xsd:sequence xsd:attribute name=name type=xsd:string use=required xsd:complexType The abstract type fes:AbstractQueryExpressionType is described in ISO 19143:2010, 6.2.

7.9.3.3 KVP encoding

Table 10 defines the KVP-encoding for a stored query expression. Table 10 — Keywords for Stored query KVP-encoding URL Component OMa Description STOREDQUERY_ID M The identifier of the stored query to invoke. storedquery_parameter=value O Each parameter of a stored query shall be encoded in KVP as a keyword-value pair. Stored query parameters shall not have names that conflict with any WFS parameter name. a O = Optional, M = Mandatory Unlike ad hoc queries, where more than one query can be encoded in a single KVP-encoded request, only one stored query shall be invoked per KVP-encoded request.

7.9.3.4 Stored query identifier

For XML-encoded requests the stored query identifier shall be encoded using the id attribute on the wfs:StoredQuery element. For KVP-encoded requests the stored query identifier shall be encoded using the STOREDQUERY_ID keyword. Each stored query shall be assigned an identifier unique to the server that can be used to invoke the query.

7.9.3.5 Stored query parameters

For XML-encoded requests, each stored query parameter shall be encoded using a wfs:Parameter element. The name of the parameter shall be encoded as the value of the name attribute on the wfs:Parameter element. The value of the parameter shall be encoded as the content of the wfs:Parameter element. For KVP-encoded requests, stored query parameters shall be encoded as keyword-value pairs. The parameter name shall be encoded as the keyword and its value shall be encoded as the value of the keyword- value pair. EXAMPLE This example does a GetFeature request that invokes the GetTreesByArea stored query with the AREA parameter. http:www.someserver.comwfs.cgi?request=GetFeaturestoredquery_id=urn- x:wfs:StoredQueryId:SomeCompanyName:GetTreesByAreaAREA=10000 A server shall ensure that stored query parameters names do not collide with WFS KVP keywords.