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/04.

I've just discovered that mi.wiki (a small wiki) has many items in wikidata which have zero statements. I know enough te Reo to be able to work out what most of these are talking about. How do I query for items with only a wiki sitelink miwiki (and no others) and no statements? Being able to find those with only one statement might be useful too. Stuartyeates (talk) 21:29, 11 April 2026 (UTC)Reply

SELECT ?sitelink ?item (COUNT (?statement) as ?statements) WHERE {
  
  ?sitelink schema:about ?item ;
            schema:isPartOf <https://mi.wikipedia.org/> .
  
  ?item ?p ?statement .
}
GROUP BY  ?sitelink ?item
ORDER BY   ASC(?statements)
LIMIT 100
Try it!

Does what I need. Stuartyeates (talk) 00:35, 12 April 2026 (UTC)Reply

bonjour Q4177390 et Q68570606 parlent tout deux de Michel Efimoff en fr et Mikhail Efimov dans cinq autre langues. Je n'ai pas trouvé d'autre solution pour les fusionner ? Il en est de même pour les categories sur commons Category:Mikhail Nikiforovich Efimov et Category:Michel Effimof. Sincèrement 20Nasium26 (talk) 08:43, 13 April 2026 (UTC)Reply

Pour une fusion voir Merge. Il semble qu'il y ait un problème parce que la catégorie sur Commons est en doublon également, ça peut se régler en supprimant une des deux infos sur la catégorie commons. J'ai fait le nécessaire arbitrairement, je vais voir sur commons sur quoi faire là bas pour fusionner les deux catégories, je sais pas quel est le nom recommandé. TomT0m / talk page 09:22, 13 April 2026 (UTC)Reply
PS: Pour référence j'ai posé la question sur le bistro francophone de commons pour la fusion des catégories : commons:Commons:Bistro#Fusion_catégorie,_quelle_procédure_et_quel_nom_garder_? TomT0m / talk page 09:27, 13 April 2026 (UTC)Reply
Problème réglé sur commons également, voir sujet au bistro francophone de commons pour plus d'infos. TomT0m / talk page 18:18, 13 April 2026 (UTC)Reply

I am trying to get a list of wikidata 'organisms known by a particular common name'(Q55983715), to be categorized into plants/animals/fungi semi-manually. I can start with a list of 100 or 200 words, but even if I try to run separate queries, I get pretty "dirty" lists. How can I get better results? ~2026-23373-58 (talk) 06:22, 16 April 2026 (UTC)Reply

Please, try this one:
SELECT ?item ?itemLabel ?kingdomLabel   WHERE { 
  # 1. Find instances of "organisms known by a particular common name"
  ?item wdt:P31 wd:Q55983715.
  # 2. Try to find a kingdom (Plant, Animal, or Fungus)
  # We look through common properties like P171 (parent taxon) or P31 (instance of) 
  # on the taxa associated with this name group.
  OPTIONAL {
    ?item (wdt:P1843|wdt:P1672|wdt:P225|wdt:P31/wdt:P279*) ?relatedTaxon.
    ?relatedTaxon wdt:P171* ?kingdom.
    
    VALUES ?kingdom { 
      wd:Q729  # Animalia
      wd:Q756  # Plantae
      wd:Q764  # Fungi
    }
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],it, en". }
}
order by DESC(?kingdomLabel)
Try it!

FabC (talk) 15:58, 16 April 2026 (UTC)Reply

I'm looking for a query that list the astronaut memberships of a crew. Here my basic (not fully correct) query for Paolo Nespoli (Q17177):

# Space mission memberships of the astronaut Paolo Nespoli
SELECT ?mission ?missionLabel ?startLabel
WHERE
{
  wd:Q17177 wdt:P450 ?mission.  # Paolo Nespoli's s missions
      
  ?mission wdt:P619|wdt:P580 ?start   # Vehicles crew launch date OR begin of a mission crew (e.g. Expedition for ISS)
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } # l'etichetta verrà preferibilmente nella tua lingua, e altrimenti in inglese
}
ORDER BY (?startLabel)
Try it!

The list of missions is correct but Paolo Nespoli (Q17177) joined Expedition 26 (Q17219) not at its start time (P580) but LATER. The date can be either retrieved in the item as start time (P580) qualifier of the mission member of the crew of (P5096) or in the item of the mission. FabC (talk) 15:31, 16 April 2026 (UTC)Reply

I would like to programmatically get the wikidata entity ID and a few other properties for cities I have in my data catalog. I want to query from the client. In the Query Builder, all of the label properties I can see are limited support and can't be used for this purpose. If this isn't possible, could I please have some help understanding why? Thanks! ~2026-23581-22 (talk) 17:36, 16 April 2026 (UTC)Reply

first approximation is here (replace "Романів" with desired name):
SELECT * {
  {
    SELECT * {
      ?item wdt:P1448 "Романів"@uk .
    } LIMIT 100
  }
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,ru" .
    ?item rdfs:label ?label . ?item schema:description ?description
  }
}
Try it!
Infovarius (talk) 19:21, 16 April 2026 (UTC)Reply
Thanks! If I use Paris for this, though, I only get places in the US. Also, how is this constrained to cities? Don't other schema have official names (wdt:P1448)? ~2026-23581-22 (talk) 06:52, 17 April 2026 (UTC)Reply
Here's what I've come up with:
SELECT DISTINCT ?city ?cityLabel ?cityDescription ?population WHERE {
?city (wdt:P31/(wdt:P279*)) wd:Q515;
rdfs:label "Paris"@en.
OPTIONAL { ?city wdt:P1082 ?population. }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?city rdfs:label ?cityLabel;
schema:description ?cityDescription.
}
}
ORDER BY DESC (COALESCE(?population, 0 )) ~2026-23581-22 (talk) 07:29, 17 April 2026 (UTC)Reply

i have this working, but it bring paris back a ton of times :/

SELECT DISTINCT ?item ?name
  WHERE
  {
   ?item wdt:P31 wd:Q200250 ;
      rdfs:label ?name
   FILTER CONTAINS(?name, "Paris")
  }
  LIMIT 50
Try it!
You get a row for each language of the city name:
SELECT DISTINCT ?item ?name (lang(?name) as ?name_lang)
 WHERE 
 {
  ?item wdt:P31 wd:Q200250 ;
     rdfs:label ?name
  FILTER CONTAINS(?name, "Paris")
 }
 LIMIT 50
Try it!
Try this:
SELECT DISTINCT ?item ?itemLabel ?countryLabel ?LocationLabel WHERE {
  VALUES ?myCatalog {
    "Paris"@en
    "Livorno"@it
    "Milan"@en
  }
  
  # Search for items that have such label
  ?item rdfs:label ?myCatalog.
  
  # Filter for instances of cities
  ?item wdt:P31/wdt:P279* wd:Q515.

  # Get a few properties
  ?item wdt:P17 ?country.
  ?item wdt:P131 ?Location.
  
  # Opzionale: Recupera la descrizione per distinguere i risultati
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ?countryLabel ?itemLabel
Try it!

Hello! I have the following query that looks for works written by Bernard and/or Mary Berenson, including articles, reviews, books, etc. There should be 102 results. However, it's not working anymore as expected because three of the articles got split off into the scholarly articles graph. Can someone help me combine the results? Or, tell me if I should request that those three articles move back to main? And of course, if I could write this query better, happy to have suggestions :)

Main graph query

SELECT DISTINCT ?item ?itemLabel ?authorname (YEAR(?date) as ?year)?berenson ?berensonLabel 
WHERE {
  ?item p:P50 ?statementberenson.
  ?statementberenson ps:P50 ?berenson.
  VALUES ?berenson {wd:Q359047 wd:Q6779039}.
  OPTIONAL {?statementberenson pq:P1932 ?authorname}.
  ?item wdt:P577 ?date.
  #?item wdt:P31 ?type.
  FILTER (YEAR(?date) >= 1890 && YEAR(?date) <= 1903)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Try it!

The same query returns the three missing articles in the scholarly articles graph:

SELECT ?item ?itemLabel ?authorname (YEAR(?date) as ?year)?berenson ?berensonLabel
WHERE {
  #?item wdt:P50 wd:Q359047.
  ?item p:P50 ?statementberenson.
   ?statementberenson ps:P50 ?berenson.
  VALUES ?berenson {wd:Q359047 wd:Q6779039}.
  OPTIONAL {?statementberenson pq:P1932 ?authorname}.
  ?item wdt:P577 ?date.
  #?item wdt:P31 ?type.
  FILTER (YEAR(?date) >= 1890 && YEAR(?date) <= 1903)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Try it!

Aap1890 (talk) 18:26, 16 April 2026 (UTC)Reply

Hi, I'm trying to do a query looking for every publications (book, report, scholarly article, etc.) with on focus list of Wikimedia project (P5008) = WikiProject Temples in Roman Britain (Q133504605). It is my first time trying to query bibliographic data since the splitgraph, so I'm unsure what do you with federated queries. I feel like I almost got it with the query below, but it doesn' give me the item label nor its type of publication for the scholarly graph. Any help is more than welcome!

SELECT ?item ?itemLabel ?classLabel ?authorLabel WHERE {
  {
    ?item wdt:P5008 wd:Q133504605.
    ?item wdt:P31 ?class.
    ?class wdt:P279 wd:Q732577.
    OPTIONAL { ?item wdt:P50 ?author. }
  }
  UNION
  {
    SERVICE wdsubgraph:scholarly_articles {
      SELECT ?item ?itemLabel ?classLabel ?authorLabel WHERE {
      ?item wdt:P5008 wd:Q133504605.
      ?item wdt:P31 ?class.
      OPTIONAL { ?item wdt:P50 ?author. }
        }
    }
  }

  SERVICE wikibase:label { 
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". 
  }
  OPTIONAL { ?item rdfs:label ?itemLabel FILTER (LANG(?itemLabel) = "mul") }
}

}
Try it!

Liber008 (talk) 11:24, 17 April 2026 (UTC)Reply

For some people like Leonhard Schnetzler (Q109886580) there are several birthdates present. Sometimes one of them is only a year and there are more precise dates. So for example if there is "2026-04-18" and "2026" I only want "2026-04-18". One possibility could be, to give the less precise dates a deprecated rank, then I must always check this for new datasets in my query.

Here is my use case, where I need to eliminate such "redundant" dates for "gebText", but especially for the earliest and latest date. For Wolfgang Müller (Q110082746) I need "03.07.1897, 12.07.1897" as "gebText", "1897-07-03T00:00:00Z" as "gebBegin" and "1897-07-12T00:00:00Z" as "gebEnd".

I appreciate any help!

SELECT DISTINCT ?item ?name (GROUP_CONCAT(DISTINCT ?gebDatTxt; separator=", ") AS ?gebTxt) (STR(MIN(?gebMin)) AS ?gebBegin) (STR(MAX(?gebMax)) AS ?gebEnd)WHERE {
  VALUES ?item { wd:Q96301098 wd:Q96318837 wd:Q104464635 wd:Q109886580 wd:Q1697313 wd:Q23060375 wd:Q58456077 wd:Q125449 wd:Q55456365 wd:Q110082746}.
  
  #geb
  OPTIONAL{
    SELECT DISTINCT ?item ?gebDatTxt ?gebRaw ?gebMin ?gebMax WHERE {
      ?item p:P569 ?stmt .
        ?stmt ps:P569 ?gebRaw ;
          psv:P569 [wikibase:timePrecision ?precision] ;
          wikibase:rank ?rank .

      FILTER(?rank != wikibase:DeprecatedRank)

      OPTIONAL {
        ?stmt pq:P1480 ?nachweisNode .
        ?nachweisNode rdfs:label ?nachweis .
        FILTER(LANG(?nachweis) = "de")
      }
      
      #convert for display
      BIND(
        IF(?precision = 11, CONCAT(SUBSTR(STR(?gebRaw), 9, 2), ".", SUBSTR(STR(?gebRaw), 6, 2), ".", SUBSTR(STR(?gebRaw), 1, 4)), # TT.MM.JJJJ
        IF(?precision = 10, CONCAT(SUBSTR(STR(?gebRaw), 6, 2), ".", SUBSTR(STR(?gebRaw), 1, 4)), # MM.JJJJ
        IF(?precision = 9, SUBSTR(STR(?gebRaw), 1, 4), # JJJJ
        IF(?precision = 8, CONCAT(SUBSTR(STR(?gebRaw), 1, 3), "0er-Jahre"), # Jahrzehnt
        IF(?precision = 7, CONCAT(STR(xsd:integer(SUBSTR(STR(?gebRaw), 1, 2)) + 1), ". Jahrhundert"), # Jahrhundert
        "unbekannt"))))) AS ?gebDat).
      
      #add prefix
      BIND(
        IF(BOUND(?nachweis),
          CONCAT(
            IF(STR(?nachweis)="circa","um",
            IF(STR(?nachweis)="zweifelhaft","vielleicht", ?nachweis)),
          " ", ?gebDat),
          ?gebDat
        )
        AS ?gebDatTxt
      )
      
      #earliest date
      BIND(
        IF(?precision = 7,  STRDT(CONCAT(SUBSTR(STR(?gebRaw),1,2), "01-01-01T00:00:00Z"), xsd:dateTime), # Jahrhundert
        ?gebRaw) AS ?gebMin).
      
      #latest date
      BIND(
        IF(?precision = 10, STRDT(STR(xsd:dateTime(?gebRaw) + "P1M"^^xsd:duration - "P1D"^^xsd:duration), xsd:dateTime), # MM.JJJJ
        IF(?precision = 9,  STRDT(STR(xsd:dateTime(?gebRaw) + "P1Y"^^xsd:duration - "P1D"^^xsd:duration), xsd:dateTime), # JJJJ
        IF(?precision = 8,  STRDT(STR(xsd:dateTime(?gebRaw) + "P10Y"^^xsd:duration - "P1D"^^xsd:duration), xsd:dateTime), # Jahrzehnt
        IF(?precision = 7,  STRDT(STR(xsd:dateTime(STRDT(CONCAT(SUBSTR(STR(?gebRaw),1,2), "01-01-01T00:00:00Z"), xsd:dateTime)) + "P100Y"^^xsd:duration - "P1D"^^xsd:duration), xsd:dateTime), # Jahrhundert
        ?gebRaw)))) AS ?gebMax).
      
    }
    ORDER BY ?gebMin
    }
 
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],de,en".
    ?item rdfs:label ?name.
  }
}
GROUP BY ?item ?name
Try it!

Rerumscriptor (talk) 16:27, 18 April 2026 (UTC)Reply

Hello, how to query this property with normalized values in, say, meters ? Thanks Bouzinac💬✒️💛 10:52, 20 April 2026 (UTC)Reply

How to change this query so it works with Wikidata query service and then ListeriaBot?:

https://qlever.dev/wikidata/GDr9DK

It's for Wikidata:List of films and series made in the EU (may need renaming). There's a popular new site about the subject and it lacked data so I made this query. Additionally, grouping the items so that countries are in one column may be a good idea but then it seems like it's not possible to filter / sort the table by a specific country (an idea would be to enable columns to be filterable with selectable values based on the column contents). Moreover, it may be needed to either split this up by decade or only show films and series newer than say 1990. A general question: is there a search function on qlever – there is one in Wikidata query service but I could not find one there. Prototyperspective (talk) 13:43, 21 April 2026 (UTC)Reply

Could somebody help with fixing the query for Wikidata:List of unverified oldest humans so that the column of Achhsv Manatha (Q130323390) doesn't display so many values? Prototyperspective (talk) 14:45, 23 April 2026 (UTC)Reply

to remove all unsourced dates? Infovarius (talk) 16:22, 24 April 2026 (UTC)Reply
I've reverted seemly vandal edits. Infovarius (talk) 16:28, 24 April 2026 (UTC)Reply

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