Skip to content

Algorithm updates and tests to allow @container: @set on @type #41

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

Merged
merged 2 commits into from
Oct 3, 2018

Conversation

gkellogg
Copy link
Member

@gkellogg gkellogg commented Oct 1, 2018

or an alias in 1.1. Remains an error to redefine @type in 1.0.

For w3c/json-ld-syntax#34.

…n alias in 1.1. Remains an error to redefine `@type` in 1.0.

For w3c/json-ld-syntax#34.
"name": "Keywords may not be redefined",
"purpose": "Verifies that an exception is raised on expansion when processing an invalid context attempting to define @container on a keyword",
"input": "expand/e042-in.jsonld",
"expect": "keyword redefinition"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be in 1.0 mode?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a test to be sure that a 1.0 processor would fail if @type were so defined. We didn’t have good relevant tests before.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If processingMode is not set in the test definition, it defaults to 1.0. expand/e042-in.jsonld is the following:

{
  "@context": {
    "@type": {"@container": "@set"}
  },
  "@type": "http://example.org/type"
}

which a 1.0 processor should fail on.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was forgetting it defaulted to 1.0.

"expect": "compact/0105-out.jsonld",
"option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"}
}, {
"@id": "#t0106",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this test be a negative test in 1.0 mode?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the tests are reasonable to check both 1.0 and 1.1 modes. The negative test is in expansion, to make sure a 1.0 processor fails. A 1.0 processor compacting with an alias of @type will allow a @container definition but ignore it when actually compacting.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I thought it failed in 1.0.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We actually never checked that keyword aliases should only be for simple term definitions; we just ignore everything else. We could consider tightening these up in 1.1, and require that keyword aliases only be simple term definitions.

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

Successfully merging this pull request may close these issues.

2 participants