/** * Calculate the node and edge connected component tables. * * @param connection Connection * @param inputTable Edges table produced by ST_Graph * @param orientation Orientation string * @return True if the calculation was successful * @throws SQLException */ public static boolean getConnectedComponents(Connection connection, String inputTable, String orientation) throws SQLException { KeyedGraph graph = prepareGraph(connection, inputTable, orientation, null, VUCent.class, Edge.class); if (graph == null) { return false; } final List<Set<VUCent>> componentsList = getConnectedComponents(graph, orientation); final TableLocation tableName = TableUtilities.parseInputTable(connection, inputTable); final TableLocation nodesName = TableUtilities.suffixTableLocation(tableName, NODE_COMP_SUFFIX); final TableLocation edgesName = TableUtilities.suffixTableLocation(tableName, EDGE_COMP_SUFFIX); if (storeNodeConnectedComponents(connection, nodesName, edgesName, componentsList)) { if (storeEdgeConnectedComponents(connection, tableName, nodesName, edgesName)) { return true; } } return false; }
/** * Check if one table already exists * * @param connection * @param isH2 * @param requestedTable * @param osmTableName * @throws SQLException */ private void checkOSMTables(Connection connection, boolean isH2, TableLocation requestedTable, String osmTableName) throws SQLException { String[] omsTables = new String[]{OSMTablesFactory.TAG, OSMTablesFactory.NODE, OSMTablesFactory.NODE_TAG, OSMTablesFactory.WAY, OSMTablesFactory.WAY_NODE, OSMTablesFactory.WAY_TAG, OSMTablesFactory.RELATION, OSMTablesFactory.RELATION_TAG, OSMTablesFactory.NODE_MEMBER, OSMTablesFactory.WAY_MEMBER, OSMTablesFactory.RELATION_MEMBER}; for (String omsTableSuffix : omsTables) { String osmTable = TableUtilities.caseIdentifier(requestedTable, osmTableName + omsTableSuffix, isH2); if (JDBCUtilities.tableExists(connection, osmTable)) { throw new SQLException("The table " + osmTable + " already exists."); } } }
public ResultSet getResultSet() throws SQLException { SimpleResultSet rs = new SimpleResultSet(this); // Feed with fields TableUtilities.copyFields(connection, rs, TableLocation.parse(tableName, JDBCUtilities.isH2DataBase(connection.getMetaData()))); rs.addColumn(ISO_FIELD_NAME, Types.INTEGER,10,0); return rs; } }
int source, int destination) throws SQLException { final TableLocation tableName = TableUtilities.parseInputTable(connection, inputTable); final String firstGeometryField = getFirstGeometryField(connection, tableName); final boolean containsGeomField = firstGeometryField != null; final SimpleResultSet output = prepareResultSet(containsGeomField); if (isColumnListConnection(connection)) { return output;
private static Set<VAccess> prepareDestSet(Connection connection, KeyedGraph<VAccess, Edge> graph, String destTable) throws SQLException { final Statement st = connection.createStatement(); Set<VAccess> destinations = new HashSet<VAccess>(); try { final TableLocation destinationTable = TableUtilities.parseInputTable(connection, destTable); final ResultSet rs = st.executeQuery( "SELECT " + DESTINATION + " FROM " + destinationTable); while (rs.next()) { destinations.add(graph.getVertex(rs.getInt(1))); } } finally { st.close(); } return destinations; }
String orientation, Value arg3) throws SQLException { if (isColumnListConnection(connection)) { return prepareResultSet();
int source, int destination) throws SQLException { final TableLocation tableName = TableUtilities.parseInputTable(connection, inputTable); final String firstGeometryField = getFirstGeometryField(connection, tableName); final boolean containsGeomField = firstGeometryField != null; final SimpleResultSet output = prepareResultSet(containsGeomField); if (isColumnListConnection(connection)) { return output;
private static Set<VAccess> prepareDestSet(Connection connection, KeyedGraph<VAccess, Edge> graph, String destTable) throws SQLException { final Statement st = connection.createStatement(); Set<VAccess> destinations = new HashSet<VAccess>(); try { final TableLocation destinationTable = TableUtilities.parseInputTable(connection, destTable); final ResultSet rs = st.executeQuery( "SELECT " + DESTINATION + " FROM " + destinationTable); while (rs.next()) { destinations.add(graph.getVertex(rs.getInt(1))); } } finally { st.close(); } return destinations; }
String orientation, Value arg3) throws SQLException { if (isColumnListConnection(connection)) { return prepareResultSet();
/** * Calculate the node and edge connected component tables. * * @param connection Connection * @param inputTable Edges table produced by ST_Graph * @param orientation Orientation string * @return True if the calculation was successful * @throws SQLException */ public static boolean getConnectedComponents(Connection connection, String inputTable, String orientation) throws SQLException { KeyedGraph graph = prepareGraph(connection, inputTable, orientation, null, VUCent.class, Edge.class); if (graph == null) { return false; } final List<Set<VUCent>> componentsList = getConnectedComponents(graph, orientation); final TableLocation tableName = TableUtilities.parseInputTable(connection, inputTable); final TableLocation nodesName = TableUtilities.suffixTableLocation(tableName, NODE_COMP_SUFFIX); final TableLocation edgesName = TableUtilities.suffixTableLocation(tableName, EDGE_COMP_SUFFIX); if (storeNodeConnectedComponents(connection, nodesName, edgesName, componentsList)) { if (storeEdgeConnectedComponents(connection, tableName, nodesName, edgesName)) { return true; } } return false; }
int source, double radius) throws SQLException { final TableLocation tableName = TableUtilities.parseInputTable(connection, inputTable); final String firstGeometryField = ST_ShortestPath.getFirstGeometryField(connection, tableName); final boolean containsGeomField = firstGeometryField != null; final SimpleResultSet output = prepareResultSet(containsGeomField); if (isColumnListConnection(connection)) { return output;
/** * Check if one table already exists * * @param connection * @param isH2 * @param requestedTable * @param osmTableName * @throws SQLException */ private void checkOSMTables(Connection connection, boolean isH2, TableLocation requestedTable, String osmTableName) throws SQLException { String[] omsTables = new String[]{OSMTablesFactory.TAG, OSMTablesFactory.NODE, OSMTablesFactory.NODE_TAG, OSMTablesFactory.WAY, OSMTablesFactory.WAY_NODE, OSMTablesFactory.WAY_TAG, OSMTablesFactory.RELATION, OSMTablesFactory.RELATION_TAG, OSMTablesFactory.NODE_MEMBER, OSMTablesFactory.WAY_MEMBER, OSMTablesFactory.RELATION_MEMBER}; for (String omsTableSuffix : omsTables) { String osmTable = TableUtilities.caseIdentifier(requestedTable, osmTableName + omsTableSuffix, isH2); if (JDBCUtilities.tableExists(connection, osmTable)) { throw new SQLException("The table " + osmTable + " already exists."); } } }
TableUtilities.parseInputTable(connection, inputTable));
public ResultSet getResultSet() throws SQLException { SimpleResultSet rs = new SimpleResultSet(this); // Feed with fields TableUtilities.copyFields(connection, rs, TableLocation.parse(tableName, JDBCUtilities.isH2DataBase(connection.getMetaData()))); rs.addColumn(ISO_FIELD_NAME, Types.INTEGER,10,0); return rs; } }
Value arg4, Value arg5) throws SQLException { if (isColumnListConnection(connection)) { return prepareResultSet();
throws SQLException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException { final TableLocation tableName = TableUtilities.parseInputTable(connection, inputTable); final TableLocation nodesName = TableUtilities.suffixTableLocation(tableName, NODE_CENT_SUFFIX); final TableLocation edgesName = TableUtilities.suffixTableLocation(tableName, EDGE_CENT_SUFFIX); try { createTables(connection, nodesName, edgesName);
int source, double radius) throws SQLException { final TableLocation tableName = TableUtilities.parseInputTable(connection, inputTable); final String firstGeometryField = ST_ShortestPath.getFirstGeometryField(connection, tableName); final boolean containsGeomField = firstGeometryField != null; final SimpleResultSet output = prepareResultSet(containsGeomField); if (isColumnListConnection(connection)) { return output;
/** * Check if one table already exists * * @param connection * @param isH2 * @param requestedTable * @param osmTableName * @throws SQLException */ private void checkOSMTables(Connection connection, boolean isH2, TableLocation requestedTable, String osmTableName) throws SQLException { String[] omsTables = new String[]{OSMTablesFactory.TAG, OSMTablesFactory.NODE, OSMTablesFactory.NODE_TAG, OSMTablesFactory.WAY, OSMTablesFactory.WAY_NODE, OSMTablesFactory.WAY_TAG, OSMTablesFactory.RELATION, OSMTablesFactory.RELATION_TAG, OSMTablesFactory.NODE_MEMBER, OSMTablesFactory.WAY_MEMBER, OSMTablesFactory.RELATION_MEMBER}; for (String omsTableSuffix : omsTables) { String osmTable = TableUtilities.caseIdentifier(requestedTable, osmTableName + omsTableSuffix, isH2); if (JDBCUtilities.tableExists(connection, osmTable)) { throw new SQLException("The table " + osmTable + " already exists."); } } }
TableUtilities.parseInputTable(connection, inputTable));
/** * Return the exploded geometries as multiple rows * @return * @throws SQLException */ public ResultSet getResultSet() throws SQLException { SimpleResultSet rs = new SimpleResultSet(this); // Feed with fields TableUtilities.copyFields(connection, rs, TableLocation.parse(tableName, JDBCUtilities.isH2DataBase(connection.getMetaData()))); rs.addColumn(EXPLODE_FIELD, Types.INTEGER,10,0); return rs; } }