0

In a UML class diagram, is it technically correct to have two possible compistion relationships leading to one class?

I.E. I have an inventory class, which has a composition of the inventory class. I want to have the same relationship but with a container class taking the place of the inventory.

So, can I have two compositions, or do I need to turn these into aggregations?

LightMikeE
  • 719
  • 3
  • 8
  • 17
  • Show us the picture of what you mean – xmojmr Dec 06 '14 at 06:31
  • @xmojmr Not accusing you or anything, but are you stalking me? – LightMikeE Dec 06 '14 at 12:26
  • I don't know what makes you think about stalking. I'm just saying show the picture - your draft UML class diagram - to explain more clearly what you mean. I did not get if you need a recursive structure and where would be the place of "container taking place of inventory". Is it the root of the hierarchy or something in the middle. One simple picture would tell it – xmojmr Dec 06 '14 at 12:44
  • Not about this, I just noticed that you seemed to find something wrong in every single question and answer I posted on this site. Just wondering. – LightMikeE Dec 06 '14 at 12:57
  • I have left comment in your 26856660, answered your 27180394 and now requested clarification in this question. 2 (out of 5) your other questions are intact. These are the facts. Finding something wrong is the way to improvement. Instead of "stalking" perhaps think about if my comments are on-topic and up to the point. Otherwise you can request moderator's attention by flagging the comments as inappropriate. I'm not stalking you, I'm just following the `uml` tag where you post your questions – xmojmr Dec 06 '14 at 13:09
  • 1
    "I'm just following the uml tag where you post your questions". That explains it. I wasn't deriding you, merely felt awkward when you seemed to leave comments on most my posts. – LightMikeE Dec 06 '14 at 13:11

2 Answers2

3

You can have as many composite associations as you like on the class level. But each instance can only be part of one composition at a specific moment in time. UML superstructure says:

If the whole has aggregationKind = composite then the part can be included in at most one composite at a time

This article I wrote tries to explain the difference: UML Composition vs Aggregation vs Association

Geert Bellekens
  • 12,788
  • 2
  • 23
  • 50
0

Any number of composition association can lead to one class of course. If instance of composed class is composed of instances of more types for example.

Vladimir
  • 2,066
  • 15
  • 13