diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/Csv2Rdf.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/Csv2Rdf.java index 9eabd410e..6dda0ef8b 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/Csv2Rdf.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/Csv2Rdf.java @@ -5,6 +5,9 @@ package edu.cornell.mannlib.vitro.webapp.utils; import java.io.IOException; import java.io.InputStream; import java.util.List; +import java.util.Random; + +import javax.servlet.http.HttpServletRequest; import org.skife.csv.CSVReader; import org.skife.csv.SimpleReader; @@ -17,6 +20,11 @@ import com.hp.hpl.jena.ontology.OntModel; import com.hp.hpl.jena.ontology.OntModelSpec; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.ModelFactory; +import com.hp.hpl.jena.rdf.model.Resource; +import com.hp.hpl.jena.rdf.model.ResourceFactory; + +import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; +import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; public class Csv2Rdf { @@ -48,7 +56,7 @@ public class Csv2Rdf { this.propertyNameBase = individualNameBase+"_"; } - public Model[] convertToRdf(InputStream fis) throws IOException { + public Model[] convertToRdf(InputStream fis,VitroRequest vreq, Model destination) throws IOException { OntModel ontModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM); OntModel tboxOntModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM); ontModel.addSubModel(tboxOntModel); @@ -57,7 +65,13 @@ public class Csv2Rdf { CSVReader cReader = new SimpleReader(); cReader.setSeperator(separatorChar); cReader.setQuoteCharacters(quoteChars); - + WebappDaoFactory wdf = vreq.getFullWebappDaoFactory(); + Random random = new Random(); + boolean uriIsGood = false; + boolean inDestination = false; + int attempts = 0; + String uri = null; + String errMsg = null; List fileRows = cReader.parse(fis); String[] columnHeaders = fileRows.get(0); @@ -69,7 +83,21 @@ public class Csv2Rdf { } for (int row=1; row