GitHub user wangzhewwzz added a comment to the discussion: 关于电网拓扑数据导入
也请您看一下 我json里面的每个"label": { "CONNECTED_TO": "LineSegment2LineSegment" },
"source_label": { "LineSegment": "LineSegment" },
"target_label": { "LineSegment": "LineSegment" } 是否理解的有误
原始邮件
发件人:dosubot[bot] ***@***.***>
发件时间:2025年12月9日 11:19
收件人:apache/incubator-hugegraph ***@***.***>
抄送:wangzhewwzz ***@***.***>, Mention ***@***.***>
主题:Re: [apache/incubator-hugegraph] 关于电网拓扑数据导入 (Discussion #2917)
你的 struct.json 配置还不能保证所有连接关系都能导入,原因是 HugeGraph 的每个 edgeLabel 只能连接一种源点和目标点类型,且
struct.json 里每个 edgeLabel 的配置会尝试导入整个 edge_connected_to.csv,但只有源/目标顶点 label 和
schema.groovy 里 edgeLabel 的 sourceLabel/targetLabel
完全匹配时才会真正导入成功,否则会被静默跳过(不会报错,但关系缺失)参考。
你的配置只覆盖了部分边类型,像
LineSegment2LineSegment、LineSegment2LineSwitch、LineSwitch2LineSegment
等常见的电网关系没有在 struct.json 里补全,所以这些类型的连接不会被导入。即使 edge_connected_to.csv
里有这些数据,loader 也会因为 label 不匹配 schema 而跳过。
建议做法:
明确所有需要的边类型组合,比如:
Substation2LineSegment
LineSegment2Substation
LineSegment2StationHouse
StationHouse2LineSegment
LineSegment2LineSegment
LineSegment2LineSwitch
LineSwitch2LineSegment
StationHouse2LineSwitch
LineSwitch2StationHouse
schema.groovy 里为每种类型的连接都定义 edgeLabel,sourceLabel/targetLabel 必须和顶点 label 一致。
struct.json 里 edges 部分为每个 edgeLabel 配置一段,source/target 字段和顶点主键一致,value_mapping
只需把 label 字段映射为 edgeLabel 名称(如 "CONNECTED_TO": "LineSegment2LineSegment")。
edge_connected_to.csv 建议增加 source_label/target_label 字段(或用脚本拆分),这样每个 edgeLabel
配置时可以用 selected/value_mapping 精确筛选出属于自己的那部分边,避免类型不匹配被跳过。
举例:
{ "label": "LineSegment2LineSegment", "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" }, "selected":
["from", "to"], "value_mapping": { "label": {
"CONNECTED_TO": "LineSegment2LineSegment" }, "source_label": {
"LineSegment": "LineSegment" }, "target_label": { "LineSegment":
"LineSegment" } } }
每种类型的边都要写一段,path 可以都指向同一个 CSV 文件。
核心要点:每个 edgeLabel 只能导入一种类型的连接,必须保证 struct.json 里每个 edgeLabel
配置只处理属于自己的那部分边,否则会被跳过,导致连接关系不全。loader 的“成功”只代表数据格式没错,不代表所有逻辑关系都建立了官方文档说明。
如需具体 struct.json/schema.groovy 模板或数据预处理脚本,可以补充你的需求。
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose |
Hallucination | Report 🐛 | Other
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.
GitHub link:
https://github.com/apache/incubator-hugegraph/discussions/2917#discussioncomment-15204322
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]