Skip to content

Expose all required fields in container listings for the filesystem backend #1207

Closed

Description

@RubenVerborgh

Container listings detail all resources within a container, and add some metadata for each.

With the acceptance of solid/specification#352, we have determined that 4 pieces of metadata need to be present per item as per the 0.9 specification

  • rdf:type with http://www.w3.org/ns/iana/media-types/{+iana-media-type}#Resource
  • stat:size
  • dcterms:modified
  • stat:mtime

This functionality is currently implemented in an external module https://github.com/RubenVerborgh/solid-metadata-extender, but given that it is now part of the 0.9 spec, we need to move this to the main codebase.

Additionally, I would suggest that we write the corresponding tests for https://github.com/solid/specification-tests

Activity

  1. added
    good first issue
    📜 solid:protocol:v0.9
    on Mar 8, 2022
  2. RubenVerborgh commented on Mar 8, 2022

    @RubenVerborgh
    MemberAuthor

    A simple way is to update https://github.com/solid/community-server/blob/982d57e1d2812925b09353445a318d067a242943/src/storage/accessors/FileDataAccessor.ts#L313 such that the above metadata is written. It already has stats.msize and stat:mtime, so just needs the other two, for which the code is here: https://github.com/RubenVerborgh/solid-metadata-extender/blob/e1e0fccb4c089105778d8a62e5e3b0afc2f82e54/src/MetadataExtender.ts#L40-L53

    Then it already works for files. We can then create another issue to make it work for other back-ends if desired.

  3. jvherweg commented on Mar 9, 2022

    @jvherweg
    Member

    The addPosixMetadata function linked above already adds the dcterms:modified metadata, it calls this function on the next line: https://github.com/solid/community-server/blob/982d57e1d2812925b09353445a318d067a242943/src/util/ResourceUtil.ts#L26-L36

    The iana type could be deduced based on the content type somewhere.

    That is only for the FileDataAccessor though. If those are mandatory, we either should define in the DataAccessor interface that those values need to be returned, or that behaviour should be pulled to a higher level. One problem there is that stat:size doesn't really make sense in the memory/sparql data accessor. Do we just return a random number there? We will also have to store the modified date in the memory/sparql data accessor then.

    Note that currently DataAccessors are fully responsible for the metadata returned when you request all container children, through the getChildren function.

    The iana type I see multiple potential issues with, and we will have to make sure we have a consistent design here. Which type exactly is returned here? Is it the type that the resource was originally stored with, or is it the type deduced through content negotiation? The first is possible for the file and memory data accessor, but in the case of the sparql data accessor this is completely lost. So there we would return internal/quads as types which would result in an invalid iana type. On the other hand, deducing the type based on the accept header to the container request also doesn't make sense in case the container contains resources of differing non-RDF types.

  4. jvherweg commented on Mar 9, 2022

    @jvherweg
    Member

    Then it already works for files. We can then create another issue to make it work for other back-ends if desired.

    I do admit that I did miss this line, in case we just want a hotfix to make it only work for files we should probably rename the issue and move the other discussion elsewhere.

  5. changed the title [-]Expose all required fields in container listings[/-] [+]Expose all required fields in container listings for the filesystem backend[/+] on Mar 9, 2022
  6. RubenVerborgh commented on Mar 9, 2022

    @RubenVerborgh
    MemberAuthor

    in case we just want a hotfix to make it only work for files we should probably rename the issue and move the other discussion elsewhere.

    Renamed. Note there there currently is a "hotfix" for files; it just does not return all metadata.

    I think we can just fix it for files, and then have a more generic discussion about the accessor architecture. There are several bits that we can reuse more flexibly.

    The iana type I see multiple potential issues with, and we will have to make sure we have a consistent design here. Which type exactly is returned here? Is it the type that the resource was originally stored with, or is it the type deduced through content negotiation?

    Yeah that mechanism is limited; needs to be resolved on the spec level. It's 0.9, but I expect better solutions for 1.0. (One possibility being https://github.com/RubenVerborgh/solid-metadata-extender/blob/e1e0fccb4c089105778d8a62e5e3b0afc2f82e54/src/MetadataExtender.ts#L58)

  7. jvherweg commented on Mar 9, 2022

    @jvherweg
    Member

    Renamed. Note there there currently is a "hotfix" for files; it just does not return all metadata.

    Just as a historical explanation: it's not that there really was a hotfix, it's more that it was never really well defined what metadata should be returned when GETting a container, so every DataAccessor was fully free to choose there. The FileDataAccessor just happened to make the choice that was the closest to what is needed now 😄.

    I agree that we can make the file backend more correct for now, as it will only require 1 extra line just to add the iana type, but after that we will need to have that discussion indeed.

  8. bourgeoa commented on Mar 9, 2022

    @bourgeoa
    Contributor

    I think this is related but I may be wrong. If not I shall create an other issue

    When using the latest community-server-recipes with mashlib (from main) for each resourcefile, a resourcefile.meta is created containing a triple describing resourcefile length.

    Removing this resourcefile.meta apparently do no harm.

  9. jvherweg commented on Mar 9, 2022

    @jvherweg
    Member

    When using the latest community-server-recipes with mashlib (from main) for each resourcefile, a resourcefile.meta is created containing a triple describing resourcefile length.

    @RubenVerborgh that's a consequence of the metadata-extender not marking the added metadata as we do here https://github.com/solid/community-server/blob/982d57e1d2812925b09353445a318d067a242943/src/storage/accessors/FileDataAccessor.ts#L319

    So in case of a PATCH that metadata will not be removed before writing back to disk.

  10. jvherweg commented on Mar 9, 2022

    @jvherweg
    Member

    ResponseMetadata is specifically used for metadata that was generated as part of a response, and should not be stored in a resource. The ones above are generated on a higher level and should be stored. It's just that the file data accessor stores them by how the file system works, but the other data accessors store those as actual metadata.

    Potentially that we need to rethink some things there after the metadata PR is finished.

  11. added this to the v4.0.0 milestone on Mar 21, 2022
  12. jvherweg commented on Mar 28, 2022

    @jvherweg
    Member

    Added in #1237. Will be part of v4.0.0

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

    📜 solid:protocol:v0.9good first issue

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions