Unique Key Representation in UML

A unique key of a class can be represented as an attribute with an ID modifier in the UML class diagram.

If you want to specify a unique key for a particular class, you can set an ID modifier for the desired attribute. The identifier attribute can model the primary key of the database table or the mapped class in ORM.

The unique attribute is marked with "{id}" text after the attribute definition:

Class with a unique key (the attribute with ID modifier)
Class with a unique key (the attribute with ID modifier)

How to Set Identifier to Attribute?

If you want to set an identifier modifier to an attribute to represent a unique key, you can do it this way:

  • Open the class diagram with the desired class element
  • Right-click on the desired attribute
  • Navigate to Modifiers submenu in the context menu
  • Click on the ID menu item
How to set an attribute as a unique key in UML
How to set an attribute as a unique key in UML

New Comment

Comment