[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 55 lines
1SELECT DISTINCT ?iso ?iso1 ?langLabel 2 (FLOOR(MAX(?nativeSpeakers_) / 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 wdt:P1098 ?nativeSpeakers_ ; 13 rdfs:label ?langLabel . 14 FILTER(LANG(?langLabel) = "en") 15 FILTER(?nativeSpeakers_ >= 1000000) 16 17 # ISO 639-1 code (optional) 18 OPTIONAL { ?lang wdt:P218 ?iso1 } 19 20 # Optional data 21 OPTIONAL { 22 ?lang wdt:P282 ?writingSystem . 23 ?writingSystem rdfs:label ?writingSystemLabel . 24 FILTER(LANG(?writingSystemLabel) = "en") 25 } 26 OPTIONAL { 27 ?lang wdt:P17 ?country . 28 ?country rdfs:label ?countryLabel . 29 FILTER(LANG(?countryLabel) = "en") 30 } 31 32 # RTL detection based on writing system 33 OPTIONAL { 34 ?lang wdt:P282 ?writingSystem . 35 VALUES ?rtlSystem { 36 wd:Q8196 # Arabic script 37 wd:Q9288 # Hebrew alphabet 38 wd:Q28564 # Persian alphabet 39 wd:Q47577 # N'Ko script 40 wd:Q1137511 # Mandaic alphabet 41 wd:Q1137469 # Samaritan script 42 wd:Q1137466 # Syriac alphabet 43 } 44 BIND(IF(?writingSystem = ?rtlSystem, true, false) as ?isRTL) 45 } 46 47 # Status and names 48 OPTIONAL { ?lang wdt:P1999 ?unescoStatus } 49 OPTIONAL { ?lang wdt:P3823 ?ethnologueStatus } 50 OPTIONAL { ?lang wdt:P1705 ?nativeName } 51} 52GROUP BY ?iso ?iso1 ?langLabel 53HAVING(MAX(?nativeSpeakers_) >= 1000000) 54ORDER BY DESC(MAX(?nativeSpeakers_)) ?iso 55LIMIT 200