UML model
Stay organized with collections
Save and categorize content based on your preferences.
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
:

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-08-21 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-08-21 UTC."],[[["\u003cp\u003eThe Unified Modeling Language (UML) model provides a standardized way to describe data, focusing on data elements and their relationships for better structure and adaptability.\u003c/p\u003e\n"],["\u003cp\u003eUML class relationships, including directed composition, "type of" or "instance of", and directed association, influence the structure of XML elements within a schema.\u003c/p\u003e\n"],["\u003cp\u003eDirected composition results in sub-elements, "type of" or "instance of" relationships lead to abstract and concrete element definitions, and directed association establishes links between elements through identifiers.\u003c/p\u003e\n"],["\u003cp\u003eUML diagrams visually represent these relationships, showcasing examples like contest entities and their various types, along with detailed views of specific contest structures.\u003c/p\u003e\n"]]],[],null,["# UML model\n\nThe Unified Modeling Language (UML) model represents a format-independent\ndescription of your data. Its primary benefit is that it defines and describes\nthe data elements and how they're related. With this model-based approach,\nthe data is more likely to be well-structured and tolerant to modifications.\n\nUML class relationships\n-----------------------\n\nThe major classes in the UML model are represented as major elements in your XML\nschema. The different types of relationships between the UML classes determine\nhow your XML elements are structured in the schema.\n\nThere are three class relationships:\n\nDirected composition\n: This is when a class is composed of a sub-element or sub-elements. For\n example, if you create an elections report, then the election report is composed\n of elections. In your XML schema, the `Election` element is generated as a\n sub-element of the `ElectionReport` element.\n\nA \"Type of\" or \"Instance of\"\n: This is when an abstract class implements a concrete class. For example, if\n you create a contest, it's implemented by its concrete class. This means a\n candidate contest is a type of contest. In your XML schema, `Contest` is\n generated as an abstract XML element and serves as an extension base to the\n `CandidateContest` element.\n\nDirected association\n: This is when an element includes another element that contains\n an identifier associated with the second element. For example, this happens if\n you associate or link a candidate to a party. In your XML schema, the\n `Candidate` element includes a `PartyId` element, which contains an identifier\n associated with a `Party` element.\n\nThe following diagram illustrates the three types of relationships:\n\nUML model examples\n------------------\n\nThe following diagram shows a `Contest` entity and two types of `Contest`:\n`CandidateContest` and `PartyContest`.\n\nThe following diagram shows a high-level view of the class diagram for a\n`CandidateContest`:\n\nThe following diagram shows a high-level view of the class diagram for a\n`PartyContest`:"]]