query-dc5427427600ea73b899b1169edcf377

rq turtle/ttl

Count of topics

PREFIX target: http://www.wikidata.org/entity/Q3067819

SELECT ?count ?topic ?topicLabel ?example_work ?example_workLabel WITH { SELECT (COUNT(?work) as ?count) ?topic (SAMPLE(?work) AS ?example_work) WHERE { ?work wdt:P1433 target: . ?work wdt:P921 ?topic . } GROUP BY ?topic } AS %result WHERE { INCLUDE %result SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } } ORDER BY DESC(?count)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Count of topics

PREFIX target: <http://www.wikidata.org/entity/Q3067819>

SELECT ?count ?topic ?topicLabel ?example_work ?example_workLabel
WHERE {
   {
  SELECT 
    (COUNT(?work) as ?count)
    ?topic
    (SAMPLE(?work) AS ?example_work)
  WHERE {
    ?work wdt:P1433 target: .
    ?work wdt:P921 ?topic .
  }
  GROUP BY ?topic
}  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } 
}
ORDER BY DESC(?count)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?count"):::projected v4("?example_work"):::projected v3("?topic"):::projected v2("?work") c5(["bd:serviceParam"]):::iri c2([http://www.wikidata.org/entity/Q3067819]):::iri c7(["#91;AUTO_LANGUAGE#93;,en"]):::literal v2 --"wdt:P1433"--> c2 v2 --"wdt:P921"--> v3 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