query-cfd25d4568c3db2fd96517241c7bb3c4

rq turtle/ttl

title:Identifier coverage for Booker authors (winners and nominees) SELECT ?idLabel ?idDescription (round(COUNT(DISTINCT ?item)1000/?total)/10 AS ?percent) WITH { SELECT DISTINCT ?item WHERE { VALUES ?award{wd:Q160082 wd:Q2052291} ?item wdt:P166|wdt:P1411 ?award. ?item wdt:P31 wd:Q5. } } AS %subquery WITH { SELECT (COUNT(?item) AS ?total) WHERE { INCLUDE %subquery } } AS %total WHERE { INCLUDE %subquery . INCLUDE %total . ?id wikibase:propertyType wikibase:ExternalId; wikibase:claim ?p; wikibase:statementProperty ?ps; wdt:P31/wdt:P279 wd:Q19595382. ?item ?p [ ?ps ?value ] . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } GROUP BY ?total ?idLabel ?idDescription ORDER BY DESC(?percent)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#title:Identifier coverage for Booker authors (winners and nominees)
SELECT ?idLabel ?idDescription (round(COUNT(DISTINCT ?item)*1000/?total)/10 AS ?percent)
  WHERE {
   {
  SELECT DISTINCT ?item WHERE {
    VALUES ?award{wd:Q160082 wd:Q2052291}
?item wdt:P166|wdt:P1411 ?award.
    ?item wdt:P31 wd:Q5.
  }
}.
   { SELECT (COUNT(?item) AS ?total) WHERE {
   {
  SELECT DISTINCT ?item WHERE {
    VALUES ?award{wd:Q160082 wd:Q2052291}
?item wdt:P166|wdt:P1411 ?award.
    ?item wdt:P31 wd:Q5.
  }
}}
  }.
  ?id wikibase:propertyType wikibase:ExternalId; wikibase:claim ?p; wikibase:statementProperty ?ps; wdt:P31/wdt:P279* wd:Q19595382.
  ?item ?p [ ?ps ?value ] .
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} GROUP BY ?total ?idLabel ?idDescription
ORDER BY DESC(?percent)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?award") v5("?id") v3("?item") v6("?p") v9("?percent") v7("?ps") v4("?total"):::projected v8("?value") a1((" ")) a2((" ")) c10(["wd:Q19595382"]):::iri c6(["wikibase:ExternalId"]):::iri c12(["bd:serviceParam"]):::iri c4(["wd:Q5"]):::iri c14(["#91;AUTO_LANGUAGE#93;,en"]):::literal bind0[/VALUES ?award/] bind0-->v4 bind00(["wd:Q160082"]) bind00 --> bind0 bind01(["wd:Q2052291"]) bind01 --> bind0 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P1411"--> v4 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P166"--> v4 end union0r <== or ==> union0l end v3 --"wdt:P31"--> c4 bind1[/VALUES ?award/] bind1-->v4 bind10(["wd:Q160082"]) bind10 --> bind1 bind11(["wd:Q2052291"]) bind11 --> bind1 subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P1411"--> v4 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P166"--> v4 end union1r <== or ==> union1l end v3 --"wdt:P31"--> c4 bind3[/"count(?item)"/] v3 --o bind3 bind3 --as--o v4 v5 --"wikibase:propertyType"--> c6 v5 --"wikibase:claim"--> v6 v5 --"wikibase:statementProperty"--> v7 v5 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c10 a2 -->v7--> v8 v3 -->v6--> a2 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c12 --"wikibase:language"--> c14 end bind5[/"numeric-round( * '1000^^xsd:integer' / ?total) / '10^^xsd:integer'"/] null --o bind5 v4 --o bind5 bind5 --as--o v9