Injecting JSON-LD context when parsing #2372
Unanswered
Natureshadow
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When parsing a JSON-LD document, RDFlib will analyze its context and load all URI contexts from their remotes.
As a best practice and to improve performance, it is a good idea to cache such contexts (which, as I see it, RDFlib doesn't do), or even inject expected contexts before loading.
A major part of this was already discussed in #1844 from a security point of view, but that's not the background here. (I have a particularly bad example where the JSON-LD representation of the context has vanished from its URI.)
In other words: I am about to load a document, and I know that it will contain
https://example.com/ns/foo#
as context. My application knows this context, and I want to prevent RDFlib from laoding it remotely, and instead provide it with the known context. I am not so much concerned about security here (if the context were dereferencable, that would be great), I just want to spare the parser the effort of loading it.Has anybody doen that already, or has a nice idea of how to do it?
Beta Was this translation helpful? Give feedback.
All reactions