Skip to content

keyword alias with "@prefix"=true ? #153

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
pchampin opened this issue Sep 20, 2019 · 4 comments
Closed

keyword alias with "@prefix"=true ? #153

pchampin opened this issue Sep 20, 2019 · 4 comments

Comments

@pchampin
Copy link
Contributor

The following is quite ugly, and in my opinion it should break.

{
  "@context": {
    "@version": 1.1,
    "id": {
        "@id": "@id",
        "@prefix": true
     }
  },
  "id:foo": "#x"
}

The thing is: nothing in the spec explicitly prevents it:

  • Step 25 of Create Term Definition does not check that iri mapping is not a keyword.
  • Step 5.4 of IRI Expansion does not either, so should happily use the keyword as a prefix.

This is what the Ruby distiller is doing: the JSON-LD above generates a "@idfoo" property... The playground ignores it silently, which in my view is not complying with the spec. But that's not the point. I think the spec should reject the use of keyword aliases as prefix, by updating either of the steps above.

I can provide the PR, if we agree that it's a bug and not a feature.

@azaroth42
Copy link
Contributor

Related to w3c/json-ld-syntax#246

@iherman
Copy link
Member

iherman commented Sep 21, 2019

This issue was discussed in a meeting.

  • RESOLVED: When encountering a term in the form of a compact IRI for which the prefix would expand to a keyword, do not expand the term
  • ACTION: determine if <code>@prefix:</code> false will prevent the term from being used in expanding IRIs, and file an issue if it does (Gregg Kellogg)
View the transcript Rob Sanderson: time to summarize for the minutes
… we accept that issue 153 is an issue
Gregg Kellogg: a bug
Rob Sanderson: true. a bug
… it should not in fact generate @idfoo
Gregg Kellogg: it should treat id:foo as an IRI
… so the result of expanding should be id:foo
Proposed resolution: When encountering a term in the form of a compact IRI for which the prefix would expand to a keyword, do not expand the term (Rob Sanderson)
Rob Sanderson: so if there was an @vocab it would expand to that value + id:foo?
Rob Sanderson: +1
Pierre-Antoine Champin: +1
Gregg Kellogg: it won’t be expanded as a relative URI because of the colon
Gregg Kellogg: +1
Benjamin Young: +1
Simon Steyskal: +1
Resolution #4: When encountering a term in the form of a compact IRI for which the prefix would expand to a keyword, do not expand the term
Gregg Kellogg: if there is an id term that’s legit, and I see @prefix: false
… it won’t expand that because prefix is false
Action #1: determine if @prefix: false will prevent the term from being used in expanding IRIs, and file an issue if it does (Gregg Kellogg)

@pchampin
Copy link
Contributor Author

(duplicating my comment on c482f45, to make the discussion easier to follow:

It seems to me that this change was meant precisely to prevent a term from being used in expanding IRIs when @Prefix is false...

From what I see, the Expand IRI algorithm in the Ruby distiller does honnor @prefix, conforming to the letter of the spec since c482f45 (but possibly not conforming to its spirit). The Playground does not honnor @prefix during expansion.

My PR above is based on the current version of Expand IRI. If we were to revert it to not honnor @prefix, it would be moot.

@gkellogg
Copy link
Member

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

No branches or pull requests

4 participants