From 45d274cf2c6c0a60e8626ddb7ba8090cdc9fc3ac Mon Sep 17 00:00:00 2001 From: h7x4 Date: Sun, 17 Nov 2024 12:27:46 +0100 Subject: [PATCH] WIP --- migrations/0005_Connections.sql | 6 - .../0005_KANJIDIC_Radical__RADKFILE__XREF.sql | 227 ++++++++++++++++++ ...KanjiElement__KANJIDIC_Character__XREF.sql | 7 + .../0007_KANJIDIC_Character_lookup_tables.sql | 15 ++ .../0008_JMdict_Entry_lookup_tables.sql | 0 5 files changed, 249 insertions(+), 6 deletions(-) delete mode 100644 migrations/0005_Connections.sql create mode 100644 migrations/0005_KANJIDIC_Radical__RADKFILE__XREF.sql create mode 100644 migrations/0006_JMdict_KanjiElement__KANJIDIC_Character__XREF.sql create mode 100644 migrations/0007_KANJIDIC_Character_lookup_tables.sql create mode 100644 migrations/0008_JMdict_Entry_lookup_tables.sql diff --git a/migrations/0005_Connections.sql b/migrations/0005_Connections.sql deleted file mode 100644 index 5289e7f..0000000 --- a/migrations/0005_Connections.sql +++ /dev/null @@ -1,6 +0,0 @@ --- Radk - kanjidic --- kanjireading -> filter kanji regex - kanjidic --- index kanji search by romaji --- index kanji search by hiragana --- index word search by romaji --- index word search by hiragana \ No newline at end of file diff --git a/migrations/0005_KANJIDIC_Radical__RADKFILE__XREF.sql b/migrations/0005_KANJIDIC_Radical__RADKFILE__XREF.sql new file mode 100644 index 0000000..d5b5780 --- /dev/null +++ b/migrations/0005_KANJIDIC_Radical__RADKFILE__XREF.sql @@ -0,0 +1,227 @@ +CREATE TABLE "KANJIDIC_Radical__RADKFILE__XREF"( + "radicalId" INTEGER NOT NULL, + "radicalSymbol" CHAR(1) NOT NULL REFERENCES "RADKFILE"("radical"), + "radicalType" VARCHAR(9) NOT NULL CHECK ("radicalType" IN ('classical', 'nelson_c')) DEFAULT 'classical', + PRIMARY KEY ("radicalId", "radicalSymbol", "radicalType"), + FOREIGN KEY ("radicalId", "radicalType") REFERENCES "KANJIDIC_Radical"("radical", "type") +) WITHOUT ROWID; + +CREATE INDEX "KANJIDIC_Radical__RADKFILE__XREF_byRadicalId" ON "KANJIDIC_Radical__RADKFILE__XREF"("radicalId"); +CREATE INDEX "KANJIDIC_Radical__RADKFILE__XREF_byRadicalSymbol_byRadicalType" ON "KANJIDIC_Radical__RADKFILE__XREF"("radicalSymbol", "radicalType"); + +/* Source: https://ctext.org/kangxi-zidian */ +INSERT INTO "KANJIDIC_Radical__RADKFILE__XREF"("radicalId", "radicalSymbol") VALUES + (1, '一'), + (2, '丨'), + (3, '丶'), + (4, '丿'), + (5, '乙'), + (6, '亅'), + (7, '二'), + (8, '亠'), + (9, '人'), + (10, '儿'), + (11, '入'), + (12, '八'), + (13, '冂'), + (14, '冖'), + (15, '冫'), + (16, '几'), + (17, '凵'), + (18, '刀'), + (19, '力'), + (20, '勹'), + (21, '匕'), + (22, '匚'), + (23, '匸'), + (24, '十'), + (25, '卜'), + (26, '卩'), + (27, '厂'), + (28, '厶'), + (29, '又'), + (30, '口'), + (31, '囗'), + (32, '土'), + (33, '士'), + (34, '夂'), + (35, '夊'), + (36, '夕'), + (37, '大'), + (38, '女'), + (39, '子'), + (40, '宀'), + (41, '寸'), + (42, '小'), + (43, '尢'), + (44, '尸'), + (45, '屮'), + (46, '山'), + (47, '巛'), + (48, '工'), + (49, '己'), + (50, '巾'), + (51, '干'), + (52, '幺'), + (53, '广'), + (54, '廴'), + (55, '廾'), + (56, '弋'), + (57, '弓'), + (58, '彐'), + (59, '彡'), + (60, '彳'), + (61, '心'), + (62, '戈'), + (63, '户'), + (64, '手'), + (65, '支'), + (66, '攴'), + (67, '文'), + (68, '斗'), + (69, '斤'), + (70, '方'), + (71, '无'), + (72, '日'), + (73, '曰'), + (74, '月'), + (75, '木'), + (76, '欠'), + (77, '止'), + (78, '歹'), + (79, '殳'), + (80, '毋'), + (81, '比'), + (82, '毛'), + (83, '氏'), + (84, '气'), + (85, '水'), + (86, '火'), + (87, '爪'), + (88, '父'), + (89, '爻'), + (90, '爿'), + (91, '片'), + (92, '牙'), + (93, '牛'), + (94, '犬'), + (95, '玄'), + (96, '玉'), + (97, '瓜'), + (98, '瓦'), + (99, '甘'), + (100, '生'), + (101, '用'), + (102, '田'), + (103, '疋'), + (104, '疒'), + (105, '癶'), + (106, '白'), + (107, '皮'), + (108, '皿'), + (109, '目'), + (110, '矛'), + (111, '矢'), + (112, '石'), + (113, '示'), + (114, '禸'), + (115, '禾'), + (116, '穴'), + (117, '立'), + (118, '竹'), + (119, '米'), + (120, '糸'), + (121, '缶'), + (122, '网'), + (123, '羊'), + (124, '羽'), + (125, '老'), + (126, '而'), + (127, '耒'), + (128, '耳'), + (129, '聿'), + (130, '肉'), + (131, '臣'), + (132, '自'), + (133, '至'), + (134, '臼'), + (135, '舌'), + (136, '舛'), + (137, '舟'), + (138, '艮'), + (139, '色'), + (140, '艸'), + (141, '虍'), + (142, '虫'), + (143, '血'), + (144, '行'), + (145, '衣'), + (146, '襾'), + (147, '見'), + (148, '角'), + (149, '言'), + (150, '谷'), + (151, '豆'), + (152, '豕'), + (153, '豸'), + (154, '貝'), + (155, '赤'), + (156, '走'), + (157, '足'), + (158, '身'), + (159, '車'), + (160, '辛'), + (161, '辰'), + (162, '辵'), + (163, '邑'), + (164, '酉'), + (165, '釆'), + (166, '里'), + (167, '金'), + (168, '長'), + (169, '門'), + (170, '阜'), + (171, '隶'), + (172, '隹'), + (173, '雨'), + (174, '青'), + (175, '非'), + (176, '面'), + (177, '革'), + (178, '韋'), + (179, '韭'), + (180, '音'), + (181, '頁'), + (182, '風'), + (183, '飛'), + (184, '食'), + (185, '首'), + (186, '香'), + (187, '馬'), + (188, '骨'), + (189, '高'), + (190, '髟'), + (191, '鬥'), + (192, '鬯'), + (193, '鬲'), + (194, '鬼'), + (195, '魚'), + (196, '鳥'), + (197, '鹵'), + (198, '鹿'), + (199, '麥'), + (200, '麻'), + (201, '黃'), + (202, '黍'), + (203, '黑'), + (204, '黹'), + (205, '黽'), + (206, '鼎'), + (207, '鼓'), + (208, '鼠'), + (209, '鼻'), + (210, '齊'), + (211, '齒'), + (212, '龍'), + (213, '龜'), + (214, '龠'); diff --git a/migrations/0006_JMdict_KanjiElement__KANJIDIC_Character__XREF.sql b/migrations/0006_JMdict_KanjiElement__KANJIDIC_Character__XREF.sql new file mode 100644 index 0000000..fc01bc5 --- /dev/null +++ b/migrations/0006_JMdict_KanjiElement__KANJIDIC_Character__XREF.sql @@ -0,0 +1,7 @@ +CREATE TABLE "JMdict_KanjiElement__KANJIDIC_Character__XREF"( + "entryId" INTEGER NOT NULL, + "reading" TEXT NOT NULL, + "kanji" CHAR(1) NOT NULL REFERENCES "KANJIDIC_Character"("literal"), + PRIMARY KEY ("entryId", "reading", "kanji"), + FOREIGN KEY ("entryId", "reading") REFERENCES "JMdict_KanjiElement"("entryId", "reading") +) WITHOUT ROWID; \ No newline at end of file diff --git a/migrations/0007_KANJIDIC_Character_lookup_tables.sql b/migrations/0007_KANJIDIC_Character_lookup_tables.sql new file mode 100644 index 0000000..8d50f4a --- /dev/null +++ b/migrations/0007_KANJIDIC_Character_lookup_tables.sql @@ -0,0 +1,15 @@ +CREATE TABLE "KANJIDIC_Character__lookup_romaji"( + "kanji" CHAR(1) NOT NULL REFERENCES "KANJIDIC_Character"("literal"), + "romaji" TEXT NOT NULL, + PRIMARY KEY("kanji", "romaji") +) WITHOUT ROWID; + +CREATE TABLE "KANJIDIC_Character__lookup_hiragana"( + "kanji" CHAR(1) NOT NULL REFERENCES "KANJIDIC_Character"("literal"), + "hiragana" TEXT NOT NULL, + PRIMARY KEY("kanji", "hiragana") +) WITHOUT ROWID; + +-- index kanji search by hiragana +-- index word search by romaji +-- index word search by hiragana \ No newline at end of file diff --git a/migrations/0008_JMdict_Entry_lookup_tables.sql b/migrations/0008_JMdict_Entry_lookup_tables.sql new file mode 100644 index 0000000..e69de29