I have a shell script that uses Wikidata Query Service (WDQS) to get required data. The SPARQL query that run WDQS takes input parameter language code.
Is there a way that I can check in shell script if the input language code is a valid Wikimedia language code as the first column data in below link https://www.wikidata.org/wiki/Help:Wikimedia_language_codes/lists/all
These codes are possible values of
wdt:P424
. From the property proposal:You could retrieve all these codes using the following simple SPARQL query:
Try it!
In fact, the list you have linked to is periodically generated by a bot. The full query is:
You could:
ASK
SPARQL query at every user input.I would prefer the third option: