问题描述:

I have loaded a bunch of data into the data base in my java application. However, when I start the Web Administration server, all I can see is the default 1 node, 1 relationship. How do I (point?) this server to the data files I specified in the EmbeddedGraphdatabase instance? I have included a snippet of code, if that helps. Thanks!

// The path to my data files is var/graphDb/full_abstract1. I want Web Admin to point HERE

graphDb = new GraphDatabaseFactory().newEmbeddedDatabase( "var/graphDb/full_abstract1" );

registerShutdownHook(graphDb);

Transaction tx = graphDb.beginTx();

int count = 0;

try {

for (org.openbel.framework.common.model.Statement s : statements) {

firstNode = graphDb.createNode();

String str = s.getSubject().toBELShortForm();

firstNode.setProperty("getSubject()", str);

secondNode = graphDb.createNode();

String str0 = s.getObject().toBELShortForm();

secondNode.setProperty( "getObject()", str0);

// have to convert the Relationship Type

org.openbel.framework.common.enums.RelationshipType r = s.getRelationshipType();

RelationshipType r_neo = makeNeoRType(r);

relation = firstNode.createRelationshipTo(secondNode, r_neo);

tx.success();

out.println("# statements: " +count++);

}

}

finally {

tx.finish();

}

// Some debug code, to make sure I get all the nodes I expect.

for (Node n : graphDb.getAllNodes()) {

for (Relationship r : n.getRelationships()) {

out.println("Node Id: " +n.getId());

out.println("Relationship Type: " +r.getType());

}

}

out.println("Done");

网友答案:

You edit conf/neo4j-server.properties and set the database path to var/graphDb/full_abstract1

You can also start the web-interface as part of your java application, see: http://docs.neo4j.org/chunked/snapshot/server-embedded.html

相关阅读:
Top