For the multiplicity part - if you omit multiplicity information anywhere (composition, aggregation, association end, attribute, part...), according to UML specification, this means exactly that - you didn't provide the information, it is unknown or irrelevant.
You may choose to provide default value for your model (the UML language specification itself doesn't specify default multiplicity value for user models). Most UML users choose default of exactly one [1] , but I have seen other chosen defaults, like [0..*]. There is no formal way to define default value of multiplicity for a UML model, you have to inform readers of your model in some other way (introductory text paragraph, comment, etc).
If you come across model that doesn't provide this information, safest assumption is that default multiplicity is set to [1].
From this point of view, I would assume that case 1 and case 2 are the same.
For the composition part - semantics of composition relationship, according to UML specification, is as follows: "composite: Indicates that the Property is aggregated compositely, i.e., the composite object has responsibility for
the existence and storage of the composed objects (see the definition of parts in 11.2.3).") - so this rule is applied to objects, not to classes.
It is true that all composed objects have to obey this rule, but that doesn't necessarily mean that all your animation objects have to be composed in sprites. You may have an animation on your intro splash screen, that doesn't belong to any sprite. On the other hand, it is true that composed objects (parts) can't be composed in several composing objects (wholes) at the same time.
Thus, possible situations are:
- Multiplicity of 0..1 on the Sprite end of composition - this would mean that some animations are part of sprites. Those animations and their lifetime is managed by those sprites. Beside those, there might be other, sprite-independent animations in the system.
- Multiplicity of exactly 1 (either set explicitly, like in the case 2, or by default, like, probably, for the case 1) - this would mean that all instances of animations must be part of some sprite.
- Other multiplicity cases, with upper bound greater than 1 - well, since I cannot share composed parts, semantics of composition forbids me to have more than one instance of sprite per animation.
Maybe a little of topic remark at the end:
Setting multiplicity to, let's say 0..* on the sprite end of composition would still produce valid UML (from abstract syntax perspective). It wouldn't make much sense and reader would probably assume some kind of mistake, but when you think about it, you can make instance model that respects all structural and semantical constraints, just by "not using" the possibility to have more than one sprite per animation. It's just like saying that you want some number to be greater than 0 and 10 at the same time. It's not wrong, It's just that it could be specified in simpler and more understandable manner.
SpriteObject
side in the diagram, means it's multiplicity defaults to 1? Assuming that author thought thatSpriteObject
multiplicity is 0 on Option1, I still wonder, why it is right to have 0. IfAnimation
exists, then it must be thatSpriteObject
exists too (since it is a "father") and therefore multiplicity equals to 1, but it does not mean thatAnimation
has navigation toSpriteObject
. I am new to putting UML into practice, so what am I missing? – Filthy