src/main/java/SDOImport.java
public static void interlinkBuildMInstanceWithCrawls(String resource, String sda_config) throws SQLException {
        //load the virtuoso endpoint configuration
        Map<String, String> sda_config_properties = FileUtils.readIntoStringMap(sda_config, "\t", false);
        //load the buildM instances
        Map<String, Set<String>> data = loadbuildMLocations(resource, sda_config_properties.get("endpoint"), sda_config_properties.get("master_graph"));
        Map<String, Set<String>> crawls = loadFinishedCrawls(sda_config_properties);

        //for each instance check if you can find a crawl.
        StringBuffer sb = new StringBuffer();
        for (String buildm_instance : data.keySet()) {
            Set<String> locations = data.get(buildm_instance);

            for (String crawl_uri : crawls.keySet()) {
                Set<String> seeds = crawls.get(crawl_uri);

                //check the overlap between the locations and the seed lists.
                Set<String> tmp = new HashSet<String>(seeds);
                tmp.retainAll(locations);

                //if there is an overlap interlink the buildM instance with the crawl.
                if (!tmp.isEmpty()) {
                    sb.append(buildm_instance).append("\t<http://www.w3.org/2000/01/rdf-schema#seeAlso>\t").append(crawl_uri).append(" .\n");
                }
            }
        }

        String out_file = "crawl_interlinking.nt";
        FileUtils.saveText(sb.toString(), out_file);

        //write the data into the graph.
        Model model = VirtModel.openDatabaseModel(sda_config_properties.get("master_graph"), "jdbc:virtuoso://" + sda_config_properties.get("server") + ":1111", sda_config_properties.get("user"), sda_config_properties.get("password"));
        InputStream in = FileManager.get().open(out_file);
        if (in == null) {
            throw new IllegalArgumentException("File: " + out_file + " not found");
        }
        model.read(new InputStreamReader(in), null, "N-TRIPLE");
        model.close();
        File f = new File(out_file);
        f.delete();
    }
/**
     * Interlinks a given buildM instance with existing crawls. In case the resource is empty, first it fetches
     * all buildM instances and matches them with a given crawl.
     *
     * @param resource
     */
Interlinks a given buildM instance with existing crawls. In case the resource is empty, first it fetches
all buildM instances and matches them with a given crawl.

@param resource
Interlinks a given buildM instance with existing crawls . In case the resource is empty first it fetches all buildM instances and matches them with a given crawl . @param resource
public static void interlinkBuildMInstanceWithCrawls(String resource, String sda_config) throws SQLException {
        Map<String, String> sda_config_properties = FileUtils.readIntoStringMap(sda_config, "\t", false);
        Map<String, Set<String>> data = loadbuildMLocations(resource, sda_config_properties.get("endpoint"), sda_config_properties.get("master_graph"));
        Map<String, Set<String>> crawls = loadFinishedCrawls(sda_config_properties);
        StringBuffer sb = new StringBuffer();
        for (String buildm_instance : data.keySet()) {
            Set<String> locations = data.get(buildm_instance);
            for (String crawl_uri : crawls.keySet()) {
                Set<String> seeds = crawls.get(crawl_uri);
                Set<String> tmp = new HashSet<String>(seeds);
                tmp.retainAll(locations);
                if (!tmp.isEmpty()) {
                    sb.append(buildm_instance).append("\t<http://www.w3.org/2000/01/rdf-schema#seeAlso>\t").append(crawl_uri).append(" .\n");
                }
            }
        }
        String out_file = "crawl_interlinking.nt";
        FileUtils.saveText(sb.toString(), out_file);
        Model model = VirtModel.openDatabaseModel(sda_config_properties.get("master_graph"), "jdbc:virtuoso://" + sda_config_properties.get("server") + ":1111", sda_config_properties.get("user"), sda_config_properties.get("password"));
        InputStream in = FileManager.get().open(out_file);
        if (in == null) {
            throw new IllegalArgumentException("File: " + out_file + " not found");
        }
        model.read(new InputStreamReader(in), null, "N-TRIPLE");
        model.close();
        File f = new File(out_file);
        f.delete();
    }
public static void interlinkBuildMInstanceWithCrawls ( String resource , String sda_config ) throws SQLException { Map < String , String > sda_config_properties = FileUtils . readIntoStringMap ( sda_config , "\t" , false ) ; Map < String , Set < String > > data = loadbuildMLocations ( resource , sda_config_properties . get ( "endpoint" ) , sda_config_properties . get ( "master_graph" ) ) ; Map < String , Set < String > > crawls = loadFinishedCrawls ( sda_config_properties ) ; StringBuffer sb = new StringBuffer ( ) ; for ( String buildm_instance : data . keySet ( ) ) { Set < String > locations = data . get ( buildm_instance ) ; for ( String crawl_uri : crawls . keySet ( ) ) { Set < String > seeds = crawls . get ( crawl_uri ) ; Set < String > tmp = new HashSet < String > ( seeds ) ; tmp . retainAll ( locations ) ; if ( ! tmp . isEmpty ( ) ) { sb . append ( buildm_instance ) . append ( "\t<http://www.w3.org/2000/01/rdf-schema#seeAlso>\t" ) . append ( crawl_uri ) . append ( " .\n" ) ; } } } String out_file = "crawl_interlinking.nt" ; FileUtils . saveText ( sb . toString ( ) , out_file ) ; Model model = VirtModel . openDatabaseModel ( sda_config_properties . get ( "master_graph" ) , "jdbc:virtuoso://" + sda_config_properties . get ( "server" ) + ":1111" , sda_config_properties . get ( "user" ) , sda_config_properties . get ( "password" ) ) ; InputStream in = FileManager . get ( ) . open ( out_file ) ; if ( in == null ) { throw new IllegalArgumentException ( "File: " + out_file + " not found" ) ; } model . read ( new InputStreamReader ( in ) , null , "N-TRIPLE" ) ; model . close ( ) ; File f = new File ( out_file ) ; f . delete ( ) ; }
Interlinks a given buildM instance with existing crawls.
Interlinks a given buildM instance with existing crawls .
//load the virtuoso endpoint configuration //load the buildM instances //for each instance check if you can find a crawl. //check the overlap between the locations and the seed lists. //if there is an overlap interlink the buildM instance with the crawl. //write the data into the graph.