-
Notifications
You must be signed in to change notification settings - Fork 198
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
base: main
Are you sure you want to change the base?
Conversation
assert.equal( | ||
rdf, | ||
'_:b0 <foo:bar> _:b1 .\n' + | ||
//'_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <test> .\n' + |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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. Thebase 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": { |
There was a problem hiding this comment.
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.
See #382