query-847987f5c7632372fad52ff1010be5c4

rq turtle/ttl

Counting appearances as talk show guestsI'm trying to count how often people have apppeared on a particular talk show as guests. However, all the count values are 1, although some people like Q1082694 do appear in different episodes.

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 ?person ?personLabel (count(distinct ?episode) as ?count) where
{
  ?episode wdt:P179 wd:Q565894.
  ?episode wdt:P5030 ?person.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} group by ?person ?personLabel order by desc(?count)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?count") v2("?episode"):::projected v3("?person"):::projected c5(["bd:serviceParam"]):::iri c7(["#91;AUTO_LANGUAGE#93;,en"]):::literal c2(["wd:Q565894"]):::iri v2 --"wdt:P179"--> c2 v2 --"wdt:P5030"--> v3 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c5 --"wikibase:language"--> c7 end bind1[/"count(?episode)"/] v2 --o bind1 bind1 --as--o v4