src/main/java/SDOImport.java
public static Map<String, Map<String, Set<String>>> loadbuildMInstances(String resource, String endpoint, String working_graph) {
        Map<String, Map<String, Set<String>>> data = new HashMap<String, Map<String, Set<String>>>();
        try {
            String querystr = "";
            if (!resource.isEmpty()) {
                querystr = "SELECT ?resource ?predicate ?object WHERE { GRAPH <" + working_graph + "> {?resource ?predicate ?object. FILTER (regex(?resource, \"" + resource + "\", \"i\"))}}";
            } else {
                querystr = "SELECT ?resource ?predicate ?object WHERE { GRAPH <" + working_graph + "> {?resource ?predicate ?object}}";
            }
            QueryEngineHTTP query = new QueryEngineHTTP(endpoint, querystr);

            ResultSet rst = query.execSelect();
            while (rst.hasNext()) {
                QuerySolution qs = rst.next();
                RDFNode resource_node = qs.get("?resource");
                RDFNode predicate_node = qs.get("?predicate");
                RDFNode object_node = qs.get("?object");

                String resource_uri = "<" + resource_node.asResource().getURI() + ">";
                String predicate = "<" + predicate_node.toString() + ">";
                String object = object_node.isResource() ? "<" + object_node.asResource().getURI() + ">" : "\"" + object_node.asLiteral().getString() + "\"";

                if (!data.containsKey(resource_uri)) {
                    data.put(resource_uri, new HashMap<String, Set<String>>());
                }

                if (!data.get(resource_uri).containsKey(predicate)) {
                    data.get(resource_uri).put(predicate, new HashSet<String>());
                }
                data.get(resource_uri).get(predicate).add(object);
            }
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }

        return data;
    }
/**
     * Loads the set of buildM instances that match the resource URI (in case this is given).
     * We get the full description of the resource.
     *
     * @param resource
     * @param endpoint
     * @return
     */
Loads the set of buildM instances that match the resource URI (in case this is given).
We get the full description of the resource.

@param resource
@param endpoint
@return
Loads the set of buildM instances that match the resource URI ( in case this is given ) . We get the full description of the resource . @param resource @param endpoint @return
public static Map<String, Map<String, Set<String>>> loadbuildMInstances(String resource, String endpoint, String working_graph) {
        Map<String, Map<String, Set<String>>> data = new HashMap<String, Map<String, Set<String>>>();
        try {
            String querystr = "";
            if (!resource.isEmpty()) {
                querystr = "SELECT ?resource ?predicate ?object WHERE { GRAPH <" + working_graph + "> {?resource ?predicate ?object. FILTER (regex(?resource, \"" + resource + "\", \"i\"))}}";
            } else {
                querystr = "SELECT ?resource ?predicate ?object WHERE { GRAPH <" + working_graph + "> {?resource ?predicate ?object}}";
            }
            QueryEngineHTTP query = new QueryEngineHTTP(endpoint, querystr);
            ResultSet rst = query.execSelect();
            while (rst.hasNext()) {
                QuerySolution qs = rst.next();
                RDFNode resource_node = qs.get("?resource");
                RDFNode predicate_node = qs.get("?predicate");
                RDFNode object_node = qs.get("?object");
                String resource_uri = "<" + resource_node.asResource().getURI() + ">";
                String predicate = "<" + predicate_node.toString() + ">";
                String object = object_node.isResource() ? "<" + object_node.asResource().getURI() + ">" : "\"" + object_node.asLiteral().getString() + "\"";
                if (!data.containsKey(resource_uri)) {
                    data.put(resource_uri, new HashMap<String, Set<String>>());
                }
                if (!data.get(resource_uri).containsKey(predicate)) {
                    data.get(resource_uri).put(predicate, new HashSet<String>());
                }
                data.get(resource_uri).get(predicate).add(object);
            }
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
        return data;
    }
public static Map < String , Map < String , Set < String > > > loadbuildMInstances ( String resource , String endpoint , String working_graph ) { Map < String , Map < String , Set < String > > > data = new HashMap < String , Map < String , Set < String > > > ( ) ; try { String querystr = "" ; if ( ! resource . isEmpty ( ) ) { querystr = "SELECT ?resource ?predicate ?object WHERE { GRAPH <" + working_graph + "> {?resource ?predicate ?object. FILTER (regex(?resource, \"" + resource + "\", \"i\"))}}" ; } else { querystr = "SELECT ?resource ?predicate ?object WHERE { GRAPH <" + working_graph + "> {?resource ?predicate ?object}}" ; } QueryEngineHTTP query = new QueryEngineHTTP ( endpoint , querystr ) ; ResultSet rst = query . execSelect ( ) ; while ( rst . hasNext ( ) ) { QuerySolution qs = rst . next ( ) ; RDFNode resource_node = qs . get ( "?resource" ) ; RDFNode predicate_node = qs . get ( "?predicate" ) ; RDFNode object_node = qs . get ( "?object" ) ; String resource_uri = "<" + resource_node . asResource ( ) . getURI ( ) + ">" ; String predicate = "<" + predicate_node . toString ( ) + ">" ; String object = object_node . isResource ( ) ? "<" + object_node . asResource ( ) . getURI ( ) + ">" : "\"" + object_node . asLiteral ( ) . getString ( ) + "\"" ; if ( ! data . containsKey ( resource_uri ) ) { data . put ( resource_uri , new HashMap < String , Set < String > > ( ) ) ; } if ( ! data . get ( resource_uri ) . containsKey ( predicate ) ) { data . get ( resource_uri ) . put ( predicate , new HashSet < String > ( ) ) ; } data . get ( resource_uri ) . get ( predicate ) . add ( object ) ; } } catch ( Exception e ) { System . out . println ( e . getMessage ( ) ) ; } return data ; }
Loads the set of buildM instances that match the resource URI (in case this is given).
Loads the set of buildM instances that match the resource URI ( in case this is given ) .