src/main/java/SDOImport.java
public static Map<String, Set<String>> loadFinishedCrawls(Map<String, String> mysql_params) throws SQLException {
        Map<String, Set<String>> data = new HashMap<String, Set<String>>();
        Connection conn = getMySQLConnection(mysql_params.get("mysql_user"), mysql_params.get("mysql_password"), mysql_params.get("mysql_database"), mysql_params.get("mysql_server"));

        PreparedStatement prep = conn.prepareStatement("SELECT crawl_id, seed_list FROM crawl_configurations WHERE end_timestamp IS NOT NULL");
        java.sql.ResultSet rst = prep.executeQuery();
        while (rst.next()) {
            int crawl_id = rst.getInt("crawl_id");
            String[] seeds = rst.getString("seed_list").split(";");

            String crawl_uri = "<http://data.duraark.eu/crawl/" + crawl_id + ">";
            Set<String> sub_data = new HashSet<String>();
            data.put(crawl_uri, sub_data);
            for (String seed : seeds) {
                String seed_tmp = seed;
                if (seed.indexOf("/") != -1) {
                    seed_tmp = seed.substring(seed.lastIndexOf("/") + 1).trim();
                }
                sub_data.add(seed_tmp);
            }
        }

        return data;
    }
/**
     * Loads all existing crawls from the database.
     *
     * @return
     */
Loads all existing crawls from the database.
@return
Loads all existing crawls from the database . @return
public static Map<String, Set<String>> loadFinishedCrawls(Map<String, String> mysql_params) throws SQLException {
        Map<String, Set<String>> data = new HashMap<String, Set<String>>();
        Connection conn = getMySQLConnection(mysql_params.get("mysql_user"), mysql_params.get("mysql_password"), mysql_params.get("mysql_database"), mysql_params.get("mysql_server"));
        PreparedStatement prep = conn.prepareStatement("SELECT crawl_id, seed_list FROM crawl_configurations WHERE end_timestamp IS NOT NULL");
        java.sql.ResultSet rst = prep.executeQuery();
        while (rst.next()) {
            int crawl_id = rst.getInt("crawl_id");
            String[] seeds = rst.getString("seed_list").split(";");
            String crawl_uri = "<http://data.duraark.eu/crawl/" + crawl_id + ">";
            Set<String> sub_data = new HashSet<String>();
            data.put(crawl_uri, sub_data);
            for (String seed : seeds) {
                String seed_tmp = seed;
                if (seed.indexOf("/") != -1) {
                    seed_tmp = seed.substring(seed.lastIndexOf("/") + 1).trim();
                }
                sub_data.add(seed_tmp);
            }
        }
        return data;
    }
public static Map < String , Set < String > > loadFinishedCrawls ( Map < String , String > mysql_params ) throws SQLException { Map < String , Set < String > > data = new HashMap < String , Set < String > > ( ) ; Connection conn = getMySQLConnection ( mysql_params . get ( "mysql_user" ) , mysql_params . get ( "mysql_password" ) , mysql_params . get ( "mysql_database" ) , mysql_params . get ( "mysql_server" ) ) ; PreparedStatement prep = conn . prepareStatement ( "SELECT crawl_id, seed_list FROM crawl_configurations WHERE end_timestamp IS NOT NULL" ) ; java . sql . ResultSet rst = prep . executeQuery ( ) ; while ( rst . next ( ) ) { int crawl_id = rst . getInt ( "crawl_id" ) ; String [ ] seeds = rst . getString ( "seed_list" ) . split ( ";" ) ; String crawl_uri = "<http://data.duraark.eu/crawl/" + crawl_id + ">" ; Set < String > sub_data = new HashSet < String > ( ) ; data . put ( crawl_uri , sub_data ) ; for ( String seed : seeds ) { String seed_tmp = seed ; if ( seed . indexOf ( "/" ) != - 1 ) { seed_tmp = seed . substring ( seed . lastIndexOf ( "/" ) + 1 ) . trim ( ) ; } sub_data . add ( seed_tmp ) ; } } return data ; }
Loads all existing crawls from the database.
Loads all existing crawls from the database .