SPARQL examples: Difference between revisions
Jump to navigation
Jump to search
Created page with "Test examples" |
No edit summary |
||
| Line 1: | Line 1: | ||
<languages /> | |||
{{Warning|1=<translate><!--T:1--> Editing this page will change the examples shown on <tvar name=1>[https://query.wikidata.org query.wikidata.org]</tvar></translate>}} | |||
{{Notice|1=<translate><!--T:2--> Please help to improve this page! Phabricator task <tvar name=1>[https://phabricator.wikimedia.org/T132690 T132690]</tvar></translate>}} | |||
{{Notice|1=<translate><!--T:3--> Feel free to add your example, or edit an existing one, if you think it is useful</translate> }} | |||
<!--T:4--> | |||
This page is parsed by the web interface of the query service to fill the query example dialog. | |||
__TOC__ | |||
{{Translation categories|Wikidata:SPARQL query service}} | |||
{{#if:{{#translation:}}|| | |||
[[Category:SPARQL]] | |||
[[Category:Exploring Wikidata]] | |||
}} | |||
== <translate><!--T:9--> Simple queries</translate> == | |||
=== <translate><!--T:541--> Institutions</translate> === | |||
{{SPARQL|query=SELECT SELECT ?institution ?institutionLabel | |||
WHERE | |||
{ | |||
?institution wdt:P47 wd:Q467. # <translate><!--T:680--> Must be of a cat</translate> | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # <translate><!--T:681--> Helps get the label in your language, if not, then en language</translate> | |||
} | |||
}} | |||
== <!--T:683--> External identifiers == | |||
=== <translate><!--T:684--> Swedish municipalities which changed their municipality identifier at some point</translate> === | |||
<translate><!--T:685--> This is an example of an identifier which is unstable over time and thus unsuitable to be used as an identifier in e.g. an IT-system.</translate> | |||
{{SPARQL|query= | |||
#title:Swedish municipalities which changed their municipality identifier at some point | |||
#author:Salgo60 2021-09-11 | |||
SELECT DISTINCT ?item ?itemLabel ?kkod1 ?kkod2 ?svwp_artikel WHERE | |||
{ | |||
?item wdt:P525 ?kkod1 . | |||
?item wdt:P525 ?kkod2 . | |||
FILTER ( ?kkod1<?kkod2 ) | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "sv". } | |||
OPTIONAL { ?svwp_artikel schema:about ?item; schema:isPartOf <https://sv.wikipedia.org/> } | |||
} | |||
ORDER BY ?itemLabel | |||
}} | |||
Revision as of 12:49, 10 May 2022
<languages /> Template:Warning Template:Notice Template:Notice
This page is parsed by the web interface of the query service to fill the query example dialog.
Template:Translation categories {{#if:{{#translation:}}|| }}
<translate> Simple queries</translate>
<translate> Institutions</translate>
External identifiers
<translate> Swedish municipalities which changed their municipality identifier at some point</translate>
<translate> This is an example of an identifier which is unstable over time and thus unsuitable to be used as an identifier in e.g. an IT-system.</translate> Template:SPARQL