UML Derived Property

Derived property is property which value (or values) is produced or computed from other information, for example, by using values of other properties.

Derived property is shown with its name preceded by a forward slash '/'. This notation is used both for attributes and association ends.

Patient class has derived attributes name and age.

Patient class has derived attributes name and age.

In the example above, Patient class has derived attributes name and age. Name represents full patient's name and could be combined from title, given (or first) name, middle name, and family (or last) name. Patient's age is also calculated based on her or his birth date and current date or hospital admission date. (See complete example at Hospital management domain UML diagram example.)

Because derived property is produced or calculated from other properties, it is common to mark it as read-only, so that its value may not be changed directly. UML also allows derived property to be changeable. For the changeable derived property all the constraints have to be met, and in particular the derivation constraint.

Library book has derived attributes loanPeriod, dueDate, and isOverdue.

Library Book has derived attributes loanPeriod, dueDate, and isOverdue.
The loanPeriod and dueDate are read-only.

In the example above attributes loanPeriod, dueDate, and isOverdue are derived. Length of time a library book may be borrowed (loan period) depends on library policy and varies based on a kind of book and who is borrowing it. For example, in a university library undergraduates could borrow book for 30 days, graduate students for a quarter, and faculty staff for a year. In a public library normal loan period for a book could be 3 weeks, while it could be lowered to 2 weeks for new books. Book return due date will be calculated based on the borrow date and loan period. If due date is past the current date, isOverdue Boolean flag which is false by default will be set to true.

A derived property may redefine another property which was not derived. In such case the constraints implied by the derivation should be still met when the property is updated. If a property redefines another property with a specified default value, redefining property could have different default value. If present, the default value of the redefining property will be used in place of the default value from the redefined property.

Library book has derived attribute loanPeriod which redefines attribute of the Book with default value 14.

Library Book has derived attribute loanPeriod which redefines
non derived loanPeriod attribute of the Book with default value 14.

The implementation or logic of the derivation is usually shown using Object Constraint Language (OCL). If an attribute or association end is marked as derived and is not a derived union, the derivation is specified by an operation with the same name and type as the derived attribute or association end. Actions involving a derived property behave the same as for a nonderived property.