Skip to content

Neo4jBatch Implementation

spmallette edited this page Jan 11, 2012 · 8 revisions
<dependency>
   <groupId>com.tinkerpop.blueprints</groupId>
   <artifactId>blueprints-neo4jbatch-graph</artifactId>
   <version>??</version>
</dependency>
Graph graph = new Neo4jBatchGraph("/tmp/neo4j");

Neo4jBatchGraph provides support for the bulk insertion of data into a Neo4j graph. This Blueprints implementation is single-threaded and non-transactional. It is meant for initial dumps of raw data into a Neo4j graph and is much faster than doing the equivalent process using Neo4jGraph (see Neo4j Implementation).

Note: This is not a pure Blueprints implementation as numerous methods throw an UnsupportedOperationException. Those that do are primarily delete methods. Be sure to review the respective JavaDoc for information on method peculiarities.

One particular peculiarity involves the use of the flush method on Neo4jBatchIndex. This method must be called before querying the index for data to ensure that it returns results consistently. This method is not a standard Index API method and thus, be sure to typecast the index to Neo4jBatchIndex. Note that calling flush (and using indices in general) has a noticeable impact on the performance when writing to the graph.