User:Geertivp/training/Wikidata Query/Missing label in target language
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.
- Copy the following text to https://query.wikidata.org and click on Execute query:
The following query uses these:
- Items: human (Q5) , Belgium (Q31)
- Properties: instance of (P31) , country of citizenship (P27) , occupation (P106) , field of work (P101)
# 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:
- You better do not use
FILTER(NOT EXISTS { ... } )
- FILTER(!(BOUND(?variable )))
- 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:Wikidata curricula/Activities/Pywikibot/Missing label in target language
- Special:PrefixIndex/User:Geertivp/training/Wikidata Query
- User:Geertivp/training/QuickStatements
- User:Geertivp/training/Wikidata Query/Missing description in target language
- Wikidata