UML model

The Unified Modeling Language (UML) model represents a format-independent description of your data. Its primary benefit is that it defines and describes the data elements and how they're related. With this model-based approach, the data is more likely to be well-structured and tolerant to modifications.

UML class relationships

The major classes in the UML model are represented as major elements in your XML schema. The different types of relationships between the UML classes determine how your XML elements are structured in the schema.

There are three class relationships:

Directed composition
This is when a class is composed of a sub-element or sub-elements. For example, if you create an elections report, then the election report is composed of elections. In your XML schema, the Election element is generated as a sub-element of the ElectionReport element.
A "Type of" or "Instance of"
This is when an abstract class implements a concrete class. For example, if you create a contest, it's implemented by its concrete class. This means a candidate contest is a type of contest. In your XML schema, Contest is generated as an abstract XML element and serves as an extension base to the CandidateContest element.
Directed association
This is when an element includes another element that contains an identifier associated with the second element. For example, this happens if you associate or link a candidate to a party. In your XML schema, the Candidate element includes a PartyId element, which contains an identifier associated with a Party element.

The following diagram illustrates the three types of relationships:

UML model examples

The following diagram shows a Contest entity and two types of Contest: CandidateContest and PartyContest.

The following diagram shows a high-level view of the class diagram for a CandidateContest:

The following diagram shows a high-level view of the class diagram for a PartyContest: