Wikidata:WikiProject LGBT/Queries
Jump to navigation
Jump to search

Try it!
Try it!
Try it!
Try it!

This is the WikiProject LGBT query collection and showcase! Present commonly requested and otherwise interesting queries here. Especially share queries which are helpful for content curation projects.
Queries for content curation
[edit]- PetScan report of people who their sexual orientation is determined in English Wikipedia but they don't have P91 statement in Wikidata (2200 items).
- en:Category:Medieval LGBT people is a much less-daunting 16 people who could do with being checked — certainly Edward II of England (Q5236) has no reference to his sexuality and no mention of Piers Gaveston, 1st Earl of Cornwall (Q710482) as unmarried partner (P451), for example.
Query showcase
[edit]Politicians, born before 1910, who are LGBT+
[edit]The following query uses these:
- Items: intersex (Q1097630)
, hermaphrodite (Q303479)
, transgender (Q189125)
, trans woman (Q1052281)
, trans man (Q2449503)
, non-binary (Q48270)
, faʻafafine (Q1399232)
, māhū (Q3277905)
, kathoey (Q746411)
, fakaleitī (Q350374)
, hijra (Q660882)
, politician (Q82955)
- Properties: sexual orientation (P91)
, sex or gender (P21)
, date of birth (P569)
, position held (P39)
, occupation (P106)
SELECT DISTINCT ?person ?label ?date WHERE { { ?person wdt:P91 ?orientation .} UNION { {VALUES ?gender {wd:Q1097630 wd:Q303479 wd:Q189125 wd:Q1052281 wd:Q2449503 wd:Q48270 #wd:Q1399232 wd:Q3277905 wd:Q746411 wd:Q350374 wd:Q660882 } . ?person wdt:P21 ?gender . } } VALUES (?earliest) {("01-01-01T00:00:00Z"^^xsd:dateTime)} VALUES (?latest) {("1910-01-01T00:00:00Z"^^xsd:dateTime)} ?person wdt:P569 ?date . hint:Prior hint:rangeSafe true . FILTER (?date >= ?earliest) FILTER (?date <= ?latest) {?person wdt:P39 ?role .} UNION { ?person wdt:P106 wd:Q82955 .} ?person rdfs:label ?label. FILTER(LANG(?label) = "en"). } ORDER BY DESC(?date) LIMIT 100
Academic fields sorted by the count of LGBT+ researchers publishing on the topic
[edit]SELECT DISTINCT
?topic
?topicLabel
(group_concat(if(bound(?personName), ?personName, ?personEnglishLabel); separator=", ") as ?authors)
(COUNT(?topic) AS ?count)
WHERE {
{
?person wdt:P91 ?orientation .
FILTER (?orientation != wd:Q1035954 )
} UNION {
?person wdt:P21 ?gender .
VALUES ?gender { wd:Q1097630 wd:Q303479 wd:Q189125 wd:Q1052281 wd:Q2449503 wd:Q48270 wd:Q1399232 wd:Q3277905 wd:Q746411 wd:Q350374 wd:Q660882 }
}
?work wdt:P50 ?person ; wdt:P921 ?topic .
OPTIONAL {
?person wdt:P1559 ?personName
}
OPTIONAL {
?person rdfs:label ?personEnglishLabel
FILTER (lang(?personEnglishLabel) = "en")
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?topic ?topicLabel
ORDER BY DESC(?count)
LIMIT 1000
Same-sex couples
[edit]SELECT
?h
?hLabel
?spouse
?spouseLabel
?genderLabel
WHERE {
?h wdt:P21 ?gender .
?h wdt:P26 ?spouse .
?spouse wdt:P21 ?genderr .
FILTER (?gender = ?genderr)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
LIMIT 1000
Timeline of legalization of same-sex marriages
#defaultView:Timeline
SELECT DISTINCT ?marriage ?marriageLabel ?time ?image
{
{
SELECT ?marriage ?time {
?marriage wdt:P31|wdt:P279 wd:Q17422;
wdt:P580 ?time.
}
}
UNION {
SELECT ?marriage ?time {
?marriage wdt:P31|wdt:P279 wd:Q17422;
wdt:P585 ?time.
}
}
OPTIONAL{
?marriage wdt:P18 ?image.
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
LGBT people born, residing, or working in New York City
[edit]The following query uses these:
- Items: human (Q5)
, New York City (Q60)
, male (Q6581097)
, female (Q6581072)
, cisgender man (Q15145778)
, cisgender woman (Q15145779)
, cisgender (Q1093205)
, heterosexuality (Q1035954)
- Properties: instance 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)
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". } }
LGBT memorials commemorating the persecution of homosexuals in Nazi Germany and the Holocaust
[edit]The following query uses these:
- Properties: subclass of (P279)
, image (P18)
, inception (P571)
, commemorates (P547)
#defaultView:Timeline SELECT DISTINCT ?item ?itemLabel ?image ?date WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". } { SELECT DISTINCT ?item WHERE { ?item p:P547 ?statement0. ?statement0 (ps:P547/(wdt:P279*)) wd:Q718858. } } OPTIONAL { ?item wdt:P18 ?image. } OPTIONAL { ?item wdt:P571 ?date. } }
LGBT historic places
[edit]The following query uses these:
- Properties: instance of (P31)
, coordinate location (P625)
, inception (P571)
, country (P17)
, commemorates (P547)
SELECT ?item ?itemLabel ?geo ?inception ?countryLabel ?commemorates ?commemoratesLabel WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } ?item wdt:P31 wd:Q29469577. OPTIONAL { ?item wdt:P625 ?geo. } OPTIONAL { ?item wdt:P571 ?inception. } OPTIONAL { ?item wdt:P17 ?country. } OPTIONAL { ?item wdt:P547 ?commemorates. } }
LGBT choires around the world
[edit]The following query uses these:
- Items: LGBT chorus (Q1820625)
- Properties: subclass of (P279)
, located in the administrative territorial entity (P131)
, country (P17)
, inception (P571)
, dissolved, abolished or demolished date (P576)
, instance of (P31)
, field of work (P101)
SELECT DISTINCT ?item ?itemLabel ?country ?countryLabel ?start ?stop ?city ?cityLabel WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en". } { SELECT DISTINCT ?item WHERE { { ?item p:P31 ?statement0. ?statement0 (ps:P31/(wdt:P279*)) wd:Q1820625. } UNION { ?item p:P101 ?statement1. ?statement1 (ps:P101/(wdt:P279*)) wd:Q1820625. } } } OPTIONAL { ?item wdt:P131 ?city. } OPTIONAL { ?item wdt:P17 ?country. } OPTIONAL { ?item wdt:P571 ?start. } OPTIONAL { ?item wdt:P576 ?stop. } } ORDER by ?start
Queries for data-model maintenance
[edit]Statement-required constraints involving properties related to gender
[edit]#defaultView:Tree
select ?reqPropKind ?reqPropKindDesc ?reqProp ?reqPropDesc ?constraintStatus ?constraintStatusDesc ?prop ?propDesc {
?reqPropKind wdt:P279* wd:Q107417492.
?reqProp wdt:P31 ?reqPropKind.
?prop p:P2302 [
ps:P2302 wd:Q21503247;
pq:P2306 ?reqProp;
pq:P2316 ?constraintStatus;
].
?reqPropKind rdfs:label ?reqPropKindLabel.
FILTER(lang(?reqPropKindLabel) = "en")
?reqProp rdfs:label ?reqPropLabel.
FILTER(lang(?reqPropLabel) = "en")
?constraintStatus rdfs:label ?constraintStatusLabel.
FILTER(lang(?constraintStatusLabel) = "en")
BIND(
IF(?constraintStatus = <http://www.wikidata.org/entity/Q62026391>, "is suggested to be used",
IF(?constraintStatus = <http://www.wikidata.org/entity/Q21502408>, "is mandated to be used",
"is implied in a constraint that applies"
)
)
AS ?constraintStatusPhraseStr
)
?prop rdfs:label ?propLabel.
FILTER(lang(?propLabel) = "en")
BIND(CONCAT("Property of kind “", ?reqPropKindLabel, "”, namely …") as ?reqPropKindDesc)
BIND(CONCAT("“", ?reqPropLabel, "” (", str(?reqProp), "), …") as ?reqPropDesc)
BIND(CONCAT(?constraintStatusPhraseStr, " (", str(?constraintStatus), ") on items that have property …") as ?constraintStatusDesc)
BIND(CONCAT("“", ?propLabel, "” (", str(?prop), ").") as ?propDesc)
}