Skip to content

Appending triples to container state should be possible #917

Closed

Description

@RubenVerborgh

@justinwb informed me that projects he's building rely on adding extra triples to the container state.

This works with PUT:

curl -X PUT http://localhost:3000/ -H "Content-Type: text/turtle" --data '
  <http://example/book1> <http://example/book1> <http://example/book1>.
'

However, currently this fails with PATCH:

curl -X PATCH http://localhost:3000/ -H "Content-Type: application/sparql-update" --data '
INSERT DATA
{
  <http://example/book1> <http://example/book1> <http://example/book1>.
}
'

with

# ConflictHttpError

## Technical details
Container bodies are not allowed to have containment triples.

This seems to be because in

https://github.com/solid/community-server/blob/1173f98b5db64fcbb63436ed574697eaa6b1fecd/src/storage/DataAccessorBasedStore.ts#L371-L376

the full representation is processed, not just the delta.

As a resolution, I would have proposed that we filter disallowed triples from the client body (or patch) rather than rejecting.
However, the spec mandates a 409.

We might need to install a patch body parser for containers that makes these checks.
(Or just add that functionality to the existing parser, but perhaps that is less extensible.)

Activity

  1. jvherweg commented on Aug 17, 2021

    @jvherweg
    Member

    Note that we have a related issue in #384 that was paused, where some related solutions were discussed.

  2. jvherweg commented on Aug 17, 2021

    @jvherweg
    Member

    Now that we put generated metadata in a separate graph, one other potential solution is having a patcher that knows that for containers it should run on the metadata object and then re-create the container body to only contain the non-generated triples and PUT that back to the store.

  3. RubenVerborgh commented on Aug 17, 2021

    @RubenVerborgh
    MemberAuthor

    Makes sense.

    Alternatively, we could see this as part of a (future) validation workflow (#87) where we check if the patch maintains a valid state and/or whether a PUT sends a valid state.

  4. jvherweg commented on Sep 23, 2021

    @jvherweg
    Member

    Added in #955

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions