Home > Articles > Software Development & Management > UML

  • Print
  • + Share This
From the author of

Conceptual Models of XML Vocabulary

Now that you understand the basics of UML class diagrams, let's apply them to a larger XML vocabulary design. We'll work with the purchase order vocabulary used in the XML Schema Part 0: Primer document. That example is first introduced in section 2.1 and then elaborated throughout the W3C specification. The model defined in this article adds international addresses and multi-schema support as explained in section 4.1 of the W3C specification. If you are new to XML Schema, I suggest that you review the Primer after reading this article, and then compare our UML design process in these three articles with the same purchase order vocabulary in the schema specification. (Also see the XML.com Schemas Resource Center.)

The purchase order vocabulary is defined in two modules, corresponding to the core PurchaseOrder type and a separate reusable Address module specification. In UML, these modules are called packages. The first package specification is shown as a UML class diagram in Figure 3. The PurchaseOrder class has two attributes and three associations that define its structure. Several of these attributes include a multiplicity specification of [0..1], which means that those attribute values are optional, either 0 or 1 occurrences.

The Address class plays both a shipTo and billTo role in association with a PurchaseOrder. (Hint: these might become shipTo and billTo child elements in the schema.) The multiplicity of 1 means that a PurchaseOrder must have exactly one of each address role. On the Item class, notice that a quantity is of type QuantityType. This type is defined as another class in the UML model. In the same diagram, QuantityType is defined as a subclass of positiveInteger, which is annotated as coming from the XSD_Datatypes package in this UML model. Thus, a quantity is a specialized kind of positive integer.

Both QuantityType and SKU are user-defined datatypes, and both include an attribute that further restricts their intended usage. The pattern and maxExclusive attributes are assigned a value that is used at later stages of the design process to guide XML Schema generation. Finally, the class name of Address is shown in italics, which means that it is an abstract class that is not intended to be used directly. As we'll see next, Address is further specified in another UML class diagram.

Figure 3 Conceptual model of purchase order vocabulary.

The Address package specification, shown in Figure 4, follows a similar logic. In this diagram, both USAddress and UKAddress are specialized subtypes of Address. In common object-oriented interpretation, this means that both of these subtypes inherit the three attributes defined in their superclass. The exportCode attribute of UKAddress is assigned an initial value of 1.

Figure 4 Modularized Address schema component.

  • + Share This
  • 🔖 Save To Your Account