@_linked/core 2.28.4 → 2.30.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.
- package/CHANGELOG.md +87 -0
- package/README.md +131 -1
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/ontologies/linked-core.d.ts +2 -0
- package/lib/esm/ontologies/linked-core.js +10 -0
- package/lib/esm/ontologies/linked-core.js.map +1 -1
- package/lib/esm/ontologies/shacl.d.ts +1 -0
- package/lib/esm/ontologies/shacl.js +2 -0
- package/lib/esm/ontologies/shacl.js.map +1 -1
- package/lib/esm/queries/IRMutation.js +1 -1
- package/lib/esm/queries/IRMutation.js.map +1 -1
- package/lib/esm/queries/IntermediateRepresentation.d.ts +5 -0
- package/lib/esm/queries/IntermediateRepresentation.js.map +1 -1
- package/lib/esm/queries/MutationQuery.js +15 -0
- package/lib/esm/queries/MutationQuery.js.map +1 -1
- package/lib/esm/queries/MutationSerialization.d.ts +5 -4
- package/lib/esm/queries/MutationSerialization.js +9 -1
- package/lib/esm/queries/MutationSerialization.js.map +1 -1
- package/lib/esm/queries/QueryFactory.d.ts +6 -0
- package/lib/esm/queries/QueryFactory.js.map +1 -1
- package/lib/esm/queries/SelectQuery.js +3 -1
- package/lib/esm/queries/SelectQuery.js.map +1 -1
- package/lib/esm/queries/lowerMutationJSON.js +6 -1
- package/lib/esm/queries/lowerMutationJSON.js.map +1 -1
- package/lib/esm/shapes/List.d.ts +1 -0
- package/lib/esm/shapes/List.js.map +1 -1
- package/lib/esm/shapes/PathNode.d.ts +5 -2
- package/lib/esm/shapes/PathNode.js +5 -2
- package/lib/esm/shapes/PathNode.js.map +1 -1
- package/lib/esm/shapes/SHACL.d.ts +15 -2
- package/lib/esm/shapes/SHACL.js.map +1 -1
- package/lib/esm/shapes/serializePathToNodeData.d.ts +17 -5
- package/lib/esm/shapes/serializePathToNodeData.js +41 -27
- package/lib/esm/shapes/serializePathToNodeData.js.map +1 -1
- package/lib/esm/shapes/singleOwnerConstraint.d.ts +27 -0
- package/lib/esm/shapes/singleOwnerConstraint.js +89 -0
- package/lib/esm/shapes/singleOwnerConstraint.js.map +1 -0
- package/lib/esm/shapes/syncShapes.js +49 -10
- package/lib/esm/shapes/syncShapes.js.map +1 -1
- package/lib/esm/shapes/validation.js +2 -2
- package/lib/esm/shapes/validation.js.map +1 -1
- package/lib/esm/sparql/SparqlAlgebra.d.ts +5 -0
- package/lib/esm/sparql/SparqlAlgebra.js.map +1 -1
- package/lib/esm/sparql/SparqlDataset.d.ts +9 -1
- package/lib/esm/sparql/SparqlDataset.js +19 -0
- package/lib/esm/sparql/SparqlDataset.js.map +1 -1
- package/lib/esm/sparql/algebraToString.js +2 -0
- package/lib/esm/sparql/algebraToString.js.map +1 -1
- package/lib/esm/sparql/irToAlgebra.d.ts +34 -6
- package/lib/esm/sparql/irToAlgebra.js +384 -59
- package/lib/esm/sparql/irToAlgebra.js.map +1 -1
- package/lib/esm/sparql/ownedLinkCheck.d.ts +50 -0
- package/lib/esm/sparql/ownedLinkCheck.js +142 -0
- package/lib/esm/sparql/ownedLinkCheck.js.map +1 -0
- package/lib/esm/utils/Package.js +8 -0
- package/lib/esm/utils/Package.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,92 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.30.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#332](https://github.com/linked-fw/core/pull/332) [`9b76457`](https://github.com/linked-fw/core/commit/9b764574df910900d4242b59e0007758f9f5dfd6) Thanks [@flyon](https://github.com/flyon)! - Shape sync now writes complex SHACL property paths as blank nodes, so SHACL validators read them correctly.
|
|
8
|
+
|
|
9
|
+
**What was wrong.** `syncShapes()` / `syncShape()` stored every inverse, alternative, sequence and `*`/`+`/`?` path as IRI-named nodes (`sh:path <…/owners/inv>`). An IRI in `sh:path` is a predicate path (SHACL §2.3.1), so validators such as Jena read those paths as predicates that match nothing. Constraints on complex paths never reported a violation. That includes the generated `…singleOwner` constraints.
|
|
10
|
+
|
|
11
|
+
**What is stored now.** Paths are written in plain SHACL syntax. Operator nodes and list cells are untyped blank nodes:
|
|
12
|
+
|
|
13
|
+
```turtle
|
|
14
|
+
<…/Thing/image.singleOwner/owners> sh:path [ sh:inversePath schema:image ] .
|
|
15
|
+
<…/Person/region> sh:path ( ex:worksAt ex:locatedIn ) .
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The next sync of a shape removes the IRI path nodes earlier versions wrote. One exception: an operator node that sat inside a sequence (`<…/seq/0/inv>`) is left behind unreferenced. Nothing points at it, and the README has a query to remove it.
|
|
19
|
+
|
|
20
|
+
**If you read stored shapes.** A path node is now a blank node, and its label is valid only inside the result set it came from. Read a path's structure in the same query that finds it (`?ps sh:path ?p . ?p sh:inversePath ?x`), keyed by the property shape's IRI. Joining on a path node's id across two queries no longer works. Nothing reads the old `rdf:type core:PathNode` / `rdf:List` triples on path nodes; they are gone.
|
|
21
|
+
|
|
22
|
+
**New: `__blank` in nested create data.** Nested node data in a `create` may carry `__blank: true`. The node is then written as a fresh blank node holding only its field triples, with no `rdf:type`. The delete cascade removes such nodes when they are owned through a `contains` property. It is meant for RDF syntax such as SHACL paths. It throws if:
|
|
23
|
+
|
|
24
|
+
- it is combined with `__id` or `id`;
|
|
25
|
+
- it is on the created root;
|
|
26
|
+
- it is used in `update` or `upsert`;
|
|
27
|
+
- it is the value of a property that is not `contains`.
|
|
28
|
+
|
|
29
|
+
`serializePathToNodeData(path)` now produces this form. Its second argument is ignored and kept only for compatibility.
|
|
30
|
+
|
|
31
|
+
## 2.29.0
|
|
32
|
+
|
|
33
|
+
### Minor Changes
|
|
34
|
+
|
|
35
|
+
- [#328](https://github.com/linked-fw/core/pull/328) [`c6fa4ef`](https://github.com/linked-fw/core/commit/c6fa4efbe105cb4af276c6d81fbb923e337ff182) Thanks [@flyon](https://github.com/flyon)! - Owned (`contains`) values:
|
|
36
|
+
- re-sending the current `{id}` is now a no-op, where before it deleted that node's own triples;
|
|
37
|
+
- an array overwrite keeps the ids it sends again and deletes only the ones left out; a set
|
|
38
|
+
modification that removes and re-adds the same id leaves that node alone;
|
|
39
|
+
- deleting a subject, by id or in bulk (`.all()`, `.where(...)`), now deletes its immediately-owned
|
|
40
|
+
children (every `contains` property that declares a `shape`), as documented. The `dependent`
|
|
41
|
+
cascade below them now only visits the dependent shapes the deleted shape can reach through its
|
|
42
|
+
owned properties, so a shape that owns only non-dependent values pays no cascade cost;
|
|
43
|
+
- a `contains` property without a value shape only deletes `dependent`-typed values;
|
|
44
|
+
- linking a node of the wrong class into an owned property that declares a shape is refused before
|
|
45
|
+
anything is written (one `SELECT` per mutation that links owned ids, none otherwise).
|
|
46
|
+
|
|
47
|
+
Shape sync now also writes one generated SHACL NodeShape per `contains` property with a value
|
|
48
|
+
shape, at `<property shape IRI>.singleOwner`, written only by the class that declares the property.
|
|
49
|
+
It limits each value of that predicate to one owner (`sh:targetObjectsOf <p>` plus an
|
|
50
|
+
`sh:inversePath <p>` property with `sh:maxCount 1`) and is marked `core:generated true`, with no
|
|
51
|
+
`sh:targetClass`, so catalog readers can skip it. The declaring shape owns these through a new
|
|
52
|
+
`core:generatedShape` edge, so sync still sends two requests per shape: the delete removes them and
|
|
53
|
+
the create writes them nested. A removed or renamed accessor's constraint goes with the next sync.
|
|
54
|
+
Core does not enforce the constraint on write; run a SHACL validator against the persisted shapes.
|
|
55
|
+
|
|
56
|
+
New exports and meta-model terms:
|
|
57
|
+
- `singleOwnerShapeIri(propertyShapeIri)`, `singleOwnerProperties(nodeShape)` and
|
|
58
|
+
`buildSingleOwnerConstraints(nodeShape, shapeIri)` from `@_linked/core`, to recompute the
|
|
59
|
+
generated shapes' IRIs and data;
|
|
60
|
+
- `NodeShape.targetObjectsOf` (`sh:targetObjectsOf`), `NodeShape.generated` (`core:generated`) and
|
|
61
|
+
`NodeShape.generatedShapes` (`core:generatedShape`, `contains`);
|
|
62
|
+
- `shacl.targetObjectsOf` (`@_linked/core/ontologies/shacl`), `coreOntology.generated` and
|
|
63
|
+
`coreOntology.generatedShape` (`@_linked/core/ontologies/linked-core`).
|
|
64
|
+
|
|
65
|
+
See the README section "Owned properties (`contains` / `dependent`)".
|
|
66
|
+
|
|
67
|
+
**Behaviour changes.** Check these before upgrading:
|
|
68
|
+
- **Deletes now delete owned children.** `@_linked/schema` declares `Thing.image` as `contains`,
|
|
69
|
+
so deleting any schema-derived entity (by id or in bulk) now deletes its linked `ImageObject`s,
|
|
70
|
+
including ones linked by `{id}`. If your data shares one image between several entities through
|
|
71
|
+
`image`, deleting one of them deletes the shared image. Link shared images through a property
|
|
72
|
+
that does not own them.
|
|
73
|
+
- **Linked `{id}`s are class-checked.** Linking an existing node by `{id}` into an owned property
|
|
74
|
+
(any property on a `contains` predicate that declares a shape) is refused when the node is typed
|
|
75
|
+
and none of its types is the shape's class, a registered sub-shape's class, or `sh:class`. A node
|
|
76
|
+
typed only with a subclass that has no registered shape is refused. To accept it, register a shape
|
|
77
|
+
for that subclass (extending the value shape), or declare `sh:class`. Untyped or not-yet-existing
|
|
78
|
+
ids are allowed.
|
|
79
|
+
- **Plain properties on a `contains` predicate are checked too.** Ownership is decided per
|
|
80
|
+
predicate across the registry, so a property *without* `contains` whose predicate another shape
|
|
81
|
+
declares `contains` is class-checked as well (and a replace through it deletes the old value).
|
|
82
|
+
Example: an application shape that declares `schema:image` without `contains`, while
|
|
83
|
+
`@_linked/schema` declares `Thing.image` as `contains`. To resolve a refusal, link a node of the
|
|
84
|
+
value shape's class (or a registered sub-shape's class), register a shape for the node's
|
|
85
|
+
subclass, declare `sh:class` on the property, or use a predicate that no shape owns.
|
|
86
|
+
- **Shape-less `contains` properties keep non-dependent old values.** A `contains` property without
|
|
87
|
+
a value shape (a polymorphic slot such as `sh:path`) no longer deletes the old value's own triples
|
|
88
|
+
on replace or remove. A non-dependent old value is now left in place and may orphan.
|
|
89
|
+
|
|
3
90
|
## 2.28.4
|
|
4
91
|
|
|
5
92
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -246,7 +246,8 @@ removing the link leaves the referenced node untouched. Two optional flags let y
|
|
|
246
246
|
**`contains: true` on an object property** — the edge asserts *exclusive ownership* of the
|
|
247
247
|
value. Whenever that edge goes away, the owned node is deleted with it:
|
|
248
248
|
|
|
249
|
-
- `parent.delete()` deletes the owned child (and its owned sub-tree).
|
|
249
|
+
- `parent.delete()` deletes the owned child (and its owned sub-tree). So do the bulk deletes,
|
|
250
|
+
`DeleteBuilder.from(Parent).all()` and `.where(...)`.
|
|
250
251
|
- `update({ownedProp: newValue})` **replaces** the owned node — the old one is deleted, not
|
|
251
252
|
orphaned.
|
|
252
253
|
- `update({ownedProp: {remove: [x]}})` deletes `x` itself, not just the link.
|
|
@@ -263,6 +264,135 @@ export class Person extends Shape {
|
|
|
263
264
|
}
|
|
264
265
|
```
|
|
265
266
|
|
|
267
|
+
**Replace versus patch in place.** A plain nested object on a `contains` property is a
|
|
268
|
+
*replace*: a new node is created and the old one is deleted. To change the owned node itself,
|
|
269
|
+
update it directly:
|
|
270
|
+
|
|
271
|
+
```typescript
|
|
272
|
+
// Replace: creates a new ImageObject, deletes the old one.
|
|
273
|
+
await Person.update({avatar: {contentUrl: 'https://cdn.example.org/b.png'}}).for(personId);
|
|
274
|
+
|
|
275
|
+
// Patch in place: the same ImageObject keeps its id and its other fields.
|
|
276
|
+
await ImageObject.update({contentUrl: 'https://cdn.example.org/b.png'}).for(avatarId);
|
|
277
|
+
|
|
278
|
+
// Re-sending the current id is a no-op: the edge and the node are left as they are.
|
|
279
|
+
await Person.update({avatar: {id: avatarId}}).for(personId);
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
The same holds for an array overwrite of a `contains` set: ids you send again are kept, ids you
|
|
283
|
+
leave out are deleted. `{id: current, ...fields}` is a nested create with a predefined id, not a
|
|
284
|
+
patch: it deletes all of that node's triples and writes the new ones.
|
|
285
|
+
|
|
286
|
+
**Linking an existing node by `{id}`** is allowed, e.g. upload an image first, then attach it with
|
|
287
|
+
`{avatar: {id: uploadedId}}`. The link transfers ownership: the linked node is deleted when it is
|
|
288
|
+
replaced, removed, or when the owner is deleted.
|
|
289
|
+
|
|
290
|
+
Because of that, core checks the class of every id linked into a property that owns its value and
|
|
291
|
+
declares a `shape`. Ownership is decided per predicate: a property owns its value when any
|
|
292
|
+
registered shape declares its predicate `contains`, so a plain property that shares such a
|
|
293
|
+
predicate is checked too (a replace through it deletes the old value just the same). A link is
|
|
294
|
+
refused, and nothing is written, when the store already types the node and none of its types is
|
|
295
|
+
the shape's `targetClass`, a registered sub-shape's `targetClass`, or the property's `sh:class`:
|
|
296
|
+
|
|
297
|
+
```
|
|
298
|
+
Cannot link <https://my.app/alice> into the contains property "avatar" of <…/shape/my-pkg/Person>:
|
|
299
|
+
it is typed <https://example.org/Person>, but "avatar" only owns instances of <https://schema.org/ImageObject>. …
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
Ids that do not exist yet, or have no `rdf:type`, are allowed, so upload-then-attach works in
|
|
303
|
+
either write order. The check runs in `SparqlDataset` (one `SELECT` per mutation that links owned
|
|
304
|
+
ids, none otherwise). Plain references on predicates no shape owns are never checked. A node
|
|
305
|
+
whose type comes from a subclass that has no registered shape is refused unless the store also
|
|
306
|
+
holds the expected type (an RDFS-inferring store adds it); register a shape for that class, or
|
|
307
|
+
declare `sh:class`, to accept it.
|
|
308
|
+
|
|
309
|
+
Two limits: an id linked while it is untyped, and typed as something else later, is not caught.
|
|
310
|
+
Nor is a node typed by another request between the check's `SELECT` and the `UPDATE` that
|
|
311
|
+
follows it: the two are separate requests, not one transaction. Raw SPARQL updates bypass the
|
|
312
|
+
check altogether. SHACL validation of `sh:class` is the backstop for all three.
|
|
313
|
+
|
|
314
|
+
**What a delete removes.** `parent.delete()` deletes the immediately-owned children of every
|
|
315
|
+
`contains` property that declares a `shape`; `dependent` extends the cascade further down. The bulk
|
|
316
|
+
deletes (`.all()`, `.where(...)`) remove the same owned children and cascade for every matched
|
|
317
|
+
subject (they do not delete incoming references to the subjects, which a delete by id does). A
|
|
318
|
+
`contains` property *without* a `shape` (a polymorphic slot such as `sh:path`, whose value may be a
|
|
319
|
+
shared predicate IRI) only ever deletes `dependent`-typed values; a non-dependent old value is
|
|
320
|
+
left in place.
|
|
321
|
+
|
|
322
|
+
Subject deletes and replaces decide ownership differently. A subject delete (by id or in bulk)
|
|
323
|
+
uses the deleted shape's *own* `contains` properties. Replace, set-remove and the class check use
|
|
324
|
+
the registry-wide predicate rule above. So a plain property on a predicate that another shape
|
|
325
|
+
declares `contains` deletes its old value on replace, but not when its subject is deleted.
|
|
326
|
+
Whether ownership should be decided per property everywhere is an open design question. The
|
|
327
|
+
cascade into `dependent` descendants only emits blocks for the dependent shapes the deleted
|
|
328
|
+
shape can reach through its owned properties, so deleting a shape that owns only non-dependent
|
|
329
|
+
values costs one extra block per owned property. The walk follows only the `contains` properties
|
|
330
|
+
the reached shapes declare: an owned edge that none of those shapes declares is not followed,
|
|
331
|
+
and the node behind it is left in place rather than deleted.
|
|
332
|
+
|
|
333
|
+
Non-owning references to an owned node, through other properties or from other subjects, are
|
|
334
|
+
allowed. They are not cleaned up: after the owner is deleted they dangle. The same holds when two
|
|
335
|
+
subjects own one node (an `{id}` linked into a second owner, which breaks the single-owner rule
|
|
336
|
+
below): deleting either owner deletes the node, and the other owner's edge dangles.
|
|
337
|
+
|
|
338
|
+
**The single-owner constraint.** An owned node has at most one owner. Shape sync persists this as
|
|
339
|
+
one generated SHACL NodeShape per `contains` property that declares a `shape` (simple paths only;
|
|
340
|
+
a shape-less slot may hold a shared IRI, so it is left out). It is written only by the class that
|
|
341
|
+
declares the property, at the property shape's IRI plus `.singleOwner`: `Thing.image` gets one
|
|
342
|
+
constraint at `Thing`, not one per subclass. It is marked `core:generated true` and has no
|
|
343
|
+
`sh:targetClass`, so catalog readers can skip it, and it is never registered in memory. For
|
|
344
|
+
`Thing.image`:
|
|
345
|
+
|
|
346
|
+
```turtle
|
|
347
|
+
<…/shape/my-pkg/Thing/image.singleOwner> a sh:NodeShape ;
|
|
348
|
+
core:generated true ;
|
|
349
|
+
sh:targetObjectsOf schema:image ;
|
|
350
|
+
sh:property <…/Thing/image.singleOwner/owners> .
|
|
351
|
+
|
|
352
|
+
<…/Thing/image.singleOwner/owners> a sh:PropertyShape ;
|
|
353
|
+
rdfs:label "owners" ;
|
|
354
|
+
sh:maxCount 1 ;
|
|
355
|
+
sh:path [ sh:inversePath schema:image ] .
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
The inverse path is stored as an untyped blank node, as is every complex `sh:path` shape sync
|
|
359
|
+
writes (inverse, alternative, sequence, `*`/`+`/`?`): an IRI in `sh:path` is a predicate path to a
|
|
360
|
+
SHACL validator. Versions before 2.30 wrote IRI-named nodes (`…/owners/inv`); the next sync
|
|
361
|
+
replaces them, except an operator node inside a sequence (`…/seq/0/inv`), which is left
|
|
362
|
+
unreferenced. To remove those:
|
|
363
|
+
|
|
364
|
+
```sparql
|
|
365
|
+
DELETE { ?n ?p ?o } WHERE {
|
|
366
|
+
?n a <https://linked.cm/ont/core/PathNode> ; ?p ?o .
|
|
367
|
+
FILTER(isIRI(?n)) FILTER NOT EXISTS { ?x ?y ?n }
|
|
368
|
+
}
|
|
369
|
+
```
|
|
370
|
+
Read a stored path's structure in the same query that finds it (`?ps sh:path ?p .
|
|
371
|
+
?p sh:inversePath ?x`): a blank node's label is not stable across queries.
|
|
372
|
+
|
|
373
|
+
Nested node-data in a `create` may carry `__blank: true` to be written that way: a fresh blank
|
|
374
|
+
node with only its field triples and no `rdf:type`. It is meant for RDF syntax such as SHACL
|
|
375
|
+
paths, has no id (combining it with `__id`/`id` throws), cannot be the created root, and is
|
|
376
|
+
refused in `update`/`upsert`, whose INSERT runs once per WHERE solution.
|
|
377
|
+
The declaring shape owns its generated shapes through `core:generatedShape`, a `contains` edge:
|
|
378
|
+
`<…/Thing> core:generatedShape <…/Thing/image.singleOwner>`. Syncing a shape is still two
|
|
379
|
+
requests: deleting the shape deletes the generated shapes with it (their own triples, property
|
|
380
|
+
shapes and blank path nodes, never the predicate IRI), and the create writes the current ones nested in
|
|
381
|
+
the same request. A removed or renamed accessor therefore loses its constraint, a pruned shape
|
|
382
|
+
takes its constraints with it, and a NodeShape the shape does not own is never touched.
|
|
383
|
+
`singleOwnerShapeIri`, `singleOwnerProperties` and `buildSingleOwnerConstraints` are exported if
|
|
384
|
+
you need to recompute them.
|
|
385
|
+
|
|
386
|
+
Each constraint counts owners through its own predicate only. A node owned through two different
|
|
387
|
+
`contains` predicates (`schema:image` from one subject, `ex:attachments` from another) is not
|
|
388
|
+
reported. That needs overlapping value shapes, and the class check already refuses a wrongly
|
|
389
|
+
typed link.
|
|
390
|
+
|
|
391
|
+
> **Not enforced on write.** Core does not check the single-owner rule, or `sh:class` on
|
|
392
|
+
> non-owning references, when it writes. The default Fuseki setup does not validate SHACL on
|
|
393
|
+
> write either: a dataset exposes only query, update and graph-store services. Run a SHACL
|
|
394
|
+
> validator (Jena SHACL, pySHACL, …) against the persisted shapes to enforce them.
|
|
395
|
+
|
|
266
396
|
**`dependent: true` on a shape** — marks the shape's *instances* as having no independent
|
|
267
397
|
existence, so they are cascade-deleted when reached through a `contains` edge from a parent
|
|
268
398
|
being deleted. Use it for structural nodes that are only ever owned (e.g. list cells, path
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import './shapes/index.js';
|
|
2
2
|
import './live.js';
|
|
3
3
|
export { syncShapes, syncShape } from './shapes/syncShapes.js';
|
|
4
|
+
export { singleOwnerShapeIri, singleOwnerProperties, buildSingleOwnerConstraints, } from './shapes/singleOwnerConstraint.js';
|
|
4
5
|
export { rdfList } from './shapes/List.js';
|
|
5
6
|
export { serializePathToNodeData } from './shapes/serializePathToNodeData.js';
|
|
6
7
|
export { Shape } from './shapes/Shape.js';
|
package/lib/esm/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import './shapes/index.js';
|
|
|
8
8
|
// Registers the live-query store so `query.live()` works (side effects only).
|
|
9
9
|
import './live.js';
|
|
10
10
|
export { syncShapes, syncShape } from './shapes/syncShapes.js';
|
|
11
|
+
export { singleOwnerShapeIri, singleOwnerProperties, buildSingleOwnerConstraints, } from './shapes/singleOwnerConstraint.js';
|
|
11
12
|
export { rdfList } from './shapes/List.js';
|
|
12
13
|
export { serializePathToNodeData } from './shapes/serializePathToNodeData.js';
|
|
13
14
|
// Core public API surface (documented as root imports in the README).
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,0DAA0D;AAC1D,OAAO,mBAAmB,CAAC;AAC3B,8EAA8E;AAC9E,OAAO,WAAW,CAAC;AACnB,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAC,OAAO,EAAC,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAC,uBAAuB,EAAC,MAAM,qCAAqC,CAAC;AAC5E,sEAAsE;AACtE,OAAO,EAAC,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACxC,kEAAkE;AAClE,OAAO,EAAC,QAAQ,EAAE,WAAW,EAAE,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAQnF,OAAO,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACvD,2CAA2C;AAC3C,OAAO,EAAC,aAAa,EAAE,YAAY,EAAC,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAC,KAAK,EAAC,MAAM,oBAAoB,CAAC;AAEzC,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAE/C,OAAO,EACL,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAC,sBAAsB,EAAC,MAAM,4BAA4B,CAAC;AAElE,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAC,YAAY,EAAE,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AAEzE,sBAAsB;AACtB,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAM/C,+BAA+B;AAC/B,OAAO,EAAC,UAAU,EAAE,UAAU,EAAC,MAAM,yBAAyB,CAAC;AAG/D,OAAO,EAAC,YAAY,EAAE,YAAY,EAAC,MAAM,2BAA2B,CAAC;AAGrE,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AAGzD,8CAA8C;AAC9C,OAAO,EAAC,cAAc,EAAC,MAAM,iCAAiC,CAAC;AAE/D,OAAO,EAAC,IAAI,EAAC,MAAM,uBAAuB,CAAC;AAe3C,sEAAsE;AACtE,OAAO,EACL,cAAc,EACd,WAAW,GACZ,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,cAAc,EACd,iBAAiB,GAClB,MAAM,gCAAgC,CAAC;AAWxC,0FAA0F;AAC1F,OAAO,EAAC,iBAAiB,EAAE,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAElF,OAAO,EAAC,qBAAqB,EAAC,MAAM,2BAA2B,CAAC;AAEhE,mDAAmD;AACnD,OAAO,EAAC,cAAc,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,aAAa,EAAE,UAAU,EAAC,MAAM,0BAA0B,CAAC","sourcesContent":["/*\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n */\n// Registers every shape core defines (side effects only).\nimport './shapes/index.js';\n// Registers the live-query store so `query.live()` works (side effects only).\nimport './live.js';\nexport {syncShapes, syncShape} from './shapes/syncShapes.js';\nexport {rdfList} from './shapes/List.js';\nexport {serializePathToNodeData} from './shapes/serializePathToNodeData.js';\n// Core public API surface (documented as root imports in the README).\nexport {Shape} from './shapes/Shape.js';\n// SHACL-aligned validation of plain data objects against a shape.\nexport {validate, assertValid, ShapeValidationError} from './shapes/validation.js';\nexport type {\n ValidationReport,\n ValidationResult,\n ValidationMode,\n ValidateOptions,\n ValidatableShape,\n} from './shapes/validation.js';\nexport {LinkedStorage} from './utils/LinkedStorage.js';\n// New dynamic query building API (Phase 2)\nexport {SelectBuilder, QueryBuilder} from './queries/QueryBuilder.js';\nexport {lower} from './queries/lower.js';\nexport type {LowerableQuery} from './queries/lower.js';\nexport {fromJSON} from './queries/fromJSON.js';\nexport type {QueryJSON} from './queries/fromJSON.js';\nexport {\n getQueryContext,\n setQueryContext,\n subscribeQueryContext,\n PendingQueryContext,\n UnresolvedContextError,\n} from './queries/QueryContext.js';\nexport {subscribeQueryDispatch} from './queries/queryDispatch.js';\nexport type {QueryDispatchEvent, QueryDispatchListener} from './queries/queryDispatch.js';\nexport {\n CONTEXT_REF_KEY,\n encodeContextRef,\n isContextRefJSON,\n resolveContextId,\n} from './queries/ContextRef.js';\nexport type {ContextRefJSON} from './queries/ContextRef.js';\nexport {PropertyPath, walkPropertyPath} from './queries/PropertyPath.js';\n\n// Phase 3a — FieldSet\nexport {FieldSet} from './queries/FieldSet.js';\nexport type {FieldSetEntry, FieldSetInput, FieldSetJSON, FieldSetFieldJSON} from './queries/FieldSet.js';\n\n// Phase 4 — Serialization types\nexport type {QueryBuilderJSON} from './queries/QueryBuilder.js';\n\n// Phase 3b — Mutation builders\nexport {AskBuilder, isAskQuery} from './queries/AskBuilder.js';\nexport type {AskSpec} from './queries/AskBuilder.js';\nexport type {AskQuery, AskQueryJSON, RawAskInput} from './queries/AskQuery.js';\nexport {CountBuilder, isCountQuery} from './queries/CountBuilder.js';\nexport type {CountSpec} from './queries/CountBuilder.js';\nexport type {CountQuery, CountQueryJSON, RawCountInput} from './queries/CountQuery.js';\nexport {CreateBuilder} from './queries/CreateBuilder.js';\nexport {UpdateBuilder} from './queries/UpdateBuilder.js';\nexport {DeleteBuilder} from './queries/DeleteBuilder.js';\nexport type {DeleteId} from './queries/DeleteBuilder.js';\n\n// Expressions — computed fields and functions\nexport {ExpressionNode} from './expressions/ExpressionNode.js';\nexport type {ExpressionInput, PropertyRefMap} from './expressions/ExpressionNode.js';\nexport {Expr} from './expressions/Expr.js';\nexport type {\n ExpressionUpdateProxy,\n ExpressionUpdateResult,\n BaseExpressionMethods,\n NumericExpressionMethods,\n StringExpressionMethods,\n DateExpressionMethods,\n BooleanExpressionMethods,\n} from './expressions/ExpressionMethods.js';\n\n// Phase 5 — Component query integration\nexport type {LinkedComponentInterface, QueryComponentLike} from './queries/SelectQuery.js';\n\n\n// Mutation DSL-JSON serialization (create/update/delete to/from JSON)\nexport {\n encodeNodeData,\n encodeValue,\n} from './queries/MutationSerialization.js';\nexport {\n decodeNodeData,\n lowerMutationJSON,\n} from './queries/lowerMutationJSON.js';\nexport type {\n MutationJSON,\n CreateMutationJSON,\n UpdateMutationJSON,\n DeleteMutationJSON,\n MutationValueJSON,\n MutationNodeDataJSON,\n} from './queries/MutationSerialization.js';\n\n\n// Live-query dependency helpers — what a query reads and a mutation writes, as predicates\nexport {queryDependencies, mutationEffects} from './queries/queryDependencies.js';\nexport type {QueryDependencies, MutationEffects} from './queries/queryDependencies.js';\nexport {findPropertyShapeById} from './shapes/nodeShapeData.js';\n\n// Live queries — see documentation/live-queries.md\nexport {LiveQueryStore, getLiveQueryStore, resetLiveQueryStore, publishChange, invalidate} from './live/LiveQueryStore.js';\nexport type {ChangeEvent} from './live/changes.js';\nexport type {\n LiveQuery,\n LiveState,\n LiveStatus,\n LiveListener,\n LiveQueryOptions,\n LiveQueryStore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+BAA+B;AAC/B,OAAO,EAAC,UAAU,EAAE,UAAU,EAAC,MAAM,yBAAyB,CAAC;AAG/D,OAAO,EAAC,YAAY,EAAE,YAAY,EAAC,MAAM,2BAA2B,CAAC;AAGrE,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AAGzD,8CAA8C;AAC9C,OAAO,EAAC,cAAc,EAAC,MAAM,iCAAiC,CAAC;AAE/D,OAAO,EAAC,IAAI,EAAC,MAAM,uBAAuB,CAAC;AAe3C,sEAAsE;AACtE,OAAO,EACL,cAAc,EACd,WAAW,GACZ,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,cAAc,EACd,iBAAiB,GAClB,MAAM,gCAAgC,CAAC;AAWxC,0FAA0F;AAC1F,OAAO,EAAC,iBAAiB,EAAE,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAElF,OAAO,EAAC,qBAAqB,EAAC,MAAM,2BAA2B,CAAC;AAEhE,mDAAmD;AACnD,OAAO,EAAC,cAAc,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,aAAa,EAAE,UAAU,EAAC,MAAM,0BAA0B,CAAC","sourcesContent":["/*\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n */\n// Registers every shape core defines (side effects only).\nimport './shapes/index.js';\n// Registers the live-query store so `query.live()` works (side effects only).\nimport './live.js';\nexport {syncShapes, syncShape} from './shapes/syncShapes.js';\nexport {\n singleOwnerShapeIri,\n singleOwnerProperties,\n buildSingleOwnerConstraints,\n} from './shapes/singleOwnerConstraint.js';\nexport {rdfList} from './shapes/List.js';\nexport {serializePathToNodeData} from './shapes/serializePathToNodeData.js';\n// Core public API surface (documented as root imports in the README).\nexport {Shape} from './shapes/Shape.js';\n// SHACL-aligned validation of plain data objects against a shape.\nexport {validate, assertValid, ShapeValidationError} from './shapes/validation.js';\nexport type {\n ValidationReport,\n ValidationResult,\n ValidationMode,\n ValidateOptions,\n ValidatableShape,\n} from './shapes/validation.js';\nexport {LinkedStorage} from './utils/LinkedStorage.js';\n// New dynamic query building API (Phase 2)\nexport {SelectBuilder, QueryBuilder} from './queries/QueryBuilder.js';\nexport {lower} from './queries/lower.js';\nexport type {LowerableQuery} from './queries/lower.js';\nexport {fromJSON} from './queries/fromJSON.js';\nexport type {QueryJSON} from './queries/fromJSON.js';\nexport {\n getQueryContext,\n setQueryContext,\n subscribeQueryContext,\n PendingQueryContext,\n UnresolvedContextError,\n} from './queries/QueryContext.js';\nexport {subscribeQueryDispatch} from './queries/queryDispatch.js';\nexport type {QueryDispatchEvent, QueryDispatchListener} from './queries/queryDispatch.js';\nexport {\n CONTEXT_REF_KEY,\n encodeContextRef,\n isContextRefJSON,\n resolveContextId,\n} from './queries/ContextRef.js';\nexport type {ContextRefJSON} from './queries/ContextRef.js';\nexport {PropertyPath, walkPropertyPath} from './queries/PropertyPath.js';\n\n// Phase 3a — FieldSet\nexport {FieldSet} from './queries/FieldSet.js';\nexport type {FieldSetEntry, FieldSetInput, FieldSetJSON, FieldSetFieldJSON} from './queries/FieldSet.js';\n\n// Phase 4 — Serialization types\nexport type {QueryBuilderJSON} from './queries/QueryBuilder.js';\n\n// Phase 3b — Mutation builders\nexport {AskBuilder, isAskQuery} from './queries/AskBuilder.js';\nexport type {AskSpec} from './queries/AskBuilder.js';\nexport type {AskQuery, AskQueryJSON, RawAskInput} from './queries/AskQuery.js';\nexport {CountBuilder, isCountQuery} from './queries/CountBuilder.js';\nexport type {CountSpec} from './queries/CountBuilder.js';\nexport type {CountQuery, CountQueryJSON, RawCountInput} from './queries/CountQuery.js';\nexport {CreateBuilder} from './queries/CreateBuilder.js';\nexport {UpdateBuilder} from './queries/UpdateBuilder.js';\nexport {DeleteBuilder} from './queries/DeleteBuilder.js';\nexport type {DeleteId} from './queries/DeleteBuilder.js';\n\n// Expressions — computed fields and functions\nexport {ExpressionNode} from './expressions/ExpressionNode.js';\nexport type {ExpressionInput, PropertyRefMap} from './expressions/ExpressionNode.js';\nexport {Expr} from './expressions/Expr.js';\nexport type {\n ExpressionUpdateProxy,\n ExpressionUpdateResult,\n BaseExpressionMethods,\n NumericExpressionMethods,\n StringExpressionMethods,\n DateExpressionMethods,\n BooleanExpressionMethods,\n} from './expressions/ExpressionMethods.js';\n\n// Phase 5 — Component query integration\nexport type {LinkedComponentInterface, QueryComponentLike} from './queries/SelectQuery.js';\n\n\n// Mutation DSL-JSON serialization (create/update/delete to/from JSON)\nexport {\n encodeNodeData,\n encodeValue,\n} from './queries/MutationSerialization.js';\nexport {\n decodeNodeData,\n lowerMutationJSON,\n} from './queries/lowerMutationJSON.js';\nexport type {\n MutationJSON,\n CreateMutationJSON,\n UpdateMutationJSON,\n DeleteMutationJSON,\n MutationValueJSON,\n MutationNodeDataJSON,\n} from './queries/MutationSerialization.js';\n\n\n// Live-query dependency helpers — what a query reads and a mutation writes, as predicates\nexport {queryDependencies, mutationEffects} from './queries/queryDependencies.js';\nexport type {QueryDependencies, MutationEffects} from './queries/queryDependencies.js';\nexport {findPropertyShapeById} from './shapes/nodeShapeData.js';\n\n// Live queries — see documentation/live-queries.md\nexport {LiveQueryStore, getLiveQueryStore, resetLiveQueryStore, publishChange, invalidate} from './live/LiveQueryStore.js';\nexport type {ChangeEvent} from './live/changes.js';\nexport type {\n LiveQuery,\n LiveState,\n LiveStatus,\n LiveListener,\n LiveQueryOptions,\n LiveQueryStoreOptions,\n} from './live/LiveQueryStore.js';\n"]}
|
|
@@ -39,6 +39,14 @@ const PathNode = ns('PathNode');
|
|
|
39
39
|
// app — NOT the CN-proprietary `code:` vocab, which describes source-code structure.
|
|
40
40
|
const displayRank = ns('displayRank');
|
|
41
41
|
const displayHidden = ns('displayHidden');
|
|
42
|
+
// Provenance marker: a NodeShape core generates at sync time from another shape's code
|
|
43
|
+
// (today the `<propertyShape>.singleOwner` constraint derived from `contains`), rather than one a
|
|
44
|
+
// developer declared. Catalog readers skip shapes with `core:generated true`.
|
|
45
|
+
const generated = ns('generated');
|
|
46
|
+
// Ownership edge from a NodeShape to the shapes core generated from it at sync time (the
|
|
47
|
+
// single-owner constraint of each `contains` property). It is `contains`, so deleting the
|
|
48
|
+
// shape deletes them, and sync writes them nested in the shape's own create.
|
|
49
|
+
const generatedShape = ns('generatedShape');
|
|
42
50
|
export const coreOntology = {
|
|
43
51
|
Package,
|
|
44
52
|
ShapeClass,
|
|
@@ -52,5 +60,7 @@ export const coreOntology = {
|
|
|
52
60
|
PathNode,
|
|
53
61
|
displayRank,
|
|
54
62
|
displayHidden,
|
|
63
|
+
generated,
|
|
64
|
+
generatedShape,
|
|
55
65
|
};
|
|
56
66
|
//# sourceMappingURL=linked-core.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linked-core.js","sourceRoot":"","sources":["../../../src/ontologies/linked-core.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAC,MAAM,EAAC,MAAM,oBAAoB,CAAC;AAE1C,sFAAsF;AACtF,wCAAwC;AACxC,qDAAqD;AACrD,6FAA6F;AAC7F,gGAAgG;AAChG,oEAAoE;AACpE,MAAM,CAAC,MAAM,EAAE,GAAG,eAAe,CAAC,6BAA6B,CAAC,CAAC;AACjE,MAAM,CAAC,MAAM,KAAK,GAAuB,EAAE,CAAC,EAAE,CAAC,CAAC;AAChD,6FAA6F;AAC7F,0FAA0F;AAC1F,oEAAoE;AACpE,MAAM,CAAC,GAAG,CAAC,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;AACpC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;AAE7B,MAAM,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;AAC9B,MA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F,kGAAkG;AAClG,8EAA8E;AAC9E,MAAM,SAAS,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC;AAElC,yFAAyF;AACzF,0FAA0F;AAC1F,6EAA6E;AAC7E,MAAM,cAAc,GAAG,EAAE,CAAC,gBAAgB,CAAC,CAAC;AAE5C,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,OAAO;IACP,UAAU;IACV,YAAY;IACZ,MAAM,EAAE,cAAc;IACtB,cAAc;IACd,UAAU;IACV,WAAW;IACX,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,WAAW;IACX,aAAa;IACb,SAAS;IACT,cAAc;CACf,CAAC","sourcesContent":["import type {NodeReferenceValue} from '../utils/NodeReference.js';\nimport {createNameSpace} from '../utils/NameSpace.js';\nimport {Prefix} from '../utils/Prefix.js';\n\n// The @_linked/core framework vocabulary. First-party ontology IRIs follow Create Now\n// arch-02 §\"Public ontology namespace\":\n// https://linked.cm/ont/{ontologySlug}/{localName}\n// where ontologySlug defaults to the owning package's publicSlug (`@_linked/core` -> `core`)\n// and the prefix label equals the ontologySlug. Previously `https://linked.cm/ont/linked-core/`\n// (prefix `linked_core`), a leftover of a reverted slug derivation.\nexport const ns = createNameSpace('https://linked.cm/ont/core/');\nexport const _self: NodeReferenceValue = ns('');\n// @deprecated prefix alias: keeps `linked_core:` prefixed names resolving (to the NEW IRIs).\n// It does not make the old full IRIs match. Registered BEFORE `core` because the last add\n// wins for IRI -> prefix compaction, so output always uses `core:`.\nPrefix.add('linked_core', _self.id);\nPrefix.add('core', _self.id);\n\nconst Package = ns('Package');\nconst ShapeClass = ns('ShapeClass');\nconst definesShape = ns('definesShape');\nconst moduleProperty = ns('module');\nconst usesShapeClass = ns('usesShapeClass');\nconst editInline = ns('editInline');\nconst isExtending = ns('isExtending');\n\n// Containment / lifecycle vocabulary.\n// contains — property characteristic: the cascade follows this edge (composition).\n// dependent — shape characteristic: instances may be deleted when reached via a `contains` edge.\n// PathNode — class for SHACL property-path operator nodes (sh:inversePath/alternativePath/…).\nconst contains = ns('contains');\nconst dependent = ns('dependent');\nconst PathNode = ns('PathNode');\n\n// Display vocabulary. SHACL has `sh:order` and `sh:group`, which say how properties\n// are arranged; it has no way to say how *important* a property is, which is what a\n// renderer needs when it can only show one, three or six of them. `displayRank` is\n// that: a single linear rank per property, lower = more important, from which every\n// truncated context (\"show the top 3\") derives. `displayHidden` removes a property\n// from generic rendering without changing its cardinality or its meaning.\n//\n// Placement is deliberate (backlog-029): this is an ecosystem SHACL extension that\n// materializes onto the pure `sh:NodeShape` and therefore travels with an ejected\n// app — NOT the CN-proprietary `code:` vocab, which describes source-code structure.\nconst displayRank = ns('displayRank');\nconst displayHidden = ns('displayHidden');\n\n// Provenance marker: a NodeShape core generates at sync time from another shape's code\n// (today the `<propertyShape>.singleOwner` constraint derived from `contains`), rather than one a\n// developer declared. Catalog readers skip shapes with `core:generated true`.\nconst generated = ns('generated');\n\n// Ownership edge from a NodeShape to the shapes core generated from it at sync time (the\n// single-owner constraint of each `contains` property). It is `contains`, so deleting the\n// shape deletes them, and sync writes them nested in the shape's own create.\nconst generatedShape = ns('generatedShape');\n\nexport const coreOntology = {\n Package,\n ShapeClass,\n definesShape,\n module: moduleProperty,\n usesShapeClass,\n editInline,\n isExtending,\n contains,\n dependent,\n PathNode,\n displayRank,\n displayHidden,\n generated,\n generatedShape,\n};\n"]}
|
|
@@ -68,6 +68,7 @@ export declare const shacl: {
|
|
|
68
68
|
Shape: NodeReferenceValue;
|
|
69
69
|
targetClass: NodeReferenceValue;
|
|
70
70
|
targetNode: NodeReferenceValue;
|
|
71
|
+
targetObjectsOf: NodeReferenceValue;
|
|
71
72
|
BlankNode: NodeReferenceValue;
|
|
72
73
|
IRI: NodeReferenceValue;
|
|
73
74
|
Literal: NodeReferenceValue;
|
|
@@ -24,6 +24,7 @@ const prefix = ns('prefix');
|
|
|
24
24
|
const PropertyShape = ns('PropertyShape');
|
|
25
25
|
const targetClass = ns('targetClass');
|
|
26
26
|
const targetNode = ns('targetNode');
|
|
27
|
+
const targetObjectsOf = ns('targetObjectsOf');
|
|
27
28
|
const node = ns('node');
|
|
28
29
|
const nodeKind = ns('nodeKind');
|
|
29
30
|
const Shape = ns('Shape');
|
|
@@ -114,6 +115,7 @@ export const shacl = {
|
|
|
114
115
|
Shape,
|
|
115
116
|
targetClass,
|
|
116
117
|
targetNode,
|
|
118
|
+
targetObjectsOf,
|
|
117
119
|
BlankNode,
|
|
118
120
|
IRI,
|
|
119
121
|
Literal,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shacl.js","sourceRoot":"","sources":["../../../src/ontologies/shacl.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,MAAM,EAAC,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAC;AAEtD,MAAM,IAAI,GAAG,6BAA6B,CAAC;AAC3C,MAAM,CAAC,MAAM,iBAAiB,GAAuB,EAAC,EAAE,EAAE,IAAI,EAAC,CAAC;AAChE,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AAE1B,MAAM,CAAC,MAAM,EAAE,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;AAExC,8BAA8B;AAC9B,MAAM,MAAM,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC;AAC3B,MAAM,QAAQ,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC;AAChC,MAAM,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;AAC9B,MAAM,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;AACrB,MAAM,QAAQ,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC;AAChC,MAAM,QAAQ,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC;AAChC,MAAM,MAAM,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC;AAC5B,MAAM,IAAI,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC;AACxB,MAAM,W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O;IACP,EAAE,EAAE,GAAG;IACP,QAAQ;IACR,QAAQ;IACR,IAAI;IACJ,WAAW;IACX,IAAI;IACJ,SAAS;IACT,QAAQ;IACR,SAAS;IACT,iBAAiB;IACjB,IAAI;IACJ,MAAM;IACN,QAAQ;IACR,aAAa;IACb,KAAK;IACL,WAAW;IACX,UAAU;IACV,SAAS;IACT,GAAG;IACH,OAAO;IACP,cAAc;IACd,kBAAkB;IAClB,YAAY;IACZ,QAAQ;IACR,MAAM;IACN,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,YAAY;IACZ,KAAK;IACL,KAAK;IACL,MAAM;IACN,iBAAiB;IACjB,UAAU;IACV,QAAQ;IACR,gBAAgB;IAChB,YAAY;IACZ,YAAY;IACZ,SAAS;IACT,YAAY;IACZ,YAAY;IACZ,SAAS;IACT,OAAO;IACP,UAAU;IACV,gBAAgB;IAChB,QAAQ;IACR,gBAAgB;IAChB,SAAS;IACT,WAAW;IACX,cAAc;IACd,UAAU;IACV,KAAK;IACL,OAAO;IACP,aAAa;IACb,MAAM;IACN,SAAS;IACT,yBAAyB;IACzB,wBAAwB;IACxB,uBAAuB;IACvB,2BAA2B;IAC3B,4BAA4B;IAC5B,4BAA4B;IAC5B,2BAA2B;IAC3B,2BAA2B;IAC3B,+BAA+B;IAC/B,+BAA+B;IAC/B,+BAA+B;IAC/B,+BAA+B;IAC/B,0BAA0B;IAC1B,qBAAqB;IACrB,2BAA2B;IAC3B,yBAAyB;IACzB,OAAO;IACP,IAAI;IACJ,cAAc;IACd,MAAM;IACN,eAAe;IACf,WAAW;IACX,cAAc;IACd,aAAa;IACb,aAAa;CACd,CAAC","sourcesContent":["/*\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n */\nimport type {NodeReferenceValue} from '../utils/NodeReference.js';\nimport {Prefix} from '../utils/Prefix.js';\nimport {createNameSpace} from '../utils/NameSpace.js';\n\nconst base = 'http://www.w3.org/ns/shacl#';\nexport const _ontologyResource: NodeReferenceValue = {id: base};\nPrefix.add('shacl', base);\n\nexport const ns = createNameSpace(base);\n\n//add your ontology nodes here\nconst _class = ns('class');\nconst datatype = ns('datatype');\nconst declare = ns('declare');\nconst _in = ns('in');\nconst maxCount = ns('maxCount');\nconst minCount = ns('minCount');\nconst inList = ns('inList');\nconst name = ns('name');\nconst description = ns('description');\nconst NodeShape = ns('NodeShape');\nconst optional = ns('optional');\nconst Parameter = ns('Parameter');\nconst PrefixDeclaration = ns('PrefixDeclaration');\nconst path = ns('path');\nconst property = ns('property');\nconst prefix = ns('prefix');\nconst PropertyShape = ns('PropertyShape');\nconst targetClass = ns('targetClass');\nconst targetNode = ns('targetNode');\nconst node = ns('node');\nconst nodeKind = ns('nodeKind');\nconst Shape = ns('Shape');\n\nconst equals = ns('equals');\nconst disjoint = ns('disjoint');\nconst hasValue = ns('hasValue');\nconst defaultValue = ns('defaultValue');\nconst order = ns('order');\nconst group = ns('group');\nconst closed = ns('closed');\nconst ignoredProperties = ns('ignoredProperties');\n\nconst alternativePath = ns('alternativePath');\nconst inversePath = ns('inversePath');\nconst zeroOrMorePath = ns('zeroOrMorePath');\nconst oneOrMorePath = ns('oneOrMorePath');\nconst zeroOrOnePath = ns('zeroOrOnePath');\n\nconst BlankNode = ns('BlankNode');\nconst IRI = ns('IRI');\nconst Literal = ns('Literal');\nconst BlankNodeOrIRI = ns('BlankNodeOrIRI');\nconst BlankNodeOrLiteral = ns('BlankNodeOrLiteral');\nconst IRIOrLiteral = ns('IRIOrLiteral');\n\nexport const languageIn = ns('languageIn');\nexport const lessThan = ns('lessThan');\nexport const lessThanOrEquals = ns('lessThanOrEquals');\nexport const maxExclusive = ns('maxExclusive');\nexport const maxInclusive = ns('maxInclusive');\nexport const maxLength = ns('maxLength');\nexport const minExclusive = ns('minExclusive');\nexport const minInclusive = ns('minInclusive');\nexport const minLength = ns('minLength');\nexport const pattern = ns('pattern');\nexport const uniqueLang = ns('uniqueLang');\nexport const ValidationReport = ns('ValidationReport');\nexport const conforms = ns('conforms');\nexport const ValidationResult = ns('ValidationResult');\nexport const focusNode = ns('focusNode');\nexport const sourceShape = ns('sourceShape');\nexport const resultSeverity = ns('resultSeverity');\nexport const resultPath = ns('resultPath');\nexport const value = ns('value');\n/** `sh:message` — a custom message declared on a shape or constraint. */\nexport const message = ns('message');\n/** `sh:resultMessage` — the message carried by a validation result. */\nexport const resultMessage = ns('resultMessage');\n/** `sh:detail` — links a validation result to the results that explain it. */\nexport const detail = ns('detail');\nexport const Violation = ns('Violation');\nexport const AbstractResult = ns('AbstractResult');\nexport const sourceConstraintComponent = ns('sourceConstraintComponent');\nexport const ClassConstraintComponent = ns('ClassConstraintComponent');\nexport const NodeConstraintComponent = ns('NodeConstraintComponent');\nexport const DatatypeConstraintComponent = ns('DatatypeConstraintComponent');\nexport const MinLengthConstraintComponent = ns('MinLengthConstraintComponent');\nexport const MaxLengthConstraintComponent = ns('MaxLengthConstraintComponent');\nexport const MinInclusiveConstraintComponent = ns('MinInclusiveConstraintComponent');\nexport const MaxInclusiveConstraintComponent = ns('MaxInclusiveConstraintComponent');\nexport const MinExclusiveConstraintComponent = ns('MinExclusiveConstraintComponent');\nexport const MaxExclusiveConstraintComponent = ns('MaxExclusiveConstraintComponent');\nexport const PatternConstraintComponent = ns('PatternConstraintComponent');\nexport const InConstraintComponent = ns('InConstraintComponent');\nexport const MinCountConstraintComponent = ns('MinCountConstraintComponent');\nexport const MaxCountConstraintComponent = ns('MaxCountConstraintComponent');\nexport const NodeKindConstraintComponent = ns('NodeKindConstraintComponent');\nexport const ClosedConstraintComponent = ns('ClosedConstraintComponent');\nexport const Warning = ns('Warning');\nexport const Info = ns('Info');\nexport const result = ns('result');\n\n//make sure every node is also exported here\nexport const shacl = {\n class: _class,\n datatype,\n declare,\n in: _in,\n maxCount,\n minCount,\n name,\n description,\n node,\n NodeShape,\n optional,\n Parameter,\n PrefixDeclaration,\n path,\n prefix,\n property,\n PropertyShape,\n Shape,\n targetClass,\n targetNode,\n BlankNode,\n IRI,\n Literal,\n BlankNodeOrIRI,\n BlankNodeOrLiteral,\n IRIOrLiteral,\n nodeKind,\n inList,\n equals,\n disjoint,\n hasValue,\n defaultValue,\n order,\n group,\n closed,\n ignoredProperties,\n languageIn,\n lessThan,\n lessThanOrEquals,\n maxExclusive,\n maxInclusive,\n maxLength,\n minExclusive,\n minInclusive,\n minLength,\n pattern,\n uniqueLang,\n ValidationReport,\n conforms,\n ValidationResult,\n focusNode,\n sourceShape,\n resultSeverity,\n resultPath,\n value,\n message,\n resultMessage,\n detail,\n Violation,\n sourceConstraintComponent,\n ClassConstraintComponent,\n NodeConstraintComponent,\n DatatypeConstraintComponent,\n MinLengthConstraintComponent,\n MaxLengthConstraintComponent,\n MinCountConstraintComponent,\n MaxCountConstraintComponent,\n MinInclusiveConstraintComponent,\n MaxInclusiveConstraintComponent,\n MinExclusiveConstraintComponent,\n MaxExclusiveConstraintComponent,\n PatternConstraintComponent,\n InConstraintComponent,\n NodeKindConstraintComponent,\n ClosedConstraintComponent,\n Warning,\n Info,\n AbstractResult,\n result,\n alternativePath,\n inversePath,\n zeroOrMorePath,\n oneOrMorePath,\n zeroOrOnePath,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"shacl.js","sourceRoot":"","sources":["../../../src/ontologies/shacl.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,MAAM,EAAC,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAC;AAEtD,MAAM,IAAI,GAAG,6BAA6B,CAAC;AAC3C,MAAM,CAAC,MAAM,iBAAiB,GAAuB,EAAC,EAAE,EAAE,IAAI,EAAC,CAAC;AAChE,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AAE1B,MAAM,CAAC,MAAM,EAAE,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;AAExC,8BAA8B;AAC9B,M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A2B;IAC3B,4BAA4B;IAC5B,4BAA4B;IAC5B,2BAA2B;IAC3B,2BAA2B;IAC3B,+BAA+B;IAC/B,+BAA+B;IAC/B,+BAA+B;IAC/B,+BAA+B;IAC/B,0BAA0B;IAC1B,qBAAqB;IACrB,2BAA2B;IAC3B,yBAAyB;IACzB,OAAO;IACP,IAAI;IACJ,cAAc;IACd,MAAM;IACN,eAAe;IACf,WAAW;IACX,cAAc;IACd,aAAa;IACb,aAAa;CACd,CAAC","sourcesContent":["/*\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n */\nimport type {NodeReferenceValue} from '../utils/NodeReference.js';\nimport {Prefix} from '../utils/Prefix.js';\nimport {createNameSpace} from '../utils/NameSpace.js';\n\nconst base = 'http://www.w3.org/ns/shacl#';\nexport const _ontologyResource: NodeReferenceValue = {id: base};\nPrefix.add('shacl', base);\n\nexport const ns = createNameSpace(base);\n\n//add your ontology nodes here\nconst _class = ns('class');\nconst datatype = ns('datatype');\nconst declare = ns('declare');\nconst _in = ns('in');\nconst maxCount = ns('maxCount');\nconst minCount = ns('minCount');\nconst inList = ns('inList');\nconst name = ns('name');\nconst description = ns('description');\nconst NodeShape = ns('NodeShape');\nconst optional = ns('optional');\nconst Parameter = ns('Parameter');\nconst PrefixDeclaration = ns('PrefixDeclaration');\nconst path = ns('path');\nconst property = ns('property');\nconst prefix = ns('prefix');\nconst PropertyShape = ns('PropertyShape');\nconst targetClass = ns('targetClass');\nconst targetNode = ns('targetNode');\nconst targetObjectsOf = ns('targetObjectsOf');\nconst node = ns('node');\nconst nodeKind = ns('nodeKind');\nconst Shape = ns('Shape');\n\nconst equals = ns('equals');\nconst disjoint = ns('disjoint');\nconst hasValue = ns('hasValue');\nconst defaultValue = ns('defaultValue');\nconst order = ns('order');\nconst group = ns('group');\nconst closed = ns('closed');\nconst ignoredProperties = ns('ignoredProperties');\n\nconst alternativePath = ns('alternativePath');\nconst inversePath = ns('inversePath');\nconst zeroOrMorePath = ns('zeroOrMorePath');\nconst oneOrMorePath = ns('oneOrMorePath');\nconst zeroOrOnePath = ns('zeroOrOnePath');\n\nconst BlankNode = ns('BlankNode');\nconst IRI = ns('IRI');\nconst Literal = ns('Literal');\nconst BlankNodeOrIRI = ns('BlankNodeOrIRI');\nconst BlankNodeOrLiteral = ns('BlankNodeOrLiteral');\nconst IRIOrLiteral = ns('IRIOrLiteral');\n\nexport const languageIn = ns('languageIn');\nexport const lessThan = ns('lessThan');\nexport const lessThanOrEquals = ns('lessThanOrEquals');\nexport const maxExclusive = ns('maxExclusive');\nexport const maxInclusive = ns('maxInclusive');\nexport const maxLength = ns('maxLength');\nexport const minExclusive = ns('minExclusive');\nexport const minInclusive = ns('minInclusive');\nexport const minLength = ns('minLength');\nexport const pattern = ns('pattern');\nexport const uniqueLang = ns('uniqueLang');\nexport const ValidationReport = ns('ValidationReport');\nexport const conforms = ns('conforms');\nexport const ValidationResult = ns('ValidationResult');\nexport const focusNode = ns('focusNode');\nexport const sourceShape = ns('sourceShape');\nexport const resultSeverity = ns('resultSeverity');\nexport const resultPath = ns('resultPath');\nexport const value = ns('value');\n/** `sh:message` — a custom message declared on a shape or constraint. */\nexport const message = ns('message');\n/** `sh:resultMessage` — the message carried by a validation result. */\nexport const resultMessage = ns('resultMessage');\n/** `sh:detail` — links a validation result to the results that explain it. */\nexport const detail = ns('detail');\nexport const Violation = ns('Violation');\nexport const AbstractResult = ns('AbstractResult');\nexport const sourceConstraintComponent = ns('sourceConstraintComponent');\nexport const ClassConstraintComponent = ns('ClassConstraintComponent');\nexport const NodeConstraintComponent = ns('NodeConstraintComponent');\nexport const DatatypeConstraintComponent = ns('DatatypeConstraintComponent');\nexport const MinLengthConstraintComponent = ns('MinLengthConstraintComponent');\nexport const MaxLengthConstraintComponent = ns('MaxLengthConstraintComponent');\nexport const MinInclusiveConstraintComponent = ns('MinInclusiveConstraintComponent');\nexport const MaxInclusiveConstraintComponent = ns('MaxInclusiveConstraintComponent');\nexport const MinExclusiveConstraintComponent = ns('MinExclusiveConstraintComponent');\nexport const MaxExclusiveConstraintComponent = ns('MaxExclusiveConstraintComponent');\nexport const PatternConstraintComponent = ns('PatternConstraintComponent');\nexport const InConstraintComponent = ns('InConstraintComponent');\nexport const MinCountConstraintComponent = ns('MinCountConstraintComponent');\nexport const MaxCountConstraintComponent = ns('MaxCountConstraintComponent');\nexport const NodeKindConstraintComponent = ns('NodeKindConstraintComponent');\nexport const ClosedConstraintComponent = ns('ClosedConstraintComponent');\nexport const Warning = ns('Warning');\nexport const Info = ns('Info');\nexport const result = ns('result');\n\n//make sure every node is also exported here\nexport const shacl = {\n class: _class,\n datatype,\n declare,\n in: _in,\n maxCount,\n minCount,\n name,\n description,\n node,\n NodeShape,\n optional,\n Parameter,\n PrefixDeclaration,\n path,\n prefix,\n property,\n PropertyShape,\n Shape,\n targetClass,\n targetNode,\n targetObjectsOf,\n BlankNode,\n IRI,\n Literal,\n BlankNodeOrIRI,\n BlankNodeOrLiteral,\n IRIOrLiteral,\n nodeKind,\n inList,\n equals,\n disjoint,\n hasValue,\n defaultValue,\n order,\n group,\n closed,\n ignoredProperties,\n languageIn,\n lessThan,\n lessThanOrEquals,\n maxExclusive,\n maxInclusive,\n maxLength,\n minExclusive,\n minInclusive,\n minLength,\n pattern,\n uniqueLang,\n ValidationReport,\n conforms,\n ValidationResult,\n focusNode,\n sourceShape,\n resultSeverity,\n resultPath,\n value,\n message,\n resultMessage,\n detail,\n Violation,\n sourceConstraintComponent,\n ClassConstraintComponent,\n NodeConstraintComponent,\n DatatypeConstraintComponent,\n MinLengthConstraintComponent,\n MaxLengthConstraintComponent,\n MinCountConstraintComponent,\n MaxCountConstraintComponent,\n MinInclusiveConstraintComponent,\n MaxInclusiveConstraintComponent,\n MinExclusiveConstraintComponent,\n MaxExclusiveConstraintComponent,\n PatternConstraintComponent,\n InConstraintComponent,\n NodeKindConstraintComponent,\n ClosedConstraintComponent,\n Warning,\n Info,\n AbstractResult,\n result,\n alternativePath,\n inversePath,\n zeroOrMorePath,\n oneOrMorePath,\n zeroOrOnePath,\n};\n"]}
|
|
@@ -84,7 +84,7 @@ const toFieldUpdate = (field, collector) => {
|
|
|
84
84
|
};
|
|
85
85
|
};
|
|
86
86
|
const toNodeData = (description, collector) => {
|
|
87
|
-
return Object.assign({ shape: description.shape.id, fields: description.fields.map((f) => toFieldUpdate(f, collector)) }, (description.__id ? { id: description.__id } : {}));
|
|
87
|
+
return Object.assign(Object.assign({ shape: description.shape.id, fields: description.fields.map((f) => toFieldUpdate(f, collector)) }, (description.__id ? { id: description.__id } : {})), (description.__blank ? { blank: true } : {}));
|
|
88
88
|
};
|
|
89
89
|
/** Builds an IRCreateMutation from a create factory's internal description. */
|
|
90
90
|
export const buildCanonicalCreateMutationIR = (query) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IRMutation.js","sourceRoot":"","sources":["../../../src/queries/IRMutation.ts"],"names":[],"mappings":"AACA,OAAO,EAML,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAC,gBAAgB,EAAE,qBAAqB,EAAC,MAAM,kCAAkC,CAAC;AAiBzF,OAAO,EAAC,uBAAuB,EAAC,MAAM,cAAc,CAAC;AAmBrD;;;GAGG;AACH,MAAM,wBAAwB,GAAG,CAC/B,OAA6B,EAC7B,OAAe,EACT,EAAE;;IACR,KAAK,MAAM,KAAK,IAAI,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,mCAAI,EAAE,EAAE,CAAC;QAC1C,iFAAiF;QACjF,4CAA4C;QAC5C,IAAI,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CACb,+DAA+D,KAAK,CAAC,IAAI,CAAC,EAAE,QAAQ,OAAO,KAAK;gBAC9F,6FAA6F;gBAC7F,4EAA4E;gBAC5E,mDAAmD,CACtD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AC,aAAa;KACnC,CAAC;AACJ,CAAC,CAAC;AASF,sFAAsF;AACtF,MAAM,CAAC,MAAM,mCAAmC,GAAG,CACjD,KAA+B,EACR,EAAE;IACzB,MAAM,SAAS,GAAG,wBAAwB,EAAE,CAAC;IAC7C,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAClD,uBACE,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,EACrB,IAAI,EACJ,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,aAAa,EAAE,KAAK,CAAC,aAAa,IAC/B,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC;QAC/B,CAAC,CAAC,EAAC,iBAAiB,EAAE,SAAS,CAAC,QAAQ,EAAC;QACzC,CAAC,CAAC,EAAE,CAAC,EACP;AACJ,CAAC,CAAC","sourcesContent":["import type {NodeShapeData} from '../shapes/SHACL.js';\nimport {\n type NodeDescriptionValue,\n NodeReferenceValue,\n type PropUpdateValue,\n type SetModificationValue,\n type SinglePropertyUpdateValue,\n isSetModificationValue,\n} from './QueryFactory.js';\nimport {isExpressionNode, resolveExpressionRefs} from '../expressions/ExpressionNode.js';\nimport type {\n IRCreateMutation,\n IRDeleteMutation,\n IRDeleteAllMutation,\n IRDeleteWhereMutation,\n IRUpdateWhereMutation,\n IRFieldValue,\n IRNodeData,\n IRFieldUpdate,\n IRSetModificationValue,\n IRUpdateMutation,\n IRUpsertMutation,\n IRExpression,\n IRGraphPattern,\n IRTraversalPattern,\n} from './IntermediateRepresentation.js';\nimport {createTraversalResolver} from './IRLower.js';\n\ntype CreateMutationInput = {\n shape: NodeShapeData;\n description: NodeDescriptionValue;\n};\n\ntype UpdateMutationInput = {\n id: string;\n shape: NodeShapeData;\n updates: NodeDescriptionValue;\n};\n\ntype UpsertMutationInput = {\n id: string;\n shape: NodeShapeData;\n updates: NodeDescriptionValue;\n};\n\n/**\n * Throws if any field of an upsert carries an expression. Named per offending property so\n * the caller is not left decoding an unbound-variable mystery further down the pipeline.\n */\nconst assertNoExpressionFields = (\n updates: NodeDescriptionValue,\n shapeId: string,\n): void => {\n for (const field of updates?.fields ?? []) {\n // Mirrors how `toSingleFieldValue` recognises an expression, so the guard cannot\n // drift from the lowering it is protecting.\n if (isExpressionNode(field.val)) {\n throw new Error(\n `upsert does not support expression-valued fields (property \"${field.prop.id}\" of ${shapeId}). ` +\n `An expression reads the node's current value, which does not exist when upsert creates it, ` +\n `and the property would be silently skipped. Pass a concrete value, or use ` +\n `update().for({id}) if the node is known to exist.`,\n );\n }\n }\n};\n\ntype DeleteMutationInput = {\n shape: NodeShapeData;\n ids: NodeReferenceValue[];\n};\n\nconst toNodeReference = (value: NodeReferenceValue): NodeReferenceValue => ({\n id: value.id,\n});\n\nconst toSetModification = (value: SetModificationValue): IRSetModificationValue => {\n return {\n add: value.$add\n ? value.$add.map((item) => toFieldValue(item as unknown as PropUpdateValue))\n : undefined,\n remove: value.$remove ? value.$remove.map((item) => toNodeReference(item)) : undefined,\n };\n};\n\n/** Alias used as the mutation subject for expression ref resolution. */\nconst MUTATION_SUBJECT_ALIAS = '__mutation_subject__';\n\nexport type TraversalCollector = {\n resolve: (fromAlias: string, propertyShapeId: string) => string;\n patterns: IRTraversalPattern[];\n};\n\n/**\n * Create a traversal collector for mutation expressions. Uses `__trav_N__` alias\n * prefixes to avoid collision with query aliases (a0, a1...) and the mutation\n * subject placeholder. Delegates to the shared createTraversalResolver factory.\n */\nexport function createTraversalCollector(): TraversalCollector {\n let counter = 0;\n return createTraversalResolver(\n () => `__trav_${counter++}__`,\n (from, to, property): IRTraversalPattern => ({from, property, to}),\n );\n}\n\nconst toSingleFieldValue = (\n value: SinglePropertyUpdateValue,\n collector?: TraversalCollector,\n): IRFieldValue => {\n if (value === undefined) {\n return undefined;\n }\n\n // ExpressionNode → resolve refs and extract IRExpression\n if (isExpressionNode(value)) {\n return resolveExpressionRefs(\n value.ir,\n value._refs,\n MUTATION_SUBJECT_ALIAS,\n // In mutation context, all property segments are on the subject entity.\n // For single-segment refs (e.g. p.age), the property_expr already has the property as its .property.\n // For multi-segment refs (e.g. p.bestFriend.name), this creates intermediate traversals.\n collector\n ? collector.resolve\n : (_fromAlias, _propertyShapeId) => {\n // No collector provided — multi-segment traversals cannot be resolved.\n return MUTATION_SUBJECT_ALIAS;\n },\n );\n }\n\n if (\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean' ||\n value instanceof Date\n ) {\n return value;\n }\n\n if ('id' in (value as NodeReferenceValue)) {\n return toNodeReference(value as NodeReferenceValue);\n }\n\n return toNodeData(value as NodeDescriptionValue);\n};\n\nconst toFieldValue = (\n value: PropUpdateValue,\n collector?: TraversalCollector,\n): IRFieldValue => {\n if (Array.isArray(value)) {\n return value.map((item) => toSingleFieldValue(item, collector));\n }\n\n if (isSetModificationValue(value)) {\n return toSetModification(value);\n }\n\n return toSingleFieldValue(value, collector);\n};\n\nconst toFieldUpdate = (\n field: NodeDescriptionValue['fields'][number],\n collector?: TraversalCollector,\n): IRFieldUpdate => {\n return {\n property: field.prop.id,\n value: toFieldValue(field.val, collector),\n };\n};\n\nconst toNodeData = (\n description: NodeDescriptionValue,\n collector?: TraversalCollector,\n): IRNodeData => {\n return {\n shape: description.shape.id,\n fields: description.fields.map((f) => toFieldUpdate(f, collector)),\n ...(description.__id ? {id: description.__id} : {}),\n };\n};\n\n/** Builds an IRCreateMutation from a create factory's internal description. */\nexport const buildCanonicalCreateMutationIR = (\n query: CreateMutationInput,\n): IRCreateMutation => {\n return {\n kind: 'create',\n shape: query.shape.id,\n data: toNodeData(query.description),\n };\n};\n\n/** Builds an IRUpdateMutation from an update factory's internal description. */\nexport const buildCanonicalUpdateMutationIR = (\n query: UpdateMutationInput,\n): IRUpdateMutation => {\n const collector = createTraversalCollector();\n const data = toNodeData(query.updates, collector);\n return {\n kind: 'update',\n shape: query.shape.id,\n id: query.id,\n data,\n ...(collector.patterns.length > 0\n ? {traversalPatterns: collector.patterns}\n : {}),\n };\n};\n\n/**\n * Builds an IRUpsertMutation — an update that also asserts the node's type, so it is\n * correct whether or not the node exists.\n *\n * Rejects expression-valued fields. An expression such as `age: p.age.plus(1)` lowers to\n * a BIND over the node's current value; when the node does not exist that ref is unbound,\n * and SPARQL drops any INSERT triple containing an unbound variable. The write would\n * report success and store nothing for that property — precisely the silent-wrong-write\n * this primitive exists to remove, so it is refused rather than documented.\n */\nexport const buildCanonicalUpsertMutationIR = (\n query: UpsertMutationInput,\n): IRUpsertMutation => {\n assertNoExpressionFields(query.updates, query.shape.id);\n const collector = createTraversalCollector();\n const data = toNodeData(query.updates, collector);\n return {\n kind: 'upsert',\n shape: query.shape.id,\n id: query.id,\n data,\n ...(collector.patterns.length > 0\n ? {traversalPatterns: collector.patterns}\n : {}),\n };\n};\n\n/** Builds an IRDeleteMutation from a delete factory's internal description. */\nexport const buildCanonicalDeleteMutationIR = (\n query: DeleteMutationInput,\n): IRDeleteMutation => {\n return {\n kind: 'delete',\n shape: query.shape.id,\n ids: query.ids.map((id) => ({id: id.id})),\n };\n};\n\ntype DeleteAllMutationInput = {\n shape: NodeShapeData;\n};\n\n/** Builds an IRDeleteAllMutation — delete all instances of a shape type. */\nexport const buildCanonicalDeleteAllMutationIR = (\n query: DeleteAllMutationInput,\n): IRDeleteAllMutation => {\n return {\n kind: 'delete_all',\n shape: query.shape.id,\n };\n};\n\ntype DeleteWhereMutationInput = {\n shape: NodeShapeData;\n where: IRExpression;\n wherePatterns: IRGraphPattern[];\n};\n\n/** Builds an IRDeleteWhereMutation — delete instances matching a condition. */\nexport const buildCanonicalDeleteWhereMutationIR = (\n query: DeleteWhereMutationInput,\n): IRDeleteWhereMutation => {\n return {\n kind: 'delete_where',\n shape: query.shape.id,\n where: query.where,\n wherePatterns: query.wherePatterns,\n };\n};\n\ntype UpdateWhereMutationInput = {\n shape: NodeShapeData;\n updates: NodeDescriptionValue;\n where?: IRExpression;\n wherePatterns?: IRGraphPattern[];\n};\n\n/** Builds an IRUpdateWhereMutation — update instances matching a condition or all. */\nexport const buildCanonicalUpdateWhereMutationIR = (\n query: UpdateWhereMutationInput,\n): IRUpdateWhereMutation => {\n const collector = createTraversalCollector();\n const data = toNodeData(query.updates, collector);\n return {\n kind: 'update_where',\n shape: query.shape.id,\n data,\n where: query.where,\n wherePatterns: query.wherePatterns,\n ...(collector.patterns.length > 0\n ? {traversalPatterns: collector.patterns}\n : {}),\n };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"IRMutation.js","sourceRoot":"","sources":["../../../src/queries/IRMutation.ts"],"names":[],"mappings":"AACA,OAAO,EAML,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAC,gBAAgB,EAAE,qBAAqB,EAAC,MAAM,kCAAkC,CAAC;AAiBzF,OAAO,EAAC,uBAAuB,EAAC,MAAM,cAAc,CAAC;AAmBrD;;;GAGG;AACH,MAAM,wBAAwB,GAAG,CAC/B,OAA6B,EAC7B,OAAe,EACT,EAAE;;IACR,KAAK,MAAM,KAAK,IAAI,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,mCAAI,EAAE,EAAE,CAAC;QAC1C,iFAAiF;QACjF,4CAA4C;QAC5C,IAAI,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CACb,+DAA+D,KAAK,CAAC,IAAI,CAAC,EAAE,QAAQ,OAAO,KAAK;gBAC9F,6FAA6F;gBAC7F,4EAA4E;gBAC5E,mDAAmD,CACtD,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAOF,MAAM,eAAe,GAAG,CAAC,KAAyB,EAAsB,EAAE,CAAC,CAAC;IAC1E,EAAE,EAAE,KAAK,CAAC,EAAE;CACb,CAAC,CAAC;AAEH,MAAM,iBAAiB,GAAG,CAAC,KAA2B,EAA0B,EAAE;IAChF,OAAO;QACL,GAAG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AS,GAAG,wBAAwB,EAAE,CAAC;IAC7C,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAClD,uBACE,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,EACrB,IAAI,EACJ,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,aAAa,EAAE,KAAK,CAAC,aAAa,IAC/B,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC;QAC/B,CAAC,CAAC,EAAC,iBAAiB,EAAE,SAAS,CAAC,QAAQ,EAAC;QACzC,CAAC,CAAC,EAAE,CAAC,EACP;AACJ,CAAC,CAAC","sourcesContent":["import type {NodeShapeData} from '../shapes/SHACL.js';\nimport {\n type NodeDescriptionValue,\n NodeReferenceValue,\n type PropUpdateValue,\n type SetModificationValue,\n type SinglePropertyUpdateValue,\n isSetModificationValue,\n} from './QueryFactory.js';\nimport {isExpressionNode, resolveExpressionRefs} from '../expressions/ExpressionNode.js';\nimport type {\n IRCreateMutation,\n IRDeleteMutation,\n IRDeleteAllMutation,\n IRDeleteWhereMutation,\n IRUpdateWhereMutation,\n IRFieldValue,\n IRNodeData,\n IRFieldUpdate,\n IRSetModificationValue,\n IRUpdateMutation,\n IRUpsertMutation,\n IRExpression,\n IRGraphPattern,\n IRTraversalPattern,\n} from './IntermediateRepresentation.js';\nimport {createTraversalResolver} from './IRLower.js';\n\ntype CreateMutationInput = {\n shape: NodeShapeData;\n description: NodeDescriptionValue;\n};\n\ntype UpdateMutationInput = {\n id: string;\n shape: NodeShapeData;\n updates: NodeDescriptionValue;\n};\n\ntype UpsertMutationInput = {\n id: string;\n shape: NodeShapeData;\n updates: NodeDescriptionValue;\n};\n\n/**\n * Throws if any field of an upsert carries an expression. Named per offending property so\n * the caller is not left decoding an unbound-variable mystery further down the pipeline.\n */\nconst assertNoExpressionFields = (\n updates: NodeDescriptionValue,\n shapeId: string,\n): void => {\n for (const field of updates?.fields ?? []) {\n // Mirrors how `toSingleFieldValue` recognises an expression, so the guard cannot\n // drift from the lowering it is protecting.\n if (isExpressionNode(field.val)) {\n throw new Error(\n `upsert does not support expression-valued fields (property \"${field.prop.id}\" of ${shapeId}). ` +\n `An expression reads the node's current value, which does not exist when upsert creates it, ` +\n `and the property would be silently skipped. Pass a concrete value, or use ` +\n `update().for({id}) if the node is known to exist.`,\n );\n }\n }\n};\n\ntype DeleteMutationInput = {\n shape: NodeShapeData;\n ids: NodeReferenceValue[];\n};\n\nconst toNodeReference = (value: NodeReferenceValue): NodeReferenceValue => ({\n id: value.id,\n});\n\nconst toSetModification = (value: SetModificationValue): IRSetModificationValue => {\n return {\n add: value.$add\n ? value.$add.map((item) => toFieldValue(item as unknown as PropUpdateValue))\n : undefined,\n remove: value.$remove ? value.$remove.map((item) => toNodeReference(item)) : undefined,\n };\n};\n\n/** Alias used as the mutation subject for expression ref resolution. */\nconst MUTATION_SUBJECT_ALIAS = '__mutation_subject__';\n\nexport type TraversalCollector = {\n resolve: (fromAlias: string, propertyShapeId: string) => string;\n patterns: IRTraversalPattern[];\n};\n\n/**\n * Create a traversal collector for mutation expressions. Uses `__trav_N__` alias\n * prefixes to avoid collision with query aliases (a0, a1...) and the mutation\n * subject placeholder. Delegates to the shared createTraversalResolver factory.\n */\nexport function createTraversalCollector(): TraversalCollector {\n let counter = 0;\n return createTraversalResolver(\n () => `__trav_${counter++}__`,\n (from, to, property): IRTraversalPattern => ({from, property, to}),\n );\n}\n\nconst toSingleFieldValue = (\n value: SinglePropertyUpdateValue,\n collector?: TraversalCollector,\n): IRFieldValue => {\n if (value === undefined) {\n return undefined;\n }\n\n // ExpressionNode → resolve refs and extract IRExpression\n if (isExpressionNode(value)) {\n return resolveExpressionRefs(\n value.ir,\n value._refs,\n MUTATION_SUBJECT_ALIAS,\n // In mutation context, all property segments are on the subject entity.\n // For single-segment refs (e.g. p.age), the property_expr already has the property as its .property.\n // For multi-segment refs (e.g. p.bestFriend.name), this creates intermediate traversals.\n collector\n ? collector.resolve\n : (_fromAlias, _propertyShapeId) => {\n // No collector provided — multi-segment traversals cannot be resolved.\n return MUTATION_SUBJECT_ALIAS;\n },\n );\n }\n\n if (\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean' ||\n value instanceof Date\n ) {\n return value;\n }\n\n if ('id' in (value as NodeReferenceValue)) {\n return toNodeReference(value as NodeReferenceValue);\n }\n\n return toNodeData(value as NodeDescriptionValue);\n};\n\nconst toFieldValue = (\n value: PropUpdateValue,\n collector?: TraversalCollector,\n): IRFieldValue => {\n if (Array.isArray(value)) {\n return value.map((item) => toSingleFieldValue(item, collector));\n }\n\n if (isSetModificationValue(value)) {\n return toSetModification(value);\n }\n\n return toSingleFieldValue(value, collector);\n};\n\nconst toFieldUpdate = (\n field: NodeDescriptionValue['fields'][number],\n collector?: TraversalCollector,\n): IRFieldUpdate => {\n return {\n property: field.prop.id,\n value: toFieldValue(field.val, collector),\n };\n};\n\nconst toNodeData = (\n description: NodeDescriptionValue,\n collector?: TraversalCollector,\n): IRNodeData => {\n return {\n shape: description.shape.id,\n fields: description.fields.map((f) => toFieldUpdate(f, collector)),\n ...(description.__id ? {id: description.__id} : {}),\n ...(description.__blank ? {blank: true as const} : {}),\n };\n};\n\n/** Builds an IRCreateMutation from a create factory's internal description. */\nexport const buildCanonicalCreateMutationIR = (\n query: CreateMutationInput,\n): IRCreateMutation => {\n return {\n kind: 'create',\n shape: query.shape.id,\n data: toNodeData(query.description),\n };\n};\n\n/** Builds an IRUpdateMutation from an update factory's internal description. */\nexport const buildCanonicalUpdateMutationIR = (\n query: UpdateMutationInput,\n): IRUpdateMutation => {\n const collector = createTraversalCollector();\n const data = toNodeData(query.updates, collector);\n return {\n kind: 'update',\n shape: query.shape.id,\n id: query.id,\n data,\n ...(collector.patterns.length > 0\n ? {traversalPatterns: collector.patterns}\n : {}),\n };\n};\n\n/**\n * Builds an IRUpsertMutation — an update that also asserts the node's type, so it is\n * correct whether or not the node exists.\n *\n * Rejects expression-valued fields. An expression such as `age: p.age.plus(1)` lowers to\n * a BIND over the node's current value; when the node does not exist that ref is unbound,\n * and SPARQL drops any INSERT triple containing an unbound variable. The write would\n * report success and store nothing for that property — precisely the silent-wrong-write\n * this primitive exists to remove, so it is refused rather than documented.\n */\nexport const buildCanonicalUpsertMutationIR = (\n query: UpsertMutationInput,\n): IRUpsertMutation => {\n assertNoExpressionFields(query.updates, query.shape.id);\n const collector = createTraversalCollector();\n const data = toNodeData(query.updates, collector);\n return {\n kind: 'upsert',\n shape: query.shape.id,\n id: query.id,\n data,\n ...(collector.patterns.length > 0\n ? {traversalPatterns: collector.patterns}\n : {}),\n };\n};\n\n/** Builds an IRDeleteMutation from a delete factory's internal description. */\nexport const buildCanonicalDeleteMutationIR = (\n query: DeleteMutationInput,\n): IRDeleteMutation => {\n return {\n kind: 'delete',\n shape: query.shape.id,\n ids: query.ids.map((id) => ({id: id.id})),\n };\n};\n\ntype DeleteAllMutationInput = {\n shape: NodeShapeData;\n};\n\n/** Builds an IRDeleteAllMutation — delete all instances of a shape type. */\nexport const buildCanonicalDeleteAllMutationIR = (\n query: DeleteAllMutationInput,\n): IRDeleteAllMutation => {\n return {\n kind: 'delete_all',\n shape: query.shape.id,\n };\n};\n\ntype DeleteWhereMutationInput = {\n shape: NodeShapeData;\n where: IRExpression;\n wherePatterns: IRGraphPattern[];\n};\n\n/** Builds an IRDeleteWhereMutation — delete instances matching a condition. */\nexport const buildCanonicalDeleteWhereMutationIR = (\n query: DeleteWhereMutationInput,\n): IRDeleteWhereMutation => {\n return {\n kind: 'delete_where',\n shape: query.shape.id,\n where: query.where,\n wherePatterns: query.wherePatterns,\n };\n};\n\ntype UpdateWhereMutationInput = {\n shape: NodeShapeData;\n updates: NodeDescriptionValue;\n where?: IRExpression;\n wherePatterns?: IRGraphPattern[];\n};\n\n/** Builds an IRUpdateWhereMutation — update instances matching a condition or all. */\nexport const buildCanonicalUpdateWhereMutationIR = (\n query: UpdateWhereMutationInput,\n): IRUpdateWhereMutation => {\n const collector = createTraversalCollector();\n const data = toNodeData(query.updates, collector);\n return {\n kind: 'update_where',\n shape: query.shape.id,\n data,\n where: query.where,\n wherePatterns: query.wherePatterns,\n ...(collector.patterns.length > 0\n ? {traversalPatterns: collector.patterns}\n : {}),\n };\n};\n"]}
|
|
@@ -280,6 +280,11 @@ export type IRNodeData = {
|
|
|
280
280
|
shape: string;
|
|
281
281
|
fields: IRFieldUpdate[];
|
|
282
282
|
id?: string;
|
|
283
|
+
/**
|
|
284
|
+
* A nested node written as a fresh blank node with only its field triples: no IRI, no
|
|
285
|
+
* `rdf:type` (see `NodeDescriptionValue.__blank`). Never set together with `id`.
|
|
286
|
+
*/
|
|
287
|
+
blank?: true;
|
|
283
288
|
};
|
|
284
289
|
export type IRFieldUpdate = {
|
|
285
290
|
property: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntermediateRepresentation.js","sourceRoot":"","sources":["../../../src/queries/IntermediateRepresentation.ts"],"names":[],"mappings":"","sourcesContent":["import {NodeReferenceValue} from './QueryFactory.js';\nimport type {PathExpr} from '../paths/PropertyPathExpr.js';\n\nexport type IRDirection = 'ASC' | 'DESC';\nexport type IRAlias = string;\n\nexport type IRValue = string | number | boolean | null;\n\nexport type IRQuery =\n | IRSelectQuery\n | IRAskQuery\n | IRCountQuery\n | IRCreateMutation\n | IRUpdateMutation\n | IRUpsertMutation\n | IRDeleteMutation\n | IRDeleteAllMutation\n | IRDeleteWhereMutation\n | IRUpdateWhereMutation;\n\nexport type IRSelectQuery = {\n kind: 'select';\n root: IRShapeScanPattern;\n patterns: IRGraphPattern[];\n projection: IRProjectionItem[];\n where?: IRExpression;\n orderBy?: IROrderByItem[];\n limit?: number;\n offset?: number;\n subjectId?: string;\n subjectIds?: string[];\n singleResult?: boolean;\n resultMap?: IRResultMapEntry[];\n};\n\n/**\n * A query whose answer is a boolean.\n *\n * Carries a pattern and nothing else. There is no `projection`, `orderBy`,\n * `limit` or `offset`: each of those shapes or windows a *solution sequence*, and\n * an ask has none — so rather than being ignored during conversion, or guarded\n * against, they are unrepresentable.\n *\n * `root` is **optional**. Absent means no `rdf:type` constraint at all — \"does a\n * node with this IRI exist\", under any shape or none — which lowers to\n * `ASK { <iri> ?p ?o }`. A rootless ask carries no `patterns` or `where`, since\n * both reference properties and a property is only resolvable through a shape.\n */\nexport type IRAskQuery = {\n kind: 'ask';\n root?: IRShapeScanPattern;\n patterns: IRGraphPattern[];\n where?: IRExpression;\n subjectId?: string;\n subjectIds?: string[];\n};\n\n/**\n * A query whose answer is a single number: how many instances of a shape match.\n *\n * Like {@link IRAskQuery}, it carries a **pattern and nothing else**. There is no\n * `projection`, `orderBy`, `limit` or `offset`: each of those shapes or windows a\n * *solution sequence*, and a count has none — the number it answers is a property\n * of the whole match set. So rather than being ignored during conversion, or\n * guarded against, they are unrepresentable.\n *\n * That is the entire reason this is a distinct IR kind and not a flag on\n * {@link IRSelectQuery}: a count of a windowed query is meaningless, and a type\n * that cannot hold the window cannot half-drop it.\n *\n * `root` is **required**, unlike an ask's. A shapeless count would count every\n * node in the store, which is never what a caller means.\n */\nexport type IRCountQuery = {\n kind: 'count';\n root: IRShapeScanPattern;\n patterns: IRGraphPattern[];\n where?: IRExpression;\n subjectId?: string;\n subjectIds?: string[];\n /**\n * The variable the `COUNT` is bound to (`(COUNT(DISTINCT ?a0) AS ?count)`).\n * Carried in the IR rather than hardcoded in two places so lowering and result\n * mapping cannot disagree about it.\n */\n alias: IRAlias;\n};\n\nexport type IRProjectionItem = {\n alias: IRAlias;\n expression: IRExpression;\n};\n\nexport type IROrderByItem = {\n expression: IRExpression;\n direction: IRDirection;\n};\n\nexport type IRResultMapEntry = {\n key: string;\n alias: IRAlias;\n};\n\nexport type IRGraphPattern =\n | IRShapeScanPattern\n | IRTraversePattern\n | IRJoinPattern\n | IROptionalPattern\n | IRUnionPattern\n | IRExistsPattern\n | IRMinusPattern;\n\nexport type IRShapeScanPattern = {\n kind: 'shape_scan';\n shape: string;\n alias: IRAlias;\n};\n\nexport type IRTraversePattern = {\n kind: 'traverse';\n from: IRAlias;\n to: IRAlias;\n property: string;\n pathExpr?: PathExpr;\n filter?: IRExpression;\n maxCount?: number;\n /**\n * Inner LIMIT/OFFSET/ORDER BY for a nested select on this traversal's\n * related collection. When set, the root→child traverse is wrapped in a\n * SPARQL sub-SELECT to bound the collection per parent. Only valid when the\n * outer query targets a single root subject (enforced in irToAlgebra).\n */\n innerLimit?: number;\n innerOffset?: number;\n innerOrderBy?: IRInnerOrderBy[];\n};\n\nexport type IRInnerOrderBy = {\n property: string;\n direction: IRDirection;\n};\n\nexport type IRJoinPattern = {\n kind: 'join';\n patterns: IRGraphPattern[];\n};\n\nexport type IROptionalPattern = {\n kind: 'optional';\n pattern: IRGraphPattern;\n};\n\nexport type IRUnionPattern = {\n kind: 'union';\n branches: IRGraphPattern[];\n};\n\nexport type IRExistsPattern = {\n kind: 'exists';\n pattern: IRGraphPattern;\n};\n\nexport type IRMinusPattern = {\n kind: 'minus';\n pattern: IRGraphPattern;\n filter?: IRExpression;\n};\n\nexport type IRExpression =\n | IRLiteralExpression\n | IRReferenceExpression\n | IRAliasExpression\n | IRPropertyExpression\n | IRContextPropertyExpression\n | IRBinaryExpression\n | IRLogicalExpression\n | IRNotExpression\n | IRFunctionExpression\n | IRAggregateExpression\n | IRExistsExpression\n | IRInExpression;\n\n/**\n * Membership test — `value IN (…)` / `NOT IN (…)`.\n * `source` is forward-shaped: today only the explicit-`list` arm exists (Rung 1);\n * a `{query}` arm (Rung 2 — membership against a subquery, lowering to EXISTS)\n * can be added without changing the node's identity or the `oneOf`/`notOneOf` DSL.\n */\nexport type IRInExpression = {\n kind: 'in_expr';\n negated: boolean;\n value: IRExpression;\n source: {list: IRExpression[]};\n};\n\nexport type IRLiteralExpression = {\n kind: 'literal_expr';\n /**\n * `Date` is admitted alongside `IRValue`: a temporal comparison has to reach the\n * SPARQL layer still knowing it is temporal, or the literal is emitted untyped\n * and never equals the `^^xsd:dateTime` term the mutation side writes.\n */\n value: IRValue | Date;\n};\n\nexport type IRReferenceExpression = {\n kind: 'reference_expr';\n /** The referenced node IRI. Optional only while a `contextName` is unresolved. */\n value?: string;\n /**\n * A query-context reference (`{@ctx}` on the wire). When set, `value` is filled\n * by `lower()` from the live context map — resolved or thrown there, never baked\n * at build time. Absent for a plain node reference.\n */\n contextName?: string;\n};\n\nexport type IRAliasExpression = {\n kind: 'alias_expr';\n alias: IRAlias;\n};\n\nexport type IRPropertyExpression = {\n kind: 'property_expr';\n sourceAlias: IRAlias;\n property: string;\n pathExpr?: import('../paths/PropertyPathExpr.js').PathExpr;\n maxCount?: number;\n};\n\nexport type IRContextPropertyExpression = {\n kind: 'context_property_expr';\n /** The context entity IRI. Optional only while a `contextName` is unresolved. */\n contextIri?: string;\n /** A query-context reference resolved into `contextIri` by `lower()`. */\n contextName?: string;\n property: string;\n};\n\nexport type IRBinaryOperator =\n | '='\n | '!='\n | '>'\n | '>='\n | '<'\n | '<='\n | '+'\n | '-'\n | '*'\n | '/';\n\nexport type IRBinaryExpression = {\n kind: 'binary_expr';\n operator: IRBinaryOperator;\n left: IRExpression;\n right: IRExpression;\n};\n\nexport type IRLogicalOperator = 'and' | 'or';\n\nexport type IRLogicalExpression = {\n kind: 'logical_expr';\n operator: IRLogicalOperator;\n expressions: IRExpression[];\n};\n\nexport type IRNotExpression = {\n kind: 'not_expr';\n expression: IRExpression;\n};\n\nexport type IRFunctionExpression = {\n kind: 'function_expr';\n name: string;\n args: IRExpression[];\n};\n\nexport type IRAggregateExpression = {\n kind: 'aggregate_expr';\n name: 'count' | 'sum' | 'avg' | 'min' | 'max';\n args: IRExpression[];\n};\n\nexport type IRExistsExpression = {\n kind: 'exists_expr';\n pattern: IRGraphPattern;\n filter?: IRExpression;\n};\n\nexport type IRCreateMutation = {\n kind: 'create';\n shape: string;\n data: IRNodeData;\n};\n\nexport type IRTraversalPattern = {\n from: string; // source alias\n property: string; // property IRI\n to: string; // target alias\n};\n\nexport type IRUpdateMutation = {\n kind: 'update';\n shape: string;\n id: string;\n data: IRNodeData;\n traversalPatterns?: IRTraversalPattern[];\n};\n\n/**\n * Create-or-replace against a known id, in one request.\n *\n * Structurally identical to {@link IRUpdateMutation} — it lowers through the same\n * DELETE/INSERT/WHERE body — and differs in exactly one emitted triple: upsert also\n * asserts `?id rdf:type <targetClass>`, which the update path never writes.\n *\n * That single triple is the whole difference between the two, because `update`'s WHERE\n * is a bare `OPTIONAL` and so already matches when the node is absent. It is a distinct\n * IR kind rather than a flag on the update mutation so that a consumer which does not\n * know about upsert fails loudly, instead of quietly writing an untyped node and\n * reporting success.\n */\nexport type IRUpsertMutation = {\n kind: 'upsert';\n shape: string;\n id: string;\n data: IRNodeData;\n traversalPatterns?: IRTraversalPattern[];\n};\n\nexport type IRDeleteMutation = {\n kind: 'delete';\n shape: string;\n ids: NodeReferenceValue[];\n};\n\nexport type IRDeleteAllMutation = {\n kind: 'delete_all';\n shape: string;\n};\n\nexport type IRDeleteWhereMutation = {\n kind: 'delete_where';\n shape: string;\n where: IRExpression;\n wherePatterns: IRGraphPattern[];\n};\n\nexport type IRUpdateWhereMutation = {\n kind: 'update_where';\n shape: string;\n data: IRNodeData;\n where?: IRExpression;\n wherePatterns?: IRGraphPattern[];\n traversalPatterns?: IRTraversalPattern[];\n};\n\nexport type IRNodeData = {\n shape: string;\n fields: IRFieldUpdate[];\n id?: string;\n};\n\nexport type IRFieldUpdate = {\n property: string;\n value: IRFieldValue;\n};\n\nexport type IRSetModificationValue = {\n add?: IRFieldValue[];\n remove?: NodeReferenceValue[];\n};\n\nexport type IRFieldValue =\n | IRValue\n | Date\n | NodeReferenceValue\n | IRNodeData\n | IRSetModificationValue\n | IRFieldValue[]\n | IRExpression\n | undefined;\n\n// ---------------------------------------------------------------------------\n// Store result types\n// ---------------------------------------------------------------------------\n// These types describe what an IDataset implementation should return.\n// The calling layer (LinkedStorage via queryDispatch) threads the precise\n// DSL-level TypeScript result type back to the caller, so the store\n// only needs to produce data that satisfies these structural contracts.\n// ---------------------------------------------------------------------------\n\n/**\n * A single result row — an object with a node id and dynamic fields.\n * Used in select and create results.\n */\nexport type ResultRow = {id: string; [key: string]: ResultFieldValue};\n\n/**\n * Possible field values in a select or create result row.\n */\nexport type ResultFieldValue =\n | string\n | number\n | boolean\n | Date\n | null\n | undefined\n | ResultRow\n | ResultRow[]\n | string[]\n | number[]\n | boolean[]\n | Date[];\n\n/**\n * What `selectQuery` should return.\n *\n * - Array of rows for multi-result queries (the default).\n * - A single row when `query.singleResult` is true (`.one()` or subject-targeted query).\n * - `null` when `singleResult` is true and the target node doesn't exist.\n */\nexport type SelectResult = ResultRow[] | ResultRow | null;\n\n/**\n * What `createQuery` should return.\n *\n * A single row with the generated `id` and the created field values.\n * Nested creates appear as nested `ResultRow` objects (with their own ids).\n * Array fields (e.g. friends) appear as `ResultRow[]`.\n */\nexport type CreateResult = ResultRow;\n\n/**\n * When a set property is fully overwritten, the result contains `updatedTo`\n * with the new complete set of values.\n */\nexport type SetOverwriteResult = {updatedTo: ResultRow[]};\n\n/**\n * When a set property is incrementally modified with `{add, remove}`,\n * the result contains the added and removed entries.\n */\nexport type SetModificationResult = {added: ResultRow[]; removed: ResultRow[]};\n\n/**\n * Possible field values in an update result row.\n * Extends `ResultFieldValue` with set modification shapes.\n */\nexport type UpdateFieldValue =\n | ResultFieldValue\n | SetOverwriteResult\n | SetModificationResult;\n\n/**\n * What `updateQuery` should return.\n *\n * A single row with the target node's `id` and only the changed fields.\n * Fields not included in the update are omitted (not returned).\n *\n * Field value shapes depend on the type of update:\n * - Literal fields: the new value (string, number, boolean, Date).\n * - Single object fields: a `ResultRow` with the referenced/created node.\n * - Set overwrite (passing an array): `{updatedTo: ResultRow[]}`.\n * - Set add/remove (passing `{add, remove}`): `{added: ResultRow[], removed: ResultRow[]}`.\n * - Unset single field (passing `undefined` or `null`): field is `undefined`.\n * - Unset multi-value field (passing `undefined`): empty array `[]`.\n */\nexport type UpdateResult = {id: string; [key: string]: UpdateFieldValue};\n"]}
|
|
1
|
+
{"version":3,"file":"IntermediateRepresentation.js","sourceRoot":"","sources":["../../../src/queries/IntermediateRepresentation.ts"],"names":[],"mappings":"","sourcesContent":["import {NodeReferenceValue} from './QueryFactory.js';\nimport type {PathExpr} from '../paths/PropertyPathExpr.js';\n\nexport type IRDirection = 'ASC' | 'DESC';\nexport type IRAlias = string;\n\nexport type IRValue = string | number | boolean | null;\n\nexport type IRQuery =\n | IRSelectQuery\n | IRAskQuery\n | IRCountQuery\n | IRCreateMutation\n | IRUpdateMutation\n | IRUpsertMutation\n | IRDeleteMutation\n | IRDeleteAllMutation\n | IRDeleteWhereMutation\n | IRUpdateWhereMutation;\n\nexport type IRSelectQuery = {\n kind: 'select';\n root: IRShapeScanPattern;\n patterns: IRGraphPattern[];\n projection: IRProjectionItem[];\n where?: IRExpression;\n orderBy?: IROrderByItem[];\n limit?: number;\n offset?: number;\n subjectId?: string;\n subjectIds?: string[];\n singleResult?: boolean;\n resultMap?: IRResultMapEntry[];\n};\n\n/**\n * A query whose answer is a boolean.\n *\n * Carries a pattern and nothing else. There is no `projection`, `orderBy`,\n * `limit` or `offset`: each of those shapes or windows a *solution sequence*, and\n * an ask has none — so rather than being ignored during conversion, or guarded\n * against, they are unrepresentable.\n *\n * `root` is **optional**. Absent means no `rdf:type` constraint at all — \"does a\n * node with this IRI exist\", under any shape or none — which lowers to\n * `ASK { <iri> ?p ?o }`. A rootless ask carries no `patterns` or `where`, since\n * both reference properties and a property is only resolvable through a shape.\n */\nexport type IRAskQuery = {\n kind: 'ask';\n root?: IRShapeScanPattern;\n patterns: IRGraphPattern[];\n where?: IRExpression;\n subjectId?: string;\n subjectIds?: string[];\n};\n\n/**\n * A query whose answer is a single number: how many instances of a shape match.\n *\n * Like {@link IRAskQuery}, it carries a **pattern and nothing else**. There is no\n * `projection`, `orderBy`, `limit` or `offset`: each of those shapes or windows a\n * *solution sequence*, and a count has none — the number it answers is a property\n * of the whole match set. So rather than being ignored during conversion, or\n * guarded against, they are unrepresentable.\n *\n * That is the entire reason this is a distinct IR kind and not a flag on\n * {@link IRSelectQuery}: a count of a windowed query is meaningless, and a type\n * that cannot hold the window cannot half-drop it.\n *\n * `root` is **required**, unlike an ask's. A shapeless count would count every\n * node in the store, which is never what a caller means.\n */\nexport type IRCountQuery = {\n kind: 'count';\n root: IRShapeScanPattern;\n patterns: IRGraphPattern[];\n where?: IRExpression;\n subjectId?: string;\n subjectIds?: string[];\n /**\n * The variable the `COUNT` is bound to (`(COUNT(DISTINCT ?a0) AS ?count)`).\n * Carried in the IR rather than hardcoded in two places so lowering and result\n * mapping cannot disagree about it.\n */\n alias: IRAlias;\n};\n\nexport type IRProjectionItem = {\n alias: IRAlias;\n expression: IRExpression;\n};\n\nexport type IROrderByItem = {\n expression: IRExpression;\n direction: IRDirection;\n};\n\nexport type IRResultMapEntry = {\n key: string;\n alias: IRAlias;\n};\n\nexport type IRGraphPattern =\n | IRShapeScanPattern\n | IRTraversePattern\n | IRJoinPattern\n | IROptionalPattern\n | IRUnionPattern\n | IRExistsPattern\n | IRMinusPattern;\n\nexport type IRShapeScanPattern = {\n kind: 'shape_scan';\n shape: string;\n alias: IRAlias;\n};\n\nexport type IRTraversePattern = {\n kind: 'traverse';\n from: IRAlias;\n to: IRAlias;\n property: string;\n pathExpr?: PathExpr;\n filter?: IRExpression;\n maxCount?: number;\n /**\n * Inner LIMIT/OFFSET/ORDER BY for a nested select on this traversal's\n * related collection. When set, the root→child traverse is wrapped in a\n * SPARQL sub-SELECT to bound the collection per parent. Only valid when the\n * outer query targets a single root subject (enforced in irToAlgebra).\n */\n innerLimit?: number;\n innerOffset?: number;\n innerOrderBy?: IRInnerOrderBy[];\n};\n\nexport type IRInnerOrderBy = {\n property: string;\n direction: IRDirection;\n};\n\nexport type IRJoinPattern = {\n kind: 'join';\n patterns: IRGraphPattern[];\n};\n\nexport type IROptionalPattern = {\n kind: 'optional';\n pattern: IRGraphPattern;\n};\n\nexport type IRUnionPattern = {\n kind: 'union';\n branches: IRGraphPattern[];\n};\n\nexport type IRExistsPattern = {\n kind: 'exists';\n pattern: IRGraphPattern;\n};\n\nexport type IRMinusPattern = {\n kind: 'minus';\n pattern: IRGraphPattern;\n filter?: IRExpression;\n};\n\nexport type IRExpression =\n | IRLiteralExpression\n | IRReferenceExpression\n | IRAliasExpression\n | IRPropertyExpression\n | IRContextPropertyExpression\n | IRBinaryExpression\n | IRLogicalExpression\n | IRNotExpression\n | IRFunctionExpression\n | IRAggregateExpression\n | IRExistsExpression\n | IRInExpression;\n\n/**\n * Membership test — `value IN (…)` / `NOT IN (…)`.\n * `source` is forward-shaped: today only the explicit-`list` arm exists (Rung 1);\n * a `{query}` arm (Rung 2 — membership against a subquery, lowering to EXISTS)\n * can be added without changing the node's identity or the `oneOf`/`notOneOf` DSL.\n */\nexport type IRInExpression = {\n kind: 'in_expr';\n negated: boolean;\n value: IRExpression;\n source: {list: IRExpression[]};\n};\n\nexport type IRLiteralExpression = {\n kind: 'literal_expr';\n /**\n * `Date` is admitted alongside `IRValue`: a temporal comparison has to reach the\n * SPARQL layer still knowing it is temporal, or the literal is emitted untyped\n * and never equals the `^^xsd:dateTime` term the mutation side writes.\n */\n value: IRValue | Date;\n};\n\nexport type IRReferenceExpression = {\n kind: 'reference_expr';\n /** The referenced node IRI. Optional only while a `contextName` is unresolved. */\n value?: string;\n /**\n * A query-context reference (`{@ctx}` on the wire). When set, `value` is filled\n * by `lower()` from the live context map — resolved or thrown there, never baked\n * at build time. Absent for a plain node reference.\n */\n contextName?: string;\n};\n\nexport type IRAliasExpression = {\n kind: 'alias_expr';\n alias: IRAlias;\n};\n\nexport type IRPropertyExpression = {\n kind: 'property_expr';\n sourceAlias: IRAlias;\n property: string;\n pathExpr?: import('../paths/PropertyPathExpr.js').PathExpr;\n maxCount?: number;\n};\n\nexport type IRContextPropertyExpression = {\n kind: 'context_property_expr';\n /** The context entity IRI. Optional only while a `contextName` is unresolved. */\n contextIri?: string;\n /** A query-context reference resolved into `contextIri` by `lower()`. */\n contextName?: string;\n property: string;\n};\n\nexport type IRBinaryOperator =\n | '='\n | '!='\n | '>'\n | '>='\n | '<'\n | '<='\n | '+'\n | '-'\n | '*'\n | '/';\n\nexport type IRBinaryExpression = {\n kind: 'binary_expr';\n operator: IRBinaryOperator;\n left: IRExpression;\n right: IRExpression;\n};\n\nexport type IRLogicalOperator = 'and' | 'or';\n\nexport type IRLogicalExpression = {\n kind: 'logical_expr';\n operator: IRLogicalOperator;\n expressions: IRExpression[];\n};\n\nexport type IRNotExpression = {\n kind: 'not_expr';\n expression: IRExpression;\n};\n\nexport type IRFunctionExpression = {\n kind: 'function_expr';\n name: string;\n args: IRExpression[];\n};\n\nexport type IRAggregateExpression = {\n kind: 'aggregate_expr';\n name: 'count' | 'sum' | 'avg' | 'min' | 'max';\n args: IRExpression[];\n};\n\nexport type IRExistsExpression = {\n kind: 'exists_expr';\n pattern: IRGraphPattern;\n filter?: IRExpression;\n};\n\nexport type IRCreateMutation = {\n kind: 'create';\n shape: string;\n data: IRNodeData;\n};\n\nexport type IRTraversalPattern = {\n from: string; // source alias\n property: string; // property IRI\n to: string; // target alias\n};\n\nexport type IRUpdateMutation = {\n kind: 'update';\n shape: string;\n id: string;\n data: IRNodeData;\n traversalPatterns?: IRTraversalPattern[];\n};\n\n/**\n * Create-or-replace against a known id, in one request.\n *\n * Structurally identical to {@link IRUpdateMutation} — it lowers through the same\n * DELETE/INSERT/WHERE body — and differs in exactly one emitted triple: upsert also\n * asserts `?id rdf:type <targetClass>`, which the update path never writes.\n *\n * That single triple is the whole difference between the two, because `update`'s WHERE\n * is a bare `OPTIONAL` and so already matches when the node is absent. It is a distinct\n * IR kind rather than a flag on the update mutation so that a consumer which does not\n * know about upsert fails loudly, instead of quietly writing an untyped node and\n * reporting success.\n */\nexport type IRUpsertMutation = {\n kind: 'upsert';\n shape: string;\n id: string;\n data: IRNodeData;\n traversalPatterns?: IRTraversalPattern[];\n};\n\nexport type IRDeleteMutation = {\n kind: 'delete';\n shape: string;\n ids: NodeReferenceValue[];\n};\n\nexport type IRDeleteAllMutation = {\n kind: 'delete_all';\n shape: string;\n};\n\nexport type IRDeleteWhereMutation = {\n kind: 'delete_where';\n shape: string;\n where: IRExpression;\n wherePatterns: IRGraphPattern[];\n};\n\nexport type IRUpdateWhereMutation = {\n kind: 'update_where';\n shape: string;\n data: IRNodeData;\n where?: IRExpression;\n wherePatterns?: IRGraphPattern[];\n traversalPatterns?: IRTraversalPattern[];\n};\n\nexport type IRNodeData = {\n shape: string;\n fields: IRFieldUpdate[];\n id?: string;\n /**\n * A nested node written as a fresh blank node with only its field triples: no IRI, no\n * `rdf:type` (see `NodeDescriptionValue.__blank`). Never set together with `id`.\n */\n blank?: true;\n};\n\nexport type IRFieldUpdate = {\n property: string;\n value: IRFieldValue;\n};\n\nexport type IRSetModificationValue = {\n add?: IRFieldValue[];\n remove?: NodeReferenceValue[];\n};\n\nexport type IRFieldValue =\n | IRValue\n | Date\n | NodeReferenceValue\n | IRNodeData\n | IRSetModificationValue\n | IRFieldValue[]\n | IRExpression\n | undefined;\n\n// ---------------------------------------------------------------------------\n// Store result types\n// ---------------------------------------------------------------------------\n// These types describe what an IDataset implementation should return.\n// The calling layer (LinkedStorage via queryDispatch) threads the precise\n// DSL-level TypeScript result type back to the caller, so the store\n// only needs to produce data that satisfies these structural contracts.\n// ---------------------------------------------------------------------------\n\n/**\n * A single result row — an object with a node id and dynamic fields.\n * Used in select and create results.\n */\nexport type ResultRow = {id: string; [key: string]: ResultFieldValue};\n\n/**\n * Possible field values in a select or create result row.\n */\nexport type ResultFieldValue =\n | string\n | number\n | boolean\n | Date\n | null\n | undefined\n | ResultRow\n | ResultRow[]\n | string[]\n | number[]\n | boolean[]\n | Date[];\n\n/**\n * What `selectQuery` should return.\n *\n * - Array of rows for multi-result queries (the default).\n * - A single row when `query.singleResult` is true (`.one()` or subject-targeted query).\n * - `null` when `singleResult` is true and the target node doesn't exist.\n */\nexport type SelectResult = ResultRow[] | ResultRow | null;\n\n/**\n * What `createQuery` should return.\n *\n * A single row with the generated `id` and the created field values.\n * Nested creates appear as nested `ResultRow` objects (with their own ids).\n * Array fields (e.g. friends) appear as `ResultRow[]`.\n */\nexport type CreateResult = ResultRow;\n\n/**\n * When a set property is fully overwritten, the result contains `updatedTo`\n * with the new complete set of values.\n */\nexport type SetOverwriteResult = {updatedTo: ResultRow[]};\n\n/**\n * When a set property is incrementally modified with `{add, remove}`,\n * the result contains the added and removed entries.\n */\nexport type SetModificationResult = {added: ResultRow[]; removed: ResultRow[]};\n\n/**\n * Possible field values in an update result row.\n * Extends `ResultFieldValue` with set modification shapes.\n */\nexport type UpdateFieldValue =\n | ResultFieldValue\n | SetOverwriteResult\n | SetModificationResult;\n\n/**\n * What `updateQuery` should return.\n *\n * A single row with the target node's `id` and only the changed fields.\n * Fields not included in the update are omitted (not returned).\n *\n * Field value shapes depend on the type of update:\n * - Literal fields: the new value (string, number, boolean, Date).\n * - Single object fields: a `ResultRow` with the referenced/created node.\n * - Set overwrite (passing an array): `{updatedTo: ResultRow[]}`.\n * - Set add/remove (passing `{add, remove}`): `{added: ResultRow[], removed: ResultRow[]}`.\n * - Unset single field (passing `undefined` or `null`): field is `undefined`.\n * - Unset multi-value field (passing `undefined`): empty array `[]`.\n */\nexport type UpdateResult = {id: string; [key: string]: UpdateFieldValue};\n"]}
|