query-f7cabdf25c1e1dbb513c85f7f80222de

rq turtle/ttl

title:Winners of New Media Writing Prize, organised by work SELECT DISTINCT (YEAR(?date) AS ?year) ?awardLabel ?work ?workLabel (GROUP_CONCAT(?winnerLabel; separator=", ") AS ?winner_list) WHERE { ?winner p:P166 ?statement0. # Get "award received" statement ?statement0 ps:P166 ?award. # restrict the award wd:Q108459688 wdt:P527? ?award. # award either is New Media Writing Prize or a part of it OPTIONAL { ?statement0 pq:P585 ?date } # show point in time (if we have it) ?statement0 pq:P1686 ?work # identify work SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". ?award rdfs:label ?awardLabel . ?winner rdfs:label ?winnerLabel . ?work rdfs:label ?workLabel} } GROUP BY ?date ?awardLabel ?work ?workLabel ORDER BY ?year ?awardLabel #consistent order of year and awards within a year

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
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#>
#title:Winners of New Media Writing Prize, organised by work
SELECT DISTINCT (YEAR(?date) AS ?year) ?awardLabel ?work ?workLabel (GROUP_CONCAT(?winnerLabel; separator=", ") AS ?winner_list) WHERE {
      ?winner p:P166 ?statement0.    # Get "award received" statement
      ?statement0 ps:P166 ?award.      # restrict the award
    wd:Q108459688 wdt:P527? ?award.      # award either is New Media Writing Prize or a part of it
   OPTIONAL { ?statement0 pq:P585 ?date }      # show point in time (if we have it)
   ?statement0 pq:P1686 ?work      # identify work
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". 
          ?award rdfs:label ?awardLabel . ?winner rdfs:label ?winnerLabel . ?work rdfs:label ?workLabel}
} GROUP BY ?date ?awardLabel ?work ?workLabel
ORDER BY ?year ?awardLabel     #consistent order of year and awards within a year

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?award") v2("?awardLabel"):::projected v6("?date"):::projected v4("?statement0") v3("?winner") v8("?winnerLabel"):::projected v10("?winner_list") v7("?work"):::projected v9("?workLabel"):::projected v10("?year") c8(["bd:serviceParam"]):::iri c10(["#91;AUTO_LANGUAGE#93;"]):::literal c3(["wd:Q108459688"]):::iri v3 --"p:P166"--> v4 v4 --"p:statement/P166"--> v5 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; c3 --"p:direct/P527"--> v5 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; end union0r <== or ==> union0l end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."p:qualifier/P585".-> v6 end v4 --"p:qualifier/P1686"--> v7 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 v5 --"rdfs:label"--> v2 v3 --"rdfs:label"--> v8 v7 --"rdfs:label"--> v9 end bind1[/"year-from-dateTime(?date)"/] v6 --o bind1 bind1 --as--o v10 bind2[/"?winnerLabel"/] v8 --o bind2 bind2 --as--o v10