To define a stored query you have to create a XML file with the query definition. An example from ESRI looks like this:
<?xml version="1.0" encoding="utf-8" ?> <wfs:StoredQueryList xmlns:ogc="http://www.opengis.net/ogc" xmlns:wfs="http://www.opengis.net/wfs" xmlns:fes="http://www.opengis.net/fes/2.0" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:myns="http://www.someserver.com/myns" xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd" service="WFS" version="2.0.0"> <wfs:StoredQueryDefinition id="urn:ogc:def:query:OGC-WFS::GetFeatureById"> <wfs:Title>urn:ogc:def:query:OGC-WFS::GetFeatureById predefined stored query</wfs:Title>
<wfs:Abstract>This query support all layers in the map</wfs:Abstract> <wfs:QueryExpressionText returnFeatureTypes="myns:Cities,myns:Continent,myns:World" language="urn:ogc:def:queryLanguage:OGC-WFS::WFS_QueryExpression" isPrivate="false"> <wfs:Query typeName="myns:Cities"> <ogc:Filter> <ogc:PropertyIsEqualTo>
<ogc:Literal>OBJECTID</ogc:Literal> <ogc:Literal>${ID}</ogc:Literal> </ogc:PropertyIsEqualTo> </ogc:Filter> </wfs:Query> </wfs:StoredQueryDefinition> </wfs:StoredQueryList>
The disadvantage of this is, that you have to define it for each and every typeName - everytime a new type is added, you have to add it to the Query. I would like to have a typename="*" or typename="?" - I want to remove the typename. Is this possible?
If not - I still have to add the typename or featureId parameter from the GetFeature request (even so i added the StoredQuery_id=...) otherwise there is an exception. Here is the request:
...- server - name - usw.... /WFSServer?service=WFS&REQUEST=GetFeature&STOREDQUERY_ID=urn:ogc:def:query:OGC-WFS::GetFeatureById&ID=52&typename=layer_name
Is there any possiblity to use this layer_name in the typename in the wfs:Query?
Nobody?
Mapserver has this answer even in the documentation...