Wikidata:WikiProject Cycling/SPARQL/List of all tour de France's stage winners

This page is a documented query. All documented queries can be found in Category:Documented query.

This query looks at all stage winners in the history of the Tour de France (Q33881) with their country of citizenship. It has been created in order to create a visualisation of the history of the tour de France[1].

Main query edit

This query takes all instances of Tour de France (Q33881) with start time (P580) and edition number (P393).

For each tour (named ?tour), we take all the stages which are part of it (part of (P361)) with series ordinal (P1545).

For each stage (?stage), we select winner (P1346) with qualifier of (P642) equal to stage winner (Q20882747).

For each stage winner (?winner), we select the value of country of citizenship (P27).

We have the following list of variables :

  • ?tour : qid of the tour
  • ?tourLabel : English label of the tour
  • ?startdate : start date of the tour
  • ?tournumber : tour number
  • ?stage : qid of the stage
  • ?stageLabel : English label of the stage
  • ?stagenumber : stage number
  • ?winner : qid of the stage winner
  • ?winnerLabel : English label of the winner
  • ?country : qid of the country of citizenship of the stage winner
  • ?countryLabel : English label of the country of citizenship of the winner.
#title: List of all stage winners of the tour de France by country
SELECT ?tour ?tourLabel ?startdate ?tournumber ?stage ?stageLabel ?stagenumber ?winner ?winnerLabel ?country ?countryLabel WHERE {
  ?tour wdt:P31 wd:Q33881;
        wdt:P580 ?startdate;
        wdt:P393 ?tournumber;
        rdfs:label ?tourLabel.
  FILTER((LANG(?tourLabel)) = "en")
  ?stage wdt:P361 ?tour;
        rdfs:label ?stageLabel;
        wdt:P1545 ?stagenumber;
        p:P1346 ?statement.
  FILTER((LANG(?stageLabel)) = "en")
  ?statement ps:P1346 ?winner;
             pq:P642 wd:Q20882747.
  ?winner wdt:P27 ?country;       
          rdfs:label ?winnerLabel.
  FILTER((LANG(?winnerLabel)) = "en" )
  ?country rdfs:label ?countryLabel.
  FILTER((LANG(?countryLabel)) = "en" )
}
ORDER BY ?tournumber ?stagenumber
List of all stage winners of the tour de France by country

Checks and tests edit

All data can be checked using the official website[2].

Insights edit

References edit

See also edit