Skip to content

Add --context option to format. #28

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

BigBlueHat
Copy link
Contributor

@BigBlueHat BigBlueHat commented Mar 20, 2024

Mainly, I wanted to be able to test JSON documents (which completely lack an @context property) by generating nquads and comparing that output as I change a local context file.

jsonld format -f nquads random.json --context=context.jsonld

@BigBlueHat BigBlueHat requested a review from davidlehn March 20, 2024 21:05
@vorburger
Copy link

@BigBlueHat @davidlehn @msporny any chance you would consider merging this? I would use it on enola-dev/enola#779! 😺

@msporny
Copy link
Member

msporny commented Jul 21, 2024

@davidlehn any reason this PR is languishing? It feels fine to me. Can we merge it?

@davidlehn
Copy link
Member

Does this work for compact and flatten? It's using the generic _jsonLdOptions() to set options.expandContext when --context is used. But compact and flatten already used --context to set the param for the API call. I'm not thinking this through all the way, but I don't think that will result in correct behavior. This perhaps need to be something like --expand-context and setup for all API calls that use that option.

@vorburger
Copy link

vorburger commented Jul 22, 2024

Actually I originally missed that this PR is specifically for adding --context to format, lint and expand; whereas I am using flatten which already has a --context flag... but you are right, it does not appear to work (on v2.0.0); if I (x2) remove this @context (as I will be in enola-dev/enola#796, WIP), then npx [email protected] flatten --context=test/picasso-context.jsonld test/picasso.json does NOT seem to read it (nor is there an error; it seems to just ignore it). Nor does npx [email protected] flatten --context=picasso-context.jsonld --base=test/ test/picasso.json work (re. #15). (With https://github.com/filip26/ld-cli it works, as used in tools/test-jsonld/test-jsonld.bash).

PS, just FYI: I had used jsonld-cli for exploring and learning JSON-LD, and am now moving on to using another implementation.

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

Successfully merging this pull request may close these issues.

4 participants