Skip to content

Instantly share code, notes, and snippets.

@CountCulture
Created March 15, 2010 21:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CountCulture/333369 to your computer and use it in GitHub Desktop.
Save CountCulture/333369 to your computer and use it in GitHub Desktop.
<!-- This is an example of the key content on a typical page containing ward results pages, marked up appropriately to -->
<!-- expose the information as data rather than just text -->
<!-- NB The eklection data below is dummy data and has been altered to better demonstrate the markup -->
<!-- ####### -->
<!-- ####### -->
<!-- ####### -->
<!-- We start by attached basic info to the div that wraps around the data. -->
<!-- First we need to declare the XML schemas we're going to use and the shortcuts by which we'll refer to them -->
<div id="mainContent" xmlns:openelection="http://openelectiondata.org/0.1/" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:cal="http://www.w3.org/2002/12/cal#" xmlns:v="http://www.w3.org/2006/vcard/ns# " xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
<!-- Then we declare what we're talking about, using a URI to identify it -->
<!-- Though councils could/can generate their own URIs we provide an option to use an external one for those councils (prob the majority) who can't yet generate their own -->
<!-- #### -->
<!-- A Poll is something that happens in on a given date in an electoral ward, resulting in one or more candidates being elected for that position. This is the Poll resource URI -->
<div id="content" about="http://openelectiondata.org/id/polls/41UDGE/2007-05-03/member" typeof='openelection:Poll'>
<!-- Here, we are saying that the Poll is for an electoral area, specifically the ward identified by http://statistics.data.gov.uk/id/local-authority-ward/41UDGE. This is the Ward resource URI -->
<h1 rel="openelection:electionArea">2007 Election Results for <span about="http://statistics.data.gov.uk/id/local-authority-ward/41UDGE">All Saints Ward</span></h1>
<!-- The Election is held on (has a start-date property of) May 3, 2007. By putting the date in a machine-readable form, we're making it clear what the date is, without have to try to figure it out from the letters numbers humans see -->
<p><strong>Election date:</strong> <span datatype="xsd:date" content="2007-05-03" property="cal:dtstart">May 3, 2007</span></p>
<!-- This Election has a possible total electorate of 2919 -->
<p><strong>Electorate:</strong> <span property="openelection:electorate" datatype="xsd:integer">2919</span></p>
<!-- 1035 ballot papers were issued -->
<p><strong>Ballot Papers Issued: </strong><span property="openelection:ballotsIssued" datatype="xsd:integer">1035</span></p>
<!-- 10 ballot papers were rejected (NB dummy figures) -->
<p><strong>Rejected Ballot Papers: </strong><span property="openelection:rejectedBallots" datatype="xsd:integer">10</span></p>
<p><strong>Turnout:</strong><span>35.5%</span></p>
<table width="100%" border="0" summary="2007 Election Results for All Saints Ward">
<tr>
<th scope="col">Candidate's Name </th>
<th scope="col">Party</th>
<th scope="col">Votes</th>
<th scope="col">Percentage of Electorate </th>
<th scope="col">Elected? </th>
</tr>
<!-- These are the candidacies for the poll. A candidacy consists of a person (a candidate), a party, and a vote count -->
<!-- Note that we can list the candidacy before the vote-count is known, so allowing a list of candidates to be published (which would be very useful) -->
<!-- # -->
<!-- In the following list of candidates we've varied the amount of detail provided to show that even if you don't have all the detail, or have technical difficulties publishing it all you can still expose the key information -->
<!-- # -->
<!-- This first statement, attached to the table row, says we're talking about a candidacy -->
<tr rel='openelection:candidacy'>
<!-- Here we are saying the candidate has given names of Keith William and a familyName Cockroft -->
<th scope="row" rel="openelection:candidate"><span property="foaf:givenName">Keith William</span> <span property="foaf:familyName">Cockroft</span></th>
<!-- Here we are saying the candidacy is for a party identified by the resource at http://openelectiondata.org/id/parties/6 (The Labour Party). This is one of the core benefits to using linked data -- being able to specify exactly what we mean by a party. Given that political parties use many different names, it's important that it's clear which party they are standing for. -->
<!-- The Electoral Commission has a list of registered parties, and we've turned those into resource URIs, with one URI per party. See http://openelectiondata.org/parties. At the URI for each party there are links to other resources about this party (Electoral Commission page, and, where known, home page, DBPedia entry, etc) -->
<td rel="openelection:party" resource="http://openelectiondata.org/id/parties/6"><span property="rdfs:label">Labour</span></td>
<!-- The candidacy got 330 votes -->
<td property="openelection:candidateVoteCount" datatype="xsd:integer">330</td>
<td>16.6%</td>
<!-- The candidacy was not successful in winning election. We've added a true/false machine-readable version which makes it clear what we mean -->
<td property="openelection:elected" datatype="xsd:boolean" content="false">No</td>
</tr>
<tr rel='openelection:candidacy'>
<!-- For this candidate we know the address and can mark it up as such, splitting it up into street, locality, region and postcode. NB dummy info -->
<th scope="row" rel="openelection:candidate">
<span typeof="openelection:Candidate" property="foaf:name">Brenda Lilian Constable</span>
<span rel="openelection:address">
<span property="v:street-address">37 Morley Road</span>,
<span property="v:locality">Burntwood</span>,
<span property="v:region">Staffordshire</span>
<span property="v:postal-code">WS7 2DE</span>
</span>
</th>
<!-- Here, we showing an example of what to do if it's not possible to use the URI that identifies the party, putting it in as a literal -->
<td rel="openelection:party"><span property="rdfs:label">Conservative</span></td>
<td property="openelection:candidateVoteCount" datatype="xsd:integer">671</td>
<td>33.8%</td>
<td property="openelection:elected" datatype="xsd:boolean" content="true">Yes</td>
</tr>
<tr rel='openelection:candidacy'>
<th scope="row" rel="openelection:candidate"><span typeof="openelection:Candidate" property="foaf:name">Helen Elizabeth Fisher</span></th>
<td rel="openelection:party" resource="http://openelectiondata.org/id/parties/25"><span property="rdfs:label">Conservative</span></td>
<td property="openelection:candidateVoteCount" datatype="xsd:integer">655</td>
<td>33.0%</td>
<td property="openelection:elected" datatype="xsd:boolean" content="true">Yes</td>
</tr>
<tr rel='openelection:candidacy'>
<th scope="row" rel="openelection:candidate"><span typeof="openelection:Candidate"><span property="foaf:givenName">William Edward</span> <span property="foaf:familyName">Harrison</span></th>
<td rel="openelection:party" resource="http://openelectiondata.org/id/parties/6"><span property="rdfs:label">Labour</span></td>
<td property="openelection:candidateVoteCount" datatype="xsd:integer">331</td>
<td>16.7%</td>
<td property="openelection:elected" datatype="xsd:boolean" content="false">No</td>
</tr>
</table>
<h2>Duly Elected:</h2>
<p>Brenda Lilian Constable (Conservative), Helen Elizabeth Fisher (Conservative)</p>
<!-- Finally, here we are saying that the election information (but not the rest of the info on the page) is made available under the Creative Commons CC0 Open Licence -->
<p rel="foaf:isPrimaryTopicOf" rev="foaf:primaryTopic" resource="#content">Licence for election data: <a rel="license" href="http://creativecommons.org/publicdomain/zero/1.0/">Creative Commons CC0 1.0 Universal</a></p>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment