Relations between objects
Relations between objects are defined using the following symbols :
Type | Symbol | Image |
---|---|---|
Extension |
`+< |
--+` |
image::extends01.png[] |
Composition |
|
image::sym03.png[] |
Aggregation |
|
It is possible to replace --
by ..
to have a dotted line.
Knowing those rules, it is possible to draw the following drawings.
It is possible a add a label on the relation, using :
followed by the text of the label.
For cardinality, you can use double-quotes ""
on
each side of the relation.
Common features with class diagrams
-
link::class-diagram#Hide[Hide attributes, methods…]
-
link::class-diagram#Notes[Defines notes]
-
link::class-diagram#Using[Use packages]
-
link::class-diagram#Skinparam[Skin the output]
Map table or associative array
You can define a map table or associative array, with map
keyword and =>
separator.
@startuml
map "Map **Contry => CapitalCity**" as CC {
UK => London
USA => Washington
Germany => Berlin
}
@enduml
And add link with object.
@startuml
object London
map CapitalCity {
UK *-> London
USA => Washington
Germany => Berlin
}
@enduml
@startuml
object London
object Washington
object Berlin
object NewYork
map CapitalCity {
UK *-> London
USA *--> Washington
Germany *---> Berlin
}
NewYork --> CapitalCity::USA
@enduml
[Ref. #307]
@startuml
package foo {
object baz
}
package bar {
map A {
b *-> foo.baz
c =>
}
}
A::c --> foo
@enduml
[Ref. QA-12934]
@startuml
object Foo
map Bar {
abc=>
def=>
}
object Baz
Bar::abc --> Baz : Label one
Foo --> Bar::def : Label two
@enduml
[Ref. #307]
Program (or project) evaluation and review technique (PERT) with map
You can use map table
in order to make Program (or project) evaluation and review technique (PERT) diagram.
@startuml PERT
left to right direction
' Horizontal lines: -->, <--, <-->
' Vertical lines: ->, <-, <->
title PERT: Project Name
map Kick.Off {
}
map task.1 {
Start => End
}
map task.2 {
Start => End
}
map task.3 {
Start => End
}
map task.4 {
Start => End
}
map task.5 {
Start => End
}
Kick.Off --> task.1 : Label 1
Kick.Off --> task.2 : Label 2
Kick.Off --> task.3 : Label 3
task.1 --> task.4
task.2 --> task.4
task.3 --> task.4
task.4 --> task.5 : Label 4
@enduml
[Ref. QA-12337]
Display JSON Data on Class or Object diagram
Simple example
@startuml
class Class
object Object
json JSON {
"fruit":"Apple",
"size":"Large",
"color": ["Red", "Green"]
}
@enduml
[Ref. QA-15481]
For another example, see on link::json#jinnkhaa7d65l0fkhfec[JSON page].