Diagrams - General Diagram Features - Constraints

4 important questions on Diagrams - General Diagram Features - Constraints

What is a constraint?

A constraint is a rule that prohibits some potential values for a field

Where is a common way to place the constraint?

In UML, constraints can be added to many places on a diagram.

One common way is to place the constraint inside a comment symbol.

How can we identify that it is a constraint?

To identify it is a constraint the text of the constraint is surrounded by curly braces, {}.
  • Higher grades + faster learning
  • Never study anything twice
  • 100% sure, 100% understanding
Discover Study Smart

The BNF for a constraint is as follows:

<constraint> ::= ‘{’ [ <name> ‘:’ ] <boolean-expression> ‘}’ where <name> is the optional name of the Constraint.


If the <name> field appears it is followed by the colon ‘:’.



<boolean-expression> is the textual form for the Constraint.

It is required to have either a true of false value when evaluated.




The whole expression is surrounded by curly braces ‘{}’.

The question on the page originate from the summary of the following study material:

  • A unique study and practice tool
  • Never study anything twice again
  • Get the grades you hope for
  • 100% sure, 100% understanding
Remember faster, study better. Scientifically proven.
Trustpilot Logo