query-d4711bd781ec29b1c4e9f54956ab66a8
Propertiesinstance of (P31)sex or gender (P21)sexual orientation (P91)place of birth (P19)located in the administrative territorial entity (P131)residence (P551)work location (P937)
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 bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?person ?personLabel ?sexualorientationLabel ?sexorgenderLabel
WHERE {
?person wdt:P31 wd:Q5 . #?person is a human
BIND(wd:Q60 as ?place). #change wd:Q60 (New York City) to whatever ?place you want to search
{
?person wdt:P21 ?sexorgender. #?person has ?sexorgender
#?sexorgender is not male, female, cisgender male, cigender female, or cisgender person
FILTER(?sexorgender NOT IN (wd:Q6581097, wd:Q6581072, wd:Q15145778, wd:Q15145779, wd:Q1093205)).
} UNION {
?person wdt:P91 ?sexualorientation . #?person has ?sexualorientation
FILTER(?sexualorientation != wd:Q1035954). #?sexualorientation is not heterosexual
}
{
?person wdt:P19/wdt:P131* ?place. #?person was born in ?place
}
UNION {
?person wdt:P551/wdt:P131* ?place. #?person resides in ?place
}
UNION {
?person wdt:P937/wdt:P131* ?place. #?person works in ?place
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?person"):::projected
v2("?place")
v3("?sexorgender")
v4("?sexualorientation")
a1((" "))
a2((" "))
a3((" "))
c16(["bd:serviceParam"]):::iri
c2(["wd:Q5"]):::iri
c18(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v1 --"wdt:P31"--> c2
bind0[/"'wd:Q60'"/]
bind0 --as--o v2
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
f1[["?sexualorientation != 'wd:Q1035954'"]]
f1 --> v4
v1 --"wdt:P91"--> v4
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
f2[["?sexorgender != 'wd:Q6581097'?sexorgender != 'wd:Q6581072'?sexorgender != 'wd:Q15145778'?sexorgender != 'wd:Q15145779'?sexorgender != 'wd:Q1093205'"]]
f2 --> v3
v1 --"wdt:P21"--> v3
end
union0r <== or ==> union0l
end
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
subgraph union2[" Union "]
subgraph union2l[" "]
style union2l fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P937"--> a3
a3 --"wdt:P131"--> v2
end
subgraph union2r[" "]
style union2r fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P551"--> a2
a2 --"wdt:P131"--> v2
end
union2r <== or ==> union2l
end
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P19"--> a1
a1 --"wdt:P131"--> v2
end
union1r <== or ==> union1l
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c16 --"wikibase:language"--> c18
end