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. For a subject-matter index of examples created for browsing lgbtDB, see Table of Contents.
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
}
ORDER BY ASC(UCASE(?itemLabel))
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
}
ORDER BY ASC(UCASE(?itemLabel))
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
}
ORDER BY ASC(UCASE(?itemLabel))
Instances of encyclopedias
This query returns all instances of encyclopedias 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:Q2514 . # Must be an encyclopedia
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(?itemLabel))
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
}
ORDER BY ASC(UCASE(?itemLabel))
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
}
ORDER BY ASC(UCASE(?itemLabel))
Instances of events or sets of events
This query returns all instances of events (or sets of events, such as recurring events) in lgbtDB. It uses the service wikibase:label to return the labels in your default language or in English. It also includes Wikidata identifiers, if available, and orders them by the start date (or earliest date) and then alphabetically.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT DISTINCT ?event ?eventLabel ?wikidata ?takesPlaceLabel ?date ?endTime
WHERE
{
{
?event wdt:P1/wdt:P2* wd:Q20659 .
}
UNION
{
?event wdt:P1/wdt:P2* wd:Q146404 .
}
OPTIONAL { ?event wdt:P3 ?wikidata }
OPTIONAL { ?event wdt:P640 ?takesPlace }
OPTIONAL { ?event wdt:P19 ?pointInTime }
OPTIONAL { ?event wdt:P44 ?startTime }
OPTIONAL { ?event wdt:P45 ?endTime }
BIND(COALESCE(?pointInTime, ?startTime) AS ?date)
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
}
}
ORDER BY ?date ?takesPlaceLabel ?eventLabel
Instances of academic disciplines
This query returns all instances of academic disciplines 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:Q4167. # Must be an academic discipline
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(?itemLabel))
Instances of social movements
This query returns all instances of social movements 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 DISTINCT ?item ?itemLabel
WHERE
{
?item wdt:P1/wdt:P2* wd:Q74164 . # Must be a social movement
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(?itemLabel))
Instances of subcultures
This query returns all instances of subcultures 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 DISTINCT ?item ?itemLabel
WHERE
{
?item wdt:P1/wdt:P2* wd:Q3810 . # Must be a subculture
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(?itemLabel))
Instances of theories
This query returns all instances of theories 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 DISTINCT ?item ?itemLabel
WHERE
{
?item wdt:P1/wdt:P2* wd:Q2702 . # Must be a theory
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(?itemLabel))
Subclasses
Languages
Count of titles in lgbtDB by language title code
This query returns the number of titles in lgbtDB by title language code.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT ?lang ?count
WHERE {
SELECT ?lang (count(?item) AS ?count)
WHERE {
SELECT ?item (LANG(?title) AS ?lang)
WHERE
{
?item wdt:P67 ?title .
}
} GROUP BY ?lang
}
ORDER BY DESC(?count)
Calculations
Percentage of Knowsy subjects covered by Medical Subject Headings
This query calculates the percentage of subjects in Knowsy covered using Medical Subject Headings (MeSH).
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT (COUNT(?mesh)*100/(COUNT(?item)) as ?percent) WHERE
{
{
SELECT DISTINCT ?item ?mesh WHERE {
?x wdt:P136 ?item .
?x wdt:P568 wd:Q49199 .
OPTIONAL { ?item wdt:P228 ?mesh } .
}
}
}
Percentage of Knowsy subjects covered by Library of Congress Subject Headings
This query calculates the percentage of subjects in Knowsy covered using Library of Congress Subject Headings (LCSH).
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT (COUNT(?lcsh)*100/(COUNT(?item)) as ?percent) WHERE
{
{
SELECT DISTINCT ?item ?lcsh WHERE {
?x wdt:P136 ?item .
?x wdt:P568 wd:Q49199 .
OPTIONAL {
?item wdt:P108 ?lcsh .
FILTER(STRSTARTS(?lcsh, "sh")) . # Makes sure the authority identifier starts with "sh" (indicating that it is a subject heading).
} .
}
}
}
Dates
Instances of real-life people born today (based on UTC date)
This query returns all instances of real-life (human) persons with a birth date today. 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 ?person ?personLabel ?bdate
WHERE
{
?person wdt:P1 wd:Q8775 . # Must be a human person (a real-life person)
?person wdt:P141 ?bdate .
FILTER (
(MONTH(?bdate) = MONTH(NOW())) &&
(DAY(?bdate) = DAY(NOW()))
)
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 ?bdate
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
}
Instances of titles published between 1800 and 1910
This query returns all instances of items with titles that were created, issued, or published between 1800 and 1910 (inclusive).
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?item ?title ?dateCreated ?dateIssued ?datePublished
WHERE
{
BIND ("1800"^^xsd:integer AS ?STARTYEAR) .
BIND ("1910"^^xsd:integer AS ?ENDYEAR) .
?item wdt:P67 ?title .
?item wdt:P400|wdt:P469|wdt:P58 [] .
OPTIONAL { ?item wdt:P400 ?dateCreated . }
OPTIONAL { ?item wdt:P469 ?dateIssued . }
OPTIONAL { ?item wdt:P58 ?datePublished . }
FILTER (
(YEAR(?dateCreated) >= ?STARTYEAR && YEAR(?dateCreated) <= ?ENDYEAR) ||
(YEAR(?dateIssued) >= ?STARTYEAR && YEAR(?dateIssued) <= ?ENDYEAR) ||
(YEAR(?datePublished) >= ?STARTYEAR && YEAR(?datePublished) <= ?ENDYEAR) ) .
# Replace unbound dates with a far-future placeholder
BIND(COALESCE(?dateCreated, "9999-12-31"^^xsd:dateTime) AS ?d1) .
BIND(COALESCE(?dateIssued, "9999-12-31"^^xsd:dateTime) AS ?d2) .
BIND(COALESCE(?datePublished, "9999-12-31"^^xsd:dateTime) AS ?d3) .
# Take the minimum of the three
BIND(
IF(?d1 <= ?d2 && ?d1 <= ?d3, ?d1,
IF(?d2 <= ?d1 && ?d2 <= ?d3, ?d2, ?d3)
) AS ?earliest
) .
}
ORDER BY ASC(?earliest)
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 DISTINCT ?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 LGBTQ-owned bookstores
This query returns a map of all entities referred to as LGBTQ-owned bookstores.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
#defaultView:Map
SELECT DISTINCT ?bookstore ?bookstoreLabel ?coor ?photo
WHERE
{
?bookstore wdt:P1 wd:Q28457 . # Returns entities that are LGBTQ-owned bookstores.
?bookstore wdt:P638 ?coor . # Returns instances of bookstores with geographic coordinates available.
OPTIONAL { ?bookstore 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 GLAM institutions
This query returns a map of all entities referred to as galleries, libraries, archives, or museums (or any subclasses of these entities).
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
#defaultView:Map
SELECT DISTINCT ?glam ?glamLabel ?coor ?photo
WHERE
{
VALUES ?type {
wd:Q4271 # gallery
wd:Q5525 # library
wd:Q4265 # archive
wd:Q5677 # museum
}
?glam wdt:P1/wdt:P2* ?type . # Returns instances of GLAM institutions or instances of subclasses of GLAM institutions
?glam wdt:P638 ?coor . # Returns instances of GLAM institutions with geographic coordinates available.
OPTIONAL { ?glam 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
}
This query finds sources in lgbtDB that contain a concept related to AIDS (Q251), and ranks them by distance (shortest to longest) to the original concept. 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 prov: <http://www.w3.org/ns/prov#>
SELECT DISTINCT ?item ?itemLabel ?usedSubject ?usedSubjectLabel ?distance (COUNT(DISTINCT ?ref) AS ?refCount)
( (100 - (?distance * 10)) + (COUNT(DISTINCT ?ref) * 5) AS ?score )
WHERE {
VALUES ?rootSubject { wd:Q251 }
{
# root subject itself, distance = 0
BIND(?rootSubject AS ?usedSubject)
BIND(0 AS ?distance)
}
UNION
{
# narrower
?usedSubject wdt:P104 ?rootSubject .
BIND(1 AS ?distance)
?usedSubject p:P104 ?stmt .
OPTIONAL { ?stmt prov:wasDerivedFrom ?ref }
}
UNION
{
# broader
?rootSubject wdt:P105 ?usedSubject .
BIND(1 AS ?distance)
?rootSubject p:P105 ?stmt .
OPTIONAL { ?stmt prov:wasDerivedFrom ?ref }
}
UNION
{
# related
?rootSubject wdt:P106 ?usedSubject .
BIND(1 AS ?distance)
?rootSubject p:P106 ?stmt .
OPTIONAL { ?stmt prov:wasDerivedFrom ?ref }
}
UNION
{
# inverse related
?usedSubject wdt:P106 ?rootSubject .
BIND(1 AS ?distance)
?usedSubject p:P106 ?stmt .
OPTIONAL { ?stmt prov:wasDerivedFrom ?ref }
}
UNION
{
# see-also
?rootSubject wdt:P14 ?usedSubject .
BIND(1 AS ?distance)
?rootSubject p:P14 ?stmt .
OPTIONAL { ?stmt prov:wasDerivedFrom ?ref }
}
UNION
{
?usedSubject wdt:P14 ?rootSubject .
BIND(1 AS ?distance)
?usedSubject p:P14 ?stmt .
OPTIONAL { ?stmt prov:wasDerivedFrom ?ref }
}
# Find items where that subject is used
?item wdt:P134|wdt:P135|wdt:P136|wdt:P206|wdt:P818|wdt:P878 ?usedSubject .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?item ?itemLabel ?usedSubject ?usedSubjectLabel ?distance
ORDER BY DESC(?score) ?usedSubjectLabel ?itemLabel
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.
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)
Count of sources by Library of Congress Classification
This query counts of the number of source items (such as journal articles) that have a some kind of subject with an associated Library of Congress Classification (LCC). It returns the classifications in descending order by most common classification heading.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT ?lcc ?count WHERE {
SELECT (COUNT(?item) as ?count) ?lcc WHERE {
?item wdt:P134|wdt:P135|wdt:P136|wdt:P206 ?subj . # Must have a subject indicated.
?subj wdt:P107 ?lcc . # Returns Library of Congress Classification(s) for the subject (if one exists).
}
GROUP BY ?lcc
}
ORDER BY DESC(?count)
List of sources by Library of Congress Classification
This query lists source items (such as journal articles) that have some kind of subject with an associated Library of Congress Classification (LCC). It returns a list of those sources arranged by classification heading. Note that sources appear in the list multiple times if they have multiple subjects or if there are multiple LCC values associated with a given subject. This query 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 ?lcc ?item ?itemLabel WHERE {
?item wdt:P134|wdt:P135|wdt:P136|wdt:P206 ?subj . # Must have a subject indicated.
?subj wdt:P107 ?lcc . # Returns Library of Congress Classification(s) for the subject (if one exists).
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 ?lcc
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
Proportion of nonbinary gender identities respondents to the Gender Census chose
This query returns a line chart showing the percentage of respondents to each of the Gender Censuses who chose each gender identity. 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 DISTINCT ?endDate ?proportion ?identityLabel WHERE {
# Instances of gender identity
?identity wdt:P1 wd:Q10639 .
# Statement node for sample proportion
?identity p:P1351 ?statement .
# Extract numeric value
?statement ps:P1351 ?proportion .
# Qualifier: population = nonbinary people
?statement pq:P1100 wd:Q158981 .
# Qualifier: date data collection ended
?statement pq:P1353 ?endDate .
# Labels (if label service available)
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY ?endDate ?identityLabel
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 for instances of nations (Q21454). 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 wdt:P1 wd:Q21454 . # Must be an instance of a nation
?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 Percentage Over Time
This query returns a line chart showcasing how the MAP (Movement Advancement Project) Sexual Orientation Percentage (P1196) 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 ?SexualOrientationPercentage ?USStateLabel
WHERE
{
?USState p:P1196 ?SexualOrientationPercentageProp .
?SexualOrientationPercentageProp pq:P19 ?PointInTime ;
ps:P1196 ?SexualOrientationPercentage .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ?USStateLabel ?PointInTime
MAP Gender Identity Percentage Over Time
This query returns a line chart showcasing how the MAP (Movement Advancement Project) Gender Identity Percentage (P1197) 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 ?GenderIdentityPercentage ?USStateLabel
WHERE
{
?USState p:P1197 ?GenderIdentityPercentageProp .
?GenderIdentityPercentageProp pq:P19 ?PointInTime ;
ps:P1197 ?GenderIdentityPercentage .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ?USStateLabel ?PointInTime
MAP Overall Percentage Over Time
This query returns a line chart showcasing how the MAP (Movement Advancement Project) Overall Percentage (P1195) 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 ?OverallPercentage ?USStateLabel
WHERE
{
?USState p:P1195 ?OverallPercentageProp .
?OverallPercentageProp pq:P19 ?PointInTime ;
ps:P1195 ?OverallPercentage .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ?USStateLabel ?PointInTime
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
}
Scatter Charts
Scatter chart of F&M Global Barometer of Gay Rights Score versus F&M Global Barometer of Transgender Rights Score
This query returns a scatter chart of the F&M Global Barometer of Gay Rights (GBGR) Score versus the F&M Global Barometer of Transgender Rights (GBTR) Score for the same year. 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:ScatterChart
SELECT ?GBGRScore ?GBTRScore (CONCAT(COALESCE(STR(?RegionLabel), STR(?Region)), " (", STR(?Year), ")") AS ?RegionYearLabel)
WHERE {
{
SELECT ?Region ?YearGBGR ?GBGRScore
WHERE {
?Region wdt:P1 wd:Q21454 .
?Region p:P949 ?GBGRProp .
?GBGRProp pq:P19 ?GBGRDate ;
ps:P949 ?GBGRScore .
BIND(YEAR(?GBGRDate) AS ?YearGBGR)
}
}
{
SELECT ?Region ?YearGBTR ?GBTRScore
WHERE {
?Region wdt:P1 wd:Q21454 .
?Region p:P950 ?GBTRProp .
?GBTRProp pq:P19 ?GBTRDate ;
ps:P950 ?GBTRScore .
BIND(YEAR(?GBTRDate) AS ?YearGBTR)
}
}
FILTER(?YearGBGR = ?YearGBTR) .
BIND(?YearGBGR AS ?Year) .
# Get label for the bound ?Region at this (outer) level
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
?Region rdfs:label ?RegionLabel .
}
}
Scatter chart of Equaldex's Equality Index versus F&M Global Barometer of Unified LGBT Rights Score
This query returns a scatter chart of the average Equaldex Equality Index (EEI) per year versus the F&M Global Barometer of Unified LGBT Rights (GBUR) Score for the same year. 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:ScatterChart
SELECT ?AverageEqualityIndex ?AverageGBURScore (CONCAT(COALESCE(STR(?RegionLabel), STR(?Region)), " (", STR(?Year), ")") AS ?RegionYearLabel)
WHERE {
{
SELECT ?Region ?YearEquality (AVG(?EqualityIndex) AS ?AverageEqualityIndex)
WHERE {
?Region wdt:P1 wd:Q21454 .
?Region p:P864 ?EqualityIndexProp .
?EqualityIndexProp pq:P19 ?EqualityDate ;
ps:P864 ?EqualityIndex .
BIND(YEAR(?EqualityDate) AS ?YearEquality)
}
GROUP BY ?Region ?YearEquality
}
{
SELECT ?Region ?YearGBUR (AVG(?GBURValue) AS ?AverageGBURScore)
WHERE {
?Region wdt:P1 wd:Q21454 .
?Region p:P1222 ?GBURProp .
?GBURProp pq:P19 ?GBURDate ;
ps:P1222 ?GBURValue .
BIND(YEAR(?GBURDate) AS ?YearGBUR)
}
GROUP BY ?Region ?YearGBUR
}
FILTER(?YearEquality = ?YearGBUR) .
BIND(?YearEquality AS ?Year) .
# Get label for the bound ?Region at this (outer) level
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
?Region rdfs:label ?RegionLabel .
}
}
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, P206: MeSH subject, and P818: tag) 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|wdt:P878 ?subject1. # Selects a first subject.
?item wdt:P134|wdt:P135|wdt:P136|wdt:P206|wdt:P818|wdt:P878 ?subject2 . # Selects a second subject.
?item wdt:P134|wdt:P135|wdt:P136|wdt:P206|wdt:P818|wdt:P878 ?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 instances of the Gay Games
This query returns a timeline of instances of the Gay Games. 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 ?StartTime ?EndTime
WHERE
{
?Item wdt:P1 wd:Q23768 .
?Item wdt:P44 ?StartTime .
?Item wdt:P45 ?EndTime .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ?ItemLabel ?StartTime
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
Places to Contribute
Showing all real-life people with missing birth or death dates
This query returns all items representing real-life people which are missing both a birth date and a death date. While not every item here requires one or both to be added, it is usually ideal for one or both to be present.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT DISTINCT ?item ?itemLabel
WHERE
{
?item wdt:P1 wd:Q8775 . # Must be a human person (a real-life person)
FILTER NOT EXISTS { ?item wdt:P141|wdt:P142 ?borddate . }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
Showing all real-life people with missing birth or death places
This query returns all items representing real-life people which are missing both a birth place and a death place. While not every item here requires one or both to be added, it is usually ideal for one or both to be present.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT DISTINCT ?item ?itemLabel
WHERE
{
?item wdt:P1 wd:Q8775 . # Must be a human person (a real-life person)
FILTER NOT EXISTS { ?item wdt:P1266|wdt:P1268 ?bordplace . }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
Showing all real-life people who do not have an "instance of" statement other than "human person"
This query returns all items representing real-life people who have no other instance statements other than "instance of" (Q1) "human person" (Q8775). Persons should typically have multiple or many instance of statements.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT DISTINCT ?person ?personLabel WHERE {
?person wdt:P1 wd:Q8775 . # Must be a human person (a real-life person)
# Ensure there are no other instance of (P1) values
FILTER NOT EXISTS {
?person wdt:P1 ?otherInstance.
FILTER(?otherInstance != wd:Q8775)
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
All affiliations that lack an address or coordinates
This query returns all items that are listed as affiliations on publications that are missing both an address and coordinates. While not every item here requires one or both to be added, it is usually ideal for one or both to be present.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT DISTINCT ?affiliation ?affiliationLabel
WHERE
{
?item wdt:P838 ?affiliation. # Returns entities referred as as affiliations across all items.
FILTER NOT EXISTS { ?affiliation wdt:P698|wdt:P638 ?addressorcoor . }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en (English) language
}
Quality Checks (QC)
Making sure all entities with "(concept)" in "also known as" are instances of concepts
This query returns all items with an "also known as" (`skos:altLabel`) value with the substring "(concept)" included in it, that are not instances of concepts. Ideally, all such items should be instances of concepts, and therefore 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 ?item ?itemLabel WHERE {
?x wdt:P136 ?item .
?item skos:altLabel ?itemAltLabel .
FILTER(CONTAINS(LCASE(STR(?itemAltLabel)), "(concept)")) .
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
}
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 that have an "instance of" statement pointing to them have a "subclass of" statement
This query returns all items what are included as the object of an "instance of" (P1) statement that do not themselves have a "subclass of" (P2) statement on them. 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:P1 ?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 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
}
Making sure all concepts have a source where the concept is mentioned or described
This query returns all items that are instances of concepts (Q16333) that do not have a "mentioned in source" (P240) or "described in source" (P82) statement.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT DISTINCT ?concept ?conceptLabel
WHERE
{
?concept wdt:P1 wd:Q16333 .
FILTER NOT EXISTS { ?concept wdt:P82|wdt:P240 [] } .
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 ?conceptLabel
Making sure all references have an instance-of statement
This query returns are entities included as references, ranked by number of mentions, wherein the entities referenced lack an "instance of" statement. Each reference should have an instance-of statement, telling the user what kind of reference it is (i.e. a book, a film, a journal article, etc.).
PREFIX pr: <https://lgbtdb.wikibase.cloud/prop/reference/>
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT ?reference ?referenceLabel ?count WHERE {
{
SELECT ?reference (COUNT(?reference) as ?count) WHERE {
?item ?prop [ prov:wasDerivedFrom [ pr:P21 ?reference ] ] .
FILTER NOT EXISTS { ?reference wdt:P1 ?sourceType }
}
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)
Making sure there are no duplicate DOIs
This query returns all items that contain the same DOI.
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT ?itemLabel ?doi
WHERE
{
?item wdt:P95 ?doi .
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 ?itemLabel ?doi HAVING (COUNT(?doi) > 1)
Check completeness of SSSOM mappings
This query returns references that map to the SSSOM (a Simple Standard for Sharing Ontology Mappings) and checks them for field completeness. Please note that this query is significant and may take some time to load. This can be utilized to assist in filling out mappings that aren't fully documented.
PREFIX pr: <https://lgbtdb.wikibase.cloud/prop/reference/>
PREFIX wd: <https://lgbtdb.wikibase.cloud/entity/>
PREFIX wdt: <https://lgbtdb.wikibase.cloud/prop/direct/>
SELECT DISTINCT
?item
?mappingSubject
?mappingPredicateLabel
?mappingObject
?mappingJustificationLabel
?mappingSubjectSourceLabel
?mappingSubjectSourceVersionLabel
?mappingObjectSourceLabel
?mappingObjectSourceVersionLabel
?statedInLabel
WHERE {
?item ?prop [
prov:wasDerivedFrom ?ref
] .
?ref pr:P615 ?mappingPredicate ;
pr:P278 ?mappingSubjectSource ;
pr:P279 ?mappingObjectSource ;
pr:P21 ?statedIn .
OPTIONAL { ?ref pr:P561 ?mappingSubject . }
OPTIONAL { ?ref pr:P562 ?mappingObject . }
OPTIONAL { ?ref pr:P558 ?mappingJustification . }
OPTIONAL { ?ref pr:P559 ?mappingSubjectSourceVersion . }
OPTIONAL { ?ref pr:P560 ?mappingObjectSourceVersion . }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
}
}
ORDER BY ASC(?mappingSubjectSourceLabel) ASC(?mappingObjectSourceLabel) ASC(?mappingPredicateLabel)