query-c5677cf719f61b87c7b693cae595aa42
of 1. So I made this query. (P1352)ranking , qualified with (P1344)participant in Then I noticed that the winner is sometimes modelled with
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT (YEAR(?date) AS ?year) ?winner ?winnerLabel ?countryLabel ?songLabel (SAMPLE(?img) AS ?image) WHERE {
?contest wdt:P31 wd:Q110288240. # Each contest
?contest wdt:P585 ?date. # Get month and year (we'll just use year)
?song p:P1344 ?s. ?s ps:P1344 ?contest. # Song participant in contest
?s pq:P1352 ?rank FILTER (?rank = 1).
?song wdt:P175 ?winner.
OPTIONAL{ ?s pq:P17 ?country}
OPTIONAL{ ?winner wdt:P18 ?img }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} GROUP BY ?date ?winner ?winnerLabel ?countryLabel ?songLabel
ORDER BY ?year
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?contest")
v8("?country")
v4("?date"):::projected
v10("?image")
v9("?img"):::projected
v2("?rank")
v6("?s")
v5("?song")
v7("?winner"):::projected
v10("?year")
c3(["wd:Q110288240"]):::iri
c12(["bd:serviceParam"]):::iri
c14(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["?rank = '1^^xsd:integer'"]]
f0 --> v2
v3 --"p:direct/P31"--> c3
v3 --"p:direct/P585"--> v4
v5 --"p:P1344"--> v6
v6 --"p:statement/P1344"--> v3
v6 --"p:qualifier/P1352"--> v2
v5 --"p:direct/P175"--> v7
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v6 -."p:qualifier/P17".-> v8
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v7 -."p:direct/P18".-> v9
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c12 --"wikibase:language"--> c14
end
bind2[/"year-from-dateTime(?date)"/]
v4 --o bind2
bind2 --as--o v10
bind3[/"sample(?img)"/]
v9 --o bind3
bind3 --as--o v10