Re: POSTing to a collection and GETing its index

On 10 Apr 2012, at 15:54, Henry Story wrote:

> 
> On 9 Apr 2012, at 15:12, Alexandre Bertails wrote:
> 
>> Hi Henry,
>> 
>> On 04/08/2012 06:20 PM, Henry Story wrote:
>>> Hi,
>>> 
>>>  As I understand POSTing a resource to a Collection should create a new resource.
>>> We want to allow collections to be POST only so that unknown people can post into
>>> a collection without seeing the other resource in it. (whilst perhaps allowing the
>>> POSTer to edit the resources he created in that collection). We would like the owner
>>> of the collection to be able to know what is in the collection: so that he can for
>>> example find the new resources POSTed there.
>>> 
>>>  So some user should be able to
>>> 
>>> POST /collection/ HTTP/1.1
>>> 
>>> thereby having the read-write-web server create the resource
>>> 
>>>  /collection/r42
>>> 
>>> which he could later edit in case he made a mistake. But he would not be
>>> albe to find the elements of the collection by doing a
>>> 
>>> GET /collection/
>> 
>> There is no perfect solution for handling collections. I kind of like
>> Sandro's idea [1]. Also, this is a place where using the WebDav verbs
>> (eg. MKCOL) should be considered IMO. But this could be a problem in
>> the browser.
> 
> 
> Thanks. I added  file creation to a collection with the last patch
> 
>   https://dvcs.w3.org/hg/read-write-web/rev/5cf67ba5c0d4
> 
> in particular
> 
>   https://dvcs.w3.org/hg/read-write-web/file/5cf67ba5c0d4/src/main/scala/ReadWriteWeb.scala#l115
> 
> I'll try to do directory listings next, and also read up more closely on the
> other comments on the list....

Btw. one very nice feature of POSTing docs to collections, is that you
can POST a document with a relative URL say

   <#me> a foaf:Person .

and have the <#me> then bound to the URL of the to-be-created document.
So that if above document is POSTed to  <http://example.com/collection/>
creating in the process <http://example.com/collection/doc21231.rdf> then
the URI of the user above will be

   <http://example.com/collection/doc21231.rdf#me> 


It works pretty much out of the box and I added a test case for it
here:

   https://dvcs.w3.org/hg/read-write-web/file/5e48ef562a36/src/test/scala/CreateContentSpecs.scala#l78



Henry



> 
> 
> 
>> Alexandre.
>> 
>> [1] http://www.w3.org/2001/sw/wiki/REST#Creating_Collections
>> 
>>> 
>>> as that would be protected. He certainly could not edit what ends up being the
>>> equivalent of /collection/index{.rdf} since he does not have access to that
>>> file. It must therefore be up to the ReadWriteWeb server to do three things:
>>> 
>>> 1. create a name for the POSTed resource
>>> 2. update/display the collection (sioc:Collection?) index retrieved when
>>>    doing a GET /collection/
>>> 3. Only show a subset of those elements of the collection that an agent
>>>    has read access to
>>> 
>>> I think the scala read-write-web does not have POST on a collection (a directory
>>> in unix terminology) create a new file currently. (It has a POST of a SPARQL update
>>> on an rdf information resource change it.)
>>> 
>>> Does that sound right?
>>> 
>>> 	Henry
>>> 
>>> 
>>> Social Web Architect
>>> http://bblfish.net/
>>> 
>>> 
>> 
> 
> Social Web Architect
> http://bblfish.net/
> 

Social Web Architect
http://bblfish.net/

Received on Tuesday, 10 April 2012 18:58:20 UTC