知识图谱 KG-代码配置模式:操作步骤

时间:2023-11-01 16:18:25

操作步骤

  1. 在普通配置构建图谱页面,单击“知识映射”,页面下方弹出“知识映射”对话框,单击右侧按钮可以放大对话框。
    图1 知识映射
  2. “编辑方式”选择“代码配置模式”
  3. “代码配置模式”页签的编辑框中,输入json格式代码,以映射关系如图2为例,代码示例如下所示:
    图2 实体人物的映射关系
    {  "label_map_configs": {    "Film": "电影",    "Person": "人物"  },  "property_map_configs": [    {      "label": "电影",      "source_keys": [        "票房"      ],      "target_key": "票房"    },    {      "label": "电影",      "source_keys": [        "中文名"      ],      "target_key": "name"    },    {      "label": "电影",      "source_keys": [        "上映时间"      ],      "target_key": "haha"    },    {      "label": "人物",      "source_keys": [        "中文名"      ],      "target_key": "name"    },    {      "label": "人物",      "source_keys": [        "国籍"      ],      "target_key": "国籍"    },    {      "label": "人物",      "source_keys": [        "职业"      ],      "target_key": "职业"    },    {      "label": "人物",      "source_keys": [        "出生日期"      ],      "target_key": "出生日期"    }  ],  "relation_map_configs": [    {      "source_label": "电影",      "target_key": "电影:主演:人物",      "source_keys": [        "中文名",        "主演",        "导演"      ],      "target_label": "人物"    },    {      "source_label": "电影",      "target_key": "电影:导演:人物",      "source_keys": [        "中文名",        "主演",        "导演"      ],      "target_label": "人物"    }  ]}
  4. 单击“保存”,完成配置知识映射。
support.huaweicloud.com/usermanual-kg/kg_01_0054.html