Neo4j の埋め込み Java バージョンで以前に作成したデータベースにアクセスできません。私がやりたいのは、GraphDatabaseService を開き、数百万のリレーションシップ (BatchInserter を使用せず、トランザクションのみ) を追加してから、最後のトランザクションと接続をシャットダウンすることです。これは次のようになります。
public class startNeo4j{ …
public static void main (String[] args) {
GraphDatabaseService graphDb = new EmbeddedGraphDatabase( "data/test/base" );
Transaction tx = graphDb.beginTx();
IndexManager index = graphDb.index();
Index<Node> userIds = index.forNodes("userIds");
RelationshipIndex follows = index.forRelationships("follows");
[ここでは、非常に大きな csv (数百万の関係) を入力し、関係と userId インデックスも提供します]
tx.finish();
graphDb.shutdown(); }}
次に、新しい GraphDatabaseService を開いて、挿入したすべてのデータにアクセスできるようにする必要があります。Neo4j リストを確認したところ、可能であることが確認されましたが、詳細は提供されませんでした。
インデックスを再作成したくありませんが、単純に再オープンしようとすると、インデックス (上記の userIds) が「解決できません」というエラーが表示されます。理想的には、誰かが 2 番目のコード セットがどのように見えるかの概要を知っていれば、それは素晴らしいことです。私の機能しないものは次のようになります。
public class examineNeo4j{
public static void main (String[] args){
GraphDatabaseService graphDb = new EmbeddedGraphDatabase( "data/test/base" );
Transaction tx = graphDb.beginTx();
IndexHits<Node> hits_final = userIds.get("userId","12");
Node testthis = hits_final.getSingle();
[または実行したい他のクエリ]
tx.finish();
graphDb.shutdown();}}
どんな助けでも大歓迎です!