Redefining Property in UML

UML allows some properties of a generalization of a specializing classifier to be redefined instead of being inherited. Redefinition could be done to rename, augment, constrain, or override the redefined members in the context of instances of the specializing classifier.

The concept and notation for the redefinition was introduced in UML 2.0. It was not present in the older UML 1.x.

Redefining property will replace any reference to a redefined property in the context of an instance of the specializing classifier. A property could be redefined to have different

UML requires redefining property "to be consistent" with the property it redefines, while it may add specific constraints or "other details" that are particular to instances of the specializing classifier and do not contradict existing constraints. Because name, visibility, and default values could be completely different, it looks that this "consistency" for properties usually means that the type of redefining property should be a "kind of type" (e.g. subclass) of redefined property.

One special case of redefinition is when a derived property redefines one which is not derived. The constraints implied by the derivation should be maintained if the property is updated.

Redefinition may be either explicitly notated with the use of a {redefines <property>} property string or applied implicitly if redefining property cannot be distinguished from redefined property. UML 2.0 to 2.1.2 required all redefinitions to be made explicit. This requirement was relaxed in the latest UML specifications. Still, when in doubt it is easier to use explicit {redefines <property>} notation to make your intentions clear.

Example below shows Library Book class with redefined attributes title, author, lang, and loanPeriod. Two of those are explicitly notated as redefined.

Library book has redefined attributes title, author, lang, and loanPeriod.

Library book has redefined attributes
title, author, lang, and loanPeriod.

The title attribute explicitly redefines name. While type of the attributes is the same, name is different. The author attribute is redefined implicitly. Name of the attribute is the same while we assume that Author type is kind of a Person, so that they are "consistent".

The lang attribute is explicitly redefined with different type. Original type was free text String, while redefined attribute is more specific (e.g. enumerated) Language class. We used explicit redefinition in this case because attribute types String and Language seem not to be related.

The loanPeriod attribute is an example of a derived property redefining one which is not derived. The default length of time a Book may be borrowed (loan period) was originally set to 14 (days) while for the Library Book it was redefined as derived because it is calculated based on a library policy, and varies based on a kind of a 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. UML considers property redefined both when it becomes derived and if default value is changed.