query-a2fbdf63019163462069707f10ef18bd

rq turtle/ttl

Types of writers by number of instances Types of writers by number of instances Types d'écrivains par nombre d'instances Soorten schrijvers naar aantal instanties Types of writers by number of instances Types of writers by number of instances

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?type 
 (COUNT(DISTINCT ?instance) AS ?count)
 ?Label_en
 (group_concat(distinct ?occupationType1_en;separator="; ") as ?occupationTypes1_en) 
 (group_concat(distinct ?occupationType2_en;separator="; ") as ?occupationTypes2_en)
 (group_concat(distinct ?occupationType3_en;separator="; ") as ?occupationTypes3_en)
 (group_concat(distinct ?occupationType4_en;separator="; ") as ?occupationTypes4_en)
WHERE {
 ?type wdt:P279* wd:Q36180.
 OPTIONAL { ?instance wdt:P106 ?type }  
 OPTIONAL { ?type rdfs:label ?Label_en . FILTER (lang(?Label_en) = "en") }
 OPTIONAL { ?type wdt:P279+ ?occupationType1 . ?occupationType1 wdt:P279/^wdt:P279 wd:Q36180 . ?occupationType1 rdfs:label ?occupationType1_en . FILTER (lang(?occupationType1_en) = "en") }
 OPTIONAL { ?type wdt:P279+ ?occupationType2 . ?occupationType2 wdt:P279 wd:Q36180 . ?occupationType2 rdfs:label ?occupationType2_en . FILTER (lang(?occupationType2_en) = "en") }
 OPTIONAL { ?type wdt:P279+ ?occupationType3 . ?occupationType3 wdt:P279/wdt:P279 wd:Q36180 . ?occupationType3 rdfs:label ?occupationType3_en . FILTER (lang(?occupationType3_en) = "en") }
 OPTIONAL { ?type wdt:P279+ ?occupationType4 . ?occupationType4 wdt:P279/wdt:P279/wdt:P279 wd:Q36180 . ?occupationType4 rdfs:label ?occupationType4_en . FILTER (lang(?occupationType4_en) = "en") }
}
GROUP BY ?type                      #List all the variables for which the values are not concatenated!
  ?count
  ?Label_en 
ORDER BY DESC(?count)
LIMIT 100

Query found at