GitHub user dosubot[bot] edited a comment on the discussion: 关于电网拓扑数据导入
<!-- Answer -->
是的,struct.json 里 "edges" 部分的 path 字段完全可以都指向你提供的
`/loader/power_data/edge_connected_to.csv`,只要 field_mapping、source/target
字段和顶点主键一致即可。每个 edgeLabel 的配置会从这个文件读取数据,Loader 会根据你在 struct.json 里配置的
label、source、target、field_mapping 等信息,导入对应的边。
如果你的 edge_connected_to.csv 里包含了所有类型的边(比如不同类型的节点之间的连接),你可以在 struct.json 里为每个
edgeLabel 分别配置一段,path 都指向同一个文件,然后用 selected 或 value_mapping 过滤出当前 edgeLabel
需要的那部分数据。例如:
```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"
}
}
}
```
如果你不区分 label,所有边都用同一个 edgeLabel(比如 CONNECTED_TO),那只需要配置一次即可。如果需要区分不同类型的边(比如
Substation2LineSegment、LineSegment2StationHouse 等),建议在 edge_connected_to.csv
里加一列类型,然后用 value_mapping 或 selected 过滤。
官方文档和社区案例都支持这种做法,只要配置正确,不需要拆成多个 CSV
文件,方便后续扩展和维护。[参考](https://github.com/apache/incubator-hugegraph/issues/2749)
[官方文档](https://github.com/apache/incubator-hugegraph-doc/blob/3e1c610281c91ea3a5c600b393088e9ffae34799/content/en/docs/quickstart/toolchain/hugegraph-loader.md#L323-L974)
如有 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=d5463c68-ef16-4789-8504-44512711261d)
[](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-15193370
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]