Skip to content

Migrate JsonLdProcessor to RDFLib - #254

Open
mielvds wants to merge 21 commits into
220-RDFC10from
use-rdflib
Open

Migrate JsonLdProcessor to RDFLib#254
mielvds wants to merge 21 commits into
220-RDFC10from
use-rdflib

Conversation

@mielvds

@mielvds mielvds commented May 4, 2026

Copy link
Copy Markdown
Collaborator

This PR migrates JsonLdProcessor to rdflib and completes the internal migration to rdflib. It introduces a legacy mode to preserve backward-compatibility of the public API.

Changed

  • Migrated jsonld.to_rdf(), jsonld.from_rdf(), and N-Quads parsing/serialization to use rdflib.Dataset and RDFLib terms directly.
    • jsonld.to_rdf() now returns an rdflib.Dataset by default when no output format is requested.
    • Added legacyMode to jsonld.to_rdf() to return the previous RDF.js-like dataset dict.
    • jsonld.from_rdf() now accepts both rdflib.Dataset inputs and the previous legacy dataset dict shape.
  • N-Quads input/output now delegates to RDFLib instead of PyLD’s custom parser and serializer.

Removed

  • Removed the internal pyld.nquads parser/serializer module.

Fixed

  • Preserved RDF literal lexical forms when converting through RDFLib, including canonical double output, large numeric values, and compound literal handling.
  • Fixed iri_resolver.unresolve() query/fragment reconstruction while cleaning up the resolver docstring.

Maintenance

  • Updated RDF-related tests for RDFLib dataset and N-Quads serialization behavior.
  • Removed small Python 2-era compatibility code and simplified a few internal collection checks.

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown

@mielvds
mielvds marked this pull request as ready for review August 12, 2026 08:30
@mielvds

mielvds commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator Author

@anatoly-scherbakov et al. would you mind doing an in-depth review of the changes to jsonld.py? The changes should be overseeable, but they are crucial to making the switch to 4.0 and rdflib.

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.

1 participant