@shaclmate/compiler 4.0.23 → 4.0.24

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 (62) hide show
  1. package/dist/ShapesGraphToAstTransformer.js +16 -16
  2. package/dist/_ShapesGraphToAstTransformer/shapeAstTypeName.js +6 -5
  3. package/dist/_ShapesGraphToAstTransformer/shapeNodeKinds.js +1 -1
  4. package/dist/_ShapesGraphToAstTransformer/shapeOntology.js +4 -3
  5. package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +11 -11
  6. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.js +3 -3
  7. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.js +6 -9
  8. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.js +11 -12
  9. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.js +1 -1
  10. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.js +3 -3
  11. package/dist/ast/AbstractLazyObjectType.d.ts +0 -2
  12. package/dist/ast/ListType.d.ts +1 -8
  13. package/dist/ast/ListType.js +1 -6
  14. package/dist/ast/ObjectType.d.ts +1 -8
  15. package/dist/ast/ObjectType.js +1 -7
  16. package/dist/generators/ts/AbstractUnionType.js +1 -1
  17. package/dist/generators/ts/ListType.d.ts +1 -5
  18. package/dist/generators/ts/ListType.js +8 -27
  19. package/dist/generators/ts/NamedObjectType.d.ts +1 -9
  20. package/dist/generators/ts/NamedObjectType.js +1 -29
  21. package/dist/generators/ts/NamedObjectUnionType.js +1 -1
  22. package/dist/generators/ts/TypeFactory.js +8 -46
  23. package/dist/generators/ts/_NamedObjectType/AbstractProperty.d.ts +10 -10
  24. package/dist/generators/ts/_NamedObjectType/AbstractProperty.js +6 -0
  25. package/dist/generators/ts/_NamedObjectType/DiscriminantProperty.d.ts +1 -3
  26. package/dist/generators/ts/_NamedObjectType/DiscriminantProperty.js +17 -5
  27. package/dist/generators/ts/_NamedObjectType/IdentifierProperty.d.ts +5 -15
  28. package/dist/generators/ts/_NamedObjectType/IdentifierProperty.js +32 -202
  29. package/dist/generators/ts/_NamedObjectType/NamedObjectType_classDeclaration.js +1 -2
  30. package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionOrMethodDeclaration.js +10 -9
  31. package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterFunctionDeclaration.js +4 -4
  32. package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js +1 -1
  33. package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js +1 -1
  34. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js +1 -5
  35. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js +5 -10
  36. package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionOrMethodDeclarations.js +13 -9
  37. package/dist/generators/ts/_NamedObjectType/NamedObjectType_interfaceDeclaration.js +1 -1
  38. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.js +2 -2
  39. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js +1 -1
  40. package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.js +1 -1
  41. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionOrMethodDeclaration.js +8 -4
  42. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionOrMethodDeclaration.js +4 -2
  43. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionOrMethodDeclaration.js +9 -5
  44. package/dist/generators/ts/_NamedObjectType/Property.d.ts +1 -2
  45. package/dist/generators/ts/_NamedObjectType/ShaclProperty.d.ts +1 -3
  46. package/dist/generators/ts/_NamedObjectType/ShaclProperty.js +3 -12
  47. package/dist/generators/ts/_snippets/snippets_LazyObject.js +2 -2
  48. package/dist/generators/ts/_snippets/snippets_LazyObjectOption.js +2 -2
  49. package/dist/generators/ts/_snippets/snippets_LazyObjectSet.js +2 -2
  50. package/dist/generators/ts/imports.d.ts +0 -2
  51. package/dist/generators/ts/imports.js +0 -2
  52. package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.js +2 -2
  53. package/dist/generators/ts/sparqlObjectSetClassDeclaration.js +1 -1
  54. package/dist/input/generated.d.ts +10 -47
  55. package/dist/input/generated.js +105 -154
  56. package/package.json +2 -2
  57. package/dist/_ShapesGraphToAstTransformer/nodeShapeIdentifierMintingStrategy.d.ts +0 -6
  58. package/dist/_ShapesGraphToAstTransformer/nodeShapeIdentifierMintingStrategy.js +0 -32
  59. package/dist/enums/IdentifierMintingStrategy.d.ts +0 -9
  60. package/dist/enums/IdentifierMintingStrategy.js +0 -18
  61. package/dist/generators/ts/_NamedObjectType/IdentifierPrefixProperty.d.ts +0 -33
  62. package/dist/generators/ts/_NamedObjectType/IdentifierPrefixProperty.js +0 -92
@@ -7,13 +7,13 @@ import { transformShapeToAstType } from "./_ShapesGraphToAstTransformer/transfor
7
7
  function relatedNodeShapes({ logger, shapesGraph, }) {
8
8
  const immediateRelatedNodeShapes = new TermMap();
9
9
  for (const childNodeShape of shapesGraph.nodeShapes) {
10
- let childRelatedNodeShapes = immediateRelatedNodeShapes.get(childNodeShape.$identifier);
10
+ let childRelatedNodeShapes = immediateRelatedNodeShapes.get(childNodeShape.$identifier());
11
11
  if (!childRelatedNodeShapes) {
12
12
  childRelatedNodeShapes = {
13
13
  children: new TermMap(),
14
14
  parents: new TermMap(),
15
15
  };
16
- immediateRelatedNodeShapes.set(childNodeShape.$identifier, childRelatedNodeShapes);
16
+ immediateRelatedNodeShapes.set(childNodeShape.$identifier(), childRelatedNodeShapes);
17
17
  }
18
18
  for (const parentClassIdentifier of childNodeShape.subClassOf) {
19
19
  shapesGraph
@@ -22,29 +22,29 @@ function relatedNodeShapes({ logger, shapesGraph, }) {
22
22
  logger.error("%s is rdfs:subClassOf %s which is either missing or not a node shape: %s", childNodeShape, parentClassIdentifier, error.message);
23
23
  })
24
24
  .ifRight((parentNodeShape) => {
25
- childRelatedNodeShapes.parents.set(parentNodeShape.$identifier, parentNodeShape);
26
- let parentRelatedNodeShapes = immediateRelatedNodeShapes.get(parentNodeShape.$identifier);
25
+ childRelatedNodeShapes.parents.set(parentNodeShape.$identifier(), parentNodeShape);
26
+ let parentRelatedNodeShapes = immediateRelatedNodeShapes.get(parentNodeShape.$identifier());
27
27
  if (!parentRelatedNodeShapes) {
28
28
  parentRelatedNodeShapes = {
29
29
  children: new TermMap(),
30
30
  parents: new TermMap(),
31
31
  };
32
- immediateRelatedNodeShapes.set(parentNodeShape.$identifier, parentRelatedNodeShapes);
32
+ immediateRelatedNodeShapes.set(parentNodeShape.$identifier(), parentRelatedNodeShapes);
33
33
  }
34
- parentRelatedNodeShapes.children.set(childNodeShape.$identifier, childNodeShape);
34
+ parentRelatedNodeShapes.children.set(childNodeShape.$identifier(), childNodeShape);
35
35
  });
36
36
  }
37
37
  }
38
38
  const result = new TermMap();
39
39
  for (const nodeShape of shapesGraph.nodeShapes) {
40
- const { children: childNodeShapes, parents: parentNodeShapes } = immediateRelatedNodeShapes.get(nodeShape.$identifier);
40
+ const { children: childNodeShapes, parents: parentNodeShapes } = immediateRelatedNodeShapes.get(nodeShape.$identifier());
41
41
  const ancestorNodeShapes = new TermMap();
42
42
  function recurseAncestorNodeShapes(nodeShape) {
43
43
  for (const parentNodeShape of immediateRelatedNodeShapes
44
- .get(nodeShape.$identifier)
44
+ .get(nodeShape.$identifier())
45
45
  .parents.values()) {
46
- if (!ancestorNodeShapes.has(parentNodeShape.$identifier)) {
47
- ancestorNodeShapes.set(parentNodeShape.$identifier, parentNodeShape);
46
+ if (!ancestorNodeShapes.has(parentNodeShape.$identifier())) {
47
+ ancestorNodeShapes.set(parentNodeShape.$identifier(), parentNodeShape);
48
48
  recurseAncestorNodeShapes(parentNodeShape);
49
49
  }
50
50
  }
@@ -53,16 +53,16 @@ function relatedNodeShapes({ logger, shapesGraph, }) {
53
53
  const descendantNodeShapes = new TermMap();
54
54
  function recurseDescendantNodeShapes(nodeShape) {
55
55
  for (const childNodeShape of immediateRelatedNodeShapes
56
- .get(nodeShape.$identifier)
56
+ .get(nodeShape.$identifier())
57
57
  .children.values()) {
58
- if (!descendantNodeShapes.has(childNodeShape.$identifier)) {
59
- descendantNodeShapes.set(childNodeShape.$identifier, childNodeShape);
58
+ if (!descendantNodeShapes.has(childNodeShape.$identifier())) {
59
+ descendantNodeShapes.set(childNodeShape.$identifier(), childNodeShape);
60
60
  recurseDescendantNodeShapes(childNodeShape);
61
61
  }
62
62
  }
63
63
  }
64
64
  recurseDescendantNodeShapes(nodeShape);
65
- result.set(nodeShape.$identifier, {
65
+ result.set(nodeShape.$identifier(), {
66
66
  ancestors: [...ancestorNodeShapes.values()],
67
67
  children: [...childNodeShapes.values()],
68
68
  descendants: [...descendantNodeShapes.values()],
@@ -95,10 +95,10 @@ export class ShapesGraphToAstTransformer {
95
95
  const syntheticAstObjectTypesByName = {};
96
96
  const astNamedUnionTypes = [];
97
97
  for (const nodeShape of this.shapesGraph.nodeShapes) {
98
- if (nodeShape.$identifier.termType !== "NamedNode") {
98
+ if (nodeShape.$identifier().termType !== "NamedNode") {
99
99
  continue;
100
100
  }
101
- if (nodeShape.$identifier.value.startsWith(dash[""].value)) {
101
+ if (nodeShape.$identifier().value.startsWith(dash[""].value)) {
102
102
  continue;
103
103
  }
104
104
  const nodeShapeAstTypeEither = transformShapeToAstType.call(this, nodeShape, new ShapeStack());
@@ -4,7 +4,8 @@ export function shapeAstTypeName(shape) {
4
4
  if (shape.$type !== "NodeShape") {
5
5
  return Maybe.empty();
6
6
  }
7
- if (shape.$identifier.termType !== "NamedNode") {
7
+ const shapeIdentifier = shape.$identifier();
8
+ if (shapeIdentifier.termType !== "NamedNode") {
8
9
  return Maybe.empty();
9
10
  }
10
11
  // Explicit shaclmate:name
@@ -16,11 +17,11 @@ export function shapeAstTypeName(shape) {
16
17
  return shape.label;
17
18
  }
18
19
  // CURIE shape identifier
19
- if (shape.$identifier instanceof Curie) {
20
- if (shape.$identifier.hasUniqueReference) {
21
- return Maybe.of(shape.$identifier.reference);
20
+ if (shapeIdentifier instanceof Curie) {
21
+ if (shapeIdentifier.hasUniqueReference) {
22
+ return Maybe.of(shapeIdentifier.reference);
22
23
  }
23
- return Maybe.of(`${shape.$identifier.prefix}_${shape.$identifier.reference}`);
24
+ return Maybe.of(`${shapeIdentifier.prefix}_${shapeIdentifier.reference}`);
24
25
  }
25
26
  return Maybe.empty();
26
27
  }
@@ -12,7 +12,7 @@ function nodeShapeNodeKinds(nodeShape) {
12
12
  .orDefault(new Set());
13
13
  // Recurse into parents
14
14
  const parentNodeKinds = new Set();
15
- for (const parentNodeShape of this.relatedNodeShapesByIdentifier.get(nodeShape.$identifier).parents) {
15
+ for (const parentNodeShape of this.relatedNodeShapesByIdentifier.get(nodeShape.$identifier()).parents) {
16
16
  nodeShapeNodeKinds
17
17
  .call(this, parentNodeShape)
18
18
  .ifRight((parentNodeKinds_) => {
@@ -12,9 +12,10 @@ export function shapeOntology(shape) {
12
12
  // If there's a single ontology in the shapes graph, consider the shape a part of the ontology
13
13
  return Either.of(Maybe.of(ontologies[0]));
14
14
  }
15
- if (shape.$identifier.termType === "NamedNode") {
16
- const prefixOntologies = ontologies.filter((ontology) => ontology.$identifier.termType === "NamedNode" &&
17
- shape.$identifier.value.startsWith(ontology.$identifier.value));
15
+ const shapeIdentifier = shape.$identifier();
16
+ if (shapeIdentifier.termType === "NamedNode") {
17
+ const prefixOntologies = ontologies.filter((ontology) => ontology.$identifier().termType === "NamedNode" &&
18
+ shapeIdentifier.value.startsWith(ontology.$identifier().value));
18
19
  if (prefixOntologies.length === 1) {
19
20
  // If there's a single ontology whose IRI is a prefix of this shape's IRI, consider the shape a part of the ontology
20
21
  return Either.of(Maybe.of(prefixOntologies[0]));
@@ -25,7 +25,6 @@ function synthesizePartialAstObjectType({ identifierType, tsFeatures, }) {
25
25
  extern: false,
26
26
  fromRdfType: Maybe.empty(),
27
27
  identifierType,
28
- identifierMintingStrategy: Maybe.empty(),
29
28
  label: Maybe.empty(),
30
29
  name: Maybe.of(syntheticName),
31
30
  shapeIdentifier: dataFactory.namedNode(`urn:shaclmate:synthetic:${syntheticName}`),
@@ -49,13 +48,14 @@ function propertyName(objectType, propertyShape) {
49
48
  }
50
49
  // Pick up the common pattern of a property shape identifier being the node shape's identifier -localName,
51
50
  // like ex:NodeShape-property
52
- if (propertyShape.$identifier.termType === "NamedNode" &&
51
+ const propertyShapeIdentifier = propertyShape.$identifier();
52
+ if (propertyShapeIdentifier.termType === "NamedNode" &&
53
53
  objectType.shapeIdentifier.termType === "NamedNode") {
54
54
  const propertyShapeIdentifierPrefix = `${objectType.shapeIdentifier.value}-`;
55
- if (propertyShape.$identifier.value.startsWith(propertyShapeIdentifierPrefix) &&
56
- propertyShape.$identifier.value.length >
55
+ if (propertyShapeIdentifier.value.startsWith(propertyShapeIdentifierPrefix) &&
56
+ propertyShapeIdentifier.value.length >
57
57
  propertyShapeIdentifierPrefix.length) {
58
- return propertyShape.$identifier.value.substring(propertyShapeIdentifierPrefix.length);
58
+ return propertyShapeIdentifier.value.substring(propertyShapeIdentifierPrefix.length);
59
59
  }
60
60
  }
61
61
  // sh:path CURIE reference
@@ -63,12 +63,12 @@ function propertyName(objectType, propertyShape) {
63
63
  return propertyShape.path.reference;
64
64
  }
65
65
  // Shape identifier CURIE reference
66
- if (propertyShape.$identifier instanceof Curie) {
67
- return propertyShape.$identifier.reference;
66
+ if (propertyShapeIdentifier instanceof Curie) {
67
+ return propertyShapeIdentifier.reference;
68
68
  }
69
69
  // Shape identifier IRI
70
- if (propertyShape.$identifier.termType === "NamedNode") {
71
- return propertyShape.$identifier.value;
70
+ if (propertyShapeIdentifier.termType === "NamedNode") {
71
+ return propertyShapeIdentifier.value;
72
72
  }
73
73
  // sh:path IRI
74
74
  if (propertyShape.path.termType === "NamedNode") {
@@ -201,7 +201,7 @@ export function transformPropertyShapeToAstObjectTypeProperty({ objectType, prop
201
201
  comment: Maybe.empty(),
202
202
  label: Maybe.empty(),
203
203
  name: Maybe.empty(),
204
- shapeIdentifier: propertyShape.$identifier,
204
+ shapeIdentifier: propertyShape.$identifier(),
205
205
  };
206
206
  switch (astType.kind) {
207
207
  case "BlankNodeType":
@@ -259,7 +259,7 @@ export function transformPropertyShapeToAstObjectTypeProperty({ objectType, prop
259
259
  objectType,
260
260
  order: propertyShape.order.orDefault(0),
261
261
  path: propertyShape.path,
262
- shapeIdentifier: propertyShape.$identifier,
262
+ shapeIdentifier: propertyShape.$identifier(),
263
263
  type: astType,
264
264
  visibility: propertyShape.visibility
265
265
  .map(Visibility.fromIri)
@@ -45,7 +45,7 @@ export function transformShapeToAstCompoundType(shape, shapeStack) {
45
45
  comment: shape.comment,
46
46
  label: shape.label,
47
47
  name: shapeAstTypeName(shape),
48
- shapeIdentifier: shape.$identifier,
48
+ shapeIdentifier: shape.$identifier(),
49
49
  tsFeatures,
50
50
  });
51
51
  if (memberShapes.length === 1) {
@@ -54,7 +54,7 @@ export function transformShapeToAstCompoundType(shape, shapeStack) {
54
54
  .map(Maybe.of);
55
55
  }
56
56
  // Put a placeholder in the cache to deal with cyclic references
57
- this.cachedAstTypesByShapeIdentifier.set(shape.$identifier, compoundType);
57
+ this.cachedAstTypesByShapeIdentifier.set(shape.$identifier(), compoundType);
58
58
  return Either.sequence(memberShapes.map((memberShape) => transformShapeToAstType.call(this, memberShape, shapeStack)))
59
59
  .chain((memberShapeTypes) => {
60
60
  for (let memberI = 0; memberI < memberShapes.length; memberI++) {
@@ -88,7 +88,7 @@ export function transformShapeToAstCompoundType(shape, shapeStack) {
88
88
  return Either.of(Maybe.of(compoundType));
89
89
  })
90
90
  .ifLeft(() => {
91
- this.cachedAstTypesByShapeIdentifier.delete(shape.$identifier);
91
+ this.cachedAstTypesByShapeIdentifier.delete(shape.$identifier());
92
92
  });
93
93
  });
94
94
  }
@@ -4,7 +4,6 @@ import { Either, Left, Maybe } from "purify-ts";
4
4
  import * as ast from "../ast/index.js";
5
5
  import { Eithers } from "../Eithers.js";
6
6
  import { defaultNodeShapeNodeKinds } from "./defaultNodeShapeNodeKinds.js";
7
- import { nodeShapeIdentifierMintingStrategy } from "./nodeShapeIdentifierMintingStrategy.js";
8
7
  import { shapeAstTypeName } from "./shapeAstTypeName.js";
9
8
  import { shapeNodeKinds } from "./shapeNodeKinds.js";
10
9
  import { transformPropertyShapeToAstObjectTypeProperty } from "./transformPropertyShapeToAstObjectTypeProperty.js";
@@ -13,7 +12,6 @@ const listPropertiesObjectType = new ast.ObjectType({
13
12
  extern: false,
14
13
  comment: Maybe.empty(),
15
14
  label: Maybe.empty(),
16
- identifierMintingStrategy: Maybe.empty(),
17
15
  identifierType: new ast.IdentifierType({
18
16
  comment: Maybe.empty(),
19
17
  label: Maybe.empty(),
@@ -47,9 +45,9 @@ export function transformShapeToAstListType(shape, shapeStack) {
47
45
  return empty;
48
46
  }
49
47
  const nodeShape = shape;
50
- return Eithers.chain3(nodeShapeIdentifierMintingStrategy.call(this, nodeShape), shapeNodeKinds.call(this, nodeShape, { defaultNodeShapeNodeKinds }), Either.sequence(nodeShape.xone
48
+ return Eithers.chain2(shapeNodeKinds.call(this, nodeShape, { defaultNodeShapeNodeKinds }), Either.sequence(nodeShape.xone
51
49
  .orDefault([])
52
- .map((shapeIdentifier) => this.shapesGraph.shape(shapeIdentifier)))).chain(([identifierMintingStrategy, nodeKinds, xone]) => {
50
+ .map((shapeIdentifier) => this.shapesGraph.shape(shapeIdentifier)))).chain(([nodeKinds, xone]) => {
53
51
  // Put a placeholder in the cache to deal with cyclic references
54
52
  // Remove the placeholder if the transformation fails.
55
53
  const listType = new ast.ListType({
@@ -59,11 +57,10 @@ export function transformShapeToAstListType(shape, shapeStack) {
59
57
  label: nodeShape.label,
60
58
  mutable: nodeShape.mutable.orDefault(false),
61
59
  name: shapeAstTypeName(nodeShape),
62
- identifierMintingStrategy,
63
- shapeIdentifier: nodeShape.$identifier,
60
+ shapeIdentifier: nodeShape.$identifier(),
64
61
  toRdfTypes: nodeShape.toRdfTypes,
65
62
  });
66
- this.cachedAstTypesByShapeIdentifier.set(nodeShape.$identifier, listType);
63
+ this.cachedAstTypesByShapeIdentifier.set(nodeShape.$identifier(), listType);
67
64
  return (() => {
68
65
  let emptyListShape;
69
66
  let nonEmptyListShape;
@@ -127,7 +124,7 @@ export function transformShapeToAstListType(shape, shapeStack) {
127
124
  })
128
125
  .chain((restProperty) => {
129
126
  if (restProperty.type.kind !== "ListType" ||
130
- !restProperty.type.shapeIdentifier.equals(nodeShape.$identifier)) {
127
+ !restProperty.type.shapeIdentifier.equals(nodeShape.$identifier())) {
131
128
  return Left(new Error(`${nodeShape} rdf:rest property is not recursive into the node shape`));
132
129
  }
133
130
  return Either.of(Maybe.of(listType));
@@ -135,7 +132,7 @@ export function transformShapeToAstListType(shape, shapeStack) {
135
132
  });
136
133
  });
137
134
  })().ifLeft(() => {
138
- this.cachedAstTypesByShapeIdentifier.delete(nodeShape.$identifier);
135
+ this.cachedAstTypesByShapeIdentifier.delete(nodeShape.$identifier());
139
136
  });
140
137
  });
141
138
  }
@@ -5,7 +5,6 @@ import * as ast from "../ast/index.js";
5
5
  import { Eithers } from "../Eithers.js";
6
6
  import { TsObjectDeclarationType } from "../enums/TsObjectDeclarationType.js";
7
7
  import { defaultNodeShapeNodeKinds } from "./defaultNodeShapeNodeKinds.js";
8
- import { nodeShapeIdentifierMintingStrategy } from "./nodeShapeIdentifierMintingStrategy.js";
9
8
  import { nodeShapeTsFeatures } from "./nodeShapeTsFeatures.js";
10
9
  import { ShapeStack } from "./ShapeStack.js";
11
10
  import { shapeAstTypeName } from "./shapeAstTypeName.js";
@@ -54,16 +53,17 @@ export function transformShapeToAstObjectType(shape, shapeStack) {
54
53
  nodeShape.xone.orDefault([]).length > 0) {
55
54
  return Either.of(Maybe.empty());
56
55
  }
57
- if (nodeShape.$identifier.termType !== "NamedNode") {
56
+ if (nodeShape.$identifier().termType !== "NamedNode") {
58
57
  return Either.of(Maybe.empty());
59
58
  }
60
- return Eithers.chain5(nodeShapeIdentifierMintingStrategy.call(this, nodeShape), shapeNodeKinds.call(this, nodeShape, { defaultNodeShapeNodeKinds }), Either.sequence(nodeShape.properties.map((propertyShapeIdentifier) => this.shapesGraph.propertyShape(propertyShapeIdentifier))), nodeShapeTsFeatures.call(this, nodeShape), nodeShape.tsObjectDeclarationType.isJust()
59
+ return Eithers.chain4(shapeNodeKinds.call(this, nodeShape, { defaultNodeShapeNodeKinds }), Either.sequence(nodeShape.properties.map((propertyShapeIdentifier) => this.shapesGraph.propertyShape(propertyShapeIdentifier))), nodeShapeTsFeatures.call(this, nodeShape), nodeShape.tsObjectDeclarationType.isJust()
61
60
  ? Either.of(nodeShape.tsObjectDeclarationType.map(TsObjectDeclarationType.fromIri))
62
61
  : shapeOntology
63
62
  .call(this, nodeShape)
64
- .map((ontology) => ontology.chain((ontology) => ontology.tsObjectDeclarationType.map(TsObjectDeclarationType.fromIri)))).chain(([identifierMintingStrategy, nodeKinds, propertyShapes, tsFeatures, tsObjectDeclarationType,]) => {
63
+ .map((ontology) => ontology.chain((ontology) => ontology.tsObjectDeclarationType.map(TsObjectDeclarationType.fromIri)))).chain(([nodeKinds, propertyShapes, tsFeatures, tsObjectDeclarationType]) => {
65
64
  const abstract = nodeShape.abstract.orDefault(false);
66
- const { ancestors: ancestorNodeShapes, descendants: descendantNodeShapes, children: childNodeShapes, parents: parentNodeShapes, } = this.relatedNodeShapesByIdentifier.get(nodeShape.$identifier);
65
+ const nodeShapeIdentifier = nodeShape.$identifier();
66
+ const { ancestors: ancestorNodeShapes, descendants: descendantNodeShapes, children: childNodeShapes, parents: parentNodeShapes, } = this.relatedNodeShapesByIdentifier.get(nodeShapeIdentifier);
67
67
  const isClass = nodeShape.subClassOf.length > 0 ||
68
68
  descendantNodeShapes.length > 0 || // A node shape that is the object of an rdfs:subClassOf is itself an rdfs:Class
69
69
  nodeShape.types.some((type) => type.equals(owl.Class) || type.equals(rdfs.Class));
@@ -71,8 +71,8 @@ export function transformShapeToAstObjectType(shape, shapeStack) {
71
71
  let toRdfTypes;
72
72
  if (!abstract) {
73
73
  fromRdfType = nodeShape.fromRdfType.alt(nodeShape.rdfType);
74
- if (isClass && nodeShape.$identifier.termType === "NamedNode") {
75
- fromRdfType = fromRdfType.alt(Maybe.of(nodeShape.$identifier));
74
+ if (isClass && nodeShapeIdentifier.termType === "NamedNode") {
75
+ fromRdfType = fromRdfType.alt(Maybe.of(nodeShapeIdentifier));
76
76
  }
77
77
  toRdfTypes = nodeShape.toRdfTypes.concat();
78
78
  if (toRdfTypes.length === 0) {
@@ -97,7 +97,7 @@ export function transformShapeToAstObjectType(shape, shapeStack) {
97
97
  comment: Maybe.empty(),
98
98
  label: Maybe.empty(),
99
99
  name: Maybe.empty(),
100
- shapeIdentifier: nodeShape.$identifier,
100
+ shapeIdentifier: nodeShape.$identifier(),
101
101
  };
102
102
  if (nodeKinds.size === 2) {
103
103
  invariant(nodeShape.in_.isNothing());
@@ -134,16 +134,15 @@ export function transformShapeToAstObjectType(shape, shapeStack) {
134
134
  fromRdfType,
135
135
  label: nodeShape.label,
136
136
  identifierType,
137
- identifierMintingStrategy,
138
137
  name: shapeAstTypeName(nodeShape),
139
- shapeIdentifier: nodeShape.$identifier,
138
+ shapeIdentifier: nodeShape.$identifier(),
140
139
  synthetic: false,
141
140
  toRdfTypes,
142
141
  tsFeatures,
143
142
  tsImports: nodeShape.tsImports,
144
143
  tsObjectDeclarationType: tsObjectDeclarationType.orDefault("class"),
145
144
  });
146
- this.cachedAstTypesByShapeIdentifier.set(nodeShape.$identifier, objectType);
145
+ this.cachedAstTypesByShapeIdentifier.set(nodeShape.$identifier(), objectType);
147
146
  return (() => {
148
147
  // Populate ancestor and descendant object types
149
148
  const relatedObjectTypes = (relatedNodeShapes) => {
@@ -180,7 +179,7 @@ export function transformShapeToAstObjectType(shape, shapeStack) {
180
179
  objectType.sortProperties();
181
180
  return Either.of(Maybe.of(objectType));
182
181
  })().ifLeft(() => {
183
- this.cachedAstTypesByShapeIdentifier.delete(nodeShape.$identifier);
182
+ this.cachedAstTypesByShapeIdentifier.delete(nodeShape.$identifier());
184
183
  });
185
184
  });
186
185
  }
@@ -15,7 +15,7 @@ export function transformShapeToAstTermType(shape, shapeStack) {
15
15
  comment: Maybe.empty(),
16
16
  name: Maybe.empty(),
17
17
  label: Maybe.empty(),
18
- shapeIdentifier: shape.$identifier,
18
+ shapeIdentifier: shape.$identifier(),
19
19
  };
20
20
  let termType;
21
21
  if (nodeKinds.size === 1) {
@@ -13,7 +13,7 @@ const tryTransformShapeToAstTypeMethods = [
13
13
  * not the other transformShapeToAst*Type functions directly.
14
14
  */
15
15
  export function transformShapeToAstType(shape, shapeStack) {
16
- const astType = this.cachedAstTypesByShapeIdentifier.get(shape.$identifier);
16
+ const astType = this.cachedAstTypesByShapeIdentifier.get(shape.$identifier());
17
17
  if (astType) {
18
18
  return Either.of(astType);
19
19
  }
@@ -28,14 +28,14 @@ export function transformShapeToAstType(shape, shapeStack) {
28
28
  }
29
29
  const astType = either.unsafeCoerce().extract();
30
30
  if (astType) {
31
- this.cachedAstTypesByShapeIdentifier.set(shape.$identifier, astType);
31
+ this.cachedAstTypesByShapeIdentifier.set(shape.$identifier(), astType);
32
32
  return Either.of(astType);
33
33
  }
34
34
  }
35
35
  return transformShapeToAstTermType
36
36
  .call(this, shape, shapeStack)
37
37
  .ifRight((astType) => {
38
- this.cachedAstTypesByShapeIdentifier.set(shape.$identifier, astType);
38
+ this.cachedAstTypesByShapeIdentifier.set(shape.$identifier(), astType);
39
39
  });
40
40
  }
41
41
  //# sourceMappingURL=transformShapeToAstType.js.map
@@ -21,7 +21,6 @@ export declare abstract class AbstractLazyObjectType<PartialTypeT extends Abstra
21
21
  toJSON(): {
22
22
  partialType: {
23
23
  fromRdfType: import("@rdfjs/types").NamedNode<string> | undefined;
24
- identifierMintingStrategy: "blankNode" | "sha256" | "uuidv4" | undefined;
25
24
  identifierType: {
26
25
  hasValues: readonly import("@rdfjs/types").NamedNode<string>[] | undefined;
27
26
  in: readonly import("@rdfjs/types").NamedNode<string>[] | undefined;
@@ -64,7 +63,6 @@ export declare abstract class AbstractLazyObjectType<PartialTypeT extends Abstra
64
63
  };
65
64
  resolveType: {
66
65
  fromRdfType: import("@rdfjs/types").NamedNode<string> | undefined;
67
- identifierMintingStrategy: "blankNode" | "sha256" | "uuidv4" | undefined;
68
66
  identifierType: {
69
67
  hasValues: readonly import("@rdfjs/types").NamedNode<string>[] | undefined;
70
68
  in: readonly import("@rdfjs/types").NamedNode<string>[] | undefined;
@@ -1,7 +1,5 @@
1
1
  import type { BlankNode, NamedNode } from "@rdfjs/types";
2
2
  import type { IdentifierNodeKind } from "@shaclmate/shacl-ast";
3
- import type { Maybe } from "purify-ts";
4
- import type { IdentifierMintingStrategy } from "../enums/IdentifierMintingStrategy.js";
5
3
  import { AbstractCollectionType } from "./AbstractCollectionType.js";
6
4
  import type { BlankNodeType } from "./BlankNodeType.js";
7
5
  import type { IdentifierType } from "./IdentifierType.js";
@@ -25,10 +23,6 @@ export declare class ListType<ItemTypeT extends ListType.ItemType = ListType.Ite
25
23
  */
26
24
  readonly identifierNodeKind: IdentifierNodeKind;
27
25
  readonly kind = "ListType";
28
- /**
29
- * Strategy for minting new list and sub-list identifiers.
30
- */
31
- readonly identifierMintingStrategy: Maybe<IdentifierMintingStrategy>;
32
26
  /**
33
27
  * rdf:type's that will be added to this object when it's serialized toRdf.
34
28
  *
@@ -36,8 +30,7 @@ export declare class ListType<ItemTypeT extends ListType.ItemType = ListType.Ite
36
30
  * class targets).
37
31
  */
38
32
  readonly toRdfTypes: readonly NamedNode[];
39
- constructor({ identifierMintingStrategy, identifierNodeKind, toRdfTypes, ...superParameters }: {
40
- identifierMintingStrategy: Maybe<IdentifierMintingStrategy>;
33
+ constructor({ identifierNodeKind, toRdfTypes, ...superParameters }: {
41
34
  identifierNodeKind: IdentifierNodeKind;
42
35
  shapeIdentifier: BlankNode | NamedNode;
43
36
  toRdfTypes: readonly NamedNode[];
@@ -12,10 +12,6 @@ export class ListType extends AbstractCollectionType {
12
12
  */
13
13
  identifierNodeKind;
14
14
  kind = "ListType";
15
- /**
16
- * Strategy for minting new list and sub-list identifiers.
17
- */
18
- identifierMintingStrategy;
19
15
  /**
20
16
  * rdf:type's that will be added to this object when it's serialized toRdf.
21
17
  *
@@ -23,9 +19,8 @@ export class ListType extends AbstractCollectionType {
23
19
  * class targets).
24
20
  */
25
21
  toRdfTypes;
26
- constructor({ identifierMintingStrategy, identifierNodeKind, toRdfTypes, ...superParameters }) {
22
+ constructor({ identifierNodeKind, toRdfTypes, ...superParameters }) {
27
23
  super(superParameters);
28
- this.identifierMintingStrategy = identifierMintingStrategy;
29
24
  this.identifierNodeKind = identifierNodeKind;
30
25
  this.toRdfTypes = toRdfTypes;
31
26
  }
@@ -2,7 +2,6 @@ import type { BlankNode, NamedNode } from "@rdfjs/types";
2
2
  import { PropertyPath } from "@rdfx/resource";
3
3
  import type { NodeKind } from "@shaclmate/shacl-ast";
4
4
  import type { Maybe } from "purify-ts";
5
- import type { IdentifierMintingStrategy } from "../enums/IdentifierMintingStrategy.js";
6
5
  import type { TsFeature } from "../enums/TsFeature.js";
7
6
  import type { TsObjectDeclarationType } from "../enums/TsObjectDeclarationType.js";
8
7
  import type { Visibility } from "../enums/Visibility.js";
@@ -32,10 +31,6 @@ export declare class ObjectType extends AbstractType {
32
31
  * class targets).
33
32
  */
34
33
  readonly fromRdfType: Maybe<NamedNode>;
35
- /**
36
- * Strategy for minting new object identifiers.
37
- */
38
- readonly identifierMintingStrategy: Maybe<IdentifierMintingStrategy>;
39
34
  /**
40
35
  * Identifier type.
41
36
  */
@@ -73,11 +68,10 @@ export declare class ObjectType extends AbstractType {
73
68
  * Whether to generate a TypeScript class or interface for this type.
74
69
  */
75
70
  readonly tsObjectDeclarationType: TsObjectDeclarationType;
76
- constructor({ abstract, extern, fromRdfType, identifierMintingStrategy, identifierType, synthetic, toRdfTypes, tsFeatures, tsImports, tsObjectDeclarationType, ...superParameters }: {
71
+ constructor({ abstract, extern, fromRdfType, identifierType, synthetic, toRdfTypes, tsFeatures, tsImports, tsObjectDeclarationType, ...superParameters }: {
77
72
  abstract: boolean;
78
73
  extern: boolean;
79
74
  fromRdfType: Maybe<NamedNode>;
80
- identifierMintingStrategy: Maybe<IdentifierMintingStrategy>;
81
75
  identifierType: BlankNodeType | IdentifierType | IriType;
82
76
  synthetic: boolean;
83
77
  toRdfTypes: readonly NamedNode[];
@@ -100,7 +94,6 @@ export declare class ObjectType extends AbstractType {
100
94
  sortProperties(): void;
101
95
  toJSON(): {
102
96
  fromRdfType: NamedNode<string> | undefined;
103
- identifierMintingStrategy: "blankNode" | "sha256" | "uuidv4" | undefined;
104
97
  identifierType: {
105
98
  hasValues: readonly NamedNode<string>[] | undefined;
106
99
  in: readonly NamedNode<string>[] | undefined;
@@ -62,10 +62,6 @@ export class ObjectType extends AbstractType {
62
62
  * class targets).
63
63
  */
64
64
  fromRdfType;
65
- /**
66
- * Strategy for minting new object identifiers.
67
- */
68
- identifierMintingStrategy;
69
65
  /**
70
66
  * Identifier type.
71
67
  */
@@ -103,12 +99,11 @@ export class ObjectType extends AbstractType {
103
99
  * Whether to generate a TypeScript class or interface for this type.
104
100
  */
105
101
  tsObjectDeclarationType;
106
- constructor({ abstract, extern, fromRdfType, identifierMintingStrategy, identifierType, synthetic, toRdfTypes, tsFeatures, tsImports, tsObjectDeclarationType, ...superParameters }) {
102
+ constructor({ abstract, extern, fromRdfType, identifierType, synthetic, toRdfTypes, tsFeatures, tsImports, tsObjectDeclarationType, ...superParameters }) {
107
103
  super(superParameters);
108
104
  this.abstract = abstract;
109
105
  this.extern = extern;
110
106
  this.fromRdfType = fromRdfType;
111
- this.identifierMintingStrategy = identifierMintingStrategy;
112
107
  this.identifierType = identifierType;
113
108
  this.synthetic = synthetic;
114
109
  this.toRdfTypes = toRdfTypes;
@@ -171,7 +166,6 @@ export class ObjectType extends AbstractType {
171
166
  return {
172
167
  ...super.toJSON(),
173
168
  fromRdfType: this.fromRdfType.extract(),
174
- identifierMintingStrategy: this.identifierMintingStrategy.extract(),
175
169
  identifierType: this.identifierType.toJSON(),
176
170
  parentObjectTypes: this.parentObjectTypes.length > 0
177
171
  ? this.parentObjectTypes.map((parentObjectType) => parentObjectType.name.extract() ??
@@ -239,7 +239,7 @@ ${joinCode(this.concreteMembers.map(({ type, typeCheck, unwrap }) => code `if ($
239
239
  ${joinCode([
240
240
  ...this.identifierType
241
241
  .map((identifierType) => code `\
242
- if (filter.${syntheticNamePrefix}identifier !== undefined && !${identifierType.filterFunction}(filter.${syntheticNamePrefix}identifier, value.${syntheticNamePrefix}identifier)) {
242
+ if (filter.${syntheticNamePrefix}identifier !== undefined && !${identifierType.filterFunction}(filter.${syntheticNamePrefix}identifier, value.${syntheticNamePrefix}identifier())) {
243
243
  return false;
244
244
  }`)
245
245
  .toList(),
@@ -1,6 +1,4 @@
1
1
  import type { NamedNode } from "@rdfjs/types";
2
- import type { Maybe } from "purify-ts";
3
- import type { IdentifierMintingStrategy } from "../../enums/IdentifierMintingStrategy.js";
4
2
  import { AbstractCollectionType } from "./AbstractCollectionType.js";
5
3
  import type { AnonymousUnionType } from "./AnonymousUnionType.js";
6
4
  import type { BigDecimalType } from "./BigDecimalType.js";
@@ -22,13 +20,11 @@ import type { TermType } from "./TermType.js";
22
20
  import type { Type } from "./Type.js";
23
21
  import { type Code } from "./ts-poet-wrapper.js";
24
22
  export declare class ListType<ItemTypeT extends ListType.ItemType> extends AbstractCollectionType<ItemTypeT> {
25
- private readonly identifierMintingStrategy;
26
23
  private readonly identifierNodeKind;
27
24
  private readonly toRdfTypes;
28
25
  readonly kind = "ListType";
29
- constructor({ identifierNodeKind, identifierMintingStrategy, toRdfTypes, ...superParameters }: {
26
+ constructor({ identifierNodeKind, toRdfTypes, ...superParameters }: {
30
27
  identifierNodeKind: ListType<ItemTypeT>["identifierNodeKind"];
31
- identifierMintingStrategy: Maybe<IdentifierMintingStrategy>;
32
28
  toRdfTypes: readonly NamedNode[];
33
29
  } & ConstructorParameters<typeof AbstractCollectionType<ItemTypeT>>[0]);
34
30
  get valueSparqlConstructTriplesFunction(): Code;