Book a Demo

Author Topic: Tagged Value Multiplicity  (Read 5500 times)

markg

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Tagged Value Multiplicity
« on: February 24, 2010, 10:13:01 am »
I was wondering if it is possible to have multiplicity with tagged values in a UML profile.

For example, if I am creating a UML profile and I create new stereotypes called Node and Parameter, and I want Node to have multiple Parameters as its tagged value, is there a way of doing this? If so, how?

Creating a Predefined Structured Type and using a RefGUIDList seems like it might work, but when I use that tagged value, I can only specify one Parameter, and not a list of them like the User Guide suggests.
« Last Edit: February 24, 2010, 10:36:49 am by markg »

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Tagged Value Multiplicity
« Reply #1 on: February 24, 2010, 10:48:57 am »
RefGUIDList tagged values should be what you're looking for. If you can't get them to work, please send in a support request - somebody in Support ought to be able to help get you up and running.

However, I wouldn't actually use tagged values to model one:many or many:many relationships - I think creating something like a stereotyped dependency between the elements is much simpler.
The Sparx Team
[email protected]

Van Lepthien

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: Tagged Value Multiplicity
« Reply #2 on: February 26, 2010, 08:28:19 am »
How does one specify a RefGUIDList on a taggedValue association in a UML Profile? I know how to specify it in the UML Tagged Value Types, but I'd like to duplicate the function in my profile.

One of the reasons for wanting to do this is that the RefGUIDList feature is a convenient way to limit selection to items of only the appropriate type, and allows users to specify the relationships without having to maintain diagrams.

markg

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Tagged Value Multiplicity
« Reply #3 on: February 26, 2010, 08:54:39 am »
Thanks KP. I did get the RefGUIDList working.

Quote
However, I wouldn't actually use tagged values to model one:many or many:many relationships - I think creating something like a stereotyped dependency between the elements is much simpler.

What do you mean by "stereotyped dependency", and how do I do this?

Thanks.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Tagged Value Multiplicity
« Reply #4 on: February 26, 2010, 11:00:56 am »
Quote
What do you mean by "stereotyped dependency", and how do I do this?
Consider classes named Lion, Antelope and Gnu where Lion has a RefGUIDList tagged value named "eats" which references Antelope and Gnu. An alternative way to model the same thing is to create a dependency relationship from Lion to Antelope and give the dependency the stereotype «eats». Do the same from Lion to Gnu. The stereotype can be any name that has meaning to you, but mustn't be a UML keyword.
The Sparx Team
[email protected]

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Tagged Value Multiplicity
« Reply #5 on: February 26, 2010, 11:05:00 am »
Quote
How does one specify a RefGUIDList on a taggedValue association in a UML Profile? I know how to specify it in the UML Tagged Value Types, but I'd like to duplicate the function in my profile.
I don't think you can do it with the taggedValue association. Instead, give the «stereotype» class an attribute with the same name as the RefGUIDList tagged value type that you have defined.
The Sparx Team
[email protected]

markg

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Tagged Value Multiplicity
« Reply #6 on: February 26, 2010, 11:33:49 am »
Quote
Consider classes named Lion, Antelope and Gnu where Lion has a RefGUIDList tagged value named "eats" which references Antelope and Gnu. An alternative way to model the same thing is to create a dependency relationship from Lion to Antelope and give the dependency the stereotype «eats». Do the same from Lion to Gnu. The stereotype can be any name that has meaning to you, but mustn't be a UML keyword.

That sounds like what I want, but how do I specify (or constrain) that at the meta level in the UML Profile I am creating? In your example above, I could create a "Predator" and "Prey" stereotype, which extends the metaclass "class". When the Profile is used, I want the user to be able to drag in a "Predator" and a "Prey", and then join the them and the relationship will be eats. How do I specify such a thing at the UML Profile level? As far as I understand, your current suggestion does not require any specification at the meta-level, but requires that when the profile is used, the user must know that the "eats" stereotype connects a predator to a prey. Is that the case?

The main reason to use tagged values is that it is clear that when the user uses the profile, that the valid values of the tagged value "eats" are "Prey". I would much prefer that to be shown graphically, but I'm not sure how to specify it in the profile.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Tagged Value Multiplicity
« Reply #7 on: February 26, 2010, 11:54:13 am »
Yes, that's the same point that Van made higher up this thread.

At the moment, the only way to constrain the creation of an «eats» dependency so that the client must be a «predator» class and the supplier must be a «prey» class is to write an add-in. [If you decided to do this, you would need to implement the EA_OnPreNewConnector broadcast handler and return false if the constraints weren't met - see help for details].

A possibly simpler way, which doesn't force the user to make the correct connection but only encourages them, is to define quicklinks [again, see help for details]. If your quicklink definitions provide an eats dependency between prey and predator and nothing else, then it's easier for the user to do the right thing than the wrong thing. You can back this method up with a model validation script or add-in.

Well it's almost Friday lunchtime, so: KP ---«eats»--->"Chicken Parma"  8)
The Sparx Team
[email protected]