The result of the transformation from UML to relational model that is described in this section is a PSM, which is still a model. It is not the code to create the database with. Luckily, the PSM is closely linked to the relational database platform, and uses platform-specific concepts and constructs. From this model, it is easy to generate code. From the relational model, a pair of SQL scripts is generated. One script is for creating the tables and the other script for dropping the tables. We will examine the creation script only, because the drop script is very simple and does not add much value to the example. The transformation is rather straightforward because the structure and amount of detail of the relational model is already similar to the SQL language. The following rules are used to generate the SQL creation script from the Relation model.
Fragments of the generated code can be found in Appendix B. |