sparqlrdfjenablazegraph

404 Not Found on load from Jena into Blazegraph


I have a simple piece of code using Jena's RDFConnection to load rdf into Blazegraph, but keep getting HTTP 404 Not found:

public void simpleLoad() {
    String service = "http://localhost:8889/bigdata";
  try ( RDFConnection conn = RDFConnectionFactory.connect(service) ) {
    conn.load("/Users/rf/test2.rdf") ;
  //Txn.executeWrite(conn, ()-> {
     //conn.load("/Users/rf/test2.rdf") ;
  //});
  } catch (Exception ex) {
        System.out.println(ex);
  }
}

Sparql requests work fine for this service url. I tried to call connect() with more detailed urls, like

connect(service, service, "http://localhost:8889/bigdata/dataloader")

which was mentioned somewhere, but this resulted in HTTP 400 Bad request instead.

Probably worth mentioning that Blazegraph is running in Docker in my setup


Solution

  • Go to you Blazegraph Workbench. Select the Namespaces tab. For you namespace click "Service Description". That will create a sparql.rdf. Open that and search for sparqlEndpoint. That is IRI you need to use for RDFConnection. Then

      RDFConnection conn = RDFConnectionFactory.connect(service);
      conn.load(data);
      conn.close();
    

    should work.