Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Rich Anderson on November 28, 2019, 04:11:30 pm

Title: Reverse Engineering a Database Model to UML?
Post by: Rich Anderson on November 28, 2019, 04:11:30 pm
Hi There,  I have a SQL Server 2012 database schema of about 30 tables that I have imported as a database model in EA.  I would like to reverse engineer this to derive a UML Class Model which could then be edited and then forward-engineered back to the database, .NET classes, etc, etc..  I've tested and understood the forward engineering part and that's all fine, but wondering if there is any model transformation or script around that goes in the reverse direction?  All the documentation seems to indicate model transformations are forward-engineered.  I suppose I could write a script to do this (not too hard), but before I do, can anyone point me to something like this that has already been done?   
Title: Re: Reverse Engineering a Database Model to UML?
Post by: Geert Bellekens on November 28, 2019, 05:13:35 pm
I don't think anything like this exists already.

Geert
Title: Re: Reverse Engineering a Database Model to UML?
Post by: Modesto Vega on November 28, 2019, 07:10:08 pm
Hi There,  I have a SQL Server 2012 database schema of about 30 tables that I have imported as a database model in EA.  I would like to reverse engineer this to derive a UML Class Model which could then be edited and then forward-engineered back to the database, .NET classes, etc, etc..  I've tested and understood the forward engineering part and that's all fine, but wondering if there is any model transformation or script around that goes in the reverse direction?  All the documentation seems to indicate model transformations are forward-engineered.  I suppose I could write a script to do this (not too hard), but before I do, can anyone point me to something like this that has already been done?   
Assuming the database has a sensible design, please note the intentional emphasis, you could try to write a transform to forward engineer a into something closer to a physical model into a UML diagram. I have written transforms in the past to transition from physical to logical models (and for logical to conceptual), the result is a good starting point but there is manual work involved.

Title: Re: Reverse Engineering a Database Model to UML?
Post by: Richard Freggi on November 29, 2019, 02:25:55 am
I may be stating the obvious but can't you just use the diagram menu to hide methods (triggers) and datatypes?  And show relationships as UML instead of IE notation.  If you need to convert the physical model to a higher abstraction logical model (with different classes, associations, generalizations etc.) then the only thing that works is manually redesigning the higher abstraction model based on the physical one.  There's a lot of subjective decisions and modeler style/perspectives that go into the abstraction, so I've never seen it automated.
Title: Re: Reverse Engineering a Database Model to UML?
Post by: Rich Anderson on November 29, 2019, 07:08:52 am
Thanks, all for your thoughtful responses.  My goals for this are pretty modest.  Mostly, it's about getting to a better-than-zero starting point for the UML model and not having to manually create it.  (I'm lazy that way).  I think I could pretty easily write a script that would do the job, so that's today's task.  I just wanted to avoid doing something that had already been done.   
Title: Re: Reverse Engineering a Database Model to UML?
Post by: Sunshine on November 29, 2019, 10:02:12 am
Someone asked the same question a while ago. Have a look at this
https://www.sparxsystems.com/forums/smf/index.php/topic,42646.msg253338.html#msg253338 (https://www.sparxsystems.com/forums/smf/index.php/topic,42646.msg253338.html#msg253338)
Has scripts that do
Title: Re: Reverse Engineering a Database Model to UML?
Post by: Rich Anderson on November 29, 2019, 11:08:12 am
Thanks for the referral, Sunshine! But I've just finished writing the .NET code to do the transformation (about 90 lines) and it appears to be working.  From my reverse-engineered UML model, I'm now able to generate another database design which is the functional equivalent of what I imported. (The original database design is pretty well-done)  More tweaking to do, but I think I'm there.   
Title: Re: Reverse Engineering a Database Model to UML?
Post by: Sunshine on November 29, 2019, 11:19:38 am
Bah  :(  had a niggley feeling it was a case of being too late. Kind of like the horse had already bolted before I attempted to shut the gate.
On the plus side you probably have more control with the .Net code to do exactly what you need.