4

使用後に Neo4J グラフに戻る方法

g = new TinkerGraph() 

みたいな感じかな

g.loadGraphML(...)

編集:

あなたの答えは、loadGraphML() がどのように機能するかをよりよく理解するのに役立ちましたが、私の問題は解決しませんでした。

質問を言い換えます。私は Neo4j と Gremlin を使用しています。最初にサーバーを起動すると、Gremlin コンソールの下に次の行が表示されます。

==> Available variables:
==>   g = neo4jgraph[EmbeddedGraphDatabase [/home/user/software/neo4j-community-1.5.M01/data/graph.db]]

次に、入力します

gremlin> g = TinkerGraphFactory.createTinkerGraph()
==> tinkergraph[vertices:6 edges:6]

しかし、どうすれば「g = neo4jgraph[EmbeddedGraphDatabase [/home/user/software/neo4j-community-1.5.M01/data/graph.db]]」に戻ることができますか?

4

2 に答える 2

2

gremlinコンソール内で、次のように入力できるはずです。g = new Neo4jGraph( "/ home / path_to_your_neo4j / data /graph.db")

これがあなたの質問に答えるかどうか教えてください。

于 2012-10-12T18:01:11.663 に答える
2

I don't fully understand your question, but I believe you mean that you have done some work with TinkerGraph and you want to import that data into Neo4jGraph? Moreover, given that you are doing g.loadGraphML(...), I will assume you are talking about doing this from Gremlin. If not, please use the respective GraphMLReader/Writer classes provided by Blueprints.

gremlin> g
==>tinkergraph[vertices:6 edges:6]
gremlin> g.V
==>v[3]
==>v[2]
==>v[1]
==>v[6]
==>v[5]
==>v[4]
gremlin> h = new Neo4jGraph('/tmp/test')
==>neo4jgraph[EmbeddedGraphDatabase [/tmp/test]]
gremlin> g.saveGraphML('test.xml') 
==>null
gremlin> h.loadGraphML('test.xml')
gremlin> h.V
==>v[1]
==>v[2]
==>v[3]
==>v[4]
==>v[5]
==>v[6]

In short, you can output your graph to GraphML from TinkerGraph and then load it up into Neo4jGraph via the loadGraphML() method. There is a GraphMigrator tool in Blueprints that you might be interested---see the Blueprints JavaDoc for more information.

于 2011-09-26T17:26:14.050 に答える