Re: SPARQL 1.1 Graph Store spec rather misleading

> On 17 Sep 2015, at 01:10, Danny Ayers <danny.ayers@gmail.com> wrote:
> 
> http://www.w3.org/TR/2013/REC-sparql11-http-rdf-update-20130321/#http-post <http://www.w3.org/TR/2013/REC-sparql11-http-rdf-update-20130321/#http-post>
> 
> In this section it states:
> 
> [[
> The following two operations are considered to have the same effect
> 
>     POST /rdf-graph-store?graph=..graph_uri.. HTTP/1.1
>     Host: example.com <http://example.com/>
>     Content-Type: text/turtle
>     
>     ... RDF payload ...    
>     
>     INSERT DATA { GRAPH <graph_uri> { .. RDF payload .. } 
> ]]
> 
> The problem is, taken literally the INSERT operation won't work. For example:
> 
> INSERT DATA { GRAPH <http://schema.org/terms/ <http://schema.org/terms/>> 
> { 
> 
> @PREFIX schema: <http://schema.org/ <http://schema.org/>> .
> ...
> schema:Thing ...
> }}
> 
> The RDF payload has to be tweaked to make it compatible with the SPARQL syntax, something like:
> 
> PREFIX schema: <http://schema.org/ <http://schema.org/>> 
> 
> INSERT DATA { GRAPH <http://schema.org/terms/ <http://schema.org/terms/>> 
> { 
> schema:Thing ...
> }}
> 
> I just got caught out by this, building the SPARQL via a templating engine. Ok, it took all of a minute to realise what was happening. But still, anyone coming to the docs for the first time might not be so lucky (as it is, I'll have to rethink my approach with the templates).
> 
> Cheers,
> Danny.
> 
> 

The wording isn’t terribly clear, but what it’s trying to say is that

> POST /rdf-graph-store?graph=..graph_uri.. HTTP/1.1
>     Host: example.com <http://example.com/>
>     Content-Type: text/turtle
>     
>     ... RDF payload …    

Is equivalent to the Update operation 

> INSERT, blah.


So it’s not necessary to convert the Turtle to SPARQL PREFIX notation, you can just use Turtle as-is, as per the MIME type.

There’s a double space between the … RDF payload … and the INSERT line, which is supposed to indicate the difference, I think.

- Steve

Received on Thursday, 17 September 2015 09:19:03 UTC