Skip to content

Migrate JsonLdProcessor to RDFLib - #254

Merged
mielvds merged 25 commits into
v4.0.0from
use-rdflib
Aug 24, 2026
Merged

Migrate JsonLdProcessor to RDFLib#254
mielvds merged 25 commits into
v4.0.0from
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 draft May 4, 2026 14:52
@mielvds
mielvds force-pushed the 220-RDFC10 branch 2 times, most recently from bbae7ad to a1d1f71 Compare May 11, 2026 10:17
@mielvds
mielvds force-pushed the 220-RDFC10 branch 2 times, most recently from cc2ec18 to a41ab1c Compare June 5, 2026 07:40
@mielvds
mielvds force-pushed the use-rdflib branch 2 times, most recently from d7a684e to 088c645 Compare June 5, 2026 12:18
@mielvds mielvds added this to the v4.0.0 (migration to rdflib) milestone Jun 11, 2026
@mielvds
mielvds force-pushed the 220-RDFC10 branch 2 times, most recently from 6ab54b7 to 10902a5 Compare July 16, 2026 08:35
@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.

Comment thread lib/pyld/jsonld.py Outdated
Base automatically changed from 220-RDFC10 to v4.0.0 August 24, 2026 08:45
@mielvds
mielvds merged commit 977fc29 into v4.0.0 Aug 24, 2026
19 checks passed
@mielvds
mielvds deleted the use-rdflib branch August 24, 2026 08:51
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