Current Release

This documentation covers the current version of Fedora. Looking for another version? See all documentation.

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Fedora implements the following container types, which are defined by the LDP specification:

  • ldp:BasicContainer
  • ldp:DirectContainer
  • ldp:IndirectContainer

This document describes the basic interactions for these object types within Fedora, and some specific behavior decisions the application makes. For more details about

BasicContainer

ldp:BasicContainer are created by default in Fedora requests if no interaction model or unsupported RDF serialization Content-Type is provided. They ldp:containers, and as a result, objects which are created as children of these containers will create containment triples from the BasicContainer to the child object, using the ldp:contains predicate.

Interactions with these objects are documented in RESTful HTTP API - Containers, along with supported RDF serialization types.

DirectContainer

In addition to the regular containment behaviors of ldp:Containers, ldp:DirectContainers are used to produce membership triples between a membership resource and the immediate children of the DirectContainer. For more information, you may refer to the LDP specification and LDP-PCDM-F4 In Action.

The membership resource of a DirectContainer is defined by the Object of a ldp:membershipResource property. If this property is not set, by default the DirectContainer itself used. Any resource URI may be specified, whether it is within the Fedora repository or not. However, it must be a resource URI, literals are disallowed. Only one membership resource may be specified per DirectContainer.

To specify which predicate to use for the membership triples, either a ldp:hasMemberRelation or ldp:isMemberOfRelation property should be set on the DirectContainer. If the former property is set, for each child of the DirectContainer a membership property will be created with the membership resource as the subject and the child as the object. If the ldp:isMemberOfRelation is used, the subject and object will be reversed. If no property is provided, by default ldp:hasMemberRelation with the object ldp:member will be added to the DirectContainer. Only one of these two properties may be present per container, and only a single instance of it.

To create a DirectContainer with default properties, simply provide the appropriate interaction model:

curl -XPUT http://localhost:8080/rest/direct_container -H'Link: <http://www.w3.org/ns/ldp#DirectContainer>;rel="type"'

To create a DirectContainer with a different membership resource and relation:

echo "
<> <http://www.w3.org/ns/ldp#membershipResource> <http://localhost:8080/rest/membership_resc> .
<> <http://www.w3.org/ns/ldp#hasMemberRelation> <http://example.com/hasMember> .
" |
curl -XPUT http://localhost:8080/rest/direct_container -H'Link: <http://www.w3.org/ns/ldp#DirectContainer>;rel="type"' -H"Content-Type: text/turtle" --data-binary "@-"

The properties of the DirectContainer may be updated after creation via PATCH or PUT.

The membership triples produced will be included in GET responses to the membership resource if the DirectContainer specifies ldp:hasMemberRelation (<http://localhost:8080/rest/membership_resc> in the example above), or in the response for child objects if ldp:isMemberOfRelation was set.

Membership triples are returned in responses from mementos of objects as well. It should be noted that even with autoversioning enabled, adding membership triples to a resource does not trigger a new memento of that resource. If the DirectContainer, the membership resource, or a child of the DirectContainer is deleted along with its fcr:tombstone, any membership triples resulting from that resource will no longer appear in mementos.

IndirectContainer

ldp:IndirectContainers are a subclass of ldp:DirectContainer, so everything previously described about those applies here as well. What they add is the ability to create membership triples to resources which are not the immediate children of the container, via proxy objects.

By default, IndirectContainers will have a ldp:insertedContentRelation property with the object ldp:MemberSubject. If the property has this object, then the container will function like a DirectContainer in that membership triples will only be generated for immediate children of the container.

If any other predicate URI is provided as the object of this property, then membership will be generated between the membership resource and resources referenced by the children of the IndirectContainer. These children are referred to as proxy objects. Only resources referenced by the children using the same predicate defined via the ldp:insertedContentRelation of the IndirectContainer will generate membership triples. Additionally, membership will only be generated for resource URIs referenced by the children, not literals.

Only one member may be referenced per proxy, but the same member resource can be referenced by any number of proxy objects in any number of IndirectContainers.

To create an IndirectContainer with membership resource "http://localhost:8080/rest/membership_resc":

echo "
<> <http://www.w3.org/ns/ldp#membershipResource> <http://localhost:8080/rest/membership_resc>;
   <http://www.w3.org/ns/ldp#hasMemberRelation> <http://example.com/hasMember>;
   <http://www.w3.org/ns/ldp#insertedContentRelation> <http://example.com/proxyFor>
" |
curl -XPUT http://localhost:8080/rest/indirect_container -H'Link: <http://www.w3.org/ns/ldp#IndirectContainer>;rel="type"' -H"Content-Type: text/turtle" --data-binary "@-"

To add "http://localhost:8080/rest/member1" as a member of membership_resc, you could create a proxy as follows:

echo "
<> <http://example.com/proxyFor> <http://localhost:8080/rest/member1>" |
curl -XPUT http://localhost:8080/rest/indirect_container/proxy1 -H"Content-Type: text/turtle" --data-binary "@-"

At which point a GET request to membership_resc would return the membership triple:

curl http://localhost:8080/rest/membership_resc

@prefix ldp:   <http://www.w3.org/ns/ldp#> .
<http://localhost:8080/rest/membership_resc>
        <http://example.com/hasMember>  <http://localhost:8080/rest/member1> .
        ...
  • No labels