Reference · UML
UML arrows: what each line and arrowhead means
In short
UML arrows differ in two things: the line (solid or dashed) and the end (none, open arrowhead, hollow triangle, hollow or filled diamond). A solid line with a hollow triangle is inheritance (generalization), a dashed line with a hollow triangle is realization of an interface, a dashed open arrow is a dependency, a plain line is an association, and a diamond marks the whole in aggregation (hollow) or composition (filled). In sequence diagrams a filled arrowhead is a synchronous call, an open one asynchronous, and a dashed line a reply.
Updated · by the ChartCraft team · drawings rendered with Mermaid 11.17.2 · part of the UML symbols reference
What do the arrows in a UML class diagram mean?
Seven lines cover every relationship between classes. Read them by asking two questions: is the line solid or dashed, and what is at the end?
| Arrow | Name | Meaning | Read it as | Mermaid |
|---|---|---|---|---|
| Association | The classes are linked | A teacher teaches a course | Teacher -- Course : teaches | |
| Directed association | Navigable one way: an order knows its customer | An order has a customer | Order --> Customer : placedBy | |
| Generalization (inheritance) | The subclass is a kind of the superclass. Triangle at the superclass | A dog is an animal | Animal <|-- Dog | |
| Realization | The class implements the interface. Dashed, triangle at the interface | An invoice is payable | Payable <|.. Invoice | |
| Dependency | One class uses another for a while, for example as a parameter | A report uses a printer | Report ..> Printer : uses | |
| Aggregation | Whole and part; the part can exist alone. Hollow diamond at the whole | A team has players | Team o-- Player | |
| Composition | Whole and part; the part cannot exist without the whole. Filled diamond at the whole | A house is made of rooms | House *-- Room |
UML 2.5.1 words each one: a Generalization is a line with a hollow triangle as an arrowhead; a Realization is a dashed line with a triangular arrowhead at the realized element; a Dependency is a dashed arrow; shared aggregation adds a hollow diamond and composite aggregation a filled diamond; an open arrowhead on an association end means that end is navigable.
How do you remember the UML arrows?
Line first, end second. Solid lines are structural, permanent relationships; dashed lines are weaker, a use or a promise. Triangles mean is-a, diamonds mean has-a, and an open arrowhead means knows about or uses.
| End | Solid line | Dashed line |
|---|---|---|
| No end | Association | (a link to a note or constraint) |
| Open arrowhead | Directed association | Dependency |
| Hollow triangle | Generalization: is a kind of | Realization: implements |
| Hollow diamond | Aggregation: has, part can live alone | |
| Filled diamond | Composition: owns, part dies with it |
Which way do UML arrows point?
Triangles and open arrowheads point at the class that is depended on: the superclass, the interface, the used class. Diamonds sit at the other end, on the whole, not the part.
| Drawing | Say it like this |
|---|---|
| Dog inherits from Animal. The triangle touches Animal. | |
| Invoice implements Payable. The triangle touches the interface. | |
| A house is composed of rooms. The diamond touches House, the whole. | |
| Report depends on Printer. The arrow points at what is used. |
What do the arrows in a sequence diagram mean?
In UML 2.5.1 an asynchronous message has an open arrowhead, a synchronous message a filled arrowhead, and a reply message a dashed line with an open or filled arrowhead.
| Arrow | Message | Mermaid |
|---|---|---|
| Synchronous call: the sender waits for the answer | A->>B: call() | |
| Asynchronous: the sender carries on | A-)B: notify() | |
| Reply | B-->>A: result |
sequenceDiagram
actor Student
participant Portal
participant Mailer
Student->>Portal: submit(essay)
Portal-)Mailer: notifyTeacher()
Portal-->>Student: receipt
How do you choose the arrows for a class diagram?
Use a school. Go through the pairs of classes and ask, for each pair, which sentence is true: is a kind of, implements, owns, has, or uses.
Step 1
Is a kind of: generalization
A student is a person and a teacher is a person. Two solid lines with hollow triangles at Person.
Step 2
Owns or has: composition or aggregation
A classroom cannot exist without its school, so School to Classroom is composition. A student still exists if the classroom is closed, so Classroom to Student is aggregation.
Step 3
Implements and uses: realization and dependency
Exam implements Gradable, a dashed line with a triangle. A teacher uses an exam only while marking it, a dashed open arrow.
classDiagram
direction LR
class Person
class Student
class Teacher
class School
class Classroom
class Gradable {
<<interface>>
}
class Exam
Person <|-- Student
Person <|-- Teacher
School *-- Classroom
Classroom o-- Student
Gradable <|.. Exam
Teacher ..> Exam : marksDraw this in the editor → Opens ChartCraft with this description filled in: “UML class diagram for a school: Student and Teacher inherit from Person, a School is composed of Classrooms, a Classroom aggregates Students, Exam implements the Gradable interface, and Teacher depends on Exam to mark it.”
Which UML arrow mistakes lose marks?
Direction mistakes are the most common, because the arrows point the opposite way from how many students say the sentence.
1. Inheritance triangle at the subclass
Loses marks
Animal --|> Dog
Correct
Animal <|-- Dog
The triangle points at the parent. The wrong drawing says Animal is a kind of Dog.
2. Composition diamond at the part
Loses marks
Room *-- House
Correct
House *-- Room
The diamond goes on the whole. The wrong drawing says a room owns a house.
3. Solid line to an interface
Loses marks
Payable <|-- Invoice
Correct
Payable <|.. Invoice
A class implements an interface: dashed line, hollow triangle. Solid is inheritance between classes.
Can you answer these five UML arrow questions?
Answer, then open the worked answer.
Question 1. A Car has an Engine that is thrown away with the car. Which arrow, and where is the diamond?
Worked answer
Composition: a filled diamond at Car.
Question 2. A Library has Books that can be moved to another library. Which arrow?
Worked answer
Aggregation: a hollow diamond at Library. The books exist on their own.
Question 3. What does a dashed line with a hollow triangle mean?
Worked answer
Realization: the class at the tail implements the interface at the triangle.
Question 4. A method of Report takes a Printer as a parameter and nothing more. Which arrow?
Worked answer
Dependency: a dashed line with an open arrowhead from Report to Printer.
Question 5. In a sequence diagram, what is a dashed arrow?
Worked answer
A reply message, the return from an earlier call.
Questions
What do UML arrows mean?
Each combination of line and end is one relationship: a hollow triangle is inheritance, a dashed hollow triangle realization, a dashed open arrow dependency, a plain line association, and diamonds aggregation (hollow) or composition (filled).
What are the UML class diagram arrow types?
Association, directed association, generalization, realization, dependency, aggregation and composition.
What are class diagram arrows?
The lines between class boxes. Their line style (solid or dashed) and end (arrowhead, triangle or diamond) say which relationship the classes have.
What does a dashed arrow mean in a UML class diagram?
A dependency when it has an open arrowhead, and realization of an interface when it has a hollow triangle.
What does a filled diamond mean in UML?
Composition: the class at the diamond owns the other, and the parts are destroyed with it.
Which way does the inheritance arrow point in UML?
From the subclass to the superclass. The hollow triangle touches the superclass.
Sources
The rules and names on this page were checked against these documents.
- OMG Unified Modeling Language, version 2.5.1. The notation of each element: Generalization (hollow triangle), Realization (dashed line, triangular arrowhead), Dependency (dashed arrow), shared and composite aggregation (hollow and filled diamond), Message sorts (filled, open and dashed arrowheads), activity nodes, UseCase (ellipse) and Actor (stick-man).
- Mermaid documentation, Class diagrams. Relationship syntax: <|--, *--, o--, -->, --, ..>, ..|> and ..; annotations such as <<interface>>; multiplicities in quotes.
- Mermaid documentation, Sequence diagrams. Message arrows ->>, -->> and -), actors, and alt, loop and opt fragments.