Book a Demo

Author Topic: Association Class linked to Multiple Associations?  (Read 19731 times)

Dorian Workman

  • EA User
  • **
  • Posts: 194
  • Karma: +0/-0
    • View Profile
Association Class linked to Multiple Associations?
« on: December 17, 2009, 07:40:38 am »
Is it legal UML to link a single Association Class to multiple Associations?

I want to record the exact same information about an Association between Document and Entity & Note and Entity in the below diagram, but I can't see how to do this in EA.  Is that because it is illegal in UML?

Thanks.

<a href="http://www.linkedin.com/in/dorianworkman" ><img src="http://www.linkedin.com/img/webpromo/btn_liprofile_blue_80x15.gif" width="80" height="15" border="0" alt="View Dorian Workman

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Association Class linked to Multiple Associati
« Reply #1 on: December 17, 2009, 08:23:58 am »
In UML an association class is a single entity.  (Not a class attached to an association.)

So, yes.  It would be illegal.

I'd recommend creating individual association classes and using a composite relationship to the data you want saved for each.  (Stereotyped if necessary to say members should be copied into the owning class.)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Association Class linked to Multiple Associati
« Reply #2 on: December 17, 2009, 01:18:11 pm »
Simon is right, it is illegal.

An alternative, if you have the ability to vary your model is to create a generalization of Note and Document and then make 1 association to that and entity.

HTH,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Dorian Workman

  • EA User
  • **
  • Posts: 194
  • Karma: +0/-0
    • View Profile
Re: Association Class linked to Multiple Associati
« Reply #3 on: December 17, 2009, 03:47:58 pm »
Thanks guys appreciate the replies.
<a href="http://www.linkedin.com/in/dorianworkman" ><img src="http://www.linkedin.com/img/webpromo/btn_liprofile_blue_80x15.gif" width="80" height="15" border="0" alt="View Dorian Workman

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Association Class linked to Multiple Associati
« Reply #4 on: December 17, 2009, 06:08:02 pm »
Dorian,

I is indeed illegal to link an AssociationClass to (one or more) associations. It is also unnessesary since the AssociationClass IS an Association (and a Class).

BUT, an association isn't limited to having only two ends. It is perfectly legal to associate three or more Classes with a single association (and ofcourse an AssociationClass).

So it could be a solution for you to create an AssociationClass with more then two ends.

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Association Class linked to Multiple Associati
« Reply #5 on: December 17, 2009, 06:48:31 pm »
Quote
Dorian,

I is indeed illegal to link an AssociationClass to (one or more) associations. It is also unnecessary since the AssociationClass IS an Association (and a Class).

BUT, an association isn't limited to having only two ends. It is perfectly legal to associate three or more Classes with a single association (and of course an AssociationClass).

So it could be a solution for you to create an AssociationClass with more then two ends.

Geert
Hi Dorian,

Geert means an Association "lozenge(TM)".  See: N-Ary Associations and Association Class  and other posts with the term n-ary (posted by me) to see some interesting discussion over the years...

HTH,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Dorian Workman

  • EA User
  • **
  • Posts: 194
  • Karma: +0/-0
    • View Profile
Re: Association Class linked to Multiple Associati
« Reply #6 on: December 18, 2009, 01:56:55 am »
Quote
BUT, an association isn't limited to having only two ends. It is perfectly legal to associate three or more Classes with a single association (and ofcourse an AssociationClass).

So it could be a solution for you to create an AssociationClass with more then two ends.

Geert

I'm not quite sure I follow sorry Geert.  In my example diagram above, where could I add another association?  Between the Association Class ("Attachment") and "Note"?

Thanks.
<a href="http://www.linkedin.com/in/dorianworkman" ><img src="http://www.linkedin.com/img/webpromo/btn_liprofile_blue_80x15.gif" width="80" height="15" border="0" alt="View Dorian Workman

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Association Class linked to Multiple Associati
« Reply #7 on: December 18, 2009, 09:13:47 am »
Quote
Quote
BUT, an association isn't limited to having only two ends. It is perfectly legal to associate three or more Classes with a single association (and of course an AssociationClass).

So it could be a solution for you to create an AssociationClass with more then two ends.

Geert

I'm not quite sure I follow sorry Geert.  In my example diagram above, where could I add another association?  Between the Association Class ("Attachment") and "Note"?

Thanks.
That's why Geert was meaning an N-Ary UML Association Lozenge (Obejct)...  You CAN'T add an AssociationEnd to a 2-Ary AssociationClass (rendered in this way) you need an N-Ary Association lozenge.

NOTE: you have to precisely distinguish between Associations (the connector) and AssociationEnd (linkages).  An n-ary Association has one AssociationEnd for each of its "arities".  It may also have normal (binary) Association connectors to other classes, but they DON'T form part of its "arity".

HTH,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Dorian Workman

  • EA User
  • **
  • Posts: 194
  • Karma: +0/-0
    • View Profile
Re: Association Class linked to Multiple Associati
« Reply #8 on: December 18, 2009, 09:40:06 am »
Thanks Paolo.  I've never tried using n-ary's before so please excuse my ignorance.  I took a stab at using them - does this look right now?  It feels right, and I read in a post that each each artery of the n-ary association participates in the association, so if that's true then this now captures what I wanted.

Thanks.

<a href="http://www.linkedin.com/in/dorianworkman" ><img src="http://www.linkedin.com/img/webpromo/btn_liprofile_blue_80x15.gif" width="80" height="15" border="0" alt="View Dorian Workman

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Association Class linked to Multiple Associati
« Reply #9 on: December 18, 2009, 09:54:59 am »
Quote
Thanks Paolo.  I've never tried using n-ary's before so please excuse my ignorance.  I took a stab at using them - does this look right now?  It feels right, and I read in a post that each each artery of the n-ary association participates in the association, so if that's true then this now captures what I wanted.
Actually, I don't think an N-ary relationship applies here.

If I understood your original statement correctly, then Simon's suggestion is actually operationally correct, in my view (ie multiple binary AssociationClasses).  My  proposal was a conceptual refinement on his solution.  If you have these multiple AssociationClasses with the same structure, it's usually because you are missing a generalization (at least at the conceptual level).

If you are familiar with Data Architecture, if you think of N-ary Associations as Associative tables with each arity as a ForeignKey Constraint segment of the PrimaryKey, you pretty much can't go wrong.

The two attributes in the "Attachment" Class in your second diagram should be "within" the lozenge.   They don't constitute and independent object.

HTH,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Association Class linked to Multiple Associati
« Reply #10 on: December 18, 2009, 04:59:20 pm »
Quote
The two attributes in the "Attachment" Class in your second diagram should be "within" the lozenge.
Except the "diamond" (as UML call it; a lozenge is a cough sweet) cannot have attributes "within" it.
The Sparx Team
[email protected]

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Association Class linked to Multiple Associati
« Reply #11 on: December 18, 2009, 05:07:13 pm »
Quote
Quote
The two attributes in the "Attachment" Class in your second diagram should be "within" the lozenge.
Except the "diamond" (as UML call it; a lozenge is a cough sweet) cannot have attributes "within" it.
Yes, I know - it's a bug in UML  ;)

That's (and additional reason) why I argued that an N-ary relation wasn't the right answer.

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Makulik

  • EA User
  • **
  • Posts: 400
  • Karma: +0/-0
    • View Profile
Re: Association Class linked to Multiple Associati
« Reply #12 on: December 18, 2009, 10:14:10 pm »
Quote
Except the "diamond" (as UML call it; a lozenge is a cough sweet) ...
My dictionary says 'lozenge' is also used for '(math.) Rhombus', which depicts it even better than 'diamond' (at least for non native speakers).
But anyway I guess 'lozenge' will be used much more often for 'little pills' or 'cough sweets' by native speakers (it's the more commonly useful meaning).

Just my 0.02 EUR
günther
« Last Edit: December 18, 2009, 10:15:07 pm by Makulik »

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Association Class linked to Multiple Associati
« Reply #13 on: December 18, 2009, 10:57:53 pm »
Quote
Quote
Except the "diamond" (as UML call it; a lozenge is a cough sweet) ...
My dictionary says 'lozenge' is also used for '(math.) Rhombus', which depicts it even better than 'diamond' (at least for non native speakers).
But anyway I guess 'lozenge' will be used much more often for 'little pills' or 'cough sweets' by native speakers (it's the more commonly useful meaning).

Just my 0.02 EUR
günther
Indeed, Gunther, the original "lozenge" cough sweets started off rhombic in shape!   Over the years, lozenge (especially here in Oz) has come to mean a generic sweet (of no particular shape)...

Ah... The entropy of the language...

I was using Lozenge in its mathematical sense - to particularly distinguish it from the other diamonds which have a slightly different shape, as you suggest.

Paolo
« Last Edit: December 18, 2009, 10:59:55 pm by PaoloFCantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Dorian Workman

  • EA User
  • **
  • Posts: 194
  • Karma: +0/-0
    • View Profile
Re: Association Class linked to Multiple Associati
« Reply #14 on: December 19, 2009, 03:06:12 am »
Quote
Quote
Thanks Paolo.  I've never tried using n-ary's before so please excuse my ignorance.  I took a stab at using them - does this look right now?  It feels right, and I read in a post that each each artery of the n-ary association participates in the association, so if that's true then this now captures what I wanted.
Actually, I don't think an N-ary relationship applies here.

If I understood your original statement correctly, then Simon's suggestion is actually operationally correct, in my view (ie multiple binary AssociationClasses).  My  proposal was a conceptual refinement on his solution.  If you have these multiple AssociationClasses with the same structure, it's usually because you are missing a generalization (at least at the conceptual level).

If you are familiar with Data Architecture, if you think of N-ary Associations as Associative tables with each arity as a ForeignKey Constraint segment of the PrimaryKey, you pretty much can't go wrong.

The two attributes in the "Attachment" Class in your second diagram should be "within" the lozenge.   They don't constitute and independent object.

HTH,
Paolo

Thanks Paolo, I'll give Simon's approach a try.  BTW I'm not familiar with Data Architecture, I'm an Analyst by trade, so I'm coming at this from the business side.
<a href="http://www.linkedin.com/in/dorianworkman" ><img src="http://www.linkedin.com/img/webpromo/btn_liprofile_blue_80x15.gif" width="80" height="15" border="0" alt="View Dorian Workman