Re: [Neo4j] Feels like a stupid question, but...

59 views
Skip to first unread message

Michael Hunger

unread,
Oct 11, 2012, 7:45:46 PM10/11/12
to ne...@googlegroups.com
You point your graphdatabase-location setting in the server/conf/neo4j-server.properties to the directory or just copy it into server/data/graph.db

HTH

Michael

Am 11.10.2012 um 21:56 schrieb betseyb:

> I want to write a Java program to use a BatchInserter to set up a database, which I will then access via the REST API from another application. The BatchInserter requires that I provide a directory for my database, but there doesn't appear to be any examples of how to use that directory in the REST API. What am I missing??
>
> Thanks!
>
>
> --
>
>

betseyb

unread,
Oct 12, 2012, 10:44:22 AM10/12/12
to ne...@googlegroups.com
Thank you!  I've been trying to read through the manual and the tutorials, and it seems like there are a lot of missing details that make it difficult to understand.

Peter Neubauer

unread,
Oct 15, 2012, 9:07:57 AM10/15/12
to ne...@googlegroups.com
Hi there,
if you can compile a list of things that are confusing to you, it
would be most appreciated in order to make the docs better!

Cheers,

/peter neubauer

G: neubauer.peter
S: peter.neubauer
P: +46 704 106975
L: http://www.linkedin.com/in/neubauer
T: @peterneubauer

Neo4j 1.8 GA - http://www.dzone.com/links/neo4j_18_release_fluent_graph_literacy.html
> --
>
>

betseyb

unread,
Oct 17, 2012, 12:08:17 PM10/17/12
to ne...@googlegroups.com
OK, I"m really confused.

My neo4j-server.properties has: 
# location of the database directory 
org.neo4j.server.database.location=data/graph.db

My Java code using a BatchInserter to insert nodes is:

BatchInserter db =  null;
BufferedReader reader = null;
DateFormat  df = new SimpleDateFormat("yyyy/MM/dd");
Date today = new Date();
try {
File graphDb = new File("data/graph.db");
if (graphDb.exists()) {
FileUtils.deleteRecursively(graphDb);
}

long nodes = 0;
Map<String, String> config = new HashMap<String, String>();
db = BatchInserters.inserter(dbpath);
reader = new BufferedReader(new FileReader(new File(nodeFile)));
System.out.println("Loading nodes..");
reader.readLine();
String line = null;
while ((line = reader.readLine()) != null) {
String[] lineData = line.split(",");
Map<String, Object> prop = new HashMap<String, Object>(10);
prop.put("Name", lineData[0]);
prop.put("Type", lineData[1]);
prop.put("DateCreated", today.getTime());
createNode(lineData[0], db, prop);
nodes++;
}

System.out.println("Total nodes: "+nodes);

reader.close();

It executes successfully, but when I try to look at the database from the web interface, I don't see anything there.  I also tried prepending 'server' to the directory, with no luck.

Michael Hunger

unread,
Oct 18, 2012, 1:42:09 AM10/18/12
to ne...@googlegroups.com
Probably you should use absolute paths in your batch inserter to make sure it ends up in the right place, otherwise it will be data/graph.db from the base of your java project (you might have to copy that).

Don't forget to stop your server before that and start if afterwards

Michael

--
 
 

Reply all
Reply to author
Forward
0 new messages