火花图上的克里姆林宫遍历查询

问题描述 投票:0回答:1

我使用Apache Spark Graphx框架从s3构建了一个属性图(6000万个节点,4000万个边)。我想在该图上触发遍历查询。

我的查询将是:-

g.V()。has(“ name”,“ xyz”)。out('parent')。out()。has('name','abc')

gV()。has('proc_name','serv.exe')。out('file_create')。has('file_path',contains('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相比有点复杂。

我正在寻找火花图的原因是因为上述graphdbs的云解决方案成本很高。

apache-spark gremlin spark-graphx graphdb
1个回答
0
投票

spark graphframes库应该对您来说最方便。它提供类似neo4j的遍历描述,并使用spark数据帧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()

TnokerPop它本身具有火花支持,因此您可以从gremlin控制台发出火花OLAP查询https://tinkerpop.apache.org/docs/current/reference/#sparkgraphcomputer

或者有一些近源解决方案。 Datastax企业数据库对Spark具有良好的Gremlin支持:https://www.datastax.com/blog/2017/05/introducing-dse-graph-frames我曾经是它的作者

© www.soinside.com 2019 - 2024. All rights reserved.