UML Package Diagrams Reference

Notation Description
Package
Package shown as a rectangle with a small tab.

Package org.hibernate

Package is a namespace used to group together elements that are semantically related and might change together.

A package could be shown as a rectangle with a small tab attached to the left side of the top of the rectangle.

Package members shown within the package rectangle.

Package org.hibernate contains SessionFactory and Session.

Members of the package may be shown within the boundaries of the package. In this case the name of the package should be placed on the tab.
Members of package shown outside the package.

Package org.hibernate contains interfaces SessionFactory and Session.

Members of the package may be shown outside of the package by branching lines from the package to the members. A plus sign (+) within a circle is drawn at the end attached to the namespace (package).

This notation for packages is semantically equivalent to composition (which is shown using solid diamond.)

Visibility of a package element may be public or private.

All elements of Library Domain package are public except for Account.

If an element that is owned by a package has visibility, it could be only public or private visibility. Protected or package visibility is not allowed. The visibility of a package element may be indicated by preceding the name of the element by a visibility symbol ("+" for public and "-" for private).
Package URI Attribute
URI attribute of a package rendered after the package name.

EJB Profile shown as a package with URI attribute.

Package has optional URI attribute which serves as unique identifier of the package. This attribute was introduced in UML 2.4 mostly to support exchange of profiles using XMI.

UML 2.4 requires this URI attribute to follow the rules and syntax of the IETF URI specification RFC 2396 (while the more recent version of the URI syntax RFC 3986 released in 2005 rendered the RFC 2396 obsolete).

The URI attribute of a package may be rendered in the form {uri=<uri>} after the package name.

Element Import
Public element import shown using a import keyword.

Public import of PageInfo element into Search namespace from Domain package.

If element import is public, the imported element will be added to the namespace and made visible outside the namespace. Keyword «import» indicates public element import.

Private element import shown using a access keyword

Private import of SortInfo element into Search namespace from Domain package.

If element import is private, the imported element will be added to the namespace but will not be visible outside the namespace. Keyword «access» indicates private element import.
Package Import

WebApplication imports Presentation package with default public visibility.

Package import is shown using a dashed arrow with an open arrowhead from the importing namespace to the imported package. By default, the value of visibility is public, so it is the same as «import».
Public package import into the importing namespace

Public import of Domain package into WebApplication.

If the package import is public, the imported elements will be added to the namespace and made visible outside the namespace. Keyword «import» indicates public package import.
Private package import into the importing namespace

Private import of Presentation package into WebApplication.

If the package import is private, the imported elements will be added to the namespace but will not be visible outside the namespace. Keyword «access» indicates private package import.
Package Merge
Package merge shown as dashed line with an open arrowhead from receiving package to merged package.

UML Kernel package merges Constructs package which imports Primitive Types.

A package merge is a directed relationship between two packages that indicates that content of one package is extended by the contents of another package.

Package merge is shown using a dashed line with an open arrowhead pointing from the receiving package to the merged package. Keyword «merge» is shown near the dashed line.

Model
Model notated as package with a small triangle.

Business layer model

Model is a package which captures a view of a system. View is some abstraction of the system describing only those aspects of the system that are relevant to the purpose of the model, at the appropriate level of detail, describing logical or behavioral aspects of the system to a certain category of readers.

Model is notated using the ordinary package symbol (a folder icon) with a small triangle in the upper right corner of the large rectangle.

Model triangle may be drawn to the right of the model name in the tab.

Service Layer model contains service interfaces and message types

If contents of the model are shown within the large rectangle, the triangle may be drawn to the right of the model name in the tab.

Model could be notated as a package with the keyword «model».

Stereotyped model Layered Service

Model could be notated as a package with the keyword «model» placed above the name of the model.

Next  Examples of package diagrams