{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "人物关系边数据规范",
  "description": "关系边存于 data/relations/ 下，按时期/批次分文件，每个文件是边的数组。方向语义：from 是关系主体，type 描述 from 对 to 的关系（如 from=萧何, to=韩信, type=举荐）。同一对人物可有多条边。",
  "type": "array",
  "items": {
    "type": "object",
    "required": ["from", "to", "category", "type", "description", "sources"],
    "properties": {
      "from": { "type": "string", "description": "关系主体的人物 id" },
      "to": { "type": "string", "description": "关系对象的人物 id" },
      "category": {
        "type": "string",
        "enum": ["亲缘", "政治", "恩怨", "师承"],
        "description": "关系大类，用于图谱边着色"
      },
      "type": {
        "type": "string",
        "description": "关系类型，封闭集合：亲缘=[夫妻,父母,子女,兄弟姐妹,宗族]；政治=[君臣,上下级,举荐,敌对,背叛,同盟]；恩怨=[知交,救援,诛杀]；师承=[师承]（大类「师承」2026-09-09 新增：知识/技艺/法的传授谱系，方向 from=师、to=徒；同学/同门不入此型）。君臣限帝王/诸侯王/执政太后为君；双方皆非君主的统属关系（辟除/为司马/部曲/遣使）用上下级。适用指引（2026-09-18）：篡位/禅让按受禅前关系建「君臣」（如 刘协→曹丕），不用背叛；非夫妻的联姻（翁婿/舅甥等）归「宗族」；双方皆非君主的名义通好/遣使输款用「上下级」不用同盟。每条边必须挂得住一个具体事件或事实；同僚/同时代/同地域等次要关系不入边"
      },
      "description": { "type": "string", "description": "关系说明，一两句话；只写史实本身，批次归属等编务注记写批次汇报、不写进数据" },
      "year": { "type": ["integer", "null"], "description": "关系形成/发生年份；不适用或不详为 null" },
      "event": {
        "type": ["string", "null"],
        "description": "可选：挂接 data/events.json 中的事件 id，作为本边对应的证据事件（如 玄武门之变）。必须命中 events.json 已有 id，build.py 校验；挂不上具体事件的边留空"
      },
      "sources": {
        "type": "array",
        "items": {
          "oneOf": [
            { "type": "string", "description": "简写形式，默认视为原始史料" },
            {
              "type": "object",
              "required": ["text"],
              "properties": {
                "text": { "type": "string" },
                "tier": { "type": "string", "enum": ["原始史料", "出土文献", "后世研究", "百科网络"] },
                "url": { "type": "string" }
              }
            }
          ]
        },
        "description": "史料出处，写法与 person 的 sources 一致"
      }
    }
  }
}
