Here is an example of what I want to do: Let's say I have 5 classes, I would like to express the constraint that we can have an instance of class "B" or/and "C" linked to "A", if so we cannot have anything else, and if we don't have any instance from those classes, we only can have one instance of class "D" or "E".
I checked on the official documentation here: https://www.omg.org/spec/UML/2.5.1/ But the part on XOR constraint is very limited. As it's not explicitly described that we cannot, I assume it's possible, but i'm not sure.
Thank you for your help.
In UML Class Diagrams, all kinds of constraints can be included in the form of invariants, which are logical conditions that can be expressed either in plain English or in the Object Constraint Language (OCL) within a constraint rectangle/box that is attached to a class (or association).
Your constraint could be added in this way (attached to your class A
), like so:
But your constraint cannot be expressed in the way you have tried to express it. The special dashed line notation for disjunctive association constraints cannot be combined in this way.