Commit f9b74a0
committed
feat(generators): add --deterministic flag with diff-stable WL hashing
Layers Weisfeiler-Lehman structural hashing on top of upstream RDFC-1.0
canonicalization (linkml#3407) to produce diff-stable blank node
identifiers. RDFC-1.0 remains always-on as the default serialization;
the --deterministic flag adds WL hashing for version-controlled artifacts.
Three-phase pipeline (deterministic_turtle):
1. RDFC-1.0 via pyoxigraph — canonical triple ordering
2. WL structural hashing — content-based blank node IDs
3. rdflib re-serialization — idiomatic Turtle syntax
Additional --deterministic behaviours:
- deterministic_json() for JSON-LD context output
- Sorted owl:oneOf, sh:in, sh:ignoredProperties members
- Sorted any_of/exactly_one_of expression members in OWL
Fixes from review (#1):
- Remove trailing newline from context generator return values
(avoids double-newline when CLI prints output)
- Sort WL collision counter by signature, not c14n ID
(prevents unrelated triples from swapping _0/_1 suffixes)
- Remove dead code: well_known_prefix_map(), normalize_prefixes
(belong in separate --normalize-prefixes PR)
Signed-off-by: Carlo van Driesten <carlo.van-driesten@bmw.de>1 parent 1f14ff5 commit f9b74a0
9 files changed
Lines changed: 1325 additions & 46 deletions
File tree
- packages/linkml/src/linkml
- generators
- utils
- tests/linkml/test_generators
- rdf
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
312 | | - | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
313 | 367 | | |
314 | 368 | | |
315 | 369 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
205 | 206 | | |
206 | 207 | | |
207 | 208 | | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
208 | 213 | | |
209 | 214 | | |
210 | 215 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
59 | 75 | | |
60 | 76 | | |
61 | 77 | | |
| |||
376 | 392 | | |
377 | 393 | | |
378 | 394 | | |
379 | | - | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
380 | 403 | | |
381 | 404 | | |
382 | 405 | | |
| |||
673 | 696 | | |
674 | 697 | | |
675 | 698 | | |
676 | | - | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
677 | 703 | | |
678 | 704 | | |
679 | 705 | | |
680 | | - | |
681 | | - | |
682 | | - | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
683 | 710 | | |
684 | 711 | | |
685 | 712 | | |
686 | 713 | | |
687 | 714 | | |
688 | 715 | | |
689 | 716 | | |
690 | | - | |
| 717 | + | |
691 | 718 | | |
692 | 719 | | |
693 | 720 | | |
694 | | - | |
| 721 | + | |
695 | 722 | | |
696 | 723 | | |
697 | 724 | | |
| |||
701 | 728 | | |
702 | 729 | | |
703 | 730 | | |
704 | | - | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
705 | 735 | | |
706 | 736 | | |
707 | 737 | | |
708 | | - | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
709 | 742 | | |
710 | 743 | | |
711 | 744 | | |
| |||
878 | 911 | | |
879 | 912 | | |
880 | 913 | | |
881 | | - | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
882 | 922 | | |
883 | | - | |
| 923 | + | |
884 | 924 | | |
885 | | - | |
| 925 | + | |
886 | 926 | | |
887 | 927 | | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
888 | 931 | | |
889 | | - | |
| 932 | + | |
890 | 933 | | |
891 | 934 | | |
892 | 935 | | |
893 | | - | |
| 936 | + | |
894 | 937 | | |
895 | 938 | | |
896 | 939 | | |
| |||
1164 | 1207 | | |
1165 | 1208 | | |
1166 | 1209 | | |
1167 | | - | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
1168 | 1214 | | |
1169 | 1215 | | |
1170 | 1216 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
187 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
188 | 194 | | |
189 | 195 | | |
190 | 196 | | |
| |||
652 | 658 | | |
653 | 659 | | |
654 | 660 | | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
655 | 664 | | |
656 | 665 | | |
657 | 666 | | |
658 | | - | |
659 | | - | |
660 | | - | |
661 | | - | |
| 667 | + | |
662 | 668 | | |
663 | 669 | | |
664 | 670 | | |
| |||
817 | 823 | | |
818 | 824 | | |
819 | 825 | | |
820 | | - | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
821 | 830 | | |
822 | 831 | | |
823 | 832 | | |
| |||
904 | 913 | | |
905 | 914 | | |
906 | 915 | | |
907 | | - | |
908 | 916 | | |
909 | 917 | | |
910 | 918 | | |
| |||
0 commit comments