GitHub user dosubot[bot] edited a comment on the discussion: 关于电网拓扑数据导入
<!-- Answer --> 你的理解是对的,struct.json 里所有 "edges" 的 path 字段都可以指向同一个 edge_connected_to.csv 文件,只要 field_mapping、source、target 配置和顶点主键字段一致即可。每个 edgeLabel 的配置会从这个文件读取数据,通过 value_mapping 或 selected 过滤出当前 edgeLabel 需要的边类型,无需拆分多个 CSV 文件,官方文档和社区案例都推荐这种做法 [参考](https://github.com/apache/incubator-hugegraph-doc/blob/master/content/cn/docs/quickstart/toolchain/hugegraph-loader.md) [案例](https://github.com/apache/incubator-hugegraph/issues/2749)。 举例:假设 edge_connected_to.csv 结构如下: ``` id,from,to,label edge_1,BDZ-3002,XLD-3445,CONNECTED_TO edge_2,XLD-3445,HWX-3087,CONNECTED_TO ... ``` struct.json 里可以这样写(以 LineSegment2LineSegment 为例): ```json { "label": "LineSegment2LineSegment", "source": ["from"], "target": ["to"], "input": { "type": "file", "path": "/loader/power_data/edge_connected_to.csv", "format": "CSV", "header": ["id", "from", "to", "label"] }, "field_mapping": { "from": "id", "to": "id" }, "selected": ["from", "to"], "value_mapping": { "label": { "CONNECTED_TO": "LineSegment2LineSegment" } } } ``` 如果你有多个 edgeLabel(比如 Substation2LineSegment、LineSegment2StationHouse 等),每个 edgeLabel 都写一段类似配置,path 都指向同一个 CSV 文件,只需用 value_mapping 或 selected 过滤出对应类型的边即可。 注意事项: - field_mapping 的 from/to 要和顶点主键字段一致(比如都是 id)。 - value_mapping 里的 "label" 字段要和 CSV 里的 label 列内容对应。 - 如果 CSV 没有区分类型的字段,建议加一列 type 或 label,便于后续扩展和维护。 - 如果只用一个 edgeLabel(比如 CONNECTED_TO),那只需配置一次即可。 如需具体 struct.json 配置模板或遇到导入问题,可以把你的 struct.json 发出来,我可以帮你检查。 <!-- 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).* --- Docs are dead. Just use [Dosu](https://dosu.dev?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-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=static-docs-feedback&utm_term=apache%2Fhugegraph#message_id=19a20f72-cd4a-44c7-ac5f-7e5826be3945) [](https://github.dosu.com/apache/hugegraph?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-ask-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=static-docs-share-team&utm_term=apache%2Fhugegraph) GitHub link: https://github.com/apache/hugegraph/discussions/2917#discussioncomment-15193586 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected]
