0
votes

I'm working on a Java EE application using Neo4j as database. In this application, i need to do some backup of users's projects to compare them in time (for example, a user has a project (Master nodes + children Nodes + Labels + relationships) A, created 01/01/2014, he creates a copy of this project 01/30/2014 and wants to compare it with actual version 1 month later). My idea is to use "dump" from neo4j-shell to copy all of the project when the user wants it, and keep it in the database to make the user able to compare them.

But the problem is there, i'm searching on the internet since 4 days and i'm always stuck with this.

I tried to do it with cypher but the best way for me is neo4j-shell because dump command can return a cypher query to create the same node with labels, relationships and child nodes, then i just have to edit some parameters in it... et voila !

What i need :

  • Use neo4j-shell in my application code to use dump command(Java EE)
  • be able to get result of dump neo4j-shell command

I don't need to know how to use cypher, i already do it in all of my application, the only reason why i need neo4j-shell in my java code is because i didn't find a way to do something like the backup command in a cypher query (if you know how, please tell me, it should be realy easier to do it with cypher)

I hope you will be able to help me, have a nice day :)

2

2 Answers

1
votes

You might want to consider using the Neo4J JDBC driver to expose the neo4j database as a JDBC connection, and then use other existing tools to query/backup from that JDBC connection.

It seems that as you've found, dump is good for creating cypher that you can use to re-create another neo4j database. If that isn't what you want, maybe you want to dump the information as tabular data? Setting up neo4j as a JDBC connection point has the advantage that you can reuse any tool that knows how to talk to a JDBC database, and use all of those to query/format/dump your data.

0
votes

Just call the transactional http endpoint and use the returned JSON string as comparison.

The example is in the documentation too.

For Java you can look here: http://docs.neo4j.org/chunked/milestone/server-java-rest-client-example.html#_sending_cypher