Jump to content

Wikidata:Request a query

Add topic
Shortcuts: WD:RAQ, w.wiki/LX
From Wikidata


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)Reply

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
Try it!

Danny Benjafield (WMDE) (talk) 14:07, 24 April 2026 (UTC)Reply

Abreviaturas

No manejo el glosario de abreviaturas que usais Ñankul (talk) 08:02, 3 May 2026 (UTC)Reply

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)Reply

Here you go:
SELECT (COUNT(?sitelink) AS ?count) WHERE {
  ?sitelink schema:about wd:Q6809928.
  FILTER(REGEX(STR(?sitelink), "^https://[^.]+\\.wikipedia\\.org/"))
}
Try it!
--Yirba (talk) 09:25, 9 May 2026 (UTC)Reply
You can also use ?sitelink schema:isPartOf/wikibase:wikiGroup "wikipedia" . in place of the above filter. Infrastruktur (talk) 18:42, 9 May 2026 (UTC)Reply

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
}
Try it!

Why does it not find anything, and why does it take ages to do so? –Shisma (talk) 17:43, 9 May 2026 (UTC)Reply

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)Reply

#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]". }
}
List of occupations, with all labels and lccn

Could I get a little help please? Stuartyeates (talk) 21:13, 15 May 2026 (UTC)Reply

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.}
}
List of occupations, with all labels and lccn