0
我想將子圖導出到json文件並在其他圖中導入。我試過如下:將子圖(sideeffect)導出到json文件並導入圖中
gremlin> subGraph = g.V().has("name","john").outE("has").subgraph("subgraph").cap("subgraph").next()
==>tinkergraph[vertices:6 edges:5]
現在我有子圖對象,然後我用graphson直接寫入此子對象的JSON文件,如下所示:
subGraph.io(GraphSONIo.build()).writeGraph("/tmp/subgraph.json")
但我得到的錯誤是這樣的:
(was java.lang.IllegalStateException) (through reference chain: com.thinkaurelius.titan.graphdb.relations.RelationIdentifier["inVertexId"])
什麼問題?
我使用泰坦1.0和圖形對象是使用'圖= TitanFactory.open泰坦圖(」 ../ conf/titan-cassandra.properties「)'當用上面的gremlin查詢創建子圖時,它給出'TinkerGraph'對象? 那麼我們可以創建子圖作爲泰坦圖對象嗎? –
我試過你的代碼在gremlin它給mapper對象的錯誤爲'沒有這樣的屬性:TitanGraphSONModule類:groovysh_evaluate' –
是的,子圖是內存中的TinkerGraph,即使你的主圖是泰坦。通常情況下,這通常很有意義,因爲您通常不想保留子圖。我不記得你是否可以在1.0版中使用Titan的子圖 - 我認爲這很快會作爲TinkerPop的一個特性加入。至於你的錯誤,我想你可能需要將這個類導入到控制檯 - 你可以在這裏找到包名:https://github.com/thinkaurelius/titan/blob/1.0.0/titan-core/src/主/ JAVA/COM/thinkaurelius /鈦/ graphdb/TinkerPop有關/ IO/graphson/TitanGraphSONModule.java –