query-7ac92bd1ac80dbed99b80a45139805e9

rq turtle/ttl

Types of musicians by number of instances Types of musicians by number of instances Types de musiciens par nombre d'instances Soorten uitvoerende muzikanten naar aantal instanties Types of musicians by number of instances Types of musicians 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:Q639669.
 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:Q639669 . ?occupationType1 rdfs:label ?occupationType1_en . FILTER (lang(?occupationType1_en) = "en") }
 OPTIONAL { ?type wdt:P279+ ?occupationType2 . ?occupationType2 wdt:P279 wd:Q639669 . ?occupationType2 rdfs:label ?occupationType2_en . FILTER (lang(?occupationType2_en) = "en") }
 OPTIONAL { ?type wdt:P279+ ?occupationType3 . ?occupationType3 wdt:P279/wdt:P279 wd:Q639669 . ?occupationType3 rdfs:label ?occupationType3_en . FILTER (lang(?occupationType3_en) = "en") }
 OPTIONAL { ?type wdt:P279+ ?occupationType4 . ?occupationType4 wdt:P279/wdt:P279/wdt:P279 wd:Q639669 . ?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 10000

Query found at