Oracle Database 10g Workspace Manager Support for Oracle Spatial Topology Data Model An Oracle White Paper May 2005
Contents Executive Overview... 3 Introduction... 3 Versioning a Topology... 4 Adding a Geometry Layer to a Versioned Topology... 5 Editing a Versioned Topology... 5 Merging, Refreshing, Rolling Back Topology Changes... 6 Conclusion... 6 Oracle Database 10g Workspace Manager Support for Oracle Spatial Topology Data Model Page 2
Oracle Database 10g Workspace Manager Support for Oracle Spatial Topology Data Model EXECUTIVE OVERVIEW Workspace Manager, a feature of Oracle Database, allows application developers and DBAs to version topologies stored in the Oracle Spatial topology data model. A workspace is a virtual environment in which to isolate a collection of changes to one or more topologies, keep a history of changes and create multiple topological scenarios for what if analysis in the same database. This can save money, time and labor over traditional approaches of managing versions. The Oracle Spatial topology data model manages data about nodes (points), edges (lines), and faces (polygons) in a topology. Topological relationships include such relationships as contains, inside, covers, covered by, touch, and overlap with boundaries intersecting. Topological relationships remain constant when features are edited or the coordinate space is deformed, such as by twisting or stretching. Topologies are useful when there is a high degree of feature editing and a strong requirement for data integrity across maps and map layers. Additionally, topology-based queries typically perform faster for queries involving relationships such as adjacency, connectivity, and containment. Land management (cadastral) systems and spatial data providers benefit from these capabilities. INTRODUCTION The Oracle Spatial topology data model and schema persistently store topology data in Oracle Database. Information about geometry layers and topological elements is stored in the following Oracle Spatial tables: One or more user-named feature tables <topology-name>_edge$ <topology-name>_node$ <topology-name>_face$ <topology-name>_relation$ <topology-name>_history$ Oracle Database 10g Workspace Manager Support for Oracle Spatial Topology Data Model Page 3
When a topology is versioned, the following mechanisms ensure that a valid view of the versioned topology is maintained for every workspace: A topology is versioned by a special form of the Workspace Manager EnableVersioning procedure. It versions all of the tables associated with a topology at the same time. Versioning is disabled on a topology in a similar fashion, using the DisableVersioning procedure. The Workspace Manager API includes a special form of the Spatial procedures that add and delete a topology geometry (feature) layer. The Workspace Manager procedures must be used (instead of the Spatial procedures) to add or delete a feature associated with versioned topology: Oracle Spatial allows one user at a time to edit topological elements contained in a window of interest. This prevents conflicts. The editing application must invoke the Workspace Manager lock rows procedure on the elements to be loaded into the editing window before loading them. When editing is finished, the Workspace Manager unlock rows procedure must be invoked to allow another user to edit the same topological elements. When changes to a versioned topology are merged, refreshed or rolled back, only Workspace level procedures can be used. Table level procedures are not supported. See the following Oracle Database 10g documentation, Application Developer's Guide - Workspace Manager and Spatial Topology and Network Data Models, for complete information on versioning and using the Oracle Spatial topology data model. VERSIONING A TOPOLOGY You must invoke the SDO_TOPO.INITIALIZE_METADATA procedure at least once on a topology before you version-enable the tables associated with the topology. The INITIALIZE_METADATA procedure creates or recreates sequences and indexes on edge, node, face, and relationship tables. (You can also invoke the SDO_TOPO.INITIALIZE_METADATA procedure as needed after version-enabling a topology.) A version-enabled topology must have at least one feature table. To versionenable a topology, you must specify the topology name as the table_name parameter to the EnableVersioning procedure, and you must specify the istopology parameter as TRUE. For example: EXECUTE DBMS_WM.EnableVersioning (table_name => 'xyz_topo', istopology => TRUE); Oracle Database 10g Workspace Manager Support for Oracle Spatial Topology Data Model Page 4
The preceding example version-enables the xyz_topo topology; that is, it version-enables all feature tables associated with the xyz_topo topology, as well as the XYZ_TOPO_NODE$, XYZ_TOPO_FACE$, XYZ_TOPO_EDGE$, XYZ_TOPO_RELATION$, and XYZ_TOPO_HISTORY$ tables. To disable versioning on any topology tables, you must disable versioning on all tables associated with the topology by specifying the topology name as the table_name parameter to the DisableVersioning procedure and the istopology parameter as TRUE. EXCEPTIONS Exceptions apply to the preceding guidelines about version-enabling and version-disabling topology tables in the following cases: If a feature table of a topology is the child table of a referential integrity constraint with CASCADE option with a table that is not in the topology If a feature table of a topology is the parent table of a referential integrity constraint with a table that is not in the topology In these cases, you must version-enable or version-disable the feature table separately. That is, first call the EnableVersioning or DisableVersioning procedure on the feature table (along with any tables required by the referential integrity constraint), and then invoke the EnableVersioning or DisableVersioning procedure specifying the topology name. ADDING A GEOMETRY LAYER TO A VERSIONED TOPOLOGY The Workspace Manager procedures that add or remove a topology geometry layer in a version-enabled topology are: DBMS_WM.ADD_TOPO_GEOMETRY_LAYER DBMS_WM.DELETE_TOPO_GEOMETRY_LAYER These procedures have the same format and meaning as the Spatial Topology procedures SDO_TOPO.ADD_TOPO_GEOMETRY_LAYER and SDO_TOPO.DELETE_TOPO_GEOMETRY_LAYER, which should be used with non-versioned topologies. EDITING A VERSIONED TOPOLOGY Pessimistic locking is used to edit version-enabled topologies. Before elements of a topology can be edited, the associated table rows must be locked. To edit the elements of a topology in a workspace (including the LIVE workspace), follow these steps: 1. Use the Workspace Manager procedure DBMS_WM.LOCKROWS to put version locks on all the elements of the topology contained in a window of interest. Oracle Database 10g Workspace Manager Support for Oracle Spatial Topology Data Model Page 5
2. Invoke the Oracle Spatial Topology Java client LoadWindow method for the same window of interest. To lock or unlock rows in tables associated with a topology, you must specify the topology name as the table_name parameter to the DBMS_WM.LOCKROWS or DBMS_WM.UNLOCKROWS procedure, and you must identify the window containing the rows by using the Xmin, Ymin, Xmax, and Ymax parameters. You must also not specify the where_clause parameter. For example: EXECUTE DBMS_WM.LockRows (workspace => 'ws1', table_name => 'xyz_topo', Xmin => 0.1, Ymin => 0.1, Xmax => 0.5, Ymax => 0.5 ); The preceding example puts version locks on all the rows of the specified topology contained in the specified window. MERGING, REFRESHING, ROLLING BACK TOPOLOGY CHANGES Use the MergeWorkspace, RefreshWorkspace, and RollbackWorkspace procedures to merge, refresh, or roll back tables associated with a topology. Do not use the MergeTable, RefreshTable, or RollbackTable procedure on a version-enabled table associated with a topology. CONCLUSION Workspace Manager can version topologies that are stored in the Oracle Spatial topology data model. Use workspaces to isolate a collection of changes to one or more topologies, keep a history of changes and create multiple topological scenarios for what if analysis in the same database. For technical information, software downloads and sample code go to: http://www.oracle.com/technology//products/workspace_mgr/index.html http://www.oracle.com/technology/products/spatial/index.html Oracle Database 10g Workspace Manager Support for Oracle Spatial Topology Data Model Page 6
Oracle Database 10g Workspace Manager Support for Oracle Spatial Topology Data Model May 2005 Author: Bill Beauregard Contributing Author: Chuck Murray Oracle Corporation World Headquarters 500 Oracle Parkway Redwood Shores, CA 94065 U.S.A. Worldwide Inquiries: Phone: +1.650.506.7000 Fax: +1.650.506.7200 oracle.com Copyright 2005, Oracle. All rights reserved. This document is provided for information purposes only and the contents hereof are subject to change without notice. This document is not warranted to be error-free, nor subject to any other warranties or conditions, whether expressed orally or implied in law, including implied warranties and conditions of merchantability or fitness for a particular purpose. We specifically disclaim any liability with respect to this document and no contractual obligations are formed either directly or indirectly by this document. This document may not be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without our prior written permission. Oracle, JD Edwards, and PeopleSoft are registered trademarks of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.