| 1 |
<?xml version="1.0"?> |
|---|
| 2 |
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" |
|---|
| 3 |
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" |
|---|
| 4 |
> |
|---|
| 5 |
<chapter id="chap-elements"> |
|---|
| 6 |
<title>UML elements</title> |
|---|
| 7 |
|
|---|
| 8 |
<para>This chapter describes the UML elements that are implemented by |
|---|
| 9 |
Gaphor.</para> |
|---|
| 10 |
|
|---|
| 11 |
<section id="sect-elements-actor"> |
|---|
| 12 |
<title>Actor</title> |
|---|
| 13 |
|
|---|
| 14 |
<para>Actors are used to describe external entities that interact with the |
|---|
| 15 |
system. In this case an external entity can be a user or another system |
|---|
| 16 |
which interacts with the system.</para> |
|---|
| 17 |
|
|---|
| 18 |
<para>An actor is represented by the <literal>Actor</literal> |
|---|
| 19 |
class.</para> |
|---|
| 20 |
|
|---|
| 21 |
<para>See also <xref linkend="sect-elements-class"/>, |
|---|
| 22 |
<xref linkend="sect-elements-usecase"/> and |
|---|
| 23 |
[TODO: link to usecase diagram].</para> |
|---|
| 24 |
</section> |
|---|
| 25 |
|
|---|
| 26 |
<section id="sect-elements-association"> |
|---|
| 27 |
<title>Association</title> |
|---|
| 28 |
|
|---|
| 29 |
<para>Associations are used to define relatinships between classifiers |
|---|
| 30 |
(classes, actors, usecases). The most common usage is in Class and UseCase |
|---|
| 31 |
diagrams.</para> |
|---|
| 32 |
|
|---|
| 33 |
<para>An association is created by one Association instance and two or |
|---|
| 34 |
more Property's (in case of Gaphor: two, Gaphor can't handle N-ary |
|---|
| 35 |
association at this moment).</para> |
|---|
| 36 |
|
|---|
| 37 |
<para>An association end can be navigable or not. If an association end is |
|---|
| 38 |
navigable, the class can traverse to the class at the other end. |
|---|
| 39 |
If an end is navigable, the property at that end is owned by the class |
|---|
| 40 |
(<literal>Property.class_</literal> refers to the class and the property is |
|---|
| 41 |
in <literal>Class.ownedAttribute</literal>). If the end is not navigable, |
|---|
| 42 |
the property is owned by the association |
|---|
| 43 |
(Property.owningAssociation/Association.ownedMember).</para> |
|---|
| 44 |
|
|---|
| 45 |
<figure id="fig-elements-association"> |
|---|
| 46 |
<title>An association</title> |
|---|
| 47 |
<graphic fileref="examples/association/associationExample.png"/> |
|---|
| 48 |
</figure> |
|---|
| 49 |
|
|---|
| 50 |
<para><xref linkend="fig-elements-association"/> shows how an association |
|---|
| 51 |
as shown in a diagram (a) is implemented in the data model (b). The |
|---|
| 52 |
Association has two properties: one with name <literal>myWheel</literal> |
|---|
| 53 |
and one with <literal>theBike</literal>. In (a) an arrow is drawn from |
|---|
| 54 |
<literal>Bike</literal> to <literal>Wheel</literal>, meaning that |
|---|
| 55 |
instances of <literal>Bike</literal> can traverse to instances of |
|---|
| 56 |
<literal>Wheel</literal>, but not visa versa. In the data model (b) this |
|---|
| 57 |
is represented as property <literal>myWheel</literal> being an attribute |
|---|
| 58 |
of <literal>Bike</literal>. Property <literal>theBike</literal> can not |
|---|
| 59 |
be used to go from <literal>Wheel</literal> to <literal>Bike</literal>, |
|---|
| 60 |
therefore it's owned by the Association.</para> |
|---|
| 61 |
|
|---|
| 62 |
<para>Association is subclass of Namespace. When a new Association is |
|---|
| 63 |
created in a diagram, the namespace is set to the namespace of the |
|---|
| 64 |
diagram.</para> |
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
</section> |
|---|
| 68 |
|
|---|
| 69 |
<section id="sect-elements-class"> |
|---|
| 70 |
<title>Class</title> |
|---|
| 71 |
|
|---|
| 72 |
<para>Classes are the most well known elements of UML. A class as a unique |
|---|
| 73 |
name (within it's namespace) and can contain attributes and operations. |
|---|
| 74 |
Relationships with other classes can be established by means of |
|---|
| 75 |
associations, dependencies and generalization.</para> |
|---|
| 76 |
|
|---|
| 77 |
<section> |
|---|
| 78 |
<title>Attributes</title> |
|---|
| 79 |
|
|---|
| 80 |
<para>Attributes can be written using OCL syntax: |
|---|
| 81 |
<programlisting> |
|---|
| 82 |
+ name: string |
|---|
| 83 |
# count: integer = 1</programlisting> |
|---|
| 84 |
</para> |
|---|
| 85 |
|
|---|
| 86 |
<para>Syntax: |
|---|
| 87 |
<synopsis> |
|---|
| 88 |
attribute ::= [visibility] [derived] name [':' type] ['=' default] ['{' tagged_values '}'] |
|---|
| 89 |
visibility ::= ('+'|'#'|'-') |
|---|
| 90 |
derived ::= '/' |
|---|
| 91 |
name ::= literal |
|---|
| 92 |
type ::= literal ['[' multiplicity ']'] |
|---|
| 93 |
multiplicity ::= mult_value ['..' mult_value] |
|---|
| 94 |
default ::= literal |
|---|
| 95 |
tagged_values ::= tagged_value [, tagged_value]* |
|---|
| 96 |
tagged_value ::= literal |
|---|
| 97 |
mult_value ::= ('0' .. '9' ['0' .. '9']* | '*') |
|---|
| 98 |
literal ::= literal_char [literal_char]* |
|---|
| 99 |
literal_char ::= ('A' .. 'Z' | 'a' .. 'z' | '0' .. '9' | '-' | '_')</synopsis> |
|---|
| 100 |
</para> |
|---|
| 101 |
|
|---|
| 102 |
</section> |
|---|
| 103 |
|
|---|
| 104 |
<section> |
|---|
| 105 |
<title>Operations</title> |
|---|
| 106 |
|
|---|
| 107 |
<para>Syntax: |
|---|
| 108 |
<synopsis> |
|---|
| 109 |
operation ::= [visibility] name '('[parameterlist]')' [':' type] ['{' tagged_values '}'] |
|---|
| 110 |
visibility ::= ('+'|'#'|'-') |
|---|
| 111 |
derived ::= '/' |
|---|
| 112 |
parameterlist ::= parameter [',' parameter] |
|---|
| 113 |
parameter ::= [direction] name [':' type] ['{' tagged_values '}'] |
|---|
| 114 |
direction ::= ('in'|'out'|'inout') |
|---|
| 115 |
name ::= literal |
|---|
| 116 |
type ::= literal ['[' multiplicity ']'] |
|---|
| 117 |
multiplicity ::= mult_value ['..' mult_value] |
|---|
| 118 |
mult_value ::= ('0' .. '9' ['0' .. '9']* | '*') |
|---|
| 119 |
tagged_values ::= tagged_value [, tagged_value]* |
|---|
| 120 |
tagged_value ::= literal |
|---|
| 121 |
literal ::= literal_char [literal_char]* |
|---|
| 122 |
literal_char ::= ('A' .. 'Z' | 'a' .. 'z' | '0' .. '9' | '-' | '_')</synopsis> |
|---|
| 123 |
</para> |
|---|
| 124 |
</section> |
|---|
| 125 |
|
|---|
| 126 |
</section> |
|---|
| 127 |
|
|---|
| 128 |
<section id="sect-elements-comment"> |
|---|
| 129 |
<title>Comment</title> |
|---|
| 130 |
|
|---|
| 131 |
<para>TODO</para> |
|---|
| 132 |
</section> |
|---|
| 133 |
|
|---|
| 134 |
<section id="sect-elements-dependency"> |
|---|
| 135 |
<title>Dependency</title> |
|---|
| 136 |
|
|---|
| 137 |
<para>TODO</para> |
|---|
| 138 |
</section> |
|---|
| 139 |
|
|---|
| 140 |
<section id="sect-elements-generalization"> |
|---|
| 141 |
<title>Generalization</title> |
|---|
| 142 |
|
|---|
| 143 |
<para>TODO</para> |
|---|
| 144 |
</section> |
|---|
| 145 |
|
|---|
| 146 |
<section id="sect-elements-package"> |
|---|
| 147 |
<title>Package</title> |
|---|
| 148 |
|
|---|
| 149 |
<para>TODO</para> |
|---|
| 150 |
</section> |
|---|
| 151 |
|
|---|
| 152 |
<section id="sect-elements-usecase"> |
|---|
| 153 |
<title>Use Case</title> |
|---|
| 154 |
|
|---|
| 155 |
<para>TODO</para> |
|---|
| 156 |
</section> |
|---|
| 157 |
|
|---|
| 158 |
</chapter> |
|---|
| 159 |
|
|---|
| 160 |
|
|---|