query-a09383ae4258270886eeaed0b6169cd9

rq turtle/ttl

(71) Bubble chart: populations of fictional universesNo.71 (2022.12.29T2059 created)

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 of the query
#title: bubble chart of populations of fictional universes
# viewed as bubble chart (also viewable as table)
#defaultView:BubbleChart
SELECT DISTINCT ?universe ?universeLabel ?item_count
WHERE {
  {SELECT DISTINCT ?universe (COUNT(DISTINCT ?item) AS ?item_count)
   WHERE {
     # ?item is instance of (P31) "subclass of (P279)" [ZeroOrMorePath (*)] fictional human (Q15632617)
     ### Note: "wdt:P31/wdt:P279* wd:Q15632617;" can be removed, and
     ### ?item will be all items from a fictional universe.
     ?item wdt:P31/wdt:P279* wd:Q15632617;
           # ?item is from narrative universe (P1080) ?universe
           wdt:P1080 ?universe
   }
   # group COUNT by ?universe
   GROUP BY ?universe
  }
  # show label in auto language as default, and English when no default label exists
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?item") v3("?item_count"):::projected v2("?universe"):::projected a1((" ")) c6(["bd:serviceParam"]):::iri c8(["#91;AUTO_LANGUAGE#93;,en"]):::literal c3(["wd:Q15632617"]):::iri v1 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c3 v1 --"wdt:P1080"--> v2 bind1[/"count(?item)"/] v1 --o bind1 bind1 --as--o v3 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c6 --"wikibase:language"--> c8 end