Book a Demo

Author Topic: Data model to Class Model  (Read 7276 times)

michelreap

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Data model to Class Model
« on: March 04, 2014, 01:59:59 am »
I've been modeling the Data entities from my project with EA, so far I've modelled all Tables from my database with their respective attributes, and now I would like to make a transformation to a Class diagram.

But I fear I've been doing the modeling wrong and somehow EA is not identifying my model as a Data Relational Model. See this screencap where it says "Class Diagram" although I am clearly talking about Tables here, with columns and foreign keys and such:



I tried right clicking on my package and selecting Transform Diagram but the resulting diagram looks very much like this one, I still got tables (not classes) but with getters. Isn't there any way to automatically generate the classes with relationships mapped with collections and objects?

The idea is that I can generate the code after I'm done modeling and so far this transformation is not much of an improvement.

PS. I am using EA version 9

« Last Edit: March 04, 2014, 02:00:32 am by MichelReap »

Helmut Ortmann

  • EA User
  • **
  • Posts: 970
  • Karma: +42/-1
    • View Profile
Re: Data model to Class Model
« Reply #1 on: March 04, 2014, 02:15:07 am »
There is only a transformation from class model to data model.

If you want to go the other way you have to write your own transformation.

Helmut
Coaching, Training, Workshop (Addins: hoTools, Search&Replace, LineStyle)

michelreap

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Data model to Class Model
« Reply #2 on: March 04, 2014, 02:17:08 am »
So all this semantics I introduced can't be used to automatically generate a class?

How do I write such transformation then?

What if a project starts with a pre-defined database and you have to start off from that immutable model?
« Last Edit: March 04, 2014, 02:17:46 am by MichelReap »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Data model to Class Model
« Reply #3 on: March 04, 2014, 05:18:22 am »
Quote
So all this semantics I introduced can't be used to automatically generate a class?

How do I write such transformation then?

What if a project starts with a pre-defined database and you have to start off from that immutable model?
That's what modelers do: transform one representation into another. If everything could be done by an automat we all would be unemployed.

Transformation goes from abstract to concrete (usually) because it is more simple than the other way around.

q.
« Last Edit: March 04, 2014, 05:20:20 am by qwerty »

Nizam Mohamed

  • EA User
  • **
  • Posts: 193
  • Karma: +1/-0
    • View Profile
Re: Data model to Class Model
« Reply #4 on: March 04, 2014, 03:14:40 pm »
Whilst the off-the-shelf product's transformation cannot understand your semantics to convert to a abstract model, it is certainly a valid case to automate this, by customizing transformation templates, if you know there is a certain pattern in your data model.
We have done one such to transform from reverse engineered Java model to a abstract PIM for one of our clients.

You can start with transformation templates customization by referring to http://www.sparxsystems.com/enterprise_architect_user_guide/9.2/model_transformation/writingtransformations.html

you can also refer to this slidedeck for a quick start Transformation & CTF
« Last Edit: March 04, 2014, 03:15:20 pm by nizammohamed »

Dermot

  • EA Administrator
  • EA User
  • *****
  • Posts: 591
  • Karma: +7/-0
    • View Profile
Re: Data model to Class Model
« Reply #5 on: March 04, 2014, 03:47:40 pm »
Yes as Nizam points out with the DBMS specific DDL model you are dealing with a Platform Specific Model (PSM). What you are trying to do is a PSM to PSM transform. When really the transform is PIM to PSM.

There are some transform scripts on the Community site that will reverse transform a DDL PSM to Logical Class model (PIM). You can then use the PIM model to transform to a PSM of specific code platform.

See: http://community.sparxsystems.com/community-resources/512-84data-modeling-logical-and-conceptual-mda-transforms

p.s. you might like to look at the data modeling wp fo more tricks:
http://community.sparxsystems.com/white-papers/669-data-modeling-from-conceptual-model-to-dbms
« Last Edit: March 04, 2014, 03:57:07 pm by Dermot »

michelreap

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Data model to Class Model
« Reply #6 on: March 04, 2014, 10:04:44 pm »
Okay, but what I don't understand is, why am I getting tables as a result of the transformation, instead of classes, if what I'm asking is to transform to Java?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Data model to Class Model
« Reply #7 on: March 04, 2014, 11:20:50 pm »
I don't understand what you're asking. There is a transform template which can transform a class model into DDL. But there is no transformation to do it vice versa. You would have to write such one by yourself.

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Data model to Class Model
« Reply #8 on: March 05, 2014, 08:42:24 am »
Quote
Okay, but what I don't understand is, why am I getting tables as a result of the transformation, instead of classes, if what I'm asking is to transform to Java?
Because the transformation isn't designed to go from tables to normal classes it is copying any stereotypes into the target model. You need to stop that to prevent tables from being generated.