I am quite new to both Java and Sesame. I tried to create a repository in Sesame by programming in Eclipse. Unfortunately I am getting an error. I cannot figure out why this error happens and what is wrong! I reviewed many questions and available sources to get help but unfortunately, most of the web pages in the answers are expired and the documents are no longer accessible! lots of things were not very clear to me. I started with simple pieces of code as in the snippet below:
public class sesame {
public static void main(String[] args) throws Exception{
initi();
}
private static void initi() throws java.lang.Exception {
// connect to the server
String serverUrl = "http://localhost:8080/openrdf-sesame";
RepositoryManager manager = RepositoryProvider.getRepositoryManager(serverUrl);
// get a list of the ids of all existing repositories
List ids = (List)manager.getRepositoryIDs();
// open a repository with a known identifier, e.g. "test"
Repository rep = manager.getRepository("TestID");
}
}
I always get below error no matter what the code is!
Exception in thread "main" java.io.IOException: No -Dserver=<URL> option provided at org.openrdf.tools.cmdline.SesameClient.main(SesameClient.java:138)
I used the openrdf_workbench by deploying the two war files for Sesame in Tomcat. I have created a new repository and I don't have any problem there but I cannot do these programmatically! My main objective is to be able to create the repository in sesame using Java programming.
Finally, I would greatly appreciate it if someone can help me with below concerns:
to be able to fix the above error (why is it caused? how to remove it?)
to find an up to date source to learn programming with Sesame API. (is there any step by step tutorial?)
to help me figure out how exactly I can create a repository in Sesame server and then insert an RDF/XML file into that repository using Java that I can also view in a browser when I navigate to the Sesame workbench. (I have seen some sample codes but because I faced this error from the very first attempt I am quite confused what the correct way to create a repository is. I also have a problem in understanding the difference between
SailRepositoryandHTTPRepository.)
Sesame has been renamed to Eclipse RDF4J. There's a beginners tutorial available on the RDF4J documentation site.
As for your error: as AKSW also indicated in his comment, the error does not correspond to the Java code you show: it's an error from using a command line tool incorrectly.