Book a Demo

Author Topic: Associations for association class  (Read 5827 times)

jasonab

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Associations for association class
« on: April 05, 2005, 06:18:41 pm »
I'm not sure if this is my problem or EA's. If I add an association class to a UML diagram, I get the link between the two classes, and the assoc class hanging off of the relationship.

I expect the two main classes to point to the assoc class, and the assoc class to point to the other two classes. Instead, the assoc class has no relationships, and the two main classes still point to each other. Code gen gives the same result.

I don't think this is correct behavior. Can anyone clarify? This is using 4.51.749

sargasso

  • EA Practitioner
  • ***
  • Posts: 1406
  • Karma: +1/-2
  • 10 COMFROM 30; 20 HALT; 30 ONSUB(50,90,10)
    • View Profile
Re: Associations for association class
« Reply #1 on: April 05, 2005, 09:12:36 pm »
See UML 2.0 superstructure page 119.

bruce
« Last Edit: April 05, 2005, 09:13:06 pm by sargasso »
"It is not so expressed, but what of that?
'Twere good you do so much for charity."

Oh I forgot, we aren't doing him are we.

jasonab

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Associations for association class
« Reply #2 on: April 05, 2005, 10:08:13 pm »
Quote
See UML 2.0 superstructure page 119.


I'm afraid that doesn't tell me anything. You're referring to the section labelled Association Rules?

I don't suppose you could translate?

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Associations for association class
« Reply #3 on: April 05, 2005, 10:17:51 pm »
I think Bruce was referring to the following, which describes how an association class is shown...

Quote
Notation

An association class is shown as a class symbol attached to the association path by a dashed line. The association path and the association class symbol represent the same underlying model element, which has a single name. The name may be placed on the path, in the class symbol, or on both, but they must be the same name.

Logically, the association class and the association are the same semantic entity; however, they are graphically distinct. The association class symbol can be dragged away from the line, but the dashed line must remain attached to both the path and the class symbol.
The Sparx Team
[email protected]

sargasso

  • EA Practitioner
  • ***
  • Posts: 1406
  • Karma: +1/-2
  • 10 COMFROM 30; 20 HALT; 30 ONSUB(50,90,10)
    • View Profile
Re: Associations for association class
« Reply #4 on: April 05, 2005, 11:18:08 pm »
Yep, sorry I grabbed it quickly from a paper copy on my desk.  The  section is "7.16.1 AssociationClass (from AssociationClasses)"

bruce
p.s.  Jason, I cant find a section labelled Association Rules (or AssociationRule)?
"It is not so expressed, but what of that?
'Twere good you do so much for charity."

Oh I forgot, we aren't doing him are we.

jasonab

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Associations for association class
« Reply #5 on: April 06, 2005, 12:06:32 am »
Thanks for the replies, I think I was looking at the wrong spec.

Still, I'm not sure that answers my question. I know an assoc class describes the attributes of an association, but isn't it written as a many association from each class to the assoc class, and a one association from the assoc class to each of the joining classes?

thomaskilian

  • Guest
Re: Associations for association class
« Reply #6 on: April 06, 2005, 03:12:34 am »
Quote
...but isn't it written as a many association from each class to the assoc class, and a one association from the assoc class to each of the joining classes?

No. Just read the definition above. Of course you can draw it in the way you described it (and likely it will behave like an association class) but the construct has been defined to be shown the way it is.

jasonab

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Associations for association class
« Reply #7 on: April 06, 2005, 08:16:16 am »
Ok, I see where I didn't come across correctly.

I understand that's how it should look (dotted line and all that) - I'm used to that. When I do a codegen on the class, though, my understanding is the code should have relationships inside that association class. For that matter, if I look at the Links page of the assoc class, my understanding is it should list the two classes on either side of the relationship.

That doesn't happen. Should EA do this automatically, or should I do it manually, or is it correct with the class not actually having those relationships?

dserodio

  • EA User
  • **
  • Posts: 30
  • Karma: +0/-0
    • View Profile
Re: Associations for association class
« Reply #8 on: April 08, 2005, 07:35:41 am »
I'm having problems with association classes too, maybe they're related:

I have a diagram for a package, "core", with an association class between C and I, where C is a class and I an interface.

Then I have another diagram for another package, where I import C(which shows up as core::C), and I have a class D, which realizes I(which appears as a "lollipop" protruding from D).

The problem is: I want the Association Class to show links between C and I. How can I do that?
Correctness is clearly the prime quality. If a system does not do what it is supposed to do, then everything else about it matters little. - Bertrand Meyer