ldp-primer/ldp-primer.html
changeset 958 2f25528e103a
parent 876 715fcd4d4710
child 959 b2d2d631693e
equal deleted inserted replaced
938:859f98c26867 958:2f25528e103a
   483       <p>In this case, the response tells Alice's LDP client that this is an LDP-Basic Container and the container allows her to POST things of both RDF types (text/turtle, application/ld+json) and images (image/bmp and image/jpeg).</p>
   483       <p>In this case, the response tells Alice's LDP client that this is an LDP-Basic Container and the container allows her to POST things of both RDF types (text/turtle, application/ld+json) and images (image/bmp and image/jpeg).</p>
   484 
   484 
   485     </section>
   485     </section>
   486 
   486 
   487     <section>
   487     <section>
   488       <h2> Creating a RDF resource (POST an RDF resource to an LDP-BC) </h2> 
   488       <h3 id="meta-structure">Creating Containers and Structural Hierarchy</h3>
       
   489       <p>In order for the client to introduce hierarchy to the management of documents, the document store allows creation of container resources, enabling Alice to create a container hierarchy to organise her documents. This can be done by POSTing (a child) container representation to a (parent) container. For instance, it enables Alice to create a child container which she intends to use for image storage.
       
   490       </p>
       
   491 
       
   492     <figure id="fig-bcs">
       
   493       <img src="images/bcs.png" alt=".." />
       
   494       <figcaption>Child Containers inside a Basic Container.</figcaption>
       
   495     </figure>
       
   496 
       
   497       <pre title="State of Alice's document store before creating the photo (child) container" class='example' data-include='examples/create_cr_s1.txt' data-oninclude='fixCode'></pre>  
       
   498 
       
   499       <p>To create a new container for managing photos, Alice POSTs a representation of a container (LDP-BC) to the root container. Alice express her intention that the newly created resource should be an LDP Basic Container by including a Link header in the request with the relationship "type". </p>
       
   500       <pre title="Request - creating a new container" class='example' data-include='examples/create_cr_req.txt' data-oninclude='fixCode'></pre>  
       
   501       <p>If the POST is successful, the server responds with the location of the newly created container for the photos.</p>
       
   502       <pre title="Response - creating a new container" class="example">
       
   503 HTTP/1.1 201 Created
       
   504 Location: http://example.org/alice/photos/
       
   505 Link: &lt;http://www.w3.org/ns/ldp#Resource&gt;; rel=&quot;type&quot;
       
   506 Content-Length: 0  
       
   507         </pre>  
       
   508 
       
   509       <p>This is how the parent container will look like after creating the new container</p>
       
   510       <pre title="State of Alice's document store after creating the photo (child) container" class='example' data-include='examples/create_cr_s2.txt' data-oninclude='fixCode'></pre> 
       
   511       <p>and the photo container will look like the following.</p>
       
   512       <pre title="State of Alice's newly created photo container" class='example' data-include='examples/create_cr_s3.txt' data-oninclude='fixCode'></pre> 
       
   513 
       
   514     </section> 
       
   515 
       
   516     <section>
       
   517       <h2> Creating an RDF resource (POST an RDF resource to an LDP-BC) </h2> 
   489 
   518 
   490       <p>
   519       <p>
   491         Alice can upload a social profile document to her store, by POSTing her FOAF personal profile document to her LDP-BC at the root of her document store. Note, the Slug header offers the server a hint about URL of the resource to be created.  
   520         Alice can upload a social profile document to her store, by POSTing her FOAF personal profile document to her LDP-BC at the root of her document store. Note, the Slug header offers a hint to the server about the URL of the resource to be created. Alice also indicates that the newly created resource should be an LDP Resource by including a Link header in the request with the relationship "type".
   492       </p>
   521       </p>
   493       
   522       
   494       <p> The FOAF document includes statements about the resource to be created and other resources relative to the resource to be created. According the LDP specification
   523       <p> The FOAF document includes statements about the resource to be created and other resources relative to the resource to be created. According the LDP specification, Alice can use an empty relative URI (&lt;&gt;) in the request entity body to refer to resource to be created.
   495       Alice can use null relative URI (<>) in the request entity body to refer to resource to be created.
       
   496       
   524       
   497       </p>
   525       </p>
   498 
   526 
   499       <pre title="Request - creating a RDF resource" class='example' data-include='examples/bccreate.txt' data-oninclude='fixCode'></pre> 
   527       <pre title="Request - creating an RDF resource" class='example' data-include='examples/bccreate.txt' data-oninclude='fixCode'></pre> 
   500 
   528 
   501    </pre> 
   529       <pre title="Response - creating an RDF resource" class="example"> 
   502 
   530         HTTP/1.1 201 Created
   503    <pre title="Response - creating a RDF resource" class="example"> 
   531         Location: http://example.org/alice/foaf
   504 HTTP/1.1 201 Created
   532         Link: &lt;http://www.w3.org/ns/ldp#Resource&gt;; rel="type"
   505 Location: http://example.org/alice/foaf
   533         Content-Length: 0 
   506 Link: &lt;http://www.w3.org/ns/ldp#Resource&gt;; rel=&#39;type&#39;
   534       </pre>
   507 Content-Length: 0 
       
   508    </pre>
       
   509       <p> The response to the create request provides a Link to the newly created resource using the Location header. In this case, the server has honored the hint provided by the slug header and created the new resource in the URL http://example.org/alice/foaf. </p>
   535       <p> The response to the create request provides a Link to the newly created resource using the Location header. In this case, the server has honored the hint provided by the slug header and created the new resource in the URL http://example.org/alice/foaf. </p>
   510       <p>Knowing the URL of the newly created resource, Alice can check the container again to confirm that the container correctly contains the newly created resource.</p>
   536       <p>Knowing the URL of the newly created resource, Alice can check the container again to confirm that the container correctly contains the newly created resource.</p>
   511 
   537 
   512       <pre title="Request - basic container retrieval after resource created" class="example">
   538       <pre title="Request - basic container retrieval after resource created" class="example">
   513     GET /alice/ HTTP/1.1
   539         GET /alice/ HTTP/1.1
   514     Host: example.org
   540         Host: example.org
   515     Accept: text/turtle, application/ld+json
   541         Accept: text/turtle, application/ld+json
   516      </pre>
   542       </pre>
   517 
   543 
   518      <pre title="Response - basic container retrieval after resource created" class='example' data-include='examples/bcget_res.txt' data-oninclude='fixCode'/>
   544       <pre title="Response - basic container retrieval after resource created" class='example' data-include='examples/bcget_res.txt' data-oninclude='fixCode'/>
   519      <p>
   545       <p>
   520        The ldp:contains containment triple discloses the newly created resource in the response. 
   546         The ldp:contains containment triple discloses the newly created resource in the response. 
   521      </p>
   547       </p>
   522 
   548 
   523     </section>
   549     </section>
   524 
   550 
   525     <section>
   551     <section>
   526       <h2> Creating a non-RDF (binary) resource (POST an image to an LDP-BC) </h2> 
   552       <h2> Creating a non-RDF (binary) resource (POST an image to an LDP-BC) </h2> 
   528       <p>Next, Alice wants to upload a photo of herself to the document storage. She can create an image by POSTing it in the same way she created the RDF document.</p>
   554       <p>Next, Alice wants to upload a photo of herself to the document storage. She can create an image by POSTing it in the same way she created the RDF document.</p>
   529 
   555 
   530       <pre title="Request - creating a non-RDF resource" class="example"> 
   556       <pre title="Request - creating a non-RDF resource" class="example"> 
   531 POST /alice/ HTTP/1.1
   557 POST /alice/ HTTP/1.1
   532 Host: example.org
   558 Host: example.org
       
   559 Link: &lt;http://www.w3.org/ns/ldp#Resource&gt;; rel="type"
   533 Slug: avatar
   560 Slug: avatar
   534 Content-Type: image/png
   561 Content-Type: image/png
   535 Content- Length: 1020
   562 Content- Length: 1020
   536 
   563 
   537 ### binary data ###
   564 ### binary data ###
   599      
   626      
   600       <pre title="Response - after deletion" class="example"> 
   627       <pre title="Response - after deletion" class="example"> 
   601 HTTP/1.1 410 Gone 
   628 HTTP/1.1 410 Gone 
   602    </pre>     
   629    </pre>     
   603     </section>
   630     </section>
   604 
       
   605     <section>
       
   606       <h3 id="meta-structure">Structural Manipulation (Child Containers)</h3>
       
   607       <p>In order for the client to introduce hierarchy to the management of documents, the document store allows creation of documents which are containers. That enables Alice to create a container hierarchy to organise her documents. This can be done by POSTing (a child) container representation to a (parent) container. This enables Alice to create a child container which she intends to use for image storage.
       
   608       </p>
       
   609 
       
   610     <figure id="fig-bcs">
       
   611       <img src="images/bcs.png" alt=".." />
       
   612       <figcaption>Child Containers inside a Basic Container.</figcaption>
       
   613     </figure>
       
   614 
       
   615       <pre title="State of Alice's document store before creating the photo (child) container" class='example' data-include='examples/create_cr_s1.txt' data-oninclude='fixCode'></pre>  
       
   616 
       
   617       <p>To create a new container for managing photos, Alice POSTs a representation of a container (LDP-BC) to the root container. Alice express her intention that the newly created resource should be an LDP Basic Container by including a Link header in the request with the relationship 'type'. </p>
       
   618       <pre title="Request - creating a new container" class='example' data-include='examples/create_cr_req.txt' data-oninclude='fixCode'></pre>  
       
   619       <p>If the create is successful, the server responds with location of the newly created container for the photos.</p>
       
   620       <pre title="Response - creating the new container" class="example">
       
   621 HTTP/1.1 201 Created
       
   622 Location: http://example.org/alice/photos/
       
   623 Link: &lt;http://www.w3.org/ns/ldp#Resource&gt;; rel=&quot;type&quot;
       
   624 Content-Length: 0  
       
   625         </pre>  
       
   626 
       
   627       <p>After creation of this new container, the parent container will look like</p>
       
   628       <pre title="State of Alice's document store after creating the photo (child) container" class='example' data-include='examples/create_cr_s2.txt' data-oninclude='fixCode'></pre> 
       
   629       <p>and the photo container will look like the following.</p>
       
   630       <pre title="State of Alice's newly created photo container" class='example' data-include='examples/create_cr_s3.txt' data-oninclude='fixCode'></pre> 
       
   631 
       
   632     </section> 
       
   633 
   631 
   634   </section>
   632   </section>
   635 
   633 
   636   <section id="bugtracker">
   634   <section id="bugtracker">
   637     <h1>Bug Tracker Example (LDP Direct containers)</h1>
   635     <h1>Bug Tracker Example (LDP Direct containers)</h1>