query-bb6b423d1cecb79df831eedd832ce91e
Malaysians by occupation and gender
Use at
- https://query.wikidata.org/sparql
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#>
#defaultView:BubbleChart
SELECT ?occupation_ms ?rgb (COUNT(DISTINCT ?person) AS ?personCount) WHERE {
?person wdt:P27 wd:Q833;
wdt:P106 ?occupation;
wdt:P21 ?gender.
bind( if(?gender=wd:Q6581097,"3399FF","FF99FF") as ?rgb ) .
OPTIONAL {?occupation rdfs:label ?occupation_ms filter (lang(?occupation_ms) = "ms")}.
}
GROUP BY ?occupation_ms ?rgb
ORDER BY DESC(?personCount)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?gender")
v4("?occupation")
v2("?occupation_ms"):::projected
v3("?person"):::projected
v7("?personCount")
v6("?rgb"):::projected
c3(["wd:Q833"]):::iri
v3 --"wdt:P27"--> c3
v3 --"wdt:P106"--> v4
v3 --"wdt:P21"--> v5
bind0[/"if(?gender = 'wd:Q6581097','3399FF','FF99FF')"/]
v5 --o bind0
bind0 --as--o v6
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."rdfs:label".-> v2
end
bind2[/"count(?person)"/]
v3 --o bind2
bind2 --as--o v7