per introduces OMT-G Designer1, a Web-based free software tool developed for modeling ... We mention, for instance, Modul-R [5], GISER [6], GeoOOA [7],.
OMT-G Designer: A Web Tool for Modeling Geographic Databases in OMT-G Lu´ıs Eduardo Oliveira Lizardo and Clodoveu Augusto Davis Jr. Computer Science Department – Universidade Federal de Minas Gerais Belo Horizonte, Brazil {lizardo,clodoveu}@dcc.ufmg.br
Abstract. Data modeling tools are useful in software development and in database design. Some advanced modeling tools available in the market go beyond the data modeling process and allow the generation of source code or DDL scripts for RDBMSs based on the modeled schema. This work presents OMT-G Designer, a web tool for modeling geographic databases using OMT-G, an object-oriented data model for geographic applications. The tool provides various consistency checks on the integrity of the schema, and includes a function that maps OMT-G geographic conceptual schemas into physical schemas, including the necessary spatial integrity constraints. The tool was developed using free software and aims to increase the practical and academic uses of OMTG, by providing an open and platform-independent modeling resource. Keywords: OMT-G, Geographic Information Systems, Geographic Software Design, Spatial Database Modeling.
1
Introduction
Most data modeling activities nowadays use data modeling tools, aiming at software development and database design. Such tools reduce the development effort with a variety of features that provide the generation of source code and scripts for some database management systems (DBMS). There are many modeling tools available in the market, directed towards various data models, with a variety of features and prices, including commercial and free software. However, although some commercial modeling tools can be adapted for geographic database design, we notice that certain aspects are lacking, such as the treatment of spatial integrity constraints. Even though spatial database extensions have functions that would allow the implementation of the necessary constraints, manually programming constraint verification code with them is often tedious and repetitive, due to the lack of a specific support for such constraints in the DDL. Furthermore, semantic aspects can make it hard to automatically decide on the more adequate constraint implementation style, based on resources such as checks, assertions, and triggers. We covered this subject in previous work, first defining the means for extracting spatial integrity constraints from a geographic schema [1], and later creating a framework to generate code for M. Indulska and S. Purao (Eds.): ER Workshops 2014, LNCS 8823, pp. 228–233, 2014. © Springer International Publishing Switzerland 2014
OMT-G Designer: A Web Tool for Modeling Geographic Databases
229
that purpose [2], always based on OMT-G, an object-oriented UML-based data model for geographic applications [3]. Now, we merged these results into a Webbased modeling tool, so that more people can freely experiment and learn the subtle aspects of spatial data modeling, while generating useful code. This paper introduces OMT-G Designer1 , a Web-based free software tool developed for modeling geographic databases in OMT-G. It allows users to create geographic conceptual schemas and to map them to Oracle Spatial SQL schemas. The remainder of this paper is structured as follows. Section 2 describes related work. Section 3 describes OMT-G Designer. Section 4 presents a brief example of use. Finally, Section 5 presents our conclusions and lists future work.
2
Background and Related Work
The special nature of spatial data modeling has been noticed many years ago [4]. In the late 1990s and early 2000s, much work was directed towards creating and adapting existing models in order to accommodate the needs of geographic database design. We mention, for instance, Modul-R [5], GISER [6], GeoOOA [7], and GMOD [8], all of which are proposals of spatial data models. A decade later, the most active initiatives are UML-based. UML-GeoFrame [9], for instance, proposes using the extensiveness features of UML in order to accommodate spatial representations, geographic and topological relationships, and other modeling primitives. CASE tools have been proposed for UMLGeoFrame [9], based on previously existing free software, but leaving the mapping towards a physical implementation in charge of the modeler. OMT-G (Object Modeling Technique for Geographic Applications) is an object oriented data model for the design of geographic applications and geographic database systems. It provides primitives for modeling the geometric shape and location of geographic objects, supporting spatial and topological relationships, “whole-part” structures, networks, and multiple representations of objects and spatial relationships. Due to space limitations, we will not present OMT-G’s notation in detail here. For more information on the model, and for more detailed examples, see OMT-G Designer’s site1 . OMT-G considers eleven representation alternatives for geographic data: six for geo-objects (point, line, polygon, network node, uni- and bi-directional network arc), and five for geo-fields (isolines, tesselation, triangulation, sampling and planar subdivision). Relationships include simple association, spatial relationship, spatial aggregation, arc-node network relationship, generalization/specialization, and conceptual generalization, which allows modeling multiple representations for geographic objects. OMT-G is also UML-based [3], but opted for a modified notation and established a basis for the extraction of spatial integrity constraints [1]. Based on OMT-G’s definitions, we created methods to automate the mapping from a geographic conceptual schema to a physical schema, materialized as a script of table-creation statements and the associated spatial integrity constraints, implemented as checks, assertions and triggers. OMTG2SQL is a 1
http://aqui.io/omtg
230
L.E. Oliveira Lizardo and C.A. Davis Jr.
conceptual-physical mapping procedure introduced by Hora et al. [2]. Currently it supports mapping an OMT-G schema formatted in XML and generates a data definition language (DDL) file, a dynamic controls file and a static controls file, currently following Oracle Spatial’s syntax. The DDL file contains statements for creating tables, primary and foreign keys, spatial indexes and geometric constraints for the spatial classes. The static and dynamic control files implement spatial and non-spatial integrity constraints. The dynamic control file contains triggers that check the consistency of topological relationships, generalizations and user-defined spatial integrity constraints. The static control file contains functions to check the integrity of network relationships, spatial aggregations and geo-field classes. Code is generated from templates, which can be adapted and modified to accommodate other spatial DBMSs, considering that the spatial function sets in current OGC-compliant DBMSs are quite similar. Due to space limitations, we will not present the code templates in more detail (see [2]). OMT-G Designer, detailed in the next section, is the first tool that fully supports the OMT-G model up to the mapping to a spatial DBMS, by means of a Web-based modeling interface that implements consistency checks on the schema as it is created, and by incorporating OMTG2SQL.
3
OMT-G Designer
OMT-G Designer’s interface has three main parts: the tool palette, the menu and the canvas (Figure 1). The menu allows users to export their project to SQL, to import from and export to XML and also to print the schema. In the canvas, users develop their schema, adding classes and relationships chosen from the tool palette. Relationships, selected at the tool palette, can be inserted by clicking over the source class and dragging a line to the target class. Class and relationship attributes can be edited by double-clicking on the primitive. Following OMT-G semantics, some constraints apply to class diagrams, and our tool blocks invalid design constructions, as follows. Aggregations: Spatial aggregation cannot be used if conventional classes are involved; Associations: Simple associations can occur between classes of any representation type, but spatial associations only occur between georeferenced classes; Conceptual generalizations: The superclass must be non-geographic; Generalizations: Superclass and subclasses must be of the same representation type; Networks: Network relationships are only allowed between node and arc classes, or without nodes in a recursive relationship on the class that represents network segments. When a project is exported to SQL, an XML file containing an encoding of the schema is generated. This file is sent to the server to be validated and processed by OMTG2SQL, which maps the user’s conceptual schema to Oracle Spatial. The resulting code files are zipped and sent to the client for downloading. The same occurs when the schema is exported as an XML file for future importing. When a schema is imported from a XML file, the file is first sent to the server to be validated, and is later rendered by the browser on the client’s side.
OMT-G Designer: A Web Tool for Modeling Geographic Databases
4
231
Example
Figure 1 shows a schema fragment for a bus transportation network (nodes at bus stops and unidirectional arcs corresponding to route segments) that serves a set of school districts. A conventional class holds the attributes for the bus line. The schema embeds spatial integrity constraints for (1) the network relationship (each route segment must be related to two bus stops), (2) a “contains” relationship (bus stops cannot exist outside of a school district), and (3) the geometry of route segments and school districts (lines and polygons must be simple, i.e., with no self-intersections).
Fig. 1. OMT-G Designer’s interface with a sample schema fragment
After exporting the schema to SQL, three files are supplied. The first one contains DDL statements for creating the necessary tables and indexes, along with commands to update Oracle’s spatial metadata table, as shown next: -- Create table Bus_Stop CREATE TABLE Bus_Stop ( Stop_ID NUMBER(null,1), Shelter_type VARCHAR2(5), geom MDSYS.SDO_GEOMETRY, CONSTRAINT pk_Bus_Stop PRIMARY KEY (Stop_ID)); -- Insert the geom column of Bus_Stop into metadata table USER_SDO_GEOM_METADATA INSERT INTO USER_SDO_GEOM_METADATA (TABLE_NAME, COLUMN_NAME, DIMINFO, SRID) VALUES ('Bus_Stop', 'geom', MDSYS.SDO_DIM_ARRAY( MDSYS.SDO_DIM_ELEMENT('X', -180.000000000, 180.000000000, 0.005), MDSYS.SDO_DIM_ELEMENT('Y', -90.000000000, 90.000000000, 0.005)), '29100'); -- Create the spatial index on geom column of Bus_Stop CREATE INDEX SIDX_Bus_Stop ON Bus_Stop(geom) INDEXTYPE IS MDSYS.SPATIAL_INDEX PARAMETERS('SDO_INDX_DIMS=2,LAYER_GTYPE=POINT');
The second file contains PL/SQL code to verify constraint (1), i.e., the consistency of the network relationship. A function (val network Bus) checks connections at the endpoints of arcs, which must coincide with nodes. If the result is not exactly one node, an error message is generated and stored in a special table for future reference, as follows:
232
L.E. Oliveira Lizardo and C.A. Davis Jr.
-- Validate the network between the Bus_Route_Segment and Bus_Stop CREATE OR REPLACE FUNCTION val_network_Bus_Bus BEGIN FOR reg IN (SELECT rowid, geom FROM Bus_Route_Segment) LOOP p_geom_initial_vertex := get_point(reg.geom); p_geom_final_vertex := get_point(reg.geom, SDO_UTIL.GETNUMVERTICES(reg.geom)); BEGIN SELECT rowid INTO p_rowid_initial_vertex FROM Bus_Stop WHERE MDSYS. SDO_EQUAL(geom, p_geom_initial_vertex) = 'TRUE'; END; BEGIN SELECT rowid INTO p_rowid_final_vertex FROM Bus_Stop WHERE MDSYS. SDO_EQUAL(geom, p_geom_final_vertex) = 'TRUE'; END; END LOOP; FOR reg IN (SELECT rowid FROM Bus_Stop) LOOP BEGIN SELECT a.rowid INTO p_rowid_point FROM Bus_Route_Segment a, Bus_Stop n WHERE (MDSYS.SDO_EQUAL(n.geom, get_point(a.geom)) = 'TRUE' OR MDSYS. SDO_EQUAL(n.geom, get_point(a.geom, SDO_UTIL.GETNUMVERTICES(a.geom))) = ' TRUE') AND reg.rowid = n.rowid AND rownum