ICS 121: UML Built-In Constraints
Overview
- What are UML built-in constraints?
- UML built-in constraints
What are UML Built-In Constraints?
- UML built-in constraints allow you to express common logical
constraints on a UML model.
- Built-in constraints are just written as one word. In contrast,
OCL constraints are defined in a language much like first-order
predicate logic.
- They are written inside braces after the affected element
UML Built-In Constraints
- abstract: Abstract classes are usually written with their names
in italics, but you can also use {abstract} if you cannot use
italics.
- ordered: Normally all associations are considered to be
unordered. Adding {ordered} at one end of an association means that
the list of related objects is ordered. The ordering rule itself is
not written.
- bag: Normally all associations are sets, meaning that pair of
objects only occurs once. Using {bag} means that the same pair can
occur more than once.
- query: indicates that an operation only reads data from an
instance without modifying the instance.
- read only: indicates an attribute has only a getX() operation,
no setX().
- frozen: indicates that an attribute is set exactly once at
instance creation time. Like java "final" keyword.
- complete: indicates that the subclasses shown are the only
subclasses that will ever be allowed.
- hierarchy: indicates that the instances form a Composite Pattern
- dag: indicates that the instances form a DAG (directed acyclic graph)
sample use case templateexample test plan templateProject plan template