Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate Relational Model from UML Class Model?

Does anyone know an application (Enterprise Architect, ...) that allows mapping from UML Class Model to Database Relational Model automatically? How?

Thanks

like image 756
notGeek Avatar asked Dec 10 '22 10:12

notGeek


2 Answers

Further to what the others have said, Enterprise Architect supports model transformations from UML class models to Database relational models. It does this automatically.

To do this, right click on the package that contains your Class Model and select "Transform Current Package" [Ctrl + Shift + H]. Select DDL as your transformation and give it a Target Package (by clicking the [...] button.

Once you hit the go button Enterprise Architect will perform the translation which will give you the Relationship model. You will now be able to set your desired database language and use Enterprise Archtiect's code generation feature to generate the SQL scrips needed to setup the DB.

I hope this helps!

like image 154
TomO Avatar answered Jan 09 '23 21:01

TomO


Enterprise Architect and myriad other tools will allow you to generate DDL from UML models. (Note: you'll need to pick a version that supports "Database Engineering" - see here for EA).

'How' is pretty simple. Classes become tables, attributes become columns, relationships become Foreign Keys. You can denote other properties too (e.g. Primary/Unique key) using stereotypes/constraints. (Can't quite remember, it's been a while).

Pretty much any tool that supports database design will use the same approach. There are differences at the fringes (e.g. some tools support round trip, some only generation). But it's largely the same story.

like image 38
sfinnie Avatar answered Jan 09 '23 23:01

sfinnie