Skip to content

Instantly share code, notes, and snippets.

@jnothman
Created October 23, 2017 06:05
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 jnothman/a60a7a906cd31cff8f9b0a5fa4012500 to your computer and use it in GitHub Desktop.
Save jnothman/a60a7a906cd31cff8f9b0a5fa4012500 to your computer and use it in GitHub Desktop.
Get Australian/COAG parliamentarians' Positions, Party Memberships and Awards from WikiData.
SELECT
?subj
?subjLabel
?prop
?position
?positionLabel
?start
?end
?district
?districtLabel
WHERE
{
VALUES ?memberlabel { "Member of the Australian House of Representatives"@en
"member of the Australian Senate"@en
"Member of the New South Wales Legislative Assembly"@en
"Member of the New South Wales Legislative Council"@en
"Member of the Australian Capital Territory Legislative Assembly"@en # Broken
"Member of the Queensland Legislative Assembly"@en
"Member of the Queensland Legislative Council"@en
"Member of the South Australian Legislative Council"@en
"Member of the South Australian House of Assembly"@en
"Member of the Tasmanian House of Assembly"@en
"Member of the Tasmanian Legislative Council"@en
"Member of the Victorian Legislative Council"@en
"Member of the Victorian Legislative Assembly"@en
"Member of the Western Australian Legislative Assembly"@en
"Member of the Western Australian Legislative Council"@en
} .
?member rdfs:label ?memberlabel ;
wdt:P31 wd:Q4164871 . # topic is a position
?subj p:P39|p:P166|p:P102 ?statement;
wdt:P31 wd:Q5;
?prop ?statement;
wdt:P39 ?member.
?statement ps:P39|ps:P166|ps:P102 ?position . # surely I don't need to repeat the list of candidate props to get the value out. How do I say "p:*"?
OPTIONAL { ?statement pq:P580 ?start . }
OPTIONAL { ?statement pq:P582 ?end . }
OPTIONAL { ?statement pq:P768 ?district . }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
}
}
ORDER BY ?subj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment