Author Topic: How do I get pre-defined tagged values on attributes when creating a profile?  (Read 119 times)

jandinger

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Hi,
Long-time Sparx user but first-time poster.
I have recently started to dip my toes in the muddy water that is profile development by creating my own profile for Information Modeling in accordance with my organisationís guidelines. Now, while Iíve managed to create everything I need in terms of objects, relationships, diagrams, script etc, thereís one thing I simply canít find an approach for. On my element stereotype (extending class) I have defined a number of tagged values with default value-sets defined as enumerations. Theyíre used for metadata like information ownership, lifecycle, status etc. Now I would like to have some of the same default tags and value sets on the attributes created in my element but for the life of me I canít find a way to do that.

If this is indeed is possible to do, is it then also possible to inherit the value on a tag on an attribute from the element. Basically I want the tags on an attribute to have the same value as the element has unless itís explicitly set to something else.

Regards

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 7740
  • Karma: +165/-21
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
create the enumeration in your profile and then use the profile helper to create your tagged value referencing the enumeration.

There is no way (except with an add-in or similar) to make your attributes copy the owners's tagged value values.

Geert

jandinger

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
create the enumeration in your profile and then use the profile helper to create your tagged value referencing the enumeration.

There is no way (except with an add-in or similar) to make your attributes copy the owners's tagged value values.

Geert

Hi Geert,
This I have already done and it works perfectly for my elements, but the attributes I create on those elements don't get any tags on them. What am I missing here? Should I perhaps extend the attribute metaclass as well and if so, how do make my element stereotype to use my attribute stereotype rather than the ones of the class metaclass my element is extended from?

Magnus

Uffe

  • EA Practitioner
  • ***
  • Posts: 1072
  • Karma: +81/-5
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Hello,


Using the enumeration type approach, you can of course reuse the same enumeration as a tagged value type for both class stereotypes and attribute stereotypes.

In general, it doesn't quite make sense to inherit tagged values from an element to its attributes. UML inheritance doesn't work that way. You should note, however, that if you create a stereotyped class with a set of tagged values and (in another class) add attributes whose types are that class, then the class' tagged values are inherited to the attributes and can be overridden if you wish. The attributes need not themselves be stereotyped for this mechanism to work.


/Uffe
My theories are always correct, just apply them to the right reality.

jandinger

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Hi,
I'm not sure I'm explaining my problem correctly so let's try this. I've created the elements (which of course is a simplified example) according to:


If I do it like that I get a section in the element properties pre-populated with my tags:

.
 
I want the tags (color in this case) to be predefined the same way also for the attributes I create on elements of MyElement-type but can't get that to work. My guess is that the MyElement does not use the MyAttribute-stereotype when creating attributes but rather the standard attribute metaclass. Basically my question is, how do I do this correctly?

Regarding the inheritance, I know that's not how inheritance is supposed to work but from a business-modeling perspective, when tagged values are used for metadata purposes, it would actually be quite convenient if all the tagged values on attributes got the same values as those on the element as sort-of a default setting. Anyway, I can managed without that functionality as long as I at least can get the tagged values also on the attributes.

Thanks for your patience

Edit: Actually, I just notice that it does indeed work if I create a toolbox-item for MyAttribute and from there drop a MyAttribute on a MyElement which confirms my suspicion above. So I guess my question now is, how do i get MyElement to always define attributes as MyAttribute no matter which way of adding attributes to an element I'm using?
« Last Edit: November 30, 2017, 12:10:39 am by jandinger »

Uffe

  • EA Practitioner
  • ***
  • Posts: 1072
  • Karma: +81/-5
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Actually, I just notice that it does indeed work if I create a toolbox-item for MyAttribute and from there drop a MyAttribute on a MyElement which confirms my suspicion above. So I guess my question now is, how do i get MyElement to always define attributes as MyAttribute no matter which way of adding attributes to an element I'm using?

The only way to do that is with an Add-In, which sets the stereotype and adds the tags when the attribute is created.

/U
My theories are always correct, just apply them to the right reality.

jandinger

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Ah, ok. Then I'll look into that topic instead.

Thank you for all your help guys!

/Magnus