By default, a non-functional association end associates a set of instances of the target class to any instance of the source class, which means that the collection values of the corresponding multi-valued reference property are sets. However, there are also cases, where a non-functional association end is ordered and, consequently, the collection values of the corresponding multi-valued reference property take the form of ordered sets.
In the following example, the association end publishedBooks
is not ordered, while the association end authors
is ordered since the order of the authors of a book is meaningful. Notice that in a UML class diagram, an ordered association end is marked up with the annotation {ordered}
.
An ordered association end should not represent any ordering based on the properties of the target class. In our example, this implies that the ordering of the authors of a book should, for example, not represent their alphabetical ordering, but rather it should represent information that is not available via the properties of Author
. This is, indeed, the case, since it represents some sort of significance, which is not expressed by any property.
Notice that ordered association ends in information design models are just a convenience feature, because an ordered association end can always be transformed into an unordered one by adding one or more attributes to the association's target class, such that these attributes' values can be used for the ordering. Ordered association ends allow a more concise information model, and a more efficient implementation, by not requiring to make the ordering information explicit with the help of auxiliary ordering attributes.
The two important types of collections for multi-valued reference properties are sets and ordered sets, while use cases for bags (multi-sets) and sequences (ordered multi-sets) as the collection type of a multi-valued reference property are rare. When the collection type of a multi-valued reference property is bag (or sequence), this can be expressed in the class diagram with the help of the annotation {nonunique}
(or {ordered, nonunique}
) in the annotation of the association end or property modifier.
Notice, however, that it is quite common to use lists (such as JS arrays or the Java interface type List
) as the range of multi-valued reference properties, both for ordered and for unordered properties.