@coasys/ad4m 0.13.0-test-interpretation → 0.13.0-test-interpretation-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.cjs CHANGED
@@ -1752,6 +1752,7 @@ class SHACLShape {
1752
1752
  filter: p.filter,
1753
1753
  transform: p.transform,
1754
1754
  interpretation_hint: p.interpretationHint,
1755
+ identity: p.identity,
1755
1756
  })),
1756
1757
  constructor_actions: this.constructor_actions,
1757
1758
  destructor_actions: this.destructor_actions,
@@ -1798,6 +1799,7 @@ class SHACLShape {
1798
1799
  filter: p.filter,
1799
1800
  transform: p.transform,
1800
1801
  interpretationHint: p.interpretation_hint,
1802
+ identity: p.identity,
1801
1803
  });
1802
1804
  }
1803
1805
  if (json.constructor_actions) {
package/lib/index.js CHANGED
@@ -1748,6 +1748,7 @@ class SHACLShape {
1748
1748
  filter: p.filter,
1749
1749
  transform: p.transform,
1750
1750
  interpretation_hint: p.interpretationHint,
1751
+ identity: p.identity,
1751
1752
  })),
1752
1753
  constructor_actions: this.constructor_actions,
1753
1754
  destructor_actions: this.destructor_actions,
@@ -1794,6 +1795,7 @@ class SHACLShape {
1794
1795
  filter: p.filter,
1795
1796
  transform: p.transform,
1796
1797
  interpretationHint: p.interpretation_hint,
1798
+ identity: p.identity,
1797
1799
  });
1798
1800
  }
1799
1801
  if (json.constructor_actions) {
@@ -744,6 +744,7 @@ export class SHACLShape {
744
744
  filter: p.filter,
745
745
  transform: p.transform,
746
746
  interpretation_hint: p.interpretationHint,
747
+ identity: p.identity,
747
748
  })),
748
749
  constructor_actions: this.constructor_actions,
749
750
  destructor_actions: this.destructor_actions,
@@ -790,6 +791,7 @@ export class SHACLShape {
790
791
  filter: p.filter,
791
792
  transform: p.transform,
792
793
  interpretationHint: p.interpretation_hint,
794
+ identity: p.identity,
793
795
  });
794
796
  }
795
797
  if (json.constructor_actions) {
package/package.json CHANGED
@@ -61,5 +61,5 @@
61
61
  "pako": "2.1.0"
62
62
  }
63
63
  },
64
- "version": "0.13.0-test-interpretation"
64
+ "version": "0.13.0-test-interpretation-1"
65
65
  }
@@ -601,6 +601,32 @@ describe('SHACLShape', () => {
601
601
  expect(prop.wherePredicates).toEqual({ status: 'ns://status' });
602
602
  expect(prop.filter).toBe(false);
603
603
  });
604
+
605
+ // Regression: identity is the interpretation-engine dedup key. If it goes
606
+ // missing on the ORM registration path (Ad4mModel.registerAll → toJSON),
607
+ // the interpreter loses "already exists" awareness and re-mints instances
608
+ // on every pass — very costly for AutoProcessor watches. toLinks/fromLinks
609
+ // already carry identity; toJSON/fromJSON must too.
610
+ it('preserves identity through toJSON() → fromJSON()', () => {
611
+ const original = new SHACLShape('ns://Task');
612
+ original.addProperty({
613
+ name: 'title',
614
+ path: 'ns://title',
615
+ datatype: 'xsd:string',
616
+ identity: true,
617
+ });
618
+ original.addProperty({
619
+ name: 'body',
620
+ path: 'ns://body',
621
+ datatype: 'xsd:string',
622
+ });
623
+
624
+ const json = original.toJSON();
625
+ const reconstructed = SHACLShape.fromJSON(json);
626
+
627
+ expect(reconstructed.properties[0].identity).toBe(true);
628
+ expect(reconstructed.properties[1].identity).toBeUndefined();
629
+ });
604
630
  });
605
631
 
606
632
  describe('transform property emission', () => {
@@ -1068,6 +1068,7 @@ export class SHACLShape {
1068
1068
  filter: p.filter,
1069
1069
  transform: p.transform,
1070
1070
  interpretation_hint: p.interpretationHint,
1071
+ identity: p.identity,
1071
1072
  })),
1072
1073
  constructor_actions: this.constructor_actions,
1073
1074
  destructor_actions: this.destructor_actions,
@@ -1119,6 +1120,7 @@ export class SHACLShape {
1119
1120
  filter: p.filter,
1120
1121
  transform: p.transform,
1121
1122
  interpretationHint: p.interpretation_hint,
1123
+ identity: p.identity,
1122
1124
  });
1123
1125
  }
1124
1126