Due to the evolution of usage patterns for PCDM (particularly as they relate to Fedora), the structure of resources described in this guide is not necessarily the recommended structure. However, the details and examples of how to use LDP Direct and Indirect Containers are still very informative in understanding how those constructs work.
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.
LDP defines terminology and interaction models relating to linked data resources and servers. The "action" in inter"action" models should be emphasized, because LDP introduces two new concepts that enhance the actions within a linked data server, F4 in this case. These concepts are:
DirectContainer
IndirectContainer
These two container types have associated behavior that are highlighted and clarified here, in this guide. Two different uses of DirectContainers are illustrated in the Book and Ordering examples, respectively, and the use of IndirectContainers is described in the Collections example.
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. Note1a: F4 is deployed in the fcrepo4-vagrant box with the context "fcrepo". If you are deploying in another environment, you may need to change the "curl" requests and turtle files (*.ttl) below to reflect a different context. Note2: Please use your Internet browser to inspect the results of each of the steps below! http://localhost:8080/fcrepo/rest
The full slide deck of images are available for
ldp-pcdm-f4.pdf.
End Goal - Final State
Error rendering macro 'panel'
com.atlassian.renderer.v2.macro.basic.validator.MacroParameterValidationException: Border style is not a valid CSS2 border-style value
Books In Action
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.
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 a new resource 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 an object that is a reference to the new resource.
The auto-created triple resulting from the addition of a new child resource within "pages/" will take the form:
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
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
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.
PREFIX pcdm: <http://pcdm.org/models#>
INSERT {
<> a pcdm:File
} WHERE {
}
Book - Conclusion
Using LDP in conjunction with PCDM terms, we have created a book, "raven/", with its constituent pages and their file representations.
Collections In Action
2: Final State - Collection
Continuing with the previous example of modeling and creating a book with LDP, PCDM and F4, here we will detail an approach for adding that book, "raven/" to a new collection, "poe/".
The objective in this section is to leverage LDP interaction models to not only create the appropriate pcdm:hasMember relationship between the collection "poe/" and the book "raven/", but to put the LDP structure in place for a simplified addition of new items to the "poe/" collection.
Here we will begin to walk through the mechanics of creating the structures that will facilitate creation of the collection and its single member, in this case.
First, create the top-level "collections/" pcdm:Object, which is also an ldp:BasicContainer.
Similar to the previously described ldp:DirectContainer, an ldp:IndirectContainer is an LDP construct that also activates the creation of certain RDF triples when a new resource is added as a child of this container. Just like with a DirectContainer, when a new resource is added inside of the "members/" IndirectContainer, a new triple on the ldp:membershipResource ("poe/") will be created with the predicate defined by the ldp:hasMemberRelation property ("pcdm:hasMember"). However, the difference from a DirectContainer is that the object of the created triple is not the newly added child, but instead the resource defined by the ldp:insertedContentRelation property (ore:proxyFor, in this case) found on the newly added child of this container.
We will see this in action next!
Collection - Create Raven Proxy
Collection - Create Raven Proxy
Create a new pcdm:Object, "ravenProxy/", that is an ldp:RdfSource within the "members/" IndirectContainer.
The ldp:IndirectContainer defines the creation of this triple as follows:
the subject of the triple comes from the "ldp:membershipResource" defined on "members/"
the predicate of the triple comes from the "ldp:hasMemberRelation" defined on "members/", and
the object of the triple is the resource defined by the ldp:insertedContentRelation property (ore:proxyFor) found on the newly added child resource, "ravenProxy".
Collection - Conclusion
Using LDP in conjunction with PCDM terms, we have created a collection, "poe/", with its single member, "raven/".
Ordering In Action
3: Final State - Ordered Pages
This final example will both illustrate a second use of ldp:DirectContainers as well as detail the PCDM recommendation for how to handle ordering of resources.
The addtional predicates/relationships that will be used in this example are:
As in the book example, begin with creating an ldp:DirectContainer, "orderProxies/", as a child of the book, "raven/", resource. This new DirectContainer will facilitate the auto-creation of triples that will define the membership relationship between the book, "raven/", and the proxies. Then, the new proxy resources within this DirectContainer will be used to establish an ordering of the books pages.
Note: This example assumes the previous creation of "/objects/raven/" and the cover and page resources from the Book example in this series.
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.
Like the "pages/" DirectContainer in an earlier example, the "orderProxies/" includes the ldp:membershipResource property ("raven/"). However, it is important to point out that the "orderProxies/" DirectContainer *does not* have the ldp:hasMemberRelation property defined, but instead uses ldp:isMemberOfRelation of "ore:proxyIn". By using ldp:isMemberOfRelation, the auto-created triple resulting from the addition of a new child resource within "orderProxies/" will take the form:
the subject of the triple is the new resource ("coverProxy") that was added to the ldp:DirectContainer ("orderProxies/")
the predicate of the triple comes from the "ldp:isMemberOfRelation" defined on "orderProxies/", and
the object of the triple comes from the "ldp:membershipResource" defined on "orderProxies/"
Ordering - Create Page0 Proxy
Ordering - Create Page0 Proxy
In the same fashion as the previous step, adding "page0Proxy" to the DirectContainer, "orderProxies/" results in a new auto-generated triple on "page0Proxy" of the form:
Now that the proxies have been created, and associated with the book ("raven/") and the proxied resources, we can actually use the proxies to establish ordering, per the PCDM recommendations. First, establish the order among the proxies with iana:next and iana:prev.
1) Establish "coverProxy" has iana:next of "page0Proxy":