Z28929

{
    "Z1K1": "Z2",
    "Z2K1": {
        "Z1K1": "Z6",
        "Z6K1": "Z28929"
    },
    "Z2K2": {
        "Z1K1": "Z14",
        "Z14K1": "Z28928",
        "Z14K3": {
            "Z1K1": "Z16",
            "Z16K1": "Z600",
            "Z16K2": "function Z28928( Z28928K1, Z28928K2, Z28928K3, Z28928K4, Z28928K5, Z28928K6, Z28928K7, Z28928K8 ) {\n\tfunction cleanString( Z27868K1 ) {\n\t\tlet s=Z27868K1.replaceAll('\u0026',\"\u0026amp;\");\n\t\ts=s.replaceAll('\"',\"\u0026quot;\");\n\t\ts=s.replaceAll(\"'\",\"\u0026apos;\");\n\t\ts=s.replaceAll('\u003C',\"\u0026lt;\");\n\t\ts=s.replaceAll('\u003E',\"\u0026gt;\");\n\t\treturn s;\n\t}\n\tlet ret='\u003Ctable class=\"wikitable\"\u003E';\n\t// we could check if Z6005K3 is German and Z6005K4 is noun\n\t// and raise an error else\n\t// assumes there is one gender statement and it is one of the three\n\tlet gender = 'unknown';\n\tfor (let statement of Z28928K1.Z6005K5) {\n\t\tif ( 'P5185' == statement.Z6003K2.Z6092K1 ) {\n\t\t\tconst genderqid = statement.Z6003K3.Z6091K1;\n\t\t\tif ( genderqid == 'Q1775415' ) gender = 'n';\n\t\t\tif ( genderqid == 'Q499327' ) gender = 'm';\n\t\t\tif ( genderqid == 'Q1775415' ) gender = 'f';\n\t\t}\n\t}\n\tlet ns = *;\n\tlet np = *;\n\tlet gs = *;\n\tlet gp = *;\n\tlet ds = *;\n\tlet dp = *;\n\tlet as = *;\n\tlet ap = *;\n\t// assumptions of well-formedness\n\tfor (let form of Z28928K1.Z6005K7) {\n\t\tconst features = [];\n\t\tfor (let feature of form.Z6004K4) {\n\t\t\tfeatures.push(feature.Z6091K1);\n\t\t}\n\t\t// assumes there is only one\n\t\tlet rep = form.Z6004K3.Z12K1[0].Z11K2;\n\t\tif ( features.includes('Q131105') \u0026\u0026 features.includes('Q110786') )\n\t\t\tns = rep;\n\t\tif ( features.includes('Q131105') \u0026\u0026 features.includes('Q146786') )\n\t\t\tnp = rep;\n\t\tif ( features.includes('Q146233') \u0026\u0026 features.includes('Q110786') )\n\t\t\tgs = rep;\n\t\tif ( features.includes('Q146233') \u0026\u0026 features.includes('Q146786') )\n\t\t\tgp = rep;\n\t\tif ( features.includes('Q145599') \u0026\u0026 features.includes('Q110786') )\n\t\t\tds = rep;\n\t\tif ( features.includes('Q145599') \u0026\u0026 features.includes('Q146786') )\n\t\t\tdp = rep;\n\t\tif ( features.includes('Q146078') \u0026\u0026 features.includes('Q110786') )\n\t\t\tas = rep;\n\t\tif ( features.includes('Q146078') \u0026\u0026 features.includes('Q146786') )\n\t\t\tap = rep;\n\t}\n\tret+='\u003Ccaption\u003E';\n\tret+= gender=='f'? 'die ' : gender=='m'? 'der ' : 'das ';\n\tret+=cleanString(ns)+'\u003C/caption\u003E';\n\tret+='\u003Ctr\u003E';\n\tret+='\u003Cth\u003E'+cleanString(Z28928K2)+'\u003C/th\u003E';\n\tret+='\u003Cth\u003E'+cleanString(Z28928K3)+'\u003C/th\u003E';\n\tret+='\u003Cth\u003E'+cleanString(Z28928K4)+'\u003C/th\u003E';\n\tret+='\u003C/tr\u003E';\n\t\n\t// nominative\n\tret+='\u003Ctr\u003E\u003Cth\u003E'+cleanString(Z28928K5)+'\u003C/th\u003E';\n\tret+= '\u003Ctd\u003E';\n\tret+= gender=='f'? 'die ' : gender=='m'? 'der ' : 'das ';\n\tret+=cleanString(ns);\n\tret+= '\u003C/td\u003E';\n\tret+= '\u003Ctd\u003Edie '+cleanString(np)+'\u003C/td\u003E';\n\tret+='\u003C/tr\u003E';\n\t\n\t// genitive\n\tret+='\u003Ctr\u003E\u003Cth\u003E'+cleanString(Z28928K6)+'\u003C/th\u003E';\n\tret+= '\u003Ctd\u003E';\n\tret+= gender=='f'? 'der ' : 'des ';\n\tret+=cleanString(gs);\n\tret+= '\u003C/td\u003E';\n\tret+= '\u003Ctd\u003Eder '+cleanString(gp)+'\u003C/td\u003E';\n\tret+='\u003C/tr\u003E';\n\t\n\t// dative\n\tret+='\u003Ctr\u003E\u003Cth\u003E'+cleanString(Z28928K7)+'\u003C/th\u003E';\n\tret+= '\u003Ctd\u003E';\n\tret+= gender=='f'? 'der ' : 'dem ';\n\tret+=cleanString(ds);\n\tret+= '\u003C/td\u003E';\n\tret+= '\u003Ctd\u003Eden '+cleanString(dp)+'\u003C/td\u003E';\n\tret+='\u003C/tr\u003E';\n\t\n\t// accusative\n\tret+='\u003Ctr\u003E\u003Cth\u003E'+cleanString(Z28928K8)+'\u003C/th\u003E';\n\tret+= '\u003Ctd\u003E';\n\tret+= gender=='f'? 'die ' : gender=='m'? 'der ' : 'das ';\n\tret+=cleanString(as);\n\tret+= '\u003C/td\u003E';\n\tret+= '\u003Ctd\u003Edie '+cleanString(ap)+'\u003C/td\u003E';\n\tret+='\u003C/tr\u003E';\n\tret+='\u003C/table\u003E';\n\t\n\treturn  {Z1K1:{Z1K1:\"Z9\",Z9K1:\"Z89\"}, Z89K1:ret};\n}"
        }
    },
    "Z2K3": {
        "Z1K1": "Z12",
        "Z12K1": [
            "Z11",
            {
                "Z1K1": "Z11",
                "Z11K1": "Z1002",
                "Z11K2": "whole table in JS, many assumptions"
            }
        ]
    },
    "Z2K4": {
        "Z1K1": "Z32",
        "Z32K1": [
            "Z31"
        ]
    },
    "Z2K5": {
        "Z1K1": "Z12",
        "Z12K1": [
            "Z11"
        ]
    }
}