Oracle® Spatial Developer's Guide 11g Release 2 (11.2) Part Number E11830-11 |
|
|
PDF · Mobi · ePub |
This chapter describes Web Feature Service (WFS) support in Oracle Spatial It includes the following major sections:
Note:
Before you use WFS, be sure that you understand the concepts described in Chapter 10, "Introduction to Spatial Web Services", and that you have performed any necessary configuration work as described in that chapter.If you have data from a previous release that was indexed using one or more SYS.XMLTABLEINDEX indexes, you must drop the associated indexes before the upgrade and re-create the indexes after the upgrade, as described in Section A.2.
This section describes the Web Feature Service engine, including its relationship to clients and to the database server. WFS is implemented as a Web service and can be deployed in a WebLogic Server, Oracle Application Server, or standalone Oracle Application Server Containers for J2EE (OC4J) environment.
WFS has a metadata layer, which stores in the database the metadata needed to reply to the WFS requests. The metadata includes spatial columns, which can be queried and processed using Oracle Spatial interfaces. The metadata also stores the association of nonspatial and spatial attributes of features, as well as the services that the Web Feature Service provides to its clients.
Figure 15-1 shows the WFS architecture.
Figure 15-1 Web Feature Service Architecture
As shown in Figure 15-1:
WFS is part of the middle tier, and includes a WFS server API and a feature cache.
WFS can communicate with a Web service client using WFS requests and responses in SOAP/XML format.
WFS performs spatial data and metadata access through JDBC calls to the database.
The database includes Oracle Spatial with WFS metadata and data, and with PL/SQL packages for administrative operations (see Chapter 34, "SDO_WFS_PROCESS Package (WFS Processing)" and Chapter 33, "SDO_WFS_LOCK Package (WFS)").
Web Service Security (WSS) is implemented using secure transport. User identities and user labels are managed in LDAP, and the middle tier and WSS combine to perform authentication. Oracle label-based security is used for managing user privileges at the feature level. For more information about WSS, see Chapter 17.
WFS supports relational and document-based feature types:
Relational feature types expose the content of database tables as feature instances. Relational feature types are well suited for those who use Oracle Spatial to manage their geospatial data and use Oracle Database to manage other business data. The Spatial WFS implementation provides ways to access the data, especially in service-oriented architecture (SOA) systems implemented using Web services.
Use PL/SQL application programming interfaces (APIs) to manage relational feature types. The PL/SQL packages SDO_WFS_LOCK and SDO_WFS_PROCESS (described in Chapter 33 and Chapter 34, respectively) enable you to manage relational feature types.
Document-based feature types expose XML schema-based XML content as feature instances. Document-based feature types are well suited for those who use XML as their main data source and who might not currently use Oracle Spatial with such data. For this data, the Spatial WFS implementation extracts the geometry components and stores them using the SDO_GEOMETRY type; it stores the remaining XML components in Oracle XDB and builds appropriate XMLIndex indexes for them.
Use Java APIs (described in Section 15.4) to manage document-based feature types.
These APIs enable you to perform operations that include:
Publishing feature types
Dropping (unpublishing) feature types
Granting to users and revoking from users privileges of WFS metadata and feature types
For relational feature types: lock-enabling and lock-disabling feature tables (with lock-enabling on by default for document-based feature types)
A capabilities document describes an instance of a capability. The document specifies a feature type (such as roads or rivers) and the type of operations supported (such as insert and delete).
A capabilities document is generated by the WFS server in response to a GetCapabilities request. The WFS server uses a capabilities template, and adds information about the feature type and operations to this template to create the capabilities document.
The client can use the HTTP GET method to access this capabilities document using either the SOAP interface or the XML interface:
For the SOAP interface, use oracle.spatial.ws.servlet.WFSServlet,
which can be accessed at an address in the following format:
http://machine-name:port/SpatialWS-SpatialWS-context-root/wfsservlet?request=GetCapabilities&service=WFS&version=1.0.0
For the XML interface, use oracle.spatial.ws.servlet.WFSXMLServlet
, which can be accessed at an address in the following format:
http://machine-name:port/SpatialWS-SpatialWS-context-root/xmlwfsservlet?request=GetCapabilities&service=WFS&version=1.0.0
In the preceding formats:
machine-name is the name of the system where the application server or OC4J server is running.
port is the port number where the application server or OC4J server is running.
SpatialWS-SpatialWS-context-root is the default root where the Spatial Web services application is mounted.
wfsservlet is the servlet-mapping url-pattern
for oracle.spatial.ws.servlet.WFSServlet
, as specified by default in the web.xml
file.
xmlwfsservlet is the servlet-mapping url-pattern
for oracle.spatial.ws.servlet.WFSXMLServlet
, as specified by default in the web.xml
file.
This section presents some feature requests to the WFS engine, and the response to each request, for each of the following operations:
GetCapabilities
DescribeFeatureType
GetFeature
GetFeatureWithLock
LockFeature
Transaction, with a subelement specifying the transaction type:
Insert
Update
Delete
The XML request and response formats are similar for both relational and document-based features. Several examples in this section refer to relational features based on the COLA_MARKETS_CS table used in Example 6-17 in Section 6.13, where the MKT_ID column contains the unique numeric ID of each feature, the NAME column contains each feature's name (cola_a
, cola_b
, cola_c
, or cola_d
), and the SHAPE column contains the geometry associated with each feature.
Example 15-1 is a request to get the capabilities of the WFS server named WFS at a specified namespace URL. T.his request will return a capabilities document, as explained in Section 15.2.1
Example 15-1 GetCapabilities Request
<?xml version="1.0" ?> <GetCapabilities service="WFS" version="1.0.0" xmlns="http://www.opengis.net/wfs" />
Example 15-2 is an excerpt of the response from the request in Example 15-1.
Example 15-2 GetCapabilities Response
<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>
Example 15-3 is a request to describe the feature type named COLA
.
Example 15-3 DescribeFeatureType Request
<?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>
Example 15-4 is the response from the request in Example 15-3. The response is an XML schema definition (XSD).
Example 15-4 DescribeFeatureType Response
<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>
Example 15-5 is a request to get the MKT_ID, NAME, and SHAPE properties of the feature or features of type COLA where the MKT_ID value is greater than 2 and the NAME value is equal to cola_c
, or where the MKT_ID value is greater than 3 and the NAME value is equal to cola_d
.
Note:
For GetFeature and GetFeatureWithLock, the<Query>
and <PropertyName>
elements, which list the property names to be selected, can be any top-level element of the queried feature type, in which case its entire content (which may be nested) is returned in the query response. XPaths of arbitrary depth are not supported in <PropertyName>
elements directly under the <Query>
element; however, they are supported in <PropertyName>
elements in a <Filter>
element under the <Query>
element, as shown in Example 15-5 and Example 15-7.Example 15-5 GetFeature Request
<?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>
Example 15-6 is the response from the request in Example 15-5.
Example 15-6 GetFeature Response
<?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>
Example 15-7 is a request to get the MKT_ID, NAME, and SHAPE properties of the feature of type COLA where the MKT_ID value is greater than 2 and the NAME value is equal to cola_c
, or where the MKT_ID value is equal to 3, and to lock that feature.
Example 15-7 GetFeatureWithLock Request
<?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>
Example 15-8 is the response from the request in Example 15-7.
Example 15-8 GetFeatureWithLock Response
<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>
Example 15-9 is a request to lock the feature where the MKT_ID value is equal to 2.
Example 15-9 LockFeature Request
<?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>
Example 15-10 is the response from the request in Example 15-9.
Example 15-10 LockFeature Response
<wfs:WFS_LockFeatureResponse xmlns:wfs="http://www.opengis.net/wfs"> <wfs:LockId>2</wfs:LockId> </wfs:WFS_LockFeatureResponse>
Example 15-11 is a request to insert a feature, with MKT_ID = 5 and NAME = cola_e
, into the table associated with the WFS service named WFS
.
<?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>
Example 15-12 is the response from the request in Example 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>
Example 15-13 is a request to update the feature, where MKT_ID is greater than 2 and less than 4 and where NAME is not null, in the table associated with the WFS service named WFS
. This request specifies that the NAME value of the specified feature is to be set to 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>
Example 15-14 is the response from the request in Example 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>
Example 15-15 is a request to delete the feature, where MKT_ID is greater than 3 and NAME is equal to cola_e
and is not null, in the table associated with the WFS service named WFS
.
<?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>
Example 15-16 is the response from the request in Example 15-15.
In addition to the PL/SQL APIs in the SDO_WFS_PROCESS and SDO_WFS_LOCK packages, you can use a Java API to publish and drop feature types, and to grant and revoke access to feature types and WFS metadata tables.
This section provides basic reference information about the methods in the oracle.spatial.wfs.WFSAdmin
class. The methods are presented in alphabetical order.
The createXMLTableIndex
method creates an index of XDB.XMLINDEX on document-based feature type instances. This method has the following format:
public static void createXMLTableIndex( OracleConnection conn, String ftNSUrl, String ftName) throws SQLException;
conn
is an Oracle Database connection for a user that has been granted the DBA role.
ftNSUrl
is the URL of the namespace of the feature type.
ftName
is the name of the feature type.
The dropFeatureType
method deletes a feature type from the WFS repository. This method has the following format:
public static void dropFeatureType( OracleConnection conn, String ftNSUrl, String ftName) throws SQLException;
conn
is an Oracle Database connection for a user that has been granted the DBA role.
ftNSUrl
is the URL of the namespace of the feature type.
ftName
is the name of the feature type.
The dropXMLTableIndex
method drops an index of type XDB.XMLINDEX that was created on document-based feature type instances. This method has the following format:
public static void dropXMLTableIndex( OracleConnection conn, String ftNSUrl, String ftName) throws SQLException;
conn
is an Oracle Database connection for a user that has been granted the DBA role.
ftNSUrl
is the URL of the namespace of the feature type.
ftName
is the name of the feature type.
The getIsXMLTableIndexCreated
method returns a Boolean TRUE
if an index of type XDB.XMLINDEX has been created on a document-based feature type, or a Boolean FALSE
if such an index has not been created. This method has the following format:
public static boolean getIsXMLTableIndexCreated( OracleConnection conn, String ftNSUrl, String ftName) throws SQLException;
conn
is an Oracle Database connection for a user that has been granted the DBA role.
ftNSUrl
is the URL of the namespace of the feature type.
ftName
is the name of the feature type.
The grantFeatureTypeToUser
method grants access to a feature type to a database user. This method has the following format:
public static void grantFeatureTypeToUser( OracleConnection conn, String typeNS, String typeName, String usrName) throws SQLException;
conn
is an Oracle Database connection for a user that has been granted the DBA role.
typeNS
is the URL of the namespace of the feature type.
typeName
is the name of the feature type.
usrName
is the name of the database user.
The grantMDAccessToUser
method grants access to the WFS metadata to a database user. This method has the following format:
public static void grantMDAccessToUser( OracleConnection conn, String usrName) throws SQLException;
conn
is an Oracle Database connection for a user that has been granted the DBA role.
usrName
is the name of the database user.
The publishFeatureType
method publishes a document-based feature type; that is, it registers metadata related to the feature type. This method has the following formats:
public static void publishFeatureType(OracleConnection conn, XMLType featureTypeMD) throws SQLException , WFSException; public static void publishFeatureType(OracleConnection conn, XMLType schemaDocXt, XMLType featureDescXt, ArrayList<String> docIdPaths, String primarySpatialPath, String featureMemberNS, String featureMemberName, String ftNSUrl, String ftName, ArrayList<PathInfo> spatialPaths, ArrayList<PathInfo> mandatoryPaths, ArrayList<PathInfo> tsPaths, ArrayList<GeomMetaInfo> sdoMetaInfo, String srsNS, String srsNSAlias) throws SQLException; public static void publishFeatureType(OracleConnection conn, XMLType schemaDocXt, XMLType featureDescXt, ArrayList<String> docIdPaths, String primarySpatialPath, String featureMemberNS, String featureMemberName, String ftNSUrl, String ftName, ArrayList<PathInfo> spatialPaths, ArrayList<PathInfo> mandatoryPaths, ArrayList<PathInfo> tsPaths, ArrayList<GeomMetaInfo> sdoMetaInfo, String srsNS, String srsNSAlias, String ftXSDRefId) throws SQLException; public static void publishFeatureType(OracleConnection conn, XMLType schemaDocXt, XMLType featureDescXt, ArrayList<String> docIdPaths, String primarySpatialPath, String featureMemberNS, String featureMemberName, String ftNSUrl, String ftName, ArrayList<PathInfo> spatialPaths, ArrayList<PathInfo> mandatoryPaths, ArrayList<PathInfo> tsPaths, ArrayList<GeomMetaInfo> sdoMetaInfo, String srsNS, String srsNSAlias, String ftXSDRefId, boolean genSpatialIndex, boolean lockEnable) throws SQLException; public static void publishFeatureType(OracleConnection conn, XMLType schemaDocXt, XMLType featureDescXt, ArrayList<String> docIdPaths, String primarySpatialPath, String featureMemberNS, String featureMemberName, String ftNSUrl, String ftName, ArrayList<PathInfo> spatialPaths, ArrayList<PathInfo> mandatoryPaths, ArrayList<PathInfo> tsPaths, ArrayList<GeomMetaInfo> sdoMetaInfo, String srsNS, String srsNSAlias, String ftXSDRefId, boolean genSpatialIndex, boolean lockEnable, ArrayList<PathInfo> numPaths, ArrayList<PathInfo> idxPaths, ArrayList<String[]> idxPathTypes, boolean genXMLIndex) throws SQLException; public static void publishFeatureType(OracleConnection conn, XMLType schemaDocXt, XMLType featureDescXt, ArrayList<String> docIdPaths, String primarySpatialPath, String featureMemberNS, String featureMemberName, String ftNSUrl, String ftName, ArrayList<PathInfo> spatialPaths, ArrayList<PathInfo> mandatoryPaths, ArrayList<PathInfo> tsPaths, ArrayList<GeomMetaInfo> sdoMetaInfo, String srsNS, String srsNSAlias, String ftXSDRefId, boolean genSpatialIndex, boolean lockEnable, ArrayList<PathInfo> numPaths, ArrayList<PathInfo> idxPaths, ArrayList<String[]> idxPathTypes, boolean genXMLIndex, String featureCollectionNS, String featureCollectionName, boolean isGML3) throws SQLException; public static void publishFeatureType(OracleConnection conn, XMLType schemaDocXt, XMLType featureDescXt, ArrayList<String> docIdPaths, String primarySpatialPath, String featureMemberNS, String featureMemberName, String ftNSUrl, String ftName, ArrayList<PathInfo> spatialPaths, ArrayList<PathInfo> mandatoryPaths, ArrayList<PathInfo> tsPaths, ArrayList<GeomMetaInfo> sdoMetaInfo, String srsNS, String srsNSAlias, String ftXSDRefId, boolean genSpatialIndex, boolean lockEnable, ArrayList<PathInfo> numPaths, ArrayList<PathInfo> idxPaths, ArrayList<String[]> idxPathTypes, boolean genXMLIndex, String featureCollectionNS, String featureCollectionName, boolean isGML3, CollectionPathInfo collPathInfo) throws SQLException; public static void publishFeatureType(OracleConnection conn, XMLType schemaDocXt, XMLType featureDescXt, ArrayList<String> docIdPaths, String primarySpatialPath, String featureMemberNS, String featureMemberName, String ftNSUrl, String ftName, ArrayList<PathInfo> spatialPaths, ArrayList<PathInfo> mandatoryPaths, ArrayList<PathInfo> tsPaths, ArrayList<GeomMetaInfo> sdoMetaInfo, String srsNS, String srsNSAlias, String ftXSDRefId, boolean genSpatialIndex, boolean lockEnable, ArrayList<PathInfo> numPaths, ArrayList<PathInfo> idxPaths, ArrayList<String[]> idxPathTypes, boolean genXMLIndex, String featureCollectionNS, String featureCollectionName, boolean isGML3, CollectionPathInfo collPathInfo, boolean hasMultipleSRSNS) throws SQLException;
conn
is an Oracle Database connection for a user that has been granted the DBA role.
featureTypeMD
is the feature type path registration metadata. This metadata must conform to the featureTypeMd
element definition as specified in the wstype_md.xsd
file. An example of feature type path registration metadata XML is provided in ft_metadata.xml
. These files are included in the ws_client.jar
demo file (described in Section 10.4) under the src/data/
path. For information about using the example to publish a feature type, see the Readme.txt
file, which is included in ws_client.jar
under the src/
path.
schemaDocXt
is the XML schema definition (XSD) of the feature type.
featureDescXt
is the XML schema definition (XSD) of the feature type description, to be included in the Capabilities
document.
docIdPaths
is a list of document ID path elements where each element is a String.
primarySpatialPath
is the primary spatial path that will be used to compute the bounding box in the result.
featureMemberNS
is the namespace of the feature member.
featureMemberName
is the name of the feature member.
ftNSUrl
is the URL of the namespace of the feature type.
ftName
is the name of the feature type.
spatialPaths
is a list of spatial paths in the feature type. It is an ArrayList
of class oracle.spatial.ws.PathInfo
, which is described in Section 15.4.7.1.
mandatoryPaths
is a list of mandatory paths in the feature type. It is an ArrayList
of class oracle.spatial.ws.PathInfo
, which is described in Section 15.4.7.1.
tsPaths
is a list of time-related paths in the feature type (for example, date
, dateTime
, gYear
, gMonth
, gDay
, gMonthDay
, and gYearMonth
). It is an ArrayList
of class oracle.spatial.ws.PathInfo
, which is described in Section 15.4.7.1.
sdoMetaInfo
is the spatial metadata information for spatial paths. It is an ArrayList
of class oracle.spatial.ws.GeomMetaInfo
, which is described in Section 15.4.7.1.
srsNS
is the user-defined namespace of the spatial reference system (coordinate system) associated with the data in the spatial paths. This namespace (if specified) is also used to generate the srsName
attribute in the <boundedBy>
element of the FeatureCollection result generated for the GetFeature request.
srsNSAlias
is the namespace alias of the spatial reference system (coordinate system) associated with the data in the spatial paths.
ftXSDRefId
is the group feature type XML schema definition file name (as a string), for cases where multiple feature types are defined in a single XSD file. This parameter is used to store the group XSD definition once in the WFS metadata, and then refer to it from multiple feature types whose schema definitions are present in the group feature type XSD file.
genSpatialIndex
is a Boolean value: TRUE
causes a spatial index to be created on the feature type at type creation time; FALSE
does not cause a spatial index to be created.
lockEnable
is a Boolean value: TRUE
causes the feature type table (the underlying system-generated table where instances of this feature type are stored) to be lock-enabled at type creation time; FALSE
does not cause the feature type table to be lock-enabled. If lockEnable
is TRUE
, this will WFS-transaction lock enable the WFS data table for the feature type. (This data table is automatically generated when the feature type is published.)
numPaths
is a list of numeric (NUMBER, INTEGER, and so on) related paths in the feature type. It is an ArrayList
of class oracle.spatial.ws.PathInfo
, which is described in Section 15.4.7.1.
idxPaths
is the index path list. It is list of paths on which to create an index of type XDB.XMLINDEX when that index is created. It is an ArrayList
of class oracle.spatial.ws.PathInfo
, which is described in Section 15.4.7.1.
idxPathTypes
specifies information about each index path, where each element of string[3] contains the following: string[0] is the type name, string[1] is the type format (such as the type length), and string[2] specifies whether a Btree or unique index, or no index, should be created (WFSAdmin.BTREE
, WFSAdmin.UNIQUE
, or null).
genXMLIndex
is a Boolean value: TRUE
causes an index of type XDB.XMLINDEX to be created on the document-based feature type; FALSE
does not cause an index of type XDB.XMLINDEX to be created on the document-based feature type. If you choose not to create the index now, you can create it later using the createXMLTableIndex
method (described in Section 15.4.1).
featureCollectionNS
is the namespace of the feature collection.
featureCollectionName
is the name of the feature collection.
isGML3
is a Boolean value: TRUE
means that the geometries inside instances of this feature type are GML3.1.1 compliant; FALSE
means that the geometries inside instances of this feature type are GML 2.1.2 compliant.
collPathInfo
is spatial collection path information.
hasMultipleSRSNS
is a Boolean value: TRUE
means that this feature type refers to multiple user-defined spatial reference system namespaces; FALSE
means that this feature type does not refer to multiple user-defined spatial reference system namespaces.
This section describes some classes used in the definition of parameters of the publishFeatureType method.
oracle.spatial.ws.PathElement
is a Java class that contains a pair of String objects: the PathElement
namespace am the PathElement
name. This class includes the getValue()
method, which returns a string format of the PathElement
object. This class has the following format:
public class PathElement { // Set namespace and name information for a PathElement. public void set(String ns, String name); //Get a string value for the PathElement object. public String getValue() ; }
oracle.spatial.ws.Path
is a Java class that contains an ordered list of PathElement
objects that constitute the path. For example, if an XPath is myns:A/myns:B
, then myns:A
and myns:B
are PathElement
objects. This class includes the getValue()
method, which returns a string format of the Path
object. This class has the following format:
public class Path { //Add a PathElement. public void add(PathElement p) ; //Get a string Value for the Path object. public String getValue() ; }
oracle.spatial.ws.PathInfo
is a container class that contains information about a path or list of paths, including their association and metadata information. This class has the following format:
public class PathInfo { // Set number of occurrences for the Path. Default value is 1. Number of // occurrences > 1 in case of arrays. public void setNumOfOccurrences(int i) ; // Get number of occurrences for the Path. public int getNumOfOccurrences(); // Add a path, in case PathInfo has multiple paths associated via a // choice association public void addPath(Path p) ; // Add path type information. This is relevant for time-related Paths // (for example, date, dateTime, gDay, gMonth, gYear, gMonthDay, // gYearMonth, duration, or time). public void addPathType(String t) ; // Add a PathInfo type. This can be PathInfo.CHOICE or // PathInfo.DEFAULT or PathInfo.COLLECTION. // PathInfo.CHOICE - means that the list of paths in this PathInfo are // related to each other via choice association. For example, we may have // a list of Spatial Paths, which are associated with one another via choice. // So, only one of these path can occur in a feature instance/document. // PathInfo.COLLECTION - means the list of paths in this PathInfo are part // of a collection (currently spatial collections are // supported) which will be indexed. // Default value is PathInfo.DEFAULT for one Path or a finite array Paths. // @param t PathInfo type information. PathInfo.CHOICE or // PathInfo.DEFAULT or PathInfo.COLLECTION public void addPathInfoType(int t) ; // Returns a string representation for PathInfo content. public String getPathContent() ; // Returns Path type information (for example, date, dateTime, gDay, gMonth, // gYear, gMonthDay, gYearMonth, duration, or time). public String getPathType() ; // Returns a string representation for PathInfo path content. // param i The index of the path in the PathInfo whose path content needs to // be returned // @return a string representation for PathInfo path content public String getCollectionPathContent(int i); // Returns number of paths in the PathInfo. // @return number of paths in the PathInfo which is of type PathInfo.COLLECTION // if PathInfo is not of type PathInfo.COLLECTION returns -1 public int getCollectionPathContentSize(); }
oracle.spatial.ws.CollectionPathInfo
is a container class that contains information about a collection of PathInfo objects. Each PathInfo object in this collection, represents a group of spatial paths that will be indexed and searched on. This class will be used to register paths referring to spatial collection-based content in feature and record types. This class has the following format:
public class CollectionPathInfo { /** * Add a PathInfo. * @param p PathInfo to be added * @param g geometry related metadata for PathInfo to be added */ public void addPathInfo(PathInfo p, GeomMetaInfo g) ; /** * Get a PathInfo. * @param i index of the PathInfo to be retrieved */ public PathInfo getPathInfo(int i) ; /** * Get geometry related metadata for a certain PathInfo. * @param i index of the PathInfo whose geomMetaInfo is to be retrieved */ public GeomMetaInfo getGeomMetaInfo(int i) ; /** * Get all PathInfo objects in this CollectionPathInfo. */ public ArrayList<PathInfo> getPathInfos() ; }
oracle.spatial.ws.GeomMetaInfo
is a class that contains dimension-related information corresponding to a spatial path in a feature type. This information includes the dimension name, the lower and upper bounds, the tolerance, and the coordinate system (SRID). This class has the following format:
public class GeomMetaInfo { // Default constructor. Creates a GeomMetaInfo object with number of // dimensions equal to 2. public GeomMetaInfo() ; // Creates a GeomMetaInfo object of a specified number of dimensions. // Parameter numOfDimensions is the number of dimensions represented // in the GeomMetaInfo object. // Note: max number of dimensions supported is 4. public GeomMetaInfo(int numOfDimensions) throws ArrayIndexOutOfBoundsException ; //Set Dimension Name. // Parameter index represents the dimension index which needs to be set. // Parameter val is dimension name value. public void setDimName(int index, String val) throws ArrayIndexOutOfBoundsException ; // Set Dimension Lower Bound. // Parameter index represents the dimension index which needs to be set. // Parameter val is dimension lower bound value. public void setLB(int index, double val) throws ArrayIndexOutOfBoundsException ; // Set Dimension Upper Bound // Parameter index represents the dimension index which needs to be set. // Parameter val is dimension upper bound value public void setUB(int index, double val) throws ArrayIndexOutOfBoundsException ; // Set Dimension tolerance value. // Parameter index represents the dimension index which needs to be set. // Parameter val is dimension tolerance value. public void setTolerance(int index, double val) throws ArrayIndexOutOfBoundsException ; // Set Coordinate Reference System Identifier public void setSRID (int val) ; // Get dimension Name. // Parameter index represents the dimension index whose name needs to be // returned. This method returns the dimension name for the given index. public String getDimName(int index) throws ArrayIndexOutOfBoundsException ; // Get dimension lower bound. // Parameter index represents the dimension index whose lower bound needs // to be returned. // This method returns the lower bound for the given index. public double getLB(int index) throws ArrayIndexOutOfBoundsException ; // Get dimension upper bound. // Parameter index represents the dimension index whose upper bound needs // to be returned. // This method returns the upper bound for the given index. public double getUB(int index) throws ArrayIndexOutOfBoundsException ; // Get dimension tolerance. // Parameter index represents the dimension index whose tolerance needs // to be returned. // This method returns the tolerance value for the given index. public double getTolerance(int index) throws ArrayIndexOutOfBoundsException ; // Get coordinate system (spatial reference system) identifier. public int getSRID () ; // Get number of dimensions represented by this GeomMetaInfo object. public int getNumOfDimensions() ; // Sets the spatial index dimension parameter. By default it is 2. // return Coordinate Reference System Identifier value public int setSpatialIndexDimension(int d) ; // Get the spatial index dimension parameter. // return number of dimensions public int getSpatialIndexDimension() ; // Sets the user spatial srs namespace refered by this GeomMetaInfo object. // Needs to be specified if multiple srs namespace are refered within the same //feature or record type. public void setSRSNS(String s) ; // Gets the user defined spatial srs namespace refered by this // GeomMetaInfo object. public String getSRSNS() ; // Sets the user defined spatial srs namespace alias refered by this // GeomMetaInfo object. public void setSRSNSAlias (String s) ; // Gets the user defined spatial srs namespace alias refered by this // GeomMetaInfo object. public String getSRSNSAlias () ; }
The revokeFeatureTypeFromUser
method revokes access to a feature type from a database user. This method has the following format:
public static void revokeFeatureTypeFromUser( OracleConnection conn, String typeNS, String typeName, String usrName) throws SQLException;
conn
is an Oracle Database connection for a user that has been granted the DBA role.
typeNS
is the URL of the namespace of the feature type.
typeName
is the name of the feature type.
usrName
is the name of the database user.
The revokeMDAccessFromUser
method revokes access to the WFS metadata from a database user. This method has the following format:
public static void revokeMDAccessFromUser( OracleConnection conn, String usrName) throws SQLException;
conn
is an Oracle Database connection for a user that has been granted the DBA role.
usrName
is the name of the database user.
The setXMLTableIndexInfo
method updates the XMLTableIndex index information for a document-based feature type, with the option of creating the index. This method has the following format:
Note:
If the XMLTableIndex index already exists, you must drop it (using the dropXMLTableIndex method) before you call thesetXMLTableIndexInfo
method.public static void setXMLTableIndexInfo(OracleConnection conn, String ftNSUrl, String ftName, ArrayList<PathInfo> idxPaths, ArrayList<String[]> idxPathTypes, boolean genXMLIndex) throws SQLException , WFSException;
conn
is an Oracle Database connection for a user that has been granted the DBA role.
ftNSUrl
is the URL of the namespace of the feature type.
ftName
is the name of the feature type.
idxPaths
is the index path list. It is list of paths on which to create an index of type XDB.XMLINDEX when that index is created. It is an ArrayList
of class oracle.spatial.ws.PathInfo
, which is described in Section 15.4.7.1.
idxPathTypes
specifies information about each index path, where each element of string[3] contains the following: string[0] is the type name, string[1] is the type format (such as the type length), and string[2] specifies whether a Btree or unique index, or no index, should be created (WFSAdmin.BTREE
, WFSAdmin.UNIQUE
, or null).
genXMLIndex
is a Boolean value: TRUE
causes an index of type XDB.XMLINDEX to be created on the document-based feature type; FALSE
does not cause an index of type XDB.XMLINDEX to be created on the document-based feature type. If you choose not to create the index now, you can create it later using the createXMLTableIndex
method (described in Section 15.4.1).
You can use Oracle Workspace Manager to version-enable a WFS table with relational features. To do so, first register the WFS table using the SDO_WFS_LOCK.RegisterFeatureTable procedure; then execute the DBMS_WM.EnableVersioning procedure. (For information about Workspace Manager, including reference documentation for the DBMS_WM PL/SQL package, see Oracle Database Workspace Manager Developer's Guide.)
You can create workspaces and perform transactional WFS changes to these workspaces by using the WFS-T (Web Feature Services transaction) interfaces. However, to use interfaces other than WFS-T, you must use a SQL*Plus session for which database transactions are enabled on the WFS tables. These database transactions include the following:
Update and delete operations on WFS tables
Workspace maintenance operations, such as refreshing a workspace or merging workspaces
To enable database transactions on the WFS tables, call the SDO_WFS_LOCK.EnableDBTxns procedure (documented in Chapter 33). After you execute this procedure, database transactions are permitted on the WFS tables and WFS-T semantics are maintained for WFS transactions, until the end of the session.