Previous Table of Contents Next


4.3.1 Identifying class instances


   Class instances (objects) are concepts that can be referred to by other constructs, such as References, Associations, and Attributes. For this reason they require a unique name by which they can be identified within the HUTN text stream. As mentioned above, an arbitrary unique identifier such as the XMI ID provides this, and is thus a logical choice for a default identifier. However, since this string is meaningless in terms of the data being represented, it makes for a somewhat poor identifier with regard to usability. It would be far better to use an identifier that somehow is relevant to or symbolic of the instance that it identifies.

   The logical choice, therefore, is to use an attribute of the class instance as the identifier. Many classes do contain an attribute which can serve as a unique identifier for the object (e.g., a name or ID field). However, it is vital that the attribute chosen does indeed distinguish between the instances of this class (it does not have to be distinct relative to instances of other unrelated classes). Since the MOF does not provide a mechanism by which an attribute can be defined as unique, the responsibility of ensuring the uniqueness of the identifying attribute must be provided by the user/model-builder.

   For attributes with a very limited range of values, this is obviously difficult. For example, if an attribute’s type is boolean, or if it is an enumeration, the attribute is unlikely to make a useful identifier, since its small range of values will greatly restrict the number of instances that it can uniquely identify. However, there are cases where these types may serve to uniquely identify class instances. The only attributes that are never practical as unique identifiers, due mainly to the impossibility of comparing values, are those of class types, and therefore it is illegal to nominate a class-valued attribute as a unique identifier for a Class. Also, the attribute selected must be mandatory (not optional), since it will always be required to generate the object identifier.

   This identifying attribute may not be configured to have a default value, as only a single instance of a class (within a given scope) may have any particular value for this attribute if it is an identifying attribute. (See 4.3.5, “Default Values? for information about configuration of default values.)

   Since the value of the attribute selected as the identifying attribute is presented in the class instance’s introduction, its normal representation within the body of the instance’s definition is superfluous, and is thus omitted.

   In addition to defining the meaning of the identifying string, users are also given the ability to define the scope over which the string is unique. By default, identifying strings (be they arbitrary or the value of an attribute) are required to be unique over the set of instances of the class, and over all instances of its subtypes. Alternatively, the identifier may be configured to be unique within the scope of the instance’s containing object. This allows for nested identification structures.

   Class instance identifiers are configured using the IdentifierConfig metaclass (see 5.1.6, “IdentifierConfig?).