@_linked/core 2.12.0 → 2.13.0

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.
Files changed (246) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/lib/esm/queries/IRPipeline.d.ts +7 -1
  3. package/lib/esm/queries/IRPipeline.js +20 -6
  4. package/lib/esm/queries/IRPipeline.js.map +1 -1
  5. package/lib/esm/queries/queryDispatch.js +12 -2
  6. package/lib/esm/queries/queryDispatch.js.map +1 -1
  7. package/package.json +10 -13
  8. package/lib/cjs/collections/CoreSet.d.ts +0 -47
  9. package/lib/cjs/collections/CoreSet.js +0 -136
  10. package/lib/cjs/collections/CoreSet.js.map +0 -1
  11. package/lib/cjs/collections/ShapeSet.d.ts +0 -6
  12. package/lib/cjs/collections/ShapeSet.js +0 -20
  13. package/lib/cjs/collections/ShapeSet.js.map +0 -1
  14. package/lib/cjs/expressions/Expr.d.ts +0 -29
  15. package/lib/cjs/expressions/Expr.js +0 -80
  16. package/lib/cjs/expressions/Expr.js.map +0 -1
  17. package/lib/cjs/expressions/ExpressionMethods.d.ts +0 -85
  18. package/lib/cjs/expressions/ExpressionMethods.js +0 -3
  19. package/lib/cjs/expressions/ExpressionMethods.js.map +0 -1
  20. package/lib/cjs/expressions/ExpressionNode.d.ts +0 -144
  21. package/lib/cjs/expressions/ExpressionNode.js +0 -432
  22. package/lib/cjs/expressions/ExpressionNode.js.map +0 -1
  23. package/lib/cjs/index.d.ts +0 -29
  24. package/lib/cjs/index.js +0 -65
  25. package/lib/cjs/index.js.map +0 -1
  26. package/lib/cjs/interfaces/ICoreIterable.d.ts +0 -14
  27. package/lib/cjs/interfaces/ICoreIterable.js +0 -3
  28. package/lib/cjs/interfaces/ICoreIterable.js.map +0 -1
  29. package/lib/cjs/interfaces/IDataset.d.ts +0 -26
  30. package/lib/cjs/interfaces/IDataset.js +0 -3
  31. package/lib/cjs/interfaces/IDataset.js.map +0 -1
  32. package/lib/cjs/interfaces/IFileStore.d.ts +0 -16
  33. package/lib/cjs/interfaces/IFileStore.js +0 -3
  34. package/lib/cjs/interfaces/IFileStore.js.map +0 -1
  35. package/lib/cjs/ontologies/linked-core.d.ts +0 -15
  36. package/lib/cjs/ontologies/linked-core.js +0 -38
  37. package/lib/cjs/ontologies/linked-core.js.map +0 -1
  38. package/lib/cjs/ontologies/npm.d.ts +0 -6
  39. package/lib/cjs/ontologies/npm.js +0 -15
  40. package/lib/cjs/ontologies/npm.js.map +0 -1
  41. package/lib/cjs/ontologies/owl.d.ts +0 -14
  42. package/lib/cjs/ontologies/owl.js +0 -21
  43. package/lib/cjs/ontologies/owl.js.map +0 -1
  44. package/lib/cjs/ontologies/rdf.d.ts +0 -13
  45. package/lib/cjs/ontologies/rdf.js +0 -27
  46. package/lib/cjs/ontologies/rdf.js.map +0 -1
  47. package/lib/cjs/ontologies/rdfs.d.ts +0 -16
  48. package/lib/cjs/ontologies/rdfs.js +0 -33
  49. package/lib/cjs/ontologies/rdfs.js.map +0 -1
  50. package/lib/cjs/ontologies/shacl.d.ts +0 -103
  51. package/lib/cjs/ontologies/shacl.js +0 -152
  52. package/lib/cjs/ontologies/shacl.js.map +0 -1
  53. package/lib/cjs/ontologies/xsd.d.ts +0 -19
  54. package/lib/cjs/ontologies/xsd.js +0 -41
  55. package/lib/cjs/ontologies/xsd.js.map +0 -1
  56. package/lib/cjs/package.d.ts +0 -4
  57. package/lib/cjs/package.js +0 -6
  58. package/lib/cjs/package.js.map +0 -1
  59. package/lib/cjs/package.json +0 -9
  60. package/lib/cjs/paths/PropertyPathExpr.d.ts +0 -38
  61. package/lib/cjs/paths/PropertyPathExpr.js +0 -221
  62. package/lib/cjs/paths/PropertyPathExpr.js.map +0 -1
  63. package/lib/cjs/paths/normalizePropertyPath.d.ts +0 -23
  64. package/lib/cjs/paths/normalizePropertyPath.js +0 -75
  65. package/lib/cjs/paths/normalizePropertyPath.js.map +0 -1
  66. package/lib/cjs/paths/pathExprToSparql.d.ts +0 -14
  67. package/lib/cjs/paths/pathExprToSparql.js +0 -136
  68. package/lib/cjs/paths/pathExprToSparql.js.map +0 -1
  69. package/lib/cjs/queries/ContextRef.d.ts +0 -32
  70. package/lib/cjs/queries/ContextRef.js +0 -69
  71. package/lib/cjs/queries/ContextRef.js.map +0 -1
  72. package/lib/cjs/queries/CreateBuilder.d.ts +0 -59
  73. package/lib/cjs/queries/CreateBuilder.js +0 -138
  74. package/lib/cjs/queries/CreateBuilder.js.map +0 -1
  75. package/lib/cjs/queries/CreateQuery.d.ts +0 -20
  76. package/lib/cjs/queries/CreateQuery.js +0 -3
  77. package/lib/cjs/queries/CreateQuery.js.map +0 -1
  78. package/lib/cjs/queries/DeleteBuilder.d.ts +0 -56
  79. package/lib/cjs/queries/DeleteBuilder.js +0 -172
  80. package/lib/cjs/queries/DeleteBuilder.js.map +0 -1
  81. package/lib/cjs/queries/DeleteQuery.d.ts +0 -37
  82. package/lib/cjs/queries/DeleteQuery.js +0 -3
  83. package/lib/cjs/queries/DeleteQuery.js.map +0 -1
  84. package/lib/cjs/queries/DslJsonExpression.d.ts +0 -68
  85. package/lib/cjs/queries/DslJsonExpression.js +0 -427
  86. package/lib/cjs/queries/DslJsonExpression.js.map +0 -1
  87. package/lib/cjs/queries/FieldSet.d.ts +0 -310
  88. package/lib/cjs/queries/FieldSet.js +0 -802
  89. package/lib/cjs/queries/FieldSet.js.map +0 -1
  90. package/lib/cjs/queries/IRAliasScope.d.ts +0 -20
  91. package/lib/cjs/queries/IRAliasScope.js +0 -52
  92. package/lib/cjs/queries/IRAliasScope.js.map +0 -1
  93. package/lib/cjs/queries/IRCanonicalize.d.ts +0 -19
  94. package/lib/cjs/queries/IRCanonicalize.js +0 -19
  95. package/lib/cjs/queries/IRCanonicalize.js.map +0 -1
  96. package/lib/cjs/queries/IRDesugar.d.ts +0 -123
  97. package/lib/cjs/queries/IRDesugar.js +0 -261
  98. package/lib/cjs/queries/IRDesugar.js.map +0 -1
  99. package/lib/cjs/queries/IRLower.d.ts +0 -25
  100. package/lib/cjs/queries/IRLower.js +0 -398
  101. package/lib/cjs/queries/IRLower.js.map +0 -1
  102. package/lib/cjs/queries/IRMutation.d.ts +0 -53
  103. package/lib/cjs/queries/IRMutation.js +0 -130
  104. package/lib/cjs/queries/IRMutation.js.map +0 -1
  105. package/lib/cjs/queries/IRPipeline.d.ts +0 -8
  106. package/lib/cjs/queries/IRPipeline.js +0 -25
  107. package/lib/cjs/queries/IRPipeline.js.map +0 -1
  108. package/lib/cjs/queries/IRProjection.d.ts +0 -39
  109. package/lib/cjs/queries/IRProjection.js +0 -105
  110. package/lib/cjs/queries/IRProjection.js.map +0 -1
  111. package/lib/cjs/queries/IntermediateRepresentation.d.ts +0 -282
  112. package/lib/cjs/queries/IntermediateRepresentation.js +0 -3
  113. package/lib/cjs/queries/IntermediateRepresentation.js.map +0 -1
  114. package/lib/cjs/queries/MutationQuery.d.ts +0 -50
  115. package/lib/cjs/queries/MutationQuery.js +0 -334
  116. package/lib/cjs/queries/MutationQuery.js.map +0 -1
  117. package/lib/cjs/queries/MutationSerialization.d.ts +0 -102
  118. package/lib/cjs/queries/MutationSerialization.js +0 -207
  119. package/lib/cjs/queries/MutationSerialization.js.map +0 -1
  120. package/lib/cjs/queries/MutationThenable.d.ts +0 -18
  121. package/lib/cjs/queries/MutationThenable.js +0 -32
  122. package/lib/cjs/queries/MutationThenable.js.map +0 -1
  123. package/lib/cjs/queries/PropertyPath.d.ts +0 -38
  124. package/lib/cjs/queries/PropertyPath.js +0 -82
  125. package/lib/cjs/queries/PropertyPath.js.map +0 -1
  126. package/lib/cjs/queries/ProxiedPathBuilder.d.ts +0 -14
  127. package/lib/cjs/queries/ProxiedPathBuilder.js +0 -29
  128. package/lib/cjs/queries/ProxiedPathBuilder.js.map +0 -1
  129. package/lib/cjs/queries/QueryBuilder.d.ts +0 -193
  130. package/lib/cjs/queries/QueryBuilder.js +0 -519
  131. package/lib/cjs/queries/QueryBuilder.js.map +0 -1
  132. package/lib/cjs/queries/QueryBuilderSerialization.d.ts +0 -31
  133. package/lib/cjs/queries/QueryBuilderSerialization.js +0 -68
  134. package/lib/cjs/queries/QueryBuilderSerialization.js.map +0 -1
  135. package/lib/cjs/queries/QueryContext.d.ts +0 -50
  136. package/lib/cjs/queries/QueryContext.js +0 -147
  137. package/lib/cjs/queries/QueryContext.js.map +0 -1
  138. package/lib/cjs/queries/QueryFactory.d.ts +0 -80
  139. package/lib/cjs/queries/QueryFactory.js +0 -21
  140. package/lib/cjs/queries/QueryFactory.js.map +0 -1
  141. package/lib/cjs/queries/SelectQuery.d.ts +0 -302
  142. package/lib/cjs/queries/SelectQuery.js +0 -761
  143. package/lib/cjs/queries/SelectQuery.js.map +0 -1
  144. package/lib/cjs/queries/UpdateBuilder.d.ts +0 -69
  145. package/lib/cjs/queries/UpdateBuilder.js +0 -199
  146. package/lib/cjs/queries/UpdateBuilder.js.map +0 -1
  147. package/lib/cjs/queries/UpdateQuery.d.ts +0 -18
  148. package/lib/cjs/queries/UpdateQuery.js +0 -3
  149. package/lib/cjs/queries/UpdateQuery.js.map +0 -1
  150. package/lib/cjs/queries/fromJSON.d.ts +0 -16
  151. package/lib/cjs/queries/fromJSON.js +0 -41
  152. package/lib/cjs/queries/fromJSON.js.map +0 -1
  153. package/lib/cjs/queries/lower.d.ts +0 -28
  154. package/lib/cjs/queries/lower.js +0 -114
  155. package/lib/cjs/queries/lower.js.map +0 -1
  156. package/lib/cjs/queries/lowerMutationJSON.d.ts +0 -25
  157. package/lib/cjs/queries/lowerMutationJSON.js +0 -173
  158. package/lib/cjs/queries/lowerMutationJSON.js.map +0 -1
  159. package/lib/cjs/queries/mutationLowerSpec.d.ts +0 -32
  160. package/lib/cjs/queries/mutationLowerSpec.js +0 -8
  161. package/lib/cjs/queries/mutationLowerSpec.js.map +0 -1
  162. package/lib/cjs/queries/queryDispatch.d.ts +0 -33
  163. package/lib/cjs/queries/queryDispatch.js +0 -33
  164. package/lib/cjs/queries/queryDispatch.js.map +0 -1
  165. package/lib/cjs/queries/resolveShape.d.ts +0 -10
  166. package/lib/cjs/queries/resolveShape.js +0 -23
  167. package/lib/cjs/queries/resolveShape.js.map +0 -1
  168. package/lib/cjs/queries/wireVersion.d.ts +0 -7
  169. package/lib/cjs/queries/wireVersion.js +0 -25
  170. package/lib/cjs/queries/wireVersion.js.map +0 -1
  171. package/lib/cjs/shapes/List.d.ts +0 -35
  172. package/lib/cjs/shapes/List.js +0 -72
  173. package/lib/cjs/shapes/List.js.map +0 -1
  174. package/lib/cjs/shapes/PathNode.d.ts +0 -20
  175. package/lib/cjs/shapes/PathNode.js +0 -68
  176. package/lib/cjs/shapes/PathNode.js.map +0 -1
  177. package/lib/cjs/shapes/SHACL.d.ts +0 -300
  178. package/lib/cjs/shapes/SHACL.js +0 -612
  179. package/lib/cjs/shapes/SHACL.js.map +0 -1
  180. package/lib/cjs/shapes/Shape.d.ts +0 -74
  181. package/lib/cjs/shapes/Shape.js +0 -124
  182. package/lib/cjs/shapes/Shape.js.map +0 -1
  183. package/lib/cjs/shapes/serializePathToNodeData.d.ts +0 -24
  184. package/lib/cjs/shapes/serializePathToNodeData.js +0 -67
  185. package/lib/cjs/shapes/serializePathToNodeData.js.map +0 -1
  186. package/lib/cjs/shapes/syncShapes.d.ts +0 -38
  187. package/lib/cjs/shapes/syncShapes.js +0 -214
  188. package/lib/cjs/shapes/syncShapes.js.map +0 -1
  189. package/lib/cjs/sparql/SparqlAlgebra.d.ts +0 -190
  190. package/lib/cjs/sparql/SparqlAlgebra.js +0 -4
  191. package/lib/cjs/sparql/SparqlAlgebra.js.map +0 -1
  192. package/lib/cjs/sparql/SparqlDataset.d.ts +0 -60
  193. package/lib/cjs/sparql/SparqlDataset.js +0 -117
  194. package/lib/cjs/sparql/SparqlDataset.js.map +0 -1
  195. package/lib/cjs/sparql/algebraToString.d.ts +0 -13
  196. package/lib/cjs/sparql/algebraToString.js +0 -385
  197. package/lib/cjs/sparql/algebraToString.js.map +0 -1
  198. package/lib/cjs/sparql/index.d.ts +0 -9
  199. package/lib/cjs/sparql/index.js +0 -41
  200. package/lib/cjs/sparql/index.js.map +0 -1
  201. package/lib/cjs/sparql/irToAlgebra.d.ts +0 -79
  202. package/lib/cjs/sparql/irToAlgebra.js +0 -2042
  203. package/lib/cjs/sparql/irToAlgebra.js.map +0 -1
  204. package/lib/cjs/sparql/resultMapping.d.ts +0 -36
  205. package/lib/cjs/sparql/resultMapping.js +0 -563
  206. package/lib/cjs/sparql/resultMapping.js.map +0 -1
  207. package/lib/cjs/sparql/sparqlUtils.d.ts +0 -53
  208. package/lib/cjs/sparql/sparqlUtils.js +0 -154
  209. package/lib/cjs/sparql/sparqlUtils.js.map +0 -1
  210. package/lib/cjs/utils/LinkedErrorLogging.d.ts +0 -13
  211. package/lib/cjs/utils/LinkedErrorLogging.js +0 -22
  212. package/lib/cjs/utils/LinkedErrorLogging.js.map +0 -1
  213. package/lib/cjs/utils/LinkedFileStorage.d.ts +0 -23
  214. package/lib/cjs/utils/LinkedFileStorage.js +0 -62
  215. package/lib/cjs/utils/LinkedFileStorage.js.map +0 -1
  216. package/lib/cjs/utils/LinkedStorage.d.ts +0 -40
  217. package/lib/cjs/utils/LinkedStorage.js +0 -148
  218. package/lib/cjs/utils/LinkedStorage.js.map +0 -1
  219. package/lib/cjs/utils/NameSpace.d.ts +0 -2
  220. package/lib/cjs/utils/NameSpace.js +0 -8
  221. package/lib/cjs/utils/NameSpace.js.map +0 -1
  222. package/lib/cjs/utils/NodeReference.d.ts +0 -30
  223. package/lib/cjs/utils/NodeReference.js +0 -54
  224. package/lib/cjs/utils/NodeReference.js.map +0 -1
  225. package/lib/cjs/utils/Package.d.ts +0 -153
  226. package/lib/cjs/utils/Package.js +0 -419
  227. package/lib/cjs/utils/Package.js.map +0 -1
  228. package/lib/cjs/utils/Prefix.d.ts +0 -22
  229. package/lib/cjs/utils/Prefix.js +0 -104
  230. package/lib/cjs/utils/Prefix.js.map +0 -1
  231. package/lib/cjs/utils/ShapeClass.d.ts +0 -30
  232. package/lib/cjs/utils/ShapeClass.js +0 -180
  233. package/lib/cjs/utils/ShapeClass.js.map +0 -1
  234. package/lib/cjs/utils/URI.d.ts +0 -18
  235. package/lib/cjs/utils/URI.js +0 -42
  236. package/lib/cjs/utils/URI.js.map +0 -1
  237. package/lib/cjs/utils/cached.d.ts +0 -14
  238. package/lib/cjs/utils/cached.js +0 -71
  239. package/lib/cjs/utils/cached.js.map +0 -1
  240. package/lib/cjs/utils/loadStores.d.ts +0 -34
  241. package/lib/cjs/utils/loadStores.js +0 -105
  242. package/lib/cjs/utils/loadStores.js.map +0 -1
  243. package/lib/cjs/utils/parseDatasetsConfig.d.ts +0 -49
  244. package/lib/cjs/utils/parseDatasetsConfig.js +0 -110
  245. package/lib/cjs/utils/parseDatasetsConfig.js.map +0 -1
  246. package/lib/esm/package.json +0 -9
@@ -1,173 +0,0 @@
1
- "use strict";
2
- /*
3
- * This Source Code Form is subject to the terms of the Mozilla Public
4
- * License, v. 2.0. If a copy of the MPL was not distributed with this
5
- * file, You can obtain one at https://mozilla.org/MPL/2.0/.
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.decodeNodeData = decodeNodeData;
9
- exports.lowerMutationJSON = lowerMutationJSON;
10
- const ExpressionNode_js_1 = require("../expressions/ExpressionNode.js");
11
- const ShapeClass_js_1 = require("../utils/ShapeClass.js");
12
- const QueryBuilderSerialization_js_1 = require("./QueryBuilderSerialization.js");
13
- const IRDesugar_js_1 = require("./IRDesugar.js");
14
- const IRLower_js_1 = require("./IRLower.js");
15
- const IRMutation_js_1 = require("./IRMutation.js");
16
- const ContextRef_js_1 = require("./ContextRef.js");
17
- const wireVersion_js_1 = require("./wireVersion.js");
18
- const MutationSerialization_js_1 = require("./MutationSerialization.js");
19
- const DslJsonExpression_js_1 = require("./DslJsonExpression.js");
20
- function requireShape(shapeId) {
21
- var _a;
22
- const shape = (_a = (0, ShapeClass_js_1.getShapeClass)(shapeId)) === null || _a === void 0 ? void 0 : _a.shape;
23
- if (!shape) {
24
- throw new Error(`Shape '${shapeId}' is not registered. The receiving side must have the shape registered to lower mutation DSL-JSON.`);
25
- }
26
- return shape;
27
- }
28
- // Bound the DSL-JSON decode recursion so a deeply-nested payload from
29
- // `fromJSON()` cannot exhaust the stack (RangeError DoS). Normal mutation data
30
- // nests only a handful of levels; 128 is far above any real query.
31
- const MAX_DECODE_DEPTH = 128;
32
- let _decodeDepth = 0;
33
- /**
34
- * Decode a DSL-JSON value to the normalized form the canonical-IR builders consume.
35
- * `currentShape` resolves computed `{@path}`/S-expr; `prop` gives a nested node's shape.
36
- * Depth-guarded wrapper around {@link decodeValueInner}.
37
- */
38
- function decodeValue(json, currentShape, prop) {
39
- if (++_decodeDepth > MAX_DECODE_DEPTH) {
40
- _decodeDepth = 0;
41
- throw new Error('DSL-JSON value nested too deeply');
42
- }
43
- try {
44
- return decodeValueInner(json, currentShape, prop);
45
- }
46
- finally {
47
- _decodeDepth--;
48
- }
49
- }
50
- function decodeValueInner(json, currentShape, prop) {
51
- var _a;
52
- // S-expr computed value (no IR on the wire)
53
- if (Array.isArray(json)) {
54
- const { ir, refs } = (0, DslJsonExpression_js_1.decodeValueExpr)(json, currentShape);
55
- return new ExpressionNode_js_1.ExpressionNode(ir, refs);
56
- }
57
- if (json === null)
58
- return null;
59
- if (typeof json !== 'object')
60
- return json; // bare scalar literal
61
- const o = json;
62
- if ('@unset' in o)
63
- return undefined;
64
- if ('@date' in o)
65
- return new Date(o['@date']);
66
- if ('@ctx' in o) {
67
- // Lowering path: a mutation must hit a concrete node, so resolve the
68
- // context now and throw if it isn't set.
69
- const id = (0, ContextRef_js_1.resolveContextId)(o['@ctx'], true);
70
- return { id };
71
- }
72
- if ('@id' in o)
73
- return { id: o['@id'] };
74
- if ('@list' in o) {
75
- return o['@list'].map((item) => decodeValue(item, currentShape, prop));
76
- }
77
- if ('@add' in o || '@remove' in o) {
78
- const mod = {};
79
- if (o['@add']) {
80
- mod.$add = o['@add'].map((v) => decodeValue(v, currentShape, prop));
81
- }
82
- if (o['@remove'])
83
- mod.$remove = o['@remove'].map((id) => ({ id }));
84
- return mod;
85
- }
86
- if ('@path' in o) {
87
- const { ir, refs } = (0, DslJsonExpression_js_1.decodeValueExpr)(json, currentShape);
88
- return new ExpressionNode_js_1.ExpressionNode(ir, refs);
89
- }
90
- // Otherwise: a bare path-keyed nested-node create.
91
- return decodeNodeData(o, (_a = (0, MutationSerialization_js_1.valueShapeOf)(prop)) !== null && _a !== void 0 ? _a : currentShape);
92
- }
93
- /**
94
- * Rebuild a normalized node description from path-keyed JSON, resolving labels via the
95
- * shape. `shape` is the shape inferred from context; `__shape` overrides it.
96
- */
97
- function decodeNodeData(json, shape) {
98
- const nodeShape = typeof json.__shape === 'string' ? requireShape(json.__shape) : shape;
99
- const fields = [];
100
- for (const [key, val] of Object.entries(json)) {
101
- if (key === '__id' || key === '__shape' || val === undefined)
102
- continue;
103
- const prop = nodeShape.getPropertyShape(key);
104
- if (!prop) {
105
- throw new Error(`Property '${key}' not found on shape '${nodeShape.label || nodeShape.id}'`);
106
- }
107
- fields.push({ prop, val: decodeValue(val, nodeShape, prop) });
108
- }
109
- const desc = { shape: nodeShape, fields };
110
- if (typeof json.__id === 'string')
111
- desc.__id = json.__id;
112
- return desc;
113
- }
114
- function lowerWhere(shape, json) {
115
- const wherePath = (0, QueryBuilderSerialization_js_1.deserializeWherePath)(shape, json);
116
- return (0, IRLower_js_1.lowerWhereToIR)((0, IRDesugar_js_1.toWhere)(wherePath));
117
- }
118
- /**
119
- * Lower a mutation DSL-JSON envelope to the canonical IR mutation the dataset
120
- * expects. Mirrors the IR that `lower()` produces from the live builder.
121
- */
122
- function lowerMutationJSON(json) {
123
- (0, wireVersion_js_1.assertWireVersion)(json.v);
124
- switch (json.op) {
125
- case 'create': {
126
- const shape = requireShape(json.shape);
127
- return (0, IRMutation_js_1.buildCanonicalCreateMutationIR)({
128
- shape,
129
- description: decodeNodeData(json.data, shape),
130
- });
131
- }
132
- case 'update': {
133
- const shape = requireShape(json.shape);
134
- const updates = decodeNodeData(json.data, shape);
135
- if (json.mode === 'for') {
136
- // A `{@ctx}` target resolves against the current context map; a mutation
137
- // must hit a concrete subject, so an unresolved context throws.
138
- const id = (0, ContextRef_js_1.isContextRefJSON)(json.targetId)
139
- ? (0, ContextRef_js_1.resolveContextId)(json.targetId['@ctx'], true)
140
- : json.targetId;
141
- if (!id) {
142
- throw new Error('update mode "for" requires a targetId');
143
- }
144
- return (0, IRMutation_js_1.buildCanonicalUpdateMutationIR)({ id, shape, updates });
145
- }
146
- let where;
147
- let wherePatterns;
148
- if (json.mode === 'where') {
149
- if (!json.where)
150
- throw new Error('update mode "where" requires a where clause');
151
- ({ where, wherePatterns } = lowerWhere(shape, json.where));
152
- }
153
- return (0, IRMutation_js_1.buildCanonicalUpdateWhereMutationIR)({ shape, updates, where, wherePatterns });
154
- }
155
- case 'delete': {
156
- const shape = requireShape(json.shape);
157
- if (json.mode === 'ids') {
158
- return (0, IRMutation_js_1.buildCanonicalDeleteMutationIR)({
159
- shape,
160
- // A `{@ctx}` id resolves against the live map; a delete must hit a
161
- // concrete node, so an unresolved context throws.
162
- ids: json.ids.map((id) => (0, ContextRef_js_1.isContextRefJSON)(id) ? { id: (0, ContextRef_js_1.resolveContextId)(id['@ctx'], true) } : { id }),
163
- });
164
- }
165
- if (json.mode === 'all') {
166
- return (0, IRMutation_js_1.buildCanonicalDeleteAllMutationIR)({ shape });
167
- }
168
- const { where, wherePatterns } = lowerWhere(shape, json.where);
169
- return (0, IRMutation_js_1.buildCanonicalDeleteWhereMutationIR)({ shape, where, wherePatterns });
170
- }
171
- }
172
- }
173
- //# sourceMappingURL=lowerMutationJSON.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lowerMutationJSON.js","sourceRoot":"","sources":["../../../src/queries/lowerMutationJSON.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AA2IH,wCAoBC;AAcD,8CAqDC;AA/MD,wEAAgE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IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;gBACxB,OAAO,IAAA,iDAAiC,EAAC,EAAC,KAAK,EAAC,CAAC,CAAC;YACpD,CAAC;YACD,MAAM,EAAC,KAAK,EAAE,aAAa,EAAC,GAAG,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;YAC7D,OAAO,IAAA,mDAAmC,EAAC,EAAC,KAAK,EAAE,KAAK,EAAE,aAAa,EAAC,CAAC,CAAC;QAC5E,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -1,32 +0,0 @@
1
- /**
2
- * IR-free "lowering specs" — the minimal, plain description each mutation
3
- * builder hands to `lower()` so the canonical-IR construction can live entirely
4
- * in the IR tier. The builders depend only on these types (no IR), keeping the
5
- * IR pipeline reachable solely through `lower()`.
6
- */
7
- import type { Shape, ShapeConstructor } from '../shapes/Shape.js';
8
- import type { UpdatePartial } from './QueryFactory.js';
9
- import type { WherePath } from './SelectQuery.js';
10
- import type { NodeId } from './MutationQuery.js';
11
- import type { PendingQueryContext } from './QueryContext.js';
12
- export interface CreateLowerSpec<S extends Shape = Shape> {
13
- shapeClass: ShapeConstructor<S>;
14
- /** The create data, with any fixed id already injected as `__id`. */
15
- data: UpdatePartial<S>;
16
- }
17
- export interface UpdateLowerSpec<S extends Shape = Shape> {
18
- shapeClass: ShapeConstructor<S>;
19
- data: UpdatePartial<S>;
20
- mode: 'for' | 'forAll' | 'where';
21
- /** Resolved target id (id-based update); the builder already resolved any context. */
22
- targetId?: string;
23
- /** A pre-evaluated where path (where-mode). */
24
- wherePath?: WherePath;
25
- }
26
- export interface DeleteLowerSpec<S extends Shape = Shape> {
27
- shapeClass: ShapeConstructor<S>;
28
- /** Ids to delete: concrete ids/`{id}` refs, or unresolved context refs (resolved at lower). */
29
- ids?: (NodeId | PendingQueryContext)[];
30
- mode: 'ids' | 'all' | 'where';
31
- wherePath?: WherePath;
32
- }
@@ -1,8 +0,0 @@
1
- "use strict";
2
- /*
3
- * This Source Code Form is subject to the terms of the Mozilla Public
4
- * License, v. 2.0. If a copy of the MPL was not distributed with this
5
- * file, You can obtain one at https://mozilla.org/MPL/2.0/.
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- //# sourceMappingURL=mutationLowerSpec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mutationLowerSpec.js","sourceRoot":"","sources":["../../../src/queries/mutationLowerSpec.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}
@@ -1,33 +0,0 @@
1
- import type { SelectQuery } from './SelectQuery.js';
2
- import type { CreateQuery } from './CreateQuery.js';
3
- import type { UpdateQuery } from './UpdateQuery.js';
4
- import type { DeleteQuery, DeleteResponse } from './DeleteQuery.js';
5
- import type { IDataset } from '../interfaces/IDataset.js';
6
- /**
7
- * Abstraction boundary between the DSL layer (Shape) and the storage layer
8
- * (LinkedStorage / IDataset). Both sides import this leaf module; neither
9
- * imports the other.
10
- *
11
- * Return types are intentionally `any` — the DSL layer threads precise
12
- * result types through its own generics; the dispatch is a runtime bridge.
13
- */
14
- export interface QueryDispatch {
15
- selectQuery<R = any>(query: SelectQuery): Promise<R>;
16
- createQuery<R = any>(query: CreateQuery): Promise<R>;
17
- updateQuery<R = any>(query: UpdateQuery): Promise<R>;
18
- deleteQuery(query: DeleteQuery): Promise<DeleteResponse>;
19
- }
20
- export declare function setQueryDispatch(d: QueryDispatch): void;
21
- export declare function getQueryDispatch(): QueryDispatch;
22
- /** The mutating query kinds — the `IDataset` methods that are optional per-store. */
23
- export type MutationKind = 'create' | 'update' | 'delete';
24
- /**
25
- * Pick the object a mutation `exec(target?)` dispatches through: the explicit `target`
26
- * dataset (validated to implement the op) when a target is given, otherwise the global
27
- * dispatch. Unlike `selectQuery`, a store's mutation methods are optional on `IDataset`,
28
- * so a target that can't perform `kind` is a caller error.
29
- *
30
- * Throws synchronously if the target lacks the method — callers invoke this from within an
31
- * `async exec`, so the throw surfaces as a rejected promise rather than a synchronous throw.
32
- */
33
- export declare function resolveMutationDispatch(kind: MutationKind, target?: IDataset): QueryDispatch;
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setQueryDispatch = setQueryDispatch;
4
- exports.getQueryDispatch = getQueryDispatch;
5
- exports.resolveMutationDispatch = resolveMutationDispatch;
6
- let dispatch = null;
7
- function setQueryDispatch(d) {
8
- dispatch = d;
9
- }
10
- function getQueryDispatch() {
11
- if (!dispatch) {
12
- throw new Error('No query dispatch configured. Call LinkedStorage.setDefaultDataset() first.');
13
- }
14
- return dispatch;
15
- }
16
- /**
17
- * Pick the object a mutation `exec(target?)` dispatches through: the explicit `target`
18
- * dataset (validated to implement the op) when a target is given, otherwise the global
19
- * dispatch. Unlike `selectQuery`, a store's mutation methods are optional on `IDataset`,
20
- * so a target that can't perform `kind` is a caller error.
21
- *
22
- * Throws synchronously if the target lacks the method — callers invoke this from within an
23
- * `async exec`, so the throw surfaces as a rejected promise rather than a synchronous throw.
24
- */
25
- function resolveMutationDispatch(kind, target) {
26
- if (!target)
27
- return getQueryDispatch();
28
- if (typeof target[`${kind}Query`] !== 'function') {
29
- throw new Error(`The target dataset does not support ${kind} queries.`);
30
- }
31
- return target;
32
- }
33
- //# sourceMappingURL=queryDispatch.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"queryDispatch.js","sourceRoot":"","sources":["../../../src/queries/queryDispatch.ts"],"names":[],"mappings":";;AAuBA,4CAEC;AAED,4CAOC;AAcD,0DASC;AApCD,IAAI,QAAQ,GAAyB,IAAI,CAAC;AAE1C,SAAgB,gBAAgB,CAAC,CAAgB;IAC/C,QAAQ,GAAG,CAAC,CAAC;AACf,CAAC;AAED,SAAgB,gBAAgB;IAC9B,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CACb,6EAA6E,CAC9E,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAKD;;;;;;;;GAQG;AACH,SAAgB,uBAAuB,CACrC,IAAkB,EAClB,MAAiB;IAEjB,IAAI,CAAC,MAAM;QAAE,OAAO,gBAAgB,EAAE,CAAC;IACvC,IAAI,OAAO,MAAM,CAAC,GAAG,IAAI,OAAO,CAAC,KAAK,UAAU,EAAE,CAAC;QACjD,MAAM,IAAI,KAAK,CAAC,uCAAuC,IAAI,WAAW,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,MAAkC,CAAC;AAC5C,CAAC"}
@@ -1,10 +0,0 @@
1
- import { Shape, type ShapeConstructor } from '../shapes/Shape.js';
2
- /**
3
- * Resolve a shape class or IRI string to a ShapeConstructor.
4
- *
5
- * Shared utility used by QueryBuilder, CreateBuilder, UpdateBuilder, and DeleteBuilder
6
- * to normalize their shape input.
7
- *
8
- * @throws If a string IRI cannot be resolved via the shape registry.
9
- */
10
- export declare function resolveShape<S extends Shape>(shape: ShapeConstructor<S> | string): ShapeConstructor<S>;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveShape = resolveShape;
4
- const ShapeClass_js_1 = require("../utils/ShapeClass.js");
5
- /**
6
- * Resolve a shape class or IRI string to a ShapeConstructor.
7
- *
8
- * Shared utility used by QueryBuilder, CreateBuilder, UpdateBuilder, and DeleteBuilder
9
- * to normalize their shape input.
10
- *
11
- * @throws If a string IRI cannot be resolved via the shape registry.
12
- */
13
- function resolveShape(shape) {
14
- if (typeof shape === 'string') {
15
- const shapeClass = (0, ShapeClass_js_1.getShapeClass)(shape);
16
- if (!shapeClass) {
17
- throw new Error(`Cannot resolve shape for '${shape}'`);
18
- }
19
- return shapeClass;
20
- }
21
- return shape;
22
- }
23
- //# sourceMappingURL=resolveShape.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolveShape.js","sourceRoot":"","sources":["../../../src/queries/resolveShape.ts"],"names":[],"mappings":";;AAWA,oCAWC;AArBD,0DAAqD;AAErD;;;;;;;GAOG;AACH,SAAgB,YAAY,CAC1B,KAAmC;IAEnC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,UAAU,GAAG,IAAA,6BAAa,EAAC,KAAK,CAAC,CAAC;QACxC,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,6BAA6B,KAAK,GAAG,CAAC,CAAC;QACzD,CAAC;QACD,OAAO,UAAiC,CAAC;IAC3C,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -1,7 +0,0 @@
1
- /** Current DSL-JSON wire-format version, stamped onto every `toJSON` envelope as `v`. */
2
- export declare const WIRE_VERSION = "1.0";
3
- /**
4
- * Validate an incoming envelope's `v`. A missing `v` is tolerated (pre-versioned /
5
- * assumed current). A different MAJOR version is rejected — the structures may differ.
6
- */
7
- export declare function assertWireVersion(v: unknown): void;
@@ -1,25 +0,0 @@
1
- "use strict";
2
- /*
3
- * This Source Code Form is subject to the terms of the Mozilla Public
4
- * License, v. 2.0. If a copy of the MPL was not distributed with this
5
- * file, You can obtain one at https://mozilla.org/MPL/2.0/.
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.WIRE_VERSION = void 0;
9
- exports.assertWireVersion = assertWireVersion;
10
- /** Current DSL-JSON wire-format version, stamped onto every `toJSON` envelope as `v`. */
11
- exports.WIRE_VERSION = '1.0';
12
- /**
13
- * Validate an incoming envelope's `v`. A missing `v` is tolerated (pre-versioned /
14
- * assumed current). A different MAJOR version is rejected — the structures may differ.
15
- */
16
- function assertWireVersion(v) {
17
- if (v === undefined || v === null)
18
- return;
19
- const incomingMajor = String(v).split('.')[0];
20
- const ourMajor = exports.WIRE_VERSION.split('.')[0];
21
- if (incomingMajor !== ourMajor) {
22
- throw new Error(`Unsupported DSL-JSON wire version "${v}". This build speaks ${exports.WIRE_VERSION}.`);
23
- }
24
- }
25
- //# sourceMappingURL=wireVersion.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wireVersion.js","sourceRoot":"","sources":["../../../src/queries/wireVersion.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AASH,8CASC;AAhBD,yFAAyF;AAC5E,QAAA,YAAY,GAAG,KAAK,CAAC;AAElC;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,CAAU;IAC1C,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO;IAC1C,MAAM,aAAa,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9C,MAAM,QAAQ,GAAG,oBAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5C,IAAI,aAAa,KAAK,QAAQ,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CACb,sCAAsC,CAAC,wBAAwB,oBAAY,GAAG,CAC/E,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -1,35 +0,0 @@
1
- import { Shape } from './Shape.js';
2
- /**
3
- * SHACL/RDF ordered-list cell shape (`rdf:List`).
4
- *
5
- * A list is a chain of cells: `first` holds the value, `rest` points to the next cell
6
- * (or `rdf:nil`). The cell is `dependent` (it has no independent existence) and `rest` is
7
- * a `contains` edge, so deleting/replacing a list cascade-cleans the whole spine — while
8
- * `first` is NOT a `contains` edge, so the list's *contents* (shared IRIs/values) are kept.
9
- */
10
- export declare class List<T = unknown> extends Shape {
11
- static targetClass: import("../utils/NodeReference.js").NodeReferenceValue;
12
- get first(): T;
13
- get rest(): List<T>;
14
- }
15
- /**
16
- * Node-data for a single cell / the `rdf:nil` terminal. Accepted by the create pipeline.
17
- */
18
- export type RdfListNodeData = {
19
- id: string;
20
- } | {
21
- shape: typeof List;
22
- first: unknown;
23
- rest: RdfListNodeData;
24
- __id?: string;
25
- };
26
- /**
27
- * Build the nested `List` node-data chain for an ordered `rdf:List`, terminating at `rdf:nil`.
28
- * Pass `opts.base` to mint deterministic cell ids (`{base}/0`, `{base}/1`, …); otherwise the
29
- * create pipeline mints ids. The empty list serializes to `rdf:nil`.
30
- *
31
- * @example Playlist.create({ tracks: rdfList([t1, t2, t3]) })
32
- */
33
- export declare function rdfList<T>(items: T[], opts?: {
34
- base?: string;
35
- }): RdfListNodeData;
@@ -1,72 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.List = void 0;
10
- exports.rdfList = rdfList;
11
- /*
12
- * This Source Code Form is subject to the terms of the Mozilla Public
13
- * License, v. 2.0. If a copy of the MPL was not distributed with this
14
- * file, You can obtain one at https://mozilla.org/MPL/2.0/.
15
- */
16
- const package_js_1 = require("../package.js");
17
- const Shape_js_1 = require("./Shape.js");
18
- const SHACL_js_1 = require("./SHACL.js");
19
- const rdf_js_1 = require("../ontologies/rdf.js");
20
- /**
21
- * SHACL/RDF ordered-list cell shape (`rdf:List`).
22
- *
23
- * A list is a chain of cells: `first` holds the value, `rest` points to the next cell
24
- * (or `rdf:nil`). The cell is `dependent` (it has no independent existence) and `rest` is
25
- * a `contains` edge, so deleting/replacing a list cascade-cleans the whole spine — while
26
- * `first` is NOT a `contains` edge, so the list's *contents* (shared IRIs/values) are kept.
27
- */
28
- let List = class List extends Shape_js_1.Shape {
29
- get first() {
30
- return null;
31
- }
32
- get rest() {
33
- return null;
34
- }
35
- };
36
- exports.List = List;
37
- List.targetClass = rdf_js_1.rdf.List;
38
- __decorate([
39
- (0, SHACL_js_1.linkedProperty)({ path: rdf_js_1.rdf.first, maxCount: 1 })
40
- ], List.prototype, "first", null);
41
- __decorate([
42
- (0, SHACL_js_1.objectProperty)({ path: rdf_js_1.rdf.rest, maxCount: 1, shape: List, contains: true })
43
- ], List.prototype, "rest", null);
44
- exports.List = List = __decorate([
45
- (0, package_js_1.linkedShape)({ dependent: true })
46
- ], List);
47
- /**
48
- * Build the nested `List` node-data chain for an ordered `rdf:List`, terminating at `rdf:nil`.
49
- * Pass `opts.base` to mint deterministic cell ids (`{base}/0`, `{base}/1`, …); otherwise the
50
- * create pipeline mints ids. The empty list serializes to `rdf:nil`.
51
- *
52
- * @example Playlist.create({ tracks: rdfList([t1, t2, t3]) })
53
- */
54
- function rdfList(items, opts) {
55
- const base = opts === null || opts === void 0 ? void 0 : opts.base;
56
- const build = (i) => {
57
- if (i >= items.length) {
58
- return { id: rdf_js_1.rdf.nil.id };
59
- }
60
- const cell = {
61
- shape: List,
62
- first: items[i],
63
- rest: build(i + 1),
64
- };
65
- if (base !== undefined) {
66
- cell.__id = `${base}/${i}`;
67
- }
68
- return cell;
69
- };
70
- return build(0);
71
- }
72
- //# sourceMappingURL=List.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"List.js","sourceRoot":"","sources":["../../../src/shapes/List.ts"],"names":[],"mappings":";;;;;;;;;AA+CA,0BAoBC;AAnED;;;;GAIG;AACH,8CAA0C;AAC1C,yCAAiC;AACjC,yCAA0D;AAC1D,iDAAyC;AAEzC;;;;;;;GAOG;AAEI,IAAM,IAAI,GAAV,MAAM,IAAkB,SAAQ,gBAAK;IAI1C,IAAI,KAAK;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IAGD,IAAI,IAAI;QACN,OAAO,IAAI,CAAC;IACd,CAAC;;AAXU,oBAAI;AACR,gBAAW,GAAG,YAAG,CAAC,IAAI,AAAX,CAAY;AAG9B;IADC,IAAA,yBAAc,EAAC,EAAC,IAAI,EAAE,YAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC,EAAC,CAAC;iCAG9C;AAGD;IADC,IAAA,yBAAc,EAAC,EAAC,IAAI,EAAE,YAAG,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC;gCAG1E;eAXU,IAAI;IADhB,IAAA,wBAAW,EAAC,EAAC,SAAS,EAAE,IAAI,EAAC,CAAC;GAClB,IAAI,CAYhB;AASD;;;;;;GAMG;AACH,SAAgB,OAAO,CACrB,KAAU,EACV,IAAsB;IAEtB,MAAM,IAAI,GAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAC;IACxB,MAAM,KAAK,GAAG,CAAC,CAAS,EAAmB,EAAE;QAC3C,IAAI,CAAC,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YACtB,OAAO,EAAC,EAAE,EAAE,YAAG,CAAC,GAAG,CAAC,EAAE,EAAC,CAAC;QAC1B,CAAC;QACD,MAAM,IAAI,GAAoB;YAC5B,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;YACf,IAAI,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC;SACnB,CAAC;QACF,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,IAAI,CAAC,IAAI,GAAG,GAAG,IAAI,IAAI,CAAC,EAAE,CAAC;QAC7B,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;IACF,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
@@ -1,20 +0,0 @@
1
- import { Shape } from './Shape.js';
2
- import { List } from './List.js';
3
- /**
4
- * Operator node for SHACL property paths that are NOT a simple predicate or a sequence:
5
- * inverse (`sh:inversePath`), alternative (`sh:alternativePath` → an `rdf:List`), and the
6
- * cardinality forms (`sh:zeroOrMorePath`/`sh:oneOrMorePath`/`sh:zeroOrOnePath`).
7
- *
8
- * Each operator edge is `contains` (the operand subtree is owned), and the node itself is
9
- * `dependent`, so a property-shape's complex `sh:path` cascade-cleans on delete/replace.
10
- * Operands are polymorphic (a predicate IRI, a nested `PathNode`, or a `List`), so no fixed
11
- * `valueShape` is declared except for `alternativePath`, which is always an `rdf:List`.
12
- */
13
- export declare class PathNode extends Shape {
14
- static targetClass: import("../utils/NodeReference.js").NodeReferenceValue;
15
- get inversePath(): unknown;
16
- get alternativePath(): List;
17
- get zeroOrMorePath(): unknown;
18
- get oneOrMorePath(): unknown;
19
- get zeroOrOnePath(): unknown;
20
- }
@@ -1,68 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.PathNode = void 0;
10
- /*
11
- * This Source Code Form is subject to the terms of the Mozilla Public
12
- * License, v. 2.0. If a copy of the MPL was not distributed with this
13
- * file, You can obtain one at https://mozilla.org/MPL/2.0/.
14
- */
15
- const package_js_1 = require("../package.js");
16
- const Shape_js_1 = require("./Shape.js");
17
- const SHACL_js_1 = require("./SHACL.js");
18
- const shacl_js_1 = require("../ontologies/shacl.js");
19
- const linked_core_js_1 = require("../ontologies/linked-core.js");
20
- const List_js_1 = require("./List.js");
21
- /**
22
- * Operator node for SHACL property paths that are NOT a simple predicate or a sequence:
23
- * inverse (`sh:inversePath`), alternative (`sh:alternativePath` → an `rdf:List`), and the
24
- * cardinality forms (`sh:zeroOrMorePath`/`sh:oneOrMorePath`/`sh:zeroOrOnePath`).
25
- *
26
- * Each operator edge is `contains` (the operand subtree is owned), and the node itself is
27
- * `dependent`, so a property-shape's complex `sh:path` cascade-cleans on delete/replace.
28
- * Operands are polymorphic (a predicate IRI, a nested `PathNode`, or a `List`), so no fixed
29
- * `valueShape` is declared except for `alternativePath`, which is always an `rdf:List`.
30
- */
31
- let PathNode = class PathNode extends Shape_js_1.Shape {
32
- get inversePath() {
33
- return null;
34
- }
35
- get alternativePath() {
36
- return null;
37
- }
38
- get zeroOrMorePath() {
39
- return null;
40
- }
41
- get oneOrMorePath() {
42
- return null;
43
- }
44
- get zeroOrOnePath() {
45
- return null;
46
- }
47
- };
48
- exports.PathNode = PathNode;
49
- PathNode.targetClass = linked_core_js_1.coreOntology.PathNode;
50
- __decorate([
51
- (0, SHACL_js_1.objectProperty)({ path: shacl_js_1.shacl.inversePath, maxCount: 1, contains: true })
52
- ], PathNode.prototype, "inversePath", null);
53
- __decorate([
54
- (0, SHACL_js_1.objectProperty)({ path: shacl_js_1.shacl.alternativePath, maxCount: 1, shape: List_js_1.List, contains: true })
55
- ], PathNode.prototype, "alternativePath", null);
56
- __decorate([
57
- (0, SHACL_js_1.objectProperty)({ path: shacl_js_1.shacl.zeroOrMorePath, maxCount: 1, contains: true })
58
- ], PathNode.prototype, "zeroOrMorePath", null);
59
- __decorate([
60
- (0, SHACL_js_1.objectProperty)({ path: shacl_js_1.shacl.oneOrMorePath, maxCount: 1, contains: true })
61
- ], PathNode.prototype, "oneOrMorePath", null);
62
- __decorate([
63
- (0, SHACL_js_1.objectProperty)({ path: shacl_js_1.shacl.zeroOrOnePath, maxCount: 1, contains: true })
64
- ], PathNode.prototype, "zeroOrOnePath", null);
65
- exports.PathNode = PathNode = __decorate([
66
- (0, package_js_1.linkedShape)({ dependent: true })
67
- ], PathNode);
68
- //# sourceMappingURL=PathNode.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PathNode.js","sourceRoot":"","sources":["../../../src/shapes/PathNode.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;GAIG;AACH,8CAA0C;AAC1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