0

I want to write a java application which gets the values and information from user and creates the graph database with neo4j,my question:

how should I create a neo4j graph database within my java application?

what tools should I use?

I read neo4j tutorials,but they were about creating a database first and query it from the application.

Thanks in advance.

2 Answers 2

2

If you are using Embedded neo4j, please see http://docs.neo4j.org/chunked/milestone/tutorials-java-embedded.html Otherwise take a look at http://docs.neo4j.org/chunked/milestone/tutorials-rest.html and/or http://www.neo4j.org/develop/drivers if you wish to use things such as Spring Data

Sign up to request clarification or add additional context in comments.

2 Comments

with these can I build a database from the java application,from the scratch?
Yes, for sure! It's how I built my first java-neo4j application
0

If you want to use the Neo4j library in your project I would suggest to first add the relative Maven dependency. Then, for the creation of a new database, just use this line:

GraphDatabaseService db = new GraphDatabaseFactory().newEmbeddedDatabase(DB_PATH)

If the database doesn't already exists, it will be created. Finally you should call

db.shutdown()

The manual suggests to register a shutdown hook in order to be sure to have a right shutdown of the database

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.