UML2 Quick Reference - dice-project/DICE-Simulation GitHub Wiki
The Unified Modeling Language (UML) is a standard which provides a language to describe different systems. UML is a domain-independent language, although its origins are in the object-oriented modeling. A UML model consists of elements such as packages, classes, and associations. The corresponding UML diagrams are graphical representations of parts of the UML model. These diagrams contain graphical elements (nodes connected by paths) that represent elements in the UML model.
UML modeling can be generally divided into two semantic categories: behavioral modeling and structural modeling. In addition to these main categories, there are some supplemental modeling constructs that have both behavioral and structural aspects (e.g., deployment diagrams, use cases) which may complement behavioral and/or structural models. This section will focus in the former category, i.e., behavioral modeling.
Specifically, we describe below the interesting parts of the activity diagrams and sequence diagrams specification which are of interest from the point of view of the DICE Simulation Tool.
Activity Diagrams
An Activity, as specified in the UML standard, is a kind of Behavior that is specified as a graph of nodes interconnected by edges. A subset of the nodes are executable nodes that embody lower-level steps in the overall Activity. Object nodes hold data that is input to and output from executable nodes, and moves across object flow edges. Control nodes specify sequencing of executable nodes via control flow edges. Activities are essentially what are commonly called control and data flow models.
The following figure shows the main concepts (i.e., metaclases) used to create activity diagrams together with their relationships.
The most relevant elements from the transformation to analysis models point of view are:
-
UML::Packages::Model— AModelcaptures a view of a physical system. It is an abstraction of the physical system, with a certain purpose. -
UML::Activities::Activity— AnActivityis the specification of parameterized behavior as the coordinated sequencing of subordinate units (ActivityNodes). -
UML::Activities::ActivityNode(abstract) —ActivityNodeis an abstract class for points in the flow of anActivityconnected byActivityEdges. -
UML::Activities::ActivityEdge(abstract) — AnActivityEdgeis an abstract class for directed connections (i.e., withsource[1..1] andtarget[1..1]) between twoActivityNodes. -
UML::Activities::ControlFlow— AControlFlowis anActivityEdgetraversed by control tokens or object tokens of control type, which are used to control the execution ofExecutableNodes. -
UML::Activities::ControlNode(abstract) — AControlNodeis an abstractActivityNodethat coordinates flows in anActivity. -
UML::Activities::InitialNode— AnInitialNodeis aControlNodethat offers a single control token when initially enabled. -
UML::Activities::FinalNode(abstract) — AFinalNodeis an abstractControlNodeat which a flow in anActivitystops. -
UML::Activities::ActivityFinalNode— AnActivityFinalNodeis aFinalNodethat terminates the execution of its owningActivity. -
UML::Activities::ForkNode— AForkNodeis aControlNodethat splits a flow into multiple concurrent flows. -
UML::Activities::JoinNode— AJoinNodeis aControlNodethat synchronizes multiple flows. -
UML::Activities::DecisionNode—DecisionNodeis aControlNodethat chooses between outgoingActivityEdgesfor the routing of tokens. -
UML::Activities::MergeNode— AMergeNodeis aControlNodethat brings together multiple alternate flows. It is not used to synchronize concurrent flows but to accept one among several alternate flows. -
UML::Actions::Action(abstract) — AnActionis the fundamental unit of executable functionality. The execution of anActionrepresents some transformation or processing in the modeled system.Actionsprovide theExecutableNodeswithinActivitiesand may also be used withinInteractions. -
UML::Actions::OpaqueAction— AnOpaqueActionis anActionwhose functionality is not specified within UML.
The figure below shows an example activity diagram using the standard notation.
It is composed by an InitialNode (Start), an ActivityFinalNode (End), three OpaqueActions (A1, A2 and A3), a DecisionNode (D) and a MergeNode (M).
Sequence Diagrams
Interactions are presented in the UML standard as a mechanism to get a better grip of an interaction situation for an individual designer or for a group that needs to achieve a common understanding of the situation. Interactions are also used during the more detailed design phase where the precise inter-process communication must be set up according to formal protocols. The most visible aspects of an Interaction are the messages between lifelines. The sequence of the messages is considered important for the understanding of the situation. The data that the messages convey and the lifelines store may also be very important, but the Interactions do not focus on the manipulation of data even though data can be used to decorate the diagrams.
The figure below shows the UML metaclases that may be used to create activity diagrams.
The most relevant elements from the transformation to analysis models point of view are:
-
UML::Packages::Model— As aforementioned aModelcaptures a view of a system with a certain purpose. -
UML::Interactions::Interaction—Interactionsare units of behavior, and focus on the passing of information withMessagesbetween theConnectableElements.Interactionsare the top-level elements of a UML sequence diagram. -
UML::Interaction::Lifeline— ALifelinerepresents an individual participant in theInteraction.Lifelinesrepresent only one interacting entity (via therepresentsassociation toConnectableElement). -
UML::Interactions::InteractionFragment(abstract) —InteractionFragmentis an abstract notion of the most general interaction unit. AnInteractionFragmentis a piece of anInteraction. EachInteractionFragmentis conceptually like anInteractionby itself.InteractionFragmentsare the main constituent parts of anInteraction. AnInteractionFragmentmay either be contained directly in an enclosingInteraction, or may be contained within anInteractionOperandof aCombinedFragment. As aCombinedFragmentis itself anInteractionFragment, there may be multiple nesting levels ofInteractionFragmentswithin anInteraction. -
UML::Interactions::CombinedFragment— The semantics of aCombinedFragmentis dependent upon the containedInteractionOperand. Typical operators are alt (for alternative behaviors), opt (for optional behaviors) or par (for parallel execution paths). -
UML::Interactions::InteractionOperan— As previously introduced, anInteractionOperandis a region within aCombinedFragment. -
UML::Interactions::ExecutionSpecification(abstract) — AnExecutionSpecificationis a specification of the execution of a unit ofBehaviororActionwithin theLifeline. The duration of anExecutionSpecificationis represented by twoOccurrenceSpecifications, thestartOccurrenceSpecificationand thefinishOccurrenceSpecification. -
UML::Interactions::BehaviorExecutionSpecification— AnExecutionSpecificationlinked to aBehavior. -
UML::Interactions::ActionExecutionSpecification— AnExecutionSpecificationlinked to anAction. -
UML::Interactions::OccurrenceSpecification— AnOccurrenceSpecificationis the basic semantic unit ofInteractions. The sequences of occurrences specified by them are the meanings ofInteractions. -
UML::Interactions::ExecutionOccurrenceSpecification— AnExecutionOccurrenceSpecificationrepresents moments in time at whichActionsorBehaviorsstart or finish. -
UML::Interactions::MessageOccurrenceSpecification— AMessageOccurrenceSpecificationspecifies the occurrence ofMessageevents. AMessageOccurrenceSpecificationis a kind ofMessageEnd.Messagesare generated either by synchronousOperationcalls or asynchronousSignalsends. -
UML::Interactions::MessageEnd—MessageEndis an abstract specialization ofNamedElementthat represents what can occur at the end of aMessage. -
UML::Interactions::Message— AMessageis simply the trace between a message send event and a receive event.
The figure below shows an example sequence diagram using the standard notation.
It describes the interaction of a user with a two tier application.
The figure contains three Lifelines represented by dotted lines: one for user (which is an instance of the User classifier), a second one for ui (which represents and instance of UI) and a third one for backend (which is an instance of the Backend classifier).
The three white boxes drawn on top the lifelines represent ExecutionSpecifications (either ActionExecutionSpecifications or BehaviorExecutionSpecifications).
The arrow labeled with displayReport(id) represents a message from user to ui requesting the operation displayReport defined by the UI classifier.
The operation takes as an argument the id value.
Similarly, the arrow labeled with getReport represents a message from ui to backend.
Finally, the dashed arrows labeled with report, represent the reply messages from the backend to the ui, and from the ui to the user.