Wikidata:WikiProject Cycling/SPARQL

From Wikidata
Jump to navigation Jump to search

Riders who have no english Wikipedia article

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, occupation (P106)  View with Reasonator View with SQID
    SELECT DISTINCT ?item WHERE {
    ?item wdt:P31 wd:Q5. 
    ?item wdt:P106 wd:Q2309784  
    Minus {
    ?article schema:about ?item. 
    ?article schema:inLanguage "en". 
    FILTER (SUBSTR(str(?article), 1, 25) = "https://en.wikipedia.org/")
    }
    }
    

lists of all riders that have no english Wikipedia article

Cycling teams who have no english Wikipedia article

[edit]

The following query uses these:

  • Properties: UCI code of cycling team (P1998)  View with Reasonator View with SQID, part of (P361)  View with Reasonator View with SQID
    SELECT DISTINCT ?item WHERE {
    ?item wdt:P1998 ?obj1 
    Minus {
    ?item wdt:P361 ?obj2 
    }
    Minus {
    ?article schema:about ?item. 
    ?article schema:inLanguage "en". 
    FILTER (SUBSTR(str(?article), 1, 25) = "https://en.wikipedia.org/")
    }
    }
    

lists all cycling teams that have no english Wikipedia article

All races

[edit]

The following query uses these:

  • Properties: sport (P641)  View with Reasonator View with SQID
    SELECT ?sport ?sportLabel WHERE {
    ?sport wdt:P641 wd:Q3609. 
    SERVICE wikibase:label {bd:serviceParam wikibase:language "fr", "en", "it"}   
    } ORDER BY ?sportLabel  LIMIT 1000
    

lists all races.

Races that have a distance (P2043) with the rank deprecated

[edit]

The following query uses these:

  • Properties: sport (P641)  View with Reasonator View with SQID, length (P2043)  View with Reasonator View with SQID
    PREFIX p: <http://www.wikidata.org/prop/>
    PREFIX ps: <http://www.wikidata.org/prop/statement/>
    SELECT ?sportLabel ?sport ?vLabel ?v WHERE {
    ?sport wdt:P641 wd:Q3609.# all races
    ?wds wikibase:rank wikibase:DeprecatedRank.
    ?sport p:P2043 ?wds.
    ?wds ps:P2043 ?v.
    SERVICE wikibase:label {bd:serviceParam wikibase:language "en".}     
    }
    

list all races that have a distance (P2043) with the rank deprecated

Items that use qualifier P1642 (acquisition transaction)

[edit]

The following query uses these:

  • Properties: acquisition transaction (P1642)  View with Reasonator View with SQID
    SELECT ?name ?z1Label WHERE {
    # values for P1642 (acquisition transaction)   
    VALUES ?z1 {wd:Q4 wd:Q23498247 wd:Q23498248 wd:Q3428243 wd:Q23498196 wd:Q23531302 wd:Q23531338}
    ?name pq:P1642 ?z1
    SERVICE wikibase:label {bd:serviceParam wikibase:language "en", "fr"}   
    } ORDER BY ?z1Label
    

find all items that use qualifier P1642 (acquisition transaction)

Season-items, no team-items

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, part of (P361)  View with Reasonator View with SQID
    SELECT DISTINCT ?x ?xLabel ?teamLabel ?gLabel WHERE {
    VALUES ?team {wd:Q1785271 wd:Q20639847 wd:Q20653563 wd:Q20638319 wd:Q6154783 wd:Q382927 
                              wd:Q20653564 wd:Q1756006 wd:Q20653566 wd:Q20639848 wd:Q20652655} 
    ?x wdt:P31 ?team. 
    ?x wdt:P361 ?g. 
    SERVICE wikibase:label {bd:serviceParam wikibase:language "de,en,fr,nl"}      
    } ORDER BY DESC(?g)
    

Team-items, no season-items

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, part of (P361)  View with Reasonator View with SQID
    SELECT DISTINCT ?x ?xLabel WHERE {
    VALUES ?team {wd:Q1785271 wd:Q20639847 wd:Q20653563 wd:Q20638319 wd:Q6154783 wd:Q382927 
                              wd:Q20653564 wd:Q1756006 wd:Q20653566 wd:Q20639848 wd:Q20652655} 
    ?x wdt:P31 ?team. 
    FILTER NOT EXISTS {?x wdt:P361 ?g}
    SERVICE wikibase:label {bd:serviceParam wikibase:language "de,en,fr,es,nl,ca"}
    } ORDER BY DESC(?x)
    

Team-items, with de article

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, part of (P361)  View with Reasonator View with SQID, dissolved, abolished or demolished date (P576)  View with Reasonator View with SQID
    SELECT DISTINCT ?x ?xLabel WHERE {
    # find team-items, no season-items
    VALUES ?team {wd:Q1785271 wd:Q20639847 wd:Q20653563 wd:Q20638319 wd:Q6154783 wd:Q382927 wd:Q20653564 wd:Q1756006 wd:Q20653566 wd:Q20639848 wd:Q20652655} 
    ?x wdt:P31 ?team.
    ?article schema:about ?x .
    ?article schema:isPartOf <https://de.wikipedia.org/>.
    FILTER NOT EXISTS {?x wdt:P361 ?g}.
    FILTER NOT EXISTS {?x wdt:P576 ?gg}  
    SERVICE wikibase:label {bd:serviceParam wikibase:language "de,en,fr,es,nl,ca,pl,pt,it"}
    } ORDER BY ASC(?xLabel)
    

Items with sport (P641) only

[edit]

List of Tour de France's stage winners with country of citizenship

[edit]

National Road Cycling Championships Tree

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, country (P17)  View with Reasonator View with SQID, flag image (P41)  View with Reasonator View with SQID, sports season of league or competition (P3450)  View with Reasonator View with SQID, part of (P361)  View with Reasonator View with SQID, has part(s) (P527)  View with Reasonator View with SQID
    #defaultView:Tree
    SELECT ?country ?countryLabel ?countryFlag ?championship ?championshipLabel ?year ?yearLabel ?race ?raceLabel
    WHERE {
      #BIND(wd:Q38 as ?country)
      ?championship wdt:P31 wd:Q2306612;
                    wdt:P17 ?country.
      ?country wdt:P41 ?countryFlag.
      
      {
        ?year wdt:P31 ?championship.
      } UNION {
        ?year wdt:P31 wd:Q27020041.
        { 
          ?year wdt:P3450 ?championship.
    #     } UNION {
    #       ?year rdfs:label ?itLabel.
    #       FILTER(LANG(?itLabel) = "it" && STRSTARTS(?itLabel, "Campionato italiano di ciclismo su strada")).
        }
      }
      
      OPTIONAL { { ?race wdt:P361 ?year. } UNION { ?year wdt:P527 ?race. } }
      
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,fr". }
    }
    ORDER BY ?countryLabel ?championshipLabel ?yearLabel