Book a Demo

Author Topic: Am changing DDL Transformation; need help...  (Read 6533 times)

j.peschier

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Am changing DDL Transformation; need help...
« on: January 03, 2006, 07:29:38 am »
I have a Class Model that I want to automatically transform into a Data Model using the DDL Transformation.

However, I do have multiple associations between classes that DDL transforms into one and the same FK column/operation because of the same name.

So I tried changing the Connector template to take the connectorName as the name instead if that is not empty like this:

%if connectorType != "Association"%
%endTemplate%

%if connectorDirection == "Unspecified" or connectorDirection == "Source -> Destination" or connectorDirection == "Bi-Directional"%
%if connectorName == ""%
$name = %connectorDestElemName%
%else%
$name = %CONVERT_NAME(connectorName, "Spaced", "Pascal Case")%
%endIf%
%ForeignKey(connectorGUID,connectorSourceElemGUID,connectorDestElemGUID,$name,"FK1")%
%endIf%

%if connectorDirection == "Destination -> Source" or connectorDirection == "Bi-Directional"%
%if connectorName == ""%
$name = %connectorSourceElemName%
%else%
$name = %CONVERT_NAME(connectorName, "Spaced", "Pascal Case")%
%endIf%
%ForeignKey(connectorGUID,connectorDestElemGUID,connectorSourceElemGUID,$name,"FK2")%
%endIf%


This seems to work in sofar that I get as many FK columns as I had associations (if I remember to give the associations the correct name I want for the field), but the FK relation Operations are not effected. I have not found where exactly the name for these ("FK_[Source]_[Dest]") is coming from.

I want to change this as well. Does anyone know how I can do this? This is my first try at code generation/transformation, so I sort of flying blind here...

Any help is greatly appreciated!

j.peschier

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Am changing DDL Transformation; need help...
« Reply #1 on: January 12, 2006, 05:45:38 am »
Apparently nobody actually seems to use these transformations much (or at all), because I have not seen any replies here...  ???

I've been puzzling myself a bit more and it seems that I need to set the name of the Foreign Key that is being created to some value I determine. The ForeignKey template in the DDL Transformation uses a ForeignKey connector but does not set its name so I get the default name you also get if you use the "Foreign Key" context menu in a database diagram. I've tried to set this name from transformation template code, but I have not been able to find out the exact correct syntax required. And this is not documented in the online help as far as I know...

I've tried using the Field Substitution Macro's "connectorName" and "opName" (not sure which one I should use for a foreign key...?) but this did not work. Are Field Substitution macro's read-only or something?

Does any of you know the syntax that allows me to add the name for the ForeignKey connector in the following transformation code?


ForeignKey
{
 %TRANSFORM_REFERENCE(...whatever...)
 stereotype="SomeStereoType"
 Source
 {
   %TRANSFORM_REFERENCE(...whatever...)
 }
 Target
 {
   %TRANSFORM_REFERENCE(...whatever...)
 }
}


I've tried adding a name="FK name" at the location of the stereotype (before/after it, and before the first %TRANSFORM_REFERENCE, but this give a parse error when I run the template.

Can anyone help me here? I really need to name the FK connectors that are created myself....

j.peschier

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Am changing DDL Transformation; need help...
« Reply #2 on: January 12, 2006, 11:30:53 pm »
I just received the following reply to my original support question related to the problem in this thread:

Quote
Hello Jarno,
 
Sorry for the delay in replying.
 
I've had a look at your problem, and it appears that the foreign key operation name can't be set by the transformation template.
 
We will rectify this as soon as possible after version 6.1 is released.
 
Best Regards,
 
Simon McNeilly
Sparx Systems Pty Ltd
[email protected]
http://www.sparxsystems.com.au


Now I understand why even in this support forum I never actually got a reply: what I assumed was standard EA functionality seems to be simply impossible for now.

thomaskilian

  • Guest
Re: Am changing DDL Transformation; need help...
« Reply #3 on: April 24, 2006, 03:38:15 pm »
Simon,
I just seem to have run in the same problem. What is the solution, as 6.1 is available (and I'm using it)?

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Am changing DDL Transformation; need help...
« Reply #4 on: April 24, 2006, 03:55:32 pm »
I gather the operative word in Sparx' reply was "after." My read of it is that now that 6.1 has found its way into production the Sparx development team can turn their attention to this (among other issues).

Bottom line I suspect is hope for it in 6.5.

I wonder, Thomas, if you could work the same kind of wizardry here has you are suggesting for (other) transformations?

David
No, you can't have it!

thomaskilian

  • Guest
Re: Am changing DDL Transformation; need help...
« Reply #5 on: April 25, 2006, 12:38:16 am »
Hi David,
I was thinking of that right in the beginning, but did not start working on it since I would not be able to use the XREF construct for synchronization. My current approach is a good step forward for me, since creation of the intermediate file via automation is even easier than using the substition macros. So probably I will create/correct multiple FK's manually. Or maybe I'll have another good idea for the XREF. I probably have to think about that.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Am changing DDL Transformation; need help...
« Reply #6 on: April 25, 2006, 04:19:09 am »
Thomas,

Of course this could be the crack in the door (or armour) that lets in XSLT...

On that subject, I'll keep my head down for a little while until the heavier objects stop flying about.

Once I get a small project off my slate I'll see if I can't wade into some of this. I've been putting off some work on building 'aggressive' helper add-ins for EA, but I really do need to address this kind of thing.

We can always open up a dialog on a back channel and compare notes - at least when I've got something more concrete to offer.

David
No, you can't have it!

thomaskilian

  • Guest
Re: Am changing DDL Transformation; need help...
« Reply #7 on: April 25, 2006, 04:58:00 am »
I'm a bit busy at the moment but I'll go and publish some of my work as soon as time permits. Any thought ahead are welcome  :)

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Am changing DDL Transformation; need help...
« Reply #8 on: April 27, 2006, 05:37:35 pm »
Quote
Simon,
I just seem to have run in the same problem. What is the solution, as 6.1 is available (and I'm using it)?

Nothing has been added for this in 6.1, but it has been added for 6.5.  From then a name (name="Something") in the source of the foreign key connector will set the source role and the operation name.  Similarly, a name in the target will set the name of the primary key method and target role.

The only way of representing this in the intermediary file while retaining control of the foreign key name is to explicitly generate classes stereotypes as table, the association between them and the primary key and foreign key operations explicitly.

thomaskilian

  • Guest
Re: Am changing DDL Transformation; need help...
« Reply #9 on: April 28, 2006, 01:34:46 am »
Thanks for the info, Simon. I'll be waiting for 6.5 and make the needed changes manually in the meantime.

mark.myers

  • EA User
  • **
  • Posts: 97
  • Karma: +0/-0
    • View Profile
Re: Am changing DDL Transformation; need help...
« Reply #10 on: January 07, 2007, 05:07:35 pm »
I am using 6.5 and trying to get this to work but no luck so far.  Has anyone got it working?
Cheers, Mark

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Am changing DDL Transformation; need help...
« Reply #11 on: January 07, 2007, 07:57:18 pm »
Version 6.5 added the ability to set a name in the source part of a foreign key to set the name of the FK operation.  You'll just need to modify you templates to do this.