Collaboration extends both behaviored classifier and structured classifier to explain how a collection of cooperating instances achieve a joint task or set of tasks. Its primary purpose is to explain how a system works and, therefore, it typically only incorporates those aspects of reality that are deemed relevant to the explanation.
A collaboration describes a structure of collaborating elements (roles), each performing a specialized function, which collectively accomplish some desired functionality (task). Details, such as the identity or precise class of the actual participating instances are suppressed.
协作描述协作元素(角色)的结构,每个元素执行一个专门的功能,共同完成一些期望的功能(任务)
Collaboration elements - roles, parts, connectors.
Collaboration Visit shows cooperation of doctor and patient roles.
A collaboration is represented as a kind of classifier and defines a set of cooperating entities to be played by instances (its roles), as well as a set of connectors that define communication paths between the participating instances. The cooperating entities are the properties of the collaboration.
A collaboration specifies a view (or projection) of a set of cooperating classifiers. It describes the required links between instances that play the roles of the collaboration, as well as the features required of the classifiers that specify the participating instances.
Several collaborations may describe different projections of the same set of classifiers.
Roles of collaborations define a usage of instances, while the classifiers typing these roles specify all required properties of these instances. Thus, a collaboration specifies what properties instances must have to be able to participate in the collaboration. A role specifies (through its type) the required set of features a participating instance must have. The connectors between the roles specify what communication paths must exist between the participating instances.
Collaboration is often defined in terms of roles typed by interfaces. An interface is a description of a set of properties (externally observable features) required or provided by an instance. An interface can be viewed as a projection of the externally observable features of a classifier realizing the interface.
Instances of different classifiers can play a role defined by a given interface, as long as these classifiers realize the interface. Several interfaces may be realized by the same classifier, even in the same context, but their features may be different subsets of the features of the realizing classifier.
A collaboration is not directly instantiable. Instead, the cooperation defined by the collaboration comes about as a consequence of the actual cooperation between the instances that play the roles defined in the collaboration (the collaboration is a selective view of that situation).
A collaboration may be attached to an operation or a classifier through a collaboration use. A collaboration used in this way describes how this operation or this classifier is realized by a set of cooperating instances. The connectors defined within the collaboration specify links between the instances when they perform the behavior specified in the classifier. The collaboration specifies the context in which behavior is performed. Such a collaboration may constrain the set of valid interactions that may occur between the instances that are connected by a link.
A collaboration is shown as a dashed ellipse icon containing the name of the collaboration. The internal structure of a collaboration as comprised by roles and connectors may be shown in a compartment within the dashed ellipse icon.
Alternatively, collaboration could be shown using composite structure diagram.
https://www.uml-diagrams.org/collaboration-diagrams/collaboration.html