Skip to content

apply fix-multiple-type-scoped-contexts#3422

Open
vamsikalagaturu wants to merge 1 commit into
RDFLib:mainfrom
secorolab:7.6.0-fix-multi-type-scoped-context
Open

apply fix-multiple-type-scoped-contexts#3422
vamsikalagaturu wants to merge 1 commit into
RDFLib:mainfrom
secorolab:7.6.0-fix-multi-type-scoped-context

Conversation

@vamsikalagaturu
Copy link
Copy Markdown

Summary of changes

Fixes handling of multiple @type values in JSON-LD scoped contexts.
Previously, when a node had multiple types (e.g., {"@type": ["TypeA", "TypeB"]}), only the first matching type's scoped context was applied and all others were ignored. This caused incorrect JSON-LD processing when scoped contexts are spread across multiple types.
The fix:

  • Merges scoped contexts from all matching types instead of stopping at the first match
  • Iterates types in reverse order so earlier types in the list take priority (last-write-wins merge)
  • Handles both dict and list context formats (@context can be either)

Checklist

  • Checked that there aren't other open pull requests for
    the same change.
  • Checked that all tests and type checking passes.
  • If the change adds new features or changes the RDFLib public API:
    • Created an issue to discuss the change and get in-principle agreement.
    • Considered adding an example in ./examples.
  • If the change has a potential impact on users of this project:
    • Added or updated tests that fail without the change.
    • Updated relevant documentation to avoid inaccuracies.
    • Considered adding additional documentation.
  • Considered granting push permissions to the PR branch,
    so maintainers can fix minor issues and keep your PR up to date.

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.

2 participants