我在下面的gremlin命令。它可以正常工作。如何將csv文件加載到janusgraph(addVertex和addEdge)?
new File(「data/1a78de40-8f0a-1028-9c9e-db07163b51b2.csv」)。eachLine {l-> p = l.split(「,」); v1 = gV()。has('uuid 」,p [0])?: graph.addVertex( 'uuid是',p [0]); V2 = GV()已( 'uuid是',p [1])?: graph.addVertex( 'uuid是', p [1]);}
但以下不能很好地工作。
new File(「data/1a78de40-8f0a-1028-9c9e-db07163b51b2.csv」)。eachLine {l-> p = l.split(「,」); v1 = gV()。has('uuid 」,p [0])?: graph.addVertex( 'uuid是',p [0]); V2 = GV()已( 'uuid是',p [1])?: graph.addVertex( 'uuid是', p [1]); v1.addEdge(對[4],V2)}
錯誤是在這裏:
的gremlin>新文件(「數據/ 1a78de40-8f0a-1028-9c9e-db07163b51b2.csv 「).eachLine {1-> p = l.split(」,「); V1 = GV()具有( 'uuid是',p [0])?: graph.addVertex( 'uuid是',p [0]。 ); v2 = gV()。has('uuid',p [1])?: graph.addVertex('uuid',p [1]); v1.addEdge(p [4],v2)}
21:30:12 WARN org.janusgraph.graphdb.transaction .StandardJanusGraphTx - 查詢需要迭代所有頂點[(uuid = 1a78de40-8f0a-1028-9c9e-db07163b51b2)]。爲了獲得更好的性能,使用索引 21:30:12 WARN org.janusgraph.graphdb.transaction.StandardJanusGraphTx - 查詢需要迭代所有頂點[(uuid = d803d140-8f0a-1028-98de-db07163b51b2)]。爲了獲得更好的性能,請使用索引 21:30:12 WARN org.janusgraph.graphdb.transaction.StandardJanusGraphTx - 查詢需要迭代所有頂點[(uuid = 1a78de40-8f0a-1028-9c9e-db07163b51b2)]。爲了獲得更好的性能,請使用索引 21:30:12 WARN org.janusgraph.graphdb.transaction.StandardJanusGraphTx - 查詢需要迭代所有頂點[(uuid = 92df9f40-8f0a-1028-8723-db07163b51b2)]。爲了獲得更好的性能,請使用索引 沒有方法的簽名:org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.DefaultGraphTraversal.addEdge()適用於參數類型:(java.lang.String,org.janusgraph。 graphdb.vertices.StandardVertex)值:[CommunitiesMember,v [122908672]] 輸入':help'或':h'尋求幫助。 顯示堆棧跟蹤? [YN]
CSV文件是如下: 1a78de40-8f0a-1028-9c9e-db07163b51b2,d803d140-8f0a-1028-98de-db07163b51b2,2012-09-18T08:56:01Z,1,CommunitiesMember 1a78de40- 8f0a-1028-9c9e-db07163b51b2,92df9f40-8f0a-1028-8723-db07163b51b2,2012-09-18T08:56:01Z,1,CommunitiesMember 1a78de40-8f0a-1028-9c9e-db07163b51b2,281edc40-3c20-102c-9a69- 980191c9f99a,2012-09-18T08:56:01Z,1,CommunitiesMember 1a78de40-8f0a-1028-9c9e-db07163b51b2,878c73c0-8f0a-1028-91a1-db07163b51b2,2012-09-18T08:56:01Z,1,CommunitiesMember 1a78de40-8f0a-1028-9c9e-db07163b51b2,5427d240-9f1e-102c-9233-9c1aa9e13df3,2012-09-18T08:56:01Z,1,CommunitiesMember
請編輯您的答案並將您的代碼和日誌放在代碼塊中。 –
我在下面有一個解決方法。但那不是最好的解決方案。 – Jeff