query-ffd88f75d6ec5ab2a235faf516ec5807
Male tennis players who won a Grand Slam singles title 15:53, 14 September 2020 (UTC)) talk (WolboHi, looking for a list of male (P21=Q6581097) tennis players (P106=Q10833314) who have won a singles title at a Grand Slam tournament sorted by height (P20148) in centimeters with tallest player listed first. Each player should only be listed once. Can this be done? Grand Slam tournaments are Australian Open (Q60874), French Open (Q43605), Wimbledon (Q41520) and US Open (Q123577). --This is one way to do it, there is missing data though, eg this year's winners, not sure if everyone has a height either
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX psn: <http://www.wikidata.org/prop/statement/value-normalized/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?winner ?winnerLabel ?height_in_cm WHERE {
?x wdt:P31 wd:Q46190676 . # x is a tennis event
?x wdt:P2094 wd:Q16893072 . # x's competiion class is men's singles
?x wdt:P361/wdt:P31/wdt:P361 wd:Q102113 . # x is part of a tournament that is part of a grand slam event
?x wdt:P1346 ?winner . # x has a winner
?winner p:P2048/psn:P2048 [ # the winner has a height
wikibase:quantityAmount ?height # get normalized units (in metres)
] .
BIND (100 * ?height AS ?height_in_cm) # convert to centimetres
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC (?height_in_cm) # order by height, tallest first
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?height")
v5("?height_in_cm"):::projected
v3("?winner"):::projected
v2("?x")
a1((" "))
a2((" "))
a4((" "))
a3((" "))
c6(["wd:Q102113"]):::iri
c12(["bd:serviceParam"]):::iri
c2(["wd:Q46190676"]):::iri
c14(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c4(["wd:Q16893072"]):::iri
v2 --"p:direct/P31"--> c2
v2 --"p:direct/P2094"--> c4
v2 --"p:direct/P361"--> a1
a1 --"p:direct/P31"--> a2
a2 --"p:direct/P361"--> c6
v2 --"p:direct/P1346"--> v3
a3 --"wikibase:quantityAmount"--> v4
v3 --"p:P2048"--> a4
a4 --"p:statement/value-normalized/P2048"--> a3
bind0[/"'100^^xsd:integer' * ?height"/]
v4 --o bind0
bind0 --as--o v5
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c12 --"wikibase:language"--> c14
end