@_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,39 +0,0 @@
1
- import type { DesugaredSelectionPath, DesugaredWhere } from './IRDesugar.js';
2
- import { IRAliasScope } from './IRAliasScope.js';
3
- import type { IRExpression, IRProjectionItem, IRResultMapEntry } from './IntermediateRepresentation.js';
4
- import type { PathExpr } from '../paths/PropertyPathExpr.js';
5
- /**
6
- * Callback invoked when a property step with an inline `.where()` is encountered
7
- * during path lowering. The callback receives the traversal alias (target entity)
8
- * and the desugared where predicate so the caller can canonicalize and lower it.
9
- */
10
- export type InlineFilterCallback = (traverseAlias: string, where: DesugaredWhere) => void;
11
- export type ProjectionPathLoweringOptions = {
12
- rootAlias: string;
13
- resolveTraversal: (fromAlias: string, propertyShapeId: string, pathExpr?: PathExpr, maxCount?: number) => string;
14
- };
15
- export type CanonicalProjectionResult = {
16
- projection: IRProjectionItem[];
17
- resultMap?: IRResultMapEntry[];
18
- };
19
- export type ProjectionPathInput = DesugaredSelectionPath | {
20
- path: DesugaredSelectionPath;
21
- key?: string;
22
- };
23
- /** Derives a result key name from the last step of a selection path. */
24
- export declare const projectionKeyFromPath: (path: DesugaredSelectionPath) => string;
25
- /**
26
- * Lowers a single desugared selection path into an IR expression,
27
- * creating traversal aliases for intermediate property steps.
28
- *
29
- * When `onInlineFilter` is provided, property steps with `.where()` will
30
- * force a traversal creation and invoke the callback with the traversal
31
- * alias and the where predicate. For last steps with `.where()`, an
32
- * `alias_expr` is returned instead of a `property_expr`.
33
- */
34
- export declare const lowerSelectionPathExpression: (path: DesugaredSelectionPath, options: ProjectionPathLoweringOptions, onInlineFilter?: InlineFilterCallback) => IRExpression;
35
- /**
36
- * Builds projection items and a result map from an array of selection paths.
37
- * Each path gets a unique alias and is lowered into an IR expression.
38
- */
39
- export declare const buildCanonicalProjection: (selections: ProjectionPathInput[], options: ProjectionPathLoweringOptions, scope?: IRAliasScope) => CanonicalProjectionResult;
@@ -1,105 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildCanonicalProjection = exports.lowerSelectionPathExpression = exports.projectionKeyFromPath = void 0;
4
- const IRAliasScope_js_1 = require("./IRAliasScope.js");
5
- /** Derives a result key name from the last step of a selection path. */
6
- const projectionKeyFromPath = (path) => {
7
- if (!path.steps.length)
8
- return 'value';
9
- const lastStep = path.steps[path.steps.length - 1];
10
- if (lastStep.kind === 'property_step')
11
- return lastStep.propertyShapeId;
12
- if (lastStep.kind === 'count_step')
13
- return lastStep.label || 'count';
14
- if (lastStep.kind === 'type_cast_step')
15
- return lastStep.shapeId;
16
- return 'value';
17
- };
18
- exports.projectionKeyFromPath = projectionKeyFromPath;
19
- /**
20
- * Lowers a single desugared selection path into an IR expression,
21
- * creating traversal aliases for intermediate property steps.
22
- *
23
- * When `onInlineFilter` is provided, property steps with `.where()` will
24
- * force a traversal creation and invoke the callback with the traversal
25
- * alias and the where predicate. For last steps with `.where()`, an
26
- * `alias_expr` is returned instead of a `property_expr`.
27
- */
28
- const lowerSelectionPathExpression = (path, options, onInlineFilter) => {
29
- if (path.steps.length === 0) {
30
- return { kind: 'alias_expr', alias: options.rootAlias };
31
- }
32
- let currentAlias = options.rootAlias;
33
- for (let i = 0; i < path.steps.length; i++) {
34
- const step = path.steps[i];
35
- const isLast = i === path.steps.length - 1;
36
- if (step.kind === 'property_step') {
37
- if (step.where && onInlineFilter) {
38
- // Force traversal creation for step with inline where
39
- currentAlias = options.resolveTraversal(currentAlias, step.propertyShapeId, step.pathExpr, step.maxCount);
40
- onInlineFilter(currentAlias, step.where);
41
- if (isLast) {
42
- return { kind: 'alias_expr', alias: currentAlias };
43
- }
44
- continue;
45
- }
46
- if (isLast) {
47
- const expr = {
48
- kind: 'property_expr',
49
- sourceAlias: currentAlias,
50
- property: step.propertyShapeId,
51
- };
52
- if (step.pathExpr) {
53
- expr.pathExpr = step.pathExpr;
54
- }
55
- if (typeof step.maxCount === 'number') {
56
- expr.maxCount = step.maxCount;
57
- }
58
- return expr;
59
- }
60
- currentAlias = options.resolveTraversal(currentAlias, step.propertyShapeId, step.pathExpr, step.maxCount);
61
- continue;
62
- }
63
- if (step.kind === 'count_step') {
64
- return {
65
- kind: 'aggregate_expr',
66
- name: 'count',
67
- args: step.path.map((propertyStep) => ({
68
- kind: 'property_expr',
69
- sourceAlias: currentAlias,
70
- property: propertyStep.propertyShapeId,
71
- })),
72
- };
73
- }
74
- }
75
- return { kind: 'alias_expr', alias: currentAlias };
76
- };
77
- exports.lowerSelectionPathExpression = lowerSelectionPathExpression;
78
- /**
79
- * Builds projection items and a result map from an array of selection paths.
80
- * Each path gets a unique alias and is lowered into an IR expression.
81
- */
82
- const buildCanonicalProjection = (selections, options, scope = new IRAliasScope_js_1.IRAliasScope('projection')) => {
83
- const projection = [];
84
- const entries = [];
85
- selections.forEach((selection) => {
86
- const path = 'path' in selection ? selection.path : selection;
87
- const key = 'path' in selection ? selection.key : undefined;
88
- const resultKey = key || (0, exports.projectionKeyFromPath)(path);
89
- const binding = scope.generateAlias(resultKey);
90
- projection.push({
91
- alias: binding.alias,
92
- expression: (0, exports.lowerSelectionPathExpression)(path, options),
93
- });
94
- entries.push({
95
- key: resultKey,
96
- alias: binding.alias,
97
- });
98
- });
99
- return {
100
- projection,
101
- resultMap: entries,
102
- };
103
- };
104
- exports.buildCanonicalProjection = buildCanonicalProjection;
105
- //# sourceMappingURL=IRProjection.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IRProjection.js","sourceRoot":"","sources":["../../../src/queries/IRProjection.ts"],"names":[],"mappings":";;;AACA,uDAA+C;AA+B/C,wEAAwE;AACjE,MAAM,qBAAqB,GAAG,CAAC,IAA4B,EAAU,EAAE;IAC5E,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM;QAAE,OAAO,OAAO,CAAC;IACvC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACnD,IAAI,QAAQ,CAAC,IAAI,KAAK,eAAe;QAAE,OAAO,QAAQ,CAAC,eAAe,CAAC;IACvE,IAAI,QAAQ,CAAC,IAAI,KAAK,YAAY;QAAE,OAAO,QAAQ,CAAC,KAAK,IAAI,OAAO,CAAC;IACrE,IAAI,QAAQ,CAAC,IAAI,KAAK,gBAAgB;QAAE,OAAO,QAAQ,CAAC,OAAO,CAAC;IAChE,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAPW,QAAA,qBAAqB,yBAOhC;AAEF;;;;;;;;GAQG;AACI,MAAM,4BAA4B,GAAG,CAC1C,IAA4B,EAC5B,OAAsC,EACtC,cAAqC,EACvB,EAAE;IAChB,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,EAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,CAAC,SAAS,EAAC,CAAC;IACxD,CAAC;IAED,IAAI,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC;IAErC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAA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H,OAAO,CAAC,IAAI,CAAC;YACX,GAAG,EAAE,SAAS;YACd,KAAK,EAAE,OAAO,CAAC,KAAK;SACrB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,UAAU;QACV,SAAS,EAAE,OAAO;KACnB,CAAC;AACJ,CAAC,CAAC;AA3BW,QAAA,wBAAwB,4BA2BnC"}
@@ -1,282 +0,0 @@
1
- import { NodeReferenceValue } from './QueryFactory.js';
2
- import type { PathExpr } from '../paths/PropertyPathExpr.js';
3
- export type IRDirection = 'ASC' | 'DESC';
4
- export type IRAlias = string;
5
- export type IRValue = string | number | boolean | null;
6
- export type IRQuery = IRSelectQuery | IRCreateMutation | IRUpdateMutation | IRDeleteMutation | IRDeleteAllMutation | IRDeleteWhereMutation | IRUpdateWhereMutation;
7
- export type IRSelectQuery = {
8
- kind: 'select';
9
- root: IRShapeScanPattern;
10
- patterns: IRGraphPattern[];
11
- projection: IRProjectionItem[];
12
- where?: IRExpression;
13
- orderBy?: IROrderByItem[];
14
- limit?: number;
15
- offset?: number;
16
- subjectId?: string;
17
- subjectIds?: string[];
18
- singleResult?: boolean;
19
- resultMap?: IRResultMapEntry[];
20
- };
21
- export type IRProjectionItem = {
22
- alias: IRAlias;
23
- expression: IRExpression;
24
- };
25
- export type IROrderByItem = {
26
- expression: IRExpression;
27
- direction: IRDirection;
28
- };
29
- export type IRResultMapEntry = {
30
- key: string;
31
- alias: IRAlias;
32
- };
33
- export type IRGraphPattern = IRShapeScanPattern | IRTraversePattern | IRJoinPattern | IROptionalPattern | IRUnionPattern | IRExistsPattern | IRMinusPattern;
34
- export type IRShapeScanPattern = {
35
- kind: 'shape_scan';
36
- shape: string;
37
- alias: IRAlias;
38
- };
39
- export type IRTraversePattern = {
40
- kind: 'traverse';
41
- from: IRAlias;
42
- to: IRAlias;
43
- property: string;
44
- pathExpr?: PathExpr;
45
- filter?: IRExpression;
46
- maxCount?: number;
47
- /**
48
- * Inner LIMIT/OFFSET/ORDER BY for a nested select on this traversal's
49
- * related collection. When set, the root→child traverse is wrapped in a
50
- * SPARQL sub-SELECT to bound the collection per parent. Only valid when the
51
- * outer query targets a single root subject (enforced in irToAlgebra).
52
- */
53
- innerLimit?: number;
54
- innerOffset?: number;
55
- innerOrderBy?: IRInnerOrderBy[];
56
- };
57
- export type IRInnerOrderBy = {
58
- property: string;
59
- direction: IRDirection;
60
- };
61
- export type IRJoinPattern = {
62
- kind: 'join';
63
- patterns: IRGraphPattern[];
64
- };
65
- export type IROptionalPattern = {
66
- kind: 'optional';
67
- pattern: IRGraphPattern;
68
- };
69
- export type IRUnionPattern = {
70
- kind: 'union';
71
- branches: IRGraphPattern[];
72
- };
73
- export type IRExistsPattern = {
74
- kind: 'exists';
75
- pattern: IRGraphPattern;
76
- };
77
- export type IRMinusPattern = {
78
- kind: 'minus';
79
- pattern: IRGraphPattern;
80
- filter?: IRExpression;
81
- };
82
- export type IRExpression = IRLiteralExpression | IRReferenceExpression | IRAliasExpression | IRPropertyExpression | IRContextPropertyExpression | IRBinaryExpression | IRLogicalExpression | IRNotExpression | IRFunctionExpression | IRAggregateExpression | IRExistsExpression | IRInExpression;
83
- /**
84
- * Membership test — `value IN (…)` / `NOT IN (…)`.
85
- * `source` is forward-shaped: today only the explicit-`list` arm exists (Rung 1);
86
- * a `{query}` arm (Rung 2 — membership against a subquery, lowering to EXISTS)
87
- * can be added without changing the node's identity or the `oneOf`/`notOneOf` DSL.
88
- */
89
- export type IRInExpression = {
90
- kind: 'in_expr';
91
- negated: boolean;
92
- value: IRExpression;
93
- source: {
94
- list: IRExpression[];
95
- };
96
- };
97
- export type IRLiteralExpression = {
98
- kind: 'literal_expr';
99
- value: IRValue;
100
- };
101
- export type IRReferenceExpression = {
102
- kind: 'reference_expr';
103
- /** The referenced node IRI. Optional only while a `contextName` is unresolved. */
104
- value?: string;
105
- /**
106
- * A query-context reference (`{@ctx}` on the wire). When set, `value` is filled
107
- * by `lower()` from the live context map — resolved or thrown there, never baked
108
- * at build time. Absent for a plain node reference.
109
- */
110
- contextName?: string;
111
- };
112
- export type IRAliasExpression = {
113
- kind: 'alias_expr';
114
- alias: IRAlias;
115
- };
116
- export type IRPropertyExpression = {
117
- kind: 'property_expr';
118
- sourceAlias: IRAlias;
119
- property: string;
120
- pathExpr?: import('../paths/PropertyPathExpr.js').PathExpr;
121
- maxCount?: number;
122
- };
123
- export type IRContextPropertyExpression = {
124
- kind: 'context_property_expr';
125
- /** The context entity IRI. Optional only while a `contextName` is unresolved. */
126
- contextIri?: string;
127
- /** A query-context reference resolved into `contextIri` by `lower()`. */
128
- contextName?: string;
129
- property: string;
130
- };
131
- export type IRBinaryOperator = '=' | '!=' | '>' | '>=' | '<' | '<=' | '+' | '-' | '*' | '/';
132
- export type IRBinaryExpression = {
133
- kind: 'binary_expr';
134
- operator: IRBinaryOperator;
135
- left: IRExpression;
136
- right: IRExpression;
137
- };
138
- export type IRLogicalOperator = 'and' | 'or';
139
- export type IRLogicalExpression = {
140
- kind: 'logical_expr';
141
- operator: IRLogicalOperator;
142
- expressions: IRExpression[];
143
- };
144
- export type IRNotExpression = {
145
- kind: 'not_expr';
146
- expression: IRExpression;
147
- };
148
- export type IRFunctionExpression = {
149
- kind: 'function_expr';
150
- name: string;
151
- args: IRExpression[];
152
- };
153
- export type IRAggregateExpression = {
154
- kind: 'aggregate_expr';
155
- name: 'count' | 'sum' | 'avg' | 'min' | 'max';
156
- args: IRExpression[];
157
- };
158
- export type IRExistsExpression = {
159
- kind: 'exists_expr';
160
- pattern: IRGraphPattern;
161
- filter?: IRExpression;
162
- };
163
- export type IRCreateMutation = {
164
- kind: 'create';
165
- shape: string;
166
- data: IRNodeData;
167
- };
168
- export type IRTraversalPattern = {
169
- from: string;
170
- property: string;
171
- to: string;
172
- };
173
- export type IRUpdateMutation = {
174
- kind: 'update';
175
- shape: string;
176
- id: string;
177
- data: IRNodeData;
178
- traversalPatterns?: IRTraversalPattern[];
179
- };
180
- export type IRDeleteMutation = {
181
- kind: 'delete';
182
- shape: string;
183
- ids: NodeReferenceValue[];
184
- };
185
- export type IRDeleteAllMutation = {
186
- kind: 'delete_all';
187
- shape: string;
188
- };
189
- export type IRDeleteWhereMutation = {
190
- kind: 'delete_where';
191
- shape: string;
192
- where: IRExpression;
193
- wherePatterns: IRGraphPattern[];
194
- };
195
- export type IRUpdateWhereMutation = {
196
- kind: 'update_where';
197
- shape: string;
198
- data: IRNodeData;
199
- where?: IRExpression;
200
- wherePatterns?: IRGraphPattern[];
201
- traversalPatterns?: IRTraversalPattern[];
202
- };
203
- export type IRNodeData = {
204
- shape: string;
205
- fields: IRFieldUpdate[];
206
- id?: string;
207
- };
208
- export type IRFieldUpdate = {
209
- property: string;
210
- value: IRFieldValue;
211
- };
212
- export type IRSetModificationValue = {
213
- add?: IRFieldValue[];
214
- remove?: NodeReferenceValue[];
215
- };
216
- export type IRFieldValue = IRValue | Date | NodeReferenceValue | IRNodeData | IRSetModificationValue | IRFieldValue[] | IRExpression | undefined;
217
- /**
218
- * A single result row — an object with a node id and dynamic fields.
219
- * Used in select and create results.
220
- */
221
- export type ResultRow = {
222
- id: string;
223
- [key: string]: ResultFieldValue;
224
- };
225
- /**
226
- * Possible field values in a select or create result row.
227
- */
228
- export type ResultFieldValue = string | number | boolean | Date | null | undefined | ResultRow | ResultRow[] | string[] | number[] | boolean[] | Date[];
229
- /**
230
- * What `selectQuery` should return.
231
- *
232
- * - Array of rows for multi-result queries (the default).
233
- * - A single row when `query.singleResult` is true (`.one()` or subject-targeted query).
234
- * - `null` when `singleResult` is true and the target node doesn't exist.
235
- */
236
- export type SelectResult = ResultRow[] | ResultRow | null;
237
- /**
238
- * What `createQuery` should return.
239
- *
240
- * A single row with the generated `id` and the created field values.
241
- * Nested creates appear as nested `ResultRow` objects (with their own ids).
242
- * Array fields (e.g. friends) appear as `ResultRow[]`.
243
- */
244
- export type CreateResult = ResultRow;
245
- /**
246
- * When a set property is fully overwritten, the result contains `updatedTo`
247
- * with the new complete set of values.
248
- */
249
- export type SetOverwriteResult = {
250
- updatedTo: ResultRow[];
251
- };
252
- /**
253
- * When a set property is incrementally modified with `{add, remove}`,
254
- * the result contains the added and removed entries.
255
- */
256
- export type SetModificationResult = {
257
- added: ResultRow[];
258
- removed: ResultRow[];
259
- };
260
- /**
261
- * Possible field values in an update result row.
262
- * Extends `ResultFieldValue` with set modification shapes.
263
- */
264
- export type UpdateFieldValue = ResultFieldValue | SetOverwriteResult | SetModificationResult;
265
- /**
266
- * What `updateQuery` should return.
267
- *
268
- * A single row with the target node's `id` and only the changed fields.
269
- * Fields not included in the update are omitted (not returned).
270
- *
271
- * Field value shapes depend on the type of update:
272
- * - Literal fields: the new value (string, number, boolean, Date).
273
- * - Single object fields: a `ResultRow` with the referenced/created node.
274
- * - Set overwrite (passing an array): `{updatedTo: ResultRow[]}`.
275
- * - Set add/remove (passing `{add, remove}`): `{added: ResultRow[], removed: ResultRow[]}`.
276
- * - Unset single field (passing `undefined` or `null`): field is `undefined`.
277
- * - Unset multi-value field (passing `undefined`): empty array `[]`.
278
- */
279
- export type UpdateResult = {
280
- id: string;
281
- [key: string]: UpdateFieldValue;
282
- };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=IntermediateRepresentation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IntermediateRepresentation.js","sourceRoot":"","sources":["../../../src/queries/IntermediateRepresentation.ts"],"names":[],"mappings":""}
@@ -1,50 +0,0 @@
1
- import { type NodeDescriptionValue, NodeReferenceValue, type PropUpdateValue, QueryFactory, type SetModification, type SetModificationValue, type UpdateNodePropertyValue, type UpdatePartial } from './QueryFactory.js';
2
- import type { NodeShape, PropertyShape } from '../shapes/SHACL.js';
3
- export type NodeId = {
4
- id: string;
5
- } | string;
6
- export declare class MutationQueryFactory extends QueryFactory {
7
- /**
8
- * Normalize raw create/update data into a {@link NodeDescriptionValue} — the
9
- * IR-free step shared by `toJSON()` and `lower()`. Kept on this base (which
10
- * imports no IR) so the builders can normalize for serialization without
11
- * pulling the canonical-IR pipeline.
12
- */
13
- describe(shape: NodeShape, data: unknown, allowTopLevelId?: boolean): NodeDescriptionValue;
14
- /** Normalize delete ids (strings / `{id}`) to `NodeReferenceValue[]` (IR-free). */
15
- normalizeNodeRefs(ids: NodeId[] | NodeId): NodeReferenceValue[];
16
- protected convertUpdateObject(obj: any, shape: NodeShape, allowTopLevelId?: boolean): NodeDescriptionValue;
17
- protected isSetModification(obj: any, shape: any): boolean;
18
- protected convertSetModification(obj: SetModification<any>, shape: PropertyShape): SetModificationValue;
19
- protected convertSetRemoveValue(obj: UpdatePartial | UpdatePartial[], shape: PropertyShape): NodeReferenceValue[];
20
- protected convertSetAddValue(obj: UpdatePartial | UpdatePartial[], shape: PropertyShape): UpdatePartial[];
21
- protected convertSingleRemoveValue(value: any, shape: PropertyShape): NodeReferenceValue;
22
- protected convertNodeDescription(inputObj: Record<string, unknown>, shape: NodeShape): NodeDescriptionValue;
23
- protected createNodePropertyValue(value: any, propShape: PropertyShape): UpdateNodePropertyValue;
24
- /**
25
- * Lightweight structural validation of a single property value against its
26
- * PropertyShape — cardinality (`minCount`/`maxCount`) and node-kind (literal
27
- * vs relation). This is *structural* only (from metadata already in hand); it
28
- * does not duplicate datatype/deep validation, which the store performs. It
29
- * fails fast at the call site with a clear message instead of surfacing a
30
- * confusing store error later.
31
- *
32
- * Skips values whose final shape isn't known here: computed expressions,
33
- * context refs, `unset` (null/undefined), and set-modifications (`{add,remove}`
34
- * — the resulting count depends on the node's current state).
35
- */
36
- protected validateAgainstShape(value: any, propShape: PropertyShape): void;
37
- /** True when the property clearly accepts only literal values. */
38
- private expectsLiteral;
39
- /** True when the property clearly accepts only nodes (IRIs/blank nodes). */
40
- private expectsNode;
41
- protected convertUpdateValue(value: any, propShape?: PropertyShape, allowArrays?: boolean): PropUpdateValue;
42
- protected isNodeReference(obj: any): obj is NodeReferenceValue;
43
- protected convertNodeReferences(input: NodeId[] | NodeId): NodeReferenceValue[];
44
- protected convertNodeReferenceOrString(o: {
45
- id: string;
46
- } | string): NodeReferenceValue;
47
- protected convertNodeReference(obj: {
48
- id: string;
49
- }): NodeReferenceValue;
50
- }