@_linked/core 2.14.4 → 2.15.0-next.20260712155143
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/CHANGELOG.md +29 -0
- package/README.md +1 -1
- package/lib/esm/expressions/ExpressionNode.d.ts +3 -3
- package/lib/esm/expressions/ExpressionNode.js +1 -1
- package/lib/esm/expressions/ExpressionNode.js.map +1 -1
- package/lib/esm/queries/CreateBuilder.d.ts +2 -2
- package/lib/esm/queries/CreateBuilder.js +2 -2
- package/lib/esm/queries/CreateBuilder.js.map +1 -1
- package/lib/esm/queries/CreateQuery.d.ts +2 -2
- package/lib/esm/queries/DeleteBuilder.d.ts +2 -2
- package/lib/esm/queries/DeleteQuery.d.ts +2 -2
- package/lib/esm/queries/DslJsonExpression.d.ts +6 -6
- package/lib/esm/queries/DslJsonExpression.js +1 -1
- package/lib/esm/queries/DslJsonExpression.js.map +1 -1
- package/lib/esm/queries/FieldSet.d.ts +18 -18
- package/lib/esm/queries/FieldSet.js +11 -10
- package/lib/esm/queries/FieldSet.js.map +1 -1
- package/lib/esm/queries/IRDesugar.js +1 -1
- package/lib/esm/queries/IRDesugar.js.map +1 -1
- package/lib/esm/queries/IRMutation.d.ts +7 -7
- package/lib/esm/queries/MutationQuery.d.ts +12 -12
- package/lib/esm/queries/MutationQuery.js +4 -3
- package/lib/esm/queries/MutationQuery.js.map +1 -1
- package/lib/esm/queries/MutationSerialization.d.ts +5 -5
- package/lib/esm/queries/MutationSerialization.js +2 -1
- package/lib/esm/queries/MutationSerialization.js.map +1 -1
- package/lib/esm/queries/PropertyPath.d.ts +8 -8
- package/lib/esm/queries/PropertyPath.js +3 -2
- package/lib/esm/queries/PropertyPath.js.map +1 -1
- package/lib/esm/queries/ProxiedPathBuilder.js +5 -4
- package/lib/esm/queries/ProxiedPathBuilder.js.map +1 -1
- package/lib/esm/queries/QueryBuilder.d.ts +3 -3
- package/lib/esm/queries/QueryBuilder.js +3 -3
- package/lib/esm/queries/QueryBuilder.js.map +1 -1
- package/lib/esm/queries/QueryBuilderSerialization.d.ts +6 -6
- package/lib/esm/queries/QueryBuilderSerialization.js.map +1 -1
- package/lib/esm/queries/QueryContext.js +4 -4
- package/lib/esm/queries/QueryContext.js.map +1 -1
- package/lib/esm/queries/QueryFactory.d.ts +3 -3
- package/lib/esm/queries/SelectQuery.d.ts +16 -16
- package/lib/esm/queries/SelectQuery.js +22 -27
- package/lib/esm/queries/SelectQuery.js.map +1 -1
- package/lib/esm/queries/UpdateBuilder.d.ts +2 -2
- package/lib/esm/queries/UpdateQuery.d.ts +2 -2
- package/lib/esm/queries/lowerMutationJSON.d.ts +2 -2
- package/lib/esm/queries/lowerMutationJSON.js +2 -1
- package/lib/esm/queries/lowerMutationJSON.js.map +1 -1
- package/lib/esm/shapes/SHACL.d.ts +24 -110
- package/lib/esm/shapes/SHACL.js +25 -229
- package/lib/esm/shapes/SHACL.js.map +1 -1
- package/lib/esm/shapes/Shape.d.ts +29 -8
- package/lib/esm/shapes/Shape.js +37 -7
- package/lib/esm/shapes/Shape.js.map +1 -1
- package/lib/esm/shapes/nodeShapeData.d.ts +122 -0
- package/lib/esm/shapes/nodeShapeData.js +183 -0
- package/lib/esm/shapes/nodeShapeData.js.map +1 -0
- package/lib/esm/shapes/syncShapes.js +2 -3
- package/lib/esm/shapes/syncShapes.js.map +1 -1
- package/lib/esm/sparql/SparqlDataset.d.ts +1 -3
- package/lib/esm/sparql/SparqlDataset.js +1 -4
- package/lib/esm/sparql/SparqlDataset.js.map +1 -1
- package/lib/esm/sparql/irToAlgebra.js +9 -12
- package/lib/esm/sparql/irToAlgebra.js.map +1 -1
- package/lib/esm/sparql/resultMapping.js +1 -1
- package/lib/esm/sparql/resultMapping.js.map +1 -1
- package/lib/esm/utils/LinkedStorage.js +1 -1
- package/lib/esm/utils/LinkedStorage.js.map +1 -1
- package/lib/esm/utils/Package.js +6 -5
- package/lib/esm/utils/Package.js.map +1 -1
- package/lib/esm/utils/ShapeClass.d.ts +3 -3
- package/lib/esm/utils/ShapeClass.js +2 -3
- package/lib/esm/utils/ShapeClass.js.map +1 -1
- package/package.json +1 -1
package/lib/esm/shapes/Shape.js
CHANGED
|
@@ -4,11 +4,34 @@ import { UpdateBuilder } from '../queries/UpdateBuilder.js';
|
|
|
4
4
|
import { DeleteBuilder } from '../queries/DeleteBuilder.js';
|
|
5
5
|
import { getPropertyShapeByLabel } from '../utils/ShapeClass.js';
|
|
6
6
|
import { ShapeSet } from '../collections/ShapeSet.js';
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
* Build a constructor-less, prototype-linked Shape used ONLY as a proxy /
|
|
10
|
+
* metadata-carrier target inside the query DSL (never handed to consumers and
|
|
11
|
+
* never persisted). It is a genuine `Shape` on the prototype chain — so
|
|
12
|
+
* `.constructor`, the `nodeShape` getter, `ShapeSet`, and `getLeastSpecificShape`
|
|
13
|
+
* all work — but it deliberately bypasses the `Shape` constructor, which is
|
|
14
|
+
* guarded to reject direct instantiation. Not exported from the package index.
|
|
15
|
+
*/
|
|
16
|
+
export function createShapeTarget(shapeClass, id) {
|
|
17
|
+
const target = Object.create(shapeClass.prototype);
|
|
18
|
+
if (id !== undefined) {
|
|
19
|
+
target.id = id;
|
|
20
|
+
}
|
|
21
|
+
return target;
|
|
22
|
+
}
|
|
7
23
|
export class Shape {
|
|
8
|
-
constructor(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
24
|
+
constructor() {
|
|
25
|
+
var _a;
|
|
26
|
+
// Shapes are metadata, not data: a Shape subclass carries no live per-instance
|
|
27
|
+
// values (its decorated getters return only typing stubs), so `new SomeShape()`
|
|
28
|
+
// is always a mistake. The query DSL never reaches here — it builds
|
|
29
|
+
// constructor-less proxy targets via `createShapeTarget()` (Object.create), and
|
|
30
|
+
// SHACL metadata is plain `NodeShapeData`/`PropertyShapeData` objects. Force
|
|
31
|
+
// consumers to the DSL instead of constructing broken instances.
|
|
32
|
+
const name = ((_a = new.target) === null || _a === void 0 ? void 0 : _a.name) || 'Shape';
|
|
33
|
+
throw new Error(`Cannot instantiate shape \`${name}\` directly — shapes are metadata, not data. ` +
|
|
34
|
+
`Use the DSL instead: ${name}.select(...), .create(...), .update(...), or .delete(...).`);
|
|
12
35
|
}
|
|
13
36
|
get nodeShape() {
|
|
14
37
|
return this.constructor.shape;
|
|
@@ -78,10 +101,14 @@ export class Shape {
|
|
|
78
101
|
static deleteWhere(fn) {
|
|
79
102
|
return DeleteBuilder.from(this).where(fn);
|
|
80
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* @deprecated Unused; the DSL reads property shapes via `nodeShapeData` free
|
|
106
|
+
* functions and static metadata. Scheduled for removal.
|
|
107
|
+
*/
|
|
81
108
|
static mapPropertyShapes(mapFunction) {
|
|
82
109
|
// SAFETY: dummyShape is used as a dynamic proxy target — we assign .proxy and
|
|
83
110
|
// access arbitrary property names on it, which S doesn't declare.
|
|
84
|
-
let dummyShape =
|
|
111
|
+
let dummyShape = createShapeTarget(this);
|
|
85
112
|
dummyShape.proxy = new Proxy(dummyShape, {
|
|
86
113
|
get(target, key, receiver) {
|
|
87
114
|
if (typeof key === 'string') {
|
|
@@ -100,6 +127,10 @@ export class Shape {
|
|
|
100
127
|
});
|
|
101
128
|
return mapFunction(dummyShape.proxy);
|
|
102
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* @deprecated Unused; shapes are metadata and no longer materialized into
|
|
132
|
+
* `ShapeSet`s of instances. Scheduled for removal.
|
|
133
|
+
*/
|
|
103
134
|
static getSetOf(values) {
|
|
104
135
|
const set = new ShapeSet();
|
|
105
136
|
for (const value of values) {
|
|
@@ -107,8 +138,7 @@ export class Shape {
|
|
|
107
138
|
set.add(value);
|
|
108
139
|
}
|
|
109
140
|
else {
|
|
110
|
-
const instance =
|
|
111
|
-
instance.id = typeof value === 'string' ? value : value.id;
|
|
141
|
+
const instance = createShapeTarget(this, typeof value === 'string' ? value : value.id);
|
|
112
142
|
set.add(instance);
|
|
113
143
|
}
|
|
114
144
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Shape.js","sourceRoot":"","sources":["../../../src/shapes/Shape.ts"],"names":[],"mappings":"AAcA,OAAO,EAAC,YAAY,EAAC,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAC,aAAa,EAAgB,MAAM,6BAA6B,CAAC;AAEzE,OAAO,EAAC,uBAAuB,EAAC,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAC,QAAQ,EAAC,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"Shape.js","sourceRoot":"","sources":["../../../src/shapes/Shape.ts"],"names":[],"mappings":"AAcA,OAAO,EAAC,YAAY,EAAC,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAC,aAAa,EAAgB,MAAM,6BAA6B,CAAC;AAEzE,OAAO,EAAC,uBAAuB,EAAC,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAC,QAAQ,EAAC,MAAM,4BAA4B,CAAC;AA2BpD;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAC/B,UAA8C,EAC9C,EAAW;IAEX,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAM,CAAC;IACxD,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;QACrB,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;IACjB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,OAAgB,KAAK;IAUzB;;QACE,+EAA+E;QAC/E,gFAAgF;QAChF,oEAAoE;QACpE,gFAAgF;QAChF,6EAA6E;QAC7E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I,CAAC;AAEvC,mBAAa,GAAmC,IAAI,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { NodeReferenceValue } from '../utils/NodeReference.js';
|
|
2
|
+
import type { PathExpr } from '../paths/PropertyPathExpr.js';
|
|
3
|
+
/**
|
|
4
|
+
* Plain-object SHACL metadata — the QResult-like shape of a `sh:PropertyShape`.
|
|
5
|
+
*
|
|
6
|
+
* Shapes are metadata, not data: a shape class's `.shape` and its property shapes
|
|
7
|
+
* are plain objects (no class instance, no methods). Operations that used to be
|
|
8
|
+
* instance methods now live as free functions in this module.
|
|
9
|
+
*/
|
|
10
|
+
export interface PropertyShapeData {
|
|
11
|
+
id: string;
|
|
12
|
+
label: string;
|
|
13
|
+
path: PathExpr;
|
|
14
|
+
nodeKind?: NodeReferenceValue;
|
|
15
|
+
datatype?: NodeReferenceValue;
|
|
16
|
+
minCount?: number;
|
|
17
|
+
maxCount?: number;
|
|
18
|
+
name?: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
order?: number;
|
|
21
|
+
group?: string;
|
|
22
|
+
class?: NodeReferenceValue;
|
|
23
|
+
in?: (NodeReferenceValue | string | number | boolean)[];
|
|
24
|
+
equalsConstraint?: NodeReferenceValue;
|
|
25
|
+
disjoint?: NodeReferenceValue;
|
|
26
|
+
lessThan?: NodeReferenceValue;
|
|
27
|
+
lessThanOrEquals?: NodeReferenceValue;
|
|
28
|
+
/** Value-range constraints (sh:minInclusive / sh:maxInclusive / sh:minExclusive / sh:maxExclusive). */
|
|
29
|
+
minInclusive?: number;
|
|
30
|
+
maxInclusive?: number;
|
|
31
|
+
minExclusive?: number | string;
|
|
32
|
+
maxExclusive?: number;
|
|
33
|
+
/** String-length constraints (sh:minLength / sh:maxLength). */
|
|
34
|
+
minLength?: number;
|
|
35
|
+
maxLength?: number;
|
|
36
|
+
/** Regex constraint (sh:pattern); serialized as its source string. */
|
|
37
|
+
pattern?: RegExp;
|
|
38
|
+
hasValueConstraint?: NodeReferenceValue | string | number | boolean;
|
|
39
|
+
defaultValue?: unknown;
|
|
40
|
+
sortBy?: PathExpr;
|
|
41
|
+
valueShape?: NodeReferenceValue;
|
|
42
|
+
/** Composition marker: the value(s) of this property are owned by the subject. */
|
|
43
|
+
contains?: boolean;
|
|
44
|
+
parentNodeShape?: NodeShapeData;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Plain-object SHACL metadata — the QResult-like shape of a `sh:NodeShape`.
|
|
48
|
+
*/
|
|
49
|
+
export interface NodeShapeData {
|
|
50
|
+
id: string;
|
|
51
|
+
label?: string;
|
|
52
|
+
description?: string;
|
|
53
|
+
targetClass?: NodeReferenceValue;
|
|
54
|
+
extends?: NodeReferenceValue;
|
|
55
|
+
/** Composition marker: instances are dependent (cascade-deletable via `contains`). */
|
|
56
|
+
dependent?: boolean;
|
|
57
|
+
/** sh:closed — target nodes with undeclared properties are invalid. */
|
|
58
|
+
closed?: boolean;
|
|
59
|
+
/** sh:ignoredProperties — extra properties permitted when the shape is closed. */
|
|
60
|
+
ignoredProperties?: NodeReferenceValue[];
|
|
61
|
+
propertyShapes: PropertyShapeData[];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Result object produced by `propertyShapeToResult()` (SHACL projection).
|
|
65
|
+
* @deprecated No production callers remain (the `NodeShape.properties` getter and
|
|
66
|
+
* `PropertyShape.getResult()` were removed with the plain-object conversion). Read
|
|
67
|
+
* the plain `PropertyShapeData` fields directly. Scheduled for removal.
|
|
68
|
+
*/
|
|
69
|
+
export interface PropertyShapeResult {
|
|
70
|
+
id: string;
|
|
71
|
+
label: string;
|
|
72
|
+
path: PathExpr;
|
|
73
|
+
nodeKind?: NodeReferenceValue;
|
|
74
|
+
datatype?: NodeReferenceValue;
|
|
75
|
+
minCount?: number;
|
|
76
|
+
maxCount?: number;
|
|
77
|
+
name?: string;
|
|
78
|
+
description?: string;
|
|
79
|
+
order?: number;
|
|
80
|
+
group?: string;
|
|
81
|
+
class?: NodeReferenceValue;
|
|
82
|
+
in?: (NodeReferenceValue | string | number | boolean)[];
|
|
83
|
+
equals?: NodeReferenceValue;
|
|
84
|
+
disjoint?: NodeReferenceValue;
|
|
85
|
+
lessThan?: NodeReferenceValue;
|
|
86
|
+
lessThanOrEquals?: NodeReferenceValue;
|
|
87
|
+
hasValue?: NodeReferenceValue | string | number | boolean;
|
|
88
|
+
defaultValue?: unknown;
|
|
89
|
+
sortBy?: PathExpr;
|
|
90
|
+
valueShape?: NodeReferenceValue;
|
|
91
|
+
}
|
|
92
|
+
/** Create an empty NodeShape metadata object for the given shape IRI. */
|
|
93
|
+
export declare function createNodeShapeData(id: string): NodeShapeData;
|
|
94
|
+
/** Create a blank PropertyShape metadata object (fields filled in by the caller). */
|
|
95
|
+
export declare function createPropertyShapeData(): PropertyShapeData;
|
|
96
|
+
/**
|
|
97
|
+
* Property shapes declared on this NodeShape. With `includeSuperClasses`, walks the
|
|
98
|
+
* registered shape-class inheritance chain (via `getShapeClass(nodeShape.id)`) and
|
|
99
|
+
* concatenates each ancestor's own property shapes.
|
|
100
|
+
*/
|
|
101
|
+
export declare function getPropertyShapes(nodeShape: NodeShapeData, includeSuperClasses?: boolean): PropertyShapeData[];
|
|
102
|
+
/** Property shapes across the inheritance chain, deduped by label (most specific wins). */
|
|
103
|
+
export declare function getUniquePropertyShapes(nodeShape: NodeShapeData): PropertyShapeData[];
|
|
104
|
+
/**
|
|
105
|
+
* Find a property shape by label. With `checkSubShapes` (default true), ascends the
|
|
106
|
+
* registered shape-class chain to superclasses if the label isn't found locally.
|
|
107
|
+
*/
|
|
108
|
+
export declare function getPropertyShape(nodeShape: NodeShapeData, label: string, checkSubShapes?: boolean): PropertyShapeData | undefined;
|
|
109
|
+
/** Two node shapes are equal when they share the same IRI. */
|
|
110
|
+
export declare function nodeShapeEquals(a: NodeShapeData, b?: NodeShapeData): boolean;
|
|
111
|
+
/** Append a property shape to a node shape, wiring the back-reference. */
|
|
112
|
+
export declare function addPropertyShape(nodeShape: NodeShapeData, propertyShape: PropertyShapeData): void;
|
|
113
|
+
/** Shallow-clone a property shape (used by property override / disallow). */
|
|
114
|
+
export declare function clonePropertyShape(propertyShape: PropertyShapeData): PropertyShapeData;
|
|
115
|
+
/**
|
|
116
|
+
* Project a property shape to its SHACL result object.
|
|
117
|
+
* @deprecated No production callers remain. Read the plain `PropertyShapeData`
|
|
118
|
+
* fields directly (note this projection renames `equalsConstraint`→`equals`,
|
|
119
|
+
* `hasValueConstraint`→`hasValue`, and serializes `pattern` to its source string).
|
|
120
|
+
* Scheduled for removal.
|
|
121
|
+
*/
|
|
122
|
+
export declare function propertyShapeToResult(ps: PropertyShapeData): PropertyShapeResult;
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { getShapeClass } from '../utils/ShapeClass.js';
|
|
2
|
+
import { Shape } from './Shape.js';
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
// Factories
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
/** Create an empty NodeShape metadata object for the given shape IRI. */
|
|
7
|
+
export function createNodeShapeData(id) {
|
|
8
|
+
return { id, propertyShapes: [] };
|
|
9
|
+
}
|
|
10
|
+
/** Create a blank PropertyShape metadata object (fields filled in by the caller). */
|
|
11
|
+
export function createPropertyShapeData() {
|
|
12
|
+
return { id: '', label: '', path: null };
|
|
13
|
+
}
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
// Free functions (formerly NodeShape/PropertyShape instance methods)
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
/** One-time warning keys for shapes whose `propertyShapes` is missing/invalid. */
|
|
18
|
+
const warnedMissingPropertyShapes = new Set();
|
|
19
|
+
/**
|
|
20
|
+
* Read a node shape's own property shapes, tolerating a missing/invalid array.
|
|
21
|
+
*
|
|
22
|
+
* A non-array `propertyShapes` almost always means a duplicate `@_linked/core`
|
|
23
|
+
* install or a non-normalized static shape on a superclass; warn once per shape id
|
|
24
|
+
* (diagnostic parity with the former `NodeShape.listPropertyShapesSafe`) and treat
|
|
25
|
+
* it as empty.
|
|
26
|
+
*/
|
|
27
|
+
function ownPropertyShapes(nodeShape) {
|
|
28
|
+
var _a;
|
|
29
|
+
const own = nodeShape.propertyShapes;
|
|
30
|
+
if (Array.isArray(own)) {
|
|
31
|
+
return own;
|
|
32
|
+
}
|
|
33
|
+
const id = (_a = nodeShape.id) !== null && _a !== void 0 ? _a : '';
|
|
34
|
+
if (!warnedMissingPropertyShapes.has(id)) {
|
|
35
|
+
warnedMissingPropertyShapes.add(id);
|
|
36
|
+
console.warn(`[@_linked/core] static shape ${id ? `'${id}'` : '(unknown id)'} has missing ` +
|
|
37
|
+
`or invalid propertyShapes. Treating as []. Often caused by duplicate ` +
|
|
38
|
+
`@_linked/core installs or a non-normalized static shape on a superclass.`);
|
|
39
|
+
}
|
|
40
|
+
return [];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Property shapes declared on this NodeShape. With `includeSuperClasses`, walks the
|
|
44
|
+
* registered shape-class inheritance chain (via `getShapeClass(nodeShape.id)`) and
|
|
45
|
+
* concatenates each ancestor's own property shapes.
|
|
46
|
+
*/
|
|
47
|
+
export function getPropertyShapes(nodeShape, includeSuperClasses = false) {
|
|
48
|
+
if (!includeSuperClasses) {
|
|
49
|
+
return [...ownPropertyShapes(nodeShape)];
|
|
50
|
+
}
|
|
51
|
+
let shapeClass = getShapeClass(nodeShape.id);
|
|
52
|
+
if (!shapeClass) {
|
|
53
|
+
return [...ownPropertyShapes(nodeShape)];
|
|
54
|
+
}
|
|
55
|
+
const res = [];
|
|
56
|
+
while (shapeClass === null || shapeClass === void 0 ? void 0 : shapeClass.shape) {
|
|
57
|
+
res.push(...ownPropertyShapes(shapeClass.shape));
|
|
58
|
+
// Stop at the base Shape class.
|
|
59
|
+
if (shapeClass === Shape) {
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
shapeClass = Object.getPrototypeOf(shapeClass);
|
|
63
|
+
}
|
|
64
|
+
return res;
|
|
65
|
+
}
|
|
66
|
+
/** Property shapes across the inheritance chain, deduped by label (most specific wins). */
|
|
67
|
+
export function getUniquePropertyShapes(nodeShape) {
|
|
68
|
+
const unique = [];
|
|
69
|
+
const seen = new Set();
|
|
70
|
+
for (const ps of getPropertyShapes(nodeShape, true)) {
|
|
71
|
+
if (!seen.has(ps.label)) {
|
|
72
|
+
seen.add(ps.label);
|
|
73
|
+
unique.push(ps);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return unique;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Find a property shape by label. With `checkSubShapes` (default true), ascends the
|
|
80
|
+
* registered shape-class chain to superclasses if the label isn't found locally.
|
|
81
|
+
*/
|
|
82
|
+
export function getPropertyShape(nodeShape, label, checkSubShapes = true) {
|
|
83
|
+
let shapeClass = getShapeClass(nodeShape.id);
|
|
84
|
+
if (!shapeClass) {
|
|
85
|
+
return ownPropertyShapes(nodeShape).find((ps) => ps.label === label);
|
|
86
|
+
}
|
|
87
|
+
let res;
|
|
88
|
+
while (!res && (shapeClass === null || shapeClass === void 0 ? void 0 : shapeClass.shape)) {
|
|
89
|
+
res = ownPropertyShapes(shapeClass.shape).find((ps) => ps.label === label);
|
|
90
|
+
if (checkSubShapes) {
|
|
91
|
+
if (shapeClass === Shape) {
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
shapeClass = Object.getPrototypeOf(shapeClass);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return res;
|
|
101
|
+
}
|
|
102
|
+
/** Two node shapes are equal when they share the same IRI. */
|
|
103
|
+
export function nodeShapeEquals(a, b) {
|
|
104
|
+
return !!b && (a === null || a === void 0 ? void 0 : a.id) === b.id;
|
|
105
|
+
}
|
|
106
|
+
/** Append a property shape to a node shape, wiring the back-reference. */
|
|
107
|
+
export function addPropertyShape(nodeShape, propertyShape) {
|
|
108
|
+
propertyShape.parentNodeShape = nodeShape;
|
|
109
|
+
if (!Array.isArray(nodeShape.propertyShapes)) {
|
|
110
|
+
nodeShape.propertyShapes = [];
|
|
111
|
+
}
|
|
112
|
+
nodeShape.propertyShapes.push(propertyShape);
|
|
113
|
+
}
|
|
114
|
+
/** Shallow-clone a property shape (used by property override / disallow). */
|
|
115
|
+
export function clonePropertyShape(propertyShape) {
|
|
116
|
+
return Object.assign({}, propertyShape);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Project a property shape to its SHACL result object.
|
|
120
|
+
* @deprecated No production callers remain. Read the plain `PropertyShapeData`
|
|
121
|
+
* fields directly (note this projection renames `equalsConstraint`→`equals`,
|
|
122
|
+
* `hasValueConstraint`→`hasValue`, and serializes `pattern` to its source string).
|
|
123
|
+
* Scheduled for removal.
|
|
124
|
+
*/
|
|
125
|
+
export function propertyShapeToResult(ps) {
|
|
126
|
+
const result = {
|
|
127
|
+
id: ps.id,
|
|
128
|
+
label: ps.label,
|
|
129
|
+
path: ps.path,
|
|
130
|
+
};
|
|
131
|
+
if (ps.nodeKind)
|
|
132
|
+
result.nodeKind = ps.nodeKind;
|
|
133
|
+
if (ps.datatype)
|
|
134
|
+
result.datatype = ps.datatype;
|
|
135
|
+
if (typeof ps.minCount === 'number')
|
|
136
|
+
result.minCount = ps.minCount;
|
|
137
|
+
if (typeof ps.maxCount === 'number')
|
|
138
|
+
result.maxCount = ps.maxCount;
|
|
139
|
+
if (ps.name)
|
|
140
|
+
result.name = ps.name;
|
|
141
|
+
if (ps.description)
|
|
142
|
+
result.description = ps.description;
|
|
143
|
+
if (typeof ps.order === 'number')
|
|
144
|
+
result.order = ps.order;
|
|
145
|
+
if (ps.group)
|
|
146
|
+
result.group = ps.group;
|
|
147
|
+
if (ps.class)
|
|
148
|
+
result.class = ps.class;
|
|
149
|
+
if (ps.in)
|
|
150
|
+
result.in = ps.in;
|
|
151
|
+
if (ps.equalsConstraint)
|
|
152
|
+
result.equals = ps.equalsConstraint;
|
|
153
|
+
if (ps.disjoint)
|
|
154
|
+
result.disjoint = ps.disjoint;
|
|
155
|
+
if (ps.lessThan)
|
|
156
|
+
result.lessThan = ps.lessThan;
|
|
157
|
+
if (ps.lessThanOrEquals)
|
|
158
|
+
result.lessThanOrEquals = ps.lessThanOrEquals;
|
|
159
|
+
if (ps.minInclusive !== undefined)
|
|
160
|
+
result.minInclusive = ps.minInclusive;
|
|
161
|
+
if (ps.maxInclusive !== undefined)
|
|
162
|
+
result.maxInclusive = ps.maxInclusive;
|
|
163
|
+
if (ps.minExclusive !== undefined)
|
|
164
|
+
result.minExclusive = ps.minExclusive;
|
|
165
|
+
if (ps.maxExclusive !== undefined)
|
|
166
|
+
result.maxExclusive = ps.maxExclusive;
|
|
167
|
+
if (typeof ps.minLength === 'number')
|
|
168
|
+
result.minLength = ps.minLength;
|
|
169
|
+
if (typeof ps.maxLength === 'number')
|
|
170
|
+
result.maxLength = ps.maxLength;
|
|
171
|
+
if (ps.pattern)
|
|
172
|
+
result.pattern = ps.pattern.source;
|
|
173
|
+
if (ps.hasValueConstraint !== undefined)
|
|
174
|
+
result.hasValue = ps.hasValueConstraint;
|
|
175
|
+
if (ps.defaultValue !== undefined)
|
|
176
|
+
result.defaultValue = ps.defaultValue;
|
|
177
|
+
if (ps.sortBy)
|
|
178
|
+
result.sortBy = ps.sortBy;
|
|
179
|
+
if (ps.valueShape)
|
|
180
|
+
result.valueShape = ps.valueShape;
|
|
181
|
+
return result;
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=nodeShapeData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeShapeData.js","sourceRoot":"","sources":["../../../src/shapes/nodeShapeData.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAC;AA8FjC,8EAA8E;AAC9E,YAAY;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,UAAU,CAAC;IACrD,OAAO,MAA6B,CAAC;AACvC,CAAC"}
|
|
@@ -14,6 +14,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
14
14
|
*/
|
|
15
15
|
import { getAllShapeClasses, getShapeClass } from '../utils/ShapeClass.js';
|
|
16
16
|
import { NodeShape } from './SHACL.js';
|
|
17
|
+
import { getUniquePropertyShapes, } from './nodeShapeData.js';
|
|
17
18
|
import { DeleteBuilder } from '../queries/DeleteBuilder.js';
|
|
18
19
|
import { rdfList } from './List.js';
|
|
19
20
|
import { serializePathToNodeData } from './serializePathToNodeData.js';
|
|
@@ -97,9 +98,7 @@ function buildNodeShapeData(nodeShape, shapeIri) {
|
|
|
97
98
|
d.ignoredProperties = nodeShape.ignoredProperties;
|
|
98
99
|
}
|
|
99
100
|
// Flatten: emit own + inherited property shapes (deduped by label) under this shape.
|
|
100
|
-
d.properties = nodeShape
|
|
101
|
-
.getUniquePropertyShapes()
|
|
102
|
-
.map((ps) => buildPropertyShapeData(ps, shapeIri));
|
|
101
|
+
d.properties = getUniquePropertyShapes(nodeShape).map((ps) => buildPropertyShapeData(ps, shapeIri));
|
|
103
102
|
return d;
|
|
104
103
|
}
|
|
105
104
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syncShapes.js","sourceRoot":"","sources":["../../../src/shapes/syncShapes.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;GAIG;AACH,OAAO,EAAC,kBAAkB,EAAE,aAAa,EAAC,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"syncShapes.js","sourceRoot":"","sources":["../../../src/shapes/syncShapes.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;GAIG;AACH,OAAO,EAAC,kBAAkB,EAAE,aAAa,EAAC,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AACrC,OAAO,EACL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AA0C,MAAM,EAAE,CAAC,CAAC;IACtE,CAAC;IACD,MAAM,SAAS,GAAG,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,KAAK,CAAC;IAC7B,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,OAAO,MAAM,KAAK,QAAQ;YACxB,CAAC,CAAC,0CAA0C,MAAM,EAAE;YACpD,CAAC,CAAC,6CAA6C,CAClD,CAAC;IACJ,CAAC;IACD,MAAM,GAAG,GAAG,SAAS,CAAC,EAAE,CAAC;IAEzB,+FAA+F;IAC/F,uDAAuD;IACvD,MAAM,GAAG,GAAI,GAA8B,CAAC,WAAW,CAAC;IACxD,IAAI,CAAC,GAAG,IAAI,GAAG,KAAK,iBAAiB,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,oDAAoD,GAAG,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED,OAAO,cAAc,CAAC,SAAS,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -6,11 +6,9 @@ import type { DeleteQuery, DeleteResponse } from '../queries/DeleteQuery.js';
|
|
|
6
6
|
import type { SelectResult, CreateResult, UpdateResult } from '../queries/IntermediateRepresentation.js';
|
|
7
7
|
import type { SparqlJsonResults } from './resultMapping.js';
|
|
8
8
|
import { type SparqlOptions } from './sparqlUtils.js';
|
|
9
|
-
import { Shape } from '../shapes/Shape.js';
|
|
10
9
|
/**
|
|
11
10
|
* Abstract base class for SPARQL-backed datasets.
|
|
12
11
|
*
|
|
13
|
-
* Extends Shape so dataset configurations can themselves be persisted as linked data.
|
|
14
12
|
* Handles the full pipeline: IR query → SPARQL string → execute → map results.
|
|
15
13
|
* Subclasses only need to implement the two transport methods:
|
|
16
14
|
* - `executeSparqlSelect` — send a SPARQL SELECT and return JSON results
|
|
@@ -34,7 +32,7 @@ import { Shape } from '../shapes/Shape.js';
|
|
|
34
32
|
* }
|
|
35
33
|
* ```
|
|
36
34
|
*/
|
|
37
|
-
export declare abstract class SparqlDataset
|
|
35
|
+
export declare abstract class SparqlDataset implements IDataset {
|
|
38
36
|
protected options?: SparqlOptions;
|
|
39
37
|
constructor(options?: SparqlOptions);
|
|
40
38
|
/**
|
|
@@ -10,12 +10,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { selectToSparql, createToSparql, updateToSparql, updateWhereToSparql, deleteToSparql, deleteAllToSparql, deleteWhereToSparql, } from './irToAlgebra.js';
|
|
11
11
|
import { mapSparqlSelectResult, mapSparqlCreateResult, mapSparqlUpdateResult, } from './resultMapping.js';
|
|
12
12
|
import { generateEntityUri } from './sparqlUtils.js';
|
|
13
|
-
import { Shape } from '../shapes/Shape.js';
|
|
14
13
|
import { lower } from '../queries/lower.js';
|
|
15
14
|
/**
|
|
16
15
|
* Abstract base class for SPARQL-backed datasets.
|
|
17
16
|
*
|
|
18
|
-
* Extends Shape so dataset configurations can themselves be persisted as linked data.
|
|
19
17
|
* Handles the full pipeline: IR query → SPARQL string → execute → map results.
|
|
20
18
|
* Subclasses only need to implement the two transport methods:
|
|
21
19
|
* - `executeSparqlSelect` — send a SPARQL SELECT and return JSON results
|
|
@@ -39,9 +37,8 @@ import { lower } from '../queries/lower.js';
|
|
|
39
37
|
* }
|
|
40
38
|
* ```
|
|
41
39
|
*/
|
|
42
|
-
export class SparqlDataset
|
|
40
|
+
export class SparqlDataset {
|
|
43
41
|
constructor(options) {
|
|
44
|
-
super();
|
|
45
42
|
this.options = options;
|
|
46
43
|
}
|
|
47
44
|
selectQuery(query) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SparqlDataset.js","sourceRoot":"","sources":["../../../src/sparql/SparqlDataset.ts"],"names":[],"mappings":";;;;;;;;;AAWA,OAAO,EACL,cAAc,EACd,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;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CAAC;gBAC/B,MAAM,MAAM,GAAG,mBAAmB,CAAC,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;gBACrD,MAAM,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;gBACvC,OAAO,EAAC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAC,CAAC;YACjC,CAAC;YACD,MAAM,MAAM,GAAG,cAAc,CAAC,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;YAChD,MAAM,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;YACvC,OAAO;gBACL,OAAO,EAAE,EAAE,CAAC,GAAG;gBACf,KAAK,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM;aACrB,CAAC;QACJ,CAAC;KAAA;IAED;;;OAGG;IACG,QAAQ,CACZ,MAAc,EACd,IAAyB;;YAEzB,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACtB,OAAO,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;YAC1C,CAAC;YACD,OAAO,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;QAC1C,CAAC;KAAA;CACF;AAED,6EAA6E;AAC7E,OAAO,EAAC,aAAa,IAAI,WAAW,EAAC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getPropertyShapes } from '../shapes/nodeShapeData.js';
|
|
1
2
|
import { pathExprToSparql, collectPathUris } from '../paths/pathExprToSparql.js';
|
|
2
3
|
import { generateEntityUri } from './sparqlUtils.js';
|
|
3
4
|
import { selectPlanToSparql, insertDataPlanToSparql, deleteInsertPlanToSparql, } from './algebraToString.js';
|
|
@@ -60,7 +61,6 @@ function resolveShapeScanIri(shapeId) {
|
|
|
60
61
|
const predicateTermCache = new Map();
|
|
61
62
|
let predicateTermCacheSize = -1;
|
|
62
63
|
function resolvePropertyPredicateTerm(propertyId) {
|
|
63
|
-
var _a, _b, _c;
|
|
64
64
|
const shapeClasses = getAllShapeClasses();
|
|
65
65
|
if (shapeClasses.size !== predicateTermCacheSize) {
|
|
66
66
|
predicateTermCache.clear();
|
|
@@ -70,7 +70,7 @@ function resolvePropertyPredicateTerm(propertyId) {
|
|
|
70
70
|
if (cached)
|
|
71
71
|
return cached;
|
|
72
72
|
for (const shapeClass of shapeClasses.values()) {
|
|
73
|
-
const propertyShape = (
|
|
73
|
+
const propertyShape = (shapeClass.shape ? getPropertyShapes(shapeClass.shape, true) : []).find((prop) => prop.id === propertyId);
|
|
74
74
|
if (!propertyShape)
|
|
75
75
|
continue;
|
|
76
76
|
const simplePathId = getSimplePathId(propertyShape.path);
|
|
@@ -1310,13 +1310,13 @@ function generateNodeDataTriples(data, options) {
|
|
|
1310
1310
|
const uri = data.id || generateEntityUri(data.shape, options);
|
|
1311
1311
|
const triples = [];
|
|
1312
1312
|
const subjectTerm = iriTerm(uri);
|
|
1313
|
-
// Type triple — resolve the SHACL
|
|
1313
|
+
// Type triple — resolve the SHACL NodeShapeData id in the IR to the ontology
|
|
1314
1314
|
// targetClass URI (sibling of PR #77's SELECT-side resolveShapeScanIri).
|
|
1315
1315
|
// Mutations were not covered by #77; see mutation-uri-fidelity.test.ts.
|
|
1316
1316
|
triples.push(tripleOf(subjectTerm, iriTerm(RDF_TYPE), iriTerm(resolveShapeScanIri(data.shape))));
|
|
1317
1317
|
// Field triples
|
|
1318
1318
|
for (const field of data.fields) {
|
|
1319
|
-
// Resolve the SHACL
|
|
1319
|
+
// Resolve the SHACL PropertyShapeData id to its declared `path` URI.
|
|
1320
1320
|
const propertyTerm = resolvePropertyPredicateTerm(field.property);
|
|
1321
1321
|
if (field.value === null || field.value === undefined) {
|
|
1322
1322
|
continue;
|
|
@@ -1638,10 +1638,9 @@ export function updateToAlgebra(query, options) {
|
|
|
1638
1638
|
function shapeHasContainsProperty(shapeId) {
|
|
1639
1639
|
var _a;
|
|
1640
1640
|
const nodeShape = (_a = getShapeClass(shapeId)) === null || _a === void 0 ? void 0 : _a.shape;
|
|
1641
|
-
if (!nodeShape
|
|
1641
|
+
if (!nodeShape)
|
|
1642
1642
|
return false;
|
|
1643
|
-
return nodeShape
|
|
1644
|
-
.getPropertyShapes(true)
|
|
1643
|
+
return getPropertyShapes(nodeShape, true)
|
|
1645
1644
|
.some((ps) => ps.contains);
|
|
1646
1645
|
}
|
|
1647
1646
|
// Memoized registry scan for cascade lowering — called once per update/delete and
|
|
@@ -1665,9 +1664,7 @@ function collectContainment() {
|
|
|
1665
1664
|
if (nodeShape.dependent && ((_a = nodeShape.targetClass) === null || _a === void 0 ? void 0 : _a.id)) {
|
|
1666
1665
|
dependentTypes.add(nodeShape.targetClass.id);
|
|
1667
1666
|
}
|
|
1668
|
-
const propertyShapes =
|
|
1669
|
-
? nodeShape.getPropertyShapes(false)
|
|
1670
|
-
: [];
|
|
1667
|
+
const propertyShapes = getPropertyShapes(nodeShape, false);
|
|
1671
1668
|
for (const ps of propertyShapes) {
|
|
1672
1669
|
if (ps.contains) {
|
|
1673
1670
|
const predId = getSimplePathId(ps.path);
|
|
@@ -1795,7 +1792,7 @@ export function deleteToAlgebra(query, _options) {
|
|
|
1795
1792
|
// Blank node tree walking for schema-aware delete cleanup
|
|
1796
1793
|
// ---------------------------------------------------------------------------
|
|
1797
1794
|
/**
|
|
1798
|
-
* Checks whether a
|
|
1795
|
+
* Checks whether a PropertyShapeData points to blank nodes (sh:BlankNode or
|
|
1799
1796
|
* sh:BlankNodeOrIRI). Returns true when the property's range *may* include
|
|
1800
1797
|
* blank node values that should be cleaned up on delete.
|
|
1801
1798
|
*/
|
|
@@ -1822,7 +1819,7 @@ function walkBlankNodeTree(shapeId, parentVar, depth, deletePatterns) {
|
|
|
1822
1819
|
if (!(shapeClass === null || shapeClass === void 0 ? void 0 : shapeClass.shape))
|
|
1823
1820
|
return null;
|
|
1824
1821
|
let optionals = null;
|
|
1825
|
-
const props = shapeClass.shape
|
|
1822
|
+
const props = shapeClass.shape ? getPropertyShapes(shapeClass.shape, true) : [];
|
|
1826
1823
|
for (const prop of props) {
|
|
1827
1824
|
if (!isBlankNodeProperty(prop))
|
|
1828
1825
|
continue;
|