MediaWiki

Difference between revisions of "SandboxData.js"

m
(Replaced content with " /* ************** SELECT ?item ?itemLabel WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } ?item prop:P2 entity:Q5 } ******...")
Tag: Replaced
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
  
 
/* **************
 
/* **************
SELECT ?languageLabel ?wikidata ?iso ?malesCount ?malesRecords ?femalesCount ?femalesRecords
+
SELECT ?item ?itemLabel WHERE {
    (ROUND(1000*?femalesRecords/(?femalesRecords+?malesRecords))/10 AS ?percent)
+
SERVICE wikibase:label {
WITH {
+
  bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
  SELECT ?language ?languageLabel ?wikidata ?iso {
+
}  
      ?record prop:P2 entity:Q2 .    # Filter: P2 'instance of' is Q2 'record'
+
?item prop:P2 entity:Q5
      ?record prop:P4 ?language .    # Assign value: P4 'language' into ?language
+
}  
      ?language prop:P12 ?wikidata .  # Assign value: P12 'wikidata id' into ?wikidata
 
      OPTIONAL { ?language prop:P13 ?iso . } # Assign value: P13 'iso639-3' into ?iso
 
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
 
}
 
GROUP BY ?language ?languageLabel ?wikidata ?iso
 
} AS %base
 
WITH {
 
  SELECT ?language ?languageLabel ?iso ?genderLabel
 
    (COUNT(DISTINCT ?females) AS ?femalesCount)
 
    (COUNT(DISTINCT ?record) AS ?femalesRecords) {
 
  INCLUDE %base
 
  ?record prop:P4 ?language ; # Filter
 
          prop:P5 ?females . # Assign value: P5 'speaker' into ?females
 
  ?females prop:P8 entity:Q17 ;  # Filter
 
          prop:P8 ?gender . # Assign value: P8 'gender' into ?gender
 
    } GROUP BY ?language ?languageLabel ?iso ?genderLabel
 
} AS %females
 
 
 
WITH {
 
  SELECT ?language ?languageLabel ?iso ?genderLabel
 
    (COUNT(DISTINCT ?males) AS ?malesCount)
 
    (COUNT(DISTINCT ?record) AS ?malesRecords) {
 
  INCLUDE %base
 
  ?record prop:P4 ?language ;
 
          prop:P5 ?males . # Assign value: P5 'speaker' into variable ?speakerQid
 
  ?males prop:P8 entity:Q16 ;
 
          prop:P8 ?gender .
 
    } GROUP BY ?language ?languageLabel ?iso ?genderLabel
 
} AS %males
 
{
 
  INCLUDE %base
 
  INCLUDE %females
 
  INCLUDE %males
 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
 
}
 
GROUP BY ?languageLabel ?wikidata ?iso ?malesCount ?malesRecords ?femalesCount ?femalesRecords
 
ORDER BY ASC(?languageLabel )
 
 
************** */
 
************** */
 
[
 
[
 
   {
 
   {
     "languageLabel": "Algerian Arabic",
+
     "item": "https://lingualibre.org/entity/Q12",
    "wikidata": "Q56499",
+
     "itemLabel": "beginner"
     "iso": "arq",
 
    "malesCount": "2",
 
    "malesRecords": "234",
 
    "femalesCount": "2",
 
    "femalesRecords": "5",
 
    "percent": "2.1"
 
 
   },
 
   },
 
   {
 
   {
     "languageLabel": "Amharic",
+
     "item": "https://lingualibre.org/entity/Q13",
    "wikidata": "Q28244",
+
     "itemLabel": "average level"
     "iso": "amh",
 
    "malesCount": "1",
 
    "malesRecords": "8",
 
    "femalesCount": "1",
 
    "femalesRecords": "209",
 
    "percent": "96.3"
 
 
   },
 
   },
 
   {
 
   {
     "languageLabel": "Arabic",
+
     "item": "https://lingualibre.org/entity/Q14",
    "wikidata": "Q13955",
+
     "itemLabel": "good level"
     "iso": "ara",
 
    "malesCount": "12",
 
    "malesRecords": "5627",
 
    "femalesCount": "2",
 
    "femalesRecords": "9",
 
    "percent": "0.2"
 
 
   },
 
   },
 
   {
 
   {
     "languageLabel": "Atikamekw",
+
     "item": "https://lingualibre.org/entity/Q15",
    "wikidata": "Q56590",
+
     "itemLabel": "native"
    "iso": "atj",
 
    "malesCount": "1",
 
    "malesRecords": "43",
 
    "femalesCount": "1",
 
    "femalesRecords": "432",
 
    "percent": "90.9"
 
  },
 
  {
 
    "languageLabel": "Balinese",
 
    "wikidata": "Q33070",
 
    "iso": "ban",
 
    "malesCount": "1",
 
    "malesRecords": "196",
 
    "femalesCount": "1",
 
    "femalesRecords": "302",
 
    "percent": "60.6"
 
  },
 
  {
 
    "languageLabel": "Baoulé",
 
    "wikidata": "Q35107",
 
    "iso": "bci",
 
    "malesCount": "4",
 
    "malesRecords": "60",
 
    "femalesCount": "3",
 
    "femalesRecords": "33",
 
    "percent": "35.5"
 
  },
 
  {
 
    "languageLabel": "Basque",
 
    "wikidata": "Q8752",
 
    "iso": "eus",
 
    "malesCount": "4",
 
    "malesRecords": "2729",
 
    "femalesCount": "3",
 
    "femalesRecords": "330",
 
    "percent": "10.8"
 
  },
 
  {
 
    "languageLabel": "Bikol languages",
 
    "wikidata": "Q35455",
 
    "iso": "bik",
 
    "malesCount": "2",
 
    "malesRecords": "423",
 
    "femalesCount": "1",
 
    "femalesRecords": "1",
 
    "percent": "0.2"
 
  },
 
  {
 
    "languageLabel": "Cantonese",
 
    "wikidata": "Q9186",
 
    "iso": "yue",
 
    "malesCount": "2",
 
    "malesRecords": "298",
 
    "femalesCount": "1",
 
    "femalesRecords": "5393",
 
    "percent": "94.8"
 
  },
 
  {
 
    "languageLabel": "Central Bikol",
 
    "wikidata": "Q33284",
 
    "iso": "bcl",
 
    "malesCount": "3",
 
    "malesRecords": "17",
 
    "femalesCount": "1",
 
    "femalesRecords": "74",
 
    "percent": "81.3"
 
  },
 
  {
 
    "languageLabel": "Chinese writing",
 
    "wikidata": "Q7850",
 
    "iso": "zho",
 
    "malesCount": "1",
 
    "malesRecords": "3",
 
    "femalesCount": "4",
 
    "femalesRecords": "184",
 
    "percent": "98.4"
 
  },
 
  {
 
    "languageLabel": "Cornish",
 
    "wikidata": "Q25289",
 
    "iso": "cor",
 
    "malesCount": "1",
 
    "malesRecords": "9",
 
    "femalesCount": "1",
 
    "femalesRecords": "139",
 
    "percent": "93.9"
 
  },
 
  {
 
    "languageLabel": "Dioula language",
 
    "wikidata": "Q32706",
 
    "iso": "dyu",
 
    "malesCount": "2",
 
    "malesRecords": "47",
 
    "femalesCount": "1",
 
    "femalesRecords": "16",
 
    "percent": "25.4"
 
  },
 
  {
 
    "languageLabel": "English",
 
    "wikidata": "Q1860",
 
    "iso": "eng",
 
    "malesCount": "41",
 
    "malesRecords": "17575",
 
    "femalesCount": "10",
 
    "femalesRecords": "1699",
 
    "percent": "8.8"
 
  },
 
  {
 
    "languageLabel": "Finnish",
 
    "wikidata": "Q1412",
 
    "iso": "fin",
 
    "malesCount": "2",
 
    "malesRecords": "1126",
 
    "femalesCount": "2",
 
    "femalesRecords": "48",
 
    "percent": "4.1"
 
  },
 
  {
 
    "languageLabel": "Fon",
 
    "wikidata": "Q33291",
 
    "iso": "fon",
 
    "malesCount": "4",
 
    "malesRecords": "361",
 
    "femalesCount": "1",
 
    "femalesRecords": "2",
 
    "percent": "0.6"
 
  },
 
  {
 
    "languageLabel": "French",
 
    "wikidata": "Q150",
 
    "iso": "fra",
 
    "malesCount": "172",
 
    "malesRecords": "217922",
 
    "femalesCount": "87",
 
    "femalesRecords": "18600",
 
    "percent": "7.9"
 
  },
 
  {
 
    "languageLabel": "French Sign Language",
 
    "wikidata": "Q33302",
 
    "iso": "fsl",
 
    "malesCount": "2",
 
    "malesRecords": "4",
 
    "femalesCount": "1",
 
    "femalesRecords": "570",
 
    "percent": "99.3"
 
  },
 
  {
 
    "languageLabel": "Galician",
 
    "wikidata": "Q9307",
 
    "iso": "glg",
 
    "malesCount": "3",
 
    "malesRecords": "28",
 
    "femalesCount": "1",
 
    "femalesRecords": "6",
 
    "percent": "17.6"
 
  },
 
  {
 
    "languageLabel": "German",
 
     "wikidata": "Q188",
 
    "iso": "deu",
 
    "malesCount": "26",
 
    "malesRecords": "10529",
 
    "femalesCount": "8",
 
    "femalesRecords": "4103",
 
    "percent": "28"
 
  },
 
  {
 
    "languageLabel": "Ghomala' language",
 
    "wikidata": "Q35271",
 
    "iso": "bbj",
 
    "malesCount": "3",
 
    "malesRecords": "91",
 
    "femalesCount": "2",
 
    "femalesRecords": "96",
 
    "percent": "51.3"
 
  },
 
  {
 
    "languageLabel": "Greek",
 
    "wikidata": "Q9129",
 
    "iso": "gre",
 
    "malesCount": "1",
 
    "malesRecords": "5",
 
    "femalesCount": "1",
 
    "femalesRecords": "13",
 
    "percent": "72.2"
 
  },
 
  {
 
    "languageLabel": "Haitian Creole",
 
    "wikidata": "Q33491",
 
    "iso": "hat",
 
    "malesCount": "1",
 
    "malesRecords": "1",
 
    "femalesCount": "2",
 
    "femalesRecords": "8",
 
    "percent": "88.9"
 
  },
 
  {
 
    "languageLabel": "Igbo",
 
    "wikidata": "Q33578",
 
    "iso": "ibo",
 
    "malesCount": "1",
 
    "malesRecords": "12",
 
    "femalesCount": "3",
 
    "femalesRecords": "633",
 
    "percent": "98.1"
 
  },
 
  {
 
    "languageLabel": "Indonesian",
 
    "wikidata": "Q9240",
 
    "iso": "ind",
 
    "malesCount": "2",
 
    "malesRecords": "3",
 
    "femalesCount": "1",
 
    "femalesRecords": "5",
 
    "percent": "62.5"
 
  },
 
  {
 
    "languageLabel": "Italian",
 
    "wikidata": "Q652",
 
    "iso": "ita",
 
    "malesCount": "5",
 
    "malesRecords": "3403",
 
    "femalesCount": "2",
 
    "femalesRecords": "883",
 
    "percent": "20.6"
 
  },
 
  {
 
    "languageLabel": "Kannada",
 
    "wikidata": "Q33673",
 
    "iso": "kan",
 
    "malesCount": "6",
 
    "malesRecords": "329",
 
    "femalesCount": "2",
 
    "femalesRecords": "158",
 
    "percent": "32.4"
 
  },
 
  {
 
    "languageLabel": "Kaqchikel",
 
    "wikidata": "Q35115",
 
    "iso": "cak",
 
    "malesCount": "1",
 
    "malesRecords": "42",
 
    "femalesCount": "1",
 
    "femalesRecords": "3",
 
    "percent": "6.7"
 
  },
 
  {
 
    "languageLabel": "Korean",
 
    "wikidata": "Q9176",
 
    "iso": "kor",
 
    "malesCount": "1",
 
    "malesRecords": "51",
 
    "femalesCount": "1",
 
    "femalesRecords": "2",
 
    "percent": "3.8"
 
  },
 
  {
 
    "languageLabel": "Kurdish",
 
    "wikidata": "Q36368",
 
    "iso": "kur",
 
    "malesCount": "3",
 
    "malesRecords": "205",
 
    "femalesCount": "1",
 
    "femalesRecords": "382",
 
    "percent": "65.1"
 
  },
 
  {
 
    "languageLabel": "Mandarin Chinese",
 
    "wikidata": "Q9192",
 
    "iso": "cmn",
 
    "malesCount": "2",
 
    "malesRecords": "15",
 
    "femalesCount": "4",
 
    "femalesRecords": "814",
 
    "percent": "98.2"
 
  },
 
  {
 
    "languageLabel": "Marathi",
 
    "wikidata": "Q1571",
 
    "iso": "mar",
 
    "malesCount": "3",
 
    "malesRecords": "1254",
 
    "femalesCount": "27",
 
    "femalesRecords": "13153",
 
    "percent": "91.3"
 
  },
 
  {
 
    "languageLabel": "Martinique Creole",
 
    "wikidata": "Q3006281",
 
    "malesCount": "1",
 
    "malesRecords": "25",
 
    "femalesCount": "1",
 
    "femalesRecords": "25",
 
    "percent": "50"
 
  },
 
  {
 
    "languageLabel": "Moroccan Arabic",
 
    "wikidata": "Q56426",
 
    "iso": "ary",
 
    "malesCount": "6",
 
    "malesRecords": "1184",
 
    "femalesCount": "2",
 
    "femalesRecords": "102",
 
    "percent": "7.9"
 
  },
 
  {
 
    "languageLabel": "Occitan",
 
    "wikidata": "Q14185",
 
    "iso": "oci",
 
    "malesCount": "4",
 
    "malesRecords": "138",
 
    "femalesCount": "1",
 
    "femalesRecords": "67",
 
    "percent": "32.7"
 
  },
 
  {
 
    "languageLabel": "Odia",
 
    "wikidata": "Q33810",
 
    "iso": "ori",
 
    "malesCount": "4",
 
    "malesRecords": "50434",
 
    "femalesCount": "1",
 
    "femalesRecords": "2",
 
    "percent": "0"
 
  },
 
  {
 
    "languageLabel": "Persian",
 
    "wikidata": "Q9168",
 
    "iso": "fas",
 
    "malesCount": "2",
 
    "malesRecords": "72",
 
    "femalesCount": "2",
 
    "femalesRecords": "811",
 
    "percent": "91.8"
 
  },
 
  {
 
    "languageLabel": "Polish",
 
    "wikidata": "Q809",
 
    "iso": "pol",
 
    "malesCount": "11",
 
    "malesRecords": "63379",
 
    "femalesCount": "3",
 
    "femalesRecords": "12971",
 
    "percent": "17"
 
  },
 
  {
 
    "languageLabel": "Portuguese",
 
    "wikidata": "Q5146",
 
    "iso": "por",
 
    "malesCount": "4",
 
    "malesRecords": "2758",
 
    "femalesCount": "2",
 
    "femalesRecords": "2520",
 
    "percent": "47.7"
 
  },
 
  {
 
    "languageLabel": "Punjabi",
 
    "wikidata": "Q58635",
 
    "iso": "pan",
 
    "malesCount": "5",
 
    "malesRecords": "3979",
 
    "femalesCount": "2",
 
    "femalesRecords": "326",
 
    "percent": "7.6"
 
  },
 
  {
 
    "languageLabel": "Romanian",
 
    "wikidata": "Q7913",
 
    "iso": "ron",
 
    "malesCount": "4",
 
    "malesRecords": "16959",
 
    "femalesCount": "1",
 
    "femalesRecords": "2442",
 
    "percent": "12.6"
 
  },
 
  {
 
    "languageLabel": "Russian",
 
    "wikidata": "Q7737",
 
    "iso": "rus",
 
    "malesCount": "16",
 
    "malesRecords": "5406",
 
    "femalesCount": "10",
 
    "femalesRecords": "3186",
 
    "percent": "37.1"
 
  },
 
  {
 
    "languageLabel": "Santali",
 
    "wikidata": "Q33965",
 
    "iso": "sat",
 
    "malesCount": "7",
 
    "malesRecords": "397",
 
    "femalesCount": "1",
 
    "femalesRecords": "150",
 
    "percent": "27.4"
 
  },
 
  {
 
    "languageLabel": "Shawiya language",
 
    "wikidata": "Q33274",
 
    "iso": "shy",
 
    "malesCount": "6",
 
    "malesRecords": "1729",
 
    "femalesCount": "1",
 
    "femalesRecords": "1",
 
    "percent": "0.1"
 
  },
 
  {
 
    "languageLabel": "South Levantine Arabic",
 
    "wikidata": "Q55633582",
 
    "iso": "ajp",
 
    "malesCount": "4",
 
    "malesRecords": "1244",
 
    "femalesCount": "2",
 
    "femalesRecords": "146",
 
    "percent": "10.5"
 
  },
 
  {
 
    "languageLabel": "Spanish",
 
    "wikidata": "Q1321",
 
    "iso": "spa",
 
    "malesCount": "15",
 
    "malesRecords": "8052",
 
    "femalesCount": "9",
 
    "femalesRecords": "632",
 
    "percent": "7.3"
 
  },
 
  {
 
    "languageLabel": "Telugu",
 
    "wikidata": "Q8097",
 
    "iso": "tel",
 
    "malesCount": "2",
 
    "malesRecords": "397",
 
    "femalesCount": "1",
 
    "femalesRecords": "5",
 
    "percent": "1.2"
 
  },
 
  {
 
    "languageLabel": "Ukrainian",
 
    "wikidata": "Q8798",
 
    "iso": "ukr",
 
    "malesCount": "3",
 
    "malesRecords": "18596",
 
    "femalesCount": "1",
 
    "femalesRecords": "5",
 
    "percent": "0"
 
  },
 
  {
 
    "languageLabel": "Wayuu",
 
    "wikidata": "Q891085",
 
    "iso": "guc",
 
    "malesCount": "1",
 
    "malesRecords": "22",
 
    "femalesCount": "5",
 
    "femalesRecords": "18",
 
    "percent": "45"
 
  },
 
  {
 
    "languageLabel": "Welsh",
 
    "wikidata": "Q9309",
 
    "iso": "cym",
 
    "malesCount": "6",
 
    "malesRecords": "791",
 
    "femalesCount": "3",
 
    "femalesRecords": "70",
 
    "percent": "8.1"
 
 
   }
 
   }
 
]
 
]

Latest revision as of 13:50, 21 August 2024

/* **************
SELECT ?item ?itemLabel WHERE {
SERVICE wikibase:label {
  bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
} 
?item prop:P2 entity:Q5
} 
************** */
[
  {
    "item": "https://lingualibre.org/entity/Q12",
    "itemLabel": "beginner"
  },
  {
    "item": "https://lingualibre.org/entity/Q13",
    "itemLabel": "average level"
  },
  {
    "item": "https://lingualibre.org/entity/Q14",
    "itemLabel": "good level"
  },
  {
    "item": "https://lingualibre.org/entity/Q15",
    "itemLabel": "native"
  }
]