Previous Table of Contents Next


6.4 Attribute Representations

   [18] AttributeInstance := 19:NormalAttribute | 20:KeywordAttribute

   [19] NormalAttribute := <AttributeName> (’:‘ | ‘=’) ( 25:DataValue | ‘null’)

   [20] KeywordAttribute := (‘~’)? <AttributeName>?

   The standard representation for attributes consists of the attribute name, followed by a colon or by an equals sign ‘=’, followed by the data value of the attribute, encoded as is appropriate for the attribute’s type. There are, however, a number of shorthands for attribute representation. If a default value has been specified for the attribute, then the absence of the attribute’s representation must be taken to mean that the attribute has the default value. Mandatory boolean attributes can be represented using the adjective or keyword shorthands. If there is no default value configured, then a value of true is indicated by the attribute name, and a value of false by the absence of the attribute name. The same applies if a default value of false has been configured. However, if a default value of true is configured, then the absence of the attribute name indicates a value of true, and a value of false is represented by the attribute name preceded by a tilde ‘~’.

   Attributes whose lower multiplicity bound is 0 may be explicitly unset by assigning them to the ‘null’ keyword.

    Figure 6-7 presents an example of a number of attributes’ representations. The ‘migrants’ attribute has been used as a keyword on the Family class, the ‘nuclear’ attribute as an adjective of Family, ‘familyName’ configured as the identifying attribute of Family, and ‘name’ has been configured as the identifier of Person.

   FamilyPackage “id-001? {

   Family “The McDonalds? { migrants Address: “7 Main Street?

   Reference representations

   } nuclear Family “The Smiths? { Address: “5 Main Street?

   Reference representations

   }

   Person “Namdou Ndiaye? { age: 7 sex: male

   Reference representations

   } }

   Figure 6-7 An example of representations of simple attributes

   Attributes whose values are instances of a class are represented in two separate ways. If the attribute class instance is contained by the enclosing class instance (that is, it does not exist outside of the containing instance’s scope), then the attribute instance may be represented in-line in the manner described in 6.3, “Class Representations.? Alternatively, a class instance may appear as a referred object, as described in 6.3, “Class Representations.? If the class instance is not contained, then only this second representation may be used. An example in which petFish is a contained attribute and petDog is a non-contained attribute, both of Family, is presented in Figure 6-8.

   FamilyPackage “id-001? {

   Family “The McDonalds? {petDog: Dog “Spike?petFish: Fish “Wanda? {

   Attribute and reference representations

   }}Dog “Spike? {

   Attribute and reference representations

   } }

   Figure 6-8 An example of class-instance valued attributes