Skip to content

Describe scoped context with @base for id map? #254

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
azaroth42 opened this issue Sep 17, 2019 · 5 comments · Fixed by #271
Closed

Describe scoped context with @base for id map? #254

azaroth42 opened this issue Sep 17, 2019 · 5 comments · Fixed by #271

Comments

@azaroth42
Copy link
Contributor

Adding @base as a scoped context below an id map makes the structure much more useful:

    "post": {
      "@id": "schema:blogPost",
      "@container": "@id",
      "@context": {
        "@base": "http://content.com/posts/"
      }
    }

As then the URIs become relative to base, and can thus be simple keys / slugs.

@azaroth42
Copy link
Contributor Author

Irrelevant as in no longer works? (And if so ... wouldn't that be a normative change?)
Or irrelevant as in this could be a best practice, but not needed in the spec?

@gkellogg
Copy link
Member

No, it's relevant.

@gkellogg
Copy link
Member

It might be considered a bug, but the algorithm doesn't set the local context when processing id-map keys, it is deferred until processing values, thus your example won't work.

We could (probably should) add a step after 13.8.3.1 to set map context if @container includes @id; I'm not sure why we didn't do this.

This will require more tests for this.

In the mean time, I'm just going to update the example to set @base in the top-level context.

@azaroth42
Copy link
Contributor Author

Hmm, then I'm doubly glad I found it, as it works in the playground just fine!

@azaroth42
Copy link
Contributor Author

(Relabeling so we know to discuss on a call)

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

Successfully merging a pull request may close this issue.

2 participants