开发者

How to generate Relational Model from UML Class Model?

开发者 https://www.devze.com 2023-02-19 00:47 出处:网络
Does anyone know an application (Enterprise Architect, ...) that allows mapping from UML Class Model开发者_Python百科 to Database Relational Model automatically? How?

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

Thanks


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!


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.


If by relational model you mean a real model, then some tools (like MagicDraw) offer a profile that can be used to annotate the UML class diagram with stereotypes like <<pk>>, <<fk>>, <<table>> to represent a relational model.

However if what you are looking for is to generate a SQL script with the tables, columns,... corresponding to your UML class diagram, then you have plenty of options. If your tool does not include this option you can try this online UMLtoSQL generator (there´s a free option for doing tests and learning about how the transformation is done): http://modeling-languages.com/content/uml2db-full-code-generation-sql-scripts-databases

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号