对于支持Gremlin语法的图数据库,可以通过Gephi中的Graph Streaming插件将输入导入到Gephi中,进行数据可视化展示。
在这里不在介绍通过Gremlin连接JanusGraph数据库的部分了,主要讲解Graph Streaming插件的使用。
Graph Streaming
点击进行安装。安装完成后在左下方的菜单栏会显示Streaming
的选项卡
# 查看使用的插件列表
gremlin> :plugin list
==>janusgraph.imports[active]
==>tinkerpop.server[active]
==>tinkerpop.gephi
==>tinkerpop.utilities[active]
==>tinkerpop.sugar
==>tinkerpop.credentials
==>tinkerpop.hadoop[active]
==>tinkerpop.spark[active]
==>tinkerpop.tinkergraph[active]
# 使用 tinkerpop.gephi 插件
gremlin> :plugin use tinkerpop.gephi
==>tinkerpop.gephi activated
gremlin> :plugin list
==>janusgraph.imports[active]
==>tinkerpop.server[active]
==>tinkerpop.gephi[active]
==>tinkerpop.utilities[active]
==>tinkerpop.sugar
==>tinkerpop.credentials
==>tinkerpop.hadoop[active]
==>tinkerpop.spark[active]
==>tinkerpop.tinkergraph[active]
# 创建简单的 Modern 图
gremlin> graph = TinkerFactory.createModern()
==>tinkergraph[vertices:6 edges:6]
# 连接到 tinkerpop.gephi 插件
gremlin> :remote connect tinkerpop.gephi
==>Connection to Gephi - http://localhost:8080/workspace1 with stepDelay:1000, startRGBColor:[0.0, 1.0, 0.5], colorToFade:g, colorFadeRate:0.7, startSize:10.0,sizeDecrementRate:0.33
gremlin> :> graph
Connect to localhost:8080 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused (Connection refused)
# 连接到 tinkerpop.gephi 插件,设置port值
gremlin> :remote connect tinkerpop.gephi
==>Connection to Gephi - http://localhost:8080/workspace1 with stepDelay:1000, startRGBColor:[0.0, 1.0, 0.5], colorToFade:g, colorFadeRate:0.7, startSize:10.0,sizeDecrementRate:0.33
gremlin> :remote config port 8088
==>Connection to Gephi - http://localhost:8088/workspace1 with stepDelay:1000, startRGBColor:[0.0, 1.0, 0.5], colorToFade:g, colorFadeRate:0.7, startSize:10.0,sizeDecrementRate:0.33
gremlin> :> graph
==>tinkergraph[vertices:6 edges:6]
==>false
至此,图数据库中的数据已经导入到Gephi中。