How does the {XOR} constraint work in UML?

I have some doubts about the correct use of the {XOR} constraint in UML.

enter image description here

I understand how this works in two different ways. Which one is correct?

  • The xor constraint applies to associations. (either: an object of type A can be associated with 1 object of type C, or: an object of type A can be associated with zero or one object with type B or: an object A can only be on its own, because we have [0 .. 1] near B).

  • The xor constraint applies to the link (either: an object of type A must be associated with only one object of type C, or: an object of type A must be associated with only one object of type B),

+4
source share
2 answers

( ). A C. - XOR B. : B 0, .

(!) - . , . , A, B, C, .

+4

2 B.

1 :

  • 1 A, 0..1 B
  • 0..1 A, 0..1 B
  • 0..1 A, 1 B
0

Source: https://habr.com/ru/post/1662278/


All Articles