You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Kieron Taylor <kt...@ebi.ac.uk> on 2017/11/14 17:13:15 UTC

Fuseki content loading via SPARQL over HTTP

Hi everyone,

Up to now I've relied on the ruby scripts shipping with Fuseki to load data onto a server, s-post, s-put etc.

I would prefer to avoid shelling out to these scripts when I need to load data, but I can't quite figure out what a multipart message body needs to look like to be accepted. The Ruby script mechanism seems to be described here: https://www.w3.org/TR/2013/REC-sparql11-http-rdf-update-20130321/#http-post

Sadly the perl libraries that support streamed content can only do so via a more proper POST body with key:value pairs. I really shouldn't have to write my own streaming code for this, so can somebody explain what multipart requests Fuseki can understand? If any?


Kieron


Re: Fuseki content loading via SPARQL over HTTP

Posted by Kieron Taylor <kt...@ebi.ac.uk>.
Thanks for clarifying Andy,


> s-post and s-put don't require a multipart request.  Just send the RDF data and set the Content-type header. s-post/s-put guess the Content-type for you but you can do it directly in a language of your choice or exec "curl".
> 
> Programmatically, open an HTTP connection with
> "Content-type: text/turtle" and push the RDF bytes down it. Fuseki does not require "Content-length".

Sadly, the libraries available to me are not expecting to just print data into the body. They act like everything is a web form. It seems I have to buffer by hand.


Kieron

Re: Fuseki content loading via SPARQL over HTTP

Posted by Andy Seaborne <an...@apache.org>.

On 14/11/17 17:13, Kieron Taylor wrote:
> Hi everyone,
> 
> Up to now I've relied on the ruby scripts shipping with Fuseki to load data onto a server, s-post, s-put etc.
> 
> I would prefer to avoid shelling out to these scripts when I need to load data, but I can't quite figure out what a multipart message body needs to look like to be accepted. The Ruby script mechanism seems to be described here: https://www.w3.org/TR/2013/REC-sparql11-http-rdf-update-20130321/#http-post
> 
> Sadly the perl libraries that support streamed content can only do so via a more proper POST body with key:value pairs. I really shouldn't have to write my own streaming code for this, so can somebody explain what multipart requests Fuseki can understand? If any?
> 
> 
> Kieron
> 

Hi Kieron,

s-post and s-put don't require a multipart request.  Just send the RDF 
data and set the Content-type header. s-post/s-put guess the 
Content-type for you but you can do it directly in a language of your 
choice or exec "curl".

Example:

curl -XPOST --header "Content-type: text/turtle"   \
      --data-binary @DATA.ttl                       \
     http://localhost:3030/ds

However, that may load the file into curl's RAM. (reading from 
https://github.com/curl/curl/issues/290)

If you want to do it like an HTML file upload:

curl -F "file=@DATA.ttl;filename=DATA.ttl" http://localhost:3030/ds

which streams a large file which si the multipart form style.

Programmatically, open an HTTP connection with
  "Content-type: text/turtle" and push the RDF bytes down it. Fuseki 
does not require "Content-length".

     Andy