I want to upload turle files on GraphDB using RDF4J framework. Any suggestion will be highly appreciated.
I tried the code below (note: I am not professional in Java). There is no error but I cannot see the data on GraphDB.
String repositoryUrl = "http://localhost:7200/repository/...";
String username = "iiuu";
String password = "iibb";
String filePath = "/.../xxx.ttl";
//Equivalent command conversion for Java execution
String[] command = { "curl", "-u", username + ":" + password, "-X", "POST", "-F", "cmd=unlockPage", "-F","Content-Type: application/x-turtle",
"-T",
"path=" + filePath, "-F", "_charset_=utf-8", repositoryUrl };
ProcessBuilder process = new ProcessBuilder(command);
Process p;
try {
p = process.start();
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
StringBuilder builder = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
builder.append(line);
builder.append(System.getProperty("line.separator"));
}
String result = builder.toString();
System.out.print(result);