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

New LD context import mechanism. #83

Merged
merged 3 commits into from Nov 30, 2022

Conversation

timothee-haudebourg
Copy link
Collaborator

This PR introduces a new method for importing external JSON-LD contexts into the generator. Importing external base context is required to avoid generating definitions for terms that are already defined or protected in the base context.

Before this PR, three differents representations for LD contexts were coexisting insinde the generator:

  • one for local contexts generated from TreeLDR layouts,
  • one for processed exteral LD contexts,
  • a last one for unprocessed external LD contexts (local contexts).

This caused a number of complications in the codes, in particular with unprocessed local contexts. This lead to various bugs triggered by incorrect or inconsistent interactions between the contexts.

With the new import mechanism, all contexts share the same internal representation. A first static analysis is performed to resolve dynamic values introduced by unprocessed contexts. Even if it complicates the first stages of the generator, this greatly simplifies the generation itself by allowing a unique and consistent comparison of contexts and term definitions.

All the tests are passing, and this implementation can still generate a context for Rebase, Verite. In addition it can generate a context for Open Badges.

What is missing

  • Error messages (for now it panics)
  • Context loading. For now imported contexts must be inlined and not referenced. It is just a matter of integrating with json_ld::Loader.

@timothee-haudebourg timothee-haudebourg changed the title New import mechanism. New LD context import mechanism. Nov 30, 2022
@timothee-haudebourg timothee-haudebourg self-assigned this Nov 30, 2022
@timothee-haudebourg timothee-haudebourg merged commit 1196867 into main Nov 30, 2022
@timothee-haudebourg timothee-haudebourg deleted the new-ld-generator-import-method branch November 30, 2022 16:30
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.

None yet

1 participant