[READ-ONLY] Mirror of https://github.com/mrgnw/ananas. learn multiple languages at once ananas.xcc.es
0

Configure Feed

Select the types of activity you want to include in your feed.

ananas / scripts / languages.sql
1.7 kB 57 lines
1SELECT DISTINCT ?iso ?iso1 ?langLabel 2 (FLOOR(MAX(COALESCE(?nativeSpeakers_, 0)) / 1000) as ?nativeSpeakers_k) 3 (GROUP_CONCAT(DISTINCT ?writingSystemLabel; separator=", ") as ?writingSystems) 4 (GROUP_CONCAT(DISTINCT ?countryLabel; separator="|") as ?countries) 5 (MIN(STRAFTER(STR(?unescoStatus), "Q")) as ?unescoStatus) 6 (MIN(STRAFTER(STR(?ethnologueStatus), "Q")) as ?ethnologueStatus) 7 (GROUP_CONCAT(DISTINCT ?nativeName; separator=", ") as ?nativeNames) 8 (MAX(?isRTL) as ?rtl) 9WHERE { 10 # Core data 11 ?lang wdt:P220 ?iso ; 12 rdfs:label ?langLabel . 13 FILTER(LANG(?langLabel) = "en") 14 15 # ISO 639-1 code (optional) 16 OPTIONAL { ?lang wdt:P218 ?iso1 } 17 18 # Native speakers (optional) 19 OPTIONAL { ?lang wdt:P1098 ?nativeSpeakers_ } 20 21 # Optional data 22 OPTIONAL { 23 ?lang wdt:P282 ?writingSystem . 24 ?writingSystem rdfs:label ?writingSystemLabel . 25 FILTER(LANG(?writingSystemLabel) = "en") 26 } 27 OPTIONAL { 28 ?lang wdt:P17 ?country . 29 ?country rdfs:label ?countryLabel . 30 FILTER(LANG(?countryLabel) = "en") 31 } 32 33 # RTL detection based on writing system 34 OPTIONAL { 35 ?lang wdt:P282 ?writingSystem . 36 VALUES ?rtlSystem { 37 wd:Q8196 # Arabic script 38 wd:Q9288 # Hebrew alphabet 39 wd:Q28564 # Persian alphabet 40 wd:Q47577 # N'Ko script 41 wd:Q1137511 # Mandaic alphabet 42 wd:Q1137469 # Samaritan script 43 wd:Q1137466 # Syriac alphabet 44 } 45 BIND(IF(?writingSystem = ?rtlSystem, true, false) as ?isRTL) 46 } 47 48 # Status and names 49 OPTIONAL { ?lang wdt:P1999 ?unescoStatus } 50 OPTIONAL { ?lang wdt:P3823 ?ethnologueStatus } 51 OPTIONAL { ?lang wdt:P1705 ?nativeName } 52} 53GROUP BY ?iso ?iso1 ?langLabel 54 55ORDER BY DESC(MAX(COALESCE(?nativeSpeakers_, 0))) ?iso 56LIMIT 270 57