Cardinalities with No Solution

What happens when classes are associated in a cycle? Figure 4 shows three classes, each with two associations.

Figure 4: Multiply Associated Classes with No Solution

We have:

  • For each A we need 2B and 4C
  • For each 2B we need 3C

A, B, and C are in the ratio A:2B:3C. By transitivity, we have 3C for each A. But there is a direct 1:4 relationship between A and C. So it is impossible to generate values of A, B, and C, and associate them in a way that preserves their cardinalities.

Cyclic associations without a solution can be detected by noting that the ratios of cardinalities for each association, when multiplied, should equal 1. In the current example, traversing in a clockwise direction, we have:

1/4 * 3/2 * 2 = 3/4

The direction of traversal does not matter. Going counterclockwise:

1/2 * 2/3 * 4 = 4/3

In either case, the result is not 1.