Last modified by Artur on 2025/09/10 11:19

Show last authors
1 {{box title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
4
5 == 16.1 Scope ==
6
7 The scope of this document is to give a brief overview of the diagram notation used in UML. The examples used in this document have been taken from the [[SDMX>>doc:Glossary.Statistical data and metadata exchange.WebHome]] UML model.
8
9 == 16.2 Use Cases ==
10
11 In order to develop the data models it is necessary to understand the functions that require to be supported. These are defined in a use case model. The use case model comprises actors and use cases and these are defined below.
12
13 The **actor** can be defined as follows:
14
15 “//An actor defines a coherent set of roles that users of the system can play when interacting with it. An actor instance can be played by either an individual or an external system”//
16
17 The actor is depicted as a stick man as shown below.
18
19 [[image:SDMX 3-0-0 SECTION 2 FINAL-1.0 (1)_en_19d8e2a1.png||height="121" width="154"]]
20
21 **Figure 49 Actor**
22
23 The **use cas**e can be defined as follows:
24
25 “//A use case defines a set of use-case instances, where each instance is a sequence of actions a system performs that yields an observable result of value to a particular actor”//
26
27 [[image:SDMX 3-0-0 SECTION 2 FINAL-1.0 (1)_en_84d6f442.png||height="95" width="124"]]
28
29 **Figure 50 Use case**
30
31 [[image:SDMX 3-0-0 SECTION 2 FINAL-1.0 (1)_en_11bb0513.png||height="91" width="371"]]
32
33 **Figure 51 Actor and use case**
34
35 [[image:SDMX 3-0-0 SECTION 2 FINAL-1.0 (1)_en_35b02320.png||height="296" width="466"]]
36
37 **Figure 52 Extend use cases**
38
39 An extend use case is where a use case may be optionally extended by a use case that is independent of the using use case. The arrow in the association points to he owning use case of the extension. In the example above the Uses Data use case is optionally extended by the Uses Metadata use case.
40
41 == 16.3 Classes and Attributes ==
42
43 === 16.3.1 General ===
44
45 A class is something of interest to the user. The equivalent name in an entity-relationship model (E-R model) is the entity and the [[attribute>>doc:Glossary.Attribute.WebHome]]. In fact, if the UML is used purely as a means of modelling data, then there is little difference between a class and an entity.
46
47 [[image:SDMX 3-0-0 SECTION 2 FINAL-1.0 (1)_en_5488dc81.png||height="113" width="147"]]
48
49 **Figure 53 Class and its attributes**
50
51 Figure 53 shows that a class is represented by a rectangle split into three compartments. The top compartment is for the class name, the second is for [[attributes>>doc:Glossary.Attribute.WebHome]] and the last is for operations. Only the first compartment is mandatory. The name of the class is [[Annotation>>doc:Glossary.Annotation.WebHome]], and it belongs to the package [[SDMX>>doc:Glossary.Statistical data and metadata exchange.WebHome]]-Base. It is common to group related [[artefacts>>doc:Glossary.Artefact.WebHome]] (classes, use-cases, etc.) together in packages. . [[Annotation>>doc:Glossary.Annotation.WebHome]] has three “String” [[attributes>>doc:Glossary.Attribute.WebHome]] – name, type, and url. The full identity of the [[attribute>>doc:Glossary.Attribute.WebHome]] includes its class e.g. the name [[attribute>>doc:Glossary.Attribute.WebHome]] is [[Annotation>>doc:Glossary.Annotation.WebHome]].name.
52
53 Note that by convention the class names use UpperCamelCase – the words are concatenated and the first letter of each word is capitalized. An [[attribute>>doc:Glossary.Attribute.WebHome]] uses lowerCamelCase - the first letter of the first (or only) word is not capitalized, the remaining words have capitalized first letters.
54
55 === 16.3.2 Abstract Class ===
56
57 An abstract class is drawn because it is a useful way of grouping classes, and avoids drawing a complex diagram with lots of association lines, but where it is not foreseen that the class serves any other purpose (i.e. it is always implemented as one of its sub classes). In the diagram in this document an abstract class is depicted with its name in italics, and coloured white.
58
59 [[image:SDMX 3-0-0 SECTION 2 FINAL-1.0 (1)_en_7fd7b0b0.png||height="80" width="486"]]
60
61 **Figure 54 Abstract and concrete classes**
62
63 == 16.4 Associations ==
64
65 === 16.4.1 General ===
66
67 In an E-R model these are known as relationships. A UML model can give more meaning to the associations than can be given in an E-R relationship. Furthermore, the UML notation is fixed (i.e. there is no variation in the way associations are drawn). In an E-R diagram, there are many diagramming techniques, and it is the relationship in an E-R diagram that has many forms, depending on the particular E-R notation used.
68
69 === 16.4.2 Simple Association ===
70
71 [[image:SDMX 3-0-0 SECTION 2 FINAL-1.0 (1)_en_464f6c7a.png||height="259" width="221"]]
72
73 **Figure 55 A simple association**
74
75 Here the DataflowDefinition class has an association with the DataStructureDefinition class. The diagram shows that a DataflowDefinition can have an association with only one DataStructureDefinition (1) and that a DataStructureDefinition can be linked to many DataflowDefinitions (0..*). The association is sometimes named to give more semantics.
76
77 In UML it is possible to specify a variety of “multiplicity” rules. The most common ones are:
78
79 Zero or one (0..1)
80 Zero or many (0..*)
81 One or many (1..*)
82 Many ( * )
83 Unspecified (blank)
84
85 === 16.4.3 Aggregation ===
86
87 [[image:SDMX 3-0-0 SECTION 2 FINAL-1.0 (1)_en_d242c5fa.png||height="289" width="267"]]
88
89 **Figure 56: A simple aggregate association**
90
91 [[image:SDMX 3-0-0 SECTION 2 FINAL-1.0 (1)_en_e053fbda.png||height="254" width="128"]]
92
93 **Figure 57 A composition aggregate association**
94
95 An association with an aggregation relationship indicates that one class is a subordinate class (or a part) of another class. In an aggregation relationship. There are two types of aggregation, a simple aggregation where the child class instance can outlive its parent class, and a composition aggregation where the child class's instance lifecycle is dependent on the parent class's instance lifecycle. In the simple aggregation it is usual, in the [[SDMX Information model>>doc:Glossary.SDMX Information Model.WebHome]], for this association to also be a reference to the associated class.
96
97 === 16.4.4 Association Names and Association-end (role) Names ===
98
99 It can be useful to name associations as this gives some more semantic meaning to the model i.e. the purpose of the association. It is possible for two classes to be joined by two (or more) associations, and in this case it is extremely useful to name the purpose of the association.
100
101 Figure 58 shows a simple aggregation between CategoryScheme and [[Category>>doc:Glossary.Category.WebHome]] called ///items //(this means it is derived from the association between the super classes – in this case between the //ItemScheme// and the //Item,// and another between [[Category>>doc:Glossary.Category.WebHome]] called ///hierarchy//.
102
103 [[image:SDMX 3-0-0 SECTION 2 FINAL-1.0 (1)_en_20c6f399.png||height="306" width="222"]]
104
105 **Figure 58 Association names and end names**
106
107 Furthermore, it is possible to give role names to the association-ends to give more semantic meaning – such as parent and child in a tree structure association. The role is shown with “+” preceding the role name (e.g. in the diagram above the semantic of the association is that a ,,Item,, can have zero or one parent Items and zero or many child Item).
108
109 In this model the preference has been to use role names for associations between concrete classes and association names for associations between abstract classes. The reason for using an association name is often useful to show a physical association between two sub classes that inherit the actual association between the super class from which they inherit. This is possible to show in the UML with association names, but not with role names. This is covered later in “Derived Association”.
110
111 Note that in general the role name is given at just one end of the association.
112
113 === 16.4.5 Navigability ===
114
115 Associations are, in general, navigable in both directions. For a conceptual data model it is not necessary to give any more semantic than this.
116
117 However, UML allows a notation to express navigability in one direction only. In this model this “navigability” feature has been used to represent referencing. In other words, the class at the navigable end of the association is referenced from the class at the non-navigable end. This is aligned, in general, with the way this is implemented in the XML schemas.
118
119 [[image:SDMX 3-0-0 SECTION 2 FINAL-1.0 (1)_en_c5020cf3.png||height="61" width="341"]]
120
121 **Figure 59 One way association**
122
123 Here it is possible to navigate from A to B, but there is no implementation support for navigation from B to A using this association.
124
125 === 16.4.6 Inheritance ===
126
127 Sometimes it is useful to group common [[attributes>>doc:Glossary.Attribute.WebHome]] and associations together in a super class.
128
129 This is useful if many classes share the same associations with other classes, and have many (but not necessarily all) [[attributes>>doc:Glossary.Attribute.WebHome]] in common. Inheritance is shown as a triangle at the super class.
130
131 [[image:SDMX 3-0-0 SECTION 2 FINAL-1.0 (1)_en_8dc7563c.png||height="353" width="166"]]
132
133 **Figure 60 Inheritance**
134
135 Here the [[Dimension>>doc:Glossary.Dimension.WebHome]] is derived from [[Component>>doc:Glossary.Component.WebHome]] which itself is derived from
136
137 //IdentifiableArtefact//. Both [[Component>>doc:Glossary.Component.WebHome]] and IdentifiableArtefact are abstract superclasses. The [[Dimension>>doc:Glossary.Dimension.WebHome]] inherits the [[attributes>>doc:Glossary.Attribute.WebHome]] and associations of all of the super classes in the inheritance tree. Note that a super class can be a concrete class (i.e. it exists in its own right as well as in the context of one of its sub classes), or an abstract class.
138
139 === 16.4.7 Derived association ===
140
141 It is often useful in a relationship diagram to show associations between sub classes that are derived from the associations of the super classes from which the sub classes inherit. A derived association is shown by “/” preceding the association name e.g. ///name//.
142
143 [[image:SDMX 3-0-0 SECTION 2 FINAL-1.0 (1)_en_255f3480.png||height="329" width="705"]]
144
145 **Figure 61 Derived associations**