You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Andy Seaborne (JIRA)" <ji...@apache.org> on 2014/07/03 14:54:25 UTC

[jira] [Comment Edited] (JENA-738) HTTP PUT to GSP endpoint should replace existing content?

    [ https://issues.apache.org/jira/browse/JENA-738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14051387#comment-14051387 ] 

Andy Seaborne edited comment on JENA-738 at 7/3/14 12:54 PM:
-------------------------------------------------------------

yes - PUT should replace the target.

BUT

In your example, the {{PUT}} on {{/ds/data}} is a quads operation and it clears the *dataset* . All named graphs will be removed; the default graph is cleared, then the data added.

If you want per graph control, it'll need to use {{?default}} or {{?graph=...}}.


was (Author: andy.seaborne):
yes - PUT should replace the target.

BUT

In your example, it's {{PUT}} on {{/ds/data}} is a quads operation and it clears the *dataset* . All named graphs will be removed.

If you want per graph control, it'll need to use {{?default}} or {{?graph=...}}.

> HTTP PUT to GSP endpoint should replace existing content?
> ---------------------------------------------------------
>
>                 Key: JENA-738
>                 URL: https://issues.apache.org/jira/browse/JENA-738
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: Fuseki
>            Reporter: Ian Dickinson
>              Labels: fuseki2
>
> Partly a question, and partly a suggestion for improvement: should HTTP PUT to the /data endpoint replace existing content in the graph? I'd like to suggest that it does, for the following reasons:
> * we already have POST to /data to add new content
> * it seems more consistent with the HTTP spec
> * it would support the use-case of 'get the current graph contents, edit it, put it back'
> Here's a test case:
> {noformat}
> ian@ian-desktop $ curl http://localhost:3030/foo/data
> { 
> }
> [~/workspace/jena-fuseki2] 
> ian@ian-desktop $ curl -XPUT -v -d '<http://example/foo> <http://example/p> <http://example/a>.' -H 'Content-Type: text/turtle' http://localhost:3030/foo/data
> * Hostname was NOT found in DNS cache
> *   Trying 127.0.0.1...
> * Connected to localhost (127.0.0.1) port 3030 (#0)
> > PUT /foo/data HTTP/1.1
> > User-Agent: curl/7.35.0
> > Host: localhost:3030
> > Accept: */*
> > Content-Type: text/turtle
> > Content-Length: 59
> > 
> * upload completely sent off: 59 out of 59 bytes
> < HTTP/1.1 200 OK
> < Fuseki-Request-ID: 235
> < Access-Control-Allow-Origin: *
> * Server Fuseki (2.0.0.M2-SNAPSHOT) is not blacklisted
> < Server: Fuseki (2.0.0.M2-SNAPSHOT)
> < Content-Type: application/json
> < Transfer-Encoding: chunked
> < 
> { 
>   "count" : 1 ,
>   "quadCount" : 0 ,
>   "tripleCount" : 1
> }
> * Connection #0 to host localhost left intact
> [~/workspace/jena-fuseki2] 
> ian@ian-desktop $ curl http://localhost:3030/foo/data
> { <http://example/foo>
>           <http://example/p>  <http://example/a> .
> }
> [~/workspace/jena-fuseki2] 
> ian@ian-desktop $ curl -XPUT -v -d '<http://example/foo> <http://example/p> <http://example/b>.' -H 'Content-Type: text/turtle' http://localhost:3030/foo/data
> * Hostname was NOT found in DNS cache
> *   Trying 127.0.0.1...
> * Connected to localhost (127.0.0.1) port 3030 (#0)
> > PUT /foo/data HTTP/1.1
> > User-Agent: curl/7.35.0
> > Host: localhost:3030
> > Accept: */*
> > Content-Type: text/turtle
> > Content-Length: 59
> > 
> * upload completely sent off: 59 out of 59 bytes
> < HTTP/1.1 200 OK
> < Fuseki-Request-ID: 237
> < Access-Control-Allow-Origin: *
> * Server Fuseki (2.0.0.M2-SNAPSHOT) is not blacklisted
> < Server: Fuseki (2.0.0.M2-SNAPSHOT)
> < Content-Type: application/json
> < Transfer-Encoding: chunked
> < 
> { 
>   "count" : 1 ,
>   "quadCount" : 0 ,
>   "tripleCount" : 1
> }
> * Connection #0 to host localhost left intact
> [~/workspace/jena-fuseki2] 
> ian@ian-desktop $ curl http://localhost:3030/foo/data
> { <http://example/foo>
>           <http://example/p>  <http://example/b> , <http://example/a> .
> }
> {noformat}
> What I am suggesting is that the final GET returns a graph of one triple: :foo \:p :b



--
This message was sent by Atlassian JIRA
(v6.2#6252)