Wikidata:Request a query
Shortcuts: WD:RAQ, w.wiki/LX
Request a query This is a page where SPARQL queries [Q114898838] can be requested. Please provide feedback if a query is written for you. You can also request help to rewrite queries that don't work anymore, due to the WDQS graph split. For sample queries, see Examples and Help:Dataset sizing. Property talk pages include also summary queries for these. For help writing your own queries, or other questions about queries, see Wikidata talk:SPARQL query service/queries and Wikidata:SPARQL query service/query optimization. Help resources about Wikidata Query Service (Q20950365) and SPARQL: Wikidata:SPARQL query service/Wikidata Query Help and Category:SPARQL. To report an issue about the Query Service (interface, results views, export...) please see Wikidata:Contact the development team/Query Service and search. |
| On this page, old discussions are archived. An overview of all archives can be found at this page's archive index. The current archive is located at 2026/03. |
SpBot archives all sections tagged with {{Section resolved|1=~~~~}} after 2 days.
|
List of towns in Ireland, with "point in time" of population listed
[edit]Hi, I need to run a SPARQL query listing towns in the republic of Ireland (with their county shown) where the population is given and the point in time of that population data (ie the census year) is also shown. It is my intention to identify and correct fields where the population is not present, or displays pre-2022 data Dinos.bar.and.grill (talk) 16:13, 17 February 2026 (UTC)
- Try it!
SELECT distinct ?item ?label_en ?label_region ?date ?population WHERE { ?item wdt:P17 wd:Q27. # Ireland ?item wdt:P31/wdt:P279* wd:Q486972. # settlement ?item p:P1082 ?populationStatement . # Statement of population ?populationStatement ps:P1082 ?population . # Property Statement Value ?populationStatement pq:P585 ?date . # property qualifier optional {?item wdt:P131 ?region} #FILTER (YEAR(?date) >= 1850) # Begin #FILTER (YEAR(?date) <= 1870) # End #SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } ?item rdfs:label ?label_en. # Label abspeichern filter (lang(?label_en) = "en"). ?region rdfs:label ?label_region. filter (lang(?label_region) = "en"). } order by ?label_region ?item ?date
- @Dinos.bar.and.grill: Here is my query for you. If you get a timeout in Wikidata Query Service, then try the same query at qlever.dev. Best regards --sk (talk) 20:37, 18 February 2026 (UTC)
- thank you so much! Dinos.bar.and.grill (talk) 15:01, 26 February 2026 (UTC)
Items with articles in x Wikipedias but not English Wikipedia – timeout issue
[edit]Thanks to Paucabot there is this query to see 50 of these articles:
SELECT ?item ?itemLabel ?sitelinks WHERE {
?item wikibase:sitelinks ?sitelinks. hint:Prior hint:rangeSafe true.
FILTER(?sitelinks >= 55)
MINUS {
?article schema:isPartOf <https://en.wikipedia.org/>;
schema:about ?item.
}
MINUS { ?item wdt:P31/wdt:P279* wd:Q17442446. } # remove templates etc.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
}
ORDER BY DESC(?sitelinks)
LIMIT 50
It worked a few times, showing mostly pages that are not viable targets for translation or actual relative content gaps. However,
- how to see more than 50?
- even with 50 the query currently does not work anymore with Unknown error upstream request timeout – how to make it run through? Any tricks and workarounds would be welcome too such as running it in small batches and then combining the outputs in a code editor. Is there a way for example to get ListeriaBot permissions for a longer-running query (ultimately I'd like to put the adequately filtered results of it into a publicly findable and accessible table; e.g. it could be useful at m:Talk:OKA/Instructions for editors#Finding gap topics)
Prototyperspective (talk) 22:44, 1 March 2026 (UTC)
- @Prototyperspective I managed to get it running by removing the label service but to get more hits try using the QLever SPARQL Engine https://qlever.dev/wikidata/eNIY9M Piecesofuk (talk) 17:39, 2 March 2026 (UTC)
- Amazing, thanks! There really are just 11 articles and 1 portal with >= 50 sitelinks that are not months or templates not in ENWP it seems…interesting! Is there a way to make ListeriaBot use that or to readapt the query to WDQS so that listeriabot can use it? The query as is already is super useful already even without being on a page I think. One can change the minimum sitelinks and the language (e.g. requiring an article to exist in a specific language on can translate from) and then use it for all sorts of translation and redirect/article-creation work. Prototyperspective (talk) 19:11, 2 March 2026 (UTC)
Query to list properties and their counts
[edit]Hello. I'm trying to use this query:
#properties used on characters from Tolkien's universe
SELECT DISTINCT ?propertyItem ?propertyItemLabel (COUNT(DISTINCT ?item) AS ?itemcount) WHERE
{
?item wdt:P1080 wd:Q81738; wdt:P31/wdt:P279* wd:Q95074; ?propertyRel [].
?propertyItem wikibase:directClaim ?propertyRel
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?propertyItem ?propertyItemLabel
ORDER BY DESC(?itemcount)
It's meant to list all the properties used by Qs that are instances of (here) properties used on characters from Tolkien's universe, and how many times each property is used. For some reason it gives an "unknown error". I took the query from this list of queries. Could you help me? Thanks. --Fantastoria (talk) 11:21, 2 March 2026 (UTC)
- @Fantastoria The error usually means that the query is taking too long to run. I've rewritten it using a named subquery to extract the data first before generating the list
#properties used on characters from Tolkien's universe
SELECT DISTINCT ?propertyItem ?propertyItemLabel (COUNT(DISTINCT ?item) AS ?itemcount) WITH {
SELECT DISTINCT ?item WHERE {
?item wdt:P1080 wd:Q81738; wdt:P31/wdt:P279* wd:Q95074 .
} } AS %matches
WHERE {
INCLUDE %matches
?item wdt:P1080 wd:Q81738; wdt:P31/wdt:P279* wd:Q95074; ?propertyRel [].
?propertyItem wikibase:directClaim ?propertyRel
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?propertyItem ?propertyItemLabel
ORDER BY DESC(?itemcount)
Piecesofuk (talk) 17:10, 2 March 2026 (UTC)
- @Piecesofuk Thank you so much! --Fantastoria (talk) 10:29, 3 March 2026 (UTC)
English Wikipedia articles without short description that have a description in Wikidata
[edit]This is related to wish W515: Add short descriptions from Wikidata to Wikipedia articles without short description via bot/script (voting open; read that wish for further details)
ENWP articles with SD are in en:Category:Pages with short description but it seems those without short description don't have such a category and if they were one should be able to pull the articles from that category. So I don't know how that can be done if at all.
If there was such a query or page with these using a query (one could maybe use two different steps), then some tool could use that to eg display the short descriptions to enable quickly adding them to articles etc. Or is there such a tool already? Prototyperspective (talk) 15:37, 2 March 2026 (UTC)
Labels in specific language: species names in North Sámi (se)
[edit]Hi! I am a beginner in the Wikidata world, and I would love some help making a query to find item labels in a specific language. I am specifically looking to get a list of names of species (items with taxon rank (P105) species (Q7432)) in North Sámi (language code se).
I have written queries to find species with values for taxon common name (P1843) in North Sámi, see my query here: https://w.wiki/H$XK and some variants in my sandbox. However I would love to get a list of items with item labels and aliases, since species names are often written there.
I tried playing around with rdfs:label and FILTER, but only seemed to get upstream request timeout or Query timeout limit reached. Let me know if you can help out. Thanks! Flygekorren (talk) 21:01, 3 March 2026 (UTC)
- Try it!
SELECT ?item ?itemLabel ?commonname ?latname ?itemAltLabel WHERE { ?item wdt:P105 wd:Q7432. #?item wdt:P1939 ?dyntaxa. ?item wdt:P1843 ?commonname. FILTER (lang(?commonname)="se"). ?item wdt:P225 ?latname. #?item rdfs:label ?itemLabel. FILTER (lang(?itemLabel)="sv"). SERVICE wikibase:label { bd:serviceParam wikibase:language "sv,mul". } } limit 10
- @Flygekorren: Hello, I add "?itemAltLabel" to your query. Now you see this alternavie labels. Best regards --sk (talk) 11:37, 11 March 2026 (UTC)
A list of persons in Fanger.no
[edit]May I have a list of persons having Norwegian prisoner register person ID (P8269) with date of birth (P569) date of death (P570), Norwegian historical register of persons ID (P4574), country of citizenship (P27), residence (P551), place of detention (P2632), Geni.com profile ID (P2600) and part of (P361) . Also pinging @Ajarmund and @Jklamo for preliminary info Pmt (talk) 18:59, 4 March 2026 (UTC)
- Yes. Jklamo (talk) 14:23, 5 March 2026 (UTC)
- @Ajarmund and @JklamoObviusly someone has created an excellent query now. Its presented in this weeks Wikidata weekly summary 722 under
Did you know? - Query examples:Data about Norwegians in captivity during WWII (using Norwegian prisoner register person ID (P8269) + others (source) https://w.wiki/JGcj Thanks to whom it may concern! Pmt (talk) 21:53, 9 March 2026 (UTC)
- Nicely done! Very nice query, it clearly shows the remaining gaps. I'll try to enrich the dates and places of death from Fanger.no next weekend if I get some extra spare time --Ajarmund (talk) 18:54, 10 March 2026 (UTC)
Merge request - John Zeleznikow
[edit]Can these please be merged:
These are all the same man, see:
ps. I requested a merge about a month ago which seems to have been closed because I didn't respond to a follow up question. But I was not aware of the question because I was not pinged and, therefore, received no notification. Mmemaigret (talk) 11:29, 5 March 2026 (UTC)
Done, if You say so, Piastu (talk) 22:48, 10 March 2026 (UTC)
data scientist sample data
[edit]i want a sample data frames for learning data science ~2026-15353-04 (talk) 03:31, 11 March 2026 (UTC)
- @~2026-15353-04: Here are some topics from data science. --sk (talk) 11:19, 11 March 2026 (UTC)
Dharani Sutra du Cœur d’Avalokitesvara aux onze visages
[edit]Hello, Yesterday I created the article Dharani Sutra du Cœur d’Avalokitesvara aux onze visages on the French Wiki, which is a translation of the article Eleven-Faced Avalokitesvara Heart Dharani Sutra on the English Wiki.
I added it to the language field, but the addition wasn't registered. Why?
Thank you for your help. Ananda disciple (talk) 02:09, 12 March 2026 (UTC)
. Pourriez-vous écrire une requête qui liste toutes les enzymes (une sous-classe de protéines) dans Wikidata avec leurs sources et la date ?
[edit]. Pourriez-vous écrire une requête qui liste toutes les enzymes (une sous-classe de protéines) dans Wikidata avec leurs sources et la date ? ~2026-15675-24 (talk) 13:11, 12 March 2026 (UTC)

