GitHub user dosubot[bot] edited a comment on the discussion: 关于电网拓扑数据导入
<!-- Answer --> 你的 struct_1.json 里 edges 的 field_mapping 还是写成了 `"from": "id", "to": "id"`,这会导致 loader 把 edge CSV 的 id 列当作边属性导入,但 schema.groovy 的 edgeLabel 没有声明 id 属性,所以报错 “Make sure the primary key fields [id] are not empty, or check whether the headers or field_mapping are configured correctly” 或 “Invalid property 'id' for edge label”[参考](https://github.com/apache/incubator-hugegraph-doc/blob/master/content/en/docs/quickstart/toolchain/hugegraph-loader.md#L705-L1064)。 **正确做法:** - struct_1.json 的 edges 部分 field_mapping 必须全部为: ```json "field_mapping": { "from": "from", "to": "to" } ``` 不能有 id。 - edgeLabel 的 .properties() 只包含 "source_label", "target_label",不要加 "id"。 - value_mapping 必须是平铺结构(你现在的写法没问题)。 - edge_connected_to.csv 的 source_label/target_label 必须和顶点 label 完全一致(区分大小写)。 **请你把 struct_1.json 里所有 edges 的 field_mapping 全部改成上面这样(只写 from/to),不要写 id,其他配置不用动。** 如果还有报错,请贴出 edge_connected_to.csv 的 header 和前几行原始数据,以及 struct.json 某个 edges 配置的完整内容,我可以帮你定位具体是哪一行或哪一列有问题。 只要这几点全部做到,边就能正常导入且无报错,所有关系都能导入。详细机制见[官方FAQ](https://github.com/apache/incubator-hugegraph-doc/blob/master/content/en/docs/guides/faq.md)。 <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=reply-with-mention&utm_term=apache%2Fhugegraph).* --- Share context across your team and agents. Try [Dosu](https://dosu.dev?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-tagline&utm_term=apache%2Fhugegraph). [](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-feedback&utm_term=apache%2Fhugegraph#message_id=0313c682-65d8-442e-83c2-bb25f2fdd748) [](https://github.dosu.com/apache/hugegraph?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-learn-repo&utm_term=apache%2Fhugegraph) [](https://app.dosu.dev/signup?referrer=openSource&source=github-footer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-add-team&utm_term=apache%2Fhugegraph) GitHub link: https://github.com/apache/hugegraph/discussions/2917#discussioncomment-15226313 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected]
