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??
> 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??
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.
On Thursday, October 11, 2012 7:46:03 PM UTC-4, Michael Hunger wrote:
> 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??
On Fri, Oct 12, 2012 at 4:44 PM, betseyb <betsey.ben...@bostonfusion.com> wrote:
> 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.
> On Thursday, October 11, 2012 7:46:03 PM UTC-4, Michael Hunger wrote:
>> 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??
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.
> On Fri, Oct 12, 2012 at 4:44 PM, betseyb <betsey...@bostonfusion.com<javascript:>> > wrote: > > 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.
> > On Thursday, October 11, 2012 7:46:03 PM UTC-4, Michael Hunger wrote:
> >> 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??
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
> 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.
> On Monday, October 15, 2012 9:08:25 AM UTC-4, Peter Neubauer wrote:
> 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!
> On Fri, Oct 12, 2012 at 4:44 PM, betseyb <betsey...@bostonfusion.com> wrote: > > 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.
> > On Thursday, October 11, 2012 7:46:03 PM UTC-4, Michael Hunger wrote:
> >> 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??