使用 BallotSelection 識別選舉中的選票選項,例如將候選人和政黨連結至得票數。
本文將討論 BallotSelection 及其子實體:
BallotSelectionCandidateSelectionPartySelectionBallotMeasureSelectionSpecialBallotSelection
選取下列其中一種動態饋給類型,進一步瞭解如何使用BallotSelection,以及該類型動態饋給的固有元素。
BallotSelection
BallotSelection 是抽象元素,會根據競賽類型使用三種不同類型:
CandidateSelection:如果比賽適用於一或多名候選人,請使用這個type的BallotSelection。將選票選項連結至Candidate元素。PartySelection:當競賽類型為Party時,請使用這個BallotSelection的BallotSelection,例如政黨比例競賽。typeBallotMeasureSelection:使用這類BallotSelection代表BallotMeasureContest中的可能選項。SpecialBallotSelection:這類BallotSelection用於彙整票數 (例如將多位候選人彙整為「其他」),以及不同類型的無效票 (即空白選票、無效或廢票,以及「以上皆非」票)。
屬性
下表說明 BallotSelection 的屬性:
| 屬性 | 是否必要? | 類型 | 說明 |
|---|---|---|---|
objectId
|
必填 | ID |
其他元素用來參照這個元素的專屬內部 ID。 |
元素
下表說明 BallotSelection 的元素:
| 元素 | 多重性 | 類型 | 說明 |
|---|---|---|---|
SequenceOrder |
0 或 1 | integer |
指定選票選項的預設顯示順序。 如果動態饋給中沒有 |
CandidateSelection
使用 CandidateSelection 識別候選人競選中的選票選項,包括手寫選項。
CandidateSelection 會繼承 BallotSelection 的屬性和元素。如有需要,可以加入多個 Candidate 元素的參照,例如選票選的是多位候選人的票。
如果票證參照多位候選人,有時必須保留候選人的順序。在這些情況下,我們希望生成應用程式根據現有的排序方式,列出 CandidateIds 內 Candidate 元素的參照。舉例來說,候選人的順序必須與 CandidateContest 類型 Contest 中 OfficeIds 內的 Office 元素參照順序相同。
如果參照多個 Candidate 物件,系統會依下列順序向使用者顯示:
- 所有將
IsTopTicket設為true的候選項目,都會排在沒有IsTopTicket值的候選項目之前。因此,這類候選人會排在IsTopTicket設為false的所有候選人之前。理想情況下,選取項目會設為沒有IsTopTicket值的候選項目,或是設為一對候選項目,其中一個候選項目的IsTopTicket設為true。如果不符合這些條件,就會發生下列情況:- 如果候選人的
IsTopTicket設為true,系統會以未定義的順序呈現。 - 如果候選人沒有
IsTopTicket,系統會以未定義的順序顯示。 - 如果候選人的
IsTopTicket設為false,系統會以未定義的順序呈現。
- 如果候選人的
CandidateSelection 的 XML 語法如下:
<BallotSelection xsi:type="CandidateSelection">。
元素
下表說明 CandidateSelection 的元素:
| 元素 | 多重性 | 類型 | 說明 |
|---|---|---|---|
CandidateIds |
1 | IDREFS |
一或多個 Candidate 元素的專屬 ID。用於將候選人與選票上的候選人選項建立關聯。如果選票上有多位候選人,例如總統和副總統一起選,這個功能也很有用。 |
EndorsementPartyIds |
0 個以上 | IDREFS |
兩個以上Party實體的專屬 ID。這代表政黨在選票上列出同一位候選人。 |
IncludedInAggregation |
0 或 1 | boolean |
所選選項的票數是否計入競賽的 AggregateBallotSelection。如未指定,則為預設值。
false
|
IsWriteIn |
0 或 1 | boolean |
指出候選人是否為自填候選人。預設值為 false。 |
範例
XML
<BallotSelection objectId="cs10861" xsi:type="CandidateSelection"> <CandidateIds>can10861a can10861b</CandidateIds> </BallotSelection>
JSON
"BallotSelection": [ { "@type": "CandidateSelection", "objectId": "cs10861", "CandidateIds": [ "can10861a", "can10861b" ] } ]
PartySelection
使用 PartySelection 找出涉及政黨的選票選項,例如選票上的政黨名單選項。
PartySelection 會繼承 BallotSelection 的屬性和元素。PartySelection 的 XML 語法如下:<BallotSelection xsi:type="PartySelection" ... />。
元素
下表說明 PartySelection 的元素:
| 元素 | 多重性 | 類型 | 說明 |
|---|---|---|---|
IncludedInAggregation |
0 或 1 | boolean |
所選選項的票數是否計入競賽的 AggregateBallotSelection。如未指定,則為預設值。
false
|
PartyIds |
1 | IDREFS |
一或多個 Party 元素的專屬 ID。用來將一或多個當事人與當事人選取項目建立關聯。 |
範例
XML
<BallotSelection objectId="ps150" xsi:type="PartySelection"> <PartyIds>par100</PartyIds> </BallotSelection>
JSON
"BallotSelection": [ { "@type": "PartySelection", "objectId": "ps150", "PartyIds": [ "par100" ] } ]
BallotMeasureSelection
使用 BallotMeasureSelection 找出涉及選票措施 (例如公民投票) 的選票選項。
BallotMeasureSelection 會繼承 BallotSelection 的屬性和元素。BallotMeasureSelection 的 XML 語法如下:
<BallotSelection xsi:type="BallotMeasureSelection" ... />。
元素
下表說明 BallotMeasureSelection 的元素:
| 元素 | 多重性 | 類型 | 說明 |
|---|---|---|---|
ExternalIdentifiers |
0 或 1 | ExternalIdentifiers |
將 ID 與投票議案選項建立關聯。必須提供穩定 ID。 |
Selection |
1 | InternationalizedText |
提供選票的可用選項,例如 Yes
或 No。 |
範例
XML
<BallotSelection objectId="bms00" xsi:type="BallotMeasureSelection"> <ExternalIdentifiers> <ExternalIdentifier> <Type>other</Type> <OtherType>stable</OtherType> <Value>bmc0_yes</Value> </ExternalIdentifier> </ExternalIdentifiers> <Selection> <Text language="en">Yes</Text> </Selection> </BallotSelection>
JSON
"BallotSelection": [ { "@type": "BallotMeasureSelection", "objectId": "bms00", "ExternalIdentifiers": { "ExternalIdentifier" : [ { "Type": "other", "OtherType": "stable", "Value": "bmc0_yes" } ] }, "Selection": { "Text": [ { "value": "Yes", "language": "en" } ] } } ]
XML
<BallotSelection objectId="bms00" xsi:type="BallotMeasureSelection"> <ExternalIdentifiers> <ExternalIdentifier> <Type>other</Type> <OtherType>stable</OtherType> <Value>bmc0_yes</Value> </ExternalIdentifier> </ExternalIdentifiers> <Selection> <Text language="en">Yes</Text> </Selection> </BallotSelection>
JSON
"BallotSelection": [ { "@type": "BallotMeasureSelection", "objectId": "bms00", "ExternalIdentifiers": { "ExternalIdentifier" : [ { "Type": "other", "OtherType": "stable", "Value": "bmc0_yes" } ] }, "Selection": { "Text": [ { "value": "Yes", "language": "en" } ] } } ]
SpecialBallotSelection
這類 BallotSelection 用於彙整票數 (例如將多位候選人彙整為「其他」),以及各種非選票 (即空白選票、無效或廢票,以及「以上皆非」票)。
SpecialBallotSelection 不應在 Contest 的一般 BallotSelection 子元素中使用,而應在 Contest 上有自己的專屬欄位,即 AggregateBallotSelection、BlankBallotSelection、NoneOfTheAboveBallotSelection 和 NullBallotSelection。詳情請參閱Contest 元素。
元素
下表說明 SpecialBallotSelection 的元素:
| 元素 | 多重性 | 類型 | 說明 |
|---|---|---|---|
CountedInTotal |
0 或 1 | boolean |
實體選取項目的票數是否計入總票數,並視為值得注意。如未指定,則假設為 true。
|
ExternalIdentifiers |
0 或 1 | ExternalIdentifiers |
將 ID 與投票議案選項建立關聯。必須提供穩定 ID。 |
Selection |
1 | InternationalizedText |
提供這項選票選項的名稱,例如「其他」或「以上皆非」。 |
範例
XML
<AggregateBallotSelection objectId="selection3"> <Selection> <Text language="en">Other Candidates</Text> </Selection> <ExternalIdentifiers> <ExternalIdentifier> <Type>other</Type> <OtherType>stable</OtherType> <Value>selection3</Value> </ExternalIdentifier> </ExternalIdentifiers> </AggregateBallotSelection> <!-- Counts of ballots left blank --> <BlankBallotSelection objectId="selection4"> <Selection> <Text language="en">Blank ballots</Text> </Selection> <!-- These ballots count in the total and can affect majorities --> <CountedInTotal>true</CountedInTotal> <ExternalIdentifiers> <ExternalIdentifier> <Type>other</Type> <OtherType>stable</OtherType> <Value>selection4</Value> </ExternalIdentifier> </ExternalIdentifiers> </BlankBallotSelection> <!-- Votes for "None of the above" option on the ballot --> <NoneOfTheAboveBallotSelection objectId="selection5"> <!-- The NOTA selection optiona as it appears on the ballot, often "None of the above", "None", or "Uncommitted" --> <Selection> <Text language="en">None</Text> </Selection> <!-- These ballots count in the total and can affect majorities --> <CountedInTotal>true</CountedInTotal> <ExternalIdentifiers> <ExternalIdentifier> <Type>other</Type> <OtherType>stable</OtherType> <Value>selection5</Value> </ExternalIdentifier> </ExternalIdentifiers> </NoneOfTheAboveBallotSelection> <!-- Counts of null or spoiled ballots, i.e. ballots that have been marked in a way that the vote cannot be counted --> <NullBallotSelection objectId="selection5"> <!-- How these ballots are often called in a given country, often "null" or "spoiled" --> <Selection> <Text language="en">Spoiled ballots</Text> </Selection> <!-- These ballots do count in the total and are treated as the same as if this vote did not happen at all --> <CountedInTotal>false</CountedInTotal> <ExternalIdentifiers> <ExternalIdentifier> <Type>other</Type> <OtherType>stable</OtherType> <Value>selection5</Value> </ExternalIdentifier> </ExternalIdentifiers> </NullBallotSelection>
JSON
"AggregateBallotSelection": { "objectId": "selection3", "Selection": { "Text": { "@language": "en", "#text": "Other Candidates" } }, "ExternalIdentifiers": { "ExternalIdentifier": { "Type": "other", "OtherType": "stable", "Value": "selection3" } }, }, "BlankBallotSelection": { "objectId": "selection4", "Selection": { "Text": { "@language": "en", "#text": "Blank Ballots" } }, "CountedInTotal": true, "ExternalIdentifiers": { "ExternalIdentifier": { "Type": "other", "OtherType": "stable", "Value": "selection4" } } }, "NoneOfTheAboveBallotSelection": { "objectId": "selection5", "Selection": { "Text": { "@language": "en", "#text": "None" } }, "CountedInTotal": true, "ExternalIdentifiers": { "ExternalIdentifier": { "Type": "other", "OtherType": "stable", "Value": "selection5" } } }, "NullBallotSelection": { "objectId": "selection5", "Selection": { "Text": { "@language": "en", "#text": "Spoiled ballots" } }, "CountedInTotal": false, "ExternalIdentifiers": { "ExternalIdentifier": { "Type": "other", "OtherType": "stable", "Value": "selection5" } } }