Tweetegy On the edge of chaos with Blockchain, Dapps, DeFi, JavaScript

| About | Search | Archive | Github | RSS |

How to get a semantic list of all spoken languages in the world

First stop, grab and parse the list from here: http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes.

Getting language meta data by url dereferencing

This is the easiest method but has less control over the data that is returned (by default all data about the language is returned). Simply replace the [language_name] part of the following url with the value in “Language Name” (NOTE: it is case sensitive so the Language Name must be in capital case):

http://dbpedia.org/resource/[Language_Name]_language.json

So for Aramaic the url would be:

http://dbpedia.org/data/Aramaic_language.json

For Khmer the url would be:

http://dbpedia.org/data/Khmer_language.json

Getting a subset of data

Let’s say we want a little more control and therefore need only a subset of the data available. In this case we can turn to the SPARQL endpoint available at http://dbpedia.org/sparql. Copy and paste the following example to get name, abstract, depiction, comment and label data for English Language:

PREFIX dbprop: <http://dbpedia.org/property/>
PREFIX dbowl: <http://dbpedia.org/ontology/>
PREFIX dbpedia: <http://dbpedia.org/ontology/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?uri ?name ?label ?thumbnail ?depiction ?abstract ?comment
WHERE {
	?uri dbprop:name "English"@en;
	rdf:type dbpedia-owl:Language;
	dbprop:name ?name;
	foaf:depiction ?depiction;
	dbowl:thumbnail ?thumbnail;
	dbowl:abstract ?abstract;
	rdfs:comment ?comment;
	rdfs:label ?label .
	filter (lang(?label) = "en" )
	filter (lang(?abstract) = "en" )
	filter (lang(?comment) = "en" )
}

Simply change ?uri dbprop:name "English"@en; to the (English) name of the language that you want to search for e.g. ?uri dbprop:name "French"@en; will return the dbpedia data fields related to the French Language.

Resources