query-6cccfa4f7e472bede22bb685bc2c6fe6

rq turtle/ttl

Which human occupation is recorded in North Africa?

SELECT ?occupationLabel ?country_citizenshipLabel (COUNT(?occupationLabel) AS ?count) WHERE { ?item wdt:P31 wd:Q5. # Human ?item wdt:P27 ?country_citizenship. #With country citizenship ?country_citizenship wdt:P361 wd:Q27381. # Which is in north Africa OPTIONAL { ?item wdt:P106 ?occupation. } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } GROUP BY ?occupationLabel ?country_citizenshipLabel ORDER BY DESC (?count)

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#>
# Which human occupation is recorded in North Africa?

SELECT ?occupationLabel ?country_citizenshipLabel (COUNT(?occupationLabel) AS ?count) WHERE {
  ?item wdt:P31 wd:Q5. # Human
  ?item wdt:P27 ?country_citizenship. #With country citizenship
  ?country_citizenship wdt:P361 wd:Q27381. # Which is in north Africa
  OPTIONAL { ?item wdt:P106 ?occupation. }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} GROUP BY ?occupationLabel ?country_citizenshipLabel
ORDER BY DESC (?count)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?count") v3("?country_citizenship") v2("?item") v4("?occupation") v5("?occupationLabel"):::projected c8(["bd:serviceParam"]):::iri c2(["wd:Q5"]):::iri c10(["#91;AUTO_LANGUAGE#93;,en"]):::literal c5(["wd:Q27381"]):::iri v2 --"wdt:P31"--> c2 v2 --"wdt:P27"--> v3 v3 --"wdt:P361"--> c5 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P106".-> v4 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end bind1[/"count(?occupationLabel)"/] v5 --o bind1 bind1 --as--o v6