Created
December 30, 2020 00:10
-
-
Save lefuturiste/e2d008af20978e1df9dd07d9d867fa21 to your computer and use it in GitHub Desktop.
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
# prfgen get richest countries and sort by gdp | |
SELECT | |
?pop ?gdp ?drivingSideLabel | |
?codeTwo ?codeThree | |
?country | |
?countryLabel | |
?coord | |
(GROUP_CONCAT(DISTINCT ?tldLabel; separator = ";") AS ?tlds) | |
(GROUP_CONCAT(DISTINCT ?callingCode; separator = ";") AS ?callingCodes) | |
(GROUP_CONCAT(DISTINCT ?timezoneOffset; separator = ";") AS ?timezones) | |
(GROUP_CONCAT(DISTINCT ?continentLabel; separator = ";") AS ?continents) | |
(GROUP_CONCAT(DISTINCT ?currencyCode; separator = ";") AS ?currencies) | |
(GROUP_CONCAT(DISTINCT ?voltage; separator = ";") AS ?voltages) | |
(GROUP_CONCAT(DISTINCT ?frequency; separator = ";") AS ?frequencies) | |
(GROUP_CONCAT(DISTINCT ?plugTypeLabel; separator = ";") AS ?plugTypes) | |
(GROUP_CONCAT(DISTINCT ?capitalId; separator = ";") AS ?capitals) | |
(MD5(CONCAT(str(?country),str(RAND()))) as ?random) | |
WHERE { | |
{ ?country wdt:P31* wd:Q3624078. } UNION { ?country wdt:P31* wd:Q6256. } | |
?country wdt:P297 ?codeTwo. | |
?country wdt:P298 ?codeThree. | |
?country wdt:P1622 ?drivingSide. | |
?country wdt:P2131 ?gdp. | |
?country wdt:P1082 ?pop. | |
?country wdt:P474 ?callingCode. | |
?country wdt:P36 ?capital. | |
?capital wdt:P227 ?capitalId. | |
# TLD. | |
?country wdt:P78 ?tld. | |
?tld wdt:P31 wd:Q42032. | |
?tld rdfs:label ?tldLabel filter (lang(?tldLabel) = "en"). | |
# CONTINENT | |
?country wdt:P30 ?continent. | |
?continent rdfs:label ?continentLabel filter (lang(?continentLabel) = "en"). | |
# Currencies | |
?country wdt:P38 ?currency. | |
?currency wdt:P498 ?currencyCode. | |
# Timezones | |
?country p:P421/ps:P421 ?timezone. | |
?timezone wdt:P2907 ?timezoneOffset. | |
#?timezone rdfs:label ?timezoneLabel filter (lang(?timezoneLabel) = "en"). | |
# domestic electricity | |
?country p:P2884/ps:P2884 ?voltage. # i'm not sure about the divider operator | |
?country p:P2884 ?voltageStatement. | |
?voltageStatement pq:P2144 ?frequency. | |
?country wdt:P2853 ?plugType. | |
?plugType rdfs:label ?plugTypeLabel filter (lang(?plugTypeLabel) = "en"). | |
OPTIONAL { ?country wdt:P625 ?coord } | |
#?country wikibase:sitelinks ?articles | |
FILTER(?gdp > 1e11 || ?codeThree = "LUX") | |
#FILTER(?pop > 5e5) | |
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } | |
} | |
GROUP BY ?country ?countryLabel ?codeTwo ?codeThree ?pop ?gdp ?drivingSideLabel ?coord | |
ORDER BY DESC(?gdp) | |
LIMIT 150 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment