Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: ermvu 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
-
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.
-
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?
-
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 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
-
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 :-)
-
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
-
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