Author Topic: Reverse Engineering a Database Model to UML with Records Modeled as Objects  (Read 3596 times)

Moe

  • EA User
  • **
  • Posts: 107
  • Karma: +0/-0
  • I'm a lifelong learner
    • View Profile
Hello, EA experts,

I have a PostegresSQL database schema of about 30 tables that I will import as a database model in EA (I have not done this before but I will try to figure it out). 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.

My question is: will EA create objects/instances of the records in the tables? If that won't happen by default, how can I make EA create these objects/instsnaces?

The number of instances in each table is relatively small and can fit nicely in an object diagram.

Below is a screenshot from PgAdmin

https://ibb.co/y0pwKvs

As always, thank you very much for your valuable input!

Thank you,
Mo
PhD Student - Systems Engineering

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 11731
  • Karma: +454/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
No, there's no out of the box process to convert records into objects.
You could write something for it, but I'm not sure of the added value.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 12736
  • Karma: +361/-295
  • I'm no guru at all
    • View Profile
You could export the contents of the DB and import via CSV (if you don't like to script it).

q.

Moe

  • EA User
  • **
  • Posts: 107
  • Karma: +0/-0
  • I'm a lifelong learner
    • View Profile
Thank you very much, Geert and q.

Quote
You could write something for it, but I'm not sure of the added value.

I understand your concern, Geert. I want to do this only for selected tables with few objects.

To your point q.
Quote
You could export the contents of the DB and import via CSV (if you don't like to script it).

If I did that, will EA model the records as objects in object diagrams?

Or should I reverse engineer the DB (to build the class diagram in EA), then export the records of the selected tables from the DB (as CSV) and import them to selected classes in EA as objects (I am not sure if this is even possible)?
PhD Student - Systems Engineering

qwerty

  • EA Guru
  • *****
  • Posts: 12736
  • Karma: +361/-295
  • I'm no guru at all
    • View Profile
I don't use the EA import since I script anything by myself. I guess you could configure Geert's CSV importer so it creates objects rather than classes. He will comment for sure.

q.

Moe

  • EA User
  • **
  • Posts: 107
  • Karma: +0/-0
  • I'm a lifelong learner
    • View Profile
It would be great to be able to import attribute values of objects using Geert's Excel tool!

Like this object https://ibb.co/nbnvkFJ

Looking forward to Geert's response.

« Last Edit: January 14, 2021, 12:38:27 pm by Mo »
PhD Student - Systems Engineering

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 11731
  • Karma: +454/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
You can import attributes on classes, but not runstate values for objects.

I did write a script in the past that did something like that:

Here's the relevant part:

Code: [Select]
function processRoleProperties(roleElement, roleNode)
dim runstateString
'get propertyNodes
dim propertyNodes
set propertyNodes = roleNode.SelectNodes("./properties/property")
'loop propertyNodes
dim propertyNode
for each propertyNode in propertyNodes
'get name
dim nameNode
set nameNode = propertyNode.SelectSingleNode("./name")
'start of the runstatestring
runstateString = runstateString & "@VAR;Variable=" & nameNode.Text
'get the values
dim valueString
valueString = ""
dim valueNodes
set valueNodes = propertyNode.SelectNodes("./value")
dim valueNode
for each valueNode in valueNodes
if len(valueString) > 0 then
valueString = valueString & ","
end if
valueString = valueString & valueNode.Text
next
'add the valueString to the runstatestring
runstateString = runstateString & ";Value=" & valueString & ";Op==;@ENDVAR;"
next
'set runstate on element
if len(runstateString) > 0 then
roleElement.RunState = runstateString
roleElement.Update
end if
end function

Geert

Moe

  • EA User
  • **
  • Posts: 107
  • Karma: +0/-0
  • I'm a lifelong learner
    • View Profile
Thank you, Geert for your response.

So if I cannot import runstate values for objects.

What is the use of this script? (I am sorry I don't have experience with scripts)

Mo
PhD Student - Systems Engineering

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 11731
  • Karma: +454/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
This is part of a larger scripts that reads an XML file and creates a bunch of stuff.

Among that bunch of stuff some objects with runstate values.

Geert

Moe

  • EA User
  • **
  • Posts: 107
  • Karma: +0/-0
  • I'm a lifelong learner
    • View Profile
Is it possible to edit your Excel tool (with this script) to export/import runstate values?
PhD Student - Systems Engineering

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 11731
  • Karma: +454/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Is it possible to edit your Excel tool (with this script) to export/import runstate values?
Yes, it's basically a bunch of VBA code.

The syntax resembles vbscript closely, so it should be relatively easy to translate from vbscript to VBA.

Geert

Moe

  • EA User
  • **
  • Posts: 107
  • Karma: +0/-0
  • I'm a lifelong learner
    • View Profile
Thank you, Geert.

So when I look for someone to help me do this, I should look for "someone who can translate a vbscript to VBA", correct?

Does that person need to have any experience in EA?

Thank you so much,
Mo
PhD Student - Systems Engineering

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 11731
  • Karma: +454/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Does that person need to have any experience in EA?
That's probably more important than knowing the VBA/Vbscript syntax.

Geert

Moe

  • EA User
  • **
  • Posts: 107
  • Karma: +0/-0
  • I'm a lifelong learner
    • View Profile
Thank you, Geert for your response.

I hope a member of the forum would respond that he can do this kind of work. Other than that, I will be looking for a needle in a haystack  :o
PhD Student - Systems Engineering

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 11731
  • Karma: +454/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
I could send you a quote if you want to.

But I would need a bit more detailed requirements before being able to estimate work correctly.

If you we are talking about import only I guess that would be about a day of work. I'm not sure what you had in mind in terms of budget?
Exporting is another matter as the runstate is not stored in a normalized way. That makes querying a lot harder.

Geert