@_linked/core 2.30.1 → 2.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/README.md +107 -60
  3. package/lib/esm/ontologies/linked-core.js +3 -2
  4. package/lib/esm/ontologies/linked-core.js.map +1 -1
  5. package/lib/esm/ontologies/shacl.d.ts +3 -0
  6. package/lib/esm/ontologies/shacl.js +6 -0
  7. package/lib/esm/ontologies/shacl.js.map +1 -1
  8. package/lib/esm/queries/IRMutation.js +1 -1
  9. package/lib/esm/queries/IRMutation.js.map +1 -1
  10. package/lib/esm/queries/IntermediateRepresentation.d.ts +0 -5
  11. package/lib/esm/queries/IntermediateRepresentation.js.map +1 -1
  12. package/lib/esm/queries/MutationQuery.js +0 -15
  13. package/lib/esm/queries/MutationQuery.js.map +1 -1
  14. package/lib/esm/queries/MutationSerialization.d.ts +6 -5
  15. package/lib/esm/queries/MutationSerialization.js +1 -9
  16. package/lib/esm/queries/MutationSerialization.js.map +1 -1
  17. package/lib/esm/queries/QueryFactory.d.ts +0 -6
  18. package/lib/esm/queries/QueryFactory.js.map +1 -1
  19. package/lib/esm/queries/lowerMutationJSON.js +1 -6
  20. package/lib/esm/queries/lowerMutationJSON.js.map +1 -1
  21. package/lib/esm/shapes/List.class.d.ts +3 -3
  22. package/lib/esm/shapes/List.class.js +3 -3
  23. package/lib/esm/shapes/List.class.js.map +1 -1
  24. package/lib/esm/shapes/List.d.ts +0 -1
  25. package/lib/esm/shapes/List.js.map +1 -1
  26. package/lib/esm/shapes/PathList.d.ts +24 -0
  27. package/lib/esm/shapes/PathList.js +60 -0
  28. package/lib/esm/shapes/PathList.js.map +1 -0
  29. package/lib/esm/shapes/PathNode.d.ts +8 -9
  30. package/lib/esm/shapes/PathNode.js +20 -14
  31. package/lib/esm/shapes/PathNode.js.map +1 -1
  32. package/lib/esm/shapes/SHACL.d.ts +15 -13
  33. package/lib/esm/shapes/SHACL.js +8 -0
  34. package/lib/esm/shapes/SHACL.js.map +1 -1
  35. package/lib/esm/shapes/index.d.ts +1 -0
  36. package/lib/esm/shapes/index.js +1 -0
  37. package/lib/esm/shapes/index.js.map +1 -1
  38. package/lib/esm/shapes/nodeShapeData.d.ts +4 -1
  39. package/lib/esm/shapes/nodeShapeData.js.map +1 -1
  40. package/lib/esm/shapes/serializePathToNodeData.d.ts +12 -11
  41. package/lib/esm/shapes/serializePathToNodeData.js +12 -11
  42. package/lib/esm/shapes/serializePathToNodeData.js.map +1 -1
  43. package/lib/esm/shapes/singleOwnerConstraint.d.ts +5 -7
  44. package/lib/esm/shapes/singleOwnerConstraint.js +65 -21
  45. package/lib/esm/shapes/singleOwnerConstraint.js.map +1 -1
  46. package/lib/esm/shapes/syncShapes.js +2 -2
  47. package/lib/esm/shapes/syncShapes.js.map +1 -1
  48. package/lib/esm/shapes/validation.js +2 -2
  49. package/lib/esm/shapes/validation.js.map +1 -1
  50. package/lib/esm/sparql/irToAlgebra.d.ts +15 -33
  51. package/lib/esm/sparql/irToAlgebra.js +680 -431
  52. package/lib/esm/sparql/irToAlgebra.js.map +1 -1
  53. package/lib/esm/sparql/ownedLinkCheck.d.ts +6 -10
  54. package/lib/esm/sparql/ownedLinkCheck.js +10 -11
  55. package/lib/esm/sparql/ownedLinkCheck.js.map +1 -1
  56. package/lib/esm/utils/Package.d.ts +3 -2
  57. package/lib/esm/utils/Package.js +21 -8
  58. package/lib/esm/utils/Package.js.map +1 -1
  59. package/package.json +1 -1
@@ -7,14 +7,12 @@
7
7
  * ImageObject — would later be deleted with it. Nothing validates `sh:class` on write, so the
8
8
  * SPARQL dataset checks it here, before the update is sent.
9
9
  *
10
- * A field is checked when it owns its value by the same rule the replace delete applies: its
11
- * predicate is a `contains` predicate anywhere in the registry (`collectContainment`), and the
12
- * property declares a value shape. That includes a plain property of one shape that shares a
13
- * predicate another shape declares `contains`, since a replace through it deletes the old
14
- * value just the same. A node is refused only
15
- * when the store holds at least one `rdf:type` for it and none of them is accepted; an id that
16
- * does not exist yet, or has no type, is allowed (`rdf:nil`, a node another request creates,
17
- * an untyped IRI). Collecting the links is a pure walk over the lowered IR; the dataset sends
10
+ * A field is checked when it owns its value by the same rule the replace delete applies: the
11
+ * property itself is `contains`, declares a value shape and has a simple path. A plain property
12
+ * on a predicate another shape declares `contains` owns nothing and is not checked. A node is
13
+ * refused only when the store holds at least one `rdf:type` for it and none of them is accepted;
14
+ * an id that does not exist yet, or has no type, is allowed (`rdf:nil`, a node another request
15
+ * creates, an untyped IRI). Collecting the links is a pure walk over the lowered IR; the dataset sends
18
16
  * one SELECT for all distinct ids, and none when there is nothing to check.
19
17
  */
20
18
  import type { IRCreateMutation, IRUpdateMutation, IRUpdateWhereMutation, IRUpsertMutation } from '../queries/IntermediateRepresentation.js';
@@ -32,8 +30,6 @@ export type OwnedLink = {
32
30
  expectedClass: string;
33
31
  /** `expectedClass`, every registered sub-shape's targetClass, and `sh:class` if declared. */
34
32
  acceptedClasses: string[];
35
- /** Set when the property is not `contains` itself but shares this `contains` predicate. */
36
- sharedPredicate?: string;
37
33
  };
38
34
  type OwnedLinkMutation = IRCreateMutation | IRUpdateMutation | IRUpsertMutation | IRUpdateWhereMutation;
39
35
  /** Every owned link in a create, update, upsert or update-where mutation. Pure; no I/O. */
@@ -2,7 +2,7 @@ import { findPropertyShapeById } from '../shapes/nodeShapeData.js';
2
2
  import { getSubShapes, getTargetClassId } from '../utils/ShapeClass.js';
3
3
  import { rdf } from '../ontologies/rdf.js';
4
4
  import { assertSafeIri } from './sparqlUtils.js';
5
- import { collectContainment, isBareNodeReference } from './irToAlgebra.js';
5
+ import { isBareNodeReference } from './irToAlgebra.js';
6
6
  import { getSimplePathId } from '../paths/normalizePropertyPath.js';
7
7
  import { isSparqlSelectResults } from './resultMapping.js';
8
8
  const RDF_NIL = rdf.nil.id;
@@ -39,10 +39,7 @@ function ownedRuleFor(propertyId, fallbackShape, cache) {
39
39
  }
40
40
  function buildRule(ps, fallbackShape) {
41
41
  var _a, _b, _c;
42
- if (!(ps === null || ps === void 0 ? void 0 : ps.valueShape))
43
- return null;
44
- const predicate = getSimplePathId(ps.path);
45
- if (!predicate || !collectContainment().containsPreds.includes(predicate))
42
+ if (!(ps === null || ps === void 0 ? void 0 : ps.contains) || !ps.valueShape || !getSimplePathId(ps.path))
46
43
  return null;
47
44
  const expectedClass = getTargetClassId(ps.valueShape.id);
48
45
  if (!expectedClass)
@@ -55,7 +52,13 @@ function buildRule(ps, fallbackShape) {
55
52
  }
56
53
  if ((_a = ps.class) === null || _a === void 0 ? void 0 : _a.id)
57
54
  accepted.add(ps.class.id);
58
- return Object.assign({ property: ps.id, label: ps.label, shape: (_c = (_b = ps.parentNodeShape) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : fallbackShape, expectedClass, acceptedClasses: [...accepted] }, (ps.contains ? {} : { sharedPredicate: predicate }));
55
+ return {
56
+ property: ps.id,
57
+ label: ps.label,
58
+ shape: (_c = (_b = ps.parentNodeShape) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : fallbackShape,
59
+ expectedClass,
60
+ acceptedClasses: [...accepted],
61
+ };
59
62
  }
60
63
  function walk(data, cache, out) {
61
64
  for (const field of data.fields) {
@@ -127,11 +130,7 @@ export function assertOwnedLinkTypes(links, typesById) {
127
130
  const alsoAccepted = others.length
128
131
  ? ` (or of ${others.map((c) => `<${c}>`).join(', ')}, a registered sub-shape or sh:class)`
129
132
  : '';
130
- const slot = link.sharedPredicate
131
- ? `the property "${link.label}" of <${link.shape}>, whose predicate <${link.sharedPredicate}> ` +
132
- 'is a contains predicate (another shape owns its values through it)'
133
- : `the contains property "${link.label}" of <${link.shape}>`;
134
- messages.push(`Cannot link <${link.id}> into ${slot}: ` +
133
+ messages.push(`Cannot link <${link.id}> into the contains property "${link.label}" of <${link.shape}>: ` +
135
134
  `it is typed ${typed}, but "${link.label}" only owns instances of ` +
136
135
  `<${link.expectedClass}>${alsoAccepted}. An owner deletes what it contains when the ` +
137
136
  'value is replaced or removed, or when the owner is deleted.');
@@ -1 +1 @@
1
- {"version":3,"file":"ownedLinkCheck.js","sourceRoot":"","sources":["../../../src/sparql/ownedLinkCheck.ts"],"names":[],"mappings":"AAgCA,OAAO,EAAC,qBAAqB,EAAyB,MAAM,4BAA4B,CAAC;AACzF,OAAO,EAAC,YAAY,EAAE,gBAAgB,EAAC,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAC,GAAG,EAAC,MAAM,sBAAsB,CAAC;AACzC,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAC,kBAAkB,EAAE,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAC,eAAe,EAAC,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAC,qBAAqB,EAA0B,MAAM,oBAAoB,CAAC;AA2BlF,MAAM,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;AAC3B,MAAM,QAAQ,GAAG,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;AAE7B,SAAS,UAAU,CAAC,KAAc;IAChC,OAAO,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,IAAI,KAAK,IAAI,QAAQ,IAAI,KAAK,CAAC;AACvF,CAAC;AAED;;;GAGG;AACH,SAAS,aAAa,CAAC,KAAmB;;IACxC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACvC,IACE,KAAK;QACL,OAAO,KAAK,KAAK,QAAQ;QACzB,CAAC,CAAC,KAAK,YAAY,IAAI,CAAC;QACxB,CAAC,CAAC,IAAI,IAAI,KAAK,CAAC;QAChB,CAAC,CAAC,OAAO,IAAI,KAAK,CAAC;QACnB,CAAC,KAAK,IAAI,KAAK,IAAI,QAAQ,IAAI,KAAK,CAAC,EACrC,CAAC;QACD,OAAO,MAAC,KA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C1F,CAAC,CAAC,EAAE,CAAC;QACP,MAAM,IAAI,GAAG,IAAI,CAAC,eAAe;YAC/B,CAAC,CAAC,iBAAiB,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,uBAAuB,IAAI,CAAC,eAAe,IAAI;gBAC7F,oEAAoE;YACtE,CAAC,CAAC,0BAA0B,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,GAAG,CAAC;QAC/D,QAAQ,CAAC,IAAI,CACX,gBAAgB,IAAI,CAAC,EAAE,UAAU,IAAI,IAAI;YACvC,eAAe,KAAK,UAAU,IAAI,CAAC,KAAK,2BAA2B;YACnE,IAAI,IAAI,CAAC,aAAa,IAAI,YAAY,+CAA+C;YACrF,6DAA6D,CAChE,CAAC;IACJ,CAAC;IACD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AAChE,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/**\n * The class check for nodes linked by `{id}` into a `contains` property.\n *\n * An owner deletes what it contains: on replace, on set-remove and when the owner itself is\n * deleted. Linking an existing node into a `contains` slot is allowed (upload, then attach),\n * so a node of the wrong kind — a Person linked into an `image` slot whose value shape is\n * ImageObject — would later be deleted with it. Nothing validates `sh:class` on write, so the\n * SPARQL dataset checks it here, before the update is sent.\n *\n * A field is checked when it owns its value by the same rule the replace delete applies: its\n * predicate is a `contains` predicate anywhere in the registry (`collectContainment`), and the\n * property declares a value shape. That includes a plain property of one shape that shares a\n * predicate another shape declares `contains`, since a replace through it deletes the old\n * value just the same. A node is refused only\n * when the store holds at least one `rdf:type` for it and none of them is accepted; an id that\n * does not exist yet, or has no type, is allowed (`rdf:nil`, a node another request creates,\n * an untyped IRI). Collecting the links is a pure walk over the lowered IR; the dataset sends\n * one SELECT for all distinct ids, and none when there is nothing to check.\n */\nimport type {\n IRCreateMutation,\n IRFieldValue,\n IRNodeData,\n IRUpdateMutation,\n IRUpdateWhereMutation,\n IRUpsertMutation,\n} from '../queries/IntermediateRepresentation.js';\nimport {findPropertyShapeById, type PropertyShapeData} from '../shapes/nodeShapeData.js';\nimport {getSubShapes, getTargetClassId} from '../utils/ShapeClass.js';\nimport {rdf} from '../ontologies/rdf.js';\nimport {assertSafeIri} from './sparqlUtils.js';\nimport {collectContainment, isBareNodeReference} from './irToAlgebra.js';\nimport {getSimplePathId} from '../paths/normalizePropertyPath.js';\nimport {isSparqlSelectResults, type SparqlQueryResults} from './resultMapping.js';\n\n/** One bare `{id}` linked into a `contains` field that declares a value shape. */\nexport type OwnedLink = {\n id: string;\n /** Property-shape id. */\n property: string;\n /** Property label, for the message. */\n label: string;\n /** The node shape that declares the property. */\n shape: string;\n /** The value shape's targetClass — the class the message names. */\n expectedClass: string;\n /** `expectedClass`, every registered sub-shape's targetClass, and `sh:class` if declared. */\n acceptedClasses: string[];\n /** Set when the property is not `contains` itself but shares this `contains` predicate. */\n sharedPredicate?: string;\n};\n\ntype OwnedLinkMutation =\n | IRCreateMutation\n | IRUpdateMutation\n | IRUpsertMutation\n | IRUpdateWhereMutation;\n\ntype OwnedRule = Omit<OwnedLink, 'id'>;\n\nconst RDF_NIL = rdf.nil.id;\nconst RDF_TYPE = rdf.type.id;\n\nfunction isNodeData(value: unknown): value is IRNodeData {\n return !!value && typeof value === 'object' && 'shape' in value && 'fields' in value;\n}\n\n/**\n * The values a field writes: the items of an array overwrite, the `add` items of a set\n * modification (`remove` items unlink, they never link), or the single value.\n */\nfunction writtenValues(value: IRFieldValue): unknown[] {\n if (Array.isArray(value)) return value;\n if (\n value &&\n typeof value === 'object' &&\n !(value instanceof Date) &&\n !('id' in value) &&\n !('shape' in value) &&\n ('add' in value || 'remove' in value)\n ) {\n return (value as {add?: IRFieldValue[]}).add ?? [];\n }\n return [value];\n}\n\n/** The check for a property, or null when the property is not checked. */\nfunction ownedRuleFor(\n propertyId: string,\n fallbackShape: string,\n cache: Map<string, OwnedRule | null>,\n): OwnedRule | null {\n if (cache.has(propertyId)) return cache.get(propertyId) ?? null;\n const rule = buildRule(findPropertyShapeById(propertyId), fallbackShape);\n cache.set(propertyId, rule);\n return rule;\n}\n\nfunction buildRule(ps: PropertyShapeData | undefined, fallbackShape: string): OwnedRule | null {\n if (!ps?.valueShape) return null;\n const predicate = getSimplePathId(ps.path);\n if (!predicate || !collectContainment().containsPreds.includes(predicate)) return null;\n const expectedClass = getTargetClassId(ps.valueShape.id);\n if (!expectedClass) return null;\n const accepted = new Set<string>([expectedClass]);\n for (const sub of getSubShapes(ps.valueShape.id)) {\n const subClass = getTargetClassId(sub);\n if (subClass) accepted.add(subClass);\n }\n if (ps.class?.id) accepted.add(ps.class.id);\n return {\n property: ps.id,\n label: ps.label,\n shape: ps.parentNodeShape?.id ?? fallbackShape,\n expectedClass,\n acceptedClasses: [...accepted],\n ...(ps.contains ? {} : {sharedPredicate: predicate}),\n };\n}\n\nfunction walk(data: IRNodeData, cache: Map<string, OwnedRule | null>, out: OwnedLink[]): void {\n for (const field of data.fields) {\n const rule = ownedRuleFor(field.property, data.shape, cache);\n for (const item of writtenValues(field.value)) {\n if (isNodeData(item)) {\n // A nested create is not a link — the mutation writes its type itself — but its\n // own fields can link.\n walk(item, cache, out);\n } else if (rule && isBareNodeReference(item) && item.id !== RDF_NIL) {\n out.push({id: item.id, ...rule});\n }\n }\n }\n}\n\n/** Every owned link in a create, update, upsert or update-where mutation. Pure; no I/O. */\nexport function collectOwnedLinks(ir: OwnedLinkMutation): OwnedLink[] {\n const out: OwnedLink[] = [];\n walk(ir.data, new Map(), out);\n return out;\n}\n\n/** `SELECT ?id ?type WHERE { VALUES ?id { … } ?id rdf:type ?type }` for the distinct ids. */\nexport function ownedLinkTypesQuery(ids: string[]): string {\n const distinct = [...new Set(ids)];\n for (const id of distinct) assertSafeIri(id);\n const values = distinct.map((id) => `<${id}>`).join(' ');\n return `SELECT ?id ?type WHERE { VALUES ?id { ${values} } ?id <${RDF_TYPE}> ?type }`;\n}\n\n/** The `rdf:type`s per id from the answer to {@link ownedLinkTypesQuery}. */\nexport function ownedLinkTypesFromResults(\n json: SparqlQueryResults,\n): Map<string, Set<string>> {\n if (!isSparqlSelectResults(json)) {\n throw new Error(\n 'Expected a SPARQL SELECT result set for the owned-link type check, got an ASK response.',\n );\n }\n const types = new Map<string, Set<string>>();\n for (const binding of json.results.bindings) {\n const id = binding.id?.value;\n const type = binding.type?.value;\n if (!id || !type) continue;\n let set = types.get(id);\n if (!set) types.set(id, (set = new Set()));\n set.add(type);\n }\n return types;\n}\n\n/**\n * Throws when a linked id is typed and none of its types is accepted. Every violation is\n * listed in the one error. An id with no types is allowed.\n */\nexport function assertOwnedLinkTypes(\n links: OwnedLink[],\n typesById: ReadonlyMap<string, ReadonlySet<string>>,\n): void {\n const messages: string[] = [];\n const seen = new Set<string>();\n for (const link of links) {\n const types = typesById.get(link.id);\n if (!types || types.size === 0) continue;\n if (link.acceptedClasses.some((c) => types.has(c))) continue;\n const key = `${link.property} ${link.id}`;\n if (seen.has(key)) continue;\n seen.add(key);\n const typed = [...types].map((t) => `<${t}>`).join(', ');\n const others = link.acceptedClasses.filter((c) => c !== link.expectedClass);\n const alsoAccepted = others.length\n ? ` (or of ${others.map((c) => `<${c}>`).join(', ')}, a registered sub-shape or sh:class)`\n : '';\n const slot = link.sharedPredicate\n ? `the property \"${link.label}\" of <${link.shape}>, whose predicate <${link.sharedPredicate}> ` +\n 'is a contains predicate (another shape owns its values through it)'\n : `the contains property \"${link.label}\" of <${link.shape}>`;\n messages.push(\n `Cannot link <${link.id}> into ${slot}: ` +\n `it is typed ${typed}, but \"${link.label}\" only owns instances of ` +\n `<${link.expectedClass}>${alsoAccepted}. An owner deletes what it contains when the ` +\n 'value is replaced or removed, or when the owner is deleted.',\n );\n }\n if (messages.length > 0) throw new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,CAAC;IACD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AAChE,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/**\n * The class check for nodes linked by `{id}` into a `contains` property.\n *\n * An owner deletes what it contains: on replace, on set-remove and when the owner itself is\n * deleted. Linking an existing node into a `contains` slot is allowed (upload, then attach),\n * so a node of the wrong kind — a Person linked into an `image` slot whose value shape is\n * ImageObject — would later be deleted with it. Nothing validates `sh:class` on write, so the\n * SPARQL dataset checks it here, before the update is sent.\n *\n * A field is checked when it owns its value by the same rule the replace delete applies: the\n * property itself is `contains`, declares a value shape and has a simple path. A plain property\n * on a predicate another shape declares `contains` owns nothing and is not checked. A node is\n * refused only when the store holds at least one `rdf:type` for it and none of them is accepted;\n * an id that does not exist yet, or has no type, is allowed (`rdf:nil`, a node another request\n * creates, an untyped IRI). Collecting the links is a pure walk over the lowered IR; the dataset sends\n * one SELECT for all distinct ids, and none when there is nothing to check.\n */\nimport type {\n IRCreateMutation,\n IRFieldValue,\n IRNodeData,\n IRUpdateMutation,\n IRUpdateWhereMutation,\n IRUpsertMutation,\n} from '../queries/IntermediateRepresentation.js';\nimport {findPropertyShapeById, type PropertyShapeData} from '../shapes/nodeShapeData.js';\nimport {getSubShapes, getTargetClassId} from '../utils/ShapeClass.js';\nimport {rdf} from '../ontologies/rdf.js';\nimport {assertSafeIri} from './sparqlUtils.js';\nimport {isBareNodeReference} from './irToAlgebra.js';\nimport {getSimplePathId} from '../paths/normalizePropertyPath.js';\nimport {isSparqlSelectResults, type SparqlQueryResults} from './resultMapping.js';\n\n/** One bare `{id}` linked into a `contains` field that declares a value shape. */\nexport type OwnedLink = {\n id: string;\n /** Property-shape id. */\n property: string;\n /** Property label, for the message. */\n label: string;\n /** The node shape that declares the property. */\n shape: string;\n /** The value shape's targetClass — the class the message names. */\n expectedClass: string;\n /** `expectedClass`, every registered sub-shape's targetClass, and `sh:class` if declared. */\n acceptedClasses: string[];\n};\n\ntype OwnedLinkMutation =\n | IRCreateMutation\n | IRUpdateMutation\n | IRUpsertMutation\n | IRUpdateWhereMutation;\n\ntype OwnedRule = Omit<OwnedLink, 'id'>;\n\nconst RDF_NIL = rdf.nil.id;\nconst RDF_TYPE = rdf.type.id;\n\nfunction isNodeData(value: unknown): value is IRNodeData {\n return !!value && typeof value === 'object' && 'shape' in value && 'fields' in value;\n}\n\n/**\n * The values a field writes: the items of an array overwrite, the `add` items of a set\n * modification (`remove` items unlink, they never link), or the single value.\n */\nfunction writtenValues(value: IRFieldValue): unknown[] {\n if (Array.isArray(value)) return value;\n if (\n value &&\n typeof value === 'object' &&\n !(value instanceof Date) &&\n !('id' in value) &&\n !('shape' in value) &&\n ('add' in value || 'remove' in value)\n ) {\n return (value as {add?: IRFieldValue[]}).add ?? [];\n }\n return [value];\n}\n\n/** The check for a property, or null when the property is not checked. */\nfunction ownedRuleFor(\n propertyId: string,\n fallbackShape: string,\n cache: Map<string, OwnedRule | null>,\n): OwnedRule | null {\n if (cache.has(propertyId)) return cache.get(propertyId) ?? null;\n const rule = buildRule(findPropertyShapeById(propertyId), fallbackShape);\n cache.set(propertyId, rule);\n return rule;\n}\n\nfunction buildRule(ps: PropertyShapeData | undefined, fallbackShape: string): OwnedRule | null {\n if (!ps?.contains || !ps.valueShape || !getSimplePathId(ps.path)) return null;\n const expectedClass = getTargetClassId(ps.valueShape.id);\n if (!expectedClass) return null;\n const accepted = new Set<string>([expectedClass]);\n for (const sub of getSubShapes(ps.valueShape.id)) {\n const subClass = getTargetClassId(sub);\n if (subClass) accepted.add(subClass);\n }\n if (ps.class?.id) accepted.add(ps.class.id);\n return {\n property: ps.id,\n label: ps.label,\n shape: ps.parentNodeShape?.id ?? fallbackShape,\n expectedClass,\n acceptedClasses: [...accepted],\n };\n}\n\nfunction walk(data: IRNodeData, cache: Map<string, OwnedRule | null>, out: OwnedLink[]): void {\n for (const field of data.fields) {\n const rule = ownedRuleFor(field.property, data.shape, cache);\n for (const item of writtenValues(field.value)) {\n if (isNodeData(item)) {\n // A nested create is not a link — the mutation writes its type itself — but its\n // own fields can link.\n walk(item, cache, out);\n } else if (rule && isBareNodeReference(item) && item.id !== RDF_NIL) {\n out.push({id: item.id, ...rule});\n }\n }\n }\n}\n\n/** Every owned link in a create, update, upsert or update-where mutation. Pure; no I/O. */\nexport function collectOwnedLinks(ir: OwnedLinkMutation): OwnedLink[] {\n const out: OwnedLink[] = [];\n walk(ir.data, new Map(), out);\n return out;\n}\n\n/** `SELECT ?id ?type WHERE { VALUES ?id { … } ?id rdf:type ?type }` for the distinct ids. */\nexport function ownedLinkTypesQuery(ids: string[]): string {\n const distinct = [...new Set(ids)];\n for (const id of distinct) assertSafeIri(id);\n const values = distinct.map((id) => `<${id}>`).join(' ');\n return `SELECT ?id ?type WHERE { VALUES ?id { ${values} } ?id <${RDF_TYPE}> ?type }`;\n}\n\n/** The `rdf:type`s per id from the answer to {@link ownedLinkTypesQuery}. */\nexport function ownedLinkTypesFromResults(\n json: SparqlQueryResults,\n): Map<string, Set<string>> {\n if (!isSparqlSelectResults(json)) {\n throw new Error(\n 'Expected a SPARQL SELECT result set for the owned-link type check, got an ASK response.',\n );\n }\n const types = new Map<string, Set<string>>();\n for (const binding of json.results.bindings) {\n const id = binding.id?.value;\n const type = binding.type?.value;\n if (!id || !type) continue;\n let set = types.get(id);\n if (!set) types.set(id, (set = new Set()));\n set.add(type);\n }\n return types;\n}\n\n/**\n * Throws when a linked id is typed and none of its types is accepted. Every violation is\n * listed in the one error. An id with no types is allowed.\n */\nexport function assertOwnedLinkTypes(\n links: OwnedLink[],\n typesById: ReadonlyMap<string, ReadonlySet<string>>,\n): void {\n const messages: string[] = [];\n const seen = new Set<string>();\n for (const link of links) {\n const types = typesById.get(link.id);\n if (!types || types.size === 0) continue;\n if (link.acceptedClasses.some((c) => types.has(c))) continue;\n const key = `${link.property} ${link.id}`;\n if (seen.has(key)) continue;\n seen.add(key);\n const typed = [...types].map((t) => `<${t}>`).join(', ');\n const others = link.acceptedClasses.filter((c) => c !== link.expectedClass);\n const alsoAccepted = others.length\n ? ` (or of ${others.map((c) => `<${c}>`).join(', ')}, a registered sub-shape or sh:class)`\n : '';\n messages.push(\n `Cannot link <${link.id}> into the contains property \"${link.label}\" of <${link.shape}>: ` +\n `it is typed ${typed}, but \"${link.label}\" only owns instances of ` +\n `<${link.expectedClass}>${alsoAccepted}. An owner deletes what it contains when the ` +\n 'value is replaced or removed, or when the owner is deleted.',\n );\n }\n if (messages.length > 0) throw new Error(messages.join('\\n'));\n}\n"]}
@@ -25,8 +25,9 @@ export type ShapeConfig = {
25
25
  */
26
26
  description?: string;
27
27
  /**
28
- * Marks this shape's instances as *dependent* (composition / no independent existence):
29
- * they may be cascade-deleted when reached through a `contains` property.
28
+ * @deprecated No effect on deletes. Ownership is per property: every node a `contains`
29
+ * property reaches is deleted with its owner, whether or not its shape is
30
+ * `dependent`. Still accepted and persisted (`core:dependent`) by shape sync.
30
31
  */
31
32
  dependent?: boolean;
32
33
  /**
@@ -299,16 +299,14 @@ corePackage.linkedShape({
299
299
  corePackage.linkedShape({
300
300
  name: 'PropertyShape',
301
301
  description: 'Represents a SHACL PropertyShape; specifies rules for one property of a NodeShape (path, datatype, cardinality). (validation rule, property constraint)',
302
- // A property shape has no independent existence — it is owned by its NodeShape via the
303
- // `contains` sh:property edge, so deleting the NodeShape cascade-deletes it.
304
- dependent: true,
302
+ // Owned by its NodeShape through the `contains` sh:property edge: deleting the NodeShape
303
+ // deletes it.
305
304
  })(PropertyShape);
306
305
  // List is registered here, by value, because PropertyShape.in below uses it as its value
307
306
  // shape. Naming it by string instead would leave it unregistered for anyone who loads the
308
307
  // SHACL metamodel without importing shapes/List (backlog 045).
309
308
  corePackage.linkedShape({
310
309
  name: 'List',
311
- dependent: true,
312
310
  })(List);
313
311
  // ValidationReport / ValidationResult removed in core metadata rewrite
314
312
  //ALL the following is to support Shape having get/set methods with property shapes
@@ -359,12 +357,15 @@ createPropertyShape({
359
357
  //currently path accepts multiple values, so its a multi-value property
360
358
  //these values will be consequent properties that follow each other. Other property paths are not supported yet.
361
359
  createPropertyShape({
362
- // No fixed valueShape: sh:path is polymorphic (a predicate IRI, an rdf:List for a
360
+ // No fixed valueShape: sh:path is polymorphic (a predicate IRI, a PathList for a
363
361
  // sequence, or a PathNode for inverse/alt/cardinality). Omitting valueShape lets the
364
362
  // create pipeline use each value's own shape. Simple paths are passed as
365
- // {id} node references, complex paths as List/PathNode node-data.
363
+ // {id} node references, complex paths as PathList/PathNode node-data.
366
364
  path: shacl.path,
367
- contains: true, // a property shape owns its complex path structure (List/PathNode)
365
+ // Not `contains`: a predicate path is a shared IRI. A complex path's operator node or
366
+ // sequence list is written without an id, so it becomes a blank node, as SHACL requires,
367
+ // and the blank-node cascade deletes it with the property shape.
368
+ nodeKind: shacl.BlankNodeOrIRI,
368
369
  }, 'path', shacl.IRI, PropertyShape);
369
370
  createPropertyShape({
370
371
  path: shacl.node,
@@ -446,7 +447,7 @@ createPropertyShape({ path: coreOntology.displayRank, datatype: xsd.integer, max
446
447
  createPropertyShape({ path: coreOntology.displayHidden, datatype: xsd.boolean, maxCount: 1 }, 'displayHidden', shacl.Literal, PropertyShape);
447
448
  // PropertyShape.contains (core:contains — persists the composition flag)
448
449
  createPropertyShape({ path: coreOntology.contains, datatype: xsd.boolean, maxCount: 1 }, 'contains', shacl.Literal, PropertyShape);
449
- // NodeShape.closed / ignoredProperties / dependent
450
+ // NodeShape.closed / ignoredProperties / dependent (deprecated, persisted only)
450
451
  createPropertyShape({ path: shacl.closed, datatype: xsd.boolean, maxCount: 1 }, 'closed', shacl.Literal, NodeShape);
451
452
  createPropertyShape({ path: shacl.ignoredProperties, shape: Shape }, 'ignoredProperties', shacl.IRI, NodeShape);
452
453
  createPropertyShape({ path: coreOntology.dependent, datatype: xsd.boolean, maxCount: 1 }, 'dependent', shacl.Literal, NodeShape);
@@ -458,4 +459,16 @@ createPropertyShape({ path: coreOntology.dependent, datatype: xsd.boolean, maxCo
458
459
  createPropertyShape({ path: shacl.targetObjectsOf, shape: Shape }, 'targetObjectsOf', shacl.IRI, NodeShape);
459
460
  createPropertyShape({ path: coreOntology.generated, datatype: xsd.boolean, maxCount: 1 }, 'generated', shacl.Literal, NodeShape);
460
461
  createPropertyShape({ path: coreOntology.generatedShape, shape: NodeShape, contains: true }, 'generatedShapes', shacl.IRI, NodeShape);
462
+ // The terms of the generated single-owner constraint (`singleOwnerConstraint.ts`):
463
+ // `sh:qualifiedValueShape [ sh:or ( [ sh:class A ] [ sh:class B ] ) ]` and
464
+ // `sh:qualifiedMaxCount`. The qualified shape and the `sh:or` list are written without ids, so
465
+ // they are blank nodes, deleted with their property shape by the blank-node cascade. The list
466
+ // cells are `PathList`s (blank-capable `rdf:List` cells); like `sh:path`, `orShapes` declares no
467
+ // value shape (`PathList.ts` imports `package.js`, which loads this module), so the create uses each value's own shape.
468
+ createPropertyShape({ path: shacl.qualifiedValueShape, shape: NodeShape, maxCount: 1, nodeKind: shacl.BlankNodeOrIRI }, 'qualifiedValueShape', shacl.BlankNodeOrIRI, PropertyShape);
469
+ createPropertyShape({ path: shacl.qualifiedMaxCount, datatype: xsd.integer, maxCount: 1 }, 'qualifiedMaxCount', shacl.Literal, PropertyShape);
470
+ createPropertyShape({ path: shacl.class, shape: Shape, maxCount: 1 }, 'class', shacl.IRI, NodeShape);
471
+ createPropertyShape({ path: shacl.or, maxCount: 1, nodeKind: shacl.BlankNodeOrIRI },
472
+ // `or` is reserved (a DSL-JSON combinator), so the accessor is `orShapes`.
473
+ 'orShapes', shacl.BlankNodeOrIRI, NodeShape);
461
474
  //# sourceMappingURL=Package.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Package.js","sourceRoot":"","sources":["../../../src/utils/Package.ts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AAC,SAAS,EAAE,QAAQ,EAAE,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAC,EAClE,WAAW,EACX,KAAK,CAAC,OAAO,EACb,SAAS,CACV,CAAC;AACF,mBAAmB,CACjB,EAAC,IAAI,EAAE,YAAY,CAAC,cAAc,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAC,EACrE,iBAAiB,EACjB,KAAK,CAAC,GAAG,EACT,SAAS,CACV,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 {\n createPropertyShape,\n getAndClearCallbacks,\n getNodeShapeUri,\n getPackageUri,\n setPackagePublishConfig,\n NodeShape,\n PropertyShape,\n} from '../shapes/SHACL.js';\nimport {createNodeShapeData, type NodeShapeData} from '../shapes/nodeShapeData.js';\nimport {Shape, type ShapeConstructor} from '../shapes/Shape.js';\nimport {List} from '../shapes/List.class.js';\nimport {Prefix} from './Prefix.js';\nimport {coreOntology} from '../ontologies/linked-core.js';\nimport {rdf} from '../ontologies/rdf.js';\nimport {addNodeShapeToShapeClass,getShapeClass} from './ShapeClass.js';\nimport {shacl} from '../ontologies/shacl.js';\nimport {rdfs} from '../ontologies/rdfs.js';\nimport {xsd} from '../ontologies/xsd.js';\nimport type {NodeReferenceValue} from './NodeReference.js';\n\n//global tree\ndeclare var _linked: any;\ndeclare var window;\ndeclare var global;\n\n\n// var packageParsePromises: Map<string,Promise<any>> = new Map();\n// var loadedPackages: Set<NamedNode> = new Set();\nlet ontologies: Set<any> = new Set();\nlet _autoLoadOntologyData = false;\n/**\n * a map of requested property shapes for specific nodes\n * The value is a promise if it's still loading, or true if it is fully loaded\n */\n// type ClassDecorator = <T extends {new (...args: any[]): {}}>(\n// constructor: T,\n// ) => T;\n\nexport type ShapeConfig = {\n /**\n * The name this shape is identified by, overriding the class name.\n *\n * A shape's IRI is `<baseUri>shape/<package>/<name>`, and `Server.call`\n * routes on it — so the name is persisted data, not a label. Taking it from\n * `constructor.name` couples that data to how the code was compiled: a\n * minifier renames the class, and so does a plain name collision, because a\n * shape and the ontology term it targets deliberately share a name. Either\n * one silently changes what the shape *is*.\n *\n * Optional, and defaults to `constructor.name`, so existing shapes are\n * unaffected. Set it where the identity has to outlive the build.\n */\n name?: string;\n /**\n * A short description of the shape, what it represents and what it is used for.\n * will be stored as rdfs:comment on the shape node\n */\n description?: string;\n /**\n * Marks this shape's instances as *dependent* (composition / no independent existence):\n * they may be cascade-deleted when reached through a `contains` property.\n */\n dependent?: boolean;\n /**\n * Close the shape (sh:closed): target nodes with properties outside this shape are invalid.\n */\n closed?: boolean;\n /**\n * Properties permitted in addition to the declared ones when the shape is closed\n * (sh:ignoredProperties).\n */\n ignoredProperties?: NodeReferenceValue[];\n};\n\nexport type PackageMetadata = {\n id: string;\n packageName: string;\n type: NodeReferenceValue;\n};\n\n/**\n * This object, returned by [linkedPackage()](/docs/lincd.js/modules/utils_Module#linkedPackage),\n * contains the decorators to link different parts of a LINCD module.\n */\nexport interface LinkedPackageObject\n{\n /**\n * Links a typescript class to a SHACL shape.\n * This decorator creates a SHACL shape and looks at the static property [targetClass](/docs/lincd.js/classes/shapes_Shape.Shape#targetclass)\n * The rest of the shape is typically 'shaped' by methods that use [property decorators](/docs/lincd.js/modules/utils_ShapeDecorators).\n *\n * @example\n * Example of a typescript class using the \\@linkedShape decorator:\n * ```tsx\n * @linkedShape\n * export class Person extends Shape { ... }\n * ```\n * Or with options:\n * ```tsx\n * @linkedShape({ description: \"...\" })\n * export class Person extends Shape { ... }\n * ```\n */\n linkedShape: {\n <T extends typeof Shape>(constructor: T): void;\n <T extends typeof Shape>(config?: ShapeConfig): (constructor: T) => void;\n };\n /**\n * Use this decorator to make any other classes or functions available on demand to other LINCD modules.\n * It does not change the object it is applied on.\n * This is specifically required for their use in an open-ended LINCD application.\n *\n * @example\n * An example helper utility using the \\@linkedUtil decorator:\n * ```tsx\n * @linkedUtil\n * export class Sort {\n * static byName(persons:Person[]) {\n * return persons.sort((p1,p2) => p1.name < p2.name ? -1 : 1)\n * }\n * ```\n */\n linkedUtil: (constructor: any) => any;\n /**\n * Used to notify LINCD.js of an ontology.\n * See also the [Ontology guides](/docs/guides/linked-code/ontologies).\n *\n * @param allFileExports - all the objects that are exported by the ontology file (use `import * as _this from \"./path-to-this-file\")`)\n * @param nameSpace - the result of [createNameSpace](/docs/lincd.js/modules/utils_NameSpace#createnamespace). This allows consumers to generate NamedNodes that may not be listed in this ontology if needed\n * @param prefixAndFileName - a suggested prefix chosen by you. Make sure the suggestedPrefix matches the file name and the name of the exported object that groups all entities together\n * @param loadDataFunction - a method that loads _and parses_ the raw ontology data. This means the ontology will be loaded into the local graph. The returned result is mostly a JSONLDParsePromise (from lincd-jsonld/JSONLD, not bundled in LINCD.js)\n * @param dataSource - the relative path to the raw data of the ontology\n * @example\n * Example of an Ontology File that used linkedOntology()\n * ```tsx\n * import {NamedNode} from 'lincd/models';\n * import {JSONLD} from 'lincd-jsonld/JSONLD';\n * import {createNameSpace} from 'lincd/utils/NameSpace';\n * import {linkedOntology} from '../package.js';\n * import * as _this from './my.js-ontology';\n *\n * let dataFile = '../data/my.js-ontology.json';\n * export var loadData = () => JSONLD.parsePromise(import(dataFile));\n *\n * export var ns = createNameSpace('http://www.my-ontology.com/');\n *\n * export var _self: NamedNode = ns('');\n *\n * // Classes\n * export var ExampleClass: NamedNode = ns('ExampleClass');\n *\n * // Properties\n * export var exampleProperty: NamedNode = ns('exampleProperty');\n *\n * export const myOntology = {\n * ExampleClass,\n * exampleProperty,\n * };\n *\n * linkedOntology(_this, ns, 'myOntology', loadData, dataFile);\n * ```\n */\n linkedOntology: (\n allFileExports,\n nameSpace: (term: string) => NodeReferenceValue,\n suggestedPrefixAndFileName: string,\n loadDataFunction?: () => Promise<any>,\n dataSource?: string | string[],\n ) => void;\n /**\n * Low level method used by other decorators to write to the modules' object in the LINCD tree.\n * You should typically not need this.\n * @param exportFileName - the file name that this exported object is available under. Needs to be unique across the module.\n * @param exportedObject - the exported object (the class, constant, function, etc)\n */\n registerPackageExport: (exportedObject: any) => void;\n\n /**\n * Get a Shape subclass registered in this package by name.\n * Returns undefined if the shape is not registered or bundled.\n *\n * Useful for avoiding circular dependencies between shapes.\n * E.g. `getOneAs(..., getPackageShape('ImageObject'))` in Thing.ts\n * avoids importing ImageObject (which extends Thing).\n */\n getPackageShape: (name: string) => ShapeConstructor | undefined;\n /**\n * A reference to the modules' object in the LINCD tree.\n * Contains all linked components of the module.\n */\n packageExports: any;\n packageName: string;\n packageMetadata: PackageMetadata;\n\n /**\n * Register a file (a javascript module) and all its exported objects.\n * Specifically helpful for registering multiple functional components if you declare them without a function name\n * @param _this\n * @param _module\n */\n registerPackageModule(_module): void;\n}\n\nexport var DEFAULT_LIMIT = 12;\n\nexport function setDefaultPageLimit(limit: number)\n{\n DEFAULT_LIMIT = limit;\n}\n\nexport function autoLoadOntologyData(value: boolean)\n{\n _autoLoadOntologyData = value;\n //this may be set to true after some ontologies have already indexed,\n if (_autoLoadOntologyData)\n {\n // so in that case we load all data of ontologies that are already indexed\n ontologies.forEach((ontologyExport) => {\n //see linkedOntology() where we store the data loading method under the _load key\n if (ontologyExport['_load'])\n {\n ontologyExport['_load']();\n }\n });\n }\n}\n\n\nexport function linkedPackage(\n packageName: string,\n options?: {baseUri?: string},\n): LinkedPackageObject\n{\n // Declare the package's publish root before any shape/metadata IRI is built.\n // The slug is derived from `packageName`; only `baseUri` is configurable — CN\n // injects a workspace-scoped root for private packages, first-party packages\n // default to linked.cm.\n setPackagePublishConfig(packageName, options);\n let packageMetadata = registerPackageMetadata(packageName);\n let packageTreeObject = registerPackageInTree(packageName);\n\n //#Create declarators for this module\n let registerPackageExport = function(object) {\n // Plan-011 §I2 interim — \"Key X was already defined\" warning silenced\n // until the duplicate-instance root cause is investigated. With Vite\n // SSR resolving workspace packages from src/, package.ts evaluates\n // twice and every export key trips this warning. The overwrite is\n // safe because the second registration is the same class.\n packageTreeObject[object.name] = object;\n };\n\n let registerInPackageTree = function(exportName,exportedObject) {\n packageTreeObject[exportName] = exportedObject;\n };\n\n function registerPackageModule(_module): void\n {\n for (var key in _module.exports)\n {\n //if the exported object itself is not named or its name is _wrappedComponent\n //then we give it the same name as it's export name.\n if (\n !_module.exports[key].name ||\n _module.exports[key].name === '_wrappedComponent'\n )\n {\n Object.defineProperty(_module.exports[key],'name',{value: key});\n //manual 'hack' to set the name of the original function\n if (\n _module.exports[key]['original'] &&\n !_module.exports[key]['original']['name']\n )\n {\n Object.defineProperty(_module.exports[key]['original'],'name',{\n value: key + '_implementation',\n });\n }\n }\n registerInPackageTree(key,_module.exports[key]);\n }\n }\n\n //create a declarator function which Components of this module can use register themselves and add themselves to the global tree\n let linkedUtil = function(constructor) {\n //add the component class of this module to the global tree\n registerPackageExport(constructor);\n\n //return the original class without modifications\n return constructor;\n };\n\n // helper that contains the previous body; applies the decorator work to a given constructor\n function applyLinkedShape<T extends typeof Shape>(\n constructor: T,\n options?: ShapeConfig,\n ): void\n {\n if(!constructor) {\n throw new Error('Constructor is undefined, skipping registration: '+constructor?.toString().substring(0,100)+' '+JSON.stringify(options));\n return;\n }\n // add the component class of this module to the global tree\n registerPackageExport(constructor);\n\n // register the component and its shape\n Shape.registerByType(constructor);\n\n // Track the un-sanitized package name on the constructor so consumers\n // (e.g. LincdServerProxy) can route backend calls using the real module\n // specifier (e.g. '@_linked/server'), not the lossy URI-sanitized form\n // ('-_linked-server' — non-recoverable via decodeURIComponent).\n if (!Object.getOwnPropertyNames(constructor).includes('packageName')) {\n (constructor as any).packageName = packageName;\n }\n\n // if no shape object has been attached to the constructor\n if (!Object.getOwnPropertyNames(constructor).includes('shape'))\n {\n // The shape's identity. An explicit name wins; otherwise the class name,\n // which is what every existing shape relies on.\n const shapeName = options?.name ?? constructor.name;\n\n // A class name ending in a digit, with no explicit name given, is almost\n // always a bundler disambiguating a collision — `BackendAPIStore2` when\n // the ontology term of the same name took the binding first. The shape\n // then registers under an IRI the rest of the system will never ask for,\n // and the only symptom is a 501 several layers away. Say so here, where\n // it is cheap and early.\n if (!options?.name && /\\d$/.test(constructor.name)) {\n console.warn(\n `[linked] Shape '${constructor.name}' in '${packageName}' has a name ending in a digit, ` +\n `which usually means a bundler renamed it to avoid a collision — often with the ` +\n `ontology term it targets. Its IRI will not match what consumers ask for. ` +\n `Pass an explicit name: @linkedShape({name: '...'}).`,\n );\n }\n\n // create a new node shape (plain metadata object) for this shapeClass\n const nodeShape: NodeShapeData = createNodeShapeData(\n getNodeShapeUri(packageName, shapeName),\n );\n // connect the typescript class to its NodeShape\n constructor.shape = nodeShape;\n // set the name\n nodeShape.label = shapeName;\n\n if (options)\n {\n if (options.description)\n {\n nodeShape.description = options.description;\n }\n if (options.dependent)\n {\n nodeShape.dependent = true;\n }\n if (options.closed !== undefined)\n {\n nodeShape.closed = options.closed;\n }\n if (options.ignoredProperties)\n {\n nodeShape.ignoredProperties = options.ignoredProperties;\n }\n }\n\n // also keep track of the reverse: nodeShape to typescript class\n addNodeShapeToShapeClass(nodeShape,constructor);\n\n //track what extends what (nodeShape level)\n const extendingShapeClass = Object.getPrototypeOf(\n constructor,\n ) as typeof Shape;\n const extendingShape = extendingShapeClass.shape;\n //if this shape class is extending something other then Shape\n if (extendingShape && !(extendingShapeClass === Shape)) {\n //store which nodeShape this nodeShape extends\n nodeShape.extends = {id: extendingShape.id};\n }\n \n\n // run deferred callbacks from property decorators\n if (constructor['shapeCallbacks'])\n {\n constructor['shapeCallbacks'].forEach((callback) => {\n callback(nodeShape);\n });\n const nodeCallbacks = getAndClearCallbacks(nodeShape.id);\n if(nodeCallbacks) {\n nodeCallbacks.forEach((callback) => {\n callback(nodeShape);\n });\n }\n delete constructor['shapeCallbacks'];\n }\n }\n else\n {\n console.warn('This ShapeClass already has a shape: ',constructor.shape);\n }\n\n if (constructor.targetClass)\n {\n (constructor.shape as NodeShapeData).targetClass = constructor.targetClass;\n }\n\n // return the original class without modifications\n // return constructor;\n }\n\n // Overloaded signatures to support both usages\n function linkedShape<T extends typeof Shape>(constructor: T): void;\n function linkedShape<T extends typeof Shape>(\n options?: ShapeConfig,\n ): (constructor: T) => void;\n function linkedShape(arg?: any): void | ((constructor: any) => void)\n {\n // usage as @linkedShape\n if (typeof arg === 'function')\n {\n applyLinkedShape(arg);\n return;\n }\n // usage as @linkedShape({...}) or @linkedShape()\n const options: ShapeConfig | undefined = arg;\n return function <T extends typeof Shape>(constructor: T): void {\n applyLinkedShape(constructor,options);\n };\n }\n\n /**\n *\n * @param exports all exports of the file, simply provide \"this\" as value!\n * @param dataSource the path leading to the ontology's data file\n * @param nameSpace the base URI of the ontology\n * @param prefixAndFileName the file name MUST match the prefix for this ontology\n */\n let linkedOntology = function(\n exports,\n nameSpace: (term: string) => NodeReferenceValue,\n prefixAndFileName: string,\n loadData?,\n dataSource?: string | string[],\n ) {\n let exportsCopy = {...exports};\n //store specifics in exports. And make sure we can detect this as an ontology later\n exportsCopy['_ns'] = nameSpace;\n exportsCopy['_prefix'] = prefixAndFileName;\n exportsCopy['_load'] = loadData;\n exportsCopy['_data'] = dataSource;\n\n //register the prefix here (so just calling linkedOntology with a prefix will automatically register that prefix)\n if (prefixAndFileName)\n {\n //run the namespace without any term name, this will give back a named node with just the namespace as URI, then get that URI to provide it as full URI\n Prefix.add(prefixAndFileName,nameSpace('').id);\n }\n\n ontologies.add(exportsCopy);\n //register all the exports under the prefix. NOTE: this means the file name HAS to match the prefix\n registerInPackageTree(prefixAndFileName,exportsCopy);\n // });\n\n if (_autoLoadOntologyData)\n {\n loadData().catch((err) => {\n console.warn(\n 'Could not load ontology data. Do you need to rebuild the module of the ' +\n prefixAndFileName +\n ' ontology?',\n err,\n );\n });\n }\n };\n\n /**\n * This method is used to get a shape class in this package by its name.\n * This can be used to avoid circular dependencies between shapes.\n * @param name\n */\n let getPackageShape = (name: string): ShapeConstructor | undefined => {\n //get the named node of the node shape first,\n //then get the shape class that defines this node shape\n return getShapeClass(\n getNodeShapeUri(packageName, name),\n );\n };\n\n //return the declarators so the module can use them\n return {\n linkedShape,\n linkedUtil,\n linkedOntology,\n registerPackageExport,\n registerPackageModule,\n getPackageShape,\n packageExports: packageTreeObject,\n packageName: packageName,\n packageMetadata,\n } as LinkedPackageObject;\n}\n\nfunction registerPackageInTree(packageName,packageExports?)\n{\n //if something with this name already registered in the global tree\n if (packageName in _linked._modules)\n {\n // Plan-011 §I2 interim — silenced until the duplicate-Linked-instance\n // root cause is investigated. Vite SSR resolving workspace packages\n // from src/ for HMR causes each package.ts to evaluate twice, so this\n // warning fired ~80x per boot. Same package, same exports — the\n // Object.assign below preserves the registry correctly.\n Object.assign(_linked._modules[packageName],packageExports);\n }\n else\n {\n //initiate an empty object for this module in the global tree\n _linked._modules[packageName] = packageExports || {};\n }\n return _linked._modules[packageName];\n}\n\nfunction registerPackageMetadata(packageName: string): PackageMetadata\n{\n if (!_linked._packages)\n {\n _linked._packages = {};\n }\n if (packageName in _linked._packages)\n {\n return _linked._packages[packageName];\n }\n const packageMetadata: PackageMetadata = {\n id: getPackageUri(packageName),\n packageName,\n type: coreOntology.Package,\n };\n _linked._packages[packageName] = packageMetadata;\n return packageMetadata;\n}\n\n\nexport function initTree()\n{\n let globalObject =\n typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : undefined;\n // Idempotent: if the global tree is already set up (by another copy of\n // this Package.ts in the same Node process — structural under Vite SSR,\n // which evaluates the file once for its own SSR transform AND once via\n // Node's resolver when a non-Vite import path reaches @_linked/core),\n // attach to it instead of throwing. Both instances write the same\n // _modules / _packages registry shape.\n //\n // Legacy `lincd` package's Package.ts (separate file) still throws on\n // dup — that throw signals a REAL problem (legacy `lincd` should never\n // load in a clean post-eradication state).\n if (!('_linked' in globalObject))\n {\n globalObject['_linked'] = {_modules: {}, _packages: {}};\n }\n}\n\n//when this file is used, make sure the tree is initialized\ninitTree();\n\n//now that this file is set up, we can link linked shapes in the core module itself\nexport const corePackage = linkedPackage('@_linked/core');\n// NodeShape, PropertyShape and List share their names with ontology terms (shacl.NodeShape,\n// shacl.PropertyShape, rdf.List), so a bundler may rename the classes. Explicit names keep\n// their IRIs independent of that.\ncorePackage.linkedShape({\n name: 'NodeShape',\n description:\n 'Represents a SHACL NodeShape; defines constraints for a class of RDF nodes. Links to multiple PropertyShapes. (schema, constraint, class validation)',\n})(NodeShape);\ncorePackage.linkedShape({\n name: 'PropertyShape',\n description:\n 'Represents a SHACL PropertyShape; specifies rules for one property of a NodeShape (path, datatype, cardinality). (validation rule, property constraint)',\n // A property shape has no independent existence — it is owned by its NodeShape via the\n // `contains` sh:property edge, so deleting the NodeShape cascade-deletes it.\n dependent: true,\n})(PropertyShape);\n// List is registered here, by value, because PropertyShape.in below uses it as its value\n// shape. Naming it by string instead would leave it unregistered for anyone who loads the\n// SHACL metamodel without importing shapes/List (backlog 045).\ncorePackage.linkedShape({\n name: 'List',\n dependent: true,\n})(List);\n// ValidationReport / ValidationResult removed in core metadata rewrite\n\n//ALL the following is to support Shape having get/set methods with property shapes\n//and Shape itself having a nodeShape\n//if we dont need Shape to have get/set methods (like label and type) then this can be removed\n// Base Shape IRI follows the same scheme as every other core shape:\n// https://linked.cm/shape/core/Shape (corePackage above declared slug 'core').\nShape.shape = createNodeShapeData(\n getNodeShapeUri('@_linked/core', 'Shape'),\n);\naddNodeShapeToShapeClass(Shape.shape,Shape);\n\n//Here we can register the properties of the Shape class itself\n//We can't do that inside of Shape because it would cause circular dependencies\ncreatePropertyShape({\n path: rdfs.label,\n //TODO: multiple labels should be possible\n maxCount: 1,//currently get label is implemented to return a single value\n },\n 'label',\n shacl.Literal,\n Shape,\n);\ncreatePropertyShape(\n {\n path: rdf.type,\n shape: Shape,\n },\n 'type',\n shacl.IRI,\n Shape,\n);\n\ncreatePropertyShape(\n {\n path: shacl.property,\n shape: PropertyShape,\n contains: true, // a NodeShape owns its property shapes (cascade on delete)\n },\n 'properties',\n shacl.IRI,\n NodeShape,\n);\n\ncreatePropertyShape({\n path: rdfs.comment,\n maxCount: 1,\n },'description',shacl.Literal, NodeShape);\n\ncreatePropertyShape({\n path: rdf.type,\n maxCount: 1,\n shape: Shape,\n},'type',shacl.IRI, NodeShape);\n\ncreatePropertyShape(\n {\n path: shacl.targetClass,\n shape: Shape, //should be rdfs Class, but that's currently not available in LINCD. So queries currently cannot continue after accessing targetClass\n maxCount: 1,\n },\n 'targetClass',\n shacl.IRI,\n NodeShape,\n);\n\ncreatePropertyShape({\n path: shacl.targetNode,\n shape: Shape,//actually returns a NamedNode... is this correct then? Should we define or use a rdfs Class that matches the potential values?\n},'targetNode',shacl.IRI, NodeShape);\n\ncreatePropertyShape({\n path: coreOntology.isExtending,\n shape: NodeShape,\n},'extends',shacl.IRI, NodeShape);\n\n//currently path accepts multiple values, so its a multi-value property\n//these values will be consequent properties that follow each other. Other property paths are not supported yet.\ncreatePropertyShape(\n {\n // No fixed valueShape: sh:path is polymorphic (a predicate IRI, an rdf:List for a\n // sequence, or a PathNode for inverse/alt/cardinality). Omitting valueShape lets the\n // create pipeline use each value's own shape. Simple paths are passed as\n // {id} node references, complex paths as List/PathNode node-data.\n path: shacl.path,\n contains: true, // a property shape owns its complex path structure (List/PathNode)\n },\n 'path',\n shacl.IRI,\n PropertyShape,\n);\n\ncreatePropertyShape(\n {\n path: shacl.node,\n shape: NodeShape,\n maxCount: 1,\n },\n 'valueShape',\n shacl.IRI,\n PropertyShape,\n);\n\ncreatePropertyShape(\n {\n maxCount: 1,\n path: shacl.nodeKind,\n shape: Shape, //actually returns a NamedNode. Queries currently cannot continue after accessing nodeKind\n },\n 'nodeKind',\n shacl.IRI,\n PropertyShape,\n);\n\ncreatePropertyShape(\n {\n path: shacl.datatype,\n shape: Shape,\n maxCount: 1,\n },\n 'datatype',\n shacl.IRI,\n PropertyShape,\n);\n\n//PropertyShape.maxCount\ncreatePropertyShape(\n {\n path: shacl.maxCount,\n datatype: xsd.integer,\n maxCount: 1,\n },\n 'maxCount',\n shacl.Literal,\n PropertyShape,\n);\n\n//PropertyShape.minCount\ncreatePropertyShape(\n {\n path: shacl.minCount,\n datatype: xsd.integer,\n maxCount: 1,\n },\n 'minCount',\n shacl.Literal,\n PropertyShape,\n);\n\n//PropertyShape.name\ncreatePropertyShape(\n {\n path: shacl.name,\n maxCount: 1,\n },\n 'name',\n shacl.Literal,\n PropertyShape,\n);\n\n//PropertyShape.description\ncreatePropertyShape(\n {\n path: shacl.description,\n maxCount: 1,\n },\n 'description',\n shacl.Literal,\n PropertyShape,\n);\n\n// ---------------------------------------------------------------------------\n// Remaining SHACL meta-model accessors for shape serialization.\n// Labels match the PropertyShapeData / NodeShapeData fields so syncShapes() can\n// build the create-pipeline data directly. `sh:in` is owned (contains, valueShape List).\n// ---------------------------------------------------------------------------\n\n// PropertyShape.class\ncreatePropertyShape(\n {path: shacl.class, shape: Shape, maxCount: 1},\n 'class',\n shacl.IRI,\n PropertyShape,\n);\n\n// PropertyShape.in → an rdf:List (owned)\ncreatePropertyShape(\n {path: shacl.in, shape: List, maxCount: 1, contains: true},\n 'in',\n shacl.IRI,\n PropertyShape,\n);\n\n// PropertyShape pair constraints (values are property IRIs)\n// Labelled `equalsConstraint`, not `equals`: `equals` is a query-builder method, so a\n// property under that label is unreachable through the DSL (backlog 041). The name also\n// matches the `PropertyShapeData` field. The predicate stays sh:equals.\ncreatePropertyShape({path: shacl.equals, shape: Shape, maxCount: 1}, 'equalsConstraint', shacl.IRI, PropertyShape);\ncreatePropertyShape({path: shacl.disjoint, shape: Shape, maxCount: 1}, 'disjoint', shacl.IRI, PropertyShape);\ncreatePropertyShape({path: shacl.lessThan, shape: Shape, maxCount: 1}, 'lessThan', shacl.IRI, PropertyShape);\ncreatePropertyShape(\n {path: shacl.lessThanOrEquals, shape: Shape, maxCount: 1},\n 'lessThanOrEquals',\n shacl.IRI,\n PropertyShape,\n);\n\n// PropertyShape.hasValue (literal or IRI — generic)\ncreatePropertyShape({path: shacl.hasValue, maxCount: 1}, 'hasValue', null, PropertyShape);\n\n// PropertyShape.defaultValue (literal or IRI — generic, mirrors hasValue).\n// getResult() already emits `defaultValue`, but without this registration the\n// property is not queryable and a query referencing it throws before executing.\ncreatePropertyShape({path: shacl.defaultValue, maxCount: 1}, 'defaultValue', null, PropertyShape);\n\n// PropertyShape value-range / string-length / pattern constraints (report 021 §3, G5).\n// The range constraints carry no fixed datatype — the literal is typed from the JS value\n// (integer/double), mirroring the constrained property's own datatype. Length is an integer;\n// pattern is the regex source string.\ncreatePropertyShape({path: shacl.minInclusive, maxCount: 1}, 'minInclusive', shacl.Literal, PropertyShape);\ncreatePropertyShape({path: shacl.maxInclusive, maxCount: 1}, 'maxInclusive', shacl.Literal, PropertyShape);\ncreatePropertyShape({path: shacl.minExclusive, maxCount: 1}, 'minExclusive', shacl.Literal, PropertyShape);\ncreatePropertyShape({path: shacl.maxExclusive, maxCount: 1}, 'maxExclusive', shacl.Literal, PropertyShape);\ncreatePropertyShape(\n {path: shacl.minLength, datatype: xsd.integer, maxCount: 1},\n 'minLength',\n shacl.Literal,\n PropertyShape,\n);\ncreatePropertyShape(\n {path: shacl.maxLength, datatype: xsd.integer, maxCount: 1},\n 'maxLength',\n shacl.Literal,\n PropertyShape,\n);\ncreatePropertyShape(\n {path: shacl.pattern, datatype: xsd.string, maxCount: 1},\n 'pattern',\n shacl.Literal,\n PropertyShape,\n);\n\n// PropertyShape.order / group\ncreatePropertyShape(\n {path: shacl.order, datatype: xsd.integer, maxCount: 1},\n 'order',\n shacl.Literal,\n PropertyShape,\n);\ncreatePropertyShape({path: shacl.group, maxCount: 1}, 'group', shacl.Literal, PropertyShape);\n\n// PropertyShape.displayRank / displayHidden (core: display vocabulary).\n// These materialize onto the pure sh:NodeShape and so travel with an ejected app.\ncreatePropertyShape(\n {path: coreOntology.displayRank, datatype: xsd.integer, maxCount: 1},\n 'displayRank',\n shacl.Literal,\n PropertyShape,\n);\ncreatePropertyShape(\n {path: coreOntology.displayHidden, datatype: xsd.boolean, maxCount: 1},\n 'displayHidden',\n shacl.Literal,\n PropertyShape,\n);\n\n// PropertyShape.contains (core:contains — persists the composition flag)\ncreatePropertyShape(\n {path: coreOntology.contains, datatype: xsd.boolean, maxCount: 1},\n 'contains',\n shacl.Literal,\n PropertyShape,\n);\n\n// NodeShape.closed / ignoredProperties / dependent\ncreatePropertyShape(\n {path: shacl.closed, datatype: xsd.boolean, maxCount: 1},\n 'closed',\n shacl.Literal,\n NodeShape,\n);\ncreatePropertyShape(\n {path: shacl.ignoredProperties, shape: Shape},\n 'ignoredProperties',\n shacl.IRI,\n NodeShape,\n);\ncreatePropertyShape(\n {path: coreOntology.dependent, datatype: xsd.boolean, maxCount: 1},\n 'dependent',\n shacl.Literal,\n NodeShape,\n);\n\n// NodeShape.targetObjectsOf (sh:targetObjectsOf — values are predicate IRIs),\n// NodeShape.generated (core:generated — marks a shape core generates at sync time,\n// e.g. the `<propertyShape>.singleOwner` constraint, so catalog readers can skip it) and\n// NodeShape.generatedShapes (core:generatedShape — the shape owns the shapes generated from\n// it: `contains`, so deleting the shape deletes them).\ncreatePropertyShape(\n {path: shacl.targetObjectsOf, shape: Shape},\n 'targetObjectsOf',\n shacl.IRI,\n NodeShape,\n);\ncreatePropertyShape(\n {path: coreOntology.generated, datatype: xsd.boolean, maxCount: 1},\n 'generated',\n shacl.Literal,\n NodeShape,\n);\ncreatePropertyShape(\n {path: coreOntology.generatedShape, shape: NodeShape, contains: true},\n 'generatedShapes',\n shacl.IRI,\n NodeShape,\n);\n"]}
1
+ {"version":3,"file":"Package.js","sourceRoot":"","sources":["../../../src/utils/Package.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,uBAAuB,EACvB,SAAS,EACT,aAAa,GACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAC,mBAAmB,EAAqB,MAAM,4BAA4B,CAAC;AACnF,OA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AAE,IAAI,EAAC,EACrE,iBAAiB,EACjB,KAAK,CAAC,GAAG,EACT,SAAS,CACV,CAAC;AAEF,mFAAmF;AACnF,2EAA2E;AAC3E,+FAA+F;AAC/F,8FAA8F;AAC9F,iGAAiG;AACjG,wHAAwH;AACxH,mBAAmB,CACjB,EAAC,IAAI,EAAE,KAAK,CAAC,mBAAmB,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,cAAc,EAAC,EAChG,qBAAqB,EACrB,KAAK,CAAC,cAAc,EACpB,aAAa,CACd,CAAC;AACF,mBAAmB,CACjB,EAAC,IAAI,EAAE,KAAK,CAAC,iBAAiB,EAAE,QAAQ,EAAE,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAC,EACnE,mBAAmB,EACnB,KAAK,CAAC,OAAO,EACb,aAAa,CACd,CAAC;AACF,mBAAmB,CACjB,EAAC,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,EAAC,EAC9C,OAAO,EACP,KAAK,CAAC,GAAG,EACT,SAAS,CACV,CAAC;AACF,mBAAmB,CACjB,EAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,cAAc,EAAC;AAC7D,2EAA2E;AAC3E,UAAU,EACV,KAAK,CAAC,cAAc,EACpB,SAAS,CACV,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 {\n createPropertyShape,\n getAndClearCallbacks,\n getNodeShapeUri,\n getPackageUri,\n setPackagePublishConfig,\n NodeShape,\n PropertyShape,\n} from '../shapes/SHACL.js';\nimport {createNodeShapeData, type NodeShapeData} from '../shapes/nodeShapeData.js';\nimport {Shape, type ShapeConstructor} from '../shapes/Shape.js';\nimport {List} from '../shapes/List.class.js';\nimport {Prefix} from './Prefix.js';\nimport {coreOntology} from '../ontologies/linked-core.js';\nimport {rdf} from '../ontologies/rdf.js';\nimport {addNodeShapeToShapeClass,getShapeClass} from './ShapeClass.js';\nimport {shacl} from '../ontologies/shacl.js';\nimport {rdfs} from '../ontologies/rdfs.js';\nimport {xsd} from '../ontologies/xsd.js';\nimport type {NodeReferenceValue} from './NodeReference.js';\n\n//global tree\ndeclare var _linked: any;\ndeclare var window;\ndeclare var global;\n\n\n// var packageParsePromises: Map<string,Promise<any>> = new Map();\n// var loadedPackages: Set<NamedNode> = new Set();\nlet ontologies: Set<any> = new Set();\nlet _autoLoadOntologyData = false;\n/**\n * a map of requested property shapes for specific nodes\n * The value is a promise if it's still loading, or true if it is fully loaded\n */\n// type ClassDecorator = <T extends {new (...args: any[]): {}}>(\n// constructor: T,\n// ) => T;\n\nexport type ShapeConfig = {\n /**\n * The name this shape is identified by, overriding the class name.\n *\n * A shape's IRI is `<baseUri>shape/<package>/<name>`, and `Server.call`\n * routes on it — so the name is persisted data, not a label. Taking it from\n * `constructor.name` couples that data to how the code was compiled: a\n * minifier renames the class, and so does a plain name collision, because a\n * shape and the ontology term it targets deliberately share a name. Either\n * one silently changes what the shape *is*.\n *\n * Optional, and defaults to `constructor.name`, so existing shapes are\n * unaffected. Set it where the identity has to outlive the build.\n */\n name?: string;\n /**\n * A short description of the shape, what it represents and what it is used for.\n * will be stored as rdfs:comment on the shape node\n */\n description?: string;\n /**\n * @deprecated No effect on deletes. Ownership is per property: every node a `contains`\n * property reaches is deleted with its owner, whether or not its shape is\n * `dependent`. Still accepted and persisted (`core:dependent`) by shape sync.\n */\n dependent?: boolean;\n /**\n * Close the shape (sh:closed): target nodes with properties outside this shape are invalid.\n */\n closed?: boolean;\n /**\n * Properties permitted in addition to the declared ones when the shape is closed\n * (sh:ignoredProperties).\n */\n ignoredProperties?: NodeReferenceValue[];\n};\n\nexport type PackageMetadata = {\n id: string;\n packageName: string;\n type: NodeReferenceValue;\n};\n\n/**\n * This object, returned by [linkedPackage()](/docs/lincd.js/modules/utils_Module#linkedPackage),\n * contains the decorators to link different parts of a LINCD module.\n */\nexport interface LinkedPackageObject\n{\n /**\n * Links a typescript class to a SHACL shape.\n * This decorator creates a SHACL shape and looks at the static property [targetClass](/docs/lincd.js/classes/shapes_Shape.Shape#targetclass)\n * The rest of the shape is typically 'shaped' by methods that use [property decorators](/docs/lincd.js/modules/utils_ShapeDecorators).\n *\n * @example\n * Example of a typescript class using the \\@linkedShape decorator:\n * ```tsx\n * @linkedShape\n * export class Person extends Shape { ... }\n * ```\n * Or with options:\n * ```tsx\n * @linkedShape({ description: \"...\" })\n * export class Person extends Shape { ... }\n * ```\n */\n linkedShape: {\n <T extends typeof Shape>(constructor: T): void;\n <T extends typeof Shape>(config?: ShapeConfig): (constructor: T) => void;\n };\n /**\n * Use this decorator to make any other classes or functions available on demand to other LINCD modules.\n * It does not change the object it is applied on.\n * This is specifically required for their use in an open-ended LINCD application.\n *\n * @example\n * An example helper utility using the \\@linkedUtil decorator:\n * ```tsx\n * @linkedUtil\n * export class Sort {\n * static byName(persons:Person[]) {\n * return persons.sort((p1,p2) => p1.name < p2.name ? -1 : 1)\n * }\n * ```\n */\n linkedUtil: (constructor: any) => any;\n /**\n * Used to notify LINCD.js of an ontology.\n * See also the [Ontology guides](/docs/guides/linked-code/ontologies).\n *\n * @param allFileExports - all the objects that are exported by the ontology file (use `import * as _this from \"./path-to-this-file\")`)\n * @param nameSpace - the result of [createNameSpace](/docs/lincd.js/modules/utils_NameSpace#createnamespace). This allows consumers to generate NamedNodes that may not be listed in this ontology if needed\n * @param prefixAndFileName - a suggested prefix chosen by you. Make sure the suggestedPrefix matches the file name and the name of the exported object that groups all entities together\n * @param loadDataFunction - a method that loads _and parses_ the raw ontology data. This means the ontology will be loaded into the local graph. The returned result is mostly a JSONLDParsePromise (from lincd-jsonld/JSONLD, not bundled in LINCD.js)\n * @param dataSource - the relative path to the raw data of the ontology\n * @example\n * Example of an Ontology File that used linkedOntology()\n * ```tsx\n * import {NamedNode} from 'lincd/models';\n * import {JSONLD} from 'lincd-jsonld/JSONLD';\n * import {createNameSpace} from 'lincd/utils/NameSpace';\n * import {linkedOntology} from '../package.js';\n * import * as _this from './my.js-ontology';\n *\n * let dataFile = '../data/my.js-ontology.json';\n * export var loadData = () => JSONLD.parsePromise(import(dataFile));\n *\n * export var ns = createNameSpace('http://www.my-ontology.com/');\n *\n * export var _self: NamedNode = ns('');\n *\n * // Classes\n * export var ExampleClass: NamedNode = ns('ExampleClass');\n *\n * // Properties\n * export var exampleProperty: NamedNode = ns('exampleProperty');\n *\n * export const myOntology = {\n * ExampleClass,\n * exampleProperty,\n * };\n *\n * linkedOntology(_this, ns, 'myOntology', loadData, dataFile);\n * ```\n */\n linkedOntology: (\n allFileExports,\n nameSpace: (term: string) => NodeReferenceValue,\n suggestedPrefixAndFileName: string,\n loadDataFunction?: () => Promise<any>,\n dataSource?: string | string[],\n ) => void;\n /**\n * Low level method used by other decorators to write to the modules' object in the LINCD tree.\n * You should typically not need this.\n * @param exportFileName - the file name that this exported object is available under. Needs to be unique across the module.\n * @param exportedObject - the exported object (the class, constant, function, etc)\n */\n registerPackageExport: (exportedObject: any) => void;\n\n /**\n * Get a Shape subclass registered in this package by name.\n * Returns undefined if the shape is not registered or bundled.\n *\n * Useful for avoiding circular dependencies between shapes.\n * E.g. `getOneAs(..., getPackageShape('ImageObject'))` in Thing.ts\n * avoids importing ImageObject (which extends Thing).\n */\n getPackageShape: (name: string) => ShapeConstructor | undefined;\n /**\n * A reference to the modules' object in the LINCD tree.\n * Contains all linked components of the module.\n */\n packageExports: any;\n packageName: string;\n packageMetadata: PackageMetadata;\n\n /**\n * Register a file (a javascript module) and all its exported objects.\n * Specifically helpful for registering multiple functional components if you declare them without a function name\n * @param _this\n * @param _module\n */\n registerPackageModule(_module): void;\n}\n\nexport var DEFAULT_LIMIT = 12;\n\nexport function setDefaultPageLimit(limit: number)\n{\n DEFAULT_LIMIT = limit;\n}\n\nexport function autoLoadOntologyData(value: boolean)\n{\n _autoLoadOntologyData = value;\n //this may be set to true after some ontologies have already indexed,\n if (_autoLoadOntologyData)\n {\n // so in that case we load all data of ontologies that are already indexed\n ontologies.forEach((ontologyExport) => {\n //see linkedOntology() where we store the data loading method under the _load key\n if (ontologyExport['_load'])\n {\n ontologyExport['_load']();\n }\n });\n }\n}\n\n\nexport function linkedPackage(\n packageName: string,\n options?: {baseUri?: string},\n): LinkedPackageObject\n{\n // Declare the package's publish root before any shape/metadata IRI is built.\n // The slug is derived from `packageName`; only `baseUri` is configurable — CN\n // injects a workspace-scoped root for private packages, first-party packages\n // default to linked.cm.\n setPackagePublishConfig(packageName, options);\n let packageMetadata = registerPackageMetadata(packageName);\n let packageTreeObject = registerPackageInTree(packageName);\n\n //#Create declarators for this module\n let registerPackageExport = function(object) {\n // Plan-011 §I2 interim — \"Key X was already defined\" warning silenced\n // until the duplicate-instance root cause is investigated. With Vite\n // SSR resolving workspace packages from src/, package.ts evaluates\n // twice and every export key trips this warning. The overwrite is\n // safe because the second registration is the same class.\n packageTreeObject[object.name] = object;\n };\n\n let registerInPackageTree = function(exportName,exportedObject) {\n packageTreeObject[exportName] = exportedObject;\n };\n\n function registerPackageModule(_module): void\n {\n for (var key in _module.exports)\n {\n //if the exported object itself is not named or its name is _wrappedComponent\n //then we give it the same name as it's export name.\n if (\n !_module.exports[key].name ||\n _module.exports[key].name === '_wrappedComponent'\n )\n {\n Object.defineProperty(_module.exports[key],'name',{value: key});\n //manual 'hack' to set the name of the original function\n if (\n _module.exports[key]['original'] &&\n !_module.exports[key]['original']['name']\n )\n {\n Object.defineProperty(_module.exports[key]['original'],'name',{\n value: key + '_implementation',\n });\n }\n }\n registerInPackageTree(key,_module.exports[key]);\n }\n }\n\n //create a declarator function which Components of this module can use register themselves and add themselves to the global tree\n let linkedUtil = function(constructor) {\n //add the component class of this module to the global tree\n registerPackageExport(constructor);\n\n //return the original class without modifications\n return constructor;\n };\n\n // helper that contains the previous body; applies the decorator work to a given constructor\n function applyLinkedShape<T extends typeof Shape>(\n constructor: T,\n options?: ShapeConfig,\n ): void\n {\n if(!constructor) {\n throw new Error('Constructor is undefined, skipping registration: '+constructor?.toString().substring(0,100)+' '+JSON.stringify(options));\n return;\n }\n // add the component class of this module to the global tree\n registerPackageExport(constructor);\n\n // register the component and its shape\n Shape.registerByType(constructor);\n\n // Track the un-sanitized package name on the constructor so consumers\n // (e.g. LincdServerProxy) can route backend calls using the real module\n // specifier (e.g. '@_linked/server'), not the lossy URI-sanitized form\n // ('-_linked-server' — non-recoverable via decodeURIComponent).\n if (!Object.getOwnPropertyNames(constructor).includes('packageName')) {\n (constructor as any).packageName = packageName;\n }\n\n // if no shape object has been attached to the constructor\n if (!Object.getOwnPropertyNames(constructor).includes('shape'))\n {\n // The shape's identity. An explicit name wins; otherwise the class name,\n // which is what every existing shape relies on.\n const shapeName = options?.name ?? constructor.name;\n\n // A class name ending in a digit, with no explicit name given, is almost\n // always a bundler disambiguating a collision — `BackendAPIStore2` when\n // the ontology term of the same name took the binding first. The shape\n // then registers under an IRI the rest of the system will never ask for,\n // and the only symptom is a 501 several layers away. Say so here, where\n // it is cheap and early.\n if (!options?.name && /\\d$/.test(constructor.name)) {\n console.warn(\n `[linked] Shape '${constructor.name}' in '${packageName}' has a name ending in a digit, ` +\n `which usually means a bundler renamed it to avoid a collision — often with the ` +\n `ontology term it targets. Its IRI will not match what consumers ask for. ` +\n `Pass an explicit name: @linkedShape({name: '...'}).`,\n );\n }\n\n // create a new node shape (plain metadata object) for this shapeClass\n const nodeShape: NodeShapeData = createNodeShapeData(\n getNodeShapeUri(packageName, shapeName),\n );\n // connect the typescript class to its NodeShape\n constructor.shape = nodeShape;\n // set the name\n nodeShape.label = shapeName;\n\n if (options)\n {\n if (options.description)\n {\n nodeShape.description = options.description;\n }\n if (options.dependent)\n {\n nodeShape.dependent = true;\n }\n if (options.closed !== undefined)\n {\n nodeShape.closed = options.closed;\n }\n if (options.ignoredProperties)\n {\n nodeShape.ignoredProperties = options.ignoredProperties;\n }\n }\n\n // also keep track of the reverse: nodeShape to typescript class\n addNodeShapeToShapeClass(nodeShape,constructor);\n\n //track what extends what (nodeShape level)\n const extendingShapeClass = Object.getPrototypeOf(\n constructor,\n ) as typeof Shape;\n const extendingShape = extendingShapeClass.shape;\n //if this shape class is extending something other then Shape\n if (extendingShape && !(extendingShapeClass === Shape)) {\n //store which nodeShape this nodeShape extends\n nodeShape.extends = {id: extendingShape.id};\n }\n \n\n // run deferred callbacks from property decorators\n if (constructor['shapeCallbacks'])\n {\n constructor['shapeCallbacks'].forEach((callback) => {\n callback(nodeShape);\n });\n const nodeCallbacks = getAndClearCallbacks(nodeShape.id);\n if(nodeCallbacks) {\n nodeCallbacks.forEach((callback) => {\n callback(nodeShape);\n });\n }\n delete constructor['shapeCallbacks'];\n }\n }\n else\n {\n console.warn('This ShapeClass already has a shape: ',constructor.shape);\n }\n\n if (constructor.targetClass)\n {\n (constructor.shape as NodeShapeData).targetClass = constructor.targetClass;\n }\n\n // return the original class without modifications\n // return constructor;\n }\n\n // Overloaded signatures to support both usages\n function linkedShape<T extends typeof Shape>(constructor: T): void;\n function linkedShape<T extends typeof Shape>(\n options?: ShapeConfig,\n ): (constructor: T) => void;\n function linkedShape(arg?: any): void | ((constructor: any) => void)\n {\n // usage as @linkedShape\n if (typeof arg === 'function')\n {\n applyLinkedShape(arg);\n return;\n }\n // usage as @linkedShape({...}) or @linkedShape()\n const options: ShapeConfig | undefined = arg;\n return function <T extends typeof Shape>(constructor: T): void {\n applyLinkedShape(constructor,options);\n };\n }\n\n /**\n *\n * @param exports all exports of the file, simply provide \"this\" as value!\n * @param dataSource the path leading to the ontology's data file\n * @param nameSpace the base URI of the ontology\n * @param prefixAndFileName the file name MUST match the prefix for this ontology\n */\n let linkedOntology = function(\n exports,\n nameSpace: (term: string) => NodeReferenceValue,\n prefixAndFileName: string,\n loadData?,\n dataSource?: string | string[],\n ) {\n let exportsCopy = {...exports};\n //store specifics in exports. And make sure we can detect this as an ontology later\n exportsCopy['_ns'] = nameSpace;\n exportsCopy['_prefix'] = prefixAndFileName;\n exportsCopy['_load'] = loadData;\n exportsCopy['_data'] = dataSource;\n\n //register the prefix here (so just calling linkedOntology with a prefix will automatically register that prefix)\n if (prefixAndFileName)\n {\n //run the namespace without any term name, this will give back a named node with just the namespace as URI, then get that URI to provide it as full URI\n Prefix.add(prefixAndFileName,nameSpace('').id);\n }\n\n ontologies.add(exportsCopy);\n //register all the exports under the prefix. NOTE: this means the file name HAS to match the prefix\n registerInPackageTree(prefixAndFileName,exportsCopy);\n // });\n\n if (_autoLoadOntologyData)\n {\n loadData().catch((err) => {\n console.warn(\n 'Could not load ontology data. Do you need to rebuild the module of the ' +\n prefixAndFileName +\n ' ontology?',\n err,\n );\n });\n }\n };\n\n /**\n * This method is used to get a shape class in this package by its name.\n * This can be used to avoid circular dependencies between shapes.\n * @param name\n */\n let getPackageShape = (name: string): ShapeConstructor | undefined => {\n //get the named node of the node shape first,\n //then get the shape class that defines this node shape\n return getShapeClass(\n getNodeShapeUri(packageName, name),\n );\n };\n\n //return the declarators so the module can use them\n return {\n linkedShape,\n linkedUtil,\n linkedOntology,\n registerPackageExport,\n registerPackageModule,\n getPackageShape,\n packageExports: packageTreeObject,\n packageName: packageName,\n packageMetadata,\n } as LinkedPackageObject;\n}\n\nfunction registerPackageInTree(packageName,packageExports?)\n{\n //if something with this name already registered in the global tree\n if (packageName in _linked._modules)\n {\n // Plan-011 §I2 interim — silenced until the duplicate-Linked-instance\n // root cause is investigated. Vite SSR resolving workspace packages\n // from src/ for HMR causes each package.ts to evaluate twice, so this\n // warning fired ~80x per boot. Same package, same exports — the\n // Object.assign below preserves the registry correctly.\n Object.assign(_linked._modules[packageName],packageExports);\n }\n else\n {\n //initiate an empty object for this module in the global tree\n _linked._modules[packageName] = packageExports || {};\n }\n return _linked._modules[packageName];\n}\n\nfunction registerPackageMetadata(packageName: string): PackageMetadata\n{\n if (!_linked._packages)\n {\n _linked._packages = {};\n }\n if (packageName in _linked._packages)\n {\n return _linked._packages[packageName];\n }\n const packageMetadata: PackageMetadata = {\n id: getPackageUri(packageName),\n packageName,\n type: coreOntology.Package,\n };\n _linked._packages[packageName] = packageMetadata;\n return packageMetadata;\n}\n\n\nexport function initTree()\n{\n let globalObject =\n typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : undefined;\n // Idempotent: if the global tree is already set up (by another copy of\n // this Package.ts in the same Node process — structural under Vite SSR,\n // which evaluates the file once for its own SSR transform AND once via\n // Node's resolver when a non-Vite import path reaches @_linked/core),\n // attach to it instead of throwing. Both instances write the same\n // _modules / _packages registry shape.\n //\n // Legacy `lincd` package's Package.ts (separate file) still throws on\n // dup — that throw signals a REAL problem (legacy `lincd` should never\n // load in a clean post-eradication state).\n if (!('_linked' in globalObject))\n {\n globalObject['_linked'] = {_modules: {}, _packages: {}};\n }\n}\n\n//when this file is used, make sure the tree is initialized\ninitTree();\n\n//now that this file is set up, we can link linked shapes in the core module itself\nexport const corePackage = linkedPackage('@_linked/core');\n// NodeShape, PropertyShape and List share their names with ontology terms (shacl.NodeShape,\n// shacl.PropertyShape, rdf.List), so a bundler may rename the classes. Explicit names keep\n// their IRIs independent of that.\ncorePackage.linkedShape({\n name: 'NodeShape',\n description:\n 'Represents a SHACL NodeShape; defines constraints for a class of RDF nodes. Links to multiple PropertyShapes. (schema, constraint, class validation)',\n})(NodeShape);\ncorePackage.linkedShape({\n name: 'PropertyShape',\n description:\n 'Represents a SHACL PropertyShape; specifies rules for one property of a NodeShape (path, datatype, cardinality). (validation rule, property constraint)',\n // Owned by its NodeShape through the `contains` sh:property edge: deleting the NodeShape\n // deletes it.\n})(PropertyShape);\n// List is registered here, by value, because PropertyShape.in below uses it as its value\n// shape. Naming it by string instead would leave it unregistered for anyone who loads the\n// SHACL metamodel without importing shapes/List (backlog 045).\ncorePackage.linkedShape({\n name: 'List',\n})(List);\n// ValidationReport / ValidationResult removed in core metadata rewrite\n\n//ALL the following is to support Shape having get/set methods with property shapes\n//and Shape itself having a nodeShape\n//if we dont need Shape to have get/set methods (like label and type) then this can be removed\n// Base Shape IRI follows the same scheme as every other core shape:\n// https://linked.cm/shape/core/Shape (corePackage above declared slug 'core').\nShape.shape = createNodeShapeData(\n getNodeShapeUri('@_linked/core', 'Shape'),\n);\naddNodeShapeToShapeClass(Shape.shape,Shape);\n\n//Here we can register the properties of the Shape class itself\n//We can't do that inside of Shape because it would cause circular dependencies\ncreatePropertyShape({\n path: rdfs.label,\n //TODO: multiple labels should be possible\n maxCount: 1,//currently get label is implemented to return a single value\n },\n 'label',\n shacl.Literal,\n Shape,\n);\ncreatePropertyShape(\n {\n path: rdf.type,\n shape: Shape,\n },\n 'type',\n shacl.IRI,\n Shape,\n);\n\ncreatePropertyShape(\n {\n path: shacl.property,\n shape: PropertyShape,\n contains: true, // a NodeShape owns its property shapes (cascade on delete)\n },\n 'properties',\n shacl.IRI,\n NodeShape,\n);\n\ncreatePropertyShape({\n path: rdfs.comment,\n maxCount: 1,\n },'description',shacl.Literal, NodeShape);\n\ncreatePropertyShape({\n path: rdf.type,\n maxCount: 1,\n shape: Shape,\n},'type',shacl.IRI, NodeShape);\n\ncreatePropertyShape(\n {\n path: shacl.targetClass,\n shape: Shape, //should be rdfs Class, but that's currently not available in LINCD. So queries currently cannot continue after accessing targetClass\n maxCount: 1,\n },\n 'targetClass',\n shacl.IRI,\n NodeShape,\n);\n\ncreatePropertyShape({\n path: shacl.targetNode,\n shape: Shape,//actually returns a NamedNode... is this correct then? Should we define or use a rdfs Class that matches the potential values?\n},'targetNode',shacl.IRI, NodeShape);\n\ncreatePropertyShape({\n path: coreOntology.isExtending,\n shape: NodeShape,\n},'extends',shacl.IRI, NodeShape);\n\n//currently path accepts multiple values, so its a multi-value property\n//these values will be consequent properties that follow each other. Other property paths are not supported yet.\ncreatePropertyShape(\n {\n // No fixed valueShape: sh:path is polymorphic (a predicate IRI, a PathList for a\n // sequence, or a PathNode for inverse/alt/cardinality). Omitting valueShape lets the\n // create pipeline use each value's own shape. Simple paths are passed as\n // {id} node references, complex paths as PathList/PathNode node-data.\n path: shacl.path,\n // Not `contains`: a predicate path is a shared IRI. A complex path's operator node or\n // sequence list is written without an id, so it becomes a blank node, as SHACL requires,\n // and the blank-node cascade deletes it with the property shape.\n nodeKind: shacl.BlankNodeOrIRI,\n },\n 'path',\n shacl.IRI,\n PropertyShape,\n);\n\ncreatePropertyShape(\n {\n path: shacl.node,\n shape: NodeShape,\n maxCount: 1,\n },\n 'valueShape',\n shacl.IRI,\n PropertyShape,\n);\n\ncreatePropertyShape(\n {\n maxCount: 1,\n path: shacl.nodeKind,\n shape: Shape, //actually returns a NamedNode. Queries currently cannot continue after accessing nodeKind\n },\n 'nodeKind',\n shacl.IRI,\n PropertyShape,\n);\n\ncreatePropertyShape(\n {\n path: shacl.datatype,\n shape: Shape,\n maxCount: 1,\n },\n 'datatype',\n shacl.IRI,\n PropertyShape,\n);\n\n//PropertyShape.maxCount\ncreatePropertyShape(\n {\n path: shacl.maxCount,\n datatype: xsd.integer,\n maxCount: 1,\n },\n 'maxCount',\n shacl.Literal,\n PropertyShape,\n);\n\n//PropertyShape.minCount\ncreatePropertyShape(\n {\n path: shacl.minCount,\n datatype: xsd.integer,\n maxCount: 1,\n },\n 'minCount',\n shacl.Literal,\n PropertyShape,\n);\n\n//PropertyShape.name\ncreatePropertyShape(\n {\n path: shacl.name,\n maxCount: 1,\n },\n 'name',\n shacl.Literal,\n PropertyShape,\n);\n\n//PropertyShape.description\ncreatePropertyShape(\n {\n path: shacl.description,\n maxCount: 1,\n },\n 'description',\n shacl.Literal,\n PropertyShape,\n);\n\n// ---------------------------------------------------------------------------\n// Remaining SHACL meta-model accessors for shape serialization.\n// Labels match the PropertyShapeData / NodeShapeData fields so syncShapes() can\n// build the create-pipeline data directly. `sh:in` is owned (contains, valueShape List).\n// ---------------------------------------------------------------------------\n\n// PropertyShape.class\ncreatePropertyShape(\n {path: shacl.class, shape: Shape, maxCount: 1},\n 'class',\n shacl.IRI,\n PropertyShape,\n);\n\n// PropertyShape.in → an rdf:List (owned)\ncreatePropertyShape(\n {path: shacl.in, shape: List, maxCount: 1, contains: true},\n 'in',\n shacl.IRI,\n PropertyShape,\n);\n\n// PropertyShape pair constraints (values are property IRIs)\n// Labelled `equalsConstraint`, not `equals`: `equals` is a query-builder method, so a\n// property under that label is unreachable through the DSL (backlog 041). The name also\n// matches the `PropertyShapeData` field. The predicate stays sh:equals.\ncreatePropertyShape({path: shacl.equals, shape: Shape, maxCount: 1}, 'equalsConstraint', shacl.IRI, PropertyShape);\ncreatePropertyShape({path: shacl.disjoint, shape: Shape, maxCount: 1}, 'disjoint', shacl.IRI, PropertyShape);\ncreatePropertyShape({path: shacl.lessThan, shape: Shape, maxCount: 1}, 'lessThan', shacl.IRI, PropertyShape);\ncreatePropertyShape(\n {path: shacl.lessThanOrEquals, shape: Shape, maxCount: 1},\n 'lessThanOrEquals',\n shacl.IRI,\n PropertyShape,\n);\n\n// PropertyShape.hasValue (literal or IRI — generic)\ncreatePropertyShape({path: shacl.hasValue, maxCount: 1}, 'hasValue', null, PropertyShape);\n\n// PropertyShape.defaultValue (literal or IRI — generic, mirrors hasValue).\n// getResult() already emits `defaultValue`, but without this registration the\n// property is not queryable and a query referencing it throws before executing.\ncreatePropertyShape({path: shacl.defaultValue, maxCount: 1}, 'defaultValue', null, PropertyShape);\n\n// PropertyShape value-range / string-length / pattern constraints (report 021 §3, G5).\n// The range constraints carry no fixed datatype — the literal is typed from the JS value\n// (integer/double), mirroring the constrained property's own datatype. Length is an integer;\n// pattern is the regex source string.\ncreatePropertyShape({path: shacl.minInclusive, maxCount: 1}, 'minInclusive', shacl.Literal, PropertyShape);\ncreatePropertyShape({path: shacl.maxInclusive, maxCount: 1}, 'maxInclusive', shacl.Literal, PropertyShape);\ncreatePropertyShape({path: shacl.minExclusive, maxCount: 1}, 'minExclusive', shacl.Literal, PropertyShape);\ncreatePropertyShape({path: shacl.maxExclusive, maxCount: 1}, 'maxExclusive', shacl.Literal, PropertyShape);\ncreatePropertyShape(\n {path: shacl.minLength, datatype: xsd.integer, maxCount: 1},\n 'minLength',\n shacl.Literal,\n PropertyShape,\n);\ncreatePropertyShape(\n {path: shacl.maxLength, datatype: xsd.integer, maxCount: 1},\n 'maxLength',\n shacl.Literal,\n PropertyShape,\n);\ncreatePropertyShape(\n {path: shacl.pattern, datatype: xsd.string, maxCount: 1},\n 'pattern',\n shacl.Literal,\n PropertyShape,\n);\n\n// PropertyShape.order / group\ncreatePropertyShape(\n {path: shacl.order, datatype: xsd.integer, maxCount: 1},\n 'order',\n shacl.Literal,\n PropertyShape,\n);\ncreatePropertyShape({path: shacl.group, maxCount: 1}, 'group', shacl.Literal, PropertyShape);\n\n// PropertyShape.displayRank / displayHidden (core: display vocabulary).\n// These materialize onto the pure sh:NodeShape and so travel with an ejected app.\ncreatePropertyShape(\n {path: coreOntology.displayRank, datatype: xsd.integer, maxCount: 1},\n 'displayRank',\n shacl.Literal,\n PropertyShape,\n);\ncreatePropertyShape(\n {path: coreOntology.displayHidden, datatype: xsd.boolean, maxCount: 1},\n 'displayHidden',\n shacl.Literal,\n PropertyShape,\n);\n\n// PropertyShape.contains (core:contains — persists the composition flag)\ncreatePropertyShape(\n {path: coreOntology.contains, datatype: xsd.boolean, maxCount: 1},\n 'contains',\n shacl.Literal,\n PropertyShape,\n);\n\n// NodeShape.closed / ignoredProperties / dependent (deprecated, persisted only)\ncreatePropertyShape(\n {path: shacl.closed, datatype: xsd.boolean, maxCount: 1},\n 'closed',\n shacl.Literal,\n NodeShape,\n);\ncreatePropertyShape(\n {path: shacl.ignoredProperties, shape: Shape},\n 'ignoredProperties',\n shacl.IRI,\n NodeShape,\n);\ncreatePropertyShape(\n {path: coreOntology.dependent, datatype: xsd.boolean, maxCount: 1},\n 'dependent',\n shacl.Literal,\n NodeShape,\n);\n\n// NodeShape.targetObjectsOf (sh:targetObjectsOf — values are predicate IRIs),\n// NodeShape.generated (core:generated — marks a shape core generates at sync time,\n// e.g. the `<propertyShape>.singleOwner` constraint, so catalog readers can skip it) and\n// NodeShape.generatedShapes (core:generatedShape — the shape owns the shapes generated from\n// it: `contains`, so deleting the shape deletes them).\ncreatePropertyShape(\n {path: shacl.targetObjectsOf, shape: Shape},\n 'targetObjectsOf',\n shacl.IRI,\n NodeShape,\n);\ncreatePropertyShape(\n {path: coreOntology.generated, datatype: xsd.boolean, maxCount: 1},\n 'generated',\n shacl.Literal,\n NodeShape,\n);\ncreatePropertyShape(\n {path: coreOntology.generatedShape, shape: NodeShape, contains: true},\n 'generatedShapes',\n shacl.IRI,\n NodeShape,\n);\n\n// The terms of the generated single-owner constraint (`singleOwnerConstraint.ts`):\n// `sh:qualifiedValueShape [ sh:or ( [ sh:class A ] [ sh:class B ] ) ]` and\n// `sh:qualifiedMaxCount`. The qualified shape and the `sh:or` list are written without ids, so\n// they are blank nodes, deleted with their property shape by the blank-node cascade. The list\n// cells are `PathList`s (blank-capable `rdf:List` cells); like `sh:path`, `orShapes` declares no\n// value shape (`PathList.ts` imports `package.js`, which loads this module), so the create uses each value's own shape.\ncreatePropertyShape(\n {path: shacl.qualifiedValueShape, shape: NodeShape, maxCount: 1, nodeKind: shacl.BlankNodeOrIRI},\n 'qualifiedValueShape',\n shacl.BlankNodeOrIRI,\n PropertyShape,\n);\ncreatePropertyShape(\n {path: shacl.qualifiedMaxCount, datatype: xsd.integer, maxCount: 1},\n 'qualifiedMaxCount',\n shacl.Literal,\n PropertyShape,\n);\ncreatePropertyShape(\n {path: shacl.class, shape: Shape, maxCount: 1},\n 'class',\n shacl.IRI,\n NodeShape,\n);\ncreatePropertyShape(\n {path: shacl.or, maxCount: 1, nodeKind: shacl.BlankNodeOrIRI},\n // `or` is reserved (a DSL-JSON combinator), so the accessor is `orShapes`.\n 'orShapes',\n shacl.BlankNodeOrIRI,\n NodeShape,\n);\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@_linked/core",
3
- "version": "2.30.1",
3
+ "version": "2.32.0",
4
4
  "packageManager": "npm@12.2.0",
5
5
  "license": "MIT",
6
6
  "linkedPackage": true,