query-2d1ea187aaec488e47c6abd14ec18fbe

rq turtle/ttl

Topics

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX target: <http://www.wikidata.org/entity/Q35>

SELECT
  ?works
  (CONCAT("#country/", SUBSTR(STR(target:), 32), "/topic/", SUBSTR(STR(?topic), 32)) AS ?worksUrl)

  ?topic ?topicLabel
  (CONCAT("#topic/", SUBSTR(STR(?topic), 32)) AS ?topicUrl)
  ?topicDescription
WHERE {
   {
  SELECT
    (COUNT(DISTINCT ?work) AS ?works)
    ?topic
  WHERE {
     {
  SELECT DISTINCT ?author WHERE {
    ?author wdt:P27| (( wdt:P1416 | wdt:P108 ) / wdt:P17) target: .
  }
}    ?work wdt:P50 ?author ;
          wdt:P921 ?topic .
  }
  GROUP BY ?topic
  ORDER BY DESC(?works) 
  LIMIT 500  
}  service wikibase:label { bd:serviceParam wikibase:language "en" . } 
}
ORDER BY DESC(?works)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?author") v4("?topic"):::projected v6("?topicUrl") v3("?work") v5("?works"):::projected v5("?worksUrl") a1((" ")) c9(["bd:serviceParam"]):::iri c11(["en"]):::literal c2([http://www.wikidata.org/entity/Q35]):::iri subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P108"--> a1 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P1416"--> a1 end union1r <== or ==> union1l end a1 --"wdt:P17"--> c2 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P27"--> c2 end union0r <== or ==> union0l end v3 --"wdt:P50"--> v2 v3 --"wdt:P921"--> v4 bind1[/"count(?work)"/] v3 --o bind1 bind1 --as--o v5 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 end bind2[/"concat('#country/',substring(str(http://www.wikidata.org/entity/Q35),'32^^xsd:integer'),'/topic/',substring(str(?topic),'32^^xsd:integer'))"/] v4 --o bind2 bind2 --as--o v5 bind3[/"concat('#topic/',substring(str(?topic),'32^^xsd:integer'))"/] v4 --o bind3 bind3 --as--o v6