Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Panel
titleBGColorgray
titleBook - Create DirectContainer

Here we will begin to walk through the mechanics of creating the structures that will facilitate creation of the book and its pages.


First, create the top-level "objects/" pcdm:Object, which is also an ldp:BasicContainer.

Code Block
curl -i -XPUT -H"Content-Type: text/turtle" --data-binary @pcdm-object.ttl localhost:8080/rest/objects/

Where "pcdm-object.ttl" follows:

Code Block
titlepcdm-object.ttl
@prefix pcdm: <http://pcdm.org/models#>
 
<> a pcdm:Object .

Second, create the nested "raven/" pcdm:Object, which is also another ldp:BasicContainer.

Code Block
curl -i -XPUT -H"Content-Type: text/turtle" --data-binary @pcdm-object.ttl localhost:8080/rest/objects/raven/

Lastly, create an ldp:DirectContainer, "pages/" that will facilitate the establishment of relationships between "raven/" and its constituent pages.

Code Block
curl -i -XPUT -H"Content-Type: text/turtle" --data-binary @ldp-direct.ttl localhost:8080/rest/objects/raven/pages/

Where "ldp-direct.ttl" follows:

Code Block
titleldp-direct.ttl
@prefix ldp: <http://www.w3.org/ns/ldp#>
@prefix pcdm: <http://pcdm.org/models#>

<> a ldp:DirectContainer ;
  ldp:membershipResource </rest/objects/raven/> ;
  ldp:hasMemberRelation pcdm:hasMember .

An ldp:DirectContaner is an LDP construct that activates the creation of certain RDF triples when a new resource is added as a child of this container.
Specifically, when an new resources is added inside of the "pages/" DirectContainer, a new triple on the ldp:membershipResource ("raven/") will be created with the predicate defined by the ldp:hasMemberRelation property ("pcdm:hasMember") and a subject that is a reference to the new resource.

We will see this in action next!

...

Panel
titleBGColorgray
titleBook - Create Page1

This step in creating the final page, "page1/", follows the same pattern shown in the previous two steps. 

Code Block
curl -i -XPUT -H"Content-Type: text/turtle" --data-binary @pcdm-object.ttl localhost:8080/rest/objects/raven/pages/page1/
Panel
titleBGColorgray
titleCover - Create DirectContainer

In the same way that we used an ldp:DirectContainer to facilitate the auto-generation of triples linking "raven/" to each of the pages, now use the same pattern to auto-generate the creation of triples that link each page to its various file representations.
To begin with, create an ldp:DirectContainer, "files/", which is also a pcdm:Object, as a child of "cover/" as follows:

Code Block
curl -i -XPUT -H"Content-Type: text/turtle" --data-binary @ldp-cover-direct.ttl localhost:8080/rest/objects/raven/pages/cover/files/

Where "ldp-cover-direct.ttl" follows:

Code Block
titleldp-cover-direct.ttl
@prefix ldp: <http://www.w3.org/ns/ldp#>
@prefix pcdm: <http://pcdm.org/models#>

<> a ldp:DirectContainer ;
  ldp:membershipResource </rest/objects/raven/pages/cover/> ;
  ldp:hasMemberRelation pcdm:hasMember .
Panel
titleBGColorgray
title2: Final State - Collection

 

...