Book a Demo

Author Topic: Tagging attributes w/Associations  (Read 4049 times)

Jim.Stanley

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Tagging attributes w/Associations
« on: June 03, 2004, 11:16:17 am »
Hi all,

We're constructing class diagrams, and wish to mark a private attribute with a name that's been given to a relationship.

Example: Car class "has" wheels, so the aggregation relationship is R1.  Can we somehow mark "{R1}" next to the FWheels attribute in the Car's class diagram?

Reference:  Executable UML, Meller & Balcer, page 135.

Thanks

Jim Stanley
Media Services Inc.

thomaskilian

  • Guest
Re: Tagging attributes w/Associations
« Reply #1 on: June 03, 2004, 01:11:20 pm »
Jim,
what do you think of just using a stereotype for the association?

Jim.Stanley

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Tagging attributes w/Associations
« Reply #2 on: June 03, 2004, 03:38:05 pm »
Well, we could... but we (that's my boss and I) were under the impression that stereotypes and tags were syntactically different, two separate entities (at least according to the Executable UML book which details UML 2.0).

I can go ahead and do that - but should we put out a suggestion to Sparx to add this feature?

Jim Stanley
Media Services, Inc.

thomaskilian

  • Guest
Re: Tagging attributes w/Associations
« Reply #3 on: June 04, 2004, 12:20:40 am »
Jim,
just for the fun there is a topic started right after yours: http://www.sparxsystems.com.au/cgi-bin/yabb/YaBB.cgi?board=general;action=display;num=1086292436
Probably you're talking about the same thing. I guess you should start an enhancement request then.

I'm not shure if this request will be successful since I have never seen tags printed on class diagramm. They are more a way to add information for coding, searching a.s.o.

mchiuminatto

  • EA User
  • **
  • Posts: 113
  • Karma: +0/-0
    • View Profile
Re: Tagging attributes w/Associations
« Reply #4 on: June 04, 2004, 06:32:47 am »
Hi Jim

If I understood, you need an attribute named wheel in the car class. When you make an association between two classes, you can define properties for the source an target role. In this case let say cWh  is the class abstarcting a wheel and cCr the class abstracting the a car.  

Follow these steps

1. Draw an association from CWh to cCr.
2. Open the association properties.
3. Select source role and set multiplicity to 4 (let`s not consider the backup wheel this time)
4. Now select target role and set  cCrrole as "wheels" and Acces as private.

With step  3 and 4 you are telling, in UML, that class cCar has a private attribute called wheels, actually,  a collection of four cWh objects.

Just for fun I was the one who needed the tagged values for associations visible in diagram, but the reason is different.

So if you associate two classes, you can define the attribute name for the target class in association properties, so as you will see in diagram, this name will be near the class it belongs to.  As a verification step generate code for those classes and you will see the attribute wheels as private in the cCar class.
Regards.

Marcello