4

I am new to neo4j and I have downloaded its community version on my mac. I would like to use the neo4j-import command to import a csv file. I found on the documentation of Neo4j that I should write on the command line the following: neo4j-import --into path_to_target_directory --nodes movies4-header.csv

I am just wondering, can anybody tell me what should be the path_to_target_directory? I mean is it in the /bin folder of the community file that i unzipped or is it in the data folder?

Your help will be much appreciated :)

1 Answers1

2

You can put it anywhere, but I'd put it into the data/graph.db directory. Assuming you don't have anything important in your data/graph.db directory:

rm -rf data/graph.db
./bin/neo4j-import --into data/graph.db --nodes movies4-header.csv

Then start neo4j and you'll be starting data/graph.db by default, assuming you haven't changed any of your config:

./bin/neo4j start
Nicole White
  • 7,720
  • 29
  • 31
  • thank you very much Nicole :) So I tried it, but they say I have an error. I typed ./bin/neo4j-import --into data/graph.db --nodes movies.csv and the error message in the command line says: Input error: Expected '--nodes' to have at least 1 item, but had 0 ([]) – Sara Piazon Jul 02 '15 at 17:24
  • 1
    Can you type `head movies.csv` and show what you see? – Nicole White Jul 02 '15 at 17:33
  • when I type: head movies.csv they say: No such file or directory. I actually have this file(movies.cvs) in the desktop, shall I put it in the main folder that contains all the files maybe? It is called my-neo4j and it contains bin, data, conf, lib, plugins, system. – Sara Piazon Jul 02 '15 at 17:45
  • 1
    You'll need to either move the csv file into the `my-neo4j` directory, or you'll need to use its path, `~/Desktop/movies.csv`. – Nicole White Jul 02 '15 at 17:55
  • 1
    oh wow it worked ! I have put the movies.csv in the main folder then i ran the same command and it worked this time. they said: IMPORT DONE in 1s 889ms. Imported: 2 nodes 0 relationships 0 properties Thank you so much Nicole :) – Sara Piazon Jul 02 '15 at 17:56
  • I have another question please :) After I imported the csv files into the database, how can I see the data? In other terms, is it possible to visualize a graph representation using the neo4j web server client (localhost:7474) ? I also read that neo4j-shell enables us to write queries and save them into the db. Is that another alternative like importing csv files? – Sara Piazon Jul 02 '15 at 21:19