fcrepo4_deltas.rst 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. Divergencies between lakesuperior and FCREPO4
  2. =============================================
  3. This is a (vastly incomplete) list of discrepancies between the current
  4. FCREPO4 implementation and LAKEsuperior. More will be added as more
  5. clients will use it.
  6. Not yet implemented (but in the plans)
  7. --------------------------------------
  8. - Various headers handling
  9. - Versioning (incomplete)
  10. - AuthN/Z
  11. - Fixity check
  12. - Blank nodes
  13. Potentially breaking changes
  14. ----------------------------
  15. The following divergences may lead into incompatibilities with some
  16. clients.
  17. Atomicity
  18. ~~~~~~~~~
  19. FCREPO4 supports batch atomic operations whereas a transaction can be
  20. opened and a number of operations (i.e. multiple R/W requests to the
  21. repository) can be performed. The operations are persisted in the
  22. repository only if and when the transaction is committed.
  23. LAKesuperior only supports atomicity for a single HTTP request. I.e. a
  24. single HTTTP request that should result in multiple write operations to
  25. the storage layer is only persisted if no exception is thrown.
  26. Otherwise, the operation is rolled back in order to prevent resources to
  27. be left in an inconsistent state.
  28. Tombstone methods
  29. ~~~~~~~~~~~~~~~~~
  30. If a client requests a tombstone resource in FCREPO4 with a method other
  31. than DELETE, the server will return ``405 Method Not Allowed``
  32. regardless of whether the tombstone exists or not.
  33. LAKEsuperior will return ``405`` only if the tombstone actually exists,
  34. ``404`` otherwise.
  35. Web UI
  36. ~~~~~~
  37. FCREPO4 includes a web UI for simple CRUD operations.
  38. Such a UI is not in the immediate LAKEsuperior development plans.
  39. However, a basic UI is available for read-only interaction: LDP resource
  40. browsing, SPARQL query and other search facilities, and administrative
  41. tools. Some of the latter *may* involve write operations, such as
  42. clean-up tasks.
  43. Automatic path segment generation
  44. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  45. A ``POST`` request without a slug in FCREPO4 results in a pairtree
  46. consisting of several intermediate nodes leading to the automatically
  47. minted identifier. E.g.
  48. ::
  49. POST /rest
  50. results in ``/rest/8c/9a/07/4e/8c9a074e-dda3-5256-ea30-eec2dd4fcf61``
  51. being created.
  52. The same request in LAKEsuperior would create
  53. ``/rest/8c9a074e-dda3-5256-ea30-eec2dd4fcf61`` (obviously the
  54. identifiers will be different).
  55. This seems to break Hyrax at some point, but might have been fixed. This
  56. needs to be verified further.
  57. Non-standard client breaking changes
  58. ------------------------------------
  59. The following changes may be incompatible with clients relying on some
  60. FCREPO4 behavior not endorsed by LDP or other specifications.
  61. Pairtrees
  62. ~~~~~~~~~
  63. FCREPO4 generates “pairtree” resources if a resource is created in a
  64. path whose segments are missing. E.g. when creating ``/a/b/c/d``, if
  65. ``/a/b`` and ``/a/b/c`` do not exist, FCREPO4 will create two Pairtree
  66. resources. POSTing and PUTting into Pairtrees is not allowed. Also, a
  67. containment triple is established between the closest LDPC and the
  68. created resource, e.g. if ``a`` exists, a
  69. ``</a> ldp:contains </a/b/c/d>`` triple is created.
  70. LAKEsuperior does not employ Pairtrees. In the example above
  71. LAKEsuperior would create a fully qualified LDPC for each missing
  72. segment, which can be POSTed and PUT to. Containment triples are created
  73. between each link in the path, i.e. ``</a> ldp:contains </a/b>``,
  74. ``</a/b> ldp:contains </a/b/c>`` etc. This may potentially break clients
  75. relying on the direct containment model.
  76. The rationale behind this change is that Pairtrees are the byproduct of
  77. a limitation imposed by Modeshape and introduce complexity in the
  78. software stack and confusion for the client. LAKEsuperior aligns with
  79. the more intuitive UNIX filesystem model, where each segment of a path
  80. is a “folder” or container (except for the leaf nodes that can be either
  81. folders or files). In any case, clients are discouraged from generating
  82. deep paths in LAKEsuperior without a specific purpose because these
  83. resources create unnecessary data.
  84. Non-mandatory, non-authoritative slug in version POST
  85. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  86. FCREPO4 requires a ``Slug`` header to POST to ``fcr:versions`` to create
  87. a new version.
  88. LAKEsuperior adheres to the more general FCREPO POST rule and if no slug
  89. is provided, an automatic ID is generated instead. The ID is a UUID4.
  90. Note that internally this ID is not called “label” but “uid” since it is
  91. treated as a fully qualified identifier. The ``fcrepo:hasVersionLabel``
  92. predicate, however ambiguous in this context, will be kept until the
  93. adoption of Memento, which will change the retrieval mechanisms.
  94. Another notable difference is that if a POST is issued on the same resource
  95. ``fcr:versions`` location using a version ID that already exists, LAKEsuperior
  96. will just mint a random identifier rather than returning an error.
  97. Deprecation track
  98. -----------------
  99. LAKEsuperior offers some “legacy” options to replicate the FCREPO4
  100. behavior, however encourages new development to use a different approach
  101. for some types of interaction.
  102. Endpoints
  103. ~~~~~~~~~
  104. The FCREPO root endpoint is ``/rest``. The LAKEsuperior root endpoint is
  105. ``/ldp``.
  106. This should not pose a problem if a client does not have ``rest``
  107. hard-coded in its code, but in any event, the ``/rest`` endpoint is
  108. provided for backwards compatibility.
  109. Future implementations of the Fedora API specs may employ a "versioned"
  110. endpoint scheme that allows multiple Fedora API versions to be available to the
  111. client, e.g. ``/ldp/fc4`` for the current LDP API version, ``/ldp/fc5`` for
  112. Fedora version 5.x, etc.
  113. Automatic LDP class assignment
  114. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  115. Since LAKEsuperior rejects client-provided server-managed triples, and
  116. since the LDP types are among them, the LDP container type is inferred
  117. from the provided properties: if the ``ldp:hasMemberRelation`` and
  118. ``ldp:membershipResource`` properties are provided, the resource is a
  119. Direct Container. If in addition to these the
  120. ``ldp:insertedContentRelation`` property is present, the resource is an
  121. Indirect Container. If any of the first two are missing, the resource is
  122. a Container.
  123. Clients are encouraged to omit LDP types in PUT, POST and PATCH
  124. requests.
  125. Lenient handling
  126. ~~~~~~~~~~~~~~~~
  127. FCREPO4 requires server-managed triples to be expressly indicated in a
  128. PUT request, unless the ``Prefer`` header is set to
  129. ``handling=lenient; received="minimal"``, in which case the RDF payload
  130. must not have any server-managed triples.
  131. LAKEsuperior works under the assumption that client should never provide
  132. server-managed triples. It automatically handles PUT requests sent to
  133. existing resources by returning a 412 if any server managed triples are
  134. included in the payload. This is the same as setting ``Prefer`` to
  135. ``handling=strict``, which is the default.
  136. If ``Prefer`` is set to ``handling=lenient``, all server-managed triples
  137. sent with the payload are ignored.
  138. Clients using the ``Prefer`` header to control PUT behavior as
  139. advertised by the specs should not notice any difference.
  140. Optional improvements
  141. ---------------------
  142. The following are improvements in performance or usability that can only
  143. be taken advantage of if client code is adjusted.
  144. LDP-NR content and metadata
  145. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  146. FCREPO4 relies on the ``/fcr:metadata`` identifier to retrieve RDF
  147. metadata about an LDP-NR. LAKEsuperior supports this as a legacy option,
  148. but encourages the use of content negotiation to do the same while
  149. offering explicit endpoints for RDF and non-RDF content retrieval.
  150. Any request to an LDP-NR with an ``Accept`` header set to one of the
  151. supported RDF serialization formats will yield the RDF metadata of the
  152. resource instead of the binary contents.
  153. The ``fcr:metadata`` URI returns the RDF metadata of a LDP-NR.
  154. The ``fcr:content`` URI returns the non-RDF content.
  155. The two optionsabove return an HTTP error if requested for a LDP-RS.
  156. “Include” and “Omit” options for children
  157. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  158. LAKEsuperior offers an additional ``Prefer`` header option to exclude
  159. all references to child resources (i.e. by removing all the
  160. ``ldp:contains`` triples) while leaving the other server-managed triples
  161. when retrieving a resource:
  162. ::
  163. Prefer: return=representation; [include | omit]="http://fedora.info/definitions/v4/repository#Children"
  164. The default behavior is to include all children URIs.
  165. Soft-delete and purge
  166. ~~~~~~~~~~~~~~~~~~~~~
  167. **NOTE**: The implementation of this section is incomplete and debated.
  168. In FCREPO4 a deleted resource leaves a tombstone deleting all traces of
  169. the previous resource.
  170. In LAKEsuperior, a normal DELETE creates a new version snapshot of the
  171. resource and puts a tombstone in its place. The resource versions are
  172. still available in the ``fcr:versions`` location. The resource can be
  173. “resurrected” by issuing a POST to its tombstone. This will result in a
  174. ``201``.
  175. If a tombstone is deleted, the resource and its versions are completely
  176. deleted (purged).
  177. Moreover, setting the ``Prefer:no-tombstone`` header option on DELETE
  178. allows to delete a resource and its versions directly without leaving a
  179. tombstone.