Wikidata talk:SPARQL query service

From Wikidata
Jump to: navigation, search

link from data access page[edit]

Hey :)

Thanks for starting this. Can you please link/incorporate in Wikidata:Data access? Thanks a lot! --Lydia Pintscher (WMDE) (talk) 10:58, 16 September 2015 (UTC)

@Lydia Pintscher (WMDE): I have added a link, diff Jheald (talk) 09:42, 17 September 2015 (UTC)
Thanks! --Lydia Pintscher (WMDE) (talk) 22:11, 17 September 2015 (UTC)

Logo?[edit]

How about a logo/icon for SPARQL query service? To make it easy to remember/distinguish from WDQ, Reasonator etc. The wikidata logo with a (white?) question mark?

--Atlasowa (talk) 14:43, 23 September 2015 (UTC)

@Atlasowa: Thanks for the suggestion! This was turned into phab:T140577 and is being discussed there. --Deskana (WMF) (talk) 04:25, 20 July 2016 (UTC)
@Deskana (WMF): Thank you! --Atlasowa (talk) 19:39, 20 July 2016 (UTC)

Embed in map tutorial[edit]

Is there a tutorial that explains how to embed a query in the wikimedia map like this:

https://query.wikidata.org/embed.html#%23%20Points%20culminants%20par%20d%C3%A9partement%20fran%C3%A7ais%0A%23defaultView%3AMap%0ASELECT%20DISTINCT%20%3Fitem%20%3FitemLabel%20%3Fculminant%20%3FculminantLabel%20%3Faltitude%20%3FpartieDeLabel%20%3Fcoordinate%20%3Fimage%20%28concat%28str%28floor%28%3Faltitude%2F500%29%2a500%29%2C%20%27-%27%2Cstr%28ceil%28%3Faltitude%2F500%29%2a500%29%29%20%20as%20%3Flayer%29%0AWHERE%20%7B%0A%0A%20%20%3Fitem%20wdt%3AP31%2Fwdt%3AP279%2a%20wd%3AQ6465%20.%0A%20%20%3Fitem%20p%3AP31%20%3Fdep%0A%20%20FILTER%20NOT%20EXISTS%20%7B%20%3Fitem%20p%3AP576%20%3Fx%20%7D%20%0A%20%20FILTER%20NOT%20EXISTS%20%7B%20%3Fitem%20p%3AP582%20%3Fx%20%7D%20%0A%20%20FILTER%20NOT%20EXISTS%20%7B%20%3Fdep%20pq%3AP582%20%3Fx%20%7D%20%20%0A%20%20OPTIONAL%7B%0A%20%20%20%20%3Fitem%20wdt%3AP610%20%3Fculminant%20%0A%20%20%20%20OPTIONAL%7B%20%3Fculminant%20wdt%3AP2044%20%3Faltitude%20%7D%0A%20%20%20%20OPTIONAL%7B%20%3Fculminant%20wdt%3AP361%20%3FpartieDe%20%7D%0A%20%20%20%20OPTIONAL%7B%20%3Fculminant%20wdt%3AP625%20%3Fcoordinate%20%7D%0A%20%20%20%20optional%20%7B%20%3Fculminant%20wdt%3AP18%20%3Fimage%20%7D%0A%20%20%7D%0A%20%0A%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22fr%22.%20%7D%0A%20%20%0A%7D%20ORDER%20BY%20DESC%28%3Faltitude%29

Thanks! --Tobias1984 (talk) 10:01, 11 September 2016 (UTC)

Actually I got it to work now. This is a nice example that shows how to put the labels into the layer-bar:
#Armenian Sister City
#defaultView:Map
SELECT ?item ?itemLabel ?sisterCity ?sisterCityLabel ?coordinate ?layer
WHERE {
  ?item wdt:P17 wd:Q399 .
  ?item wdt:P190 ?sisterCity .
  ?sisterCity wdt:P625 ?coordinate .
  ?sisterCity wdt:P17 ?sisterCountry .
  SERVICE wikibase:label { 
    bd:serviceParam wikibase:language "en" . 
    ?item rdfs:label ?itemLabel .
    ?sisterCity rdfs:label ?sisterCityLabel .
	?sisterCountry rdfs:label ?layer .
  }
}

Try it!

or the link to the map:

https://query.wikidata.org/embed.html#%23Armenian%20Sister%20City%0A%23defaultView%3AMap%0ASELECT%20%3Fitem%20%3FitemLabel%20%3FsisterCity%20%3FsisterCityLabel%20%3Fcoordinate%20%3Flayer%0AWHERE%20{%0A%20%20%3Fitem%20wdt%3AP17%20wd%3AQ399%20.%0A%20%20%3Fitem%20wdt%3AP190%20%3FsisterCity%20.%0A%20%20%3FsisterCity%20wdt%3AP625%20%3Fcoordinate%20.%0A%20%20%3FsisterCity%20wdt%3AP17%20%3FsisterCountry%20.%0A%20%20SERVICE%20wikibase%3Alabel%20{%20%0A%20%20%20%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22%20.%20%0A%20%20%20%20%3Fitem%20rdfs%3Alabel%20%3FitemLabel%20.%0A%20%20%20%20%3FsisterCity%20rdfs%3Alabel%20%3FsisterCityLabel%20.%0A%09%3FsisterCountry%20rdfs%3Alabel%20%3Flayer%20.%0A%20%20}%0A}%0A

--Tobias1984 (talk) 19:42, 12 September 2016 (UTC)

How to link to textual/ JSON data?[edit]

Let's say I want a script to retrieve the data from a query. So I don't want to click in a browser to select the download format for my query, but instead want to construct a URL to get the JSON/ CSV directly. How is this possible? Given the way the Javascript is minimised, I can't see what URL my browser is calling to get the data. Thanks in advance for any help, MartinPoulter (talk) 14:17, 13 September 2016 (UTC)

the URL is: https://query.wikidata.org/bigdata/namespace/wdq/sparql?format=json&query=YOUR_QUERY --Pasleim (talk) 14:26, 13 September 2016 (UTC)
A delayed thank-you to User:Pasleim. Cheers, MartinPoulter (talk) 16:25, 26 October 2016 (UTC)

Wikidata Query Output[edit]

Can I choose the output format of the GUI tool? In addition to XML and JSON, can the GUI tool also output wiki formatted data (tables, lists, etc.) that I can simply paste into a wiki page? Thanks! SharkD (talk) 03:39, 24 March 2017 (UTC)

missing links[edit]

Wikidata:SPARQL query service/Wikidata Query Help:

d1g (talk) 09:36, 29 April 2017 (UTC)

How often is the data updated in wikidata query?[edit]

Hi, I tried to use the query, it states the query is updated 10 seconds ago. How long does the query reflect the edit I made in wikidata? --Napoleon.tan (talk) 12:58, 29 April 2017 (UTC)

Usually about every three or four seconds, but it varies. 10 seconds is a slightly longer lag than usual, I think. Jheald (talk) 22:16, 29 April 2017 (UTC)