Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
edf1a30
Add stub for RDFC-1.0 and prepare tests.
mielvds Feb 5, 2026
f2ab46d
Add rdf-canon to submodules
mielvds Feb 16, 2026
ef04cbe
Add rdflib to dependencies
mielvds Apr 15, 2026
306b2e6
Re-enable canon tests
mielvds Apr 15, 2026
4a4e702
Introduce rdflib into canon.py and replace internal model.
mielvds Apr 15, 2026
aed8cca
Don't normalize literals
mielvds Apr 16, 2026
62de196
Fixes positions and does small touchups
mielvds Apr 20, 2026
a9fa560
Replace permutations with stdlib
mielvds Apr 20, 2026
116592e
Fix identifier ordering
mielvds Apr 20, 2026
81459b8
Switch from NT to NQ serialization
mielvds Apr 20, 2026
7dd4476
Remove legacy nquads parsing dependency by moving parsing to canon.py
mielvds Apr 21, 2026
49e48fb
Move triple data structure convert functions to util.py
mielvds Apr 21, 2026
4fe584f
Cleanup of old canon code
mielvds Apr 21, 2026
af2717c
Add tests for conversion methods in util.py and do fixes
mielvds Apr 21, 2026
7cfb48d
Make NQ serialization part of class & add override for RDFC1.0
mielvds Apr 22, 2026
7fad267
Fix RDFC1.0 literal encoding
mielvds Apr 22, 2026
3b46ac5
Add configurable hashAlgorithm
mielvds Apr 22, 2026
da2500b
Add option to return the bnode map.
mielvds Apr 22, 2026
1cffc03
Rename _main to _canonicalize, add docstring and move function
mielvds Apr 22, 2026
e434337
Minimize change
mielvds Apr 23, 2026
dbf2fe6
Make bnode map merge from parser more simple and robust
mielvds Apr 27, 2026
edc1a28
Make linter happy
mielvds Apr 27, 2026
6139d66
Separate triple and dataset conversion from legacy
mielvds Apr 27, 2026
bbbb2db
Fix passing graph as identifier
mielvds May 6, 2026
a1d1f71
Add rdflib and RDFC10 changes to changelog
mielvds May 11, 2026
fafa982
Call rdf-canon tests in github actions
mielvds May 11, 2026
1aad656
Re-enable hashAlgorithm parameter in tests
mielvds May 11, 2026
f8b31bd
[#220]: Add RDF canonicalization test submodule
anatoly-scherbakov May 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ jobs:
pytest tests/test_manifests.py --tests=./specifications/json-ld-api/tests --loader=${{ matrix.loader }}
pytest tests/test_manifests.py --tests=./specifications/json-ld-framing/tests --loader=${{ matrix.loader }}
pytest tests/test_manifests.py --tests=./specifications/normalization/tests --loader=${{ matrix.loader }}
pytest tests/test_manifests.py --tests=./specifications/rdf-canon/tests --loader=${{ matrix.loader }}
pytest --ignore ./tests/test_manifests.py
env:
LOADER: ${{ matrix.loader }}
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
[submodule "specifications/normalization"]
path = specifications/normalization
url = https://github.com/json-ld/normalization.git
[submodule "specifications/rdf-canon"]
path = specifications/rdf-canon
url = https://github.com/w3c/rdf-canon.git
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
# pyld ChangeLog

## 4.0.0 - unreleased

### Added

- migrate `canon.py` to `rdflib`
- added `rdflib` dependency in all relevant config and code files.
- added `util.py`:
- added the functions `from_legacy_dataset()` and `to_legacy_dataset()` to convert an `rdflib.Dataset` to an RDFJS-like `dict` and back wherever needed.
- added unittests in `tests/test_util.py` for these functions.
- implement RDFC1.0
- added new class `RDFC10` (subclass of `URDNA2015`) in `canon.py`
- added the RDFC1.0 test-suite in `tests/runtests.py`
- added support for testing blank-node identifier maps.
- added support for testing with different hashing algorithms

### Changed
- migrate `canon.py` to `rdflib`:
- now use `rdflib` for RDF term type checking (e.g., checking is something is a bnode), looping over triples/quads, nquads serialization and constructing RDF terms (custom deepcopy is no longer needed)
- move nquads parsing from`JsonLdProcessor.normalize()` to `URDNA2015.main()` so all parsing and serialization is handled by the same class.
- move the main logic to `URDNA2015._canonicalize(self, dataset: Dataset)` while keeping input and output in `URDNA2015.main()`. The method `URDNA2015._canonicalize(self, dataset: Dataset)` accepts an `rdflib.Dataset` and returns a tuple with
- the canonicalized result as a nquads `str` and
- the blank node identifier map as `dict`.
- the method `URDNA2015 .main(self, dataset: str | dict | Dataset, options)` now
- accepts a `rdflib.Dataset` object in addition to an nquads `str` or the original RDFJS-like`dict`.
- returns
- a `str`: the serialized nquads result, or
- a `dict`: the result as RDFJS-like dataset or the blank node identifier map when the new parameter `outputMap` is `True`.
- the hashing algorithm is now an class attribute `URDNA2015.hash_algorithm` so it configurable (required for RDFC1.0)
- the `permutations()` function now uses `itertools.permutations` instead of a custom implementation.
- replacements for rdflib's `_nq_row` and `_quoteLiteral` (these should eventually move to a fix for rdflib's nquads serializer).
- (re-)enabled all skipped URDNA2015, URDNA2012 tests in `tests/runtests.py`
- if the result of a test is a dict and the expected value is a string, the expected value is now parsed as JSON (needed for testing blank-node identifier maps).

## 3.1.0 - unreleased

### Fixed
Expand Down
Loading
Loading