この項では、次の各操作について、WFSエンジンへのフィーチャ・リクエストの一部と、各リクエストに対するレスポンスを示します。
GetCapabilities
DescribeFeatureType
GetFeature
GetFeatureWithLock
LockFeature
次のトランザクション・タイプを指定するサブ要素を含むトランザクション
挿入
更新
削除
XMLリクエストとレスポンスの書式は、リレーショナルおよびドキュメントベースの両方のフィーチャ・タイプで同様のものが使用されます。この項のいくつかの例で、「座標系変換の例」の例6-17で使用したCOLA_MARKETS_CS表に基づくリレーショナル・フィーチャを参照します。MKT_ID列には各フィーチャの一意の数値IDが含まれ、NAME列には各フィーチャの名前(cola_a
、cola_b
、cola_c
またはcola_d
)が含まれ、SHAPE列には各フィーチャと関連付けられたジオメトリが含まれます。
例15-1 GetCapabilitiesリクエスト
例15-1は、指定した名前空間URLで、WFSという名前のWFSサーバーの機能を取得するリクエストです。このリクエストでは、機能のドキュメント(「機能のドキュメント」を参照)が戻されます
<?xml version="1.0" ?> <GetCapabilities service="WFS" version="1.0.0" xmlns="http://www.opengis.net/wfs" />
例15-2 GetCapabilitiesのレスポンス
例15-2は、例15-1のリクエストに対するレスポンスからの抜粋です。
<WFS_Capabilities xmlns="http://www.opengis.net/wfs" version="1.0.0" xmlns:ogc="http://www.opengis.net/ogc" xmlns:myns="http://www.example.com/myns"> <Service> <Name> Oracle WFS </Name> <Title> Oracle Web Feature Service </Title> <Abstract> Web Feature Service maintained by Oracle </Abstract> <OnlineResource>http://localhost:8888/SpatialWS-SpatialWS-context-root/wfsservlet</OnlineResource> </Service> <Capability> <Request> <GetCapabilities> <DCPType> <HTTP> <Get onlineResource="http://localhost:8888/SpatialWS-SpatialWS-context-root/wfsservlet"/> </HTTP> </DCPType> <DCPType> <HTTP> <Post onlineResource="http://localhost:8888/SpatialWS-SpatialWS-context-root/SpatialWSSoapHttpPort"/> </HTTP> </DCPType> </GetCapabilities> <DescribeFeatureType> <SchemaDescriptionLanguage> <XMLSCHEMA/> </SchemaDescriptionLanguage> <DCPType> <HTTP> <Post onlineResource="http://localhost:8888/SpatialWS-SpatialWS-context-root/SpatialWSSoapHttpPort"/> </HTTP> </DCPType> </DescribeFeatureType> <GetFeature> <ResultFormat> <GML2/> </ResultFormat> <DCPType> <HTTP> <Post onlineResource="http://localhost:8888/SpatialWS-SpatialWS-context-root/SpatialWSSoapHttpPort"/> </HTTP> </DCPType> </GetFeature> <GetFeatureWithLock> <ResultFormat> <GML2/> </ResultFormat> <DCPType> <HTTP> <Post onlineResource="http://localhost:8888/SpatialWS-SpatialWS-context-root/SpatialWSSoapHttpPort"/> </HTTP> </DCPType> </GetFeatureWithLock> <Transaction> <DCPType> <HTTP> <Post onlineResource="http://localhost:8888/SpatialWS-SpatialWS-context-root/SpatialWSSoapHttpPort"/> </HTTP> </DCPType> </Transaction> <LockFeature> <DCPType> <HTTP> <Post onlineResource="http://localhost:8888/SpatialWS-SpatialWS-context-root/SpatialWSSoapHttpPort"/> </HTTP> </DCPType> </LockFeature> </Request> </Capability> <FeatureTypeList> <Operations> <Insert/> <Update/> <Delete/> <Query/> <Lock/> </Operations> <FeatureType xmlns:myns="http://www.example.com/myns"> <Name> myns:COLA</Name> <Title> LIST OF COLA MARKETS </Title> <SRS> SDO:8307</SRS> </FeatureType><FeatureType xmlns:myns="http://www.example.com/myns"> <Name> myns:COLAVIEW1 </Name> <Title> LIST OF COLA MARKET VIEW </Title> <SRS> SDO:8307</SRS> </FeatureType><FeatureType xmlns:wfs="http://www.opengis.net/wfs"> <Name xmlns:myns="http://www.example.com/myns1">myns:SampleFeature</Name> <Title>SAMPLE FEATURE</Title> <SRS>EPSG:32615</SRS> </FeatureType></FeatureTypeList> <ogc:Filter_Capabilities xmlns:ogc="http://www.opengis.net/ogc"> <ogc:Spatial_Capabilities> <ogc:Spatial_Operators> <ogc:BBOX/> <ogc:Equals/> <ogc:Disjoint/> <ogc:Intersect/> <ogc:Touches/> <ogc:Crosses/> <ogc:Within/> <ogc:Contains/> <ogc:Overlaps/> <ogc:Beyond/> <ogc:DWithin/> </ogc:Spatial_Operators> </ogc:Spatial_Capabilities> <ogc:Scalar_Capabilities> <ogc:Logical_Operators/> <ogc:Comparison_Operators> <ogc:Simple_Comparisons/> <ogc:Like/> <ogc:Between/> <ogc:NullCheck/> </ogc:Comparison_Operators> <ogc:Arithmetic_Operators> <ogc:Simple_Arithmetic/> </ogc:Arithmetic_Operators> </ogc:Scalar_Capabilities> </ogc:Filter_Capabilities> </WFS_Capabilities>
例15-3 DescribeFeatureTypeリクエスト
例15-3は、COLA
という名前のフィーチャ・タイプを記述するリクエストです。
<?xml version="1.0" ?> <wfs:DescribeFeatureType service="WFS" version="1.0.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:myns="http://www.example.com/myns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="http://www.opengis.net/wfs ../wfs/1.0.0/WFS-basic.xsd"> <wfs:TypeName>myns:COLA</wfs:TypeName> </wfs:DescribeFeatureType>
例15-4 DescribeFeatureTypeのレスポンス
例15-4は、例15-3のリクエストに対するレスポンスです。レスポンスはXMLスキーマ定義(XSD)です。
<xsd:schema targetNamespace="http://www.example.com/myns" xmlns:wfs="http://www.opengis.net/wfs" xmlns:myns="http://www.example.com/myns" xmlns:gml="http://www.opengis.net/gml" elementFormDefault="qualified" version="1.0.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:import namespace="http://www.opengis.net/gml" schemaLocation="http://localhost:8888/examples/servlets/xsds/feature.xsd"/> <xsd:element name="COLA" type="myns:COLAType" substitutionGroup="gml:_Feature"/> <xsd:complexType name="COLAType"> <xsd:complexContent> <xsd:extension base="gml:AbstractFeatureType"> <xsd:sequence> <xsd:element name="MKT_ID" type="xsd:double"/> <xsd:element name="NAME" nillable="true"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:maxLength value="32"/> </xsd:restriction> </xsd:simpleType> </xsd:element> <xsd:element name="SHAPE" type="gml:PolygonMemberType" nillable="true"/> </xsd:sequence> <xsd:attribute name="fid" type="xsd:double"/> </xsd:extension> </xsd:complexContent> </xsd:complexType> </xsd:schema>
例15-5 GetFeatureリクエスト
例15-5は、MKT_ID値が2より大きくNAME値がcola_c
であるか、MKT_ID値が3より大きくNAME値がcola_d
であるタイプCOLAのフィーチャのMKT_ID、NAMEおよびSHAPEプロパティを取得するリクエストです。
GetFeatureおよびGetFeatureWithLockでは<Query>
要素および<PropertyName>
要素を使用して選択するプロパティ名をリストしますが、問い合せるフィーチャ・タイプに含まれる任意の最上位レベルの要素を指定できます。その場合は、問合せへのレスポンスとして(ネストされた)コンテンツ全体が戻されます。深さが一定でないXPathは、<Query>
要素の直下の<PropertyName>
要素ではサポートされませんが<Query>
要素の下の<Filter>
要素に含まれる<PropertyName>
要素ではサポートされます(例15-5および例15-7を参照
<?xml version="1.0" ?> <wfs:GetFeature service="WFS" version="1.0.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc" xmlns:myns="http://www.example.com/myns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs ../wfs/1.0.0/WFS-basic.xsd"> <wfs:Query typeName="myns:COLA"> <ogc:PropertyName>myns:MKT_ID</ogc:PropertyName> <ogc:PropertyName>myns:NAME</ogc:PropertyName> <ogc:PropertyName>myns:SHAPE</ogc:PropertyName> <ogc:Filter> <ogc:And> <ogc:And> <ogc:PropertyIsGreaterThan> <ogc:PropertyName>myns:COLA/myns:MKT_ID</ogc:PropertyName> <ogc:Literal> 2 </ogc:Literal> </ogc:PropertyIsGreaterThan> <ogc:PropertyIsEqualTo> <ogc:PropertyName>myns:COLA/myns:NAME</ogc:PropertyName> <ogc:Literal>cola_c</ogc:Literal> </ogc:PropertyIsEqualTo> </ogc:And> <ogc:Or> <ogc:PropertyIsEqualTo> <ogc:PropertyName>myns:COLA/myns:MKT_ID</ogc:PropertyName> <ogc:Literal>3</ogc:Literal> </ogc:PropertyIsEqualTo> <ogc:PropertyIsEqualTo> <ogc:PropertyName>myns:COLA/myns:NAME</ogc:PropertyName> <ogc:Literal>cola_d</ogc:Literal> </ogc:PropertyIsEqualTo> </ogc:Or> </ogc:And> </ogc:Filter> </wfs:Query> </wfs:GetFeature>
例15-6 GetFeatureのレスポンス
例15-6は、例15-5のリクエストに対するレスポンスです。
<?xml version = '1.0' encoding = 'UTF-8'?> <wfs:FeatureCollection xsi:schemaLocation="http://www.example.com/myns http://localhost:8888/wfsservlet?featureTypeId=1 http://www.opengis.net/wfs ../wfs/1.0.0/WFS-basic.xsd" xmlns:wfs="http://www.opengis.net/wfs" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <gml:boundedBy xmlns:gml="http://www.opengis.net/gml"> <gml:Box srsName="SDO:8307"> <gml:coordinates>3.0,3.0 6.0,5.0</gml:coordinates> </gml:Box> </gml:boundedBy> <gml:featureMember xmlns:gml="http://www.opengis.net/gml"> <myns:COLA fid="3" xmlns:myns="http://www.example.com/myns"> <myns:MKT_ID>3</myns:MKT_ID> <myns:NAME>cola_c</myns:NAME> <myns:SHAPE> <gml:Polygon srsName="SDO:8307" xmlns:gml="http://www.opengis.net/gml"> <gml:outerBoundaryIs> <gml:LinearRing> <gml:coordinates decimal="." cs="," ts=" ">3.0,3.0 6.0,3.0 6.0,5.0 4.0,5.0 3.0,3.0 </gml:coordinates> </gml:LinearRing> </gml:outerBoundaryIs> </gml:Polygon> </myns:SHAPE> </myns:COLA> </gml:featureMember> </wfs:FeatureCollection>
例15-7 GetFeatureWithLockリクエスト
例15-7は、MKT_ID値が2より大きく、NAME値がcola_c
であるか、またはMKT_ID値が3であるタイプCOLAのフィーチャのMKT_ID、NAMEおよびSHAPEプロパティを取得し、そのフィーチャをロックするリクエストです。
<?xml version="1.0" ?> <wfs:GetFeatureWithLock service="WFS" version="1.0.0" expiry="5" xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" xmlns:myns="http://www.example.com/myns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > <wfs:Query typeName="myns:COLA"> <ogc:PropertyName>myns:MKT_ID</ogc:PropertyName> <ogc:PropertyName>myns:NAME</ogc:PropertyName> <ogc:PropertyName>myns:SHAPE</ogc:PropertyName> <ogc:Filter> <ogc:PropertyIsEqualTo> <ogc:PropertyName>myns:COLA/myns:MKT_ID</ogc:PropertyName> <ogc:Literal> 3 </ogc:Literal> </ogc:PropertyIsEqualTo> </ogc:Filter> </wfs:Query> </wfs:GetFeatureWithLock>
例15-8 GetFeatureWithLockのレスポンス
例15-8は、例15-7のリクエストに対するレスポンスです。
<wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs" lockId="1" xsi:schemaLocation="http://www.example.com/myns http://localhost:8888/SpatialWS-SpatialWS-context-root/wfsservlet?featureTypeId=1 " xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <gml:boundedBy xmlns:gml="http://www.opengis.net/gml"> <gml:Box srsName="SDO:8307"> <gml:coordinates>3.0,3.0 6.0,5.0</gml:coordinates> </gml:Box> </gml:boundedBy> <gml:featureMember xmlns:gml="http://www.opengis.net/gml"> <myns:COLA xmlns:myns="http://www.example.com/myns" fid="3"> <myns:MKT_ID>3</myns:MKT_ID> <myns:NAME>cola_c</myns:NAME> <myns:SHAPE> <gml:Polygon srsName="SDO:8307"> <gml:outerBoundaryIs> <gml:LinearRing> <gml:coordinates decimal="." cs="," ts=" ">3.0,3.0 6.0,3.0 6.0,5.0 4.0,5.0 3.0,3.0 </gml:coordinates> </gml:LinearRing> </gml:outerBoundaryIs> </gml:Polygon> </myns:SHAPE> </myns:COLA> </gml:featureMember> </wfs:FeatureCollection>
例15-9 LockFeatureリクエスト
例15-9は、MKT_ID値が2のフィーチャをロックするリクエストです。
<?xml version="1.0" ?> <wfs:LockFeature service="WFS" version="1.0.0" expiry="5" xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" xmlns:myns="http://www.example.com/myns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > <wfs:Lock typeName="myns:COLA"> <ogc:Filter> <ogc:PropertyIsEqualTo> <ogc:PropertyName>myns:COLA/myns:MKT_ID</ogc:PropertyName> <ogc:Literal> 2 </ogc:Literal> </ogc:PropertyIsEqualTo> </ogc:Filter> </wfs:Lock> </wfs:LockFeature>
例15-10 LockFeatureのレスポンス
例15-10は、例15-9のリクエストに対するレスポンスです。
<wfs:WFS_LockFeatureResponse xmlns:wfs="http://www.opengis.net/wfs"> <wfs:LockId>2</wfs:LockId> </wfs:WFS_LockFeatureResponse>
例15-11 Insertリクエスト
例15-11は、WFS
という名前のWFSサービスに関連付けられた表に、MKT_IDが5でNAMEがcola_e
のフィーチャを挿入するリクエストです。
<?xml version="1.0"?> <wfs:Transaction version="1.0.0" handle="TX01" service="WFS" xmlns="http://www.e xample.com/myns" xmlns:myns="http://www.example.com/myns" xmlns:gml="http://ww w.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:wfs="http://www. opengis.net/wfs" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > <wfs:Insert handle="INSERT01" > <myns:COLA fid="5" xmlns:myns="http://www.example.com/myns"> <myns:MKT_ID>5</myns:MKT_ID> <myns:NAME>cola_e</myns:NAME> <myns:SHAPE> <gml:Polygon srsName="SDO:8307" xmlns:gml="http://www.opengis.net/gml"> <gml:outerBoundaryIs> <gml:LinearRing> <gml:coordinates decimal="." cs="," ts=" ">1.0,3.0 6.0,3.0 6.0,5.0 4.0,5.0 1.0,3.0 </gml:coordinates> </gml:LinearRing> </gml:outerBoundaryIs> </gml:Polygon> </myns:SHAPE> </myns:COLA> </wfs:Insert> </wfs:Transaction>
例15-12 Insertのレスポンス
例15-12は、例15-11のリクエストに対するレスポンスです。
<?xml version = '1.0' encoding = 'UTF-8'?> <wfs:WFS_TransactionResponse version="1.0.0" xmlns:wfs="http://www.opengis.net/wfs"> <wfs:InsertResult handle="INSERT01"> <ogc:FeatureId fid="5" xmlns:ogc="http://www.opengis.net/ogc"/> </wfs:InsertResult> <wfs:TransactionResult handle="TX01"> <wfs:Status> <wfs:SUCCESS/> </wfs:Status> </wfs:TransactionResult> </wfs:WFS_TransactionResponse>
例15-13 Updateリクエスト
例15-13は、WFS
という名前のWFSサービスに関連付けられた表に含まれるフィーチャのうち、MKT_IDが2より大きく4より小さい、かつNAMEがNULL以外のフィーチャを更新するリクエストです。このリクエストには、指定したフィーチャのNAME値をcola_cl
に設定することが指定されています。
<?xml version="1.0"?> <wfs:Transaction version="1.0.0" handle="TX01" service="WFS" xmlns="http://www.example.com/myns" xmlns:myns="http://www.example.com/myns" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:wfs="http://www. opengis.net/wfs" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > <wfs:Update handle="UPDATE1" typeName="myns:COLA" > <wfs:Property> <wfs:Name>myns:COLA/myns:NAME</wfs:Name> <wfs:Value>cola_c1</wfs:Value> </wfs:Property> <ogc:Filter> <ogc:And> <ogc:And> <ogc:PropertyIsGreaterThan> <ogc:PropertyName>myns:COLA/myns:MKT_ID</ogc:PropertyName> <ogc:Literal> 2 </ogc:Literal> </ogc:PropertyIsGreaterThan> <ogc:PropertyIsLessThan> <ogc:PropertyName>myns:COLA/myns:MKT_ID</ogc:PropertyName> <ogc:Literal> 4 </ogc:Literal> </ogc:PropertyIsLessThan> </ogc:And> <ogc:Not> <ogc:PropertyIsNull> <ogc:PropertyName>myns:COLA/myns:NAME</ogc:PropertyName> </ogc:PropertyIsNull> </ogc:Not> </ogc:And> </ogc:Filter> </wfs:Update> </wfs:Transaction>
例15-14 Updateのレスポンス
例15-14は、例15-13のリクエストに対するレスポンスです。
<?xml version = '1.0' encoding = 'UTF-8'?> <wfs:WFS_TransactionResponse version="1.0.0" xmlns:wfs="http://www.opengis.net/wfs"> <wfs:TransactionResult handle="TX01"> <wfs:Status> <wfs:SUCCESS/> </wfs:Status> </wfs:TransactionResult> </wfs:WFS_TransactionResponse>
例15-15 Deleteリクエスト
例15-15は、WFS
という名前のWFSサービスに関連付けられた表に含まれるフィーチャのうち、MKT_IDが3より大きくNAMEがcola_e
のフィーチャおよびNAMEがNULL以外のフィーチャを削除するリクエストです。
<?xml version="1.0"?> <wfs:Transaction version="1.0.0" handle="TX01" service="WFS" xmlns="http://www.example.com/myns" xmlns:myns="http://www.example.com/myns" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:wfs="http://www. opengis.net/wfs" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > <wfs:Delete handle="DELETE1" typeName="myns:COLA" > <ogc:Filter> <ogc:And> <ogc:And> <ogc:PropertyIsGreaterThan> <ogc:PropertyName>myns:COLA/myns:MKT_ID</ogc:PropertyName> <ogc:Literal> 3 </ogc:Literal> </ogc:PropertyIsGreaterThan> <ogc:PropertyIsEqualTo> <ogc:PropertyName>myns:COLA/myns:NAME</ogc:PropertyName> <ogc:Literal> cola_e </ogc:Literal> </ogc:PropertyIsEqualTo> </ogc:And> <ogc:Not> <ogc:PropertyIsNull> <ogc:PropertyName>myns:COLA/myns:NAME</ogc:PropertyName> </ogc:PropertyIsNull> </ogc:Not> </ogc:And> </ogc:Filter> </wfs:Delete> </wfs:Transaction>
例15-16 Deleteのレスポンス
例15-16は、例15-15のリクエストに対するレスポンスです。
<?xml version = '1.0' encoding = 'UTF-8'?> <wfs:WFS_TransactionResponse version="1.0.0" xmlns:wfs="http://www.opengis.net/wfs"> <wfs:TransactionResult handle="TX01"> <wfs:Status> <wfs:SUCCESS/> </wfs:Status> </wfs:TransactionResult> </wfs:WFS_TransactionResponse>