Classifier (additional properties)

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.
When a property is owned by a class it represents an attribute. In this case it relates an instance of the class to a value or
set of values of the type of the attribute.
When a property is owned by an association it represents a non-navigable end of the association. In this case 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.

Attributes

isDerivedUnion : Boolean Specifies whether the property is derived as the union of all of the properties that are con-
strained to subset it. The default value is false.
isReadOnly : Boolean This redefines the corresponding attribute in Basic::Property and Abstractions::Structur-
alFeature
. The default value is false.

Associations

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::asso-
ciation, NamedElement::namespace, and Feature::featuringClassifier.
redefinedProperty : Property [*]References the properties that are redefined by this property. Subsets RedefinableEle-
ment::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.

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 then
    let otherEnd = (association.memberEnd - self)->any() in
    if otherEnd.owningAssociation->notEmpty() then otherEnd else Set{} endif
    else Set {}
    endif
  2. A specialization of a composite aggregation is also a composite aggregation.
  3. A multiplicity of a composite aggregation must not have an upper bound greater than 1.

    isComposite implies (upperBound()->isEmpty() or upperBound() <= 1)

  4. 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)))))
  5. A navigable property (one that is owned by a class) can only be redefined or subsetted by a navigable property.
    (subsettedProperty->exists(sp | sp.class->notEmpty())
    implies class->notEmpty())
    and
    (redefinedProperty->exists(rp | rp.class->notEmpty())
    implies class->notEmpty())
  6. 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()) implies
    upperBound()<=sp.upperBound() ))
  7. Only a navigable property can be marked as readOnly.

    isReadOnly implies class->notEmpty()

  8. A derived union is derived.

    isDerivedUnion implies isDerived

  9. 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.speci-
    fied) is contained in the multiplicity of the redefined property, and the redefining property is derived if the redefined prop-
    erty is derived.
    Property::isConsistentWith(redefinee : RedefinableElement) : Boolean
    pre: 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{} endif
    endif

Semantics
When a property is owned by a class or data type via ownedAttribute, then it represents an attribute of the class or data
type. When owned by an association via ownedEnd, it represents a non-navigable 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:

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

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 (attribute) 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
Notation for properties is defined separately for their use as attributes and association ends. Examples of subsetting and
derived union are shown for associations.