Open bergos opened 2 years ago
There should in fact already be a 'context'
event: https://github.com/rubensworks/jsonld-streaming-parser.js#capture-detected-contexts
This will emit all contexts that are discovered.
But it should also be possible to emit the single "parsed" context. This would also enable the usage of the convenience methods exposed by jsonld-context-parser.js, which should also make prefix extraction easier.
Sorry, I missed the part in the documentation. That would already cover the current state of @rdfjs/parser-jsonld
, where only embedded contexts have been processed. I will give it a try.
But your proposal for an event that emits the parsed context would be great to implement an improved version of the prefix
event handling.
I would like to replace
jsonld.js
with this package in the@rdfjs/parser-jsonld
package. One feature I'm currently not able to implement is theprefix
event. This logic is used, which requires access to the context object. Let's not discuss how good or bad the logic is. I just want to keep the status quo. The debugger didn't help me find the context assigned as an internal property.Is the context already assigned to a property? If not, can you add access to the context? I would propose a
context
event where the context object is given as an argument.