Skip to content
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

Access to context object #84

Open
bergos opened this issue Feb 12, 2022 · 2 comments
Open

Access to context object #84

bergos opened this issue Feb 12, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@bergos
Copy link
Contributor

bergos commented Feb 12, 2022

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 the prefix 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.

@rubensworks
Copy link
Owner

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.

@rubensworks rubensworks added the enhancement New feature or request label Feb 14, 2022
@bergos
Copy link
Contributor Author

bergos commented Feb 14, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants