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/10. |
On this page all sections tagged with {{Section resolved|1=~~~~}} after 2 days are automatically archived.
|
Wikimedia disambiguation pages with no label in English
Hello, I am trying to find a list of items with instance of (P31) of Wikimedia disambiguation page (Q4167410), which have no label in English. Thank you! Beleg Tâl (talk) 13:10, 24 April 2026 (UTC)
- I think this does the job, it will include "mul" labels though which are often (but not always) added as English.
SELECT ?item
WHERE {
?item wdt:P31 wd:Q4167410 ;
FILTER NOT EXISTS {
?item rdfs:label ?label .
FILTER(LANG(?label) = "en")
}
}
LIMIT 1000
Danny Benjafield (WMDE) (talk) 14:07, 24 April 2026 (UTC)
Abreviaturas
No manejo el glosario de abreviaturas que usais Ñankul (talk) 08:02, 3 May 2026 (UTC)
number of wikipedia sitelinks on Template:GPLv2 or later
Template:GPLv2 or later has 36 wikipedia sitelinks. i want to query various other templates also. can you please provide code. i dont want wikipedia sitelinks links. the query should result should just say 36 links. কল্কি (talk) 07:33, 9 May 2026 (UTC)
- Here you go:
- Try it!
SELECT (COUNT(?sitelink) AS ?count) WHERE { ?sitelink schema:about wd:Q6809928. FILTER(REGEX(STR(?sitelink), "^https://[^.]+\\.wikipedia\\.org/")) }
- --Yirba (talk) 09:25, 9 May 2026 (UTC)
- You can also use
?sitelink schema:isPartOf/wikibase:wikiGroup "wikipedia" .in place of the above filter. Infrastruktur (talk) 18:42, 9 May 2026 (UTC)
Finding items based on a url
I am trying to query items based on a website url.
SELECT ?item ?itemLabel ?prop ?propLabel WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
?prop wdt:P31 wd:Q84764641. # Wikidata property related to websites
?prop wikibase:propertyType wikibase:Url. # only url properties…
MINUS {
?prop wdt:P8966 ?pattern. # that don't have a match pattern.
}
?prop wikibase:directClaim ?propDirect.
VALUES ?url {
}
?item ?propDirect ?url.
# should find https://www.wikidata.org/wiki/Q2013#P856
}
Why does it not find anything, and why does it take ages to do so? –Shisma (talk) 17:43, 9 May 2026 (UTC)
Getting 'Subject named as' qualifier
I'm trying to map Library of congress occupations (which are a subset of LC Subject Headings) to wikidata. I have a query below, which works except I cna't work out how to get the subject named as (P1810) qualified on the Library of Congress Authorities ID (P244). Stuartyeates (talk) 21:13, 15 May 2026 (UTC)
#title: List of occupations, with all labels and lccn
SELECT DISTINCT ?occ ?occLabel ?occDescription ?occAltLabel ?lcsh {
VALUES ?units {wd:Q12737077 wd:Q55984204 wd:Q184872} .
?occ wdt:P31 ?units .
?occ wdt:P244 ?lcsh .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
}
Could I get a little help please? Stuartyeates (talk) 21:13, 15 May 2026 (UTC)
Seems like the answer is:
#title: List of occupations, with all labels and lccn
SELECT DISTINCT ?occ ?lcsh ?namedAs {
?occ wdt:P31 wd:Q12737077 .
?occ p:P244 ?statement .
?statement ps:P244 ?lcsh.
OPTIONAL { ?statement pq:P1810 ?namedAs.}
}
