Sets and bags / Identity of a link



Date view Thread view Subject view Author view

Gonzalo Génova (ggenova@inf.uc3m.es)
Tue, 23 Jan 2001 17:32:57 +0100


Hello pUML members, The UML defines a Class as a set of objects (UML v1.3, p. 60). This should not prevent two objects of the same class to have the same data content, that is, to have the same attribute values, to be in the same state (say, in a graphical worksheet, two Points have the same coordinateX, coordinateY and color, but they are nevertheless differentiable because each one has its own identity). That is, within an object we can distinguish identity from data content. Similarly, the UML defines an Association as a set of tuples (p. 55). On the other hand, being a link an instance of an association, an association is also a set of links. Is a link and a tuple exactly the same thing? Martin & Odell, in their book "Object-Oriented Methods: a Foundation", rather say that the instance of the association is the tuple itself, that is, the identity of the association instance is the composition of the identities of the linked objects. But others say that "the data content of a link is a tuple" (Joaquin Miller, in a message posted to this forum a year ago--excuse me if the intention is misundertood), thus enabling the distinction between identity and data content of a link, in a closer analogy with objects. Other attributes owned by the link might form part also of its data content. If we followed this interpretation, then we could have sets of links, some of which would have the same data content (would relate the same objects), but being nevertheless distinguishable (a client having several reservations for the same table in a restaurant). Unfortunately, the UML standard states that each tuple may appear at most once in an association. Guy Genilloud, in his contribution to the UML Semantics FAQ, in the 1999 Ecoop workshop, proposes to remove this constraint, defining an association as a bag of tuples (a bag instead of a set). This could work, but the analogy between links and objects would become weaker. Should we say also that a class is a bag of objects? Personally, I prefer the other solution. If we admit that classes are sets of objects, allowing different objects to have the same data content, why not admitting that associations are sets of links, allowing in an analogous way that different links have the same data content (that is, link or relate the same objects)? I think we need that links have an identity that is different from the composition of the identities of the related objects, in order to manipulate them (the links) more clearly. A link identity makes unnecessary to discuss whether associations should be sets of tuples or bags of tuples. (This link identity is not to be confused with a "link identifier", as the object identity is not to be confused with the "object identifier", some kind of invisible attribute that would ease the identification of the object; but I don't want to extend now on this point.) I expect your comments. Gonzalo Genova Carlos III University of Madrid, Spain


Date view Thread view Subject view Author view