query-46aba0eef4fb50e0b7baf4f51851d0e3

rq turtle/ttl

TEMPLATE={"template":"Video games from ?country nominated for ?awardGroup","variables":{"?country":{"query":" SELECT ?id WHERE { ?id wdt:P31 wd:Q6256 . }"},"?awardGroup":{"query":" SELECT ?id WHERE { ?id wdt:P31 wd:Q107655869 . ?id wdt:P279 wd:Q18328126. }"} } } SELECT DISTINCT ?item ?itemLabel (COUNT(?award) AS ?nominations) WHERE { BIND(wd:Q40 AS ?country) BIND(wd:Q18642757 AS ?awardGroup) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } ?item wdt:P1411 ?award; wdt:P495 ?country. ?award wdt:P361 ?awardGroup. } GROUP BY ?item ?itemLabel ORDER BY DESC (?nominations)

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#>
#TEMPLATE={"template":"Video games from ?country nominated for ?awardGroup","variables":{"?country":{"query":" SELECT ?id WHERE { ?id wdt:P31 wd:Q6256 . }"},"?awardGroup":{"query":" SELECT ?id WHERE { ?id wdt:P31 wd:Q107655869 .   ?id wdt:P279 wd:Q18328126. }"} } }
SELECT DISTINCT ?item ?itemLabel (COUNT(?award) AS ?nominations) WHERE {
  BIND(wd:Q40 AS ?country)
  BIND(wd:Q18642757 AS ?awardGroup)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  ?item wdt:P1411 ?award;
    wdt:P495 ?country.
  ?award wdt:P361 ?awardGroup.
}
GROUP BY ?item ?itemLabel
ORDER BY DESC (?nominations)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?award"):::projected v3("?awardGroup") v2("?country") v4("?item"):::projected v6("?nominations") c2(["bd:serviceParam"]):::iri c4(["#91;AUTO_LANGUAGE#93;,en"]):::literal bind0[/"'wd:Q40'"/] bind0 --as--o v2 bind1[/"'wd:Q18642757'"/] bind1 --as--o v3 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c2 --"wikibase:language"--> c4 end v4 --"wdt:P1411"--> v5 v4 --"wdt:P495"--> v2 v5 --"wdt:P361"--> v3 bind3[/"count(?award)"/] v5 --o bind3 bind3 --as--o v6