UML 模型
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
統合模型語言 (UML) 模型代表的是與格式無關的資料說明。主要優點是定義及描述資料元素,以及這些元素之間的關係。這種以模型為基礎的方法,資料較可能採用結構完整,且容忍修改。
UML 類別關係
UML 模型中的主要類別在 XML 結構定義中會以主要元素表示。UML 類別之間的不同類型的關係會決定 XML 元素在結構定義中的結構方式。
以下有三個類別關係:
- 導向式組合
- 當類別是由子元素或子元素所組成。舉例來說,如果您建立了選舉報告,則選舉報告就會組成選舉。在 XML 結構定義中,系統會產生
Election
元素做為 ElectionReport
元素的子元素。 - 「類型」或「執行個體類型」
- 這就是抽象類別實作具體類別的情況。舉例來說,如果您建立比賽,就會透過具體類別來實作。換句話說,候選人比賽是一種競賽方式。在 XML 結構定義中,
Contest
會以抽象 XML 元素的形式產生,可做為 CandidateContest
元素的擴充功能基礎。 - 導向內容協會
- 當元素含有另一個元素,其中包含與第二個元素相關聯的 ID。例如,如果您將候選人與某方建立關聯或連結至某方,就會發生這種情況。在 XML 結構定義中,
Candidate
元素包含 PartyId
元素,其中包含與 Party
元素相關聯的 ID。
下圖說明三種關係:

UML 模型範例
下圖顯示一個 Contest
實體和兩種 Contest
類型:CandidateContest
和 PartyContest
。

下圖為 CandidateContest
的類別圖概略檢視畫面:

下圖為 PartyContest
的類別圖概略檢視畫面:

除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-08-21 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2024-08-21 (世界標準時間)。"],[[["The Unified Modeling Language (UML) model provides a standardized way to describe data, focusing on data elements and their relationships for better structure and adaptability."],["UML class relationships, including directed composition, \"type of\" or \"instance of\", and directed association, influence the structure of XML elements within a schema."],["Directed 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."],["UML diagrams visually represent these relationships, showcasing examples like contest entities and their various types, along with detailed views of specific contest structures."]]],[]]