Shortcuts: WD:RAQ, w.wiki/LX

Wikidata:Request a query

From Wikidata
Jump to navigation Jump to search

Request a query
Fishing in the Wikidata river requires both an idea where to look for fish and a suitable fishing method. If you have the former, this page can help you find the latter.

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 2024/08.

All items of video games that don't have articles on the Hebrew Wikipedia

[edit]

I tried to create the code by myself but haven't succeeded so far. WikiJunkie (talk) 20:41, 6 August 2024 (UTC)[reply]

@WikiJunkie: here is a simple query for that :
SELECT ?q WHERE {
  ?q wdt:P31/wdt:P279* wd:Q7889 .
  MINUS { ?page schema:about ?q ; schema:isPartOf <https://he.wikipedia.org/> }
}
Try it!
There is 113374 results, you probably want to filter them.
Cheers, VIGNERON (talk) 16:49, 11 August 2024 (UTC)[reply]

Query timeout

[edit]

My Sandbox stopped working with the following error message: any hint?

The following SPARQL query timed out or returned no result:

SELECT ?grouping (SAMPLE(?_higher_grouping) as ?higher_grouping) (COUNT(DISTINCT ?entity) as ?count) WHERE {
  ?entity wdt:P31 wd:Q3305213; wdt:P195 ?collection. ?collection wdt:P17 wd:Q1284 .
  ?entity wdt:P195 ?grouping .
  OPTIONAL { ?grouping wdt:P17/wdt:P298 ?_higher_grouping }.
} GROUP BY ?grouping ?higher_grouping
HAVING (?count >= 6)
ORDER BY DESC(?count)
LIMIT 1000 Pietro (talk) 12:53, 7 August 2024 (UTC)[reply]
SELECT ?grouping (SAMPLE(?_higher_grouping) as ?higher_grouping) (COUNT(DISTINCT ?entity) as ?count) WHERE {
  ?entity wdt:P31 wd:Q3305213; wdt:P195 ?collection. ?collection wdt:P131* wd:Q1284 .
#   ?collection wdt:P17 wd:Q1284 .  # This gives zero results: region instead of country
  ?entity wdt:P195 ?grouping .
  OPTIONAL { ?grouping wdt:P17/wdt:P298 ?_higher_grouping }.
} GROUP BY ?grouping ?higher_grouping
HAVING (?count >= 6)
ORDER BY DESC(?count)
LIMIT 1000
Try it!
Flipping Switches (talk) 19:06, 7 August 2024 (UTC)[reply]
Thanks! Pietro (talk) 08:14, 8 August 2024 (UTC)[reply]

Searching for items that exist on multiple editions of Wikipedia

[edit]

I am searching for instance/sub-classes of LGBT+ identity (Q115870510) that have 3 or more non-English Wikipedia site-links. I attempted a query here, however it times-out. I will commit to improving documentation so that it is easier for others trying similar queries https://w.wiki/AszG

SELECT ?item ?itemLabel ?linkcount WHERE {  
?item wdt:P31/wdt:P279* wd:Q115870510 .
?item wikibase:sitelinks ?linkcount .

  FILTER (?linkcount >= 10) . 
  FILTER NOT EXISTS {
    ?article schema:about ?item 
    ?article schema:inLanguage "en" .
    ?article schema:isPartOf <https://en.wikipedia.org/>
  }
 
SERVICE wikibase:label { bd:serviceParam wikibase:language " 
 [AUTO_LANGUAGE],en". }
}

ORDER BY DESC(?linkcount)
Try it!

Shushugah (talk) 11:19, 10 August 2024 (UTC)[reply]

SELECT ?item ?itemLabel ?linkcount WHERE {
  # instance of LGBT  
  ?item wdt:P31/wdt:P279* wd:Q115870510 ;
        wikibase:sitelinks ?linkcount .
  FILTER(?linkcount > 2)
  MINUS {
    ?article schema:about ?item ;
             schema:isPartOf <https://en.wikipedia.org/>
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
}
ORDER BY DESC(?linkcount)
Try it!
Flipping Switches (talk) 13:34, 10 August 2024 (UTC)[reply]
Each FILTER and MINUS alone gives results, but they don't intersect. Flipping Switches (talk) 09:00, 17 August 2024 (UTC)[reply]

Lexemes with mismatching reading patterns

[edit]

I need a list of lexemes that have forms with diverging values for sinogram reading pattern (P5244) in order to find lexemes that should be split. Thank you 🙏 – Shisma (talk) 07:48, 14 August 2024 (UTC)[reply]

List of countries and regions which were at the 2024 Olympics, by population

[edit]

Hi all. Is there any way we can generate a list of those regions and nations which took part in this year's Olympic games, or a list of those which have a National Olympic Committee (Q183288)? Listed by population, please. Cheers! Llywelyn2000 (talk) 09:49, 15 August 2024 (UTC)[reply]