Sparx Systems Forum
Enterprise Architect => Uml Process => Topic started by: Dorian Workman 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.
(http://www.freeimagehosting.net/uploads/th.0e910214f8.png) (http://www.freeimagehosting.net/image.php?0e910214f8.png)
-
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.)
-
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
-
Thanks guys appreciate the replies.
-
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
-
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 (http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1261035189/0#0) and other posts with the term n-ary (posted by me) to see some interesting discussion over the years...
HTH,
Paolo
-
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.
-
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
-
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.
(http://www.freeimagehosting.net/uploads/th.fce7ab5cfa.png) (http://www.freeimagehosting.net/image.php?fce7ab5cfa.png)
-
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
-
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 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
-
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
-
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
-
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.
-
[size=18]...[/size]
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.
Hi Dorian,
as an Analyst you deal with Data don't you? ;)
In your Analyst training they did provide you with training in what data is, and how it's interrelated didn't they? ;)
Same with developers yes? ;)
Funny how something that is ABSOLUTELY fundamental to good systems design is almost totally ignored in the training and education of the the practitioners in this industry.... ::)
Paolo