query-4d2a185bd4e55f05712c79dbf0d06529

rq turtle/ttl

We need guidance and example queries for how to model winners. One of the researchers tried this with the Eurovision Song Contest and it didn't work. I see that winners of the ESC are modelled differently, where each year's contest is treated separately, and that's fine. Winners have to be queried a different way, but after a lot of work I am struggling to find out what that is. I was glad to see there is a dedicated WikiProject for this topic, but the existing documentation doesn't seem to answer my question. [1], just by adapting a query like (Q37922)Nobel Prize in Literature , or (Q1153257)NAACP Image Awards , (Q41254)Grammy Awards , (Q160082)Booker Prize , (Q19020)Academy Awards Hi. Yesterday I was teaching researchers how to use Wikidata, and showing how easy it is to make a data table of winners of This query presently works well up to 1960 and for 2014 onwards, but has huge gaps imbetween:

Use at

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 ?image WHERE {
  ?contest wdt:P31 wd:Q110288240. # Each contest
  ?contest wdt:P585 ?date. # Get month and year (we'll just use year)
  ?contest p:P1346 ?s. ?s ps:P1346 ?winner.
 OPTIONAL{ ?s pq:P17 ?country}
 OPTIONAL{ ?s pq:P1686 ?song}
 OPTIONAL{ ?winner wdt:P18 ?image }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} ORDER BY ?year

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?contest") v6("?country") v3("?date"):::projected v8("?image"):::projected v4("?s") v7("?song") v5("?winner"):::projected v9("?year") c2(["wd:Q110288240"]):::iri c10(["bd:serviceParam"]):::iri c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal v2 --"p:direct/P31"--> c2 v2 --"p:direct/P585"--> v3 v2 --"p:P1346"--> v4 v4 --"p:statement/P1346"--> v5 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."p:qualifier/P17".-> v6 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v4 -."p:qualifier/P1686".-> v7 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:direct/P18".-> v8 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end bind0[/"year-from-dateTime(?date)"/] v3 --o bind0 bind0 --as--o v9