You will need a g.shutdown()
at the end of your groovy script. Without a g.shutdown()
all changes to the graph are most likely to stay in memory. Re-initializing the graph from disk (/path/to/graph.db
in your case), will lose the changes which were still in memory. g.shutdown()
will flush the current transaction from memory to disk. This will make sure your changes persist and will be retrieved when you try to access the database again.
Hope this helps.
Note: You are correct on the hunch for embedded database. This issue will not occur if you use Neo4j's REST interface because every REST API request is treated as a single transaction.