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.
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.
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 IRIis an IRI established in the context, or is based on the JSON-LD document location. Thebase IRIis 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.
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