query-5890182c5abf1031a1d30985321e8dca
title: List of all stage winners by country SELECT ?winner ?winnerLabel (COUNT(*) AS ?count) WHERE { ?tour wdt:P31 wd:Q33881; rdfs:label ?tourLabel. FILTER(LANG(?tourLabel) = "[AUTO_LANGUAGE]" ) ?item wdt:P361 ?tour; rdfs:label ?itemLabel. FILTER(LANG(?itemLabel) = "[AUTO_LANGUAGE]" ) ?item wdt:P585 ?date. ?item p:P1346 ?statement. ?statement ps:P1346 ?winner. ?statement pq:P642 wd:Q20882747 . ?winner rdfs:label ?winnerLabel. FILTER((LANG(?winnerLabel)) = "[AUTO_LANGUAGE]" ) ?winner wdt:P27 ?country. ?country rdfs:label ?countryLabel. FILTER((LANG(?countryLabel)) = "[AUTO_LANGUAGE]" ) } GROUP BY ?winner ?winnerLabel ORDER BY DESC(?count)
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
#title: List of all stage winners by country
SELECT ?winner ?winnerLabel (COUNT(*) AS ?count) WHERE {
?tour wdt:P31 wd:Q33881;
rdfs:label ?tourLabel.
FILTER(LANG(?tourLabel) = "[AUTO_LANGUAGE]" )
?item wdt:P361 ?tour;
rdfs:label ?itemLabel.
FILTER(LANG(?itemLabel) = "[AUTO_LANGUAGE]" )
?item wdt:P585 ?date.
?item p:P1346 ?statement.
?statement ps:P1346 ?winner.
?statement pq:P642 wd:Q20882747 .
?winner rdfs:label ?winnerLabel.
FILTER((LANG(?winnerLabel)) = "[AUTO_LANGUAGE]" )
?winner wdt:P27 ?country.
?country rdfs:label ?countryLabel.
FILTER((LANG(?countryLabel)) = "[AUTO_LANGUAGE]" )
}
GROUP BY ?winner ?winnerLabel
ORDER BY DESC(?count)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v12("?count")
v11("?country")
v2("?countryLabel")
v8("?date")
v7("?item")
v4("?itemLabel")
v9("?statement")
v6("?tour")
v5("?tourLabel")
v10("?winner"):::projected
v3("?winnerLabel"):::projected
c3(["wd:Q33881"]):::iri
c10(["wd:Q20882747"]):::iri
f0[["?countryLabel = '#91;AUTO_LANGUAGE#93;'"]]
f0 --> v2
f1[["?winnerLabel = '#91;AUTO_LANGUAGE#93;'"]]
f1 --> v3
f2[["?itemLabel = '#91;AUTO_LANGUAGE#93;'"]]
f2 --> v4
f3[["?tourLabel = '#91;AUTO_LANGUAGE#93;'"]]
f3 --> v5
v6 --"p:direct/P31"--> c3
v6 --"rdfs:label"--> v5
v7 --"p:direct/P361"--> v6
v7 --"rdfs:label"--> v4
v7 --"p:direct/P585"--> v8
v7 --"p:P1346"--> v9
v9 --"p:statement/P1346"--> v10
v9 --"p:qualifier/P642"--> c10
v10 --"rdfs:label"--> v3
v10 --"p:direct/P27"--> v11
v11 --"rdfs:label"--> v2
bind5[/"count(*)"/]
bind5 --as--o v12