@@ -0,0 +1,873 @@
+package e6893.ocr;%0A%0Aimport java.io.File;%0A%0Aimport org.neo4j.graphdb.factory.GraphDatabaseFactory;%0A%0Apublic class InitializeGraph extends BaseOCR %7B%0A%0A%09/*%0A%09 * Initialize a database at the given path, returning system state%0A%09 */%0A%09Integer initialize(String dbPath, Double pValue) throws Exception %7B%0A%0A%09%09File dbDirectory = new File(dbPath);%0A%09%09boolean dbx = dbDirectory.exists() && dbDirectory.listFiles().length %3E 0;%0A%0A%09%09/*%0A%09%09 * Initialize%0A%09%09 */%0A%09%09msgn(dbx ? %22Connecting to database%22 : %22Creating database...%22);%0A%09%09db = new GraphDatabaseFactory().newEmbeddedDatabase(dbPath);%0A%09%09registerShutdownHook(db);%0A%0A%09%09Integer ss = getSystemState(db);%0A%09%09if (ss %3C SYSTEM_STATE_INIT) %7B%0A%09%09%09setSystemState(db, SYSTEM_STATE_INIT);%0A%09%09%09setPvalue(db, pValue);%0A%09%09%09msg(%22...Database initialization complete.%22);%0A%09%09%7D else %7B%0A%09%09%09msg(%22... Database is already initialized%22);%0A%09%09%7D%0A%0A%09%09shutDown();%0A%0A%09%09return ss;%0A%09%7D%0A%0A%7D%0A

Create InitializeGraph.java