GitHub user dosubot[bot] edited a comment on the discussion: 关于电网拓扑数据导入
<!-- Answer --> 你的 struct.json 和 schema.groovy 配置思路是对的,但要确保所有连接关系都能导入,必须做到以下几点: 1. edge_connected_to.csv 必须有 source_label 和 target_label 两列,并且内容要和 schema.groovy 里顶点的 label 完全一致(比如 LineSegment、StationHouse、LineSwitch、Substation 等),否则边会被跳过但不会报错([官方文档说明](https://github.com/apache/incubator-hugegraph-doc/blob/3e1c610281c91ea3a5c600b393088e9ffae34799/content/en/docs/quickstart/toolchain/hugegraph-loader.md#L139-L1100))。 2. struct.json 里每个 edgeLabel(比如 Substation2LineSegment、LineSegment2StationHouse、LineSegment2LineSegment、LineSegment2LineSwitch、LineSwitch2LineSegment、StationHouse2LineSwitch、LineSwitch2StationHouse 等)都要写一段,value_mapping 里的 label/source_label/target_label 必须和 schema.groovy 里的 edgeLabel、sourceLabel、targetLabel 完全一致。 3. 你的 edge_connected_to.csv 目前只有 from、to、label,没有 source_label/target_label,建议用脚本或 Excel 增加这两列,内容要和 from/to 对应的顶点类型一致(比如 from=XLD-3445 就查 vertex_linesegment-1.csv,类型是 LineSegment)。 4. 只有这样,struct.json 的 value_mapping 才能精确筛选属于自己的那部分边,否则 loader 会尝试导入所有行,但只有 label、source_label、target_label 都匹配 schema 才会真正导入,其他会被静默跳过。 5. 导入后建议用 REST API 查询各类边的数量和类型,确认所有关系都齐全。 举例(以 LineSegment2StationHouse 为例): ```json { "label": "LineSegment2StationHouse", "source": ["from"], "target": ["to"], "input": { "type": "file", "path": "/loader/power_data/edge_connected_to.csv", "format": "CSV", "header": ["id", "from", "to", "label", "source_label", "target_label"] }, "field_mapping": { "from": "id", "to": "id" }, "value_mapping": { "label": { "CONNECTED_TO": "LineSegment2StationHouse" }, "source_label": { "LineSegment": "LineSegment" }, "target_label": { "StationHouse": "StationHouse" } } } ``` 每种类型的边都要写一段,path 可以都指向同一个 CSV 文件。 **建议你先检查 edge_connected_to.csv 是否有 source_label/target_label 字段,且内容和顶点 label 一致,再检查 struct.json 里每个 edgeLabel 的 value_mapping 是否和 schema.groovy 完全一致。** 如还有问题,可以贴出一小段 edge_connected_to.csv(含 source_label/target_label)和 struct.json 的完整 edge 配置,我可以帮你逐条检查。 <!-- 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=dc658f2e-02bd-4ab1-abab-01afe84e26ff) [](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-15204416 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected]
