Angelo
Angelo

Reputation: 344

UML- association with attributes

With reference to UML, a n-ary association without attributes between n classes can be defined as subset of a Cartesian product of the sets made of instances of the n classes.

Since the association is a set of

n-tuple := {(I1,I2,...,In),...}.

Now, if the n-ary association has k attributes, is an element of it still defined as n-tuple or is it a n+k-tuple (and so the association is a set of n+k-tuple)?.

Upvotes: 0

Views: 562

Answers (2)

Gerd Wagner
Gerd Wagner

Reputation: 5673

When a class has k attributes, its objects can be represented as k-tuples corresponding to the rows of a relational database table with k columns.

In the UML, an instance of an association is called a link. A link of an n-ary association can be represented as an n-tuple corresponding to a row of a relational database table with n columns.

In UML, an association class is an association that has attributes like a class. For instance, the binary association class ExamParticipation is both an association between the classes Exam and Student and it is also a class defining the attribute grade.

When an n-ary association class has k attributes, its instances can be represented as (n+k)-tuples corresponding to the rows of a relational database table with n+k columns.

Epilog: Notice, however, that a UML association cannot be identified with the mathematical concept of a relation (as a subset of a Cartesian Product), since UML admits of associations having the same link more than once (when association ends are characterized as non-unique), thus not being sets, but multi-sets.

Upvotes: 3

Ister
Ister

Reputation: 6318

It's still n-tuple.

Note, each of the classes involved in an n-ary association can also have its own attributes. If you include those attributes it would have to be some gigantic -tuple. The association however is related only to it's ownedEnds.

However just for better understanding you could eventually consider n+1-tuple where n are ownedEnds and extra class is the one describing association. But this is not what the specification says so treat it only as a thought experiment.

Upvotes: 0

Related Questions