Neo4j导出树 [英] Neo4j export Tree
问题描述
我想导出一个具有不同根节点的树.我使用gremlin(g.saveGraphML("export.graphml"))进行了尝试,但这将导出整个数据库.然后我用gv(783095).saveGraphML("export.graphml")尝试了一下,这给了我一个错误(方法没有签名:java.util.HashMap.saveGraphML()适用于参数类型:(java.lang.String )值:[export.graphml])
I want to export a Tree which has a distinct root node. I tried it with gremlin (g.saveGraphML("export.graphml")) but this is exporting the whole database. Then I tried it with g.v(783095).saveGraphML("export.graphml") which gave me an error (No signature of method: java.util.HashMap.saveGraphML() is applicable for argument types: (java.lang.String) values: [export.graphml])
有什么想法吗?
推荐答案
尝试将g的子图创建为临时图结构,然后保存该图.
Try to create a subgraph of g into a temporary graph structure and then save that one.
g = new Neo4jGraph('/tmp/mygraph')
h = new TinkerGraph()
// some algorithm to map a subset of g to h
h.saveGraphML('subgraph.xml')
否则,使用gremlin创建类似 geoff 的图形表示应该相当容易,因为它只是json并且应该易于(反)序列化.
Otherwise it should be fairly easy to use gremlin to create a graph representation like geoff because it is just json and should be easy to (de)-serialize.
这篇关于Neo4j导出树的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!