Re: Question regarding POST versus PUT for creating an LDPC

First of all, thanks for your feedback.

I understand the case of creating a resource within a container and using
the container as a factory for that. I think I understand the case of
creating a container.

In the case that I am creating a named container, I am considering the
following:

HTTP PUT (of type text/turtle) TO URI: http://base22.com/carbon/ourco

@base <http://base22.com/carbon> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix dcterms: <http://purl.org/dc/terms/>.
@prefix ldp: <http://www.w3.org/ns/ldp#>.

<>
    a ldp:Container;
    dcterms:description "A domain root container for OurCo resources.";
    rdfs:comment "In a multitenant environment, Carbon LDP typically uses a
root container after the servlet context to represent the concept of the
tenant (e.g. a site, application, or particular domain of knowledge.";
    rdfs:label "ourco".

My thought is because I am PUTting to "/ourco" and an LDPC/LDPR does not
yet exist at that URI, then the server can accept creation of the
container, which would henceforth be accessible at that URI.

Does that sound about right?

- Cody



On Wed, Apr 17, 2013 at 5:38 AM, Eric Prud'hommeaux <eric@w3.org> wrote:

> * Cody Burleson <cody.burleson@base22.com> [2013-04-16 23:37-0500]
> > Team,
> >
> > I'm curious of your opinion.
> >
> > I have been feverishly trying to catch up, where time permits, by trying
> my
> > hand at implementing what is specified thus far (in Java, as a layer atop
> > Tomcat).
> >
> > One area where I'm having doubts is on what might be the more logical
> HTTP
> > method for the creation of an LDPC. POST or PUT?
> >
> > I kind of get the feeling that the spec, as it stands, seems to imply
> that
> > PUT is the better method. But I'm not so sure.
> >
> > In your experience, is there a convention for CREATE? It just doesn't
> seem
> > clear to me that one is intended over the other. I suppose both could be
> > supported, but what would be the majority expectation?
> >
> > Or does it matter?
> >
> > Sorry - I know I'm not really contributing yet, but rather - just asking
> > more questions. But I think, perhaps, that once I get my code up to a
> point
> > where it's starting to have good coverage, it may start to reveal some
> real
> > questions and issues that could add value. So, bear with me (and be
> gentle).
>
> If the client knows or has control over the name of the resource to be
> created, it should PUT the contents to the new location. There are
> several problems with this caveat:
>
> 1 PUTting a resource names that aren't cryptographically unique means
>   it's likely that some client has already created that resource,
>   e.g. all clients try all the time to create container/item1.
>
> 2 The server implementation might constrain the names of the resources
>   it can store and serve, e.g. one backed by a database which stores
>   only an integer which it concatonates unto "container/item".
>
> For these reasons, LDP also supports the common web convention of
> POSTing to a factory to create new resources. In LDP's case, that
> factory is called a container and there is a prescribed protocol and
> media language for talking to it.
>
> Hope I answered the right question.
>
>
> > --
> > Cody Burleson
>
> --
> -ericP
>



-- 
Cody Burleson
Enterprise Web Architect, Base22
Mobile: +1 (214) 702-6338
Skype: codyburleson
Email: cody@base22.com
Blog: codyburleson.com

* <http://base22.com>*
*
*
*Check my free/busy
time.<http://www.google.com/calendar/embed?src=cody.burleson%40base22.com&ctz=America/Chicago%20>
*

Received on Wednesday, 17 April 2013 14:01:21 UTC