Versions Compared

Key

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

...

This guide is designed to describe the details of both LDP and PCDM in the context of F4 by walking through a simple example of a single collection, consisting of a single book that implements page ordering.

Note: 

Panel
titleBGColorgray
title0: Final State - Complete
borderStylesolid

This diagram depicts the logical structure of resources and relationships of a collection ("poe") that consists of a book ("raven") that consists of three pages that are ordered.

The following steps will walk through the process of creating this structure from the ground up.
The different types of LDP containers and sources will be detailed, as well as the PCDM types and relationships in the steps below. 

...

Panel
titleBGColorgray
titleCover - Create Files

Once again, we demonstrate the use of LDP in creating PCDM relationships simply as a result of repository interactions.


Add two pcdm:File resources to the DirectContainer, "files/" as follows:

Code Block
curl -i -XPUT -H"Content-Type: image/jpeg" --data-binary @cover.jpg localhost:8080/rest/objects/raven/pages/cover/files/cover.jpg

Where "cover.jpg" is attached.

If you perform a subsequent HTTP HEAD on this new resource, you will see there is a "Link" header of rel="describedby". Update the RDF metadata of the ldp:NonRdfSource to specify that the resource is a pcdm:File, as follows:

Code Block
curl -i -XPATCH -H"Content-Type: application/sparql-update" --data-binary @pcdm-file.ru localhost:8080/rest/objects/raven/pages/cover/files/cover.jpg/fcr:metadata

Where "pcdm-file.ru" follows:

Code Block
titlepcdm-file.ru
 PREFIX pcdm: <http://pcdm.org/models#>
INSERT {
  <> a pcdm:File
} WHERE {
}

Repeat for the attached TIFF, cover.tif

Code Block
curl -i -XPUT -H"Content-Type: image/tiff" --data-binary @cover.tif localhost:8080/rest/objects/raven/pages/cover/files/cover.tif
curl -i -XPATCH -H"Content-Type: application/sparql-update" --data-binary @pcdm-file.ru localhost:8080/rest/objects/raven/pages/cover/files/cover.tif/fcr:metadata

After creating the two "cover" resources, an HTTP GET on "cover/" will include the two new triples:

No Format
<http://localhost:8080/rest/objects/raven/pages/cover/> pcdm:hasFile <http://localhost:8080/rest/objects/raven/pages/cover/files/cover.jpg> 
<http://localhost:8080/rest/objects/raven/pages/cover/> pcdm:hasFile <http://localhost:8080/rest/objects/raven/pages/cover/files/cover.tif>

Once again,

  • the subject of the triple comes from the "ldp:membershipResource" defined on "files/"
  • the predicate of the triple comes from the "ldp:hasMemberRelation" defined on "files/", and
  • the object of the triple is the new resource ("cover.jpg" or "cover.tif") that was added to the ldp:DirectContainer ("files/")
Panel
titleBGColorgray
titlePage0 - Create DirectContainer

Here we repeat the exact steps as for the "cover/" above, but for "page0".

Image Added

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-page0-direct.ttl" follows:

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

<> a ldp:DirectContainer, pcdm:Object ;
  ldp:membershipResource </rest/objects/raven/pages/page0/> ;
  ldp:hasMemberRelation pcdm:hasFile .
Panel
titleBGColorgray
titlePage0 - Create Files

Here we add the attached page0 files (page0.jpg and page0.tif) to the newly created DirectContainer. 

Image Added

Code Block
curl -i -XPUT -H"Content-Type: image/jpeg" --data-binary @page0.jpg localhost:8080/rest/objects/raven/pages/page0/files/page0.jpg
curl -i -XPUT -H"Content-Type: image/tiff" --data-binary @page0.tif localhost:8080/rest/objects/raven/pages/page0/files/page0.tif

Followed by assigning the type of pcdm:File to the respective RDF Sources found in the "Link; rel=describedby" header of each of the ldp:NonRdfSources.

Code Block
curl -i -XPATCH -H"Content-Type: application/sparql-update" --data-binary @pcdm-file.ru localhost:8080/rest/objects/raven/pages/page0/files/page0.jpg/fcr:metadata
curl -i -XPATCH -H"Content-Type: application/sparql-update" --data-binary @pcdm-file.ru localhost:8080/rest/objects/raven/pages/page0/files/page0.tif/fcr:metadata

Where "pcdm-file.ru" follows:

Code Block
titlepcdm-file.ru
PREFIX pcdm: <http://pcdm.org/models#>
INSERT {
  <> a pcdm:File
} WHERE {
}
Panel
titleBGColorgray
title2: Final State - Collection

 

...