/** * Adds the extract string <tt>tablename</tt> to the list of annotation * table names. * * @param tablename */ void addAnnotationTableToList(String tablename) { try (CoStoSysConnection conn = dbc.obtainOrReserveConnection()){ conn.setAutoCommit(true); Statement stmt = conn.createStatement(); String template = "INSERT INTO %s VALUES('%s')"; String sql = String.format(template, dbc.getActiveDataPGSchema() + "." + ANNOTATION_LIST_TABLE, tablename); stmt.execute(sql); } catch (PSQLException e) { log.debug("Tried to add already existing annotation table to annotation list: \"{}\", ignoring.", tablename); } catch (SQLException e) { e.printStackTrace(); SQLException ne = e.getNextException(); if (null != ne) ne.printStackTrace(); } }
private void createNamespaceTable(DataBaseConnector dbc) { if (!dbc.tableExists(dbc.getActiveDataPGSchema() + "." + XMI_NS_TABLE)) { try (CoStoSysConnection conn = dbc.obtainOrReserveConnection()){ conn.setAutoCommit(true); Statement stmt = conn.createStatement(); String sql = String.format("CREATE TABLE %s (%s text PRIMARY KEY, %s text)", dbc.getActiveDataPGSchema() + "." + XMI_NS_TABLE, PREFIX, NS_URI); stmt.execute(sql); } catch (SQLException e) { e.printStackTrace(); SQLException ne = e.getNextException(); if (null != ne) ne.printStackTrace(); } } }
if (notFound.size() > 0) { try (CoStoSysConnection conn = dbc.reserveConnection()) { conn.setAutoCommit(true); Statement stmt = conn.createStatement(); String sql = String.format("SELECT %s FROM %s", PREFIX, dbc.getActiveDataPGSchema() + "." + XMI_NS_TABLE);
private Map<String, String> getNamespaceMap() { Map<String, String> map = null; if (dbc.tableExists(dbc.getActiveDataPGSchema() + "." + XmiSplitConstants.XMI_NS_TABLE)) { try (CoStoSysConnection conn = dbc.obtainOrReserveConnection()){ map = new HashMap<>(); conn.setAutoCommit(true); Statement stmt = conn.createStatement(); String sql = String.format("SELECT %s,%s FROM %s", XmiSplitConstants.PREFIX, XmiSplitConstants.NS_URI, dbc.getActiveDataPGSchema() + "." + XmiSplitConstants.XMI_NS_TABLE); ResultSet rs = stmt.executeQuery(String.format(sql)); while (rs.next()) map.put(rs.getString(1), rs.getString(2)); } catch (SQLException e) { e.printStackTrace(); SQLException ne = e.getNextException(); if (null != ne) ne.printStackTrace(); } } else { log.warn( "Table \"{}\" was not found it is assumed that the table from which is read contains complete XMI documents.", dbc.getActiveDataPGSchema() + "." + XmiSplitConstants.XMI_NS_TABLE); } return map; }
private void createAnnotationListTable() { if (!dbc.tableExists(dbc.getActiveDataPGSchema() + "." + ANNOTATION_LIST_TABLE)) { try (CoStoSysConnection conn = dbc.obtainOrReserveConnection()){ conn.setAutoCommit(true); Statement stmt = conn.createStatement(); String sql = String.format("CREATE TABLE %s (%s text PRIMARY KEY)", dbc.getActiveDataPGSchema() + "." + ANNOTATION_LIST_TABLE, TABLE_NAME); stmt.execute(sql); } catch (SQLException e) { e.printStackTrace(); SQLException ne = e.getNextException(); if (null != ne) ne.printStackTrace(); } } } }
conn.setAutoCommit(false); for (String tableName : serializedCASes.keySet()) { if (serializedCASes.get(tableName).size() == 0) {