User:Geertivp/training/Wikidata Query/Missing label in target language

From Wikidata
Jump to navigation Jump to search

Search for Labels from other languages that do not exist in the target language. The results can be input for QuickStatements 2 (Q29032512), see User:Geertivp/training/QuickStatements. This way you can semi-automatically create Labels (and the Description for the item) in any target language.

Example query

[edit]

English (Q1860) is the most used Western Wikipedia language, so you better have an item label ready. This way your data item will be translated by other users into other languages as well.

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, country of citizenship (P27)  View with Reasonator View with SQID, occupation (P106)  View with Reasonator View with SQID, field of work (P101)  View with Reasonator View with SQID
    # Search for Belgian citizen without EN label
    SELECT DISTINCT ?item ?nlitemLabel ?itemDescription ?instanceLabel ?nationalityLabel ?professionLabel ?domainLabel WHERE {
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,nl,fr,de,it,lu,es,no,pt". }
      VALUES ?instance { wd:Q5 }
      VALUES ?nationality { wd:Q31 }
      ?item wdt:P31 ?instance;
        wdt:P27 ?nationality;
        rdfs:label ?nlitemLabel.
      FILTER((LANG(?nlitemLabel)) = "nl")
      MINUS {
        ?item rdfs:label ?enitemLabel.
        FILTER((LANG(?enitemLabel)) = "en")
      }
      OPTIONAL { ?item wdt:P106 ?profession. }
      OPTIONAL { ?item wdt:P101 ?domain. }
    }
    ORDER BY (?nlitemLabel)
    

Notes:

  1. You better do not use FILTER(NOT EXISTS { ... } )
  2. FILTER(!(BOUND(?variable )))
  3. Instead use MINUS { ... }

The latter syntax only takes ½ of the elapsed time; the first query might fail with resources exceeded error...

Base results

[edit]
Column Description
item Q-number
itemLabel Label in source language
itemDescription Description in source language

Load file example

[edit]

Execute transactions via https://quickstatements.toolforge.org/ (short user guide included). First create the Labels:

Q16526046	Len	"Aaron Botterman"
...

and then afterwards the Description:

Q16526046	Den	"Belgian athlete"
...

Use cases

[edit]
  • Replicate any language labels to e.g. EN (which is the most used wikidata instance; it will trigger other people to create new statements)

Tips

[edit]
  • The structure of Labels and Descriptions are language dependent (please align with existing style; look at current examples)

Caveat

[edit]
  • Do not overwrite existing Descriptions (mostly if there is no Label there is no Description neither)

See also

[edit]
Wikidata