Book a Demo

Author Topic: How to add tags to Profile Constraints relationships?  (Read 3025 times)

jk31434

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
How to add tags to Profile Constraints relationships?
« on: February 26, 2020, 03:00:20 am »
I'm writing a plug-in in C# with EA 15. The models being created by the plugin use "metarelationship" and "stereotyped relationship" from the "Profile Constraints" profile. What I cannot figure out is how to add the "metaclass" and "stereotype" tagged values, shown in the images: https://imgur.com/a/Udt2Yp2

I know these values are Tagged Values, but none of my attempts have worked. As an example, I've tried the following:

Code: [Select]
var con = connector.TaggedValues.AddNew("metaclass", "");
con.Value = "Generalization";
con.Update();

Code: [Select]
var con = connector.TaggedValues.AddNew("Profile Constraints::metaclass", "");
con.Value = "Generalization";
con.Update();

Code: [Select]
var con = connector.TaggedValues.AddNew("Profile Constraints::metarelationship::metaclass", "");
con.Value = "Generalization";
con.Update();

Followed by "connector.Update()". I've tried the fully qualified name UML::Generalization, and likewise tried the same thing for "stereotyped relationship" and the respective "stereotype" tagged value.

But the tagged values are not being added to the relationship. Any idea why this isn't working? I notice that the "metaclass" and "stereotype" tags don't show up in the Properties window "Tags" tab, but they are visible when I double-click the relationship and go to the "tags" tab. Is there a reason for this?  Is there a special way to access these tags via the API?

Thank you in advance for your help
« Last Edit: February 26, 2020, 03:02:30 am by jk31434 »

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: How to add tags to Profile Constraints relationships?
« Reply #1 on: February 26, 2020, 09:08:14 am »
Why not

Code: [Select]
Repository.SynchProfile("Profile Constraints","metarelationship");
The Sparx Team
[email protected]

jk31434

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: How to add tags to Profile Constraints relationships?
« Reply #2 on: February 27, 2020, 05:57:15 am »
Unfortunately that did not solve the issue. Thank you for the reply.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: How to add tags to Profile Constraints relationships?
« Reply #3 on: February 27, 2020, 09:19:04 am »
Then I have no idea what you're doing, or why. If you apply a stereotype to an element/connector, EA will add all the tagged values for you. If you delete any of these tagged values, synchronizing will put them back. You shouldn't need to do any of what you're trying to do. How are you applying the stereotype?
The Sparx Team
[email protected]