Previous UML Classes Table of Contents UML Packages Next


7.3.44 Property

Kernel , AssociationClasses


   A property is a structural feature.

   A property related to a classifier by ownedAttribute represents an attribute, and it may also represent an association end. It relates an instance of the class to a value or collection of values of the type of the attribute.

   A property related to an Association by memberEnd or its specializations represents an end of the association. The type of property is the type of the end of the association.

*Generalizations

   

    StructuralFeature (from Kernel ) on page 135

*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.

   Package AssociationClasses

   A property may have other properties (attributes) that serve as qualifiers.

*Attributes

*Associations

   • owningAssociation: Association [0..1] References the owning association of this property. Subsets Property::association, NamedElement ::namespace, Feature::featuringClassifier, and RedefinableElement ::redefinitionContext.

Issue 8976 -add ‘class’ entry

   • class : Class [0..1] References the Class that owns the Property. Subsets NamedElement ::namespace, Feature::featuringClassifier

   Package AssociationClasses

   • associationEnd : Property [0..1] Designates the optional association end that owns a qualifier attribute. Subsets

   Element::owner

   • qualifier : Property [*] An optional list of ordered qualifier attributes for the end. If the list is empty, then the Association is not qualified. Subsets Element::ownedElement

*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.

Issue 8451 - fix constraint

   opposite =if owningAssociation->isEmpty() and association.memberEnd->size() = 2 thenlet otherEnd = (association.memberEnd - self)->any() in

   if otherEnd.owningAssociation->isEmpty() then otherEnd else Set{} endifelse Set {}endif

   [2] A multiplicity on an aggregate end 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)))))

   Issue 8462 - replace constraint

   [4] A redefined property must be inherited from a more general classifier containing the redefining property.

   if (redefinedProperty->notEmpty()) then (redefinitionContext->notEmpty() and redefinedProperty->forAll(rp| ((redefinitionContext->collect(fc| fc.allParents()))->asSet())-> collect(c| c.allFeatures())->asSet()->includes(rp))

   [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

   [9] The value of isComposite is true only if aggregation is composite.

   isComposite = (self.aggregation = #composite)

Issue 9188 - add constraint

   [10] A Property cannot be subset by a Property with the same name

   if (self.subsettedProperty->notEmpty()) then

    self.subsettedProperty->forAll(sp | sp.name <> self.name)

*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 attribute is property.

   Issue 9085 - replace OCL 9117 - replace OCL defined for 9085

   Property::isConsistentWith(redefinee : RedefinableElement ) : Boolean

   pre: redefinee.isRedefinitionContextValid(self) isConsistentWith = redefinee.oclIsKindOf(Property) andlet prop : Property = redefinee.oclAsType(Property) in

   (prop.type.conformsTo(self.type) and

   ((prop.lowerBound()->notEmpty() and self.lowerBound()->notEmpty()) implies prop.lowerBound() >= self.lowerBound()) and ((prop.upperBound()->notEmpty() and self.upperBound()->notEmpty()) implies

   prop.lowerBound() <= self.lowerBound()) and(self.isDerived implies prop.isDerived) and (self.isComposite implies prop.isComposite))

   [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-typeelse 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() or association.owningAssociation.navigableOwnedEnd->includes(self)

Issue 8592 -add new operation

   [4] The query isAttribute() is true if the Property is defined as an attribute of some classifier

   context Property::isAttribute(p : Property) : Booleanpost: result = Classifier.allInstances->exists(c| c.attribute->includes(p))

*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 classifiers 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 7.1 - Collection types for properties

isOrdered

isUnique

Collection type

false true Set
true true OrderedSet
false false Bag

   Table 7.1 - Collection types for properties

   isOrdered

   isUnique

   Collection type

   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.

Issue 8769 - explain about derived properties

   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 nonderived 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 make appropriate changes to the model in order for all the constraints to be met, in particular the derivation constraint for the derived property. 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 which 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 the subset of another, as long as every element in the context of 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.

   A property may be owned by and in the namespace of a datatype.

   Package AssociationClasses

   A qualifier declares a partition of the set of associated instances with respect to an instance at the qualified end (the qualified instance is at the end to which the qualifier is attached). A qualifier instance comprises one value for each qualifier attribute. Given a qualified object and a qualifier instance, the number of objects at the other end of the association is constrained by the declared multiplicity. In the common case in which the multiplicity is 0..1, the qualifier value is unique with respect to the qualified object, and designates at most one associated object. In the general case of multiplicity 0..*, the set of associated instances is partitioned into subsets, each selected by a given qualifier instance. In the case of multiplicity 1 or 0..1, the qualifier has both semantic and implementation consequences. In the case of multiplicity 0..*, it has no real semantic consequences but suggests an implementation that facilitates easy access of sets of associated instances linked by a given qualifier value.

   Note – The multiplicity of a qualifier is given assuming that the qualifier value is supplied. The raw multiplicity without the qualifier is assumed to be 0..*. This is not fully general but it is almost always adequate, as a situation in which the raw multiplicity is 1 would best be modeled without a qualifier.

   Note – A qualified multiplicity whose lower bound is zero indicates that a given qualifier value may be absent, while a lower bound of 1 indicates that any possible qualifier value must be present. The latter is reasonable only for qualifiers with a finite number of values (such as enumerated values or integer ranges) that represent full tables indexed by some finite range of values.

*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.

Issue 8227 - replace ‘prop-property’ with ‘prop-modifier’

   <property> ::= [<visibility>] [‘/’] <name> [‘:’ <prop-type>] [‘[‘ <multiplicity> ‘]’] [‘=’ <default>] [‘{‘ <prop-modifier > [‘,’ <prop-modifier >]* ’}’]

   where:

   

   <visibility> is the visibility of the property. (See VisibilityKind (from Kernel ) on page 141.) <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 (from Kernel ) on page 96.)

   

   <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:

Issue 8461 - change rule for redefinitions and add explanations

   All redefinitions should be made explicit with the use of a {redefines <x>} property string. Matching features in subclasses without an explicit redefinition result in a redefinition that need not be shown in the notation. 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.

   Package AssociationClasses

   A qualifier is shown as a small rectangle attached to the end of an association path between the final path segment and the symbol of the classifier that it connects to. The qualifier rectangle is part of the association path, not part of the classifier. The qualifier is attached to the source end of the association.

   The multiplicity attached to the target end denotes the possible cardinalities of the set of target instances selected by the pairing of a source instance and a qualifier value.

   The qualifier attributes are drawn within the qualifier box. There may be one or more attributes shown one to a line. Qualifier attributes have the same notation as classifier attributes, except that initial value expressions are not meaningful.

   It is permissible (although somewhat rare), to have a qualifier on each end of a single association.

   A qualifier may not be suppressed.

*Style Guidelines

   Package AssociationClasses

   The qualifier rectangle should be smaller than the attached class rectangle, although this is not always practical.

*Examples

   Package AssociationClasses

Figure 7.72 - Qualified associations