Commit 996ca58
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 bb6ca41 commit 996ca58
9 files changed
Lines changed: 1333 additions & 54 deletions
File tree
- packages/linkml/src/linkml
- generators
- utils
- tests/linkml/test_generators
- rdf
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
239 | | - | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
240 | 294 | | |
241 | 295 | | |
242 | 296 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
203 | 204 | | |
204 | 205 | | |
205 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
206 | 211 | | |
207 | 212 | | |
208 | 213 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
58 | 74 | | |
59 | 75 | | |
60 | 76 | | |
| |||
300 | 316 | | |
301 | 317 | | |
302 | 318 | | |
303 | | - | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
304 | 327 | | |
305 | 328 | | |
306 | 329 | | |
| |||
568 | 591 | | |
569 | 592 | | |
570 | 593 | | |
571 | | - | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
572 | 598 | | |
573 | 599 | | |
574 | 600 | | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
575 | 604 | | |
576 | | - | |
| 605 | + | |
577 | 606 | | |
578 | 607 | | |
579 | 608 | | |
| |||
582 | 611 | | |
583 | 612 | | |
584 | 613 | | |
585 | | - | |
| 614 | + | |
586 | 615 | | |
587 | 616 | | |
588 | 617 | | |
589 | | - | |
| 618 | + | |
590 | 619 | | |
591 | 620 | | |
592 | 621 | | |
| |||
596 | 625 | | |
597 | 626 | | |
598 | 627 | | |
599 | | - | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
600 | 632 | | |
601 | 633 | | |
602 | 634 | | |
603 | | - | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
604 | 639 | | |
605 | 640 | | |
606 | 641 | | |
| |||
773 | 808 | | |
774 | 809 | | |
775 | 810 | | |
776 | | - | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
777 | 819 | | |
778 | | - | |
| 820 | + | |
779 | 821 | | |
780 | | - | |
| 822 | + | |
781 | 823 | | |
782 | 824 | | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
783 | 828 | | |
784 | | - | |
| 829 | + | |
785 | 830 | | |
786 | 831 | | |
787 | 832 | | |
788 | | - | |
| 833 | + | |
789 | 834 | | |
790 | 835 | | |
791 | 836 | | |
| |||
1059 | 1104 | | |
1060 | 1105 | | |
1061 | 1106 | | |
1062 | | - | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
1063 | 1111 | | |
1064 | 1112 | | |
1065 | 1113 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
99 | 105 | | |
100 | 106 | | |
101 | 107 | | |
| |||
313 | 319 | | |
314 | 320 | | |
315 | 321 | | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
316 | 325 | | |
317 | 326 | | |
318 | 327 | | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
| 328 | + | |
323 | 329 | | |
324 | 330 | | |
325 | 331 | | |
| |||
473 | 479 | | |
474 | 480 | | |
475 | 481 | | |
476 | | - | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
477 | 486 | | |
478 | 487 | | |
479 | 488 | | |
| |||
0 commit comments