Author Topic: Class to DDL transform inheritance as concrete classes  (Read 2777 times)

ermvu

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Class to DDL transform inheritance as concrete classes
« on: March 24, 2018, 02:09:12 am »
I have a class diagram of three classes; VEHICLE, CAR, and MOTORBIKE.  CAR and MOTORBIKE are specializations of the VEHICLE CLASS.

I'd like to do a DDL transform on this class diagram so I have only 2 tables; CAR and MOTORBIKE, and these tables have fields for all the extended attributes + inherited attributes from vehicle (aka concrete classes)

How do I go about this? using the standard DDL transform I get a table for each class and if I only select the derived classes the transform doesn't include the inherited attributes

Richard Freggi

  • EA User
  • **
  • Posts: 186
  • Karma: +7/-4
    • View Profile
Re: Class to DDL transform inheritance as concrete classes
« Reply #1 on: March 24, 2018, 12:53:26 pm »
The behaviour you described is correct.  The DDL transform works at physical level, meaning it assumes all elements to transform are <<Table>> stereotype classes containing physical attributes.  I think the solution is to generate a physical level class diagram (therefore you must decide what to with your parent class) then run the DDL transform.

ermvu

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Class to DDL transform inheritance as concrete classes
« Reply #2 on: March 27, 2018, 03:10:31 am »
Thank you Richard. Is this something that can be automated (i.e. by altering the DDL transformation settings) or do I have to create each new physical class?

Richard Freggi

  • EA User
  • **
  • Posts: 186
  • Karma: +7/-4
    • View Profile
Re: Class to DDL transform inheritance as concrete classes
« Reply #3 on: March 27, 2018, 10:33:53 pm »
I don't know if it CAN be automated but I would STRONGLY recommend against it.  Creating a physical data model from a logical data model or class diagram is not straightforward, and there are so many factors such as level of denormalization, target RDBMS implementation specifics, data modeler style etc.  A perfectly correct physical data model can be totally different from its perfectly correct logical data model.  Anyone else has a better idea?

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 6869
  • Karma: +148/-104
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Class to DDL transform inheritance as concrete classes
« Reply #4 on: March 28, 2018, 11:22:06 am »
I don't know if it CAN be automated but I would STRONGLY recommend against it.  Creating a physical data model from a logical data model or class diagram is not straightforward, and there are so many factors such as level of denormalization, target RDBMS implementation specifics, data modeler style etc.  A perfectly correct physical data model can be totally different from its perfectly correct logical data model.  Anyone else has a better idea?
I think you need to clarify "correct".  Viable might be a better term.  It can be argued that if one can't "see" the original conceptual model in the physical model, then there has been semantic impedance introduced.

Further, if the modeller is consistent, then it is possible to encode the rules they use into an automaton.  If the conceptual model is well-formed (actually models the reality it is scope for) then applying the modeller's rules should produce a viable physical model with reduced semantic impedance.

In my experience encoding such rules provide s a level of Concistency, konsistency, consistensy! TMUffe - after Paolo that allows both the conceptual and physical models to be improved.

But (as they say) "Don't try this at home, folks".  If you don't have the knowledge or experience.

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Glassboy

  • EA Practitioner
  • ***
  • Posts: 1323
  • Karma: +104/-75
    • View Profile
Re: Class to DDL transform inheritance as concrete classes
« Reply #5 on: March 28, 2018, 12:31:33 pm »
I think you need to clarify "correct".  Viable might be a better term.  It can be argued that if one can't "see" the original conceptual model in the physical model, then there has been semantic impedance introduced.
One wonders what schools of art you favour :-)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 9542
  • Karma: +275/-27
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Class to DDL transform inheritance as concrete classes
« Reply #6 on: March 28, 2018, 05:02:31 pm »
I agree with both.

There should be rules to define how to transform a logical data model into a database model, and (in theory) it should be possible to formalize those rules and thus automate them.

The problem is that the rules can be quite complicated, and hard to formalize.
Think about the problem of what to do with inheritance.
You could simply say that each concrete class get's his own table, but then you'll have to decide what you need to do with relations to an abstract superclass.
Or you could decide to create one table for for all of the subclasses, but at which level do you start? Obviously not a Object, but at the next level (which might be something like 'PersistentObject')

All those decisions would need to be defined and implemented in the transformation algorithm, which is not a trivial task.

I guess that is why this is often left up to the database architect/analyst/responsible to do manually.

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 6869
  • Karma: +148/-104
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Class to DDL transform inheritance as concrete classes
« Reply #7 on: March 28, 2018, 05:50:37 pm »
I think you need to clarify "correct".  Viable might be a better term.  It can be argued that if one can't "see" the original conceptual model in the physical model, then there has been semantic impedance introduced.
One wonders what schools of art you favour :-)
Conceptual Art, of course!  :D

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!