Skip to content

Commit

Permalink
Revise resource type heuristics
Browse files Browse the repository at this point in the history
  • Loading branch information
csarven committed Jun 9, 2020
1 parent d4048f5 commit 88baa6e
Showing 1 changed file with 17 additions and 89 deletions.
106 changes: 17 additions & 89 deletions main/resource-access.bs
Original file line number Diff line number Diff line change
Expand Up @@ -132,100 +132,28 @@ code.

### Resource type heuristics ### {#resource-type-heuristics}

The semantics of slashes in URI paths are shared ([[#uri-slash-semantics]]).
When creating new resources, servers can determine an effective request URI's
type by examining the URI path ending ([[#uri-slash-semantics]]).

Servers MUST apply the following heuristics to determine the request's
resource type and to construct the effective request URI for the target
resource of an HTTP `POST`
[[Source](https://github.com/solid/specification/issues/128#issuecomment-573033297)].
Clients who want to assign a URI for their resource, MUST use PUT and PATCH
requests. Servers MAY allow clients to suggest the URI for a resource created
through POST, using the HTTP `Slug` header as defined in [[!RFC5023]].

The consistency of a request is determined by checking the optional `Link` and
`Slug` headers against the target URI
[[Source](https://github.com/solid/specification/issues/40#issuecomment-566995240)].
Clients who want the server to determine the URI for their resource, MUST use
the POST request.

Servers supporting the `Slug` header MUST apply the shared slash semantics on
the `slugtext` on requests that also include the `Link` header with
`rel="type"`.
Servers MUST allow creating new resources with a POST request to URI path
ending `/`. Servers MUST create a resource with URI path ending `/{id}` in
container `/`. Servers MUST create a container with URI path ending `/{id}/`
in container `/` for requests including the HTTP `Link` header with
`rel="type"` targeting a valid LDP container type. Servers MUST handle
subsequent requests to the newly created container's URI as if it is a valid
LDP container type by including it the HTTP response's `Link` header.

Issue:
Redefine `slugtext` eg. exclude recursive container creation?
[Related issue](https://github.com/solid/specification/issues/128)
Clients who want to create hierarchical containers MUST use PUT and PATCH
requests.

<table class="data" id="heuristics-resource-type">
<caption>Heuristics to determine a resource type</caption>
<thead>
<tr>
<th>`Slug`</th>
<th>`Link`</th>
<th>Result</th>
</tr>
</thead>
<tbody>
<tr>
<td>`foo/`</td>
<td>No `Link` header.</td>
<td>Create a container with `foo/` appended to the request-URI.</td>
</tr>
<tr>
<td><code>foo/</code></td>
<td>`Link` header with `rel="type"` targeting a valid LDP container
type.</td>
<td>Create a container with `foo/` appended to the request-URI.</td>
</tr>
<tr>
<td><code>foo/</code></td>
<td>`Link` header without a `rel="type"` targeting a valid LDP container
type.</td>
<td>Create a resource with `foo` appended to the request-URI, check for
consistency.</td>
</tr>
<tr>
<td>`foo`</td>
<td>No `Link` header.</td>
<td>Create a resource with `foo` appended to the request-URI, check for
consistency.</td>
</tr>
<tr>
<td>`foo`</td>
<td>`Link` header with `rel="type"` targeting a valid LDP container
type.</td>
<td>Create a container with `foo/` appended to the request-URI.</td>
</tr>
<tr>
<td>`foo`</td>
<td>`Link` header without a `rel="type"` targeting a valid LDP container
type.</td>
<td>Create a resource with `foo` appended to the request-URI, check for
consistency.</td>
</tr>
<tr>
<td><em>none</em></td>
<td>No `Link` header.</td>
<td>Create a resource with server determined identifier appended to the
request-URI, check for consistency.</td>
</tr>
<tr>
<td><em>none</em></td>
<td>`Link` header with `rel="type"` targeting a valid LDP container
type.</td>
<td>Create a container with server determined identifier appended to the
request-URI.</td>
</tr>
<tr>
<td><em>none</em></td>
<td>`Link` header without a `rel="type"` targeting a valid LDP container
type.</td>
<td>Create a resource with server determined identifier appended to the
request-URI, check for consistency.</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="3">
</td>
</tr>
</tfoot>
</table>
[[Source](https://github.com/solid/specification/pull/160#issuecomment-636822687)].


## Auxiliary Resources ## {#rm}
Expand Down

0 comments on commit 88baa6e

Please sign in to comment.