Skip to content
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

Add various list + base tests. #390

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Add various list + base tests. #390

wants to merge 1 commit into from

Conversation

davidlehn
Copy link
Member

@davidlehn davidlehn commented Apr 15, 2020

  • WIP.
  • Started as a test to debug a N-Quads serialization bug.
  • Also checking some list + base behavior.

See #382

@davidlehn davidlehn added this to the JSON-LD 1.1 milestone Apr 15, 2020
@davidlehn davidlehn added the bug label Apr 15, 2020
assert.equal(
rdf,
'_:b0 <foo:bar> _:b1 .\n' +
//'_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <test> .\n' +
Copy link
Collaborator

Choose a reason for hiding this comment

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

This, and others, might be controversial. Certainly, the spec says that the base option overrides the input document's IRI, but this would correspond to the RFC3986 5.1.2 Base URI from the Encapsulating Entity, and following their hierarchy, an empty value would typically be made absolute by resaving against the Retrieval URI or the default base URI. It could be that it's just that the spec wording is muddy. Does it make sense to set the base option to anything other than an absolute URL?

Copy link
Collaborator

Choose a reason for hiding this comment

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

So, arguably, the API should ignore a base option which is not a valid IRI (meaning absolute). The option is described as setting the base IRI, and base IRI is described as an IRI, meaning absolute:

The base IRI is an IRI established in the context, or is based on the JSON-LD document location. The base IRI is used to turn relative IRI references into IRIs.

We don't describe what to do for invalid options, so it's a bit of a gray area.

const doc = {
"@context": {
"@base": "::",
"list": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This isn't invalid, as ':' is a valid char, which is a component of segment-nz. When expanding relative to the document base, it becomes https://w3c.github.io/json-ld-api/tests/toRdf/::, which is valid.

I'll pick something else.

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

Successfully merging this pull request may close these issues.

None yet

2 participants