query-8ee69bca71889766ae63f196c00f4fe5
.on Mastodon and on TwitterOriginally posted
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?person ?personLabel ?netWorthUSD ?orientationLabel ?genderLabel WHERE {
?person wdt:P31 wd:Q5;
p:P2218/psv:P2218 [
wikibase:quantityAmount ?netWorthUSD;
# wikibase:quantityUnit wd:Q4917
].
OPTIONAL { # non-heterosexual
?person wdt:P91 ?orientation.
?orientation wdt:P279* wd:Q339014.
}
OPTIONAL { # non-cisgender male/female
?person wdt:P21 ?gender.
FILTER(?gender NOT IN (wd:Q6581097, wd:Q6581072))
}
FILTER(BOUND(?orientation) || BOUND(?gender))
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC(?netWorthUSD)
LIMIT 50
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?gender")
v1("?netWorthUSD"):::projected
v2("?orientation")
v4("?person"):::projected
a2((" "))
a1((" "))
c10(["wd:Q339014"]):::iri
c13(["bd:serviceParam"]):::iri
c4(["wd:Q5"]):::iri
c15(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["(bound(?orientation) || bound(?gender))"]]
f0 --> v2
f0 --> v3
v4 --"p:direct/P31"--> c4
a1 --"wikibase:quantityAmount"--> v1
v4 --"p:P2218"--> a2
a2 --"p:statement/value/P2218"--> a1
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:direct/P91".-> v2
v2 --"p:direct/P279"--> c10
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:direct/P21".-> v3
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c13 --"wikibase:language"--> c15
end