DataTypes Nigel Davis 20190316
Metamodel
UML Superstructure Specification V2.2 7.3 DataType (on page 77) Description A data type is a type whose instances are identified only by their value. A DataType may contain attributes to support the modeling of structured data types. A typical use of data types would be to represent programming language primitive types or CORBA basic types. For example, integer and string types are often treated as data types. Associations ownedAttribute: Property[*] The Attributes owned by the DataType. This is an ordered collection. Subsets Classifier::attribute and Element::ownedMember … Semantics A data type is a special kind of classifier, similar to a class. It differs from a class in that instances of a data type are identified only by their value. All copies of an instance of a data type and any instances of that data type with the same value are considered to be the same instance. Instances of a data type that have attributes (i.e., is a structured data type) are considered to be the same if the structure is the same and the values of the corresponding attributes are the same. If a data type has attributes, then instances of that data type will contain attribute values matching the attributes. From Classifier (on page 68) A classifier is a classification of instances, it describes a set of instances that have features in common. From Class (on page 65) The purpose of a class is to specify a classification of objects [Object is not defined in 7.3] [Unstated implication from DataType is that an instance of a Class is identified by some id rather than its values (but this appears to not be stated anywhere]
UML Superstructure Specification V2.2 7.3 Property (on page 122) Summary 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. 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). From Association on page 55 An association describes a set of tuples whose values refer to typed instances.
Working towards an interpretation A Class has a specific id attribute such that an instance (object) that conform to the class can be referred to by the value of the id attribute A DataType has no id attribute, or alternatively, an instance (object) that conforms to the DataType can only be referred to by all of its values together, i.e., its values are its identity PrimativeType (e.g., Boolean) is derived from DataType. An interpretation of this is that there are two distinct identities, TRUE and FALSE and that one instance of the DataType is Invariant TRUE and the other is Invariant FALSE. A Class that has an attribute that is a property of type Boolean can be considered as having a reference to a DataType of type Boolean An instance of that class essentially has a reference to an instance of the DataType where there are two candidate instance, one with the value TRUE and the other with the value FALSE. The reference itself has the value TRUE or the value FALSE as the DataType instance identity is all of its values For Integer etc. this derivation seems very strange. There is an invariant instance for every case of integer?? Etc?? Clearly, this would be ridiculous But for a moment, let’s go there… Let’s assume that there is an instance of the DataType String that is “Bob”. An instance of the class with the attribute that is the property of type String reference this, but to do so, the property value must be the value of the instance of the DataType and hence is value “Bob”. An interpretation of this is that all possible DataTypes do not need to be instantiate, in fact none are. The reference is to an invisible instance of DataType “Bob”. That two instances reference “Bob” is of no consequence. If the property is writeable, this is essentially changing the pointer…. So Bob Bill is just a change of pointer to another invisible instance. The class instance must have the full value of the referenced item etc. Considering more complex DataTypes, the value in the instance is the full structured value of the DataType instance. This appears to lead to the usage in ONF/ITU-T that a DataType specifies a complex structure