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

您好,昨天的效果是这样 连接关系好像不全呢?变电站-线路  线路-变电站  站房-线路 线路-站房  线路-线路 
线路-开关  开-线路 连接关系对这份数据应该是够的 但是不知道为什么关系不全
(base) PS C:\Users\GH-76\hugegraph-1.7.0> docker exec -it hugegraph-loader 
bin/hugegraph-loader.sh -g hugegraph -f /loader/power_data/struct_1.json -s 
/loader/power_data/schema_1.groovy -h server -p 8080
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in 
[jar:file:/loader/lib/log4j-slf4j-impl-2.18.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in 
[jar:file:/loader/lib/apache-hugegraph-loader-incubating-1.7.0-shaded.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in 
[jar:file:/loader/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will 
impact performance.
ERROR StatusLogger Reconfiguration failed: No configuration found for 'Default' 
at 'null' in 'null'
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by 
org.codehaus.groovy.reflection.CachedClass 
(file:/loader/lib/apache-hugegraph-loader-incubating-1.7.0-shaded.jar) to 
method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of 
org.codehaus.groovy.reflection.CachedClass
WARNING: Use --illegal-access=warn to enable warnings of further illegal 
reflective access operations
WARNING: All illegal access operations will be denied in a future release
>> HugeGraphLoader worked in NORMAL MODE
vertices/edges loaded this time : 81/642
--------------------------------------------------
count metrics
    input read success            : 188
    input read failure            : 0
    vertex parse success          : 81
    vertex parse failure          : 0
    vertex insert success         : 81
    vertex insert failure         : 0
    edge parse success            : 642
    edge parse failure            : 0
    edge insert success           : 642
    edge insert failure           : 0
--------------------------------------------------         
                      
                      
                      
                      
                 meter metrics 
                      
                      
                      
                      
                      
                      
                    &nb
 sp; total time                   
 : 0.324s                   
                      
                      
                      
                      
                   read time 
                    : 0.127s 
                      
                      
                      
                      
                  &nbs
 p;              
    load time                 
    : 0.197s
    vertex load time             
 : 0.122s
    vertex load rate(vertices/s)  : 663
    edge load time               
 : 0.075s
    edge load rate(edges/s)       : 8560
(base) PS C:\Users\GH-76\hugegraph-1.7.0> curl 
"http://localhost:8080/graphs/hugegraph/graph/vertices";       
                      
                      
           




StatusCode        : 200
StatusDescription : OK
Content           : 
{"vertices":[{"id":"7:BDZ-3002","label":"Substation","type":"vertex","properties":{"id":"BDZ-3002","name":"110kV变电站","objectType":"Substatio
Images            : {}
InputFields       : {}
Links             : {}
ParsedHtml        : mshtml.HTMLDocumentClass
RawContentLength  : 26666
         原始邮件
         
       
发件人:dosubot[bot] ***@***.***>
发件时间:2025年12月8日 16:39
收件人:apache/incubator-hugegraph ***@***.***>
抄送:wangzhewwzz ***@***.***>, Mention ***@***.***>
主题:Re: [apache/incubator-hugegraph] 关于电网拓扑数据导入 (Discussion #2917)




是的,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 
需要的那部分数据。例如:
{   "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 文件,方便后续扩展和维护。参考 官方文档

如有 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-15204010

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

Reply via email to