Establishing a PostGIS database from UML with GISTools
GISTools is an Enterprise Architect plugin which enables one to establish a PostGIS database from a UML model.
A SOSI UML model can be used to generate all tables and columns in PostGIS. One can choose to use SOSI_name or UML/GML names in the database.
Installation requirements
PostGIS 2.0.x.
Step by step
- Database for PostGIS 2.0 or higher must be established
- Select the SOSI/Inspire UML model (acc. ISO 19109) one will establish a database for (the database itself must be created in advance with PostGIS 2.0 template and the extension uuid-ossp if uuid is chosen as datatype for primary key)
- Select Extensions -> GISTools for UML -> PostGIS -> Create Database ...
- Fill in the dialog with link to database and enter new database schema. One can choose to use SOSI names or UML/GML names in the database.
- Press Generate and the database is established (schemafile/script will be placed in a directory “postgis” at the same location as the EA (.eap) project file)
- If one chooses to validate the model, the "System Output" window will list all the rules/tests that run and any errors and warnings that are relevant to the PostGIS creation will be listed. See the list of validation rules with tests that are being run.
- Test the database with, for example, QGIS
- Set up mappings to GML or SOSI Syntax with Deegree mapping, FME mapping or Geoserver mapping.
Mapping rules
Tables
Classes (which are not abstract) with stereotype featuretype, type or none will become separate tables. In addition, datatypes which are a part of one-many or many-many relationships will also become a table (i.e. they will not be flattened). Inheritance is resolved by adding all inherited elements to subtypes. Classes must be in the same package under applicationSchema.
Flattening
Attributes that point to complex types, with max multiplicity 1, are flattened.
Multiple geometries in the same object
PostGIS supports several geometries in the same table.
Geometry
Supports conversion of PUNKT, KURVE, FLATE, SVERM, GM_Surface, GM_Multisurface, GM_Point, GM_Curve, GM_Multipoint
One can choose how strict restriction the database will require for geometry.
Associations and foreign keys / primary keys
System generated keys: Creates a surrogate key as the primary key (objid) in all tables. In the field Datatype for primary key, one can choose which type this should be.
Many to many relationships
A separate junction table is established for this.
Composition
Same as attribute with multiplicity of more than 1 but modeled as an association.
Topology
Not checked at the time.
Coordinate system
Selected coordinate system will be applied as restrictions in the tables