Book a Demo

Author Topic: How to transform inheritance from PIM to PSM?  (Read 2544 times)

Dieter

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
How to transform inheritance from PIM to PSM?
« on: February 15, 2010, 08:29:46 pm »
There are many ways to map inheritance in the PIM (by generalization connector) to database model.
The easiest way is to make a 1:1 transformation:

ParentClass ---> ParentTable
ChildClass1 ---> ChildTable1 (FK to ParentTable)
ChildClass2 ---> ChildTable2 (FK to ParentTable)
and so on

The multiplicity between parent and children should be 1:1.

But in my special case I want to make a DDL-transformation by inheriting all attributes of the parent class to the child classes. The transformation of the parent class would be then omitted.

The solution should be to synchronize the child tables with the inherited attributes by modifying the Connector template in the following way:
Code: [Select]
%if connectorType == "Generalization" and classIsRoot=="T"%
  Table
  {
    %TRANSFORM_REFERENCE("Table", connectorSourceElemGUID)%
    name = %qt%%connectorSourceElemName%%qt%
    %list="Attribute" @separator="\n" @indent="  "%
  }
%endTemplate%
It works fine, each child table gets the inherited attributes from its parent but the transformation does always overwrite the already existing child tables (with PK, special attributes and so on), generated by the "Class" template previously. But my intention is only to snchronize the child tables by adding the inherited attributes to the child tables.

Can anyone help me?

Dieter

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: How to transform inheritance from PIM to PSM?
« Reply #1 on: February 15, 2010, 08:47:12 pm »
If you are saying that the inheritance transform will replace the original tables with the partial tables from the inheritance transform you've created, then you're out of luck, I believe.

I'm not a transform expert, but I believe the NORMAL transform will ALWAYS replace the target elements.  That's the way EA Transforms work.

I have done some experiments to see if one can get around this, with limited success.

If you want to do partial transforms with multiple sources, you'll have to write and addin I suspect.

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