umlmagic-draw

modelling UML association with 0 or 6 elements


I want to model a association between two classes in UML, that says "an object of class A can have 0 objects of class B or 6 objects of class B". I don't want 0 to 6 elements, I want 0 or 6, nothing in between.

How do I model this? 0 to 6 is "0..6", but was is 0 or 6? Must I use an OCL constrain?

I'm using Magic Draw.

Thanks.


Solution

  • You can represent multiple groupings with commas i.e. 1..3, 5..6 for leaving 4 out of a list from 1 to 6, so I don't see why you can't do that with distinct numbers i.e. 0, 6