Book a Demo

Author Topic: UML Profiles, Structured Tagged Values and MDG  (Read 7285 times)

philchudley

  • EA User
  • **
  • Posts: 750
  • Karma: +22/-0
  • EA Consultant / Trainer - Sparx Europe
    • View Profile
UML Profiles, Structured Tagged Values and MDG
« on: March 11, 2012, 08:57:53 pm »
Calling all UML Profile and MDG Gurus

I have created and am still creating many UML profiles, wrapped up as MDG.

One aspect has always frustrated me regarding the use of user defined structured tagged values. Lets' give an example

1) Create a new user defined tagged value (Settings | UML Types...) say [highlight]MyMemo[/highlight] which has a definition of [highlight]Type=Memo;[/highlight]

2) Create a Stereotype called [highlight]MyStereo [/highlight]which extends the metaclass UML::Class (it could be any other metaclass actually)

3) Add an attribute called MyMemo of type MyMemo to MyStereo

4) Save the UML profile.

5) Create the MDG technology (ID MyProfile)  and select to add the profile and tagged values, and yes MyMemo appears and can be duly added

Now we test the profile.

So we add the path to our new MDG restart EA and create a new project and create a simple class diagram and add and element of type MyStereo to it. Looking at it properties, we find a tagged value correctly in the profile named section BUT  it does not have type MyMemo, but type String  >:(

The only work arounds I have are

1) Export the tagged values from the project containing the UML profile
2) Import the tagged values to ALL projects that use the profile

OR

In the profile definition, name the attribute of MyStereo [highlight]MyProfile::MyMemo[/highlight] (that is prefix the tagged value name with the ID of MDG technology)

The last is the most elegant and results in the correct type BUT the name of the tagged value in the element dialog is MyProfile::MyMemo

Question: using method 2 how do I get rid of the MDG ID prefix in the properties?

It can be done (look at BPMN or SysML profiles .... but how?) ... preferably without hacking the MDG XML.

Cheers

Phil
Models are great!
Correct models are even greater!

philchudley

  • EA User
  • **
  • Posts: 750
  • Karma: +22/-0
  • EA Consultant / Trainer - Sparx Europe
    • View Profile
Re: UML Profiles, Structured Tagged Values and MDG
« Reply #1 on: March 12, 2012, 08:29:13 am »
Hi All

I have found the solution. Simply add a line similar to

BaseStereotype=Class;

(where Class is the Metaclass that is being extended in the profile)

to the TaggedValue defintion

Cheers

Phil
Models are great!
Correct models are even greater!

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: UML Profiles, Structured Tagged Values and MDG
« Reply #2 on: March 12, 2012, 04:39:16 pm »
Quote
Hi All

I have found the solution. Simply add a line similar to

BaseStereotype=Class;

(where Class is the Metaclass that is being extended in the profile)

to the TaggedValue definition

Cheers

Phil
Hi Phil,

Thanks for that...  Is it truly a solution or just a work-around.

Often, I find that I can achieve what I want with EA but only by "hacks" - that is they aren't as elegant or intuitive as I'd expect..

In this case, I don't know enough about what's going on to say which it is.  (although I'll need to soon as I'm engaged in the same process as you - wrapping profiles in MDGs)

In your estimation, is "the right answer" or "the right hack"?

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

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: UML Profiles, Structured Tagged Values and MDG
« Reply #3 on: March 12, 2012, 09:46:45 pm »
I (AFAIR) reported that as a bug quite a while ago. So thanks for posting the solution. I won't call it workaround. It's like what Geert said. You can't wait for an official solution. So you have to build your own.

q.

philchudley

  • EA User
  • **
  • Posts: 750
  • Karma: +22/-0
  • EA Consultant / Trainer - Sparx Europe
    • View Profile
Re: UML Profiles, Structured Tagged Values and MDG
« Reply #4 on: March 13, 2012, 07:46:39 am »
I would call it a solution. I came across this by looking through one of Sparx's own MDG's (BPMN 1.1) to be precise. It certainly works for user-defined tagged values of type Memo, so I assume that it will work for other types as well.

When I have a few minutes spare I'll try other tagged values types and report back.

Phil
Models are great!
Correct models are even greater!

McMannus

  • EA User
  • **
  • Posts: 108
  • Karma: +4/-1
    • View Profile
Re: UML Profiles, Structured Tagged Values and MDG
« Reply #5 on: July 21, 2014, 09:24:44 pm »
Hi all,

I am currently facing the same problem with Type=Const.

Actually I want to ask if I apply your steps correct:

Concerning the Creation of the Tagged Value Type itself, there is no problem. I created a TV type called ReadOnly and included it in the MDG with ID 'mdg':

Code: [Select]
Type=Const;
Default=non-writable;
BaseStereotype=Part;

I have created a stereotype 'Stereo' which is extending meta-class 'Part' and added a property with name 'mdg::ReadOnly' to it.

After performing the saving/MDG generating task, the mdg id is still present in the tagged values window. Did I missunderstand your advice in any respect?

Thanks for help!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: UML Profiles, Structured Tagged Values and MDG
« Reply #6 on: July 21, 2014, 09:44:41 pm »
Altering the MDG does not change the existing TVs for elements created from the MDG. If you Synch the element/MDG EA will add missing TVs but it will not remove existing ones. If you want that you need to do it either manually or by using a script.

q.

McMannus

  • EA User
  • **
  • Posts: 108
  • Karma: +4/-1
    • View Profile
Re: UML Profiles, Structured Tagged Values and MDG
« Reply #7 on: July 21, 2014, 09:46:37 pm »
Hi qwerty,

of course I am creating new elements from the stereotype in order to test if it works, but even then the mdg id is shown.