Author Topic: Reverse Engineering a Database Model to UML?  (Read 6537 times)

Rich Anderson

  • EA User
  • **
  • Posts: 142
  • Karma: +8/-0
    • View Profile
    • LinkedIn
Reverse Engineering a Database Model to UML?
« 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?   
Rich Anderson
Urgnt Limited

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Reverse Engineering a Database Model to UML?
« Reply #1 on: November 28, 2019, 05:13:35 pm »
I don't think anything like this exists already.

Geert

Modesto Vega

  • EA Practitioner
  • ***
  • Posts: 1137
  • Karma: +30/-8
    • View Profile
Re: Reverse Engineering a Database Model to UML?
« Reply #2 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.


Richard Freggi

  • EA User
  • **
  • Posts: 493
  • Karma: +18/-7
    • View Profile
Re: Reverse Engineering a Database Model to UML?
« Reply #3 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.

Rich Anderson

  • EA User
  • **
  • Posts: 142
  • Karma: +8/-0
    • View Profile
    • LinkedIn
Re: Reverse Engineering a Database Model to UML?
« Reply #4 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.   
Rich Anderson
Urgnt Limited

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1321
  • Karma: +121/-10
  • Its the results that count
    • View Profile
Re: Reverse Engineering a Database Model to UML?
« Reply #5 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
Has scripts that do
  • DDL to Logical (select “DDL to Logical_Transform_Template”)
  • Logical to Conceptual (select “Logical to Conceptual_Transform_Template”)
  • Updated DDL Transform ( select “DDL_Transform_Template”)
« Last Edit: November 29, 2019, 10:03:59 am by Sunshine »
Happy to help
:)

Rich Anderson

  • EA User
  • **
  • Posts: 142
  • Karma: +8/-0
    • View Profile
    • LinkedIn
Re: Reverse Engineering a Database Model to UML?
« Reply #6 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.   
Rich Anderson
Urgnt Limited

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1321
  • Karma: +121/-10
  • Its the results that count
    • View Profile
Re: Reverse Engineering a Database Model to UML?
« Reply #7 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.
Happy to help
:)