@shaclmate/compiler 4.0.21 → 4.0.23

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 (53) hide show
  1. package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +1 -0
  2. package/dist/ast/ObjectType.d.ts +6 -1
  3. package/dist/ast/ObjectType.js +6 -1
  4. package/dist/generators/ts/AbstractLazyObjectType.d.ts +1 -0
  5. package/dist/generators/ts/AbstractLazyObjectType.js +7 -0
  6. package/dist/generators/ts/AbstractNamedUnionType.d.ts +3 -2
  7. package/dist/generators/ts/AbstractNamedUnionType.js +23 -9
  8. package/dist/generators/ts/AbstractTermType.d.ts +1 -0
  9. package/dist/generators/ts/AbstractTermType.js +3 -0
  10. package/dist/generators/ts/AbstractType.d.ts +12 -4
  11. package/dist/generators/ts/AbstractUnionType.d.ts +1 -0
  12. package/dist/generators/ts/AbstractUnionType.js +10 -0
  13. package/dist/generators/ts/AnonymousUnionType.d.ts +2 -1
  14. package/dist/generators/ts/AnonymousUnionType.js +6 -3
  15. package/dist/generators/ts/DefaultValueType.d.ts +2 -1
  16. package/dist/generators/ts/DefaultValueType.js +6 -3
  17. package/dist/generators/ts/ListType.d.ts +1 -0
  18. package/dist/generators/ts/ListType.js +3 -0
  19. package/dist/generators/ts/NamedObjectType.d.ts +1 -0
  20. package/dist/generators/ts/NamedObjectType.js +11 -0
  21. package/dist/generators/ts/OptionType.d.ts +1 -0
  22. package/dist/generators/ts/OptionType.js +3 -0
  23. package/dist/generators/ts/SetType.d.ts +1 -0
  24. package/dist/generators/ts/SetType.js +3 -0
  25. package/dist/generators/ts/TypeFactory.js +1 -0
  26. package/dist/generators/ts/_NamedObjectType/AbstractProperty.d.ts +13 -5
  27. package/dist/generators/ts/_NamedObjectType/DiscriminantProperty.d.ts +2 -1
  28. package/dist/generators/ts/_NamedObjectType/DiscriminantProperty.js +9 -6
  29. package/dist/generators/ts/_NamedObjectType/IdentifierPrefixProperty.d.ts +2 -1
  30. package/dist/generators/ts/_NamedObjectType/IdentifierPrefixProperty.js +4 -1
  31. package/dist/generators/ts/_NamedObjectType/IdentifierProperty.d.ts +2 -1
  32. package/dist/generators/ts/_NamedObjectType/IdentifierProperty.js +5 -2
  33. package/dist/generators/ts/_NamedObjectType/NamedObjectType_classDeclaration.js +2 -9
  34. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.js +11 -2
  35. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionOrMethodDeclaration.js +1 -1
  36. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionOrMethodDeclaration.d.ts +4 -0
  37. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionOrMethodDeclaration.js +62 -0
  38. package/dist/generators/ts/_NamedObjectType/ShaclProperty.d.ts +5 -2
  39. package/dist/generators/ts/_NamedObjectType/ShaclProperty.js +24 -9
  40. package/dist/generators/ts/_snippets/snippets_PropertyPath.js +5 -3
  41. package/dist/generators/ts/_snippets/snippets_compactRecord.d.ts +2 -0
  42. package/dist/generators/ts/_snippets/snippets_compactRecord.js +16 -0
  43. package/dist/generators/ts/_snippets/{parseIri.d.ts → snippets_parseIri.d.ts} +1 -1
  44. package/dist/generators/ts/_snippets/{parseIri.js → snippets_parseIri.js} +1 -1
  45. package/dist/generators/ts/imports.d.ts +1 -1
  46. package/dist/generators/ts/imports.js +1 -1
  47. package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.js +1 -1
  48. package/dist/generators/ts/snippets.d.ts +1 -0
  49. package/dist/generators/ts/snippets.js +3 -1
  50. package/dist/generators/ts/sparqlObjectSetClassDeclaration.js +1 -1
  51. package/dist/input/generated.d.ts +110 -7
  52. package/dist/input/generated.js +203 -26
  53. package/package.json +6 -6
@@ -1,9 +1,34 @@
1
1
  import datasetFactory from "@rdfjs/dataset";
2
2
  import dataFactory from "@rdfx/data-factory";
3
3
  import { LiteralFactory } from "@rdfx/literal";
4
- import { PropertyPath as RdfjsResourcePropertyPath, Resource, ResourceSet, } from "@rdfx/resource";
4
+ import { PropertyPath as RdfxResourcePropertyPath, Resource, ResourceSet, } from "@rdfx/resource";
5
5
  import { NTriplesIdentifier, NTriplesTerm } from "@rdfx/string";
6
6
  import { Either, Left, Maybe, Right } from "purify-ts";
7
+ /**
8
+ * Remove undefined values from a record.
9
+ */
10
+ function $compactRecord(record) {
11
+ return Object.entries(record).reduce((definedProperties, [propertyName, propertyValue]) => {
12
+ if (propertyValue !== undefined) {
13
+ definedProperties[propertyName] = propertyValue;
14
+ }
15
+ return definedProperties;
16
+ }, {});
17
+ }
18
+ export var $EqualsResult;
19
+ (function ($EqualsResult) {
20
+ $EqualsResult.Equal = Right(true);
21
+ function fromBooleanEqualsResult(left, right, equalsResult) {
22
+ if (typeof equalsResult !== "boolean") {
23
+ return equalsResult;
24
+ }
25
+ if (equalsResult) {
26
+ return $EqualsResult.Equal;
27
+ }
28
+ return Left({ left, right, type: "boolean" });
29
+ }
30
+ $EqualsResult.fromBooleanEqualsResult = fromBooleanEqualsResult;
31
+ })($EqualsResult || ($EqualsResult = {}));
7
32
  function $filterArray(filterItem) {
8
33
  return (filter, values) => {
9
34
  for (const value of values) {
@@ -184,12 +209,13 @@ export var $PropertyPath;
184
209
  return true;
185
210
  }
186
211
  $PropertyPath.$filter = $filter;
187
- $PropertyPath.$fromRdfResource = RdfjsResourcePropertyPath.fromResource;
212
+ $PropertyPath.$fromRdfResource = RdfxResourcePropertyPath.fromResource;
188
213
  $PropertyPath.$fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
189
214
  .toResource()
190
215
  .chain((resource) => $PropertyPath.$fromRdfResource(resource, options))));
191
216
  $PropertyPath.$schema = {};
192
- $PropertyPath.$toRdfResource = RdfjsResourcePropertyPath.toResource;
217
+ $PropertyPath.$toRdfResource = RdfxResourcePropertyPath.toResource;
218
+ $PropertyPath.$toString = RdfxResourcePropertyPath.toString;
193
219
  })($PropertyPath || ($PropertyPath = {}));
194
220
  var $RdfVocabularies;
195
221
  (function ($RdfVocabularies) {
@@ -232,6 +258,12 @@ var $RdfVocabularies;
232
258
  function $shaclPropertyFromRdf({ graph, propertySchema, resource, typeFromRdf, }) {
233
259
  return typeFromRdf(Right(resource.values(propertySchema.path, { graph, unique: true }))).chain((values) => values.head());
234
260
  }
261
+ /**
262
+ * Compare two values for strict equality (===), returning an $EqualsResult rather than a boolean.
263
+ */
264
+ function $strictEquals(left, right) {
265
+ return $EqualsResult.fromBooleanEqualsResult(left, right, left === right);
266
+ }
235
267
  export var PropertyShape;
236
268
  (function (PropertyShape) {
237
269
  function $create(parameters) {
@@ -362,6 +394,16 @@ export var PropertyShape;
362
394
  else {
363
395
  description = parameters.description;
364
396
  }
397
+ let display;
398
+ if (typeof parameters.display === "boolean") {
399
+ display = parameters.display;
400
+ }
401
+ else if (parameters.display === undefined) {
402
+ display = false;
403
+ }
404
+ else {
405
+ display = parameters.display;
406
+ }
365
407
  let flags;
366
408
  if (parameters.flags === undefined) {
367
409
  flags = [];
@@ -834,6 +876,7 @@ export var PropertyShape;
834
876
  deactivated,
835
877
  defaultValue,
836
878
  description,
879
+ display,
837
880
  flags,
838
881
  groups,
839
882
  hasValues,
@@ -904,6 +947,10 @@ export var PropertyShape;
904
947
  !$filterMaybe($filterString)(filter.description, value.description)) {
905
948
  return false;
906
949
  }
950
+ if (filter.display !== undefined &&
951
+ !$filterBoolean(filter.display, value.display)) {
952
+ return false;
953
+ }
907
954
  if (filter.flags !== undefined &&
908
955
  !$filterArray($filterString)(filter.flags, value.flags)) {
909
956
  return false;
@@ -1193,6 +1240,21 @@ export var PropertyShape;
1193
1240
  value: Maybe.empty(),
1194
1241
  })),
1195
1242
  }).chain((description) => $shaclPropertyFromRdf({
1243
+ graph: _$options.graph,
1244
+ resource: $resource,
1245
+ propertySchema: PropertyShape.$schema.properties.display,
1246
+ typeFromRdf: (resourceValues) => resourceValues
1247
+ .map((values) => values.length > 0
1248
+ ? values
1249
+ : new Resource.Value({
1250
+ dataFactory: dataFactory,
1251
+ focusResource: $resource,
1252
+ propertyPath: PropertyShape.$schema.properties
1253
+ .display.path,
1254
+ term: dataFactory.literal("false", $RdfVocabularies.xsd.boolean),
1255
+ }).toValues())
1256
+ .chain((values) => values.chainMap((value) => value.toBoolean())),
1257
+ }).chain((display) => $shaclPropertyFromRdf({
1196
1258
  graph: _$options.graph,
1197
1259
  resource: $resource,
1198
1260
  propertySchema: PropertyShape.$schema.properties.flags,
@@ -1215,8 +1277,8 @@ export var PropertyShape;
1215
1277
  .map((values) => values.toArray())
1216
1278
  .map((valuesArray) => Resource.Values.fromValue({
1217
1279
  focusResource: $resource,
1218
- propertyPath: PropertyShape.$schema.properties.groups
1219
- .path,
1280
+ propertyPath: PropertyShape.$schema.properties
1281
+ .groups.path,
1220
1282
  value: valuesArray,
1221
1283
  })),
1222
1284
  }).chain((groups) => $shaclPropertyFromRdf({
@@ -1257,8 +1319,8 @@ export var PropertyShape;
1257
1319
  })))
1258
1320
  .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
1259
1321
  focusResource: $resource,
1260
- propertyPath: PropertyShape.$schema.properties
1261
- .in_.path,
1322
+ propertyPath: PropertyShape.$schema
1323
+ .properties.in_.path,
1262
1324
  values: valueList.toArray(),
1263
1325
  })).chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
1264
1326
  switch (term.termType) {
@@ -1282,8 +1344,8 @@ export var PropertyShape;
1282
1344
  ? values.map((value) => Maybe.of(value))
1283
1345
  : Resource.Values.fromValue({
1284
1346
  focusResource: $resource,
1285
- propertyPath: PropertyShape.$schema.properties
1286
- .in_.path,
1347
+ propertyPath: PropertyShape.$schema
1348
+ .properties.in_.path,
1287
1349
  value: Maybe.empty(),
1288
1350
  })),
1289
1351
  }).chain((in_) => $shaclPropertyFromRdf({
@@ -1326,9 +1388,10 @@ export var PropertyShape;
1326
1388
  })))
1327
1389
  .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
1328
1390
  focusResource: $resource,
1329
- propertyPath: PropertyShape.$schema
1330
- .properties.languageIn
1331
- .path,
1391
+ propertyPath: PropertyShape
1392
+ .$schema
1393
+ .properties
1394
+ .languageIn.path,
1332
1395
  values: valueList.toArray(),
1333
1396
  }))
1334
1397
  .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
@@ -1369,15 +1432,18 @@ export var PropertyShape;
1369
1432
  ? values.map((value) => Maybe.of(value))
1370
1433
  : Resource.Values.fromValue({
1371
1434
  focusResource: $resource,
1372
- propertyPath: PropertyShape.$schema
1435
+ propertyPath: PropertyShape
1436
+ .$schema
1373
1437
  .properties
1374
- .maxExclusive.path,
1438
+ .maxExclusive
1439
+ .path,
1375
1440
  value: Maybe.empty(),
1376
1441
  })),
1377
1442
  }).chain((maxExclusive) => $shaclPropertyFromRdf({
1378
1443
  graph: _$options.graph,
1379
1444
  resource: $resource,
1380
- propertySchema: PropertyShape.$schema.properties.maxInclusive,
1445
+ propertySchema: PropertyShape.$schema.properties
1446
+ .maxInclusive,
1381
1447
  typeFromRdf: (resourceValues) => resourceValues
1382
1448
  .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1383
1449
  .chain((values) => values.chainMap((value) => value.toLiteral()))
@@ -1395,7 +1461,8 @@ export var PropertyShape;
1395
1461
  }).chain((maxInclusive) => $shaclPropertyFromRdf({
1396
1462
  graph: _$options.graph,
1397
1463
  resource: $resource,
1398
- propertySchema: PropertyShape.$schema.properties.maxLength,
1464
+ propertySchema: PropertyShape.$schema.properties
1465
+ .maxLength,
1399
1466
  typeFromRdf: (resourceValues) => resourceValues
1400
1467
  .chain((values) => values.chainMap((value) => value.toInt()))
1401
1468
  .map((values) => values.length > 0
@@ -1405,13 +1472,15 @@ export var PropertyShape;
1405
1472
  propertyPath: PropertyShape
1406
1473
  .$schema
1407
1474
  .properties
1408
- .maxLength.path,
1475
+ .maxLength
1476
+ .path,
1409
1477
  value: Maybe.empty(),
1410
1478
  })),
1411
1479
  }).chain((maxLength) => $shaclPropertyFromRdf({
1412
1480
  graph: _$options.graph,
1413
1481
  resource: $resource,
1414
- propertySchema: PropertyShape.$schema.properties.minCount,
1482
+ propertySchema: PropertyShape.$schema.properties
1483
+ .minCount,
1415
1484
  typeFromRdf: (resourceValues) => resourceValues
1416
1485
  .chain((values) => values.chainMap((value) => value.toInt()))
1417
1486
  .map((values) => values.length > 0
@@ -1470,7 +1539,8 @@ export var PropertyShape;
1470
1539
  .minLength,
1471
1540
  typeFromRdf: (resourceValues) => resourceValues
1472
1541
  .chain((values) => values.chainMap((value) => value.toInt()))
1473
- .map((values) => values.length > 0
1542
+ .map((values) => values.length >
1543
+ 0
1474
1544
  ? values.map((value) => Maybe.of(value))
1475
1545
  : Resource.Values.fromValue({
1476
1546
  focusResource: $resource,
@@ -1484,7 +1554,8 @@ export var PropertyShape;
1484
1554
  }).chain((minLength) => $shaclPropertyFromRdf({
1485
1555
  graph: _$options.graph,
1486
1556
  resource: $resource,
1487
- propertySchema: PropertyShape.$schema.properties
1557
+ propertySchema: PropertyShape.$schema
1558
+ .properties
1488
1559
  .mutable,
1489
1560
  typeFromRdf: (resourceValues) => resourceValues
1490
1561
  .chain((values) => values.chainMap((value) => value.toBoolean()))
@@ -1801,6 +1872,7 @@ export var PropertyShape;
1801
1872
  deactivated,
1802
1873
  defaultValue,
1803
1874
  description,
1875
+ display,
1804
1876
  flags,
1805
1877
  groups,
1806
1878
  hasValues,
@@ -1830,7 +1902,7 @@ export var PropertyShape;
1830
1902
  uniqueLang,
1831
1903
  visibility,
1832
1904
  xone,
1833
- }))))))))))))))))))))))))))))))))))))))));
1905
+ })))))))))))))))))))))))))))))))))))))))));
1834
1906
  };
1835
1907
  PropertyShape.$schema = {
1836
1908
  properties: {
@@ -1904,6 +1976,15 @@ export var PropertyShape;
1904
1976
  }),
1905
1977
  path: dataFactory.namedNode("http://www.w3.org/ns/shacl#description"),
1906
1978
  },
1979
+ display: {
1980
+ kind: "Shacl",
1981
+ type: () => ({
1982
+ kind: "DefaultValue",
1983
+ item: () => ({ kind: "Boolean" }),
1984
+ defaultValue: dataFactory.literal("false", $RdfVocabularies.xsd.boolean),
1985
+ }),
1986
+ path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#display"),
1987
+ },
1907
1988
  flags: {
1908
1989
  kind: "Shacl",
1909
1990
  type: () => ({
@@ -2166,7 +2247,10 @@ export var PropertyShape;
2166
2247
  };
2167
2248
  function $toRdfResource(_propertyShape, options) {
2168
2249
  const resourceSet = options?.resourceSet ??
2169
- new ResourceSet(datasetFactory.dataset(), { dataFactory: dataFactory });
2250
+ new ResourceSet({
2251
+ dataFactory: dataFactory,
2252
+ dataset: datasetFactory.dataset(),
2253
+ });
2170
2254
  const resource = resourceSet.resource(_propertyShape.$identifier);
2171
2255
  if (!options?.ignoreRdfType) {
2172
2256
  resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"), options?.graph);
@@ -2207,6 +2291,11 @@ export var PropertyShape;
2207
2291
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#description"), _propertyShape.description
2208
2292
  .toList()
2209
2293
  .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
2294
+ resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#display"), $strictEquals(_propertyShape.display, false).isLeft()
2295
+ ? [
2296
+ $literalFactory.boolean(_propertyShape.display, $RdfVocabularies.xsd.boolean),
2297
+ ]
2298
+ : [], options?.graph);
2210
2299
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#flags"), _propertyShape.flags.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
2211
2300
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#group"), _propertyShape.groups.flatMap((item) => [item]), options?.graph);
2212
2301
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#hasValue"), _propertyShape.hasValues.flatMap((item) => [item]), options?.graph);
@@ -2362,6 +2451,22 @@ export var PropertyShape;
2362
2451
  return resource;
2363
2452
  }
2364
2453
  PropertyShape.$toRdfResource = $toRdfResource;
2454
+ function $propertiesToStrings(_propertyShape) {
2455
+ return $compactRecord({
2456
+ $identifier: _propertyShape.$identifier.toString(),
2457
+ label: _propertyShape.label.map((item) => item.toString()).extract(),
2458
+ name: _propertyShape.name.map((item) => item.toString()).extract(),
2459
+ path: $PropertyPath.$toString(_propertyShape.path),
2460
+ shaclmateName: _propertyShape.shaclmateName
2461
+ .map((item) => item.toString())
2462
+ .extract(),
2463
+ });
2464
+ }
2465
+ PropertyShape.$propertiesToStrings = $propertiesToStrings;
2466
+ function $toString(_propertyShape) {
2467
+ return `PropertyShape(${JSON.stringify($propertiesToStrings((_propertyShape ?? this)))})`;
2468
+ }
2469
+ PropertyShape.$toString = $toString;
2365
2470
  })(PropertyShape || (PropertyShape = {}));
2366
2471
  export var PropertyGroup;
2367
2472
  (function (PropertyGroup) {
@@ -2546,7 +2651,10 @@ export var PropertyGroup;
2546
2651
  };
2547
2652
  function $toRdfResource(_propertyGroup, options) {
2548
2653
  const resourceSet = options?.resourceSet ??
2549
- new ResourceSet(datasetFactory.dataset(), { dataFactory: dataFactory });
2654
+ new ResourceSet({
2655
+ dataFactory: dataFactory,
2656
+ dataset: datasetFactory.dataset(),
2657
+ });
2550
2658
  const resource = resourceSet.resource(_propertyGroup.$identifier);
2551
2659
  if (!options?.ignoreRdfType) {
2552
2660
  resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup"), options?.graph);
@@ -2560,6 +2668,17 @@ export var PropertyGroup;
2560
2668
  return resource;
2561
2669
  }
2562
2670
  PropertyGroup.$toRdfResource = $toRdfResource;
2671
+ function $propertiesToStrings(_propertyGroup) {
2672
+ return $compactRecord({
2673
+ $identifier: _propertyGroup.$identifier.toString(),
2674
+ label: _propertyGroup.label.map((item) => item.toString()).extract(),
2675
+ });
2676
+ }
2677
+ PropertyGroup.$propertiesToStrings = $propertiesToStrings;
2678
+ function $toString(_propertyGroup) {
2679
+ return `PropertyGroup(${JSON.stringify($propertiesToStrings((_propertyGroup ?? this)))})`;
2680
+ }
2681
+ PropertyGroup.$toString = $toString;
2563
2682
  })(PropertyGroup || (PropertyGroup = {}));
2564
2683
  export var Ontology;
2565
2684
  (function (Ontology) {
@@ -2974,7 +3093,10 @@ export var Ontology;
2974
3093
  };
2975
3094
  function $toRdfResource(_ontology, options) {
2976
3095
  const resourceSet = options?.resourceSet ??
2977
- new ResourceSet(datasetFactory.dataset(), { dataFactory: dataFactory });
3096
+ new ResourceSet({
3097
+ dataFactory: dataFactory,
3098
+ dataset: datasetFactory.dataset(),
3099
+ });
2978
3100
  const resource = resourceSet.resource(_ontology.$identifier);
2979
3101
  if (!options?.ignoreRdfType) {
2980
3102
  resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"), options?.graph);
@@ -2992,6 +3114,17 @@ export var Ontology;
2992
3114
  return resource;
2993
3115
  }
2994
3116
  Ontology.$toRdfResource = $toRdfResource;
3117
+ function $propertiesToStrings(_ontology) {
3118
+ return $compactRecord({
3119
+ $identifier: _ontology.$identifier.toString(),
3120
+ label: _ontology.label.map((item) => item.toString()).extract(),
3121
+ });
3122
+ }
3123
+ Ontology.$propertiesToStrings = $propertiesToStrings;
3124
+ function $toString(_ontology) {
3125
+ return `Ontology(${JSON.stringify($propertiesToStrings((_ontology ?? this)))})`;
3126
+ }
3127
+ Ontology.$toString = $toString;
2995
3128
  })(Ontology || (Ontology = {}));
2996
3129
  export var NodeShape;
2997
3130
  (function (NodeShape) {
@@ -5315,7 +5448,10 @@ export var NodeShape;
5315
5448
  };
5316
5449
  function $toRdfResource(_nodeShape, options) {
5317
5450
  const resourceSet = options?.resourceSet ??
5318
- new ResourceSet(datasetFactory.dataset(), { dataFactory: dataFactory });
5451
+ new ResourceSet({
5452
+ dataFactory: dataFactory,
5453
+ dataset: datasetFactory.dataset(),
5454
+ });
5319
5455
  const resource = resourceSet.resource(_nodeShape.$identifier);
5320
5456
  if (!options?.ignoreRdfType) {
5321
5457
  resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape"), options?.graph);
@@ -5536,6 +5672,20 @@ export var NodeShape;
5536
5672
  return resource;
5537
5673
  }
5538
5674
  NodeShape.$toRdfResource = $toRdfResource;
5675
+ function $propertiesToStrings(_nodeShape) {
5676
+ return $compactRecord({
5677
+ $identifier: _nodeShape.$identifier.toString(),
5678
+ label: _nodeShape.label.map((item) => item.toString()).extract(),
5679
+ shaclmateName: _nodeShape.shaclmateName
5680
+ .map((item) => item.toString())
5681
+ .extract(),
5682
+ });
5683
+ }
5684
+ NodeShape.$propertiesToStrings = $propertiesToStrings;
5685
+ function $toString(_nodeShape) {
5686
+ return `NodeShape(${JSON.stringify($propertiesToStrings((_nodeShape ?? this)))})`;
5687
+ }
5688
+ NodeShape.$toString = $toString;
5539
5689
  })(NodeShape || (NodeShape = {}));
5540
5690
  export var Shape;
5541
5691
  (function (Shape) {
@@ -5873,6 +6023,15 @@ export var Shape;
5873
6023
  }
5874
6024
  throw new Error("unable to serialize to RDF");
5875
6025
  });
6026
+ Shape.$toString = (value) => {
6027
+ if (NodeShape.isNodeShape(value)) {
6028
+ return NodeShape.$toString(value);
6029
+ }
6030
+ if (PropertyShape.isPropertyShape(value)) {
6031
+ return PropertyShape.$toString(value);
6032
+ }
6033
+ throw new Error("unable to serialize to string");
6034
+ };
5876
6035
  function isShape(object) {
5877
6036
  return (NodeShape.isNodeShape(object) || PropertyShape.isPropertyShape(object));
5878
6037
  }
@@ -6054,6 +6213,21 @@ export var $Object;
6054
6213
  }
6055
6214
  throw new Error("unable to serialize to RDF");
6056
6215
  });
6216
+ $Object.$toString = (value) => {
6217
+ if (NodeShape.isNodeShape(value)) {
6218
+ return NodeShape.$toString(value);
6219
+ }
6220
+ if (Ontology.isOntology(value)) {
6221
+ return Ontology.$toString(value);
6222
+ }
6223
+ if (PropertyGroup.isPropertyGroup(value)) {
6224
+ return PropertyGroup.$toString(value);
6225
+ }
6226
+ if (PropertyShape.isPropertyShape(value)) {
6227
+ return PropertyShape.$toString(value);
6228
+ }
6229
+ throw new Error("unable to serialize to string");
6230
+ };
6057
6231
  })($Object || ($Object = {}));
6058
6232
  export class $RdfjsDatasetObjectSet {
6059
6233
  $graph;
@@ -6069,7 +6243,10 @@ export class $RdfjsDatasetObjectSet {
6069
6243
  return this.#dataset();
6070
6244
  }
6071
6245
  $resourceSet() {
6072
- return new ResourceSet(this.$dataset(), { dataFactory: dataFactory });
6246
+ return new ResourceSet({
6247
+ dataFactory: dataFactory,
6248
+ dataset: this.$dataset(),
6249
+ });
6073
6250
  }
6074
6251
  async nodeShape(identifier, options) {
6075
6252
  return this.nodeShapeSync(identifier, options);
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "dependencies": {
3
- "@shaclmate/shacl-ast": "4.0.21",
3
+ "@shaclmate/shacl-ast": "4.0.23",
4
4
  "@rdfjs/dataset": "~2.0.2",
5
5
  "@rdfjs/prefix-map": "~0.1.2",
6
6
  "@rdfjs/term-map": "~2.0.2",
7
7
  "@rdfjs/term-set": "~2.0.3",
8
8
  "@rdfjs/types": "~2.0.1",
9
- "@rdfx/data-factory": "0.0.11",
10
- "@rdfx/literal": "0.0.11",
11
- "@rdfx/resource": "0.0.11",
12
- "@rdfx/string": "0.0.11",
9
+ "@rdfx/data-factory": "0.0.12",
10
+ "@rdfx/literal": "0.0.12",
11
+ "@rdfx/resource": "0.0.12",
12
+ "@rdfx/string": "0.0.12",
13
13
  "@sindresorhus/base62": "~0.1.0",
14
14
  "@tpluscode/rdf-ns-builders": "~4.3.0",
15
15
  "@types/rdfjs__dataset": "~2.0.7",
@@ -70,5 +70,5 @@
70
70
  },
71
71
  "type": "module",
72
72
  "types": "./dist/index.d.ts",
73
- "version": "4.0.21"
73
+ "version": "4.0.23"
74
74
  }