this.currConnection = DriverManager.getConnection("jdbc:sqlite:data/db/current.db");
//this.graphSkeletons = new HashMap<Integer, GraphNode>();
VisualGraph.log.printDebug("[" + this.getClass().getName() + ".SQLiteModel] [OK] Creating of database");
} catch (Exception ex) {
VisualGraph.log.printDebug("[" + this.getClass().getName() + ".SQLiteModel] [FAIL] Creating of database. Exception : " + ex.getMessage());
throw(new CoreException("[Model.Model] [Creating of data base] Exception = " + ex.getMessage(),EnumCriticalityException.FAILED));
}
//creating of tables---------------------
VisualGraph.log.printDebug("[" + this.getClass().getName() + ".SQLiteModel] [PROCESS] Creating of tables");
Statement currStatement = null;
try {
//drop old tables if exists----------
currStatement = this.currConnection.createStatement();
currStatement.executeUpdate("drop table if exists com_graph_subgraph;");
currStatement.executeUpdate("drop table if exists com_subgraph_edge;");
currStatement.executeUpdate("drop table if exists com_subgraph_vertex;");
currStatement.executeUpdate("drop table if exists com_edge_attribute;");
currStatement.executeUpdate("drop table if exists com_vertex_attribute;");
currStatement.executeUpdate("drop table if exists graph;");
currStatement.executeUpdate("drop table if exists subgraph;");
currStatement.executeUpdate("drop table if exists attribute;");
currStatement.executeUpdate("drop table if exists vertex;");
currStatement.executeUpdate("drop table if exists edge;");
//create new tables------------------
currStatement.executeUpdate("create table vertex (db_id INTEGER PRIMARY KEY, id VARCHAR, db_id_inner_graph INTEGER);");
currStatement.executeUpdate("create table edge (db_id INTEGER PRIMARY KEY, id VARCHAR, db_id_source INT, db_id_target INT);");
currStatement.executeUpdate("create table attribute (db_id INTEGER PRIMARY KEY, name VARCHAR, value VARCHAR);");
currStatement.executeUpdate("create table subgraph (db_id INTEGER PRIMARY KEY, id VARCHAR, name VARCHAR, directed BOOLEAN);");
currStatement.executeUpdate("create table graph (db_id INTEGER PRIMARY KEY, root_key INTEGER, name VARCHAR);");
currStatement.executeUpdate("create table com_vertex_attribute (db_id INTEGER PRIMARY KEY autoincrement, db_id_vertex INTEGER, db_id_attribute INTEGER);");
currStatement.executeUpdate("create table com_edge_attribute (db_id INTEGER PRIMARY KEY autoincrement, db_id_edge INTEGER, db_id_attribute INTEGER);");
currStatement.executeUpdate("create table com_subgraph_vertex (db_id INTEGER PRIMARY KEY autoincrement, db_id_subgraph INTEGER, db_id_vertex INTEGER);");
currStatement.executeUpdate("create table com_subgraph_edge (db_id INTEGER PRIMARY KEY autoincrement, db_id_subgraph INTEGER, db_id_edge INTEGER);");
currStatement.executeUpdate("create table com_graph_subgraph (db_id INTEGER PRIMARY KEY autoincrement, db_id_graph INTEGER, db_id_subgraph INTEGER);");
VisualGraph.log.printDebug("[" + this.getClass().getName() + ".SQLiteModel] [OK] Creating of tables");
} catch (Exception ex) {
VisualGraph.log.printDebug("[" + this.getClass().getName() + ".SQLiteModel] [FAIL] Creating of tables. Exception : " + ex.getMessage());
throw(new CoreException("[" + this.getClass().getName() + ".SQLiteModel] [Creating of tables] Exception = " + ex.getMessage(),EnumCriticalityException.FAILED));
} finally {
if(currStatement != null) {
try {
currStatement.close();
} catch(SQLException ex) {