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

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

Ian Dickinson created JENA-738:
----------------------------------

             Summary: 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: Improvement
          Components: Fuseki
            Reporter: Ian Dickinson
            Priority: Minor


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)