query-7e7f56070eb1e2c76ec2fed07eb0cd9e

rq turtle/ttl

title:Booker Prize: authors with multiple wins SELECT ?item ?itemLabel (COUNT(?time) AS ?count) (GROUP_CONCAT(YEAR(?time); separator=", ") AS ?when) WHERE { VALUES ?award{wd:Q160082} ?item wdt:P31 wd:Q5. ?item p:P166 ?s. ?s ps:P166 ?award. ?s pq:P585 ?time SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } GROUP BY ?item ?itemLabel HAVING (?count > 1) ORDER BY DESC(?count)

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#>
#title:Booker Prize: authors with multiple wins
SELECT ?item ?itemLabel (COUNT(?time) AS ?count) (GROUP_CONCAT(YEAR(?time); separator=", ") AS ?when) WHERE {
  VALUES ?award{wd:Q160082}
  ?item wdt:P31 wd:Q5.
  ?item p:P166 ?s. ?s ps:P166 ?award.
  ?s pq:P585 ?time
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} GROUP BY ?item ?itemLabel HAVING (?count > 1)
ORDER BY DESC(?count)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?award") v6("?count") v3("?item"):::projected v4("?s") v5("?time"):::projected v6("?when") c8(["bd:serviceParam"]):::iri c3(["wd:Q5"]):::iri c10(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["?count > '1^^xsd:integer'"]] f0 --> v6 bind1[/VALUES ?award/] bind1-->v2 bind10(["wd:Q160082"]) bind10 --> bind1 v3 --"p:direct/P31"--> c3 v3 --"p:P166"--> v4 v4 --"p:statement/P166"--> v2 v4 --"p:qualifier/P585"--> v5 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end bind4[/"count(?time)"/] v5 --o bind4 bind4 --as--o v6 bind5[/"year-from-dateTime(?time)"/] v5 --o bind5 bind5 --as--o v6