Skip to content

Instantly share code, notes, and snippets.

@ewg118
Created September 22, 2023 17:36
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 ewg118/15125c56a790019b08585bbe7503cd9b to your computer and use it in GitHub Desktop.
Save ewg118/15125c56a790019b08585bbe7503cd9b to your computer and use it in GitHub Desktop.
Wikdata Geonames and label place query
SELECT ?place ?placeLabel ?geonames ?country ?countryLabel ?region ?regionLabel WHERE {
BIND (<http://www.wikidata.org/entity/Q1930> as ?place)
OPTIONAL { ?place wdt:P1566 ?geonames }
OPTIONAL {?place wdt:P17 ?country }
OPTIONAL {?place wdt:P131+ ?region .
{?region wdt:P31 wd:Q35657}
UNION {?region wdt:P31 wd:Q11828004}}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment