Jump to content

Wikimedia CEE Meeting 2016/Programme/Submissions/Sparql for Wikidata

From Meta, a Wikimedia project coordination wiki

Title of your proposal[edit]

Name(s) and/or username(s)[edit]

Tobias Schönberg, User:Tobias1984
  • Coinstructors welcome!


  • Wikidata

Type of submission (Please choose one)[edit]

  • Workshop (work in groups)


An example of a query we can build in this workshop. It can be written in a few minutes. It shows the coordinates of all the cities that have a sister-city in Armenia.

I would like to do a 1 hour Sparql workshop with people that haven't used it or only know it a little. No prior programming experience is needed. We will go through some simple query examples and then everyone can work on queries of their own. We will use http://query.wikidata.org to build the queries. An example of a query is shown in the image to the right. It is build with this query:

SELECT ?item ?itemLabel ?sisterCity ?sisterCityLabel ?coord 
  ?item wdt:P17 wd:Q399 .
  ?item wdt:P190 ?sisterCity .
  ?sisterCity wdt:P625 ?coord .
  SERVICE wikibase:label { 
    bd:serviceParam wikibase:language "en" . 
    ?item rdfs:label ?itemLabel .
    ?sisterCity rdfs:label ?sisterCityLabel .


We can also look at queries that help guide translation efforts:

# Items that have country = Armenia, have an Armenian label and are missing and English label
SELECT ?item ?itemLabel ?armenianLabel WHERE {
    ?item wdt:P17 wd:Q399 .
    ?item rdfs:label ?armenianLabel filter (lang(?armenianLabel) = "hy") .
	filter not exists { ?item rdfs:label ?missinglabel filter (lang(?missinglabel) = "en") } .
  	SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .

Expected outcomes[edit]

Duration (without Q&A)[edit]

1 hour

Specific requirements[edit]

  • Possible scheduling overlap with Pywikibot for Wikidata
  • Participants: Just a laptop, internet connection, and a new browser.
  • Instructor: A beamer would be good.

Slides or further information[edit]


Interested attendees (Please add yourself, and you may indicate your questions to the presenter).[edit]

  1. --Лорд Бъмбъри (talk) 19:44, 18 July 2016 (UTC)[reply]
  2. Yarl (talk) 09:51, 20 July 2016 (UTC)[reply]
  3. Halibutt (talk) 15:04, 20 July 2016 (UTC)[reply]
  4. Ijon (talk) 16:07, 20 July 2016 (UTC)[reply]
  5. --Vojtěch Dostál (talk) 17:41, 21 July 2016 (UTC)[reply]
  6. - Kareyac (talk) 05:30, 26 July 2016 (UTC)[reply]
  7. Wittylama (talk)
  8. --Γλαύκος (talk) 04:22, 22 August 2016 (UTC)[reply]
  9. --Aram-van (talk) 20:23, 25 August 2016 (UTC)[reply]
  10. --Gikü (talk) 09:20, 26 August 2016 (UTC)[reply]