0

enter image description hereenter image description here

I have some csv data as below. And I generated a .ttl file using Jena and the code is below-

    Property movieName = movieModel.createProperty("http://imdb.com/property/movie");
            Property countryName = movieModel.createProperty("http://imdb.com/property/country");
            for (int i = 0; i < movieDataCSV.size(); i++) {
                Resource resource = movieModel.createResource("http://imdb.com/actor/" + actors.get(i));
                resource.addProperty(movieName, movies.get(i));
                resource.addProperty(countryName, countries.get(i));
            }
            movieModel.write(System.out, "TURTLE");
            try {
                Writer fileWriter = new FileWriter("/Users/gowthamibhogireddy/Downloads/csv2rdfdata.ttl");
                movieModel.write(fileWriter, "TURTLE");
            } catch (Exception e) {
                e.printStackTrace();
            }
    
            int counter = 0;
            StmtIterator iterator = movieModel.listStatements();
            while (iterator.hasNext()) {
                Statement stmt = iterator.next();
                Resource subject = stmt.getSubject();
                Property predicate = stmt.getPredicate();
                RDFNode object = stmt.getObject();
                counter++;
                System.out.print(counter + ".  ");
                System.out.print(subject.toString());
                System.out.print(" " + predicate.toString() + " ");
                if (object instanceof Resource) {//check to see if object is is an instance of Resource
                    System.out.print(object.toString());
                } else {
                    System.out.print(" \"" + object.toString() + "\"");
                }
    
                System.out.println(" ");
            }
        }

But when I try to import this into GraphDB, i get this error -https://stackoverflow.com/questions/62230117/error-org-eclipse-rdf4j-sail-sailexception-invalid-iri-value

How can I solve this? I need a CSV to RDF converter that helps me to import data onto graph db?

Gowthi
  • 94
  • 6
  • 2
    I got lost, sorry. "below" what iiis the CSV data? Below the Turtle data in your screenshot? And then, how do you import the CSV data into GraphDB? I mean, for obvious reasons the expected data is any flavour of RDF, which in fact CSV is **not**. Nevertheless, GraphDB provides an OpenRefine plugin (dubbed [OntoRefine](https://graphdb.ontotext.com/documentation/9.8/free/loading-data-using-ontorefine.html)) which you have to use as somebody - yes it's you - has to define how to map from CSV to RDF data. – UninformedUser Oct 25 '22 at 05:13
  • To convert CSV to RDF, look for tools providing "CSVW" - the W3C standard addressing this use case. – AndyS Oct 26 '22 at 20:59
  • Did they eliminate the OntoRefine tabular data import tool? – Tim Ernst Dec 01 '22 at 00:33

0 Answers0