How to use correctly nonunique in UML?

998 Views Asked by At

Is it possible to connect a1 with b1 twice on (object diagram), while A has only one B object and it is {nonunique}?

enter image description here

2

There are 2 best solutions below

0
Ister On BEST ANSWER

nonunique constraint has sense only if upper multiplicity is higher than zero (while of course you are still allowed to use it anyway). It means that in a particular association with a specific object the same object on the other side can be used more than once.

I believe that's what you wanted to achieve, however the constraint should be on the other end of the association (the one with multiplicity *).

0
qwerty_so On

Your diagram shows just classes. Objects have an underlined name and usually do not show compartments.

The {nonunique} constraint in the multiplicity just tells that B must not be unique.

The double association between a1 and b1 is absolutely legal. However, without a role name it's rather pointless and a single association would be enough.