Previous | Table of Contents | Next |
A property is a structural feature of a classifier that characterizes instances of the classifier. Constructs::Property merges
the definition of Basic::Property with Constructs::StructuralFeature.
A property related by ownedAttribute to a classifier (other than an association) represents an attribute and might also represent
an association end. It relates an instance of the class to a value or set of values of the type of the attribute.
A property related by memberEnd or its specializations to an association represents an end of the association. The type of
the property is the type of the end of the association.
Description
Property represents a declared state of one or more instances in terms of a named relationship to a value or values. When
a property is an attribute of a classifier, the value or values are related to the instance of the classifier by being held
in slots of the instance. When a property is an association end, the value or values are related to the instance or instances
at the other end(s) of the association (see semantics of Association).
Property is indirectly a subclass of Constructs::TypedElement. The range of valid values represented by the property can be
controlled by setting the property’s type.
Generalizations
•
“StructuralFeature? on page 130
Attributes
• isDerivedUnion : Boolean Specifies whether the property is derived as the union of all of the properties that are constrained to subset it. The default value is false.
• isReadOnly : Boolean This redefines the corresponding attribute in Basic::Property and Abstractions::StructuralFeature. The default value is false.
Associations
• redefinedProperty : Property [*] References the properties that are redefined by this property. Subsets RedefinableElement::redefinedElement.
• subsettedProperty : Property [*] References the properties of which this property is constrained to be a subset.
• / opposite : Property [0..1] In the case where the property is one navigable end of a binary association with both ends navigable, this gives the other end.
• association: Association [0..1] References the association of which this property is a member, if any.
• owningAssociation: Association [0..1] References the owning association of this property, if any. Subsets Property::association, NamedElement::namespace, and Feature::featuringClassifier.
Constraints
[1] If this property is owned by a class, associated with a binary association, and the other end of the association is also
owned by a class, then opposite gives the other end.
opposite =if owningAssociation->notEmpty() and association.memberEnd->size() = 2 thenlet otherEnd = (association.memberEnd - self)->any() in
if otherEnd.owningAssociation->notEmpty() then otherEnd else Set{} endifelse Set {}endif
[2] A specialization of a composite aggregation is also a composite aggregation.A multiplicity of a composite aggregation
must not have an upper bound greater than 1.
isComposite implies (upperBound()->isEmpty() or upperBound() <= 1)
[3] Subsetting may only occur when the context of the subsetting property conforms to the context of the subsetted property.
subsettedProperty->notEmpty() implies(subsettingContext()->notEmpty() and subsettingContext()->forAll (sc |subsettedProperty->forAll(sp | sp.subsettingContext()->exists(c | sc.conformsTo(c)))))
[4] A navigable property can only be redefined or subsetted by a navigable property.
(subsettedProperty->exists(sp | sp.isNavigable()
implies isNavigable())and(redefinedProperty->exists(rp | rp.isNavigable
implies isNavigable())
[5] A subsetting property may strengthen the type of the subsetted property, and its upper bound may be less.
subsettedProperty->forAll(sp |type.conformsTo(sp.type) and((upperBound()->notEmpty() and sp.upperBound()->notEmpty()) impliesupperBound()<=sp.upperBound() ))
[6] Only a navigable property can be marked as readOnly.
isReadOnly implies isNavigable()
[7] A derived union is derived.
isDerivedUnion implies isDerived
[8] A derived union is read only
isDerivedUnion implies isReadOnly
Additional Operations
[1] The query isConsistentWith() specifies, for any two Properties in a context in which redefinition is possible, whether
redefinition would be logically consistent. A redefining property is consistent with a redefined property if the type of the
redefining property conforms to the type of the redefined property, the multiplicity of the redefining property (if.specified)
is contained in the multiplicity of the redefined property, and the redefining property is derived if the redefined property
is derived.
Property::isConsistentWith(redefinee : RedefinableElement) : Booleanpre: redefinee.isRedefinitionContextValid(self)isConsistentWith = (redefinee.oclIsKindOf(Property) and
let prop: Property = redefinee.oclAsType(Property) in type.conformsTo(prop.type) and (lowerBound()->notEmpty and prop.lowerBound()->notEmpty()
implies
lowerBound() >= prop.lowerBound()) and
(upperBound()->notEmpty and prop.upperBound()->notEmpty() implies upperBound() <= prop.upperBound()) and (prop.isDerived implies
isDerived) )
[2] The query subsettingContext() gives the context for subsetting a property. It consists, in the case of an attribute, of
the corresponding classifier, and in the case of an association end, all of the classifiers at the other ends.
Property::subsettingContext() : Set(Type)subsettingContext =if association->notEmpty()then association.endType-type else if classifier->notEmpty() then Set{classifier} else Set{} endifendif
[3] The query isNavigable indicates whether it is possible to navigate across the property.
Property::isNavigable() : BooleanIsNavigable = not classifier->isEmpty() orassociation.owningAssociation.navigableOwnedEnd->includes(self)
Semantics
When a property is owned by a classifier other than an association via ownedAttribute, then it represents an attribute of
the class or data type. When related to an association via memberEnd or one of its specializations, it represents an end of
the association. In either case, when instantiated a property represents a value or collection of values associated with an
instance of one (or in the case of a ternary or higher-order association, more than one) type. This set of types is called
the context for the property; in the case of an attribute the context is the owning classifier, and in the case of an association
end the context is the set of types at the other end or ends of the association.
The value or collection of values instantiated for a property in an instance of its context conforms to the property’s type.
Property inherits from MultiplicityElement and thus allows multiplicity bounds to be specified. These bounds constrain the
size of the collection. Typically and by default the maximum bound is 1.
Property also inherits the isUnique and isOrdered meta-attributes. When isUnique is true (the default) the collection of values
may not contain duplicates. When isOrdered is true (false being the default) the collection of values is ordered. In combination
these two allow the type of a property to represent a collection in the following way:
Table 11.1 - Collection types for properties
isOrdered |
isUnique |
Collection type |
|||
false | true | Set | |||
true | true | OrderedSet | |||
false | false | Bag | |||
true | false | Sequence |
If there is a default specified for a property, this default is evaluated when an instance of the property is created in the
absence of a specific setting for the property or a constraint in the model that requires the property to have a specific
value. The evaluated default then becomes the initial value (or values) of the property.
If a property is derived, then its value or values can be computed from other information. Actions involving a derived property
behave the same as for a non-derived property. Derived properties are often specified to be read-only (i.e., clients cannot
directly change values). But where a derived property is changeable, an implementation is expected to appropriately change
the source information of the derivation. The derivation for a derived property may be specified by a constraint.
The name and visibility of a property are not required to match those of any property it redefines.
A derived property can redefine one that is not derived. An implementation must ensure that the constraints implied by the
derivation are maintained if the property is updated.
If a property has a specified default, and the property redefines another property with a specified default, then the redefining
property’s default is used in place of the more general default from the redefined property.
If a navigable property is marked as readOnly, then it cannot be updated once it has been assigned an initial value.
A property may be marked as a subset of another, as long as every element in the context of the subsetting property conforms
to the corresponding element in the context of the subsetted property. In this case, the collection associated with an instance
of the subsetting property must be included in (or the same as) the collection associated with the corresponding instance
of the subsetted property.
A property may be marked as being a derived union. This means that the collection of values denoted by the property in some
context is derived by being the strict union of all of the values denoted, in the same context, by properties defined to subset
it. If the property has a multiplicity upper bound of 1, then this means that the values of all the subsets must be null or
the same.
Notation
The following general notation for properties is defined. Note that some specializations of Property may also have additional
notational forms. These are covered in the appropriate Notation sections of those classes.
<property> ::= [<visibility>] [‘/’] <name> [‘:’ <prop-type>] [‘[‘ <multiplicity> ‘]’] [‘=’ <default>] [‘{‘ <prop-property
> [‘,’ <prop-property >]* ’}’]
where:
• <visibility> is the visibility of the property (See “VisibilityKind? on page 88). <visibility> ::= ‘+’ | ‘-‘
• ‘/’ signifies that the property is derived.
• <name> is the name of the property.
• <prop-type> is the name of the Classifier that is the type of the property.
• <multiplicity> is the multiplicity of the property. If this term is omitted, it implies a multiplicity of 1 (exactly one). (See “MultiplicityElement? on page 129.)
• <default> is an expression that evaluates to the default value or values of the property.
• <prop-modifier > indicates a modifier that applies to the property.
<prop-modifier> ::= ‘readOnly’ | ‘union’ | ‘subsets‘ <property-name> | ‘redefines’ <property-name> | ‘ordered’ | ‘unique’ | <prop-constraint>
where:
• readOnly means that the property is read only.
• union means that the property is a derived union of its subsets.
• subsets <property-name> means that the property is a proper subset of the property identified by <propertyname>.
• unique means that there are no duplicates in a multi-valued property.
• <prop-constraint> is an expression that specifies a constraint that applies to the property.
• redefines <property-name> means that the property redefines an inherited property identified by <propertyname>.
• ordered means that the property is ordered.
All redefinitions shall be made explicit with the use of a {redefines <x>} property string. Redefinition prevents inheritance
of a redefined element into the redefinition context thereby making the name of the redefined element available for reuse,
either for the redefining element, or for some other.