0

I tried to connect Jena to my custom file which I stored on a public directory on Dropbox with the following link https://www.dropbox.com/s/d3gfidqqfwvo4e9/foaf.ttl?dl=1.

I've intentionally changed the link to dl=1 instead of dl=0 so the link would show directly to the file instead of the Dropbox folder.

In Netbeans I have the following code:

    final String url = "https://www.dropbox.com/s/d3gfidqqfwvo4e9/foaf.ttl?dl=1";
    final Model model = ModelFactory.createDefaultModel();
    model.read(url,"TURTLE");
    model.write(System.out);

And on the output the only thing I get is:

    <rdf:RDF
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
    </rdf:RDF>

Any help on why I can't get the entire model?

Ivan Janev
  • 33
  • 6
  • 2
    This works in the current development branch of Apache Jena even if it does not work in v 3.1.1. It does give 4 HTTP warnings (Invalid cookie header) - maybe in 3.1.1. these cause a silent internal error. A workaround would be to read the URL into a string and parse the string. – AndyS Dec 18 '16 at 21:42
  • Though I don't quite understand how I managed to fix the problem by changing the `model.read` function adding an additional blank parameter, now looking as the following: `model.read(url,"","TURTLE")`. As it states in the documentation the second parameter is a baseURI, but I can't understand what does it change when leaving it blank. Nevertheless the code now works properly. – Ivan Janev Dec 19 '16 at 23:44

1 Answers1

1

The actual problem was the Dropbox. Their servers had a problem during the day of my testing and now the code works perfectly.

Ivan Janev
  • 33
  • 6