Skip to content

Consider context by reference with metadata #108

Open

Description

@azaroth42

On the call of 2018-12-14, we discussed (briefly) #20, #98, and #86. One realization that came out of the discussion was that we currently have two ways to refer to contexts - either by references as a single string (the URI of the context) or by value as a JSON object (the actual context). In order to have in-document metadata about the context, such as asserting fixity such as via the SRI specification, we would need to have a URI with additional metadata about it.

Questions that arise:

  • How to distinguish between a context by value JSON object and a context by reference with metadata JSON object?
  • As the version is in the context, and this functionality is only version 1.1, how would we signal the processing requirement - some sort of transclusion within a context that has the version?
  • Are metadata properties extensible or fixed in the specification? If they're extensible, we would need some sort of meta-context wherein the mapping is asserted. If they're fixed, we would need to be very careful to accommodate the various use cases otherwise the tendency will be to simply add in new keys regardless and hope for the best.

For example:

{
  "@context": [
    "https://example.com/context-by-reference",
    {"id": "@id"},
    {"@version": 1.1, "@context": "https://example.com/context-with-metadata", "@sri": "sha256-abcd"}
  ]
}

Activity

  1. gkellogg commented on Dec 15, 2018

    @gkellogg
    Member

    I came to a similar conclusion about how to do this, but the question remains: what use case is this solving. I don't see how it allows, say, a WoT system to avoid loading https://example.com/context-with-metadata in the first place and only really allows you to say that the retrieved context should have the associated hash and fail otherwise.

  2. iherman commented on Dec 16, 2018

    @iherman
    Member

    I agree with @gkellogg that we will have to evaluate whether we wanted a structure of such an "annotated" context link. But let us try to put that aside for a moment to see whether we can agree in a syntax.

    What I had in mind is slightly different; my goal was not to overload again the same keyword with different possible semantics. What I had in mind was rather:

    {
        "@context" : [
            "https://...",
            {
                "@version": 1.1,
                "@contextref" : {
                    "@url" : ["schema", "https://cdn1.../schema.org", "https://schema.org"],
                    "@sri" : "sha256-abcd",
                    "@sealed" : true
                },
                "id" : "@id"
            }
        ]
    }
    

    It is a bit more verbose but, I believe, a bit clearer (and mimics a bit the <link> element:-).

    The array of links is also to bring back the issue we had at TPAC, namely to see if some sort of a local cache reference can be used. So that array is based on the idea used in CSS for font access: the processor takes the first URL that works in returning a context file. It is not yet clear in my mind how exactly we would identify a local cache, the array would be used for something like that.

    I guess, returning to @azaroth42's question, I tend to say that we would have to define the possible attributes, instead of an open end.

  3. iherman commented on Jan 5, 2019

    @iherman
    Member

    This issue was discussed in a meeting.

    • No actions or resolutions
    View the transcript Ivan Herman: it is interesting, no doubt
    … (puts admin hat on)
    … these are very early drafts
    … Manu made this proposal in December, very early days
    … we’re fine, though.
    … if the technique becomes a standard form for URIs, we can use it as such
    … I’m happy to have us say that we are interested
    … we should try to see whether this tech really can be used to annotate links while we also pursue other avenues
    Gregg Kellogg: really like the idea, could be very useful
    Gregg Kellogg: but not clear that it really affects our docs at all
    … what would we change?
    Ivan Herman: we shouldn’t close issues just because this new thing is a new thing
    Gregg Kellogg: unless we think that we can do that via a reference in the best practice docs
    Adam Soroka: if hashlink solves for problems we have, then we may not want to recreate alternative features that solve the same issues
    Benjamin Young: although this new hash URI tech isn’t standardized, it has been put into use
  4. azaroth42 commented on Jan 17, 2019

    @azaroth42
    ContributorAuthor
  5. iherman commented on Jan 18, 2019

    @iherman
    Member

    I realize that the example given in #108 (comment), is different from the issue discussed in #98. Indeed, in #108 (comment) the "@sealed":"@true" is set by the caller, i.e., by the one who uses the context, whereas in all examples of #98 sealing is done by the called, i.e., the author of the context. I am not sure whether there are use cases for both, in case we do such sealing.

  6. iherman commented on Jan 18, 2019

    @iherman
    Member

    Following up on #108 (comment): I can see one reason to allow for such "caller side" sealing. There may be (well, there are) a number of 1.0 version contexts that we may want to use, and we may not expect the authors to change those context files. That in spite of the fact that in some situations the sealing would be very useful. Doing it on the caller side means that new, 1.1 compatible contexts and data set can be properly used without expecting the original contexts to be changed...

  7. azaroth42 commented on Jan 18, 2019

    @azaroth42
    ContributorAuthor

    Question arose about sealing @vocab definition or just term definitions, or sealing @context references.

  8. gkellogg commented on Jan 18, 2019

    @gkellogg
    Member

    IMO, sealing a context for which you have no control can lead to problems, as it may change out from underneath you in the future and make data which used to be valid no longer valid. I would not support the ability to seal a context by reference.

  9. ajs6f commented on Jan 18, 2019

    @ajs6f
    Member

    Sealing a context in hand is an act on that context in that scope. Sealing a context-by-reference-- is that an act on the referent? The link? If someone later down the chain imports the same context via a different URI, is it sealed?

  10. pchampin commented on Jan 22, 2019

    @pchampin
    Contributor

    @gkellogg wrote:

    IMO, sealing a context for which you have no control can lead to problems, as it may change out from underneath you in the future

    This can be mitigated if you also use SRI... That being said, I'm also uncomfortable with caller-side sealing, even though @iherman 's use-case seems very valid.

  11. iherman commented on Feb 4, 2019

    @iherman
    Member

    Just to push this aspect aside: I agree (and we discussed on the call) that sealing a referenced context is not a good idea, i.e., we should remove this. Just to have a clear reference, here is my original example without it:

    {
        "@context" : [
            "https://...",
            {
                "@version": 1.1,
                "@contextref" : {
                    "@url" : ["schema", "https://cdn1.../schema.org", "https://schema.org"],
                    "@sri" : "sha256-abcd"
                },
                "id" : "@id"
            }
        ]
    }

    The original proposal still stands without it, including my remark, whereby:

    The array of links is also to bring back the issue we had at TPAC, namely to see if some sort of a local cache reference can be used. So that array is based on the idea used in CSS for font access: the processor takes the first URL that works in returning a context file. It is not yet clear in my mind how exactly we would identify a local cache, the array would be used for something like that.

  12. simonstey commented on Feb 7, 2019

    @simonstey

    It is not yet clear in my mind how exactly we would identify a local cache, the array would be used for something like that.

    maybe by using ETags?

  13. ajs6f commented on Feb 7, 2019

    @ajs6f
    Member

    @simonstey That might work in the HTTP setting, but wouldn't that be too restrictive for some IoT applications? There are some very different protocols in use there.

  14. iherman commented on Feb 7, 2019

    @iherman
    Member

    What about using the hash value, as described/defined by SRI?

  15. simonstey commented on Feb 7, 2019

    @simonstey

    @simonstey That might work in the HTTP setting, but wouldn't that be too restrictive for some IoT applications? There are some very different protocols in use there.

    @ajs6f true.. so why not just defer the task of identifying a local cache to implementations and add a note along the lines of the one provided by the WoT WG who also (afaik) don't define how identifying a local cache has to be done, but e.g. say that Vocabulary files should be cached whenever possible.

  16. 17 remaining items

  17. gkellogg commented on Aug 7, 2019

    @gkellogg
    Member

    To be consistent with other deferred issues, I've reopened this and marked with the defer-future-version label.

  18. iherman commented on Sep 21, 2019

    @iherman
    Member

    This issue was discussed in a meeting.

    • No actions or resolutions
    View the transcript Ivan Herman: See issue syntax#108
    Manu Sporny: this is an awareness opportunity
    Rob Sanderson: so from our side, we’ve pointed to DocumentLoader as the thing that makes the loading stuff work
    … whatever the format, type, etc of the IRI
    … this is deferred to a future version because we don’t know if more data will be needed at the JSON-LD document level to express this
    … What we said is that document loaders should do whatever they can … hashlink or ipfs or something else that enables content integrity. We added @import for future version, if there is interest in putting data into instance graphs/contexts… this particular thing needs a particular SRI value or other, we have a slot that we can provide stuff in @import so you can add something.
    … The use cases fulfilled by document loader process, if there is need to support this in the future, we want to have support and have support.
    Manu Sporny: the thing I don’t know is anyone circling a solution?
    … we’re strongly pushing the hashlink spec as an option for DID and VCWG stuff
    … for VC’s bad things happen if your context changes
    … and in our specs, we make the promise that this context will never change
    … so you download it and put it into your code
    … but that doesn’t address extensions
    … which need something like hashlink
    … all you can do with SRI is to find out you got something you didn’t want
    … and it requires infrastructure to be setup, etc.
    … there are two parts of this
    … in the future we’d like to settle on hashlink as the primary way–in our communities
    … [demoing hashlink]
    Dan Brickley: manu, is there a github repo for the conversation you mentioned with J Yasskin?
  19. gkellogg commented on Feb 12, 2020

    @gkellogg
    Member

    Given continued discussion on SRI, and with @import, one design might be the following:

    {
      "@context":  {
        "@version": 1.1,
        "@import": "https://example.com/context-with-metadata",
        "@sri": "sha256-abcd",
        "@protected": true
      }
    }
  20. azaroth42 commented on Feb 12, 2020

    @azaroth42
    ContributorAuthor

    I think we need to stick to the feature freeze and focus on clearing up the algorithm and @json datatype definition that caused the re-entry to CR to be necessary.

    We have put the framework in place for the above with @import, and the details can be done in a future release.

  21. gkellogg commented on Feb 12, 2020

    @gkellogg
    Member

    I was only documenting recent design discussions, not suggesting to add a feature for 1.1. It may be useful to have this outline for a hypothetical 1.2 release, or for the CG to munch on.

  22. iherman commented on Feb 14, 2020

    @iherman
    Member

    This issue was discussed in a meeting.

    • RESOLVED: Continue to defer work on context metadata (syntax #108)
    View the transcript 3.1. Integrity feature disposal
    Rob Sanderson: #108
    Rob Sanderson: from someone on the mailing list working on Ethereum
    … interested in SRI
    … gkellogg pointed out that we have deferred this,
    … but that the @import mechanism offers an extension point.
    Gregg Kellogg: did he raised a different issue, which I referenced in 108?
    Rob Sanderson: this was an email on the list.
    … does anyone feel differently, or should we keep it deferred?
    Ivan Herman: that’s the only thing that we can do now.
    Proposed resolution: Continue to defer work on context metadata (syntax #108) (Rob Sanderson)
    Rob Sanderson: +1
    Gregg Kellogg: +1
    Pierre-Antoine Champin: +1
    Tim Cole: +1
    Jeff Mixter: +1
    Harold Solbrig: +1
    Resolution #3: Continue to defer work on context metadata (syntax #108)
  23. danbri commented on Aug 18, 2022

    @danbri

    Re

    RESOLVED: Defer the integrity/context metadata related issues, and request early horizontal review from security, privacy and TAG

    Did this ever get to the TAG review stage?

  24. TallTed commented on Aug 18, 2022

    @TallTed
    Member

    I find it helpful to link to the prior comment when quoting such, especially when it's ~3.5 years in the past...

    (I don't know whether the resolution was acted upon.)

  25. gkellogg commented on Aug 18, 2022

    @gkellogg
    Member

    Did this ever get to the TAG review stage?

    I seem to recall @hadleybeeman involved in discussions about this, probably at an F2F, but I'm not able to find anything from the Fukuoka TPAC F2F, specifically.

    Generally, my recollection is that we felt that @msporny's hashlink proposal had promise for handling the issue of resource caching and availability more flexibly than something specific to JSON-LD contexts, but that the timing wasn't right for that.

    Given that the direction most groups have gone on is to create a versioned and unchanging context definition, one route for schema.org would be to freeze a subset of the current context so that it can be made entirely static. Any future changes would need to be done inline in the JSON-LD document itself.

    An alternative might be to have https://schema.org which does redirect for JSON-LD context access, to use a 403 to a static versioned context, in which case the ongoing cost would be to satisfy that redirect. Enforcing rate-limited access to this would have the result of getting the purveyors of JSON-LD processing software to follow the Best Practice advice on aggressively caching such contexts, along with the recommendations on HTTP Cache-Control headers when serving the context.

    We have plenty of time reserved in the Upcoming TPAC F2F for the JSON-LD CG, and we should organize a group to discuss the future directions in more detail.

  26. SAEED2ALAHMARI commented on Apr 29, 2023

    @SAEED2ALAHMARI
  27. moved this to Future Work in JSON-LD Managementon May 15, 2024
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

    defer-future-versionDefer this issue until a future version of JSON-LDprivacy-trackerGroup bringing to attention of Privacy, or tracked by the Privacy Group but not needing response.security-trackerGroup bringing to attention of security, or tracked by the security Group but not needing response.

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions