GitHub user wangzhewwzz added a comment to the discussion: 关于电网拓扑数据导入

我后面的补全是这样补的哈?那我导入试试看


         原始邮件
         
       
发件人:dosubot[bot] ***@***.***>
发件时间:2025年12月8日 16:59
收件人:apache/incubator-hugegraph ***@***.***>
抄送:wangzhewwzz ***@***.***>, Mention ***@***.***>
主题:Re: [apache/incubator-hugegraph] 关于电网拓扑数据导入 (Discussion #2917)




你的理解是对的,struct.json 里所有 "edges" 的 path 字段都可以指向同一个 edge_connected_to.csv 文件,只要 
field_mapping、source、target 配置和顶点主键字段一致即可。每个 edgeLabel 的配置会从这个文件读取数据,通过 
value_mapping 或 selected 过滤出当前 edgeLabel 需要的边类型,无需拆分多个 CSV 文件,官方文档和社区案例都推荐这种做法 
参考 案例。

举例:假设 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 为例):
{   "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 发出来,我可以帮你检查。

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-15193599

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to