GitHub user wangzhewwzz added a comment to the discussion: 关于电网拓扑数据导入
好的
"value_mapping": { "label": { "CONNECTED_TO":
"LineSegment2StationHouse" }, "source_label": { "LineSegment":
"LineSegment" }, "target_label": { "StationHouse": "StationHouse"
} }
上面这个value_mapping我理解了,还有一点没理解edge_connected_to.csv文件中后面需要添加两列,列表头是source_label和target_label
但是对应列队内容是填写什么?
原始邮件
发件人:dosubot[bot] ***@***.***>
发件时间:2025年12月9日 12:21
收件人:apache/incubator-hugegraph ***@***.***>
抄送:wangzhewwzz ***@***.***>, Mention ***@***.***>
主题:Re: [apache/incubator-hugegraph] 关于电网拓扑数据导入 (Discussion #2917)
你的 struct.json 和 schema.groovy 配置思路是对的,但要确保所有连接关系都能导入,必须做到以下几点:
edge_connected_to.csv 必须有 source_label 和 target_label 两列,并且内容要和 schema.groovy
里顶点的 label 完全一致(比如 LineSegment、StationHouse、LineSwitch、Substation
等),否则边会被跳过但不会报错(官方文档说明)。
struct.json 里每个 edgeLabel(比如
Substation2LineSegment、LineSegment2StationHouse、LineSegment2LineSegment、LineSegment2LineSwitch、LineSwitch2LineSegment、StationHouse2LineSwitch、LineSwitch2StationHouse
等)都要写一段,value_mapping 里的 label/source_label/target_label 必须和 schema.groovy 里的
edgeLabel、sourceLabel、targetLabel 完全一致。
你的 edge_connected_to.csv 目前只有 from、to、label,没有 source_label/target_label,建议用脚本或
Excel 增加这两列,内容要和 from/to 对应的顶点类型一致(比如 from=XLD-3445 就查
vertex_linesegment-1.csv,类型是 LineSegment)。
只有这样,struct.json 的 value_mapping 才能精确筛选属于自己的那部分边,否则 loader 会尝试导入所有行,但只有
label、source_label、target_label 都匹配 schema 才会真正导入,其他会被静默跳过。
导入后建议用 REST API 查询各类边的数量和类型,确认所有关系都齐全。
举例(以 LineSegment2StationHouse 为例):
{ "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 配置,我可以帮你逐条检查。
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-15204447
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]