What Is UML?
The Unified Modeling Language (UML) defines a standard language and graphical notation for creating models of business and technical systems. Contrary to popular opinion, UML is not limited to use as a tool for programmers. The UML defines model types that span a range from functional requirements and activity workflow models to class structure design and component diagrams. These models, and a development process that uses them, improve and simplify communication among an application's many diverse stakeholders.
A UML class diagram can be constructed to visually represent the elements, relationships, and constraints of an XML vocabulary. With a little initial coaching, class diagrams allow complex vocabularies to be shared with non-technical business stakeholders. A very simple subset of a product catalog vocabulary is shown as a class diagram in Figure 2 .
Figure 2 Simple UML class diagram.
These are the primary elements of a UML class diagram:
Class. This example defines two classes: CatalogItem and Organization. A class represents an aggregation of structural features and defines a namespace for those feature names. Thus, both classes can contain an attribute named name, but their class namespace scope makes the two attributes distinct.
Attribute. Each class can define a set of attributes. Each attribute has a type; in this example, string, double, and float refer to the built-in datatypes as defined by the XML Schema specification. For those of you thinking ahead to XML Schema design, specifying a UML attribute does not limit the schema to an XML attribute; the mapping-to-schema syntax allows either an XML attribute or child element.
Operation. The computeTax() operation of CatalogItem specifies part of the behavior for this class. In other words, what does the class do, in addition to defining the structure of its data? In object-oriented parlance, if you send a computeTax message to a CatalogItem object, it will return a floating-point data value. This operation does not expect any parameters, but they could be specified between the parentheses. We will not use class operations in the specification of XML vocabulary, but their definition would be critical to web services, especially WSDL specification of SOAP messages.
Association. An association relates two or more classes in a model. If an association has an arrow on one end, it means that the association is usually navigated in one direction and provides a hint to design and implementation of this vocabulary.
Role and multiplicity. The end of an association may specify the role of the class; the Organization plays a supplier role for a CatalogItem in this model. In addition, the 1..* multiplicity means that there must be one or more suppliers for each catalog item.
Generalization. Although Figure 2 does not include class inheritance (one class as a generalization of another), this structure is fundamental to object-oriented models and is included in the next expanded example.