Project:SPARQL/examples
This page is parsed by the web interface of the query service to fill the query example dialog. For general examples and their explanations, please see here.
Simple Queries
Instances
Instances of gender identities
This query returns all instances of gender identities in lgbtDB. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT ?item ?itemLabel
WHERE
{
?item wdt:P1 wd:Q10639 . # Must be a gender identity
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
Instances of romantic orientations
This query returns all instances of romantic orientations in lgbtDB. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT ?item ?itemLabel
WHERE
{
?item wdt:P1 wd:Q226 . # Must be a romantic orientation
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
Instances of sexual orientations
This query returns all instances of sexual orientations in lgbtDB. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT ?item ?itemLabel
WHERE
{
?item wdt:P1 wd:Q10638 . # Must be a sexual orientation
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
Instances of websites
This query returns all instances of websites in lgbtDB. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT ?item ?itemLabel
WHERE
{
?item wdt:P1 wd:Q21333 . # Must be a website
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
Instances of magazines with an African country of origin
This query returns all instances of magazines with a country of origin located in Africa. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT ?item ?itemLabel ?countryOfOriginLabel
WHERE
{
?item wdt:P1 wd:Q16165 . # Must be a magazine
?item wdt:P802 ?countryOfOrigin . # Must have a country of origin
?countryOfOrigin wdt:P356* wd:Q7621 . # That country of origin must ultimately be located in Africa.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
Subclasses
Dates
Instances of real-life people with a birth or death date available
This query returns all instances of real-life (human) persons with a birth or death date available. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT DISTINCT ?item ?itemLabel ?bdate ?ddate
WHERE
{
?item wdt:P1 wd:Q8775 . # Must be a human person (a real-life person)
?item wdt:P141|wdt:P142 [] . # Must have a birthdate or deathdate available
OPTIONAL { ?item wdt:P141 ?bdate . } # Date of birth
OPTIONAL { ?item wdt:P142 ?ddate . } # Date of death
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
Lexemes
Instances of lexemes returned in dictionary order
This query returns all instances of English lexemes in dictionary order. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT ?headword ?categoryLabel {
?item wikibase:lemma ?headword . # Returns the lemma as the headword for the entry
?item wikibase:lexicalCategory ?category . # Returns the lexical category (noun, verb, etc.)
?item dct:language wd:Q2 . # Returns only English-language lexemes
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
} ORDER BY ASC(UCASE(str(?headword))) # Orders the headwords in ascending order after being sent to uppercase
Instances of lexemes derived from a particular lexeme
This query returns all instances of lexemes wherein at least one of the indicated etyma is the lexeme 'queen' (L127). It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT ?l ?lemma ?languageLabel
WHERE
{
?l a ontolex:LexicalEntry; # Indicates that the entity is of the type lexical entry
dct:language ?language; # Returns the language
wikibase:lemma ?lemma . # Returns the lemma
?l wdt:P32 wd:L127. # Returns all lexemes with an etymon for 'queen' indicated.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
Instances of English-language pronoun sets with different forms
This query returns all instances of English-language pronoun sets with the assorted pronoun forms (subject, object, dependent possessive, independent possessive, and reflexive forms). It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT ?pronounSetLabel ?subjectLabel ?objectLabel ?dependentPossessiveLabel ?independentPossessiveLabel ?reflexiveLabel
WHERE
{
?pronounSet wdt:P1 wd:Q2524 .
?pronounSet wdt:P216 ?subject .
?subject ontolex:representation ?subjectLabel .
?pronounSet wdt:P217 ?object .
?object ontolex:representation ?objectLabel .
?pronounSet wdt:P218 ?dependentPossessive .
?dependentPossessive ontolex:representation ?dependentPossessiveLabel .
?pronounSet wdt:P219 ?independentPossessive .
?independentPossessive ontolex:representation ?independentPossessiveLabel .
?pronounSet wdt:P220 ?reflexive .
?reflexive ontolex:representation ?reflexiveLabel .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
ORDER BY ?pronounSetLabel
Places
Places in New York City
This query returns all instances of places with addresses in New York City.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
PREFIX p: <https://lgbtdb.wikibase.cloud/prop/>
PREFIX pq: <https://lgbtdb.wikibase.cloud/prop/qualifier/>
SELECT DISTINCT ?item ?itemLabel
WHERE
{
?item p:P698 ?addressObject .
?addressObject pq:P701 wd:Q18321 .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Places in California
This query returns all instances of places with addresses in the state of California.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
PREFIX p: <https://lgbtdb.wikibase.cloud/prop/>
PREFIX pq: <https://lgbtdb.wikibase.cloud/prop/qualifier/>
SELECT DISTINCT ?item ?itemLabel
WHERE
{
?item p:P698 ?addressObject .
?addressObject pq:P700 wd:Q11578 .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Places in the United States
This query returns all instances of places with addresses in the United States.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
PREFIX p: <https://lgbtdb.wikibase.cloud/prop/>
PREFIX pq: <https://lgbtdb.wikibase.cloud/prop/qualifier/>
SELECT DISTINCT ?item ?itemLabel
WHERE
{
?item p:P698 ?addressObject .
?addressObject pq:P699 wd:Q94 .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Maps
Map of instances of gay bars
This query returns all instances of gay bars (or instances of subclasses of gay bars) in the form of a map. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
#defaultView:Map
SELECT ?gayBar ?gayBarLabel ?coor ?photo
WHERE
{
?gayBar wdt:P1/wdt:P2* wd:Q1106 . # Returns instances of gay bars or instances of subclasses of gay bars (such as lesbian bars)
?gayBar wdt:P638 ?coor . # Returns instances of gay bars with geographic coordinates available.
OPTIONAL { ?gayBar wdt:P398 ?photo }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
Map of entities listed as affiliations
This query returns a map of all entities referred to as affiliations (such as academic departments, hospital departments, universities, and other types of organizations) by authors of academic works.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
#defaultView:Map
SELECT DISTINCT ?affiliation ?affiliationLabel ?coor
WHERE
{
?item wdt:P838 ?affiliation. # Returns entities referred as as affiliations across all items.
?affiliation wdt:P638 ?coor . # Returns instances of affiliations with geographic coordinates available.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
Identifiers
COEXISTENCE Thesaurus
This query returns all instances of items with at least one mapping to an identifier in the COEXISTENCE Thesaurus. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT DISTINCT ?item ?itemLabel ?coexist
WHERE
{
?item wdt:P652 ?coexist . # Returns COEXISTENCE identifiers.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
ORDER BY xsd:integer(?coexist)
GSSO
This query returns all instances of items with at least one mapping to an identifier in the GSSO (version 2). It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT DISTINCT ?item ?itemLabel ?gsso
WHERE
{
?item wdt:P25 ?gsso . # Returns GSSO identifiers.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
Library of Congress Subject Headings
This query returns all instances of items with at least one mapping to a heading in the Library of Congress Subject Headings (LCSH). It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT DISTINCT ?item ?itemLabel ?lcsh
WHERE
{
?item wdt:P108 ?lcsh . # Returns Library of Congress Authority Identifiers.
FILTER(STRSTARTS(?lcsh, "sh")) . # Makes sure the authority identifier starts with "sh" (indicating that it is a subject heading).
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
Count of sources by NLM Classification
This query counts of the number of source items (such as journal articles) that have a MeSH (Medical Subject Heading) subject with an associated NLM Classification. It returns the classifications in descending order by most common classification heading. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT ?nlm ?count WHERE {
SELECT (COUNT(?item) as ?count) ?nlm WHERE {
?item wdt:P206 ?subj . # Must have a MeSH subject.
?subj wdt:P1165 ?nlm . # Returns NLM Classification for MeSH subject (if one exists).
}
GROUP BY ?nlm
}
ORDER BY DESC(?count)
Mappings
LCC-DDC-NLM mappings
This query returns all instances of items with at least one mapping to the Library of Congress Classification (LCC), the Dewey Decimal Classification (DDC) or the NLM Classification (NLM). It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT DISTINCT ?item ?itemLabel ?ddc ?lcc ?nlm
WHERE
{
?item wdt:P1156|wdt:P107|wdt:P1165 [] . # Must have a mapping to at least one of the classifications
OPTIONAL { ?item wdt:P1156 ?ddc . } # Returns Dewey Decimal Classification.
OPTIONAL {?item wdt:P107 ?lcc . } # Returns Library of Congress Classification.
OPTIONAL { ?item wdt:P1165 ?nlm . } # Returns NLM Classification.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
ORDER BY ?ddc ?lcc ?nlm
Mappings between all versions of the Homosaurus
This query returns all instances of items with at least one mapping to one of the versions of the Homosaurus, providing mappings between them where possible. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT DISTINCT ?item ?itemLabel ?val_0 ?val_1 ?val_2 ?val_3 ?val_4
WHERE
{
?item wdt:P29|wdt:P28|wdt:P27|wdt:P26 [] . # Must have a mapping to at least one of the versions of the Homosaurus available
OPTIONAL { ?item wdt:P29 ?val_0 . } # Homosaurus Version 0
OPTIONAL { ?item wdt:P28 ?val_1 . } # Homosaurus Version 1
OPTIONAL { ?item wdt:P27 ?val_2 . } # Homosaurus Version 2
OPTIONAL { ?item wdt:P26 ?val_3 . } # Homosaurus Version 3
OPTIONAL { ?item wdt:P1058 ?val_4 . } # Homosaurus Version 4
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
ORDER BY ?itemLabel
Return potential animal models for intersex conditions
This query returns all instances of potential animal models for intersex variations in humans. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT ?intersexVarConceptLabel ?nonHumanPheneLabel ?taxonLabel
WHERE
{
?intersexVarConcept wdt:P1 wd:Q1842 .
?intersexVar wdt:P1142 ?intersexVarConcept .
?nonHumanPhene wdt:P1108 ?intersexVar .
?nonHumanPhene wdt:P292 ?taxon .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
Return human cell lines (and cell line type) for intersex conditions
This query returns all instances of cell lines for intersex variations in humans. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT ?intersexVarConceptLabel ?cellLineLabel ?cellLineTypeLabel
WHERE
{
?intersexVarConcept wdt:P1 wd:Q1842 .
?intersexVar wdt:P1142 ?intersexVarConcept .
?intersexVar wdt:P1109 ?cellLine .
?cellLine wdt:P1 ?cellLineType .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
References
List referenced sources by number of times cited in lgbtDB
This query returns a list of every item used as a reference in a "stated in" (P21) statement, in descending order from most cited to least cited. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX pr: <https://lgbtdb.wikibase.cloud/prop/reference/>
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT ?referenceLabel ?count WHERE {
{
SELECT ?reference (COUNT(?reference) as ?count) WHERE {
?item ?prop [ prov:wasDerivedFrom [ pr:P21 ?reference ] ] .
}
GROUP BY ?reference
} .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
ORDER BY DESC(?count)
List types of referenced sources by number of times cited in lgbtDB
This query returns a list of every type (instance of) of item used as a reference in a "stated in" (P21) statement, in descending order from most cited to least cited. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX pr: <https://lgbtdb.wikibase.cloud/prop/reference/>
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT ?sourceTypeLabel ?count WHERE {
{
SELECT ?sourceType (COUNT(?sourceType) as ?count) WHERE {
?item ?prop [ prov:wasDerivedFrom [ pr:P21 ?reference ] ] .
?reference wdt:P1 ?sourceType
}
GROUP BY ?sourceType
} .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
ORDER BY DESC(?count)
Visualization Queries
Line Charts
HRC Municipal Equality Index
This query returns a line chart showcasing how the Human Rights Campaign's (HRC) Municipal Equality Index (MEI) (P864) has changed over the last decade. It uses the service wikibase:label to return the labels in your default language or in English. This query requires using lgbtDB identifiers due to some municipalities sharing the same name.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
PREFIX p: <https://lgbtdb.wikibase.cloud/prop/>
PREFIX pq: <https://lgbtdb.wikibase.cloud/prop/qualifier/>
PREFIX ps: <https://lgbtdb.wikibase.cloud/prop/statement/>
#defaultView:LineChart
SELECT ?PointInTime ?MEI ?MunicipalityName
WHERE
{
?Municipality p:P900 ?MEIProp .
?MEIProp pq:P19 ?PointInTime ;
ps:P900 ?MEI .
BIND(STRAFTER(STR(?Municipality), STR(wd:)) AS ?Identifier) .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
?Municipality rdfs:label ?MunicipalityLabel . FILTER( LANG(?MunicipalityLabel) = "en" )
BIND(CONCAT(?MunicipalityLabel, " (", ?Identifier, ")") AS ?MunicipalityName) .
}
ORDER BY ?MunicipalityName ?PointInTime
Equaldex's Equality Index Over Time
This query returns a line chart showcasing how the Equaldex's Equality Index (P864) has changed over the last five years. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
PREFIX p: <https://lgbtdb.wikibase.cloud/prop/>
PREFIX pq: <https://lgbtdb.wikibase.cloud/prop/qualifier/>
PREFIX ps: <https://lgbtdb.wikibase.cloud/prop/statement/>
#defaultView:LineChart
SELECT ?PointInTime ?EqualityIndex ?RegionLabel
WHERE
{
?Region p:P864 ?EqualityIndexProp .
?EqualityIndexProp pq:P19 ?PointInTime ;
ps:P864 ?EqualityIndex .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ?RegionLabel ?PointInTime
GAI Values Over Time
This query returns a line chart showcasing how the Williams Institute's Global Acceptance Index (GAI; P870) has changed in all regions over the past two decades. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
PREFIX p: <https://lgbtdb.wikibase.cloud/prop/>
PREFIX pq: <https://lgbtdb.wikibase.cloud/prop/qualifier/>
PREFIX ps: <https://lgbtdb.wikibase.cloud/prop/statement/>
#defaultView:LineChart
SELECT ?Region ?CoverageDate ?GAIValue ?RegionLabel
WHERE
{
?Region p:P870 ?GAI .
?GAI pq:P570 ?CoverageDate ;
ps:P870 ?GAIValue .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ?RegionLabel ?CoverageDate
MAP Sexual Orientation Policy Tallies Over Time
This query returns a line chart showcasing how the MAP (Movement Advancement Project) Sexual Orientation Policy Tally (P861) has changed in all U.S. states and territories over the past decade. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
PREFIX p: <https://lgbtdb.wikibase.cloud/prop/>
PREFIX pq: <https://lgbtdb.wikibase.cloud/prop/qualifier/>
PREFIX ps: <https://lgbtdb.wikibase.cloud/prop/statement/>
#defaultView:LineChart
SELECT ?USState ?PointInTime ?SexualOrientationTally ?USStateLabel
WHERE
{
?USState p:P861 ?SexualOrientationTallyProp .
?SexualOrientationTallyProp pq:P19 ?PointInTime ;
ps:P861 ?SexualOrientationTally .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ?USStateLabel ?PointInTime
MAP Gender Identity Policy Tallies Over Time
This query returns a line chart showcasing how the MAP (Movement Advancement Project) Gender Identity Policy Tally (P862) has changed in all U.S. states and territories over the past decade. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
PREFIX p: <https://lgbtdb.wikibase.cloud/prop/>
PREFIX pq: <https://lgbtdb.wikibase.cloud/prop/qualifier/>
PREFIX ps: <https://lgbtdb.wikibase.cloud/prop/statement/>
#defaultView:LineChart
SELECT ?USState ?PointInTime ?GenderIdentityTally ?USStateLabel
WHERE
{
?USState p:P862 ?GenderIdentityTallyProp .
?GenderIdentityTallyProp pq:P19 ?PointInTime ;
ps:P862 ?GenderIdentityTally .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ?USStateLabel ?PointInTime
MAP Overall Policy Tallies Over Time
This query returns a line chart showcasing how the MAP (Movement Advancement Project) Overall Tally (P863) has changed in all U.S. states and territories over the past decade. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
PREFIX p: <https://lgbtdb.wikibase.cloud/prop/>
PREFIX pq: <https://lgbtdb.wikibase.cloud/prop/qualifier/>
PREFIX ps: <https://lgbtdb.wikibase.cloud/prop/statement/>
#defaultView:LineChart
SELECT ?USState ?PointInTime ?OverallTally ?USStateLabel
WHERE
{
?USState p:P863 ?OverallTallyProp .
?OverallTallyProp pq:P19 ?PointInTime ;
ps:P863 ?OverallTally .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ?USStateLabel ?PointInTime
TRT Number of Anti-Trans Bills Introduced in the United States
This query returns a line chart showcasing how the Trans Legislation Tracker's (TRT) count of anti-trans bills introduced in the United States (P1131) has changed over the last decade. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
PREFIX p: <https://lgbtdb.wikibase.cloud/prop/>
PREFIX pq: <https://lgbtdb.wikibase.cloud/prop/qualifier/>
PREFIX ps: <https://lgbtdb.wikibase.cloud/prop/statement/>
#defaultView:LineChart
SELECT ?PointInTime ?NoTransBillsIntroduced
WHERE
{
?Item p:P1131 ?TransBillsProp .
?TransBillsProp pq:P19 ?PointInTime ;
ps:P1131 ?NoTransBillsIntroduced .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Bar Charts
NIH funding opportunity announcements
This query returns a bar chart visualization of different NIH grant award types (P805) related to funding opportunity announcements. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
#defaultView:BarChart
SELECT ?awardTypeLabel ?count
WITH {
SELECT DISTINCT ?awardType (COUNT (?foa) as ?count) {
?foa wdt:P1 wd:Q37455 . # Must be a funding opportunity announcement
?foa wdt:P805 ?awardType .
}
GROUP BY ?awardType
ORDER BY DESC (?count)
} AS %i
WHERE {
INCLUDE %i
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
Bubble Charts
Types of places in lgbtDB
This query returns a bubble chart representing the different types (using the "instance of" property (P1)) of places with addresses represented in the database. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
#defaultView:BubbleChart
SELECT ?instanceOfLabel (count(*) as ?count) {
?item wdt:P1 ?instanceOf .
?item wdt:P698 ?address .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
GROUP BY ?instanceOfLabel
ORDER BY DESC(?count) ASC(?instanceOf)
NIH grant award types
This query returns a bubble chart visualization of different NIH grant award types (P805). It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
#defaultView:BubbleChart
SELECT ?grantAwardTypeLabel ?count
WITH {
SELECT DISTINCT ?grantAwardType (COUNT (?grant) as ?count) {
?grant wdt:P805 ?grantAwardType . # Selects an award type.
}
GROUP BY ?grantAwardType
ORDER BY DESC (?count)
} AS %i
WHERE {
INCLUDE %i
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
Graphs
Subclass tree for a class entity
This query returns a graph of the subclass tree for the class of animals (Q4243). It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
#defaultView:Graph
SELECT ?item ?itemLabel ?linkTo {
wd:Q4243 wdt:P2* ?item
OPTIONAL { ?item wdt:P2 ?linkTo }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
Co-authorship clustering
This query returns a graph linking authors (P72) who have authored pieces with one another. It uses the service wikibase:label to return the labels in your default language or in English. WARNING: Be extremely careful with this query as it will take several minutes to run or may crash. Use at your own risk.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
#defaultView:Graph
SELECT ?author1 ?author1Label ?author2 ?author2Label {
?item wdt:P72 ?author1 . # Selects a first author.
?item wdt:P72 ?author2 . # Selects a second author.
FILTER (?author1 != ?author2) # Removes self-relations.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
} LIMIT 10000
Subject clustering
This query returns a graph of subjects (P134: indexing concept, P135: subject, P136: key concept, and P206: MeSH subject) which are listed alongside one another. It uses the service wikibase:label to return the labels in your default language or in English. WARNING: Be extremely careful with this query as it will take several minutes to run or may crash. Use at your own risk.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
#defaultView:Graph
SELECT ?subject1 ?subject1Label ?subject2 ?subject2Label
WITH {
SELECT (COUNT(DISTINCT ?item) AS ?count) ?subject1 ?subject2
WHERE {
?item wdt:P134*/wdt:P135*/wdt:P136*/wdt:P206*/wdt:P818* ?subject1. # Selects a first subject.
?item wdt:P134*/wdt:P135*/wdt:P136*/wdt:P206*/wdt:P818* ?subject2 . # Selects a second subject.
?item wdt:P134*/wdt:P135*/wdt:P136*/wdt:P206*/wdt:P818* ?subject1, ?subject2 . # Find co-occurring subjects.
FILTER (?subject1 != ?subject2) # Removes self-relations.
}
GROUP BY ?subject1 ?subject2
ORDER BY DESC(?count)
LIMIT 500
} AS %results
WHERE {
INCLUDE %results
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
Subject clustering in Knowsy
This query returns a graph of subjects (P136: key concept) which are listed alongside one another as key terms for sources in the Knowsy dataset. It uses the service wikibase:label to return the labels in your default language or in English. WARNING: Be extremely careful with this query as it will take several minutes to run or may crash. Use at your own risk.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
#defaultView:Graph
SELECT ?subject1 ?subject1Label ?subject2 ?subject2Label
WITH {
SELECT (COUNT(DISTINCT ?item) AS ?count) ?subject1 ?subject2
WHERE {
?item wdt:P568 wd:Q49199 . # Selects sources in the Knowsy database.
?item wdt:P136 ?subject1. # Selects a first subject.
?item wdt:P136 ?subject2 . # Selects a second subject.
?item wdt:P136 ?subject1, ?subject2 . # Find co-occurring subjects.
FILTER (?subject1 != ?subject2) # Removes self-relations.
}
GROUP BY ?subject1 ?subject2
ORDER BY DESC(?count)
} AS %results
WHERE {
INCLUDE %results
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
Timelines
Timeline of protests and demonstrations
This query returns a timeline of protests and other kinds of demonstrations. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
#defaultView:Timeline
SELECT DISTINCT ?Item ?ItemLabel ?PointInTime
WHERE
{
?Item wdt:P1/wdt:P2* wd:Q3326 .
?Item wdt:P19 ?PointInTime .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ?ItemLabel ?PointInTime
Timeline of organizations and companies rolling back DEI commitments or programs
This query returns a timeline of organizations and companies that have rolled back DEI commitments or programs in the 2020s. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
PREFIX p: <https://lgbtdb.wikibase.cloud/prop/>
PREFIX pq: <https://lgbtdb.wikibase.cloud/prop/qualifier/>
PREFIX ps: <https://lgbtdb.wikibase.cloud/prop/statement/>
#defaultView:Timeline
SELECT ?ItemLabel ?HasRolledBackDEILabel ?PointInTime
WHERE
{
?Item p:P1054 ?DEIStatus .
?DEIStatus pq:P19 ?PointInTime ;
ps:P1054 ?HasRolledBackDEI .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ?ItemLabel ?PointInTime
Quality Checks (QC)
Making sure all key concepts are instances of concepts
This query returns all items used as key concepts that do not have instance values (it should ideally return zero results, as all values for key concept should be instances of concepts). It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT DISTINCT ?item ?itemLabel
WHERE
{
?x wdt:P136 ?item .
FILTER NOT EXISTS { ?item wdt:P1 wd:Q16333 }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
Classing key concepts that are not instances of concepts by most occurrences
This query returns all items used as key concepts that do not have instance values (it should ideally return zero results, as all values for key concept should be instances of concepts). However, unlike the above query, it counts the number of offending concepts and orders them by descending frequency. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT ?item ?itemLabel ?count WHERE {
{
SELECT ?item (COUNT(?item) as ?count) WHERE {
?x wdt:P136 ?item .
FILTER NOT EXISTS { ?item wdt:P1 wd:Q16333 } .
} GROUP BY ?item
} .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
ORDER BY DESC(?count)
Making sure all Library of Congress Authority Identifiers are instances of concepts
This query returns all items with Library of Congress Authority Identifiers listed are themselves instances of concepts (it should ideally return zero results). It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT DISTINCT ?x ?xLabel ?item
WHERE
{
?x wdt:P108 ?item .
FILTER NOT EXISTS { ?x wdt:P1 wd:Q16333 }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
Making sure all Medical Subject Headings are instances of concepts
This query returns all items with Medical Subject Headings (MeSH) listed are themselves instances of concepts (it should ideally return zero results). It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT DISTINCT ?x ?xLabel ?item
WHERE
{
?x wdt:P228 ?item .
FILTER NOT EXISTS { ?x wdt:P1 wd:Q16333 }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
Making sure all LGBT Life Thesaurus headings are instances of concepts
This query returns all items with LGBT Life Thesaurus headings listed are themselves instances of concepts (it should ideally return zero results). It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT DISTINCT ?x ?xLabel ?item
WHERE
{
?x wdt:P80 ?item .
FILTER NOT EXISTS { ?x wdt:P1 wd:Q16333 }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
Making sure all Homosaurus Version 1 headings are instances of concepts
This query returns all items with Homosaurus Version 1 headings listed are themselves instances of concepts (it should ideally return zero results). It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT DISTINCT ?x ?xLabel ?item
WHERE
{
?x wdt:P28 ?item .
FILTER NOT EXISTS { ?x wdt:P1 wd:Q16333 }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
Making sure all Homosaurus headings are instances of concepts
This query returns all items with Homosaurus headings listed are themselves instances of concepts (it should ideally return zero results). It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT DISTINCT ?item ?itemLabel ?val_0 ?val_1 ?val_2 ?val_3 ?val_4
WHERE
{
?item wdt:P29|wdt:P28|wdt:P27|wdt:P26 [] . # Must have a mapping to at least one of the versions of the Homosaurus available
OPTIONAL { ?item wdt:P29 ?val_0 . } # Homosaurus Version 0
OPTIONAL { ?item wdt:P28 ?val_1 . } # Homosaurus Version 1
OPTIONAL { ?item wdt:P27 ?val_2 . } # Homosaurus Version 2
OPTIONAL { ?item wdt:P26 ?val_3 . } # Homosaurus Version 3
OPTIONAL { ?item wdt:P1058 ?val_4 . } # Homosaurus Version 4
FILTER NOT EXISTS { ?item wdt:P1 wd:Q16333 }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
ORDER BY ?itemLabel
Making sure all entities pointed to as corresponding classes have a "subclass of" statement
This query returns all items pointed to with the "corresponding class" (P1150) property, indicating that they are classes, and then subsets that for all such entities which are lacking a "subclass of" (P2) statement. All classes (other than root classes) should, ideally, have at least one "subclass of" (P2) statement. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT DISTINCT ?class ?classLabel
WHERE
{
?concept wdt:P1150 ?class .
FILTER NOT EXISTS { ?class wdt:P2 [] }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
Making sure all entities that have a "subclass of" statement include an example photo
This query returns all items that have a "subclass of" (P2) property, indicating that they are classes, and then subsets that for all such entities which are lacking an "example photo" (P1119) statement. All classes that are continuants should, ideally, have at least one "example photo" (P1119) statement where possible. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT DISTINCT ?class ?classLabel
WHERE
{
?class wdt:P2 ?x .
FILTER NOT EXISTS { ?class wdt:P1119 [] }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
Making sure all "mentioned by" and "described by" statements appear on concepts
This query returns all items that have a "mentioned by" (P240) or "described by" (P82) statement that are not instances of concepts. All instances of these statements should occur only on concepts, meaning this query should return zero results. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT DISTINCT ?x ?xLabel
WHERE
{
?x wdt:P240|wdt:P82 ?item .
FILTER NOT EXISTS { ?x wdt:P1 wd:Q16333 }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
This query returns all items that have a "broader" (P104), "narrower" (P105), or "related to" (P106) statement that are not instances of concepts. All instances of these statements should occur only on concepts, meaning this query should return zero results. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT DISTINCT ?x ?xLabel
WHERE
{
?x wdt:P104|wdt:P105|wdt:P106 ?item .
FILTER NOT EXISTS { ?x wdt:P1 wd:Q16333 }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
Making sure all entities with geographic coordinates have a photo
This query returns all items that have geographic coordinates (P638) available, and then subsets that for all such entities which are lacking a "photo" (P398) statement. All classes that have geographic coordinates should, ideally, have at least one "photo" (P398) statement where possible. It uses the service wikibase:label to return the labels in your default language or in English.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
#defaultView:Map
SELECT DISTINCT ?entity ?entityLabel ?coor
WHERE
{
?entity wdt:P638 ?coor . # Returns entities with geographic coordinates available.
FILTER NOT EXISTS { ?entity wdt:P398 [] }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}