Fedora4 (F4) implements the Linked Data Platform (LDP) W3C Recommendation. Additionally, the Portland Common Data Model (PCDM) has increasingly become adopted as a common content modeling approach in Fedora4.
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.
Note0: Although the following example uses specifically named resources, such as "poe" and "raven", production scenarios will likely use opaque identifiers/URLs by allowing them to be auto-generated by F4. Note1: An easy way to stand-up an environment for executing the following REST requests is to use fcrepo4-vagrant.
0: Final State - Complete
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.
1: Final State - Book
The ldp:BasicContainers are simply containers of other resources. BasicContainers can contain both other containers as well as ldp:NonRdfSources (or "binaries").
There are three PCDM types here:
pcdm:Object
pcdm:Collection
pcdm:File
Additionally, there are two PCDM relationships that indicate resource membership and file membership:
pcdm:hasMember
pcdm:hasFile
The descriptions of these resource types and relationships may be found in the detailed Portland Common Data Model page.
Book - 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.
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!
Book - Create cover
Create a new pcdm:Object, "cover/", that is also an ldp:BasicContainer within the "pages/" DirectContainer.
the subject of the triple comes from the "ldp:membershipResource" defined on "pages/"
the predicate of the triple comes from the "ldp:hasMemberRelation" defined on "pages/", and
the object of the triple is the new resource ("cover/") that was added to the ldp:DirectContainer ("pages/")
Book - Create Page0
In the same fashion as the previous step, adding "page0/" to the DirectContainer, "pages/" results in a new auto-generated triple on "raven/" of the form:
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 pcdm:Object to their various file representations.
To begin with, create an ldp:DirectContainer, "files/", which is also a pcdm:Object, as a child of "cover/" as follows:
Now, any new resource that is added as a child of the DirectContainer "files/" will cause the auto-generation of a new triple on "cover/" that has a predicate of pcdm:hasFile and an object of the new resource.
Cover - 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:
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:
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.
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.