Skip to content

Unclear how to set original base URL in Context Processing #370

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
kasei opened this issue Feb 14, 2020 · 6 comments
Closed

Unclear how to set original base URL in Context Processing #370

kasei opened this issue Feb 14, 2020 · 6 comments

Comments

@kasei
Copy link
Contributor

kasei commented Feb 14, 2020

(Related to #265, #356)

Context Processing Overview 4.1.1 says:

When an active context is initialized, the value of the original base URL is initialized from the original documentUrl of the document containing the initial context . This is necessary when resetting the active context by setting it to null to retain the original default base IRI .

What about when there is no documentUrl? Is it null, or is it the current base IRI? The documentUrl field is only relevant when the LoadDocumentCallback has been used.

This also impacts compact() step 3, and expand() step 4.

@gkellogg
Copy link
Member

This is not dissimilar from Turtle serialization from a form, rather than a remote document. Also, the JSON-LD Playground. Implementations provide a reasonable default to use as a document base.

Perhaps if step 7 of the expand() API definition provided for the case where there is no remote document having a documentUrl. But, really, the use of a relative URL to locate a context from a form is non-sensical. Maybe step 5.2.1 should generate an error if context does not result in a valid IRI after resolution. Perhaps invalid IRI mapping could be used for this case too.

@gkellogg
Copy link
Member

Actually, the LoadDocumentCallback will generate a "loading document failed" error if the URL can't be resolved, so no new error detection is required.

I did add changes to the expand() API definition to fallback to JsonLdOptions/base if there is no documentUrl, which is how it's typically handled in form-based parsers. Implementations may provide a default for this, but we don't need to describe that non-normative behavior.

@gkellogg gkellogg self-assigned this Feb 14, 2020
gkellogg added a commit that referenced this issue Feb 14, 2020
… This uses `JsonLdOptions/base`, which could be null, or something else appropriate for when the `input` or `expandContext` is not a URL.

For #370.
@gkellogg
Copy link
Member

@kasei see pending change in #377.

@kasei
Copy link
Contributor Author

kasei commented Feb 15, 2020

@gkellogg I think the changes to expand() in #377 are good, but the description in 4.1.1 is still misleading as in some cases there will simply not be a relevant documntUrl.

@gkellogg
Copy link
Member

gkellogg commented Feb 15, 2020

Updated in 50a50ca0356146974532507c5e01d3ce2798e324, and to give base a default of null.

@gkellogg
Copy link
Member

Updated in #377.

gkellogg added a commit that referenced this issue Feb 18, 2020
… This uses `JsonLdOptions/base`, which could be null, or something else appropriate for when the `input` or `expandContext` is not a URL.

For #370.
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

2 participants