UML – may a uml diagram contain different types of uml models

uml

^ e.g. is it allowed to link directly from a use case to an activity diagram – or-
from a class diagram to a use case by connecting them with an association note -or – form a component diagram to a object diagram?
also, if it's allowed, and I firmly believe it is since I saw such diagrams, where does it say so in the omg formal/15-03-01 document?

Edit:
For example where does the specification say something like this is even allowed?
enter image description here

Best Answer

I'm looking at what is currently the latest UML specification, the Unified Modeling Language v2.5, released in June 2015. It is specified in an English language specification and four XMI documents.

I think there are two things to consider to provide a complete answer.

The first thing to keep in mind is the difference between a "model" and a "diagram". Annex A defines models and diagrams. Elements, such as classes and nodes and associations and actors and use cases, are part of a model. Different models have different valid elements, which are described in the standard. Diagrams are graphical views of the model. A repository contains one or more models of a software system.

The second thing to consider is the usage of UML. UML is a language, a set of standard notations with defined meanings. Martin Fowler identified different UML modes, such as sketch, blueprint, programming language. Sketches and blueprints are designed for human consumption. They take advantage of the defined notations to reduce ambiguity in a diagram and make it easy to communicate ideas in a shared language. UML as a programming language is a mode designed to be consumed by a tool, such as for autogenerating code.

The combining of models is not allowed by the formal specification. The definition of an Activity model doesn't allow for the inclusion of elements such as actors, lifelines, and objects. You can see this in the XMI documents, or in Section 15 of the English-language standard. There's simply no concept of this.

However, when creating a diagram (either by hand or with a software package), there's nothing that precludes this. For example, Figure 18.12 shows a use case diagram that is associated with a state machine diagram. Tools may show these in different formats. I'd have to dig deeper to see if it's possible to link all of the diagrams that you mentioned, but it is possible to associate an element of one model with an element in a different model, so that the output diagram may contain visual representations of multiple models in one view.

Annex A specific supports this:

This taxonomy provides a logical organization for the various major kinds of diagrams. However, it does not preclude mixing different kinds of diagram types, as one might do when one combines structural and behavioral elements (e.g., showing a state machine nested inside an internal structure). Consequently, the boundaries between the various kinds of diagram types are not strictly enforced.

Related Topic