query-7f95f37169385999f51be34b3fd218e0

rq turtle/ttl

Publishers in country

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#>
SELECT 
  ?works

  ?publisher ?publisherLabel
  (CONCAT("#publisher/", SUBSTR(STR(?publisher), 32)) AS ?publisherUrl)

  ?example_work ?example_workLabel
  (CONCAT("#work/", SUBSTR(STR(?example_work), 32)) AS ?example_workUrl)
WHERE {
   {
  SELECT 
    (COUNT(?work) AS ?works)
    ?publisher
    (SAMPLE(?work) AS ?example_work)
  WHERE {
    ?work wdt:P123 ?publisher .
    ?publisher wdt:P17 wd:Q35 .
  }
  GROUP BY ?publisher
}  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC(?works)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?example_work"):::projected v6("?example_workUrl") v3("?publisher"):::projected v5("?publisherUrl") v2("?work") v4("?works"):::projected c5(["bd:serviceParam"]):::iri c7(["#91;AUTO_LANGUAGE#93;,en"]):::literal c3(["wd:Q35"]):::iri v2 --"wdt:P123"--> v3 v3 --"wdt:P17"--> c3 bind2[/"count(?work)"/] v2 --o bind2 bind2 --as--o v4 bind3[/"sample(?work)"/] v2 --o bind3 bind3 --as--o v4 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c5 --"wikibase:language"--> c7 end bind4[/"concat('#publisher/',substring(str(?publisher),'32^^xsd:integer'))"/] v3 --o bind4 bind4 --as--o v5 bind5[/"concat('#work/',substring(str(?example_work),'32^^xsd:integer'))"/] v4 --o bind5 bind5 --as--o v6