KB-4EC4

S122 — Taxonomy Seed Data (SSOT cho import)

21 min read Revision 1

S122 — Taxonomy Seed Data (SSOT cho import)

Data chuẩn cho S122-TAXONOMY-FOUNDATION. Agent đọc file này để import. KHÔNG đoán.


1. TAXONOMY_FACETS (6 records)

INSERT INTO taxonomy_facets (code, name, description, cardinality, max_labels_per_entity, sort) VALUES
('FAC-01', 'Chuyên môn gì?', 'Entity thuộc lĩnh vực chuyên môn nào? Cấu trúc cha-con 3 tầng.', 'multiple', 3, 1),
('FAC-02', 'Vai trò hệ thống?', 'Entity đóng vai trò gì trong hệ thống?', 'single', 0, 2),
('FAC-03', 'Hành động gì?', 'Entity làm gì hoặc phục vụ cho hành động gì?', 'multiple', 0, 3),
('FAC-04', 'Phạm vi tác động?', 'Entity ảnh hưởng đến đâu?', 'single', 0, 4),
('FAC-05', 'Giai đoạn?', 'Entity đang ở giai đoạn nào trong vòng đời?', 'single', 0, 5),
('FAC-06', 'Phục vụ ai?', 'Entity phục vụ cho đối tượng nào?', 'multiple', 0, 6);

2. TAXONOMY — Chiều 1: Chuyên môn (facet FAC-01, phân cấp)

Tầng 0 — Cha (8 records)

-- Giả sử facet_id cho FAC-01 = 1 (query thực tế để lấy id)
INSERT INTO taxonomy (code, name, name_en, facet_id, depth, scope, description, sort) VALUES
('LBL-001', 'Hạ tầng & vận hành', 'Infrastructure & Operations', 1, 0, '{atom,molecule,compound,material,product,building}', 'Server, Docker, CI/CD, deploy, monitoring, mạng', 1),
('LBL-002', 'Dữ liệu & lưu trữ', 'Data & Storage', 1, 0, '{atom,molecule,compound,material,product,building}', 'PostgreSQL, Directus, Qdrant, files, backup, migration', 2),
('LBL-003', 'Giao diện & trải nghiệm', 'UI & Experience', 1, 0, '{atom,molecule,compound,material,product,building}', 'Pages, components, tables, layouts, navigation, forms', 3),
('LBL-004', 'Quy trình & điều phối', 'Workflow & Orchestration', 1, 0, '{atom,molecule,compound,material,product,building}', 'Workflows, steps, approvals, state machine, tasks', 4),
('LBL-005', 'Kiểm tra & giám sát', 'QA & Monitoring', 1, 0, '{atom,molecule,compound,material,product,building}', 'DOT tools kiểm tra, health check, audit, scan, verify', 5),
('LBL-006', 'Tích hợp AI', 'AI Integration', 1, 0, '{atom,molecule,compound,material,product,building}', 'AI agents, bridges, gateways, MCP, LLM connections', 6),
('LBL-007', 'Bảo mật & quyền', 'Security & Permissions', 1, 0, '{atom,molecule,compound,material,product,building}', 'Permissions, auth, tokens, roles, secrets', 7),
('LBL-008', 'Nghiệp vụ', 'Business', 1, 0, '{material,product,building}', 'Quy trình kinh doanh, khách hàng, đại lý, CTV (mở rộng dần)', 8);

Tầng 1 — Con (20 records, parent_id trỏ vào cha tương ứng)

-- Con của LBL-001 (Hạ tầng)
INSERT INTO taxonomy (code, name, name_en, facet_id, parent_id, depth, scope, description, sort) VALUES
('LBL-011', 'Server & VPS', 'Server & VPS', 1, (SELECT id FROM taxonomy WHERE code='LBL-001'), 1, '{atom,molecule,compound}', 'Contabo, nginx, OS, network config', 1),
('LBL-012', 'Docker & container', 'Docker & Containers', 1, (SELECT id FROM taxonomy WHERE code='LBL-001'), 1, '{atom,molecule,compound}', 'Docker compose, images, volumes, networking', 2),
('LBL-013', 'CI/CD & deploy', 'CI/CD & Deploy', 1, (SELECT id FROM taxonomy WHERE code='LBL-001'), 1, '{atom,molecule,compound}', 'GitHub Actions, deploy workflows, SSH push', 3),
('LBL-014', 'Giám sát hệ thống', 'System Monitoring', 1, (SELECT id FROM taxonomy WHERE code='LBL-001'), 1, '{atom,molecule,compound}', 'Health check, uptime, logs, alerts', 4),

-- Con của LBL-002 (Dữ liệu)
('LBL-021', 'PostgreSQL', 'PostgreSQL', 1, (SELECT id FROM taxonomy WHERE code='LBL-002'), 1, '{atom,molecule,compound}', 'Tables, views, triggers, functions, CTE', 1),
('LBL-022', 'Directus', 'Directus', 1, (SELECT id FROM taxonomy WHERE code='LBL-002'), 1, '{atom,molecule,compound}', 'Collections, fields, flows, permissions, API', 2),
('LBL-023', 'Vector & Qdrant', 'Vector & Qdrant', 1, (SELECT id FROM taxonomy WHERE code='LBL-002'), 1, '{atom,molecule,compound}', 'Embeddings, vector search, RAG', 3),
('LBL-024', 'Files & backup', 'Files & Backup', 1, (SELECT id FROM taxonomy WHERE code='LBL-002'), 1, '{atom,molecule,compound}', 'Local storage, backup scripts, restore', 4),

-- Con của LBL-003 (Giao diện)
('LBL-031', 'Trang & route', 'Pages & Routes', 1, (SELECT id FROM taxonomy WHERE code='LBL-003'), 1, '{atom,molecule,compound}', 'Nuxt pages, navigation, routing', 1),
('LBL-032', 'Bảng & danh sách', 'Tables & Lists', 1, (SELECT id FROM taxonomy WHERE code='LBL-003'), 1, '{atom,molecule,compound}', 'DirectusTable, UTable, data display', 2),
('LBL-033', 'Biểu mẫu & nhập liệu', 'Forms & Inputs', 1, (SELECT id FROM taxonomy WHERE code='LBL-003'), 1, '{atom,molecule,compound}', 'UForm, UInput, data entry', 3),

-- Con của LBL-004 (Quy trình)
('LBL-041', 'Workflow & steps', 'Workflows & Steps', 1, (SELECT id FROM taxonomy WHERE code='LBL-004'), 1, '{atom,molecule,compound}', 'Workflow definitions, nodes, transitions', 1),
('LBL-042', 'Checkpoint & xác minh', 'Checkpoints & Verification', 1, (SELECT id FROM taxonomy WHERE code='LBL-004'), 1, '{atom,molecule,compound}', 'Checkpoint types, sets, instances, verification', 2),
('LBL-043', 'Task & phân công', 'Tasks & Assignment', 1, (SELECT id FROM taxonomy WHERE code='LBL-004'), 1, '{atom,molecule,compound}', 'Task management, AI tasks, assignments', 3),

-- Con của LBL-005 (Kiểm tra)
('LBL-051', 'Đếm & xác minh', 'Counting & Verification', 1, (SELECT id FROM taxonomy WHERE code='LBL-005'), 1, '{atom,molecule,compound}', 'verify_counts, crosscheck, record counting', 1),
('LBL-052', 'Quét mồ côi', 'Orphan Scanning', 1, (SELECT id FROM taxonomy WHERE code='LBL-005'), 1, '{atom,molecule,compound}', 'dot-orphan-scan, entity_code validation', 2),
('LBL-053', 'Kiểm tra quan hệ', 'Relationship Auditing', 1, (SELECT id FROM taxonomy WHERE code='LBL-005'), 1, '{atom,molecule,compound}', 'audit_relationships, dead links, dependency scan', 3),

-- Con của LBL-006 (AI)
('LBL-061', 'AI Agent & bridge', 'AI Agents & Bridges', 1, (SELECT id FROM taxonomy WHERE code='LBL-006'), 1, '{atom,molecule,compound}', 'Claude, GPT, Gemini, MCP connections', 1),
('LBL-062', 'AI Gateway & config', 'AI Gateway & Config', 1, (SELECT id FROM taxonomy WHERE code='LBL-006'), 1, '{atom,molecule,compound}', 'Gateway setup, tokens, API keys', 2),

-- Con của LBL-007 (Bảo mật)
('LBL-071', 'Quyền & vai trò', 'Permissions & Roles', 1, (SELECT id FROM taxonomy WHERE code='LBL-007'), 1, '{atom,molecule,compound}', 'Directus roles, collection permissions, field access', 1),
('LBL-072', 'Xác thực & token', 'Auth & Tokens', 1, (SELECT id FROM taxonomy WHERE code='LBL-007'), 1, '{atom,molecule,compound}', 'Secret Manager, API keys, refresh tokens', 2);

3. TAXONOMY — Chiều 2-6 (phẳng, depth=0, facet tương ứng)

-- Chiều 2: Vai trò (facet FAC-02)
INSERT INTO taxonomy (code, name, name_en, facet_id, depth, scope, description, sort) VALUES
('LBL-101', 'Cấu trúc', 'Structure', 2, 0, '{atom,molecule}', 'Tạo nên bộ khung: collections, fields, tables', 1),
('LBL-102', 'Nội dung', 'Content', 2, 0, '{atom,molecule}', 'Chứa dữ liệu nghiệp vụ: records, comments', 2),
('LBL-103', 'Quy tắc', 'Rules', 2, 0, '{atom,molecule,compound}', 'Định nghĩa cách làm: workflows, checkpoints', 3),
('LBL-104', 'Công cụ', 'Tool', 2, 0, '{atom,molecule}', 'Thực thi hành động: DOT tools, scripts', 4),
('LBL-105', 'Giám sát', 'Monitoring', 2, 0, '{atom,molecule}', 'Phát hiện vấn đề: issues, audits', 5);

-- Chiều 3: Hành động (facet FAC-03)
INSERT INTO taxonomy (code, name, name_en, facet_id, depth, scope, description, sort) VALUES
('LBL-201', 'Tạo mới', 'Create', 3, 0, '{atom,molecule,compound}', 'Tạo entities, records, configs mới', 1),
('LBL-202', 'Đọc / truy vấn', 'Read / Query', 3, 0, '{atom,molecule,compound}', 'Đọc data, query, display, report', 2),
('LBL-203', 'Kiểm tra / xác minh', 'Check / Verify', 3, 0, '{atom,molecule,compound}', 'Verify, validate, audit, scan, test', 3),
('LBL-204', 'Cập nhật', 'Update', 3, 0, '{atom,molecule,compound}', 'Update, refresh, migrate, patch, fix', 4),
('LBL-205', 'Xoá / dọn dẹp', 'Delete / Cleanup', 3, 0, '{atom,molecule,compound}', 'Delete, archive, purge, cleanup', 5),
('LBL-206', 'Kết nối / tích hợp', 'Connect / Integrate', 3, 0, '{atom,molecule,compound}', 'Sync, connect, bridge, import, export', 6),
('LBL-207', 'Báo cáo / thông báo', 'Report / Notify', 3, 0, '{atom,molecule,compound}', 'Report, alert, notify, log, summary', 7);

-- Chiều 4: Phạm vi (facet FAC-04)
INSERT INTO taxonomy (code, name, name_en, facet_id, depth, scope, description, sort) VALUES
('LBL-301', '1 entity đơn lẻ', 'Single entity', 4, 0, '{atom,molecule,compound,material,product,building}', 'Chỉ ảnh hưởng chính nó', 1),
('LBL-302', '1 collection / module', 'Single collection', 4, 0, '{atom,molecule,compound,material,product,building}', 'Ảnh hưởng 1 nhóm entity', 2),
('LBL-303', 'Nhiều collections', 'Multiple collections', 4, 0, '{atom,molecule,compound,material,product,building}', 'Cross-collection impact', 3),
('LBL-304', 'Toàn hệ thống', 'System-wide', 4, 0, '{atom,molecule,compound,material,product,building}', 'Ảnh hưởng mọi thứ', 4);

-- Chiều 5: Giai đoạn (facet FAC-05)
INSERT INTO taxonomy (code, name, name_en, facet_id, depth, scope, description, sort) VALUES
('LBL-401', 'Thiết kế', 'Design', 5, 0, '{compound,material,product,building}', 'Đang thiết kế, chưa triển khai', 1),
('LBL-402', 'Hoạt động', 'Active', 5, 0, '{compound,material,product,building}', 'Đang chạy production', 2),
('LBL-403', 'Tạm dừng', 'Paused', 5, 0, '{compound,material,product,building}', 'Có nhưng đang tắt', 3),
('LBL-404', 'Ngưng sử dụng', 'Deprecated', 5, 0, '{compound,material,product,building}', 'Deprecated, chờ retire', 4);

-- Chiều 6: Phục vụ ai (facet FAC-06)
INSERT INTO taxonomy (code, name, name_en, facet_id, depth, scope, description, sort) VALUES
('LBL-501', 'Hệ thống nội bộ', 'Internal System', 6, 0, '{atom,molecule,compound,material,product,building}', 'Phục vụ vận hành hệ thống: infra, CI/CD, monitoring', 1),
('LBL-502', 'Nhà phát triển', 'Developer', 6, 0, '{atom,molecule,compound,material,product,building}', 'Phục vụ dev/AI agent: tools, APIs, docs kỹ thuật', 2),
('LBL-503', 'Quản trị viên', 'Administrator', 6, 0, '{atom,molecule,compound,material,product,building}', 'Phục vụ admin: settings, permissions, dashboards', 3),
('LBL-504', 'Người dùng cuối', 'End User', 6, 0, '{atom,molecule,compound,material,product,building}', 'Nhân viên TRONG tổ chức dùng hàng ngày: forms, workflows, tasks', 4),
('LBL-505', 'Khách hàng', 'Customer', 6, 0, '{atom,molecule,compound,material,product,building}', 'Người NGOÀI tổ chức: khách hàng, người mua, đăng ký dịch vụ', 5),
('LBL-506', 'Đối tác / Cộng tác viên', 'Partner / Collaborator', 6, 0, '{atom,molecule,compound,material,product,building}', 'Người NGOÀI tổ chức hợp tác: đại lý, CTV, nhà cung cấp', 6);

4. TAXONOMY_MATRIX (36 records: 6 facets × 6 levels)

-- facet_id = query thực tế, dưới đây dùng FAC code để rõ ý
-- M = mandatory, O = optional, N = not_applicable

-- FAC-01 Chuyên môn: ★ mọi lớp
INSERT INTO taxonomy_matrix (facet_id, composition_level, requirement) VALUES
((SELECT id FROM taxonomy_facets WHERE code='FAC-01'), 'atom', 'mandatory'),
((SELECT id FROM taxonomy_facets WHERE code='FAC-01'), 'molecule', 'mandatory'),
((SELECT id FROM taxonomy_facets WHERE code='FAC-01'), 'compound', 'mandatory'),
((SELECT id FROM taxonomy_facets WHERE code='FAC-01'), 'material', 'mandatory'),
((SELECT id FROM taxonomy_facets WHERE code='FAC-01'), 'product', 'mandatory'),
((SELECT id FROM taxonomy_facets WHERE code='FAC-01'), 'building', 'mandatory'),

-- FAC-02 Vai trò: ★ atom+molecule, ○ compound, — material+
((SELECT id FROM taxonomy_facets WHERE code='FAC-02'), 'atom', 'mandatory'),
((SELECT id FROM taxonomy_facets WHERE code='FAC-02'), 'molecule', 'mandatory'),
((SELECT id FROM taxonomy_facets WHERE code='FAC-02'), 'compound', 'optional'),
((SELECT id FROM taxonomy_facets WHERE code='FAC-02'), 'material', 'not_applicable'),
((SELECT id FROM taxonomy_facets WHERE code='FAC-02'), 'product', 'not_applicable'),
((SELECT id FROM taxonomy_facets WHERE code='FAC-02'), 'building', 'not_applicable'),

-- FAC-03 Hành động: ★ atom, ○ molecule+compound, — material+
((SELECT id FROM taxonomy_facets WHERE code='FAC-03'), 'atom', 'mandatory'),
((SELECT id FROM taxonomy_facets WHERE code='FAC-03'), 'molecule', 'optional'),
((SELECT id FROM taxonomy_facets WHERE code='FAC-03'), 'compound', 'optional'),
((SELECT id FROM taxonomy_facets WHERE code='FAC-03'), 'material', 'not_applicable'),
((SELECT id FROM taxonomy_facets WHERE code='FAC-03'), 'product', 'not_applicable'),
((SELECT id FROM taxonomy_facets WHERE code='FAC-03'), 'building', 'not_applicable'),

-- FAC-04 Phạm vi: ○ atom+molecule, ★ compound+
((SELECT id FROM taxonomy_facets WHERE code='FAC-04'), 'atom', 'optional'),
((SELECT id FROM taxonomy_facets WHERE code='FAC-04'), 'molecule', 'optional'),
((SELECT id FROM taxonomy_facets WHERE code='FAC-04'), 'compound', 'mandatory'),
((SELECT id FROM taxonomy_facets WHERE code='FAC-04'), 'material', 'mandatory'),
((SELECT id FROM taxonomy_facets WHERE code='FAC-04'), 'product', 'mandatory'),
((SELECT id FROM taxonomy_facets WHERE code='FAC-04'), 'building', 'mandatory'),

-- FAC-05 Giai đoạn: — atom+molecule, ○ compound, ★ material+
((SELECT id FROM taxonomy_facets WHERE code='FAC-05'), 'atom', 'not_applicable'),
((SELECT id FROM taxonomy_facets WHERE code='FAC-05'), 'molecule', 'not_applicable'),
((SELECT id FROM taxonomy_facets WHERE code='FAC-05'), 'compound', 'optional'),
((SELECT id FROM taxonomy_facets WHERE code='FAC-05'), 'material', 'mandatory'),
((SELECT id FROM taxonomy_facets WHERE code='FAC-05'), 'product', 'mandatory'),
((SELECT id FROM taxonomy_facets WHERE code='FAC-05'), 'building', 'mandatory'),

-- FAC-06 Phục vụ ai: ○ atom+molecule+compound, ★ material+
((SELECT id FROM taxonomy_facets WHERE code='FAC-06'), 'atom', 'optional'),
((SELECT id FROM taxonomy_facets WHERE code='FAC-06'), 'molecule', 'optional'),
((SELECT id FROM taxonomy_facets WHERE code='FAC-06'), 'compound', 'optional'),
((SELECT id FROM taxonomy_facets WHERE code='FAC-06'), 'material', 'mandatory'),
((SELECT id FROM taxonomy_facets WHERE code='FAC-06'), 'product', 'mandatory'),
((SELECT id FROM taxonomy_facets WHERE code='FAC-06'), 'building', 'mandatory');

5. LABEL_RULES — Collection rules (17 records, priority 10-50)

-- facet_id query thực tế. result_label = taxonomy code
INSERT INTO label_rules (name, facet_id, rule_type, condition, result_label, priority) VALUES
-- Vai trò per collection
('DOT tools → Công cụ', (SELECT id FROM taxonomy_facets WHERE code='FAC-02'), 'collection', '{"collection":"dot_tools"}', 'LBL-104', 10),
('DOT tools → Kiểm tra', (SELECT id FROM taxonomy_facets WHERE code='FAC-03'), 'collection', '{"collection":"dot_tools"}', 'LBL-203', 10),
('Workflows → Quy tắc', (SELECT id FROM taxonomy_facets WHERE code='FAC-02'), 'collection', '{"collection":"workflows"}', 'LBL-103', 10),
('Workflows → Toàn hệ thống', (SELECT id FROM taxonomy_facets WHERE code='FAC-04'), 'collection', '{"collection":"workflows"}', 'LBL-304', 10),
('Checkpoint types → Quy tắc', (SELECT id FROM taxonomy_facets WHERE code='FAC-02'), 'collection', '{"collection":"checkpoint_types"}', 'LBL-103', 10),
('System issues → Giám sát', (SELECT id FROM taxonomy_facets WHERE code='FAC-02'), 'collection', '{"collection":"system_issues"}', 'LBL-105', 10),
('Entity deps → Cấu trúc', (SELECT id FROM taxonomy_facets WHERE code='FAC-02'), 'collection', '{"collection":"entity_dependencies"}', 'LBL-101', 10),
('Comments → Nội dung', (SELECT id FROM taxonomy_facets WHERE code='FAC-02'), 'collection', '{"collection":"task_comments"}', 'LBL-102', 10),
('Modules → Cấu trúc', (SELECT id FROM taxonomy_facets WHERE code='FAC-02'), 'collection', '{"collection":"modules"}', 'LBL-101', 10),
('UI pages → Cấu trúc', (SELECT id FROM taxonomy_facets WHERE code='FAC-02'), 'collection', '{"collection":"ui_pages"}', 'LBL-101', 10),
('Collection registry → Cấu trúc', (SELECT id FROM taxonomy_facets WHERE code='FAC-02'), 'collection', '{"collection":"collection_registry"}', 'LBL-101', 10),
('Tasks → Nội dung', (SELECT id FROM taxonomy_facets WHERE code='FAC-02'), 'collection', '{"collection":"tasks"}', 'LBL-102', 10),
('Agents → Công cụ', (SELECT id FROM taxonomy_facets WHERE code='FAC-02'), 'collection', '{"collection":"agents"}', 'LBL-104', 10),
('Table registry → Cấu trúc', (SELECT id FROM taxonomy_facets WHERE code='FAC-02'), 'collection', '{"collection":"table_registry"}', 'LBL-101', 10),
('Checkpoint sets → Quy tắc', (SELECT id FROM taxonomy_facets WHERE code='FAC-02'), 'collection', '{"collection":"checkpoint_sets"}', 'LBL-103', 10),
('WCR → Nội dung', (SELECT id FROM taxonomy_facets WHERE code='FAC-02'), 'collection', '{"collection":"workflow_change_requests"}', 'LBL-102', 10),
('Workflow steps → Quy tắc', (SELECT id FROM taxonomy_facets WHERE code='FAC-02'), 'collection', '{"collection":"workflow_steps"}', 'LBL-103', 10);

6. LABEL_RULES — Keyword rules (15 records, priority 100-500)

INSERT INTO label_rules (name, facet_id, rule_type, condition, result_label, priority, skip_wide_warning) VALUES
-- Chuyên môn (FAC-01) keyword patterns → gán LEAF labels (con, không cha)
('KW: Hạ tầng', (SELECT id FROM taxonomy_facets WHERE code='FAC-01'), 'keyword', '{"name_pattern":"health|docker|vps|deploy|nginx|server|contabo"}', 'LBL-011', 100, false),
('KW: CI/CD', (SELECT id FROM taxonomy_facets WHERE code='FAC-01'), 'keyword', '{"name_pattern":"ci|cd|github.action|deploy|pipeline"}', 'LBL-013', 110, false),
('KW: PostgreSQL', (SELECT id FROM taxonomy_facets WHERE code='FAC-01'), 'keyword', '{"name_pattern":"pg|postgres|sql|trigger|view|cte|function"}', 'LBL-021', 120, false),
('KW: Directus', (SELECT id FROM taxonomy_facets WHERE code='FAC-01'), 'keyword', '{"name_pattern":"directus|collection|field|flow|permission"}', 'LBL-022', 130, true),
('KW: Giao diện', (SELECT id FROM taxonomy_facets WHERE code='FAC-01'), 'keyword', '{"name_pattern":"page|ui|table|registry|nav|layout|component"}', 'LBL-031', 140, true),
('KW: Workflow', (SELECT id FROM taxonomy_facets WHERE code='FAC-01'), 'keyword', '{"name_pattern":"workflow|step|process|approve|node"}', 'LBL-041', 150, false),
('KW: Checkpoint', (SELECT id FROM taxonomy_facets WHERE code='FAC-01'), 'keyword', '{"name_pattern":"check|verify|ensure|audit|scan|validate"}', 'LBL-051', 160, true),
('KW: AI', (SELECT id FROM taxonomy_facets WHERE code='FAC-01'), 'keyword', '{"name_pattern":"ai|agent|bridge|gateway|mcp|llm|gemini|gpt"}', 'LBL-061', 170, false),
('KW: Bảo mật', (SELECT id FROM taxonomy_facets WHERE code='FAC-01'), 'keyword', '{"name_pattern":"permission|auth|role|token|secret|security"}', 'LBL-071', 180, false),
-- Hành động (FAC-03) keyword patterns
('KW: Tạo mới', (SELECT id FROM taxonomy_facets WHERE code='FAC-03'), 'keyword', '{"name_pattern":"create|setup|init|generate|new|bootstrap"}', 'LBL-201', 200, false),
('KW: Kết nối', (SELECT id FROM taxonomy_facets WHERE code='FAC-03'), 'keyword', '{"name_pattern":"sync|connect|bridge|import|export|migrate"}', 'LBL-206', 210, false),
('KW: Báo cáo', (SELECT id FROM taxonomy_facets WHERE code='FAC-03'), 'keyword', '{"name_pattern":"report|alert|notify|log|summary|status"}', 'LBL-207', 220, false),
('KW: Xoá/dọn', (SELECT id FROM taxonomy_facets WHERE code='FAC-03'), 'keyword', '{"name_pattern":"delete|clean|remove|archive|purge|retire"}', 'LBL-205', 230, false),
('KW: Cập nhật', (SELECT id FROM taxonomy_facets WHERE code='FAC-03'), 'keyword', '{"name_pattern":"update|refresh|patch|fix|upgrade"}', 'LBL-204', 240, false),
('KW: Đọc/query', (SELECT id FROM taxonomy_facets WHERE code='FAC-03'), 'keyword', '{"name_pattern":"read|query|fetch|get|list|search|find"}', 'LBL-202', 250, false);

TÓM TẮT SỐ LIỆU

Collection Số records
taxonomy_facets 6
taxonomy (cha depth=0) 8 + 5 + 7 + 4 + 4 + 6 = 34
taxonomy (con depth=1) 20
taxonomy TỔNG 54
taxonomy_matrix 36
label_rules (collection) 17
label_rules (keyword) 15
label_rules TỔNG 32

Agent dùng SQL trên, thay facet_id bằng subquery (SELECT id FROM taxonomy_facets WHERE code='FAC-XX') và parent_id bằng (SELECT id FROM taxonomy WHERE code='LBL-XXX').