Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DavidMoraisFerreira/bad2febaa44e0339fbd141cbee51ada1 to your computer and use it in GitHub Desktop.
Save DavidMoraisFerreira/bad2febaa44e0339fbd141cbee51ada1 to your computer and use it in GitHub Desktop.
Retrieves a list of first names and gender for Luxembourgish citizens on Wikidata
#For a list of family names, change SELECT and GROUP BY
PREFIX schema: <http://schema.org/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?givenNameLabel ?genderLabel #?familyNameLabel
WHERE
{
?human wdt:P31 wd:Q5 ;
wdt:P27 wd:Q32 .
?human wdt:P735 ?givenName .
#?human wdt:P734 ?familyName FILTER (!wikibase:isSomeValue(?familyName)).
?human wdt:P21 ?gender .
OPTIONAL {
?human schema:isPartOf <https://lb.wikipedia.org/> .
}
FILTER NOT EXISTS {
?human wdt:P97 ?nobility #Excludes nobility from the result set
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "lb,fr,de,en" }
} GROUP BY ?givenNameLabel ?genderLabel #?familyNameLabel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment