@shaclmate/compiler 4.0.35 → 4.0.37

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 (76) hide show
  1. package/dist/ShapesGraphToAstTransformer.js +10 -0
  2. package/dist/ast/Ast.d.ts +1 -0
  3. package/dist/generators/ts/AbstractNamedUnionType.js +39 -22
  4. package/dist/generators/ts/AbstractObjectSetType.d.ts +35 -0
  5. package/dist/generators/ts/AbstractObjectSetType.js +44 -0
  6. package/dist/generators/ts/GraphqlSchema.d.ts +22 -0
  7. package/dist/generators/ts/GraphqlSchema.js +87 -0
  8. package/dist/generators/ts/NamedObjectType.js +13 -4
  9. package/dist/generators/ts/NamedObjectUnionType.js +14 -5
  10. package/dist/generators/ts/ObjectSetType.d.ts +6 -0
  11. package/dist/generators/ts/ObjectSetType.js +36 -0
  12. package/dist/generators/ts/RdfjsDatasetObjectSetType.d.ts +6 -0
  13. package/dist/generators/ts/{rdfjsDatasetObjectSetClassDeclaration.js → RdfjsDatasetObjectSetType.js} +73 -69
  14. package/dist/generators/ts/Snippets.d.ts +1 -0
  15. package/dist/generators/ts/Snippets.js +7 -0
  16. package/dist/generators/ts/SparqlObjectSetType.d.ts +6 -0
  17. package/dist/generators/ts/{sparqlObjectSetClassDeclaration.js → SparqlObjectSetType.js} +40 -35
  18. package/dist/generators/ts/TsFeature.d.ts +1 -1
  19. package/dist/generators/ts/TsFeature.js +25 -7
  20. package/dist/generators/ts/TsGenerator.d.ts +7 -8
  21. package/dist/generators/ts/TsGenerator.js +141 -52
  22. package/dist/generators/ts/ZodGenerator.d.ts +1 -2
  23. package/dist/generators/ts/ZodGenerator.js +12 -12
  24. package/dist/generators/ts/_NamedObjectType/NamedObjectType_createFunctionDeclaration.js +18 -12
  25. package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.js +1 -1
  26. package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterFunctionDeclaration.d.ts +2 -1
  27. package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterFunctionDeclaration.js +6 -2
  28. package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterTypeDeclaration.d.ts +2 -1
  29. package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterTypeDeclaration.js +6 -2
  30. package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js +1 -1
  31. package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js +1 -1
  32. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js +1 -1
  33. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js +1 -1
  34. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.js +1 -1
  35. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.js +1 -1
  36. package/dist/generators/ts/_NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.js +1 -1
  37. package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionDeclarations.js +1 -1
  38. package/dist/generators/ts/_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.d.ts +2 -1
  39. package/dist/generators/ts/_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.js +6 -2
  40. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.js +1 -1
  41. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.js +1 -1
  42. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.js +1 -1
  43. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js +1 -1
  44. package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.d.ts +2 -1
  45. package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.js +6 -2
  46. package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.js +1 -1
  47. package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.js +1 -1
  48. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.js +3 -2
  49. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionDeclaration.js +1 -1
  50. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.js +5 -4
  51. package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.js +1 -1
  52. package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.js +1 -1
  53. package/dist/generators/ts/_NamedObjectType/ShaclProperty.js +4 -2
  54. package/dist/generators/ts/_NamedObjectType/identifierTypeDeclarations.js +3 -0
  55. package/dist/generators/ts/_snippets/snippets_FromRdfResourceFunction.js +2 -2
  56. package/dist/generators/ts/_snippets/snippets_FromRdfResourceValuesFunction.js +2 -2
  57. package/dist/generators/ts/_snippets/snippets_PropertyPath.js +12 -6
  58. package/dist/generators/ts/_snippets/snippets__FromRdfResourceFunction.js +2 -2
  59. package/dist/generators/ts/_snippets/snippets_monkeyPatchObject.d.ts +3 -0
  60. package/dist/generators/ts/_snippets/snippets_monkeyPatchObject.js +16 -0
  61. package/dist/generators/ts/_snippets/snippets_wrap_FromRdfResourceFunction.js +3 -4
  62. package/dist/input/generated.d.ts +1 -286
  63. package/dist/input/generated.js +104 -1093
  64. package/package.json +2 -2
  65. package/dist/generators/ts/graphqlSchemaVariableStatement.d.ts +0 -10
  66. package/dist/generators/ts/graphqlSchemaVariableStatement.js +0 -84
  67. package/dist/generators/ts/objectSetDeclarations.d.ts +0 -9
  68. package/dist/generators/ts/objectSetDeclarations.js +0 -30
  69. package/dist/generators/ts/objectSetInterfaceDeclaration.d.ts +0 -9
  70. package/dist/generators/ts/objectSetInterfaceDeclaration.js +0 -26
  71. package/dist/generators/ts/objectSetMethodSignatures.d.ts +0 -18
  72. package/dist/generators/ts/objectSetMethodSignatures.js +0 -31
  73. package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.d.ts +0 -9
  74. package/dist/generators/ts/sparqlObjectSetClassDeclaration.d.ts +0 -9
  75. package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.d.ts +0 -12
  76. package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.js +0 -21
@@ -102,119 +102,6 @@ export var $EqualsResult;
102
102
  }
103
103
  $EqualsResult.fromBooleanEqualsResult = fromBooleanEqualsResult;
104
104
  })($EqualsResult || ($EqualsResult = {}));
105
- function $filterArray(filterItem) {
106
- return (filter, values) => {
107
- for (const value of values) {
108
- if (!filterItem(filter, value)) {
109
- return false;
110
- }
111
- }
112
- if (filter.$maxCount !== undefined && values.length > filter.$maxCount) {
113
- return false;
114
- }
115
- if (filter.$minCount !== undefined && values.length < filter.$minCount) {
116
- return false;
117
- }
118
- return true;
119
- };
120
- }
121
- function $filterBoolean(filter, value) {
122
- if (filter.value !== undefined && value !== filter.value) {
123
- return false;
124
- }
125
- return true;
126
- }
127
- function $filterIdentifier(filter, value) {
128
- if (filter.in !== undefined &&
129
- !filter.in.some((inValue) => inValue.equals(value))) {
130
- return false;
131
- }
132
- if (filter.type !== undefined && value.termType !== filter.type) {
133
- return false;
134
- }
135
- return true;
136
- }
137
- function $filterIri(filter, value) {
138
- if (filter.in !== undefined &&
139
- !filter.in.some((inValue) => inValue.equals(value))) {
140
- return false;
141
- }
142
- return true;
143
- }
144
- function $filterLiteral(filter, value) {
145
- return $filterTerm(filter, value);
146
- }
147
- function $filterMaybe(filterItem) {
148
- return (filter, value) => {
149
- if (filter !== null) {
150
- if (value.isNothing()) {
151
- return false;
152
- }
153
- if (!filterItem(filter, value.extract())) {
154
- return false;
155
- }
156
- }
157
- else {
158
- if (value.isJust()) {
159
- return false;
160
- }
161
- }
162
- return true;
163
- };
164
- }
165
- function $filterNumeric(filter, value) {
166
- if (filter.in !== undefined &&
167
- !filter.in.some((inValue) => inValue === value)) {
168
- return false;
169
- }
170
- if (filter.maxExclusive !== undefined && value >= filter.maxExclusive) {
171
- return false;
172
- }
173
- if (filter.maxInclusive !== undefined && value > filter.maxInclusive) {
174
- return false;
175
- }
176
- if (filter.minExclusive !== undefined && value <= filter.minExclusive) {
177
- return false;
178
- }
179
- if (filter.minInclusive !== undefined && value < filter.minInclusive) {
180
- return false;
181
- }
182
- return true;
183
- }
184
- function $filterString(filter, value) {
185
- if (filter.in !== undefined &&
186
- !filter.in.some((inValue) => inValue === value)) {
187
- return false;
188
- }
189
- if (filter.maxLength !== undefined && value.length > filter.maxLength) {
190
- return false;
191
- }
192
- if (filter.minLength !== undefined && value.length < filter.minLength) {
193
- return false;
194
- }
195
- return true;
196
- }
197
- function $filterTerm(filter, value) {
198
- if (filter.datatypeIn !== undefined &&
199
- (value.termType !== "Literal" ||
200
- !filter.datatypeIn.some((inDatatype) => inDatatype.equals(value.datatype)))) {
201
- return false;
202
- }
203
- if (filter.in !== undefined &&
204
- !filter.in.some((inTerm) => inTerm.equals(value))) {
205
- return false;
206
- }
207
- if (filter.languageIn !== undefined &&
208
- (value.termType !== "Literal" ||
209
- !filter.languageIn.some((inLanguage) => inLanguage === value.language))) {
210
- return false;
211
- }
212
- if (filter.typeIn !== undefined &&
213
- !filter.typeIn.some((inType) => inType === value.termType)) {
214
- return false;
215
- }
216
- return true;
217
- }
218
105
  function $fromRdfPreferredLanguages(values, preferredLanguages) {
219
106
  if (!preferredLanguages || preferredLanguages.length === 0) {
220
107
  return Right(values);
@@ -237,28 +124,6 @@ function $fromRdfPreferredLanguages(values, preferredLanguages) {
237
124
  values: filteredValues,
238
125
  }));
239
126
  }
240
- class $IdentifierSet {
241
- blankNodeValues = new Set();
242
- namedNodeValues = new Set();
243
- add(identifier) {
244
- switch (identifier.termType) {
245
- case "BlankNode":
246
- this.blankNodeValues.add(identifier.value);
247
- return this;
248
- case "NamedNode":
249
- this.namedNodeValues.add(identifier.value);
250
- return this;
251
- }
252
- }
253
- has(identifier) {
254
- switch (identifier.termType) {
255
- case "BlankNode":
256
- return this.blankNodeValues.has(identifier.value);
257
- case "NamedNode":
258
- return this.namedNodeValues.has(identifier.value);
259
- }
260
- }
261
- }
262
127
  function $identityConversionFunction(value) {
263
128
  return Either.of(value);
264
129
  }
@@ -266,13 +131,26 @@ function $identityValidationFunction(_schema, value) {
266
131
  return Either.of(value);
267
132
  }
268
133
  const $literalFactory = new LiteralFactory({ dataFactory: dataFactory });
134
+ function $monkeyPatchObject(obj, methods) {
135
+ if (methods.toJson &&
136
+ !globalThis.Object.prototype.hasOwnProperty.call(obj, "toJSON")) {
137
+ const toJsonMethod = methods.toJson;
138
+ obj.toJSON = function (_key) {
139
+ return toJsonMethod(this);
140
+ };
141
+ }
142
+ if (methods.$toString &&
143
+ !globalThis.Object.prototype.hasOwnProperty.call(obj, "toString")) {
144
+ const toStringMethod = methods.$toString;
145
+ obj.toString = function () {
146
+ return toStringMethod(this);
147
+ };
148
+ }
149
+ return obj;
150
+ }
269
151
  const $parseIdentifier = NTriplesIdentifier.parser(dataFactory);
270
152
  export var $PropertyPath;
271
153
  (function ($PropertyPath) {
272
- function filter(_filter, _value) {
273
- return true;
274
- }
275
- $PropertyPath.filter = filter;
276
154
  $PropertyPath.fromRdfResource = RdfxResourcePropertyPath.fromResource;
277
155
  $PropertyPath.fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
278
156
  .toResource()
@@ -354,15 +232,11 @@ function $validateMaybe(validateItem) {
354
232
  }
355
233
  function $wrap_FromRdfResourceFunction(_fromRdfResourceFunction) {
356
234
  return (resource, options) => {
357
- let { context, graph, ignoreRdfType = false, objectSet, preferredLanguages, } = options ?? {};
358
- if (!objectSet) {
359
- objectSet = new $RdfjsDatasetObjectSet(resource.dataset);
360
- }
235
+ const { context, graph, ignoreRdfType = false, preferredLanguages, } = options ?? {};
361
236
  return _fromRdfResourceFunction(resource, {
362
237
  context,
363
238
  graph,
364
239
  ignoreRdfType,
365
- objectSet,
366
240
  preferredLanguages,
367
241
  });
368
242
  };
@@ -428,13 +302,7 @@ export var PropertyShape;
428
302
  shaclmateName: $convertToMaybe($identityConversionFunction)(parameters.shaclmateName).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.shaclmateName.type(), value)),
429
303
  uniqueLang: $convertToMaybe($identityConversionFunction)(parameters.uniqueLang).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.uniqueLang.type(), value)),
430
304
  xone: $convertToMaybe($convertToArray($convertToIdentifier, true))(parameters.xone).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(PropertyShape.schema.properties.xone.type(), value)),
431
- }).map((properties) => {
432
- const finalObject = { ...properties, $type: "PropertyShape" };
433
- if (!globalThis.Object.prototype.hasOwnProperty.call(finalObject, "toString")) {
434
- finalObject.toString = $toString;
435
- }
436
- return finalObject;
437
- });
305
+ }).map((properties) => $monkeyPatchObject({ ...properties, $type: "PropertyShape" }, { $toString }));
438
306
  }
439
307
  PropertyShape.create = create;
440
308
  function createUnsafe(parameters) {
@@ -446,158 +314,6 @@ export var PropertyShape;
446
314
  Identifier.parse = $parseIdentifier;
447
315
  Identifier.stringify = NTriplesTerm.stringify;
448
316
  })(Identifier = PropertyShape.Identifier || (PropertyShape.Identifier = {}));
449
- function filter(filter, value) {
450
- if (filter.$identifier !== undefined &&
451
- !$filterIdentifier(filter.$identifier, value.$identifier())) {
452
- return false;
453
- }
454
- if (filter.and !== undefined &&
455
- !$filterMaybe($filterArray($filterIdentifier))(filter.and, value.and)) {
456
- return false;
457
- }
458
- if (filter.classes !== undefined &&
459
- !$filterArray($filterIri)(filter.classes, value.classes)) {
460
- return false;
461
- }
462
- if (filter.comment !== undefined &&
463
- !$filterMaybe($filterString)(filter.comment, value.comment)) {
464
- return false;
465
- }
466
- if (filter.datatype !== undefined &&
467
- !$filterMaybe($filterIri)(filter.datatype, value.datatype)) {
468
- return false;
469
- }
470
- if (filter.deactivated !== undefined &&
471
- !$filterMaybe($filterBoolean)(filter.deactivated, value.deactivated)) {
472
- return false;
473
- }
474
- if (filter.defaultValue !== undefined &&
475
- !$filterMaybe($filterTerm)(filter.defaultValue, value.defaultValue)) {
476
- return false;
477
- }
478
- if (filter.description !== undefined &&
479
- !$filterMaybe($filterString)(filter.description, value.description)) {
480
- return false;
481
- }
482
- if (filter.display !== undefined &&
483
- !$filterBoolean(filter.display, value.display)) {
484
- return false;
485
- }
486
- if (filter.flags !== undefined &&
487
- !$filterArray($filterString)(filter.flags, value.flags)) {
488
- return false;
489
- }
490
- if (filter.groups !== undefined &&
491
- !$filterArray($filterIdentifier)(filter.groups, value.groups)) {
492
- return false;
493
- }
494
- if (filter.hasValues !== undefined &&
495
- !$filterArray($filterTerm)(filter.hasValues, value.hasValues)) {
496
- return false;
497
- }
498
- if (filter.in_ !== undefined &&
499
- !$filterMaybe($filterArray($filterTerm))(filter.in_, value.in_)) {
500
- return false;
501
- }
502
- if (filter.isDefinedBy !== undefined &&
503
- !$filterMaybe($filterIdentifier)(filter.isDefinedBy, value.isDefinedBy)) {
504
- return false;
505
- }
506
- if (filter.label !== undefined &&
507
- !$filterMaybe($filterString)(filter.label, value.label)) {
508
- return false;
509
- }
510
- if (filter.languageIn !== undefined &&
511
- !$filterMaybe($filterArray($filterString))(filter.languageIn, value.languageIn)) {
512
- return false;
513
- }
514
- if (filter.maxCount !== undefined &&
515
- !$filterMaybe(($filterNumeric))(filter.maxCount, value.maxCount)) {
516
- return false;
517
- }
518
- if (filter.maxExclusive !== undefined &&
519
- !$filterMaybe($filterLiteral)(filter.maxExclusive, value.maxExclusive)) {
520
- return false;
521
- }
522
- if (filter.maxInclusive !== undefined &&
523
- !$filterMaybe($filterLiteral)(filter.maxInclusive, value.maxInclusive)) {
524
- return false;
525
- }
526
- if (filter.maxLength !== undefined &&
527
- !$filterMaybe(($filterNumeric))(filter.maxLength, value.maxLength)) {
528
- return false;
529
- }
530
- if (filter.minCount !== undefined &&
531
- !$filterMaybe(($filterNumeric))(filter.minCount, value.minCount)) {
532
- return false;
533
- }
534
- if (filter.minExclusive !== undefined &&
535
- !$filterMaybe($filterLiteral)(filter.minExclusive, value.minExclusive)) {
536
- return false;
537
- }
538
- if (filter.minInclusive !== undefined &&
539
- !$filterMaybe($filterLiteral)(filter.minInclusive, value.minInclusive)) {
540
- return false;
541
- }
542
- if (filter.minLength !== undefined &&
543
- !$filterMaybe(($filterNumeric))(filter.minLength, value.minLength)) {
544
- return false;
545
- }
546
- if (filter.mutable !== undefined &&
547
- !$filterMaybe($filterBoolean)(filter.mutable, value.mutable)) {
548
- return false;
549
- }
550
- if (filter.name !== undefined &&
551
- !$filterMaybe($filterString)(filter.name, value.name)) {
552
- return false;
553
- }
554
- if (filter.node !== undefined &&
555
- !$filterMaybe($filterIdentifier)(filter.node, value.node)) {
556
- return false;
557
- }
558
- if (filter.nodeKind !== undefined &&
559
- !$filterMaybe($filterIri)(filter.nodeKind, value.nodeKind)) {
560
- return false;
561
- }
562
- if (filter.not !== undefined &&
563
- !$filterArray($filterIdentifier)(filter.not, value.not)) {
564
- return false;
565
- }
566
- if (filter.or !== undefined &&
567
- !$filterMaybe($filterArray($filterIdentifier))(filter.or, value.or)) {
568
- return false;
569
- }
570
- if (filter.order !== undefined &&
571
- !$filterMaybe(($filterNumeric))(filter.order, value.order)) {
572
- return false;
573
- }
574
- if (filter.path !== undefined &&
575
- !$PropertyPath.filter(filter.path, value.path)) {
576
- return false;
577
- }
578
- if (filter.patterns !== undefined &&
579
- !$filterArray($filterString)(filter.patterns, value.patterns)) {
580
- return false;
581
- }
582
- if (filter.resolve !== undefined &&
583
- !$filterMaybe($filterIdentifier)(filter.resolve, value.resolve)) {
584
- return false;
585
- }
586
- if (filter.shaclmateName !== undefined &&
587
- !$filterMaybe($filterString)(filter.shaclmateName, value.shaclmateName)) {
588
- return false;
589
- }
590
- if (filter.uniqueLang !== undefined &&
591
- !$filterMaybe($filterBoolean)(filter.uniqueLang, value.uniqueLang)) {
592
- return false;
593
- }
594
- if (filter.xone !== undefined &&
595
- !$filterMaybe($filterArray($filterIdentifier))(filter.xone, value.xone)) {
596
- return false;
597
- }
598
- return true;
599
- }
600
- PropertyShape.filter = filter;
601
317
  PropertyShape._fromRdfResource = ($resource, _$options) => {
602
318
  return (!_$options.ignoreRdfType
603
319
  ? $resource
@@ -1130,7 +846,6 @@ export var PropertyShape;
1130
846
  typeFromRdf: (resourceValues) => $PropertyPath.fromRdfResourceValues(resourceValues, {
1131
847
  context: _$options.context,
1132
848
  graph: _$options.graph,
1133
- objectSet: _$options.objectSet,
1134
849
  preferredLanguages: _$options.preferredLanguages,
1135
850
  resource: $resource,
1136
851
  ignoreRdfType: true,
@@ -1560,7 +1275,7 @@ export var PropertyShape;
1560
1275
  if (!parameters.ignoreRdfType) {
1561
1276
  parameters.resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"), parameters.graph);
1562
1277
  }
1563
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#and"), parameters.object.and.toList().flatMap((value) => [
1278
+ parameters.resource.add(PropertyShape.schema.properties.and.path, parameters.object.and.toList().flatMap((value) => [
1564
1279
  value.length > 0
1565
1280
  ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
1566
1281
  if (itemIndex === 0) {
@@ -1582,29 +1297,29 @@ export var PropertyShape;
1582
1297
  }).listResource.identifier
1583
1298
  : $RdfVocabularies.rdf.nil,
1584
1299
  ]), parameters.graph);
1585
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#class"), parameters.object.classes.flatMap((item) => [item]), parameters.graph);
1586
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), parameters.object.comment
1300
+ parameters.resource.add(PropertyShape.schema.properties.classes.path, parameters.object.classes.flatMap((item) => [item]), parameters.graph);
1301
+ parameters.resource.add(PropertyShape.schema.properties.comment.path, parameters.object.comment
1587
1302
  .toList()
1588
1303
  .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
1589
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#datatype"), parameters.object.datatype.toList(), parameters.graph);
1590
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"), parameters.object.deactivated
1304
+ parameters.resource.add(PropertyShape.schema.properties.datatype.path, parameters.object.datatype.toList(), parameters.graph);
1305
+ parameters.resource.add(PropertyShape.schema.properties.deactivated.path, parameters.object.deactivated
1591
1306
  .toList()
1592
1307
  .flatMap((value) => [
1593
1308
  $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
1594
1309
  ]), parameters.graph);
1595
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#defaultValue"), parameters.object.defaultValue.toList(), parameters.graph);
1596
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#description"), parameters.object.description
1310
+ parameters.resource.add(PropertyShape.schema.properties.defaultValue.path, parameters.object.defaultValue.toList(), parameters.graph);
1311
+ parameters.resource.add(PropertyShape.schema.properties.description.path, parameters.object.description
1597
1312
  .toList()
1598
1313
  .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
1599
- parameters.resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#display"), $strictEquals(parameters.object.display, false).isLeft()
1314
+ parameters.resource.add(PropertyShape.schema.properties.display.path, $strictEquals(parameters.object.display, false).isLeft()
1600
1315
  ? [
1601
1316
  $literalFactory.boolean(parameters.object.display, $RdfVocabularies.xsd.boolean),
1602
1317
  ]
1603
1318
  : [], parameters.graph);
1604
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#flags"), parameters.object.flags.flatMap((item) => [$literalFactory.string(item)]), parameters.graph);
1605
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#group"), parameters.object.groups.flatMap((item) => [item]), parameters.graph);
1606
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#hasValue"), parameters.object.hasValues.flatMap((item) => [item]), parameters.graph);
1607
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#in"), parameters.object.in_.toList().flatMap((value) => [
1319
+ parameters.resource.add(PropertyShape.schema.properties.flags.path, parameters.object.flags.flatMap((item) => [$literalFactory.string(item)]), parameters.graph);
1320
+ parameters.resource.add(PropertyShape.schema.properties.groups.path, parameters.object.groups.flatMap((item) => [item]), parameters.graph);
1321
+ parameters.resource.add(PropertyShape.schema.properties.hasValues.path, parameters.object.hasValues.flatMap((item) => [item]), parameters.graph);
1322
+ parameters.resource.add(PropertyShape.schema.properties.in_.path, parameters.object.in_.toList().flatMap((value) => [
1608
1323
  value.length > 0
1609
1324
  ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
1610
1325
  if (itemIndex === 0) {
@@ -1626,11 +1341,11 @@ export var PropertyShape;
1626
1341
  }).listResource.identifier
1627
1342
  : $RdfVocabularies.rdf.nil,
1628
1343
  ]), parameters.graph);
1629
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"), parameters.object.isDefinedBy.toList(), parameters.graph);
1630
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), parameters.object.label
1344
+ parameters.resource.add(PropertyShape.schema.properties.isDefinedBy.path, parameters.object.isDefinedBy.toList(), parameters.graph);
1345
+ parameters.resource.add(PropertyShape.schema.properties.label.path, parameters.object.label
1631
1346
  .toList()
1632
1347
  .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
1633
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#languageIn"), parameters.object.languageIn.toList().flatMap((value) => [
1348
+ parameters.resource.add(PropertyShape.schema.properties.languageIn.path, parameters.object.languageIn.toList().flatMap((value) => [
1634
1349
  value.length > 0
1635
1350
  ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
1636
1351
  if (itemIndex === 0) {
@@ -1652,42 +1367,42 @@ export var PropertyShape;
1652
1367
  }).listResource.identifier
1653
1368
  : $RdfVocabularies.rdf.nil,
1654
1369
  ]), parameters.graph);
1655
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxCount"), parameters.object.maxCount
1370
+ parameters.resource.add(PropertyShape.schema.properties.maxCount.path, parameters.object.maxCount
1656
1371
  .toList()
1657
1372
  .flatMap((value) => [
1658
1373
  $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
1659
1374
  ]), parameters.graph);
1660
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxExclusive"), parameters.object.maxExclusive.toList(), parameters.graph);
1661
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxInclusive"), parameters.object.maxInclusive.toList(), parameters.graph);
1662
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxLength"), parameters.object.maxLength
1375
+ parameters.resource.add(PropertyShape.schema.properties.maxExclusive.path, parameters.object.maxExclusive.toList(), parameters.graph);
1376
+ parameters.resource.add(PropertyShape.schema.properties.maxInclusive.path, parameters.object.maxInclusive.toList(), parameters.graph);
1377
+ parameters.resource.add(PropertyShape.schema.properties.maxLength.path, parameters.object.maxLength
1663
1378
  .toList()
1664
1379
  .flatMap((value) => [
1665
1380
  $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
1666
1381
  ]), parameters.graph);
1667
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minCount"), parameters.object.minCount
1382
+ parameters.resource.add(PropertyShape.schema.properties.minCount.path, parameters.object.minCount
1668
1383
  .toList()
1669
1384
  .flatMap((value) => [
1670
1385
  $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
1671
1386
  ]), parameters.graph);
1672
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minExclusive"), parameters.object.minExclusive.toList(), parameters.graph);
1673
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minInclusive"), parameters.object.minInclusive.toList(), parameters.graph);
1674
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minLength"), parameters.object.minLength
1387
+ parameters.resource.add(PropertyShape.schema.properties.minExclusive.path, parameters.object.minExclusive.toList(), parameters.graph);
1388
+ parameters.resource.add(PropertyShape.schema.properties.minInclusive.path, parameters.object.minInclusive.toList(), parameters.graph);
1389
+ parameters.resource.add(PropertyShape.schema.properties.minLength.path, parameters.object.minLength
1675
1390
  .toList()
1676
1391
  .flatMap((value) => [
1677
1392
  $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
1678
1393
  ]), parameters.graph);
1679
- parameters.resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#mutable"), parameters.object.mutable
1394
+ parameters.resource.add(PropertyShape.schema.properties.mutable.path, parameters.object.mutable
1680
1395
  .toList()
1681
1396
  .flatMap((value) => [
1682
1397
  $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
1683
1398
  ]), parameters.graph);
1684
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#name"), parameters.object.name
1399
+ parameters.resource.add(PropertyShape.schema.properties.name.path, parameters.object.name
1685
1400
  .toList()
1686
1401
  .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
1687
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#node"), parameters.object.node.toList(), parameters.graph);
1688
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"), parameters.object.nodeKind.toList(), parameters.graph);
1689
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#not"), parameters.object.not.flatMap((item) => [item]), parameters.graph);
1690
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#or"), parameters.object.or.toList().flatMap((value) => [
1402
+ parameters.resource.add(PropertyShape.schema.properties.node.path, parameters.object.node.toList(), parameters.graph);
1403
+ parameters.resource.add(PropertyShape.schema.properties.nodeKind.path, parameters.object.nodeKind.toList(), parameters.graph);
1404
+ parameters.resource.add(PropertyShape.schema.properties.not.path, parameters.object.not.flatMap((item) => [item]), parameters.graph);
1405
+ parameters.resource.add(PropertyShape.schema.properties.or.path, parameters.object.or.toList().flatMap((value) => [
1691
1406
  value.length > 0
1692
1407
  ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
1693
1408
  if (itemIndex === 0) {
@@ -1709,30 +1424,30 @@ export var PropertyShape;
1709
1424
  }).listResource.identifier
1710
1425
  : $RdfVocabularies.rdf.nil,
1711
1426
  ]), parameters.graph);
1712
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#order"), parameters.object.order
1427
+ parameters.resource.add(PropertyShape.schema.properties.order.path, parameters.object.order
1713
1428
  .toList()
1714
1429
  .flatMap((value) => [
1715
1430
  $literalFactory.number(value, $RdfVocabularies.xsd.double),
1716
1431
  ]), parameters.graph);
1717
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#path"), [
1432
+ parameters.resource.add(PropertyShape.schema.properties.path.path, [
1718
1433
  $PropertyPath.toRdfResource(parameters.object.path, {
1719
1434
  graph: parameters.graph,
1720
1435
  resourceSet: parameters.resourceSet,
1721
1436
  }).identifier,
1722
1437
  ], parameters.graph);
1723
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#pattern"), parameters.object.patterns.flatMap((item) => [
1438
+ parameters.resource.add(PropertyShape.schema.properties.patterns.path, parameters.object.patterns.flatMap((item) => [
1724
1439
  $literalFactory.string(item),
1725
1440
  ]), parameters.graph);
1726
- parameters.resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#resolve"), parameters.object.resolve.toList(), parameters.graph);
1727
- parameters.resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#name"), parameters.object.shaclmateName
1441
+ parameters.resource.add(PropertyShape.schema.properties.resolve.path, parameters.object.resolve.toList(), parameters.graph);
1442
+ parameters.resource.add(PropertyShape.schema.properties.shaclmateName.path, parameters.object.shaclmateName
1728
1443
  .toList()
1729
1444
  .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
1730
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#uniqueLang"), parameters.object.uniqueLang
1445
+ parameters.resource.add(PropertyShape.schema.properties.uniqueLang.path, parameters.object.uniqueLang
1731
1446
  .toList()
1732
1447
  .flatMap((value) => [
1733
1448
  $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
1734
1449
  ]), parameters.graph);
1735
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#xone"), parameters.object.xone.toList().flatMap((value) => [
1450
+ parameters.resource.add(PropertyShape.schema.properties.xone.path, parameters.object.xone.toList().flatMap((value) => [
1736
1451
  value.length > 0
1737
1452
  ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
1738
1453
  if (itemIndex === 0) {
@@ -1770,7 +1485,7 @@ export var PropertyShape;
1770
1485
  }
1771
1486
  PropertyShape._propertiesToStrings = _propertiesToStrings;
1772
1487
  function $toString(_propertyShape) {
1773
- return `PropertyShape(${JSON.stringify(_propertiesToStrings((_propertyShape ?? this)))})`;
1488
+ return `PropertyShape(${JSON.stringify(_propertiesToStrings(_propertyShape))})`;
1774
1489
  }
1775
1490
  PropertyShape.$toString = $toString;
1776
1491
  })(PropertyShape || (PropertyShape = {}));
@@ -1781,13 +1496,7 @@ export var PropertyGroup;
1781
1496
  $identifier: $convertToIdentifierProperty(parameters?.$identifier),
1782
1497
  comment: $convertToMaybe($identityConversionFunction)(parameters?.comment).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.comment.type(), value)),
1783
1498
  label: $convertToMaybe($identityConversionFunction)(parameters?.label).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.label.type(), value)),
1784
- }).map((properties) => {
1785
- const finalObject = { ...properties, $type: "PropertyGroup" };
1786
- if (!globalThis.Object.prototype.hasOwnProperty.call(finalObject, "toString")) {
1787
- finalObject.toString = $toString;
1788
- }
1789
- return finalObject;
1790
- });
1499
+ }).map((properties) => $monkeyPatchObject({ ...properties, $type: "PropertyGroup" }, { $toString }));
1791
1500
  }
1792
1501
  PropertyGroup.create = create;
1793
1502
  function createUnsafe(parameters) {
@@ -1799,22 +1508,6 @@ export var PropertyGroup;
1799
1508
  Identifier.parse = $parseIdentifier;
1800
1509
  Identifier.stringify = NTriplesTerm.stringify;
1801
1510
  })(Identifier = PropertyGroup.Identifier || (PropertyGroup.Identifier = {}));
1802
- function filter(filter, value) {
1803
- if (filter.$identifier !== undefined &&
1804
- !$filterIdentifier(filter.$identifier, value.$identifier())) {
1805
- return false;
1806
- }
1807
- if (filter.comment !== undefined &&
1808
- !$filterMaybe($filterString)(filter.comment, value.comment)) {
1809
- return false;
1810
- }
1811
- if (filter.label !== undefined &&
1812
- !$filterMaybe($filterString)(filter.label, value.label)) {
1813
- return false;
1814
- }
1815
- return true;
1816
- }
1817
- PropertyGroup.filter = filter;
1818
1511
  PropertyGroup._fromRdfResource = ($resource, _$options) => {
1819
1512
  return (!_$options.ignoreRdfType
1820
1513
  ? $resource
@@ -1924,10 +1617,10 @@ export var PropertyGroup;
1924
1617
  if (!parameters.ignoreRdfType) {
1925
1618
  parameters.resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup"), parameters.graph);
1926
1619
  }
1927
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), parameters.object.comment
1620
+ parameters.resource.add(PropertyShape.schema.properties.comment.path, parameters.object.comment
1928
1621
  .toList()
1929
1622
  .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
1930
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), parameters.object.label
1623
+ parameters.resource.add(PropertyShape.schema.properties.label.path, parameters.object.label
1931
1624
  .toList()
1932
1625
  .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
1933
1626
  return parameters.resource;
@@ -1941,7 +1634,7 @@ export var PropertyGroup;
1941
1634
  }
1942
1635
  PropertyGroup._propertiesToStrings = _propertiesToStrings;
1943
1636
  function $toString(_propertyGroup) {
1944
- return `PropertyGroup(${JSON.stringify(_propertiesToStrings((_propertyGroup ?? this)))})`;
1637
+ return `PropertyGroup(${JSON.stringify(_propertiesToStrings(_propertyGroup))})`;
1945
1638
  }
1946
1639
  PropertyGroup.$toString = $toString;
1947
1640
  })(PropertyGroup || (PropertyGroup = {}));
@@ -1952,13 +1645,7 @@ export var Ontology;
1952
1645
  $identifier: $convertToIdentifierProperty(parameters?.$identifier),
1953
1646
  comment: $convertToMaybe($identityConversionFunction)(parameters?.comment).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.comment.type(), value)),
1954
1647
  label: $convertToMaybe($identityConversionFunction)(parameters?.label).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.label.type(), value)),
1955
- }).map((properties) => {
1956
- const finalObject = { ...properties, $type: "Ontology" };
1957
- if (!globalThis.Object.prototype.hasOwnProperty.call(finalObject, "toString")) {
1958
- finalObject.toString = $toString;
1959
- }
1960
- return finalObject;
1961
- });
1648
+ }).map((properties) => $monkeyPatchObject({ ...properties, $type: "Ontology" }, { $toString }));
1962
1649
  }
1963
1650
  Ontology.create = create;
1964
1651
  function createUnsafe(parameters) {
@@ -1970,22 +1657,6 @@ export var Ontology;
1970
1657
  Identifier.parse = $parseIdentifier;
1971
1658
  Identifier.stringify = NTriplesTerm.stringify;
1972
1659
  })(Identifier = Ontology.Identifier || (Ontology.Identifier = {}));
1973
- function filter(filter, value) {
1974
- if (filter.$identifier !== undefined &&
1975
- !$filterIdentifier(filter.$identifier, value.$identifier())) {
1976
- return false;
1977
- }
1978
- if (filter.comment !== undefined &&
1979
- !$filterMaybe($filterString)(filter.comment, value.comment)) {
1980
- return false;
1981
- }
1982
- if (filter.label !== undefined &&
1983
- !$filterMaybe($filterString)(filter.label, value.label)) {
1984
- return false;
1985
- }
1986
- return true;
1987
- }
1988
- Ontology.filter = filter;
1989
1660
  Ontology._fromRdfResource = ($resource, _$options) => {
1990
1661
  return (!_$options.ignoreRdfType
1991
1662
  ? $resource
@@ -2095,10 +1766,10 @@ export var Ontology;
2095
1766
  if (!parameters.ignoreRdfType) {
2096
1767
  parameters.resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"), parameters.graph);
2097
1768
  }
2098
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), parameters.object.comment
1769
+ parameters.resource.add(PropertyShape.schema.properties.comment.path, parameters.object.comment
2099
1770
  .toList()
2100
1771
  .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
2101
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), parameters.object.label
1772
+ parameters.resource.add(PropertyShape.schema.properties.label.path, parameters.object.label
2102
1773
  .toList()
2103
1774
  .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
2104
1775
  return parameters.resource;
@@ -2112,7 +1783,7 @@ export var Ontology;
2112
1783
  }
2113
1784
  Ontology._propertiesToStrings = _propertiesToStrings;
2114
1785
  function $toString(_ontology) {
2115
- return `Ontology(${JSON.stringify(_propertiesToStrings((_ontology ?? this)))})`;
1786
+ return `Ontology(${JSON.stringify(_propertiesToStrings(_ontology))})`;
2116
1787
  }
2117
1788
  Ontology.$toString = $toString;
2118
1789
  })(Ontology || (Ontology = {}));
@@ -2159,13 +1830,7 @@ export var NodeShape;
2159
1830
  tsImports: $convertToArray($identityConversionFunction, true)(parameters?.tsImports).chain((value) => $validateArray($identityValidationFunction, true)(NodeShape.schema.properties.tsImports.type(), value)),
2160
1831
  types: $convertToArray(($convertToIri), true)(parameters?.types).chain((value) => $validateArray($identityValidationFunction, true)(NodeShape.schema.properties.types.type(), value)),
2161
1832
  xone: $convertToMaybe($convertToArray($convertToIdentifier, true))(parameters?.xone).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(PropertyShape.schema.properties.xone.type(), value)),
2162
- }).map((properties) => {
2163
- const finalObject = { ...properties, $type: "NodeShape" };
2164
- if (!globalThis.Object.prototype.hasOwnProperty.call(finalObject, "toString")) {
2165
- finalObject.toString = $toString;
2166
- }
2167
- return finalObject;
2168
- });
1833
+ }).map((properties) => $monkeyPatchObject({ ...properties, $type: "NodeShape" }, { $toString }));
2169
1834
  }
2170
1835
  NodeShape.create = create;
2171
1836
  function createUnsafe(parameters) {
@@ -2177,166 +1842,6 @@ export var NodeShape;
2177
1842
  Identifier.parse = $parseIdentifier;
2178
1843
  Identifier.stringify = NTriplesTerm.stringify;
2179
1844
  })(Identifier = NodeShape.Identifier || (NodeShape.Identifier = {}));
2180
- function filter(filter, value) {
2181
- if (filter.$identifier !== undefined &&
2182
- !$filterIdentifier(filter.$identifier, value.$identifier())) {
2183
- return false;
2184
- }
2185
- if (filter.and !== undefined &&
2186
- !$filterMaybe($filterArray($filterIdentifier))(filter.and, value.and)) {
2187
- return false;
2188
- }
2189
- if (filter.classes !== undefined &&
2190
- !$filterArray($filterIri)(filter.classes, value.classes)) {
2191
- return false;
2192
- }
2193
- if (filter.closed !== undefined &&
2194
- !$filterMaybe($filterBoolean)(filter.closed, value.closed)) {
2195
- return false;
2196
- }
2197
- if (filter.comment !== undefined &&
2198
- !$filterMaybe($filterString)(filter.comment, value.comment)) {
2199
- return false;
2200
- }
2201
- if (filter.datatype !== undefined &&
2202
- !$filterMaybe($filterIri)(filter.datatype, value.datatype)) {
2203
- return false;
2204
- }
2205
- if (filter.deactivated !== undefined &&
2206
- !$filterMaybe($filterBoolean)(filter.deactivated, value.deactivated)) {
2207
- return false;
2208
- }
2209
- if (filter.discriminantValue !== undefined &&
2210
- !$filterMaybe($filterString)(filter.discriminantValue, value.discriminantValue)) {
2211
- return false;
2212
- }
2213
- if (filter.extern !== undefined &&
2214
- !$filterMaybe($filterBoolean)(filter.extern, value.extern)) {
2215
- return false;
2216
- }
2217
- if (filter.flags !== undefined &&
2218
- !$filterArray($filterString)(filter.flags, value.flags)) {
2219
- return false;
2220
- }
2221
- if (filter.fromRdfType !== undefined &&
2222
- !$filterMaybe($filterIri)(filter.fromRdfType, value.fromRdfType)) {
2223
- return false;
2224
- }
2225
- if (filter.hasValues !== undefined &&
2226
- !$filterArray($filterTerm)(filter.hasValues, value.hasValues)) {
2227
- return false;
2228
- }
2229
- if (filter.ignoredProperties !== undefined &&
2230
- !$filterMaybe($filterArray($filterIri))(filter.ignoredProperties, value.ignoredProperties)) {
2231
- return false;
2232
- }
2233
- if (filter.in_ !== undefined &&
2234
- !$filterMaybe($filterArray($filterTerm))(filter.in_, value.in_)) {
2235
- return false;
2236
- }
2237
- if (filter.isDefinedBy !== undefined &&
2238
- !$filterMaybe($filterIdentifier)(filter.isDefinedBy, value.isDefinedBy)) {
2239
- return false;
2240
- }
2241
- if (filter.label !== undefined &&
2242
- !$filterMaybe($filterString)(filter.label, value.label)) {
2243
- return false;
2244
- }
2245
- if (filter.languageIn !== undefined &&
2246
- !$filterMaybe($filterArray($filterString))(filter.languageIn, value.languageIn)) {
2247
- return false;
2248
- }
2249
- if (filter.maxCount !== undefined &&
2250
- !$filterMaybe(($filterNumeric))(filter.maxCount, value.maxCount)) {
2251
- return false;
2252
- }
2253
- if (filter.maxExclusive !== undefined &&
2254
- !$filterMaybe($filterLiteral)(filter.maxExclusive, value.maxExclusive)) {
2255
- return false;
2256
- }
2257
- if (filter.maxInclusive !== undefined &&
2258
- !$filterMaybe($filterLiteral)(filter.maxInclusive, value.maxInclusive)) {
2259
- return false;
2260
- }
2261
- if (filter.maxLength !== undefined &&
2262
- !$filterMaybe(($filterNumeric))(filter.maxLength, value.maxLength)) {
2263
- return false;
2264
- }
2265
- if (filter.minCount !== undefined &&
2266
- !$filterMaybe(($filterNumeric))(filter.minCount, value.minCount)) {
2267
- return false;
2268
- }
2269
- if (filter.minExclusive !== undefined &&
2270
- !$filterMaybe($filterLiteral)(filter.minExclusive, value.minExclusive)) {
2271
- return false;
2272
- }
2273
- if (filter.minInclusive !== undefined &&
2274
- !$filterMaybe($filterLiteral)(filter.minInclusive, value.minInclusive)) {
2275
- return false;
2276
- }
2277
- if (filter.minLength !== undefined &&
2278
- !$filterMaybe(($filterNumeric))(filter.minLength, value.minLength)) {
2279
- return false;
2280
- }
2281
- if (filter.mutable !== undefined &&
2282
- !$filterMaybe($filterBoolean)(filter.mutable, value.mutable)) {
2283
- return false;
2284
- }
2285
- if (filter.node !== undefined &&
2286
- !$filterMaybe($filterIdentifier)(filter.node, value.node)) {
2287
- return false;
2288
- }
2289
- if (filter.nodeKind !== undefined &&
2290
- !$filterMaybe($filterIri)(filter.nodeKind, value.nodeKind)) {
2291
- return false;
2292
- }
2293
- if (filter.not !== undefined &&
2294
- !$filterArray($filterIdentifier)(filter.not, value.not)) {
2295
- return false;
2296
- }
2297
- if (filter.or !== undefined &&
2298
- !$filterMaybe($filterArray($filterIdentifier))(filter.or, value.or)) {
2299
- return false;
2300
- }
2301
- if (filter.patterns !== undefined &&
2302
- !$filterArray($filterString)(filter.patterns, value.patterns)) {
2303
- return false;
2304
- }
2305
- if (filter.properties !== undefined &&
2306
- !$filterArray($filterIdentifier)(filter.properties, value.properties)) {
2307
- return false;
2308
- }
2309
- if (filter.rdfType !== undefined &&
2310
- !$filterMaybe($filterIri)(filter.rdfType, value.rdfType)) {
2311
- return false;
2312
- }
2313
- if (filter.shaclmateName !== undefined &&
2314
- !$filterMaybe($filterString)(filter.shaclmateName, value.shaclmateName)) {
2315
- return false;
2316
- }
2317
- if (filter.subClassOf !== undefined &&
2318
- !$filterArray($filterIri)(filter.subClassOf, value.subClassOf)) {
2319
- return false;
2320
- }
2321
- if (filter.toRdfTypes !== undefined &&
2322
- !$filterArray($filterIri)(filter.toRdfTypes, value.toRdfTypes)) {
2323
- return false;
2324
- }
2325
- if (filter.tsImports !== undefined &&
2326
- !$filterArray($filterString)(filter.tsImports, value.tsImports)) {
2327
- return false;
2328
- }
2329
- if (filter.types !== undefined &&
2330
- !$filterArray($filterIri)(filter.types, value.types)) {
2331
- return false;
2332
- }
2333
- if (filter.xone !== undefined &&
2334
- !$filterMaybe($filterArray($filterIdentifier))(filter.xone, value.xone)) {
2335
- return false;
2336
- }
2337
- return true;
2338
- }
2339
- NodeShape.filter = filter;
2340
1845
  NodeShape._fromRdfResource = ($resource, _$options) => {
2341
1846
  return (!_$options.ignoreRdfType
2342
1847
  ? $resource
@@ -3336,7 +2841,7 @@ export var NodeShape;
3336
2841
  if (!parameters.ignoreRdfType) {
3337
2842
  parameters.resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape"), parameters.graph);
3338
2843
  }
3339
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#and"), parameters.object.and.toList().flatMap((value) => [
2844
+ parameters.resource.add(PropertyShape.schema.properties.and.path, parameters.object.and.toList().flatMap((value) => [
3340
2845
  value.length > 0
3341
2846
  ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
3342
2847
  if (itemIndex === 0) {
@@ -3358,33 +2863,33 @@ export var NodeShape;
3358
2863
  }).listResource.identifier
3359
2864
  : $RdfVocabularies.rdf.nil,
3360
2865
  ]), parameters.graph);
3361
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#class"), parameters.object.classes.flatMap((item) => [item]), parameters.graph);
3362
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#closed"), parameters.object.closed
2866
+ parameters.resource.add(PropertyShape.schema.properties.classes.path, parameters.object.classes.flatMap((item) => [item]), parameters.graph);
2867
+ parameters.resource.add(NodeShape.schema.properties.closed.path, parameters.object.closed
3363
2868
  .toList()
3364
2869
  .flatMap((value) => [
3365
2870
  $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
3366
2871
  ]), parameters.graph);
3367
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), parameters.object.comment
2872
+ parameters.resource.add(PropertyShape.schema.properties.comment.path, parameters.object.comment
3368
2873
  .toList()
3369
2874
  .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
3370
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#datatype"), parameters.object.datatype.toList(), parameters.graph);
3371
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"), parameters.object.deactivated
2875
+ parameters.resource.add(PropertyShape.schema.properties.datatype.path, parameters.object.datatype.toList(), parameters.graph);
2876
+ parameters.resource.add(PropertyShape.schema.properties.deactivated.path, parameters.object.deactivated
3372
2877
  .toList()
3373
2878
  .flatMap((value) => [
3374
2879
  $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
3375
2880
  ]), parameters.graph);
3376
- parameters.resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#discriminantValue"), parameters.object.discriminantValue
2881
+ parameters.resource.add(NodeShape.schema.properties.discriminantValue.path, parameters.object.discriminantValue
3377
2882
  .toList()
3378
2883
  .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
3379
- parameters.resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#extern"), parameters.object.extern
2884
+ parameters.resource.add(NodeShape.schema.properties.extern.path, parameters.object.extern
3380
2885
  .toList()
3381
2886
  .flatMap((value) => [
3382
2887
  $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
3383
2888
  ]), parameters.graph);
3384
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#flags"), parameters.object.flags.flatMap((item) => [$literalFactory.string(item)]), parameters.graph);
3385
- parameters.resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#fromRdfType"), parameters.object.fromRdfType.toList(), parameters.graph);
3386
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#hasValue"), parameters.object.hasValues.flatMap((item) => [item]), parameters.graph);
3387
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#ignoredProperties"), parameters.object.ignoredProperties.toList().flatMap((value) => [
2889
+ parameters.resource.add(PropertyShape.schema.properties.flags.path, parameters.object.flags.flatMap((item) => [$literalFactory.string(item)]), parameters.graph);
2890
+ parameters.resource.add(NodeShape.schema.properties.fromRdfType.path, parameters.object.fromRdfType.toList(), parameters.graph);
2891
+ parameters.resource.add(PropertyShape.schema.properties.hasValues.path, parameters.object.hasValues.flatMap((item) => [item]), parameters.graph);
2892
+ parameters.resource.add(NodeShape.schema.properties.ignoredProperties.path, parameters.object.ignoredProperties.toList().flatMap((value) => [
3388
2893
  value.length > 0
3389
2894
  ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
3390
2895
  if (itemIndex === 0) {
@@ -3406,7 +2911,7 @@ export var NodeShape;
3406
2911
  }).listResource.identifier
3407
2912
  : $RdfVocabularies.rdf.nil,
3408
2913
  ]), parameters.graph);
3409
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#in"), parameters.object.in_.toList().flatMap((value) => [
2914
+ parameters.resource.add(PropertyShape.schema.properties.in_.path, parameters.object.in_.toList().flatMap((value) => [
3410
2915
  value.length > 0
3411
2916
  ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
3412
2917
  if (itemIndex === 0) {
@@ -3428,11 +2933,11 @@ export var NodeShape;
3428
2933
  }).listResource.identifier
3429
2934
  : $RdfVocabularies.rdf.nil,
3430
2935
  ]), parameters.graph);
3431
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"), parameters.object.isDefinedBy.toList(), parameters.graph);
3432
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), parameters.object.label
2936
+ parameters.resource.add(PropertyShape.schema.properties.isDefinedBy.path, parameters.object.isDefinedBy.toList(), parameters.graph);
2937
+ parameters.resource.add(PropertyShape.schema.properties.label.path, parameters.object.label
3433
2938
  .toList()
3434
2939
  .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
3435
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#languageIn"), parameters.object.languageIn.toList().flatMap((value) => [
2940
+ parameters.resource.add(PropertyShape.schema.properties.languageIn.path, parameters.object.languageIn.toList().flatMap((value) => [
3436
2941
  value.length > 0
3437
2942
  ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
3438
2943
  if (itemIndex === 0) {
@@ -3454,39 +2959,39 @@ export var NodeShape;
3454
2959
  }).listResource.identifier
3455
2960
  : $RdfVocabularies.rdf.nil,
3456
2961
  ]), parameters.graph);
3457
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxCount"), parameters.object.maxCount
2962
+ parameters.resource.add(PropertyShape.schema.properties.maxCount.path, parameters.object.maxCount
3458
2963
  .toList()
3459
2964
  .flatMap((value) => [
3460
2965
  $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
3461
2966
  ]), parameters.graph);
3462
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxExclusive"), parameters.object.maxExclusive.toList(), parameters.graph);
3463
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxInclusive"), parameters.object.maxInclusive.toList(), parameters.graph);
3464
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxLength"), parameters.object.maxLength
2967
+ parameters.resource.add(PropertyShape.schema.properties.maxExclusive.path, parameters.object.maxExclusive.toList(), parameters.graph);
2968
+ parameters.resource.add(PropertyShape.schema.properties.maxInclusive.path, parameters.object.maxInclusive.toList(), parameters.graph);
2969
+ parameters.resource.add(PropertyShape.schema.properties.maxLength.path, parameters.object.maxLength
3465
2970
  .toList()
3466
2971
  .flatMap((value) => [
3467
2972
  $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
3468
2973
  ]), parameters.graph);
3469
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minCount"), parameters.object.minCount
2974
+ parameters.resource.add(PropertyShape.schema.properties.minCount.path, parameters.object.minCount
3470
2975
  .toList()
3471
2976
  .flatMap((value) => [
3472
2977
  $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
3473
2978
  ]), parameters.graph);
3474
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minExclusive"), parameters.object.minExclusive.toList(), parameters.graph);
3475
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minInclusive"), parameters.object.minInclusive.toList(), parameters.graph);
3476
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minLength"), parameters.object.minLength
2979
+ parameters.resource.add(PropertyShape.schema.properties.minExclusive.path, parameters.object.minExclusive.toList(), parameters.graph);
2980
+ parameters.resource.add(PropertyShape.schema.properties.minInclusive.path, parameters.object.minInclusive.toList(), parameters.graph);
2981
+ parameters.resource.add(PropertyShape.schema.properties.minLength.path, parameters.object.minLength
3477
2982
  .toList()
3478
2983
  .flatMap((value) => [
3479
2984
  $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
3480
2985
  ]), parameters.graph);
3481
- parameters.resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#mutable"), parameters.object.mutable
2986
+ parameters.resource.add(PropertyShape.schema.properties.mutable.path, parameters.object.mutable
3482
2987
  .toList()
3483
2988
  .flatMap((value) => [
3484
2989
  $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
3485
2990
  ]), parameters.graph);
3486
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#node"), parameters.object.node.toList(), parameters.graph);
3487
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"), parameters.object.nodeKind.toList(), parameters.graph);
3488
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#not"), parameters.object.not.flatMap((item) => [item]), parameters.graph);
3489
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#or"), parameters.object.or.toList().flatMap((value) => [
2991
+ parameters.resource.add(PropertyShape.schema.properties.node.path, parameters.object.node.toList(), parameters.graph);
2992
+ parameters.resource.add(PropertyShape.schema.properties.nodeKind.path, parameters.object.nodeKind.toList(), parameters.graph);
2993
+ parameters.resource.add(PropertyShape.schema.properties.not.path, parameters.object.not.flatMap((item) => [item]), parameters.graph);
2994
+ parameters.resource.add(PropertyShape.schema.properties.or.path, parameters.object.or.toList().flatMap((value) => [
3490
2995
  value.length > 0
3491
2996
  ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
3492
2997
  if (itemIndex === 0) {
@@ -3508,21 +3013,21 @@ export var NodeShape;
3508
3013
  }).listResource.identifier
3509
3014
  : $RdfVocabularies.rdf.nil,
3510
3015
  ]), parameters.graph);
3511
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#pattern"), parameters.object.patterns.flatMap((item) => [
3016
+ parameters.resource.add(PropertyShape.schema.properties.patterns.path, parameters.object.patterns.flatMap((item) => [
3512
3017
  $literalFactory.string(item),
3513
3018
  ]), parameters.graph);
3514
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#property"), parameters.object.properties.flatMap((item) => [item]), parameters.graph);
3515
- parameters.resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#rdfType"), parameters.object.rdfType.toList(), parameters.graph);
3516
- parameters.resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#name"), parameters.object.shaclmateName
3019
+ parameters.resource.add(NodeShape.schema.properties.properties.path, parameters.object.properties.flatMap((item) => [item]), parameters.graph);
3020
+ parameters.resource.add(NodeShape.schema.properties.rdfType.path, parameters.object.rdfType.toList(), parameters.graph);
3021
+ parameters.resource.add(PropertyShape.schema.properties.shaclmateName.path, parameters.object.shaclmateName
3517
3022
  .toList()
3518
3023
  .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
3519
- parameters.resource.add($RdfVocabularies.rdfs.subClassOf, parameters.object.subClassOf.flatMap((item) => [item]), parameters.graph);
3520
- parameters.resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#toRdfType"), parameters.object.toRdfTypes.flatMap((item) => [item]), parameters.graph);
3521
- parameters.resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsImport"), parameters.object.tsImports.flatMap((item) => [
3024
+ parameters.resource.add(NodeShape.schema.properties.subClassOf.path, parameters.object.subClassOf.flatMap((item) => [item]), parameters.graph);
3025
+ parameters.resource.add(NodeShape.schema.properties.toRdfTypes.path, parameters.object.toRdfTypes.flatMap((item) => [item]), parameters.graph);
3026
+ parameters.resource.add(NodeShape.schema.properties.tsImports.path, parameters.object.tsImports.flatMap((item) => [
3522
3027
  $literalFactory.string(item),
3523
3028
  ]), parameters.graph);
3524
- parameters.resource.add($RdfVocabularies.rdf.type, parameters.object.types.flatMap((item) => [item]), parameters.graph);
3525
- parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#xone"), parameters.object.xone.toList().flatMap((value) => [
3029
+ parameters.resource.add(NodeShape.schema.properties.types.path, parameters.object.types.flatMap((item) => [item]), parameters.graph);
3030
+ parameters.resource.add(PropertyShape.schema.properties.xone.path, parameters.object.xone.toList().flatMap((value) => [
3526
3031
  value.length > 0
3527
3032
  ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
3528
3033
  if (itemIndex === 0) {
@@ -3558,7 +3063,7 @@ export var NodeShape;
3558
3063
  }
3559
3064
  NodeShape._propertiesToStrings = _propertiesToStrings;
3560
3065
  function $toString(_nodeShape) {
3561
- return `NodeShape(${JSON.stringify(_propertiesToStrings((_nodeShape ?? this)))})`;
3066
+ return `NodeShape(${JSON.stringify(_propertiesToStrings(_nodeShape))})`;
3562
3067
  }
3563
3068
  NodeShape.$toString = $toString;
3564
3069
  })(NodeShape || (NodeShape = {}));
@@ -3573,25 +3078,6 @@ export var Shape;
3573
3078
  }
3574
3079
  throw new Error("unable to serialize to string");
3575
3080
  };
3576
- Shape.filter = (filter, value) => {
3577
- if (filter.$identifier !== undefined &&
3578
- !$filterIdentifier(filter.$identifier, value.$identifier())) {
3579
- return false;
3580
- }
3581
- if (filter.on?.["NodeShape"] !== undefined &&
3582
- NodeShape.isNodeShape(value)) {
3583
- if (!NodeShape.filter(filter.on["NodeShape"], value)) {
3584
- return false;
3585
- }
3586
- }
3587
- if (filter.on?.["PropertyShape"] !== undefined &&
3588
- PropertyShape.isPropertyShape(value)) {
3589
- if (!PropertyShape.filter(filter.on["PropertyShape"], value)) {
3590
- return false;
3591
- }
3592
- }
3593
- return true;
3594
- };
3595
3081
  Shape.fromRdfResource = (resource, options) => NodeShape.fromRdfResource(resource, {
3596
3082
  ...options,
3597
3083
  ignoreRdfType: false,
@@ -3605,7 +3091,6 @@ export var Shape;
3605
3091
  context: _options.context,
3606
3092
  graph: _options.graph,
3607
3093
  ignoreRdfType: false,
3608
- objectSet: _options.objectSet,
3609
3094
  preferredLanguages: _options.preferredLanguages,
3610
3095
  propertyPath: _options.propertyPath,
3611
3096
  resource: _options.resource,
@@ -3614,7 +3099,6 @@ export var Shape;
3614
3099
  context: _options.context,
3615
3100
  graph: _options.graph,
3616
3101
  ignoreRdfType: false,
3617
- objectSet: _options.objectSet,
3618
3102
  preferredLanguages: _options.preferredLanguages,
3619
3103
  propertyPath: _options.propertyPath,
3620
3104
  resource: _options.resource,
@@ -3929,36 +3413,6 @@ export var $Object;
3929
3413
  }
3930
3414
  throw new Error("unable to serialize to string");
3931
3415
  };
3932
- $Object.filter = (filter, value) => {
3933
- if (filter.$identifier !== undefined &&
3934
- !$filterIdentifier(filter.$identifier, value.$identifier())) {
3935
- return false;
3936
- }
3937
- if (filter.on?.["NodeShape"] !== undefined &&
3938
- NodeShape.isNodeShape(value)) {
3939
- if (!NodeShape.filter(filter.on["NodeShape"], value)) {
3940
- return false;
3941
- }
3942
- }
3943
- if (filter.on?.["Ontology"] !== undefined && Ontology.isOntology(value)) {
3944
- if (!Ontology.filter(filter.on["Ontology"], value)) {
3945
- return false;
3946
- }
3947
- }
3948
- if (filter.on?.["PropertyGroup"] !== undefined &&
3949
- PropertyGroup.isPropertyGroup(value)) {
3950
- if (!PropertyGroup.filter(filter.on["PropertyGroup"], value)) {
3951
- return false;
3952
- }
3953
- }
3954
- if (filter.on?.["PropertyShape"] !== undefined &&
3955
- PropertyShape.isPropertyShape(value)) {
3956
- if (!PropertyShape.filter(filter.on["PropertyShape"], value)) {
3957
- return false;
3958
- }
3959
- }
3960
- return true;
3961
- };
3962
3416
  $Object.fromRdfResource = (resource, options) => NodeShape.fromRdfResource(resource, {
3963
3417
  ...options,
3964
3418
  ignoreRdfType: false,
@@ -3981,7 +3435,6 @@ export var $Object;
3981
3435
  context: _options.context,
3982
3436
  graph: _options.graph,
3983
3437
  ignoreRdfType: false,
3984
- objectSet: _options.objectSet,
3985
3438
  preferredLanguages: _options.preferredLanguages,
3986
3439
  propertyPath: _options.propertyPath,
3987
3440
  resource: _options.resource,
@@ -3990,7 +3443,6 @@ export var $Object;
3990
3443
  context: _options.context,
3991
3444
  graph: _options.graph,
3992
3445
  ignoreRdfType: false,
3993
- objectSet: _options.objectSet,
3994
3446
  preferredLanguages: _options.preferredLanguages,
3995
3447
  propertyPath: _options.propertyPath,
3996
3448
  resource: _options.resource,
@@ -3999,7 +3451,6 @@ export var $Object;
3999
3451
  context: _options.context,
4000
3452
  graph: _options.graph,
4001
3453
  ignoreRdfType: false,
4002
- objectSet: _options.objectSet,
4003
3454
  preferredLanguages: _options.preferredLanguages,
4004
3455
  propertyPath: _options.propertyPath,
4005
3456
  resource: _options.resource,
@@ -4008,7 +3459,6 @@ export var $Object;
4008
3459
  context: _options.context,
4009
3460
  graph: _options.graph,
4010
3461
  ignoreRdfType: false,
4011
- objectSet: _options.objectSet,
4012
3462
  preferredLanguages: _options.preferredLanguages,
4013
3463
  propertyPath: _options.propertyPath,
4014
3464
  resource: _options.resource,
@@ -4104,443 +3554,4 @@ export var $Object;
4104
3554
  throw new Error("unable to serialize to RDF");
4105
3555
  });
4106
3556
  })($Object || ($Object = {}));
4107
- export class $RdfjsDatasetObjectSet {
4108
- #dataset;
4109
- #graph;
4110
- constructor(dataset, options) {
4111
- this.#dataset = dataset;
4112
- this.#graph = options?.graph;
4113
- }
4114
- $dataset() {
4115
- if (typeof this.#dataset === "object") {
4116
- return this.#dataset;
4117
- }
4118
- return this.#dataset();
4119
- }
4120
- $resourceSet() {
4121
- return new ResourceSet({
4122
- dataFactory: dataFactory,
4123
- dataset: this.$dataset(),
4124
- });
4125
- }
4126
- async nodeShape(identifier, options) {
4127
- return this.nodeShapeSync(identifier, options);
4128
- }
4129
- nodeShapeSync(identifier, options) {
4130
- return this.nodeShapesSync({
4131
- identifiers: [identifier],
4132
- preferredLanguages: options?.preferredLanguages,
4133
- }).map((objects) => objects[0]);
4134
- }
4135
- async nodeShapeCount(query) {
4136
- return this.nodeShapeCountSync(query);
4137
- }
4138
- nodeShapeCountSync(query) {
4139
- return this.nodeShapesSync(query).map((objects) => objects.length);
4140
- }
4141
- async nodeShapeIdentifiers(query) {
4142
- return this.nodeShapeIdentifiersSync(query);
4143
- }
4144
- nodeShapeIdentifiersSync(query) {
4145
- return this.nodeShapesSync(query).map((objects) => objects.map((object) => object.$identifier()));
4146
- }
4147
- async nodeShapes(query) {
4148
- return this.nodeShapesSync(query);
4149
- }
4150
- nodeShapesSync(query) {
4151
- return this.#objectsSync({
4152
- filter: NodeShape.filter,
4153
- fromRdfResource: NodeShape.fromRdfResource,
4154
- fromRdfTypes: [NodeShape.fromRdfType],
4155
- }, query);
4156
- }
4157
- async ontology(identifier, options) {
4158
- return this.ontologySync(identifier, options);
4159
- }
4160
- ontologySync(identifier, options) {
4161
- return this.ontologiesSync({
4162
- identifiers: [identifier],
4163
- preferredLanguages: options?.preferredLanguages,
4164
- }).map((objects) => objects[0]);
4165
- }
4166
- async ontologyCount(query) {
4167
- return this.ontologyCountSync(query);
4168
- }
4169
- ontologyCountSync(query) {
4170
- return this.ontologiesSync(query).map((objects) => objects.length);
4171
- }
4172
- async ontologyIdentifiers(query) {
4173
- return this.ontologyIdentifiersSync(query);
4174
- }
4175
- ontologyIdentifiersSync(query) {
4176
- return this.ontologiesSync(query).map((objects) => objects.map((object) => object.$identifier()));
4177
- }
4178
- async ontologies(query) {
4179
- return this.ontologiesSync(query);
4180
- }
4181
- ontologiesSync(query) {
4182
- return this.#objectsSync({
4183
- filter: Ontology.filter,
4184
- fromRdfResource: Ontology.fromRdfResource,
4185
- fromRdfTypes: [Ontology.fromRdfType],
4186
- }, query);
4187
- }
4188
- async propertyGroup(identifier, options) {
4189
- return this.propertyGroupSync(identifier, options);
4190
- }
4191
- propertyGroupSync(identifier, options) {
4192
- return this.propertyGroupsSync({
4193
- identifiers: [identifier],
4194
- preferredLanguages: options?.preferredLanguages,
4195
- }).map((objects) => objects[0]);
4196
- }
4197
- async propertyGroupCount(query) {
4198
- return this.propertyGroupCountSync(query);
4199
- }
4200
- propertyGroupCountSync(query) {
4201
- return this.propertyGroupsSync(query).map((objects) => objects.length);
4202
- }
4203
- async propertyGroupIdentifiers(query) {
4204
- return this.propertyGroupIdentifiersSync(query);
4205
- }
4206
- propertyGroupIdentifiersSync(query) {
4207
- return this.propertyGroupsSync(query).map((objects) => objects.map((object) => object.$identifier()));
4208
- }
4209
- async propertyGroups(query) {
4210
- return this.propertyGroupsSync(query);
4211
- }
4212
- propertyGroupsSync(query) {
4213
- return this.#objectsSync({
4214
- filter: PropertyGroup.filter,
4215
- fromRdfResource: PropertyGroup.fromRdfResource,
4216
- fromRdfTypes: [PropertyGroup.fromRdfType],
4217
- }, query);
4218
- }
4219
- async propertyShape(identifier, options) {
4220
- return this.propertyShapeSync(identifier, options);
4221
- }
4222
- propertyShapeSync(identifier, options) {
4223
- return this.propertyShapesSync({
4224
- identifiers: [identifier],
4225
- preferredLanguages: options?.preferredLanguages,
4226
- }).map((objects) => objects[0]);
4227
- }
4228
- async propertyShapeCount(query) {
4229
- return this.propertyShapeCountSync(query);
4230
- }
4231
- propertyShapeCountSync(query) {
4232
- return this.propertyShapesSync(query).map((objects) => objects.length);
4233
- }
4234
- async propertyShapeIdentifiers(query) {
4235
- return this.propertyShapeIdentifiersSync(query);
4236
- }
4237
- propertyShapeIdentifiersSync(query) {
4238
- return this.propertyShapesSync(query).map((objects) => objects.map((object) => object.$identifier()));
4239
- }
4240
- async propertyShapes(query) {
4241
- return this.propertyShapesSync(query);
4242
- }
4243
- propertyShapesSync(query) {
4244
- return this.#objectsSync({
4245
- filter: PropertyShape.filter,
4246
- fromRdfResource: PropertyShape.fromRdfResource,
4247
- fromRdfTypes: [PropertyShape.fromRdfType],
4248
- }, query);
4249
- }
4250
- async shape(identifier, options) {
4251
- return this.shapeSync(identifier, options);
4252
- }
4253
- shapeSync(identifier, options) {
4254
- return this.shapesSync({
4255
- identifiers: [identifier],
4256
- preferredLanguages: options?.preferredLanguages,
4257
- }).map((objects) => objects[0]);
4258
- }
4259
- async shapeCount(query) {
4260
- return this.shapeCountSync(query);
4261
- }
4262
- shapeCountSync(query) {
4263
- return this.shapesSync(query).map((objects) => objects.length);
4264
- }
4265
- async shapeIdentifiers(query) {
4266
- return this.shapeIdentifiersSync(query);
4267
- }
4268
- shapeIdentifiersSync(query) {
4269
- return this.shapesSync(query).map((objects) => objects.map((object) => object.$identifier()));
4270
- }
4271
- async shapes(query) {
4272
- return this.shapesSync(query);
4273
- }
4274
- shapesSync(query) {
4275
- return this.#objectUnionsSync([
4276
- {
4277
- filter: Shape.filter,
4278
- fromRdfResource: NodeShape.fromRdfResource,
4279
- fromRdfTypes: [NodeShape.fromRdfType],
4280
- },
4281
- {
4282
- filter: Shape.filter,
4283
- fromRdfResource: PropertyShape.fromRdfResource,
4284
- fromRdfTypes: [PropertyShape.fromRdfType],
4285
- },
4286
- ], query);
4287
- }
4288
- async $object(identifier, options) {
4289
- return this.$objectSync(identifier, options);
4290
- }
4291
- $objectSync(identifier, options) {
4292
- return this.$objectsSync({
4293
- identifiers: [identifier],
4294
- preferredLanguages: options?.preferredLanguages,
4295
- }).map((objects) => objects[0]);
4296
- }
4297
- async $objectCount(query) {
4298
- return this.$objectCountSync(query);
4299
- }
4300
- $objectCountSync(query) {
4301
- return this.$objectsSync(query).map((objects) => objects.length);
4302
- }
4303
- async $objectIdentifiers(query) {
4304
- return this.$objectIdentifiersSync(query);
4305
- }
4306
- $objectIdentifiersSync(query) {
4307
- return this.$objectsSync(query).map((objects) => objects.map((object) => object.$identifier()));
4308
- }
4309
- async $objects(query) {
4310
- return this.$objectsSync(query);
4311
- }
4312
- $objectsSync(query) {
4313
- return this.#objectUnionsSync([
4314
- {
4315
- filter: $Object.filter,
4316
- fromRdfResource: NodeShape.fromRdfResource,
4317
- fromRdfTypes: [NodeShape.fromRdfType],
4318
- },
4319
- {
4320
- filter: $Object.filter,
4321
- fromRdfResource: Ontology.fromRdfResource,
4322
- fromRdfTypes: [Ontology.fromRdfType],
4323
- },
4324
- {
4325
- filter: $Object.filter,
4326
- fromRdfResource: PropertyGroup.fromRdfResource,
4327
- fromRdfTypes: [PropertyGroup.fromRdfType],
4328
- },
4329
- {
4330
- filter: $Object.filter,
4331
- fromRdfResource: PropertyShape.fromRdfResource,
4332
- fromRdfTypes: [PropertyShape.fromRdfType],
4333
- },
4334
- ], query);
4335
- }
4336
- #objectsSync(namedObjectType, query) {
4337
- const graph = query?.graph ?? this.#graph;
4338
- const limit = query?.limit ?? Number.MAX_SAFE_INTEGER;
4339
- if (limit <= 0) {
4340
- return Right([]);
4341
- }
4342
- let offset = query?.offset ?? 0;
4343
- if (offset < 0) {
4344
- offset = 0;
4345
- }
4346
- const fromRdfResourceOptions = {
4347
- graph,
4348
- objectSet: this,
4349
- preferredLanguages: query?.preferredLanguages,
4350
- };
4351
- let resources;
4352
- const resourceSet = this.$resourceSet(); // Access once, in case it's instantiated lazily
4353
- let sortResources;
4354
- if (query?.identifiers) {
4355
- resources = query.identifiers.map((identifier) => ({
4356
- resource: resourceSet.resource(identifier),
4357
- }));
4358
- sortResources = false;
4359
- }
4360
- else if (namedObjectType.fromRdfTypes.length > 0) {
4361
- const identifierSet = new $IdentifierSet();
4362
- resources = [];
4363
- sortResources = true;
4364
- for (const fromRdfType of namedObjectType.fromRdfTypes) {
4365
- for (const resource of resourceSet.instancesOf(fromRdfType, {
4366
- graph,
4367
- })) {
4368
- if (!identifierSet.has(resource.identifier)) {
4369
- identifierSet.add(resource.identifier);
4370
- resources.push({ resource });
4371
- }
4372
- }
4373
- }
4374
- }
4375
- else {
4376
- const identifierSet = new $IdentifierSet();
4377
- resources = [];
4378
- sortResources = true;
4379
- for (const quad of resourceSet.dataset) {
4380
- if (graph && !quad.graph.equals(graph)) {
4381
- continue;
4382
- }
4383
- switch (quad.subject.termType) {
4384
- case "BlankNode":
4385
- case "NamedNode":
4386
- break;
4387
- default:
4388
- continue;
4389
- }
4390
- if (identifierSet.has(quad.subject)) {
4391
- continue;
4392
- }
4393
- identifierSet.add(quad.subject);
4394
- const resource = resourceSet.resource(quad.subject);
4395
- // Eagerly eliminate the majority of resources that won't match the object type
4396
- namedObjectType
4397
- .fromRdfResource(resource, fromRdfResourceOptions)
4398
- .ifRight((object) => {
4399
- resources.push({ object, resource });
4400
- });
4401
- }
4402
- }
4403
- if (sortResources) {
4404
- // Sort resources by identifier so limit and offset are deterministic
4405
- resources.sort((left, right) => left.resource.identifier.value.localeCompare(right.resource.identifier.value));
4406
- }
4407
- let objectI = 0;
4408
- const objects = [];
4409
- for (let { object, resource } of resources) {
4410
- if (!object) {
4411
- const objectEither = namedObjectType.fromRdfResource(resource, fromRdfResourceOptions);
4412
- if (objectEither.isLeft()) {
4413
- return objectEither;
4414
- }
4415
- object = objectEither.unsafeCoerce();
4416
- }
4417
- if (query?.filter && !namedObjectType.filter(query.filter, object)) {
4418
- continue;
4419
- }
4420
- if (objectI++ >= offset) {
4421
- objects.push(object);
4422
- if (objects.length === limit) {
4423
- return Right(objects);
4424
- }
4425
- }
4426
- }
4427
- return Right(objects);
4428
- }
4429
- #objectUnionsSync(namedObjectTypes, query) {
4430
- const graph = query?.graph ?? this.#graph;
4431
- const limit = query?.limit ?? Number.MAX_SAFE_INTEGER;
4432
- if (limit <= 0) {
4433
- return Right([]);
4434
- }
4435
- let offset = query?.offset ?? 0;
4436
- if (offset < 0) {
4437
- offset = 0;
4438
- }
4439
- const fromRdfResourceOptions = {
4440
- graph,
4441
- objectSet: this,
4442
- preferredLanguages: query?.preferredLanguages,
4443
- };
4444
- let resources;
4445
- const resourceSet = this.$resourceSet(); // Access once, in case it's instantiated lazily
4446
- let sortResources;
4447
- if (query?.identifiers) {
4448
- resources = query.identifiers.map((identifier) => ({
4449
- resource: resourceSet.resource(identifier),
4450
- }));
4451
- sortResources = false;
4452
- }
4453
- else if (namedObjectTypes.every((namedObjectType) => namedObjectType.fromRdfTypes.length > 0)) {
4454
- const identifierSet = new $IdentifierSet();
4455
- resources = [];
4456
- sortResources = true;
4457
- for (const namedObjectType of namedObjectTypes) {
4458
- for (const fromRdfType of namedObjectType.fromRdfTypes) {
4459
- for (const resource of resourceSet.instancesOf(fromRdfType, {
4460
- graph,
4461
- })) {
4462
- if (!identifierSet.has(resource.identifier)) {
4463
- identifierSet.add(resource.identifier);
4464
- resources.push({ namedObjectType, resource });
4465
- }
4466
- }
4467
- }
4468
- }
4469
- }
4470
- else {
4471
- const identifierSet = new $IdentifierSet();
4472
- resources = [];
4473
- sortResources = true;
4474
- for (const quad of resourceSet.dataset) {
4475
- if (graph && !quad.graph.equals(graph)) {
4476
- continue;
4477
- }
4478
- switch (quad.subject.termType) {
4479
- case "BlankNode":
4480
- case "NamedNode":
4481
- break;
4482
- default:
4483
- continue;
4484
- }
4485
- if (identifierSet.has(quad.subject)) {
4486
- continue;
4487
- }
4488
- identifierSet.add(quad.subject);
4489
- // Eagerly eliminate the majority of resources that won't match the object types
4490
- const resource = resourceSet.resource(quad.subject);
4491
- for (const namedObjectType of namedObjectTypes) {
4492
- if (namedObjectType
4493
- .fromRdfResource(resource, fromRdfResourceOptions)
4494
- .ifRight((object) => {
4495
- resources.push({ object, namedObjectType, resource });
4496
- })
4497
- .isRight()) {
4498
- break;
4499
- }
4500
- }
4501
- }
4502
- }
4503
- if (sortResources) {
4504
- // Sort resources by identifier so limit and offset are deterministic
4505
- resources.sort((left, right) => left.resource.identifier.value.localeCompare(right.resource.identifier.value));
4506
- }
4507
- let objectI = 0;
4508
- const objects = [];
4509
- for (let { object, namedObjectType, resource } of resources) {
4510
- if (!object) {
4511
- let objectEither;
4512
- if (namedObjectType) {
4513
- objectEither = namedObjectType.fromRdfResource(resource, fromRdfResourceOptions);
4514
- }
4515
- else {
4516
- objectEither = Left(new Error("no object types"));
4517
- for (const tryObjectType of namedObjectTypes) {
4518
- objectEither = tryObjectType.fromRdfResource(resource, fromRdfResourceOptions);
4519
- if (objectEither.isRight()) {
4520
- namedObjectType = tryObjectType;
4521
- break;
4522
- }
4523
- }
4524
- }
4525
- if (objectEither.isLeft()) {
4526
- return objectEither;
4527
- }
4528
- object = objectEither.unsafeCoerce();
4529
- }
4530
- if (!namedObjectType) {
4531
- throw new Error("namedObjectType should be set here");
4532
- }
4533
- if (query?.filter && !namedObjectType.filter(query.filter, object)) {
4534
- continue;
4535
- }
4536
- if (objectI++ >= offset) {
4537
- objects.push(object);
4538
- if (objects.length === limit) {
4539
- return Right(objects);
4540
- }
4541
- }
4542
- }
4543
- return Right(objects);
4544
- }
4545
- }
4546
3557
  //# sourceMappingURL=generated.js.map