Created
January 21, 2016 11:04
-
-
Save jindrichmynarz/9f3ae84588919a17e6aa to your computer and use it in GitHub Desktop.
Prime ministers from Wikidata
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PREFIX bd: <http://www.bigdata.com/rdf#> | |
| PREFIX p: <http://www.wikidata.org/prop/> | |
| PREFIX q: <http://www.wikidata.org/prop/qualifier/> | |
| PREFIX v: <http://www.wikidata.org/prop/statement/> | |
| PREFIX wd: <http://www.wikidata.org/entity/> | |
| PREFIX wikibase: <http://wikiba.se/ontology#> | |
| SELECT DISTINCT ?countryLabel ?primeMinisterLabel | |
| WHERE { | |
| ?country p:P31 ?countryStatement . | |
| ?countryStatement v:P31 wd:Q6256 . # Find all countries | |
| FILTER NOT EXISTS { | |
| ?countryStatement q:P582 ?x . # Filter out countries with dissolution date | |
| } | |
| ?country p:P6 ?primeMinisterStatement . | |
| ?primeMinisterStatement v:P6 ?primeMinister . # Find prime minister for each country | |
| FILTER NOT EXISTS { | |
| ?primeMinisterStatement q:P582 ?x . # Filter out prime ministers, whose term ended | |
| } | |
| SERVICE wikibase:label { | |
| bd:serviceParam wikibase:language "cs,en" . # Add Czech labels (fallback on English ones) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment