9. Collection Types for Multi-Valued Reference Properties

A non-functional association end associates, by default, a set of instances of the target class to any instance of the source class, which means that the values of the corresponding multi-valued reference property are sets. However, there are also cases, where a non-functional association end is ordered (representing a list of objects) and, consequently, the values of the corresponding multi-valued reference property take the form of ordered sets. In the following example, the association end authoredBooks is not ordered, while the other one, with the implicit name authors, is ordered since the order of the authors of a book is meaningful and has to be captured by a data management app.

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 very rare. When the collection type of a multi-valued reference property is bag, this can be expressed in the class diagram with the help of the keyword unique 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, also in the case where the collection is of type set.