-
Notifications
You must be signed in to change notification settings - Fork 16
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
Support Link header when fetching remote contexts #10
Support Link header when fetching remote contexts #10
Conversation
6f5d47d
to
fe6c8e9
Compare
Sorry for the late reply.
That's correct.
It seems to be supported in 1.0 already: https://www.w3.org/TR/2014/REC-json-ld-20140116/#interpreting-json-as-json-ld |
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.
CI doesn't pass yet.
🤔 Is it passing on |
You're right. http://json-ld.org/ is currently down in general. json-ld/json-ld.org#802 |
fe6c8e9
to
a7d68c6
Compare
Seems like the site's back up. I re-pushed to see if I could get the tests to run, but maybe they're run manually. Anyway, hopefully they're working now 🤞 Might be worth trying out exvcr for these tests which connect to json-ld.org so that the tests can run even if the site is down (I think maybe you can re-generate the cassettes occasionally to make sure you're still matching to real data) |
The problem was this: "First-time contributors need a maintainer to approve running workflows." So, your next PR should automatically trigger CI ;-) I approved and it's passing now. 🚀
Yes, I agree. In the sparql_client I'm already using this. But the whole remote-context handling was not written by me and there are more things to improve on this front, eg. the hard dependency on Hackney for this. I would prefer Tesla to give users the option to choose the HTTP client they want. Unfortunately, I don't have time to look into all of this at the moment. PRs are welcome, however. |
I referenced this bit of the documentation (thanks @gkellogg in this comment). The most relevant being part 5 (quoted below). I haven't implemented all of it, but started with the basic case that would fix the issue. I'll start playing around with more fully supporting the spec.
One question, though: that document is for JSON-LD 1.1, and as far as I can see, this library doesn't support beyond 1.0 yet. I'm not sure if the
Link
header is a 1.0 thing, but I also wasn't able to get any JSON-LD data from various webpages to work because of this issue, so 🤷"If the retrieved resource's Content-Type is
application/json
or any media type with a+json
suffix as defined in [RFC6839] exceptapplication/ld+json
, and the response has an HTTP Link Header [RFC8288] using the http://www.w3.org/ns/json-ld#context link relation, set contextUrl to the associatedhref
.""If multiple HTTP Link Headers using the http://www.w3.org/ns/json-ld#context link relation are found, the promise is rejected with a JsonLdError whose code is set to multiple context link headers and processing is terminated."
"Processors MAY transform document to the internal representation."
"NOTE: The HTTP Link Header is ignored for documents served as application/ld+json, text/html, or application/xhtml+xml."