火花图上的 Gremlin 遍历查询
Gremlin traversal queries on spark graph
我已经使用 Apache Spark Graphx 框架从 s3 构建了一个 属性 图(6000 万个节点,4000 万个边)。
我想在此图上触发遍历查询。
我的查询将是这样的:-
g.V().has("name","xyz").out('parent').out().has('name','abc')
g.V().has('proc_name','serv.exe').out('file_create').
has('file_path',containing('Tsk04.txt')).in().in('parent').values('proc_name')
g.V().has('md5','935ca12348040410e0b2a8215180474e').values('files')
大部分查询的格式为 g.V().out().out().out()
在 neo4j、titan、aws neptune 等图形数据库上很容易实现此类查询,因为它们支持 gremlin。
我们能以这种方式遍历火花图吗?
我试过 spark pregel-api 但与 gremlin 相比它有点复杂。
我正在寻找 spark graph 的原因是因为上述 graphdbs 的云解决方案成本很高。
Spark GraphFrames 库对您来说应该是最方便的。它提供了类似 neo4j-cypher 的遍历描述,并使用 Spark DataFrames api 进行过滤
https://graphframes.github.io/graphframes/docs/_site/user-guide.html#motif-finding
这是一个例子:
val g2: GraphFrame = GraphFrame.fromGraphX(gx) // you can start with just V and E DataFrames here
val motifs: GraphFrame = g.find("(a)-[e]->(b); (b)-[e2]->(c)")
motifs.filter("a.name = 'xyz' and e.label = 'parent' and c.name = 'abc'").show()
TinkerPop 本身具有 spark 支持,因此您可以从 gremlin 控制台发出 spark OLAP 查询
https://tinkerpop.apache.org/docs/current/reference/#sparkgraphcomputer
或者有一些闭源的解决方案。 Datastax Enterprise Database 对 spark 有很好的 Gremlin 支持:https://www.datastax.com/blog/2017/05/introducing-dse-graph-frames
我是它的前作者
我已经使用 Apache Spark Graphx 框架从 s3 构建了一个 属性 图(6000 万个节点,4000 万个边)。 我想在此图上触发遍历查询。
我的查询将是这样的:-
g.V().has("name","xyz").out('parent').out().has('name','abc')
g.V().has('proc_name','serv.exe').out('file_create').
has('file_path',containing('Tsk04.txt')).in().in('parent').values('proc_name')
g.V().has('md5','935ca12348040410e0b2a8215180474e').values('files')
大部分查询的格式为 g.V().out().out().out()
在 neo4j、titan、aws neptune 等图形数据库上很容易实现此类查询,因为它们支持 gremlin。
我们能以这种方式遍历火花图吗? 我试过 spark pregel-api 但与 gremlin 相比它有点复杂。
我正在寻找 spark graph 的原因是因为上述 graphdbs 的云解决方案成本很高。
Spark GraphFrames 库对您来说应该是最方便的。它提供了类似 neo4j-cypher 的遍历描述,并使用 Spark DataFrames api 进行过滤
https://graphframes.github.io/graphframes/docs/_site/user-guide.html#motif-finding
这是一个例子:
val g2: GraphFrame = GraphFrame.fromGraphX(gx) // you can start with just V and E DataFrames here
val motifs: GraphFrame = g.find("(a)-[e]->(b); (b)-[e2]->(c)")
motifs.filter("a.name = 'xyz' and e.label = 'parent' and c.name = 'abc'").show()
TinkerPop 本身具有 spark 支持,因此您可以从 gremlin 控制台发出 spark OLAP 查询 https://tinkerpop.apache.org/docs/current/reference/#sparkgraphcomputer
或者有一些闭源的解决方案。 Datastax Enterprise Database 对 spark 有很好的 Gremlin 支持:https://www.datastax.com/blog/2017/05/introducing-dse-graph-frames 我是它的前作者