@shaclmate/compiler 4.0.13 → 4.0.15

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 (55) hide show
  1. package/dist/Compiler.d.ts +4 -1
  2. package/dist/Compiler.js +3 -1
  3. package/dist/ShapesGraphToAstTransformer.d.ts +10 -2
  4. package/dist/ShapesGraphToAstTransformer.js +74 -3
  5. package/dist/_ShapesGraphToAstTransformer/ShapeStack.js +6 -5
  6. package/dist/_ShapesGraphToAstTransformer/nodeShapeIdentifierMintingStrategy.d.ts +3 -2
  7. package/dist/_ShapesGraphToAstTransformer/nodeShapeIdentifierMintingStrategy.js +17 -13
  8. package/dist/_ShapesGraphToAstTransformer/nodeShapeTsFeatures.js +2 -1
  9. package/dist/_ShapesGraphToAstTransformer/shapeAstTypeName.js +6 -6
  10. package/dist/_ShapesGraphToAstTransformer/shapeNodeKinds.d.ts +2 -1
  11. package/dist/_ShapesGraphToAstTransformer/shapeNodeKinds.js +37 -30
  12. package/dist/_ShapesGraphToAstTransformer/shapeOntology.d.ts +5 -0
  13. package/dist/_ShapesGraphToAstTransformer/shapeOntology.js +25 -0
  14. package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +23 -16
  15. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.js +10 -6
  16. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.js +22 -22
  17. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.js +127 -118
  18. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.js +10 -8
  19. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.js +3 -3
  20. package/dist/ast/ObjectType.d.ts +3 -3
  21. package/dist/enums/IdentifierMintingStrategy.d.ts +4 -0
  22. package/dist/enums/IdentifierMintingStrategy.js +17 -1
  23. package/dist/enums/TsObjectDeclarationType.d.ts +4 -0
  24. package/dist/enums/TsObjectDeclarationType.js +15 -1
  25. package/dist/enums/Visibility.d.ts +6 -0
  26. package/dist/enums/Visibility.js +18 -0
  27. package/dist/generators/ts/AbstractCollectionType.js +1 -7
  28. package/dist/generators/ts/AbstractTermType.d.ts +1 -0
  29. package/dist/generators/ts/AbstractTermType.js +6 -0
  30. package/dist/generators/ts/AbstractUnionType.d.ts +31 -9
  31. package/dist/generators/ts/AbstractUnionType.js +252 -126
  32. package/dist/generators/ts/SetType.d.ts +1 -0
  33. package/dist/generators/ts/SetType.js +12 -0
  34. package/dist/generators/ts/_NamedObjectType/AbstractProperty.d.ts +3 -3
  35. package/dist/input/ShapesGraph.d.ts +39 -22
  36. package/dist/input/ShapesGraph.js +56 -60
  37. package/dist/input/generated.d.ts +389 -191
  38. package/dist/input/generated.js +2501 -829
  39. package/dist/input/index.d.ts +1 -5
  40. package/dist/input/index.js +1 -5
  41. package/package.json +2 -2
  42. package/dist/enums/PropertyVisibility.d.ts +0 -2
  43. package/dist/enums/PropertyVisibility.js +0 -2
  44. package/dist/input/NodeShape.d.ts +0 -49
  45. package/dist/input/NodeShape.js +0 -154
  46. package/dist/input/Ontology.d.ts +0 -13
  47. package/dist/input/Ontology.js +0 -40
  48. package/dist/input/PropertyShape.d.ts +0 -20
  49. package/dist/input/PropertyShape.js +0 -78
  50. package/dist/input/Shape.d.ts +0 -4
  51. package/dist/input/Shape.js +0 -2
  52. package/dist/input/ancestorClassIris.d.ts +0 -4
  53. package/dist/input/ancestorClassIris.js +0 -24
  54. package/dist/input/descendantClassIris.d.ts +0 -4
  55. package/dist/input/descendantClassIris.js +0 -27
@@ -162,6 +162,21 @@ class $IdentifierSet {
162
162
  }
163
163
  }
164
164
  }
165
+ function $isReadonlyBigIntArray(x) {
166
+ return Array.isArray(x) && x.every((z) => typeof z === "bigint");
167
+ }
168
+ function $isReadonlyBooleanArray(x) {
169
+ return Array.isArray(x) && x.every((z) => typeof z === "boolean");
170
+ }
171
+ function $isReadonlyNumberArray(x) {
172
+ return Array.isArray(x) && x.every((z) => typeof z === "number");
173
+ }
174
+ function $isReadonlyObjectArray(x) {
175
+ return Array.isArray(x) && x.every((z) => typeof z === "object");
176
+ }
177
+ function $isReadonlyStringArray(x) {
178
+ return Array.isArray(x) && x.every((z) => typeof z === "string");
179
+ }
165
180
  const $literalFactory = new LiteralFactory({ dataFactory: dataFactory });
166
181
  export var $PropertyPath;
167
182
  (function ($PropertyPath) {
@@ -219,302 +234,936 @@ function $shaclPropertyFromRdf({ graph, propertySchema, resource, typeFromRdf, }
219
234
  }
220
235
  export var PropertyShape;
221
236
  (function (PropertyShape) {
222
- let $Identifier;
223
- (function ($Identifier) {
224
- $Identifier.fromString = $identifierFromString; // biome-ignore lint/suspicious/noShadowRestrictedNames: allow toString
225
- $Identifier.toString = Resource.Identifier.toString;
226
- })($Identifier = PropertyShape.$Identifier || (PropertyShape.$Identifier = {}));
227
- function $filter(filter, value) {
228
- if (filter.$identifier !== undefined &&
229
- !$filterIdentifier(filter.$identifier, value.$identifier)) {
230
- return false;
237
+ function $create(parameters) {
238
+ let $identifier;
239
+ if (typeof parameters.$identifier === "object") {
240
+ $identifier = parameters.$identifier;
231
241
  }
232
- if (filter.and !== undefined &&
233
- !$filterArray($filterArray($filterIdentifier))(filter.and, value.and)) {
234
- return false;
242
+ else if (typeof parameters.$identifier === "string") {
243
+ $identifier = dataFactory.namedNode(parameters.$identifier);
235
244
  }
236
- if (filter.classes !== undefined &&
237
- !$filterArray($filterIri)(filter.classes, value.classes)) {
238
- return false;
245
+ else if (parameters.$identifier === undefined) {
246
+ $identifier = dataFactory.blankNode();
239
247
  }
240
- if (filter.comments !== undefined &&
241
- !$filterArray($filterString)(filter.comments, value.comments)) {
242
- return false;
248
+ else {
249
+ $identifier = parameters.$identifier;
243
250
  }
244
- if (filter.datatype !== undefined &&
245
- !$filterMaybe($filterIri)(filter.datatype, value.datatype)) {
246
- return false;
251
+ const $type = "PropertyShape";
252
+ let and;
253
+ if (Maybe.isMaybe(parameters.and)) {
254
+ and = parameters.and;
247
255
  }
248
- if (filter.deactivated !== undefined &&
249
- !$filterMaybe($filterBoolean)(filter.deactivated, value.deactivated)) {
250
- return false;
256
+ else if ($isReadonlyObjectArray(parameters.and)) {
257
+ and = Maybe.of(parameters.and);
251
258
  }
252
- if (filter.defaultValue !== undefined &&
253
- !$filterMaybe($filterTerm)(filter.defaultValue, value.defaultValue)) {
254
- return false;
259
+ else if ($isReadonlyStringArray(parameters.and)) {
260
+ and = Maybe.of(parameters.and.map((item) => dataFactory.namedNode(item)));
255
261
  }
256
- if (filter.descriptions !== undefined &&
257
- !$filterArray($filterString)(filter.descriptions, value.descriptions)) {
258
- return false;
262
+ else if (parameters.and === undefined) {
263
+ and = Maybe.empty();
259
264
  }
260
- if (filter.flags !== undefined &&
261
- !$filterArray($filterString)(filter.flags, value.flags)) {
262
- return false;
265
+ else {
266
+ and = parameters.and;
263
267
  }
264
- if (filter.groups !== undefined &&
265
- !$filterArray($filterIdentifier)(filter.groups, value.groups)) {
266
- return false;
268
+ let classes;
269
+ if (parameters.classes === undefined) {
270
+ classes = [];
267
271
  }
268
- if (filter.hasValues !== undefined &&
269
- !$filterArray($filterTerm)(filter.hasValues, value.hasValues)) {
270
- return false;
272
+ else if ($isReadonlyObjectArray(parameters.classes)) {
273
+ classes = parameters.classes;
271
274
  }
272
- if (filter.in_ !== undefined &&
273
- !$filterMaybe($filterArray($filterTerm))(filter.in_, value.in_)) {
274
- return false;
275
+ else if ($isReadonlyStringArray(parameters.classes)) {
276
+ classes = parameters.classes.map((item) => dataFactory.namedNode(item));
275
277
  }
276
- if (filter.isDefinedBy !== undefined &&
277
- !$filterMaybe($filterIdentifier)(filter.isDefinedBy, value.isDefinedBy)) {
278
- return false;
278
+ else {
279
+ classes = parameters.classes;
279
280
  }
280
- if (filter.labels !== undefined &&
281
- !$filterArray($filterString)(filter.labels, value.labels)) {
282
- return false;
281
+ let comment;
282
+ if (Maybe.isMaybe(parameters.comment)) {
283
+ comment = parameters.comment;
283
284
  }
284
- if (filter.languageIn !== undefined &&
285
- !$filterMaybe($filterArray($filterString))(filter.languageIn, value.languageIn)) {
286
- return false;
285
+ else if (typeof parameters.comment === "string") {
286
+ comment = Maybe.of(parameters.comment);
287
287
  }
288
- if (filter.maxCount !== undefined &&
289
- !$filterMaybe(($filterNumeric))(filter.maxCount, value.maxCount)) {
290
- return false;
288
+ else if (parameters.comment === undefined) {
289
+ comment = Maybe.empty();
291
290
  }
292
- if (filter.maxExclusive !== undefined &&
293
- !$filterMaybe($filterLiteral)(filter.maxExclusive, value.maxExclusive)) {
294
- return false;
291
+ else {
292
+ comment = parameters.comment;
295
293
  }
296
- if (filter.maxInclusive !== undefined &&
297
- !$filterMaybe($filterLiteral)(filter.maxInclusive, value.maxInclusive)) {
298
- return false;
294
+ let datatype;
295
+ if (Maybe.isMaybe(parameters.datatype)) {
296
+ datatype = parameters.datatype;
299
297
  }
300
- if (filter.maxLength !== undefined &&
301
- !$filterMaybe(($filterNumeric))(filter.maxLength, value.maxLength)) {
302
- return false;
298
+ else if (typeof parameters.datatype === "object") {
299
+ datatype = Maybe.of(parameters.datatype);
303
300
  }
304
- if (filter.minCount !== undefined &&
305
- !$filterMaybe(($filterNumeric))(filter.minCount, value.minCount)) {
306
- return false;
301
+ else if (typeof parameters.datatype === "string") {
302
+ datatype = Maybe.of(dataFactory.namedNode(parameters.datatype));
307
303
  }
308
- if (filter.minExclusive !== undefined &&
309
- !$filterMaybe($filterLiteral)(filter.minExclusive, value.minExclusive)) {
310
- return false;
304
+ else if (parameters.datatype === undefined) {
305
+ datatype = Maybe.empty();
311
306
  }
312
- if (filter.minInclusive !== undefined &&
313
- !$filterMaybe($filterLiteral)(filter.minInclusive, value.minInclusive)) {
314
- return false;
307
+ else {
308
+ datatype = parameters.datatype;
315
309
  }
316
- if (filter.minLength !== undefined &&
317
- !$filterMaybe(($filterNumeric))(filter.minLength, value.minLength)) {
318
- return false;
310
+ let deactivated;
311
+ if (Maybe.isMaybe(parameters.deactivated)) {
312
+ deactivated = parameters.deactivated;
319
313
  }
320
- if (filter.mutable !== undefined &&
321
- !$filterMaybe($filterBoolean)(filter.mutable, value.mutable)) {
322
- return false;
314
+ else if (typeof parameters.deactivated === "boolean") {
315
+ deactivated = Maybe.of(parameters.deactivated);
323
316
  }
324
- if (filter.name !== undefined &&
325
- !$filterMaybe($filterString)(filter.name, value.name)) {
326
- return false;
317
+ else if (parameters.deactivated === undefined) {
318
+ deactivated = Maybe.empty();
327
319
  }
328
- if (filter.names !== undefined &&
329
- !$filterArray($filterString)(filter.names, value.names)) {
330
- return false;
320
+ else {
321
+ deactivated = parameters.deactivated;
331
322
  }
332
- if (filter.nodeKind !== undefined &&
333
- !$filterMaybe($filterIri)(filter.nodeKind, value.nodeKind)) {
334
- return false;
323
+ let defaultValue;
324
+ if (Maybe.isMaybe(parameters.defaultValue)) {
325
+ defaultValue = parameters.defaultValue;
335
326
  }
336
- if (filter.nodes !== undefined &&
337
- !$filterArray($filterIdentifier)(filter.nodes, value.nodes)) {
338
- return false;
327
+ else if (typeof parameters.defaultValue === "bigint") {
328
+ defaultValue = Maybe.of($literalFactory.bigint(parameters.defaultValue));
339
329
  }
340
- if (filter.not !== undefined &&
341
- !$filterArray($filterIdentifier)(filter.not, value.not)) {
342
- return false;
330
+ else if (typeof parameters.defaultValue === "boolean") {
331
+ defaultValue = Maybe.of($literalFactory.boolean(parameters.defaultValue));
343
332
  }
344
- if (filter.or !== undefined &&
345
- !$filterArray($filterArray($filterIdentifier))(filter.or, value.or)) {
346
- return false;
333
+ else if (typeof parameters.defaultValue === "object" &&
334
+ parameters.defaultValue instanceof Date) {
335
+ defaultValue = Maybe.of($literalFactory.date(parameters.defaultValue));
347
336
  }
348
- if (filter.order !== undefined &&
349
- !$filterMaybe(($filterNumeric))(filter.order, value.order)) {
350
- return false;
337
+ else if (typeof parameters.defaultValue === "number") {
338
+ defaultValue = Maybe.of($literalFactory.number(parameters.defaultValue));
351
339
  }
352
- if (filter.path !== undefined &&
353
- !$PropertyPath.$filter(filter.path, value.path)) {
354
- return false;
340
+ else if (typeof parameters.defaultValue === "string") {
341
+ defaultValue = Maybe.of($literalFactory.string(parameters.defaultValue));
355
342
  }
356
- if (filter.patterns !== undefined &&
357
- !$filterArray($filterString)(filter.patterns, value.patterns)) {
358
- return false;
343
+ else if (typeof parameters.defaultValue === "object") {
344
+ defaultValue = Maybe.of(parameters.defaultValue);
359
345
  }
360
- if (filter.resolve !== undefined &&
361
- !$filterMaybe($filterIdentifier)(filter.resolve, value.resolve)) {
362
- return false;
346
+ else if (parameters.defaultValue === undefined) {
347
+ defaultValue = Maybe.empty();
363
348
  }
364
- if (filter.uniqueLang !== undefined &&
365
- !$filterMaybe($filterBoolean)(filter.uniqueLang, value.uniqueLang)) {
366
- return false;
349
+ else {
350
+ defaultValue = parameters.defaultValue;
367
351
  }
368
- if (filter.visibility !== undefined &&
369
- !$filterMaybe($filterIri)(filter.visibility, value.visibility)) {
370
- return false;
352
+ let description;
353
+ if (Maybe.isMaybe(parameters.description)) {
354
+ description = parameters.description;
371
355
  }
372
- if (filter.xone !== undefined &&
373
- !$filterArray($filterArray($filterIdentifier))(filter.xone, value.xone)) {
374
- return false;
356
+ else if (typeof parameters.description === "string") {
357
+ description = Maybe.of(parameters.description);
375
358
  }
376
- return true;
377
- }
378
- PropertyShape.$filter = $filter;
379
- PropertyShape.$fromRdfResource = (resource, options) => {
380
- let { context, graph, ignoreRdfType = false, objectSet, preferredLanguages, } = options ?? {};
381
- if (!objectSet) {
382
- objectSet = new $RdfjsDatasetObjectSet(resource.dataset);
359
+ else if (parameters.description === undefined) {
360
+ description = Maybe.empty();
383
361
  }
384
- return PropertyShape.$propertiesFromRdfResource(resource, {
385
- context,
386
- graph,
387
- ignoreRdfType,
388
- objectSet,
389
- preferredLanguages,
390
- });
391
- };
392
- PropertyShape.$fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
393
- .toResource()
394
- .chain((resource) => PropertyShape.$fromRdfResource(resource, options))));
395
- PropertyShape.$fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape");
396
- function isPropertyShape(object) {
397
- switch (object.$type) {
398
- case "PropertyShape":
399
- return true;
400
- default:
401
- return false;
362
+ else {
363
+ description = parameters.description;
402
364
  }
403
- }
404
- PropertyShape.isPropertyShape = isPropertyShape;
405
- PropertyShape.$propertiesFromRdfResource = ($resource, _$options) => {
406
- return (!_$options.ignoreRdfType
407
- ? $resource
408
- .value($RdfVocabularies.rdf.type, { graph: _$options.graph })
409
- .chain((actualRdfType) => actualRdfType.toIri())
410
- .chain((actualRdfType) => {
411
- // Check the expected type and its known subtypes
412
- switch (actualRdfType.value) {
413
- case "http://www.w3.org/ns/shacl#PropertyShape":
414
- return Right(true);
415
- }
416
- // Check arbitrary rdfs:subClassOf's of the expected type
417
- if ($resource.isInstanceOf(PropertyShape.$fromRdfType, {
418
- graph: _$options.graph,
419
- })) {
420
- return Right(true);
421
- }
422
- return Left(new Error(`${Resource.Identifier.toString($resource.identifier)} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#PropertyShape)`));
423
- })
424
- : Right(true)).chain((_rdfTypeCheck) => Right(new Resource.Value({
425
- dataFactory: dataFactory,
426
- focusResource: $resource,
427
- propertyPath: $RdfVocabularies.rdf.subject,
428
- term: $resource.identifier,
429
- }).toValues())
430
- .chain((values) => values.chainMap((value) => value.toIdentifier()))
431
- .chain((values) => values.head())
432
- .chain(($identifier) => Right("PropertyShape").chain(($type) => $shaclPropertyFromRdf({
433
- graph: _$options.graph,
434
- resource: $resource,
435
- propertySchema: PropertyShape.$schema.properties.and,
436
- typeFromRdf: (resourceValues) => resourceValues
437
- .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
438
- .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
439
- focusResource: $resource,
440
- propertyPath: PropertyShape.$schema.properties.and.path,
441
- values: valueList.toArray(),
442
- })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
443
- .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
444
- .map((values) => values.toArray())
445
- .map((valuesArray) => Resource.Values.fromValue({
446
- focusResource: $resource,
447
- propertyPath: PropertyShape.$schema.properties.and.path,
448
- value: valuesArray,
449
- })),
450
- }).chain((and) => $shaclPropertyFromRdf({
451
- graph: _$options.graph,
452
- resource: $resource,
453
- propertySchema: PropertyShape.$schema.properties.classes,
454
- typeFromRdf: (resourceValues) => resourceValues
455
- .chain((values) => values.chainMap((value) => value.toIri()))
456
- .map((values) => values.toArray())
457
- .map((valuesArray) => Resource.Values.fromValue({
458
- focusResource: $resource,
459
- propertyPath: PropertyShape.$schema.properties.classes.path,
460
- value: valuesArray,
461
- })),
462
- }).chain((classes) => $shaclPropertyFromRdf({
463
- graph: _$options.graph,
464
- resource: $resource,
465
- propertySchema: PropertyShape.$schema.properties.comments,
466
- typeFromRdf: (resourceValues) => resourceValues
467
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
468
- .chain((values) => values.chainMap((value) => value.toString()))
469
- .map((values) => values.toArray())
470
- .map((valuesArray) => Resource.Values.fromValue({
471
- focusResource: $resource,
472
- propertyPath: PropertyShape.$schema.properties.comments.path,
473
- value: valuesArray,
474
- })),
475
- }).chain((comments) => $shaclPropertyFromRdf({
476
- graph: _$options.graph,
477
- resource: $resource,
478
- propertySchema: PropertyShape.$schema.properties.datatype,
479
- typeFromRdf: (resourceValues) => resourceValues
480
- .chain((values) => values.chainMap((value) => value.toIri()))
481
- .map((values) => values.length > 0
482
- ? values.map((value) => Maybe.of(value))
483
- : Resource.Values.fromValue({
484
- focusResource: $resource,
485
- propertyPath: PropertyShape.$schema.properties.datatype
486
- .path,
487
- value: Maybe.empty(),
488
- })),
489
- }).chain((datatype) => $shaclPropertyFromRdf({
490
- graph: _$options.graph,
491
- resource: $resource,
492
- propertySchema: PropertyShape.$schema.properties.deactivated,
493
- typeFromRdf: (resourceValues) => resourceValues
494
- .chain((values) => values.chainMap((value) => value.toBoolean()))
495
- .map((values) => values.length > 0
496
- ? values.map((value) => Maybe.of(value))
497
- : Resource.Values.fromValue({
498
- focusResource: $resource,
499
- propertyPath: PropertyShape.$schema.properties.deactivated
500
- .path,
501
- value: Maybe.empty(),
502
- })),
503
- }).chain((deactivated) => $shaclPropertyFromRdf({
504
- graph: _$options.graph,
505
- resource: $resource,
506
- propertySchema: PropertyShape.$schema.properties.defaultValue,
507
- typeFromRdf: (resourceValues) => resourceValues
508
- .chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
509
- switch (term.termType) {
510
- case "NamedNode":
511
- case "Literal":
512
- return Either.of(term);
513
- default:
514
- return Left(new Resource.MistypedTermValueError({
515
- actualValue: term,
516
- expectedValueType: "(NamedNode | Literal)",
517
- focusResource: $resource,
365
+ let flags;
366
+ if (parameters.flags === undefined) {
367
+ flags = [];
368
+ }
369
+ else if (typeof parameters.flags === "object") {
370
+ flags = parameters.flags;
371
+ }
372
+ else {
373
+ flags = parameters.flags;
374
+ }
375
+ let groups;
376
+ if (parameters.groups === undefined) {
377
+ groups = [];
378
+ }
379
+ else if ($isReadonlyObjectArray(parameters.groups)) {
380
+ groups = parameters.groups;
381
+ }
382
+ else if ($isReadonlyStringArray(parameters.groups)) {
383
+ groups = parameters.groups.map((item) => dataFactory.namedNode(item));
384
+ }
385
+ else {
386
+ groups = parameters.groups;
387
+ }
388
+ let hasValues;
389
+ if (parameters.hasValues === undefined) {
390
+ hasValues = [];
391
+ }
392
+ else if ($isReadonlyObjectArray(parameters.hasValues)) {
393
+ hasValues = parameters.hasValues;
394
+ }
395
+ else if ($isReadonlyBigIntArray(parameters.hasValues)) {
396
+ hasValues = parameters.hasValues.map((item) => $literalFactory.bigint(item));
397
+ }
398
+ else if ($isReadonlyBooleanArray(parameters.hasValues)) {
399
+ hasValues = parameters.hasValues.map((item) => $literalFactory.boolean(item));
400
+ }
401
+ else if ($isReadonlyNumberArray(parameters.hasValues)) {
402
+ hasValues = parameters.hasValues.map((item) => $literalFactory.number(item));
403
+ }
404
+ else if ($isReadonlyStringArray(parameters.hasValues)) {
405
+ hasValues = parameters.hasValues.map((item) => $literalFactory.string(item));
406
+ }
407
+ else {
408
+ hasValues = parameters.hasValues;
409
+ }
410
+ let in_;
411
+ if (Maybe.isMaybe(parameters.in_)) {
412
+ in_ = parameters.in_;
413
+ }
414
+ else if ($isReadonlyObjectArray(parameters.in_)) {
415
+ in_ = Maybe.of(parameters.in_);
416
+ }
417
+ else if ($isReadonlyBigIntArray(parameters.in_)) {
418
+ in_ = Maybe.of(parameters.in_.map((item) => $literalFactory.bigint(item)));
419
+ }
420
+ else if ($isReadonlyBooleanArray(parameters.in_)) {
421
+ in_ = Maybe.of(parameters.in_.map((item) => $literalFactory.boolean(item)));
422
+ }
423
+ else if ($isReadonlyNumberArray(parameters.in_)) {
424
+ in_ = Maybe.of(parameters.in_.map((item) => $literalFactory.number(item)));
425
+ }
426
+ else if ($isReadonlyStringArray(parameters.in_)) {
427
+ in_ = Maybe.of(parameters.in_.map((item) => $literalFactory.string(item)));
428
+ }
429
+ else if (parameters.in_ === undefined) {
430
+ in_ = Maybe.empty();
431
+ }
432
+ else {
433
+ in_ = parameters.in_;
434
+ }
435
+ let isDefinedBy;
436
+ if (Maybe.isMaybe(parameters.isDefinedBy)) {
437
+ isDefinedBy = parameters.isDefinedBy;
438
+ }
439
+ else if (typeof parameters.isDefinedBy === "object") {
440
+ isDefinedBy = Maybe.of(parameters.isDefinedBy);
441
+ }
442
+ else if (typeof parameters.isDefinedBy === "string") {
443
+ isDefinedBy = Maybe.of(dataFactory.namedNode(parameters.isDefinedBy));
444
+ }
445
+ else if (parameters.isDefinedBy === undefined) {
446
+ isDefinedBy = Maybe.empty();
447
+ }
448
+ else {
449
+ isDefinedBy = parameters.isDefinedBy;
450
+ }
451
+ let label;
452
+ if (Maybe.isMaybe(parameters.label)) {
453
+ label = parameters.label;
454
+ }
455
+ else if (typeof parameters.label === "string") {
456
+ label = Maybe.of(parameters.label);
457
+ }
458
+ else if (parameters.label === undefined) {
459
+ label = Maybe.empty();
460
+ }
461
+ else {
462
+ label = parameters.label;
463
+ }
464
+ let languageIn;
465
+ if (Maybe.isMaybe(parameters.languageIn)) {
466
+ languageIn = parameters.languageIn;
467
+ }
468
+ else if (typeof parameters.languageIn === "object") {
469
+ languageIn = Maybe.of(parameters.languageIn);
470
+ }
471
+ else if (parameters.languageIn === undefined) {
472
+ languageIn = Maybe.empty();
473
+ }
474
+ else {
475
+ languageIn = parameters.languageIn;
476
+ }
477
+ let maxCount;
478
+ if (Maybe.isMaybe(parameters.maxCount)) {
479
+ maxCount = parameters.maxCount;
480
+ }
481
+ else if (typeof parameters.maxCount === "number") {
482
+ maxCount = Maybe.of(parameters.maxCount);
483
+ }
484
+ else if (parameters.maxCount === undefined) {
485
+ maxCount = Maybe.empty();
486
+ }
487
+ else {
488
+ maxCount = parameters.maxCount;
489
+ }
490
+ let maxExclusive;
491
+ if (Maybe.isMaybe(parameters.maxExclusive)) {
492
+ maxExclusive = parameters.maxExclusive;
493
+ }
494
+ else if (typeof parameters.maxExclusive === "bigint") {
495
+ maxExclusive = Maybe.of($literalFactory.bigint(parameters.maxExclusive));
496
+ }
497
+ else if (typeof parameters.maxExclusive === "boolean") {
498
+ maxExclusive = Maybe.of($literalFactory.boolean(parameters.maxExclusive));
499
+ }
500
+ else if (typeof parameters.maxExclusive === "object" &&
501
+ parameters.maxExclusive instanceof Date) {
502
+ maxExclusive = Maybe.of($literalFactory.date(parameters.maxExclusive));
503
+ }
504
+ else if (typeof parameters.maxExclusive === "number") {
505
+ maxExclusive = Maybe.of($literalFactory.number(parameters.maxExclusive));
506
+ }
507
+ else if (typeof parameters.maxExclusive === "string") {
508
+ maxExclusive = Maybe.of($literalFactory.string(parameters.maxExclusive));
509
+ }
510
+ else if (typeof parameters.maxExclusive === "object") {
511
+ maxExclusive = Maybe.of(parameters.maxExclusive);
512
+ }
513
+ else if (parameters.maxExclusive === undefined) {
514
+ maxExclusive = Maybe.empty();
515
+ }
516
+ else {
517
+ maxExclusive = parameters.maxExclusive;
518
+ }
519
+ let maxInclusive;
520
+ if (Maybe.isMaybe(parameters.maxInclusive)) {
521
+ maxInclusive = parameters.maxInclusive;
522
+ }
523
+ else if (typeof parameters.maxInclusive === "bigint") {
524
+ maxInclusive = Maybe.of($literalFactory.bigint(parameters.maxInclusive));
525
+ }
526
+ else if (typeof parameters.maxInclusive === "boolean") {
527
+ maxInclusive = Maybe.of($literalFactory.boolean(parameters.maxInclusive));
528
+ }
529
+ else if (typeof parameters.maxInclusive === "object" &&
530
+ parameters.maxInclusive instanceof Date) {
531
+ maxInclusive = Maybe.of($literalFactory.date(parameters.maxInclusive));
532
+ }
533
+ else if (typeof parameters.maxInclusive === "number") {
534
+ maxInclusive = Maybe.of($literalFactory.number(parameters.maxInclusive));
535
+ }
536
+ else if (typeof parameters.maxInclusive === "string") {
537
+ maxInclusive = Maybe.of($literalFactory.string(parameters.maxInclusive));
538
+ }
539
+ else if (typeof parameters.maxInclusive === "object") {
540
+ maxInclusive = Maybe.of(parameters.maxInclusive);
541
+ }
542
+ else if (parameters.maxInclusive === undefined) {
543
+ maxInclusive = Maybe.empty();
544
+ }
545
+ else {
546
+ maxInclusive = parameters.maxInclusive;
547
+ }
548
+ let maxLength;
549
+ if (Maybe.isMaybe(parameters.maxLength)) {
550
+ maxLength = parameters.maxLength;
551
+ }
552
+ else if (typeof parameters.maxLength === "number") {
553
+ maxLength = Maybe.of(parameters.maxLength);
554
+ }
555
+ else if (parameters.maxLength === undefined) {
556
+ maxLength = Maybe.empty();
557
+ }
558
+ else {
559
+ maxLength = parameters.maxLength;
560
+ }
561
+ let minCount;
562
+ if (Maybe.isMaybe(parameters.minCount)) {
563
+ minCount = parameters.minCount;
564
+ }
565
+ else if (typeof parameters.minCount === "number") {
566
+ minCount = Maybe.of(parameters.minCount);
567
+ }
568
+ else if (parameters.minCount === undefined) {
569
+ minCount = Maybe.empty();
570
+ }
571
+ else {
572
+ minCount = parameters.minCount;
573
+ }
574
+ let minExclusive;
575
+ if (Maybe.isMaybe(parameters.minExclusive)) {
576
+ minExclusive = parameters.minExclusive;
577
+ }
578
+ else if (typeof parameters.minExclusive === "bigint") {
579
+ minExclusive = Maybe.of($literalFactory.bigint(parameters.minExclusive));
580
+ }
581
+ else if (typeof parameters.minExclusive === "boolean") {
582
+ minExclusive = Maybe.of($literalFactory.boolean(parameters.minExclusive));
583
+ }
584
+ else if (typeof parameters.minExclusive === "object" &&
585
+ parameters.minExclusive instanceof Date) {
586
+ minExclusive = Maybe.of($literalFactory.date(parameters.minExclusive));
587
+ }
588
+ else if (typeof parameters.minExclusive === "number") {
589
+ minExclusive = Maybe.of($literalFactory.number(parameters.minExclusive));
590
+ }
591
+ else if (typeof parameters.minExclusive === "string") {
592
+ minExclusive = Maybe.of($literalFactory.string(parameters.minExclusive));
593
+ }
594
+ else if (typeof parameters.minExclusive === "object") {
595
+ minExclusive = Maybe.of(parameters.minExclusive);
596
+ }
597
+ else if (parameters.minExclusive === undefined) {
598
+ minExclusive = Maybe.empty();
599
+ }
600
+ else {
601
+ minExclusive = parameters.minExclusive;
602
+ }
603
+ let minInclusive;
604
+ if (Maybe.isMaybe(parameters.minInclusive)) {
605
+ minInclusive = parameters.minInclusive;
606
+ }
607
+ else if (typeof parameters.minInclusive === "bigint") {
608
+ minInclusive = Maybe.of($literalFactory.bigint(parameters.minInclusive));
609
+ }
610
+ else if (typeof parameters.minInclusive === "boolean") {
611
+ minInclusive = Maybe.of($literalFactory.boolean(parameters.minInclusive));
612
+ }
613
+ else if (typeof parameters.minInclusive === "object" &&
614
+ parameters.minInclusive instanceof Date) {
615
+ minInclusive = Maybe.of($literalFactory.date(parameters.minInclusive));
616
+ }
617
+ else if (typeof parameters.minInclusive === "number") {
618
+ minInclusive = Maybe.of($literalFactory.number(parameters.minInclusive));
619
+ }
620
+ else if (typeof parameters.minInclusive === "string") {
621
+ minInclusive = Maybe.of($literalFactory.string(parameters.minInclusive));
622
+ }
623
+ else if (typeof parameters.minInclusive === "object") {
624
+ minInclusive = Maybe.of(parameters.minInclusive);
625
+ }
626
+ else if (parameters.minInclusive === undefined) {
627
+ minInclusive = Maybe.empty();
628
+ }
629
+ else {
630
+ minInclusive = parameters.minInclusive;
631
+ }
632
+ let minLength;
633
+ if (Maybe.isMaybe(parameters.minLength)) {
634
+ minLength = parameters.minLength;
635
+ }
636
+ else if (typeof parameters.minLength === "number") {
637
+ minLength = Maybe.of(parameters.minLength);
638
+ }
639
+ else if (parameters.minLength === undefined) {
640
+ minLength = Maybe.empty();
641
+ }
642
+ else {
643
+ minLength = parameters.minLength;
644
+ }
645
+ let mutable;
646
+ if (Maybe.isMaybe(parameters.mutable)) {
647
+ mutable = parameters.mutable;
648
+ }
649
+ else if (typeof parameters.mutable === "boolean") {
650
+ mutable = Maybe.of(parameters.mutable);
651
+ }
652
+ else if (parameters.mutable === undefined) {
653
+ mutable = Maybe.empty();
654
+ }
655
+ else {
656
+ mutable = parameters.mutable;
657
+ }
658
+ let name;
659
+ if (Maybe.isMaybe(parameters.name)) {
660
+ name = parameters.name;
661
+ }
662
+ else if (typeof parameters.name === "string") {
663
+ name = Maybe.of(parameters.name);
664
+ }
665
+ else if (parameters.name === undefined) {
666
+ name = Maybe.empty();
667
+ }
668
+ else {
669
+ name = parameters.name;
670
+ }
671
+ let nodeKind;
672
+ if (Maybe.isMaybe(parameters.nodeKind)) {
673
+ nodeKind = parameters.nodeKind;
674
+ }
675
+ else if (typeof parameters.nodeKind === "object") {
676
+ nodeKind = Maybe.of(parameters.nodeKind);
677
+ }
678
+ else if (typeof parameters.nodeKind === "string") {
679
+ nodeKind = Maybe.of(dataFactory.namedNode(parameters.nodeKind));
680
+ }
681
+ else if (parameters.nodeKind === undefined) {
682
+ nodeKind = Maybe.empty();
683
+ }
684
+ else {
685
+ nodeKind = parameters.nodeKind;
686
+ }
687
+ let nodes;
688
+ if (parameters.nodes === undefined) {
689
+ nodes = [];
690
+ }
691
+ else if ($isReadonlyObjectArray(parameters.nodes)) {
692
+ nodes = parameters.nodes;
693
+ }
694
+ else if ($isReadonlyStringArray(parameters.nodes)) {
695
+ nodes = parameters.nodes.map((item) => dataFactory.namedNode(item));
696
+ }
697
+ else {
698
+ nodes = parameters.nodes;
699
+ }
700
+ let not;
701
+ if (parameters.not === undefined) {
702
+ not = [];
703
+ }
704
+ else if ($isReadonlyObjectArray(parameters.not)) {
705
+ not = parameters.not;
706
+ }
707
+ else if ($isReadonlyStringArray(parameters.not)) {
708
+ not = parameters.not.map((item) => dataFactory.namedNode(item));
709
+ }
710
+ else {
711
+ not = parameters.not;
712
+ }
713
+ let or;
714
+ if (Maybe.isMaybe(parameters.or)) {
715
+ or = parameters.or;
716
+ }
717
+ else if ($isReadonlyObjectArray(parameters.or)) {
718
+ or = Maybe.of(parameters.or);
719
+ }
720
+ else if ($isReadonlyStringArray(parameters.or)) {
721
+ or = Maybe.of(parameters.or.map((item) => dataFactory.namedNode(item)));
722
+ }
723
+ else if (parameters.or === undefined) {
724
+ or = Maybe.empty();
725
+ }
726
+ else {
727
+ or = parameters.or;
728
+ }
729
+ let order;
730
+ if (Maybe.isMaybe(parameters.order)) {
731
+ order = parameters.order;
732
+ }
733
+ else if (typeof parameters.order === "number") {
734
+ order = Maybe.of(parameters.order);
735
+ }
736
+ else if (parameters.order === undefined) {
737
+ order = Maybe.empty();
738
+ }
739
+ else {
740
+ order = parameters.order;
741
+ }
742
+ const path = parameters.path;
743
+ let patterns;
744
+ if (parameters.patterns === undefined) {
745
+ patterns = [];
746
+ }
747
+ else if (typeof parameters.patterns === "object") {
748
+ patterns = parameters.patterns;
749
+ }
750
+ else {
751
+ patterns = parameters.patterns;
752
+ }
753
+ let resolve;
754
+ if (Maybe.isMaybe(parameters.resolve)) {
755
+ resolve = parameters.resolve;
756
+ }
757
+ else if (typeof parameters.resolve === "object") {
758
+ resolve = Maybe.of(parameters.resolve);
759
+ }
760
+ else if (typeof parameters.resolve === "string") {
761
+ resolve = Maybe.of(dataFactory.namedNode(parameters.resolve));
762
+ }
763
+ else if (parameters.resolve === undefined) {
764
+ resolve = Maybe.empty();
765
+ }
766
+ else {
767
+ resolve = parameters.resolve;
768
+ }
769
+ let shaclmateName;
770
+ if (Maybe.isMaybe(parameters.shaclmateName)) {
771
+ shaclmateName = parameters.shaclmateName;
772
+ }
773
+ else if (typeof parameters.shaclmateName === "string") {
774
+ shaclmateName = Maybe.of(parameters.shaclmateName);
775
+ }
776
+ else if (parameters.shaclmateName === undefined) {
777
+ shaclmateName = Maybe.empty();
778
+ }
779
+ else {
780
+ shaclmateName = parameters.shaclmateName;
781
+ }
782
+ let uniqueLang;
783
+ if (Maybe.isMaybe(parameters.uniqueLang)) {
784
+ uniqueLang = parameters.uniqueLang;
785
+ }
786
+ else if (typeof parameters.uniqueLang === "boolean") {
787
+ uniqueLang = Maybe.of(parameters.uniqueLang);
788
+ }
789
+ else if (parameters.uniqueLang === undefined) {
790
+ uniqueLang = Maybe.empty();
791
+ }
792
+ else {
793
+ uniqueLang = parameters.uniqueLang;
794
+ }
795
+ let visibility;
796
+ if (Maybe.isMaybe(parameters.visibility)) {
797
+ visibility = parameters.visibility;
798
+ }
799
+ else if (typeof parameters.visibility === "object") {
800
+ visibility = Maybe.of(parameters.visibility);
801
+ }
802
+ else if (typeof parameters.visibility === "string") {
803
+ visibility = Maybe.of(dataFactory.namedNode(parameters.visibility));
804
+ }
805
+ else if (parameters.visibility === undefined) {
806
+ visibility = Maybe.empty();
807
+ }
808
+ else {
809
+ visibility = parameters.visibility;
810
+ }
811
+ let xone;
812
+ if (Maybe.isMaybe(parameters.xone)) {
813
+ xone = parameters.xone;
814
+ }
815
+ else if ($isReadonlyObjectArray(parameters.xone)) {
816
+ xone = Maybe.of(parameters.xone);
817
+ }
818
+ else if ($isReadonlyStringArray(parameters.xone)) {
819
+ xone = Maybe.of(parameters.xone.map((item) => dataFactory.namedNode(item)));
820
+ }
821
+ else if (parameters.xone === undefined) {
822
+ xone = Maybe.empty();
823
+ }
824
+ else {
825
+ xone = parameters.xone;
826
+ }
827
+ return {
828
+ $identifier,
829
+ $type,
830
+ and,
831
+ classes,
832
+ comment,
833
+ datatype,
834
+ deactivated,
835
+ defaultValue,
836
+ description,
837
+ flags,
838
+ groups,
839
+ hasValues,
840
+ in_,
841
+ isDefinedBy,
842
+ label,
843
+ languageIn,
844
+ maxCount,
845
+ maxExclusive,
846
+ maxInclusive,
847
+ maxLength,
848
+ minCount,
849
+ minExclusive,
850
+ minInclusive,
851
+ minLength,
852
+ mutable,
853
+ name,
854
+ nodeKind,
855
+ nodes,
856
+ not,
857
+ or,
858
+ order,
859
+ path,
860
+ patterns,
861
+ resolve,
862
+ shaclmateName,
863
+ uniqueLang,
864
+ visibility,
865
+ xone,
866
+ };
867
+ }
868
+ PropertyShape.$create = $create;
869
+ let $Identifier;
870
+ (function ($Identifier) {
871
+ $Identifier.fromString = $identifierFromString; // biome-ignore lint/suspicious/noShadowRestrictedNames: allow toString
872
+ $Identifier.toString = Resource.Identifier.toString;
873
+ })($Identifier = PropertyShape.$Identifier || (PropertyShape.$Identifier = {}));
874
+ function $filter(filter, value) {
875
+ if (filter.$identifier !== undefined &&
876
+ !$filterIdentifier(filter.$identifier, value.$identifier)) {
877
+ return false;
878
+ }
879
+ if (filter.and !== undefined &&
880
+ !$filterMaybe($filterArray($filterIdentifier))(filter.and, value.and)) {
881
+ return false;
882
+ }
883
+ if (filter.classes !== undefined &&
884
+ !$filterArray($filterIri)(filter.classes, value.classes)) {
885
+ return false;
886
+ }
887
+ if (filter.comment !== undefined &&
888
+ !$filterMaybe($filterString)(filter.comment, value.comment)) {
889
+ return false;
890
+ }
891
+ if (filter.datatype !== undefined &&
892
+ !$filterMaybe($filterIri)(filter.datatype, value.datatype)) {
893
+ return false;
894
+ }
895
+ if (filter.deactivated !== undefined &&
896
+ !$filterMaybe($filterBoolean)(filter.deactivated, value.deactivated)) {
897
+ return false;
898
+ }
899
+ if (filter.defaultValue !== undefined &&
900
+ !$filterMaybe($filterTerm)(filter.defaultValue, value.defaultValue)) {
901
+ return false;
902
+ }
903
+ if (filter.description !== undefined &&
904
+ !$filterMaybe($filterString)(filter.description, value.description)) {
905
+ return false;
906
+ }
907
+ if (filter.flags !== undefined &&
908
+ !$filterArray($filterString)(filter.flags, value.flags)) {
909
+ return false;
910
+ }
911
+ if (filter.groups !== undefined &&
912
+ !$filterArray($filterIdentifier)(filter.groups, value.groups)) {
913
+ return false;
914
+ }
915
+ if (filter.hasValues !== undefined &&
916
+ !$filterArray($filterTerm)(filter.hasValues, value.hasValues)) {
917
+ return false;
918
+ }
919
+ if (filter.in_ !== undefined &&
920
+ !$filterMaybe($filterArray($filterTerm))(filter.in_, value.in_)) {
921
+ return false;
922
+ }
923
+ if (filter.isDefinedBy !== undefined &&
924
+ !$filterMaybe($filterIdentifier)(filter.isDefinedBy, value.isDefinedBy)) {
925
+ return false;
926
+ }
927
+ if (filter.label !== undefined &&
928
+ !$filterMaybe($filterString)(filter.label, value.label)) {
929
+ return false;
930
+ }
931
+ if (filter.languageIn !== undefined &&
932
+ !$filterMaybe($filterArray($filterString))(filter.languageIn, value.languageIn)) {
933
+ return false;
934
+ }
935
+ if (filter.maxCount !== undefined &&
936
+ !$filterMaybe(($filterNumeric))(filter.maxCount, value.maxCount)) {
937
+ return false;
938
+ }
939
+ if (filter.maxExclusive !== undefined &&
940
+ !$filterMaybe($filterLiteral)(filter.maxExclusive, value.maxExclusive)) {
941
+ return false;
942
+ }
943
+ if (filter.maxInclusive !== undefined &&
944
+ !$filterMaybe($filterLiteral)(filter.maxInclusive, value.maxInclusive)) {
945
+ return false;
946
+ }
947
+ if (filter.maxLength !== undefined &&
948
+ !$filterMaybe(($filterNumeric))(filter.maxLength, value.maxLength)) {
949
+ return false;
950
+ }
951
+ if (filter.minCount !== undefined &&
952
+ !$filterMaybe(($filterNumeric))(filter.minCount, value.minCount)) {
953
+ return false;
954
+ }
955
+ if (filter.minExclusive !== undefined &&
956
+ !$filterMaybe($filterLiteral)(filter.minExclusive, value.minExclusive)) {
957
+ return false;
958
+ }
959
+ if (filter.minInclusive !== undefined &&
960
+ !$filterMaybe($filterLiteral)(filter.minInclusive, value.minInclusive)) {
961
+ return false;
962
+ }
963
+ if (filter.minLength !== undefined &&
964
+ !$filterMaybe(($filterNumeric))(filter.minLength, value.minLength)) {
965
+ return false;
966
+ }
967
+ if (filter.mutable !== undefined &&
968
+ !$filterMaybe($filterBoolean)(filter.mutable, value.mutable)) {
969
+ return false;
970
+ }
971
+ if (filter.name !== undefined &&
972
+ !$filterMaybe($filterString)(filter.name, value.name)) {
973
+ return false;
974
+ }
975
+ if (filter.nodeKind !== undefined &&
976
+ !$filterMaybe($filterIri)(filter.nodeKind, value.nodeKind)) {
977
+ return false;
978
+ }
979
+ if (filter.nodes !== undefined &&
980
+ !$filterArray($filterIdentifier)(filter.nodes, value.nodes)) {
981
+ return false;
982
+ }
983
+ if (filter.not !== undefined &&
984
+ !$filterArray($filterIdentifier)(filter.not, value.not)) {
985
+ return false;
986
+ }
987
+ if (filter.or !== undefined &&
988
+ !$filterMaybe($filterArray($filterIdentifier))(filter.or, value.or)) {
989
+ return false;
990
+ }
991
+ if (filter.order !== undefined &&
992
+ !$filterMaybe(($filterNumeric))(filter.order, value.order)) {
993
+ return false;
994
+ }
995
+ if (filter.path !== undefined &&
996
+ !$PropertyPath.$filter(filter.path, value.path)) {
997
+ return false;
998
+ }
999
+ if (filter.patterns !== undefined &&
1000
+ !$filterArray($filterString)(filter.patterns, value.patterns)) {
1001
+ return false;
1002
+ }
1003
+ if (filter.resolve !== undefined &&
1004
+ !$filterMaybe($filterIdentifier)(filter.resolve, value.resolve)) {
1005
+ return false;
1006
+ }
1007
+ if (filter.shaclmateName !== undefined &&
1008
+ !$filterMaybe($filterString)(filter.shaclmateName, value.shaclmateName)) {
1009
+ return false;
1010
+ }
1011
+ if (filter.uniqueLang !== undefined &&
1012
+ !$filterMaybe($filterBoolean)(filter.uniqueLang, value.uniqueLang)) {
1013
+ return false;
1014
+ }
1015
+ if (filter.visibility !== undefined &&
1016
+ !$filterMaybe($filterIri)(filter.visibility, value.visibility)) {
1017
+ return false;
1018
+ }
1019
+ if (filter.xone !== undefined &&
1020
+ !$filterMaybe($filterArray($filterIdentifier))(filter.xone, value.xone)) {
1021
+ return false;
1022
+ }
1023
+ return true;
1024
+ }
1025
+ PropertyShape.$filter = $filter;
1026
+ PropertyShape.$fromRdfResource = (resource, options) => {
1027
+ let { context, graph, ignoreRdfType = false, objectSet, preferredLanguages, } = options ?? {};
1028
+ if (!objectSet) {
1029
+ objectSet = new $RdfjsDatasetObjectSet(resource.dataset);
1030
+ }
1031
+ return PropertyShape.$propertiesFromRdfResource(resource, {
1032
+ context,
1033
+ graph,
1034
+ ignoreRdfType,
1035
+ objectSet,
1036
+ preferredLanguages,
1037
+ });
1038
+ };
1039
+ PropertyShape.$fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
1040
+ .toResource()
1041
+ .chain((resource) => PropertyShape.$fromRdfResource(resource, options))));
1042
+ PropertyShape.$fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape");
1043
+ function isPropertyShape(object) {
1044
+ switch (object.$type) {
1045
+ case "PropertyShape":
1046
+ return true;
1047
+ default:
1048
+ return false;
1049
+ }
1050
+ }
1051
+ PropertyShape.isPropertyShape = isPropertyShape;
1052
+ PropertyShape.$propertiesFromRdfResource = ($resource, _$options) => {
1053
+ return (!_$options.ignoreRdfType
1054
+ ? $resource
1055
+ .value($RdfVocabularies.rdf.type, { graph: _$options.graph })
1056
+ .chain((actualRdfType) => actualRdfType.toIri())
1057
+ .chain((actualRdfType) => {
1058
+ // Check the expected type and its known subtypes
1059
+ switch (actualRdfType.value) {
1060
+ case "http://www.w3.org/ns/shacl#PropertyShape":
1061
+ return Right(true);
1062
+ }
1063
+ // Check arbitrary rdfs:subClassOf's of the expected type
1064
+ if ($resource.isInstanceOf(PropertyShape.$fromRdfType, {
1065
+ graph: _$options.graph,
1066
+ })) {
1067
+ return Right(true);
1068
+ }
1069
+ return Left(new Error(`${Resource.Identifier.toString($resource.identifier)} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#PropertyShape)`));
1070
+ })
1071
+ : Right(true)).chain((_rdfTypeCheck) => Right(new Resource.Value({
1072
+ dataFactory: dataFactory,
1073
+ focusResource: $resource,
1074
+ propertyPath: $RdfVocabularies.rdf.subject,
1075
+ term: $resource.identifier,
1076
+ }).toValues())
1077
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
1078
+ .chain((values) => values.head())
1079
+ .chain(($identifier) => Right("PropertyShape").chain(($type) => $shaclPropertyFromRdf({
1080
+ graph: _$options.graph,
1081
+ resource: $resource,
1082
+ propertySchema: PropertyShape.$schema.properties.and,
1083
+ typeFromRdf: (resourceValues) => resourceValues
1084
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
1085
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
1086
+ focusResource: $resource,
1087
+ propertyPath: PropertyShape.$schema.properties.and.path,
1088
+ values: valueList.toArray(),
1089
+ })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
1090
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
1091
+ .map((values) => values.length > 0
1092
+ ? values.map((value) => Maybe.of(value))
1093
+ : Resource.Values.fromValue({
1094
+ focusResource: $resource,
1095
+ propertyPath: PropertyShape.$schema.properties.and.path,
1096
+ value: Maybe.empty(),
1097
+ })),
1098
+ }).chain((and) => $shaclPropertyFromRdf({
1099
+ graph: _$options.graph,
1100
+ resource: $resource,
1101
+ propertySchema: PropertyShape.$schema.properties.classes,
1102
+ typeFromRdf: (resourceValues) => resourceValues
1103
+ .chain((values) => values.chainMap((value) => value.toIri()))
1104
+ .map((values) => values.toArray())
1105
+ .map((valuesArray) => Resource.Values.fromValue({
1106
+ focusResource: $resource,
1107
+ propertyPath: PropertyShape.$schema.properties.classes.path,
1108
+ value: valuesArray,
1109
+ })),
1110
+ }).chain((classes) => $shaclPropertyFromRdf({
1111
+ graph: _$options.graph,
1112
+ resource: $resource,
1113
+ propertySchema: PropertyShape.$schema.properties.comment,
1114
+ typeFromRdf: (resourceValues) => resourceValues
1115
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1116
+ .chain((values) => values.chainMap((value) => value.toString()))
1117
+ .map((values) => values.length > 0
1118
+ ? values.map((value) => Maybe.of(value))
1119
+ : Resource.Values.fromValue({
1120
+ focusResource: $resource,
1121
+ propertyPath: PropertyShape.$schema.properties.comment.path,
1122
+ value: Maybe.empty(),
1123
+ })),
1124
+ }).chain((comment) => $shaclPropertyFromRdf({
1125
+ graph: _$options.graph,
1126
+ resource: $resource,
1127
+ propertySchema: PropertyShape.$schema.properties.datatype,
1128
+ typeFromRdf: (resourceValues) => resourceValues
1129
+ .chain((values) => values.chainMap((value) => value.toIri()))
1130
+ .map((values) => values.length > 0
1131
+ ? values.map((value) => Maybe.of(value))
1132
+ : Resource.Values.fromValue({
1133
+ focusResource: $resource,
1134
+ propertyPath: PropertyShape.$schema.properties.datatype
1135
+ .path,
1136
+ value: Maybe.empty(),
1137
+ })),
1138
+ }).chain((datatype) => $shaclPropertyFromRdf({
1139
+ graph: _$options.graph,
1140
+ resource: $resource,
1141
+ propertySchema: PropertyShape.$schema.properties.deactivated,
1142
+ typeFromRdf: (resourceValues) => resourceValues
1143
+ .chain((values) => values.chainMap((value) => value.toBoolean()))
1144
+ .map((values) => values.length > 0
1145
+ ? values.map((value) => Maybe.of(value))
1146
+ : Resource.Values.fromValue({
1147
+ focusResource: $resource,
1148
+ propertyPath: PropertyShape.$schema.properties.deactivated
1149
+ .path,
1150
+ value: Maybe.empty(),
1151
+ })),
1152
+ }).chain((deactivated) => $shaclPropertyFromRdf({
1153
+ graph: _$options.graph,
1154
+ resource: $resource,
1155
+ propertySchema: PropertyShape.$schema.properties.defaultValue,
1156
+ typeFromRdf: (resourceValues) => resourceValues
1157
+ .chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
1158
+ switch (term.termType) {
1159
+ case "NamedNode":
1160
+ case "Literal":
1161
+ return Either.of(term);
1162
+ default:
1163
+ return Left(new Resource.MistypedTermValueError({
1164
+ actualValue: term,
1165
+ expectedValueType: "(NamedNode | Literal)",
1166
+ focusResource: $resource,
518
1167
  propertyPath: PropertyShape.$schema.properties
519
1168
  .defaultValue.path,
520
1169
  }));
@@ -531,18 +1180,19 @@ export var PropertyShape;
531
1180
  }).chain((defaultValue) => $shaclPropertyFromRdf({
532
1181
  graph: _$options.graph,
533
1182
  resource: $resource,
534
- propertySchema: PropertyShape.$schema.properties.descriptions,
1183
+ propertySchema: PropertyShape.$schema.properties.description,
535
1184
  typeFromRdf: (resourceValues) => resourceValues
536
1185
  .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
537
1186
  .chain((values) => values.chainMap((value) => value.toString()))
538
- .map((values) => values.toArray())
539
- .map((valuesArray) => Resource.Values.fromValue({
540
- focusResource: $resource,
541
- propertyPath: PropertyShape.$schema.properties
542
- .descriptions.path,
543
- value: valuesArray,
544
- })),
545
- }).chain((descriptions) => $shaclPropertyFromRdf({
1187
+ .map((values) => values.length > 0
1188
+ ? values.map((value) => Maybe.of(value))
1189
+ : Resource.Values.fromValue({
1190
+ focusResource: $resource,
1191
+ propertyPath: PropertyShape.$schema.properties
1192
+ .description.path,
1193
+ value: Maybe.empty(),
1194
+ })),
1195
+ }).chain((description) => $shaclPropertyFromRdf({
546
1196
  graph: _$options.graph,
547
1197
  resource: $resource,
548
1198
  propertySchema: PropertyShape.$schema.properties.flags,
@@ -654,18 +1304,19 @@ export var PropertyShape;
654
1304
  }).chain((isDefinedBy) => $shaclPropertyFromRdf({
655
1305
  graph: _$options.graph,
656
1306
  resource: $resource,
657
- propertySchema: PropertyShape.$schema.properties.labels,
1307
+ propertySchema: PropertyShape.$schema.properties.label,
658
1308
  typeFromRdf: (resourceValues) => resourceValues
659
1309
  .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
660
1310
  .chain((values) => values.chainMap((value) => value.toString()))
661
- .map((values) => values.toArray())
662
- .map((valuesArray) => Resource.Values.fromValue({
663
- focusResource: $resource,
664
- propertyPath: PropertyShape.$schema.properties
665
- .labels.path,
666
- value: valuesArray,
667
- })),
668
- }).chain((labels) => $shaclPropertyFromRdf({
1311
+ .map((values) => values.length > 0
1312
+ ? values.map((value) => Maybe.of(value))
1313
+ : Resource.Values.fromValue({
1314
+ focusResource: $resource,
1315
+ propertyPath: PropertyShape.$schema
1316
+ .properties.label.path,
1317
+ value: Maybe.empty(),
1318
+ })),
1319
+ }).chain((label) => $shaclPropertyFromRdf({
669
1320
  graph: _$options.graph,
670
1321
  resource: $resource,
671
1322
  propertySchema: PropertyShape.$schema.properties.languageIn,
@@ -871,25 +1522,6 @@ export var PropertyShape;
871
1522
  value: Maybe.empty(),
872
1523
  })),
873
1524
  }).chain((name) => $shaclPropertyFromRdf({
874
- graph: _$options.graph,
875
- resource: $resource,
876
- propertySchema: PropertyShape.$schema
877
- .properties
878
- .names,
879
- typeFromRdf: (resourceValues) => resourceValues
880
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
881
- .chain((values) => values.chainMap((value) => value.toString()))
882
- .map((values) => values.toArray())
883
- .map((valuesArray) => Resource.Values.fromValue({
884
- focusResource: $resource,
885
- propertyPath: PropertyShape
886
- .$schema
887
- .properties
888
- .names
889
- .path,
890
- value: valuesArray,
891
- })),
892
- }).chain((names) => $shaclPropertyFromRdf({
893
1525
  graph: _$options.graph,
894
1526
  resource: $resource,
895
1527
  propertySchema: PropertyShape.$schema
@@ -972,16 +1604,18 @@ export var PropertyShape;
972
1604
  values: valueList.toArray(),
973
1605
  })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
974
1606
  .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
975
- .map((values) => values.toArray())
976
- .map((valuesArray) => Resource.Values.fromValue({
977
- focusResource: $resource,
978
- propertyPath: PropertyShape
979
- .$schema
980
- .properties
981
- .or
982
- .path,
983
- value: valuesArray,
984
- })),
1607
+ .map((values) => values.length >
1608
+ 0
1609
+ ? values.map((value) => Maybe.of(value))
1610
+ : Resource.Values.fromValue({
1611
+ focusResource: $resource,
1612
+ propertyPath: PropertyShape
1613
+ .$schema
1614
+ .properties
1615
+ .or
1616
+ .path,
1617
+ value: Maybe.empty(),
1618
+ })),
985
1619
  }).chain((or) => $shaclPropertyFromRdf({
986
1620
  graph: _$options.graph,
987
1621
  resource: $resource,
@@ -1061,6 +1695,27 @@ export var PropertyShape;
1061
1695
  value: Maybe.empty(),
1062
1696
  })),
1063
1697
  }).chain((resolve) => $shaclPropertyFromRdf({
1698
+ graph: _$options.graph,
1699
+ resource: $resource,
1700
+ propertySchema: PropertyShape.$schema
1701
+ .properties
1702
+ .shaclmateName,
1703
+ typeFromRdf: (resourceValues) => resourceValues
1704
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1705
+ .chain((values) => values.chainMap((value) => value.toString()))
1706
+ .map((values) => values.length >
1707
+ 0
1708
+ ? values.map((value) => Maybe.of(value))
1709
+ : Resource.Values.fromValue({
1710
+ focusResource: $resource,
1711
+ propertyPath: PropertyShape
1712
+ .$schema
1713
+ .properties
1714
+ .shaclmateName
1715
+ .path,
1716
+ value: Maybe.empty(),
1717
+ })),
1718
+ }).chain((shaclmateName) => $shaclPropertyFromRdf({
1064
1719
  graph: _$options.graph,
1065
1720
  resource: $resource,
1066
1721
  propertySchema: PropertyShape.$schema
@@ -1124,32 +1779,34 @@ export var PropertyShape;
1124
1779
  values: valueList.toArray(),
1125
1780
  })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
1126
1781
  .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
1127
- .map((values) => values.toArray())
1128
- .map((valuesArray) => Resource.Values.fromValue({
1129
- focusResource: $resource,
1130
- propertyPath: PropertyShape
1131
- .$schema
1132
- .properties
1133
- .xone
1134
- .path,
1135
- value: valuesArray,
1136
- })),
1782
+ .map((values) => values.length >
1783
+ 0
1784
+ ? values.map((value) => Maybe.of(value))
1785
+ : Resource.Values.fromValue({
1786
+ focusResource: $resource,
1787
+ propertyPath: PropertyShape
1788
+ .$schema
1789
+ .properties
1790
+ .xone
1791
+ .path,
1792
+ value: Maybe.empty(),
1793
+ })),
1137
1794
  }).map((xone) => ({
1138
1795
  $identifier,
1139
1796
  $type,
1140
1797
  and,
1141
1798
  classes,
1142
- comments,
1799
+ comment,
1143
1800
  datatype,
1144
1801
  deactivated,
1145
1802
  defaultValue,
1146
- descriptions,
1803
+ description,
1147
1804
  flags,
1148
1805
  groups,
1149
1806
  hasValues,
1150
1807
  in_,
1151
1808
  isDefinedBy,
1152
- labels,
1809
+ label,
1153
1810
  languageIn,
1154
1811
  maxCount,
1155
1812
  maxExclusive,
@@ -1161,7 +1818,6 @@ export var PropertyShape;
1161
1818
  minLength,
1162
1819
  mutable,
1163
1820
  name,
1164
- names,
1165
1821
  nodeKind,
1166
1822
  nodes,
1167
1823
  not,
@@ -1170,6 +1826,7 @@ export var PropertyShape;
1170
1826
  path,
1171
1827
  patterns,
1172
1828
  resolve,
1829
+ shaclmateName,
1173
1830
  uniqueLang,
1174
1831
  visibility,
1175
1832
  xone,
@@ -1191,7 +1848,7 @@ export var PropertyShape;
1191
1848
  and: {
1192
1849
  kind: "Shacl",
1193
1850
  type: () => ({
1194
- kind: "Set",
1851
+ kind: "Maybe",
1195
1852
  item: () => ({
1196
1853
  kind: "List",
1197
1854
  item: () => ({ kind: "Identifier" }),
@@ -1207,10 +1864,10 @@ export var PropertyShape;
1207
1864
  }),
1208
1865
  path: dataFactory.namedNode("http://www.w3.org/ns/shacl#class"),
1209
1866
  },
1210
- comments: {
1867
+ comment: {
1211
1868
  kind: "Shacl",
1212
1869
  type: () => ({
1213
- kind: "Set",
1870
+ kind: "Maybe",
1214
1871
  item: () => ({ kind: "String" }),
1215
1872
  }),
1216
1873
  path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
@@ -1239,10 +1896,10 @@ export var PropertyShape;
1239
1896
  }),
1240
1897
  path: dataFactory.namedNode("http://www.w3.org/ns/shacl#defaultValue"),
1241
1898
  },
1242
- descriptions: {
1899
+ description: {
1243
1900
  kind: "Shacl",
1244
1901
  type: () => ({
1245
- kind: "Set",
1902
+ kind: "Maybe",
1246
1903
  item: () => ({ kind: "String" }),
1247
1904
  }),
1248
1905
  path: dataFactory.namedNode("http://www.w3.org/ns/shacl#description"),
@@ -1290,10 +1947,10 @@ export var PropertyShape;
1290
1947
  }),
1291
1948
  path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"),
1292
1949
  },
1293
- labels: {
1950
+ label: {
1294
1951
  kind: "Shacl",
1295
1952
  type: () => ({
1296
- kind: "Set",
1953
+ kind: "Maybe",
1297
1954
  item: () => ({ kind: "String" }),
1298
1955
  }),
1299
1956
  path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
@@ -1387,14 +2044,6 @@ export var PropertyShape;
1387
2044
  kind: "Maybe",
1388
2045
  item: () => ({ kind: "String" }),
1389
2046
  }),
1390
- path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#name"),
1391
- },
1392
- names: {
1393
- kind: "Shacl",
1394
- type: () => ({
1395
- kind: "Set",
1396
- item: () => ({ kind: "String" }),
1397
- }),
1398
2047
  path: dataFactory.namedNode("http://www.w3.org/ns/shacl#name"),
1399
2048
  },
1400
2049
  nodeKind: {
@@ -1434,7 +2083,7 @@ export var PropertyShape;
1434
2083
  or: {
1435
2084
  kind: "Shacl",
1436
2085
  type: () => ({
1437
- kind: "Set",
2086
+ kind: "Maybe",
1438
2087
  item: () => ({
1439
2088
  kind: "List",
1440
2089
  item: () => ({ kind: "Identifier" }),
@@ -1471,6 +2120,14 @@ export var PropertyShape;
1471
2120
  }),
1472
2121
  path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#resolve"),
1473
2122
  },
2123
+ shaclmateName: {
2124
+ kind: "Shacl",
2125
+ type: () => ({
2126
+ kind: "Maybe",
2127
+ item: () => ({ kind: "String" }),
2128
+ }),
2129
+ path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#name"),
2130
+ },
1474
2131
  uniqueLang: {
1475
2132
  kind: "Shacl",
1476
2133
  type: () => ({
@@ -1497,7 +2154,7 @@ export var PropertyShape;
1497
2154
  xone: {
1498
2155
  kind: "Shacl",
1499
2156
  type: () => ({
1500
- kind: "Set",
2157
+ kind: "Maybe",
1501
2158
  item: () => ({
1502
2159
  kind: "List",
1503
2160
  item: () => ({ kind: "Identifier" }),
@@ -1514,9 +2171,9 @@ export var PropertyShape;
1514
2171
  if (!options?.ignoreRdfType) {
1515
2172
  resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"), options?.graph);
1516
2173
  }
1517
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#and"), _propertyShape.and.flatMap((item) => [
1518
- item.length > 0
1519
- ? item.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
2174
+ resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#and"), _propertyShape.and.toList().flatMap((value) => [
2175
+ value.length > 0
2176
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
1520
2177
  if (itemIndex === 0) {
1521
2178
  currentSubListResource = listResource;
1522
2179
  }
@@ -1537,7 +2194,9 @@ export var PropertyShape;
1537
2194
  : $RdfVocabularies.rdf.nil,
1538
2195
  ]), options?.graph);
1539
2196
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#class"), _propertyShape.classes.flatMap((item) => [item]), options?.graph);
1540
- resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), _propertyShape.comments.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
2197
+ resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), _propertyShape.comment
2198
+ .toList()
2199
+ .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
1541
2200
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#datatype"), _propertyShape.datatype.toList(), options?.graph);
1542
2201
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"), _propertyShape.deactivated
1543
2202
  .toList()
@@ -1545,9 +2204,9 @@ export var PropertyShape;
1545
2204
  $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
1546
2205
  ]), options?.graph);
1547
2206
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#defaultValue"), _propertyShape.defaultValue.toList(), options?.graph);
1548
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#description"), _propertyShape.descriptions.flatMap((item) => [
1549
- $literalFactory.string(item),
1550
- ]), options?.graph);
2207
+ resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#description"), _propertyShape.description
2208
+ .toList()
2209
+ .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
1551
2210
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#flags"), _propertyShape.flags.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
1552
2211
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#group"), _propertyShape.groups.flatMap((item) => [item]), options?.graph);
1553
2212
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#hasValue"), _propertyShape.hasValues.flatMap((item) => [item]), options?.graph);
@@ -1574,7 +2233,9 @@ export var PropertyShape;
1574
2233
  : $RdfVocabularies.rdf.nil,
1575
2234
  ]), options?.graph);
1576
2235
  resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"), _propertyShape.isDefinedBy.toList(), options?.graph);
1577
- resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), _propertyShape.labels.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
2236
+ resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), _propertyShape.label
2237
+ .toList()
2238
+ .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
1578
2239
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#languageIn"), _propertyShape.languageIn.toList().flatMap((value) => [
1579
2240
  value.length > 0
1580
2241
  ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
@@ -1626,16 +2287,15 @@ export var PropertyShape;
1626
2287
  .flatMap((value) => [
1627
2288
  $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
1628
2289
  ]), options?.graph);
1629
- resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#name"), _propertyShape.name
2290
+ resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#name"), _propertyShape.name
1630
2291
  .toList()
1631
2292
  .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
1632
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#name"), _propertyShape.names.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
1633
2293
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"), _propertyShape.nodeKind.toList(), options?.graph);
1634
2294
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#node"), _propertyShape.nodes.flatMap((item) => [item]), options?.graph);
1635
2295
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#not"), _propertyShape.not.flatMap((item) => [item]), options?.graph);
1636
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#or"), _propertyShape.or.flatMap((item) => [
1637
- item.length > 0
1638
- ? item.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
2296
+ resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#or"), _propertyShape.or.toList().flatMap((value) => [
2297
+ value.length > 0
2298
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
1639
2299
  if (itemIndex === 0) {
1640
2300
  currentSubListResource = listResource;
1641
2301
  }
@@ -1668,15 +2328,18 @@ export var PropertyShape;
1668
2328
  ], options?.graph);
1669
2329
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#pattern"), _propertyShape.patterns.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
1670
2330
  resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#resolve"), _propertyShape.resolve.toList(), options?.graph);
2331
+ resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#name"), _propertyShape.shaclmateName
2332
+ .toList()
2333
+ .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
1671
2334
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#uniqueLang"), _propertyShape.uniqueLang
1672
2335
  .toList()
1673
2336
  .flatMap((value) => [
1674
2337
  $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
1675
2338
  ]), options?.graph);
1676
2339
  resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#visibility"), _propertyShape.visibility.toList(), options?.graph);
1677
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#xone"), _propertyShape.xone.flatMap((item) => [
1678
- item.length > 0
1679
- ? item.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
2340
+ resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#xone"), _propertyShape.xone.toList().flatMap((value) => [
2341
+ value.length > 0
2342
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
1680
2343
  if (itemIndex === 0) {
1681
2344
  currentSubListResource = listResource;
1682
2345
  }
@@ -1702,6 +2365,50 @@ export var PropertyShape;
1702
2365
  })(PropertyShape || (PropertyShape = {}));
1703
2366
  export var PropertyGroup;
1704
2367
  (function (PropertyGroup) {
2368
+ function $create(parameters) {
2369
+ let $identifier;
2370
+ if (typeof parameters?.$identifier === "object") {
2371
+ $identifier = parameters?.$identifier;
2372
+ }
2373
+ else if (typeof parameters?.$identifier === "string") {
2374
+ $identifier = dataFactory.namedNode(parameters?.$identifier);
2375
+ }
2376
+ else if (parameters?.$identifier === undefined) {
2377
+ $identifier = dataFactory.blankNode();
2378
+ }
2379
+ else {
2380
+ $identifier = parameters?.$identifier;
2381
+ }
2382
+ const $type = "PropertyGroup";
2383
+ let comment;
2384
+ if (Maybe.isMaybe(parameters?.comment)) {
2385
+ comment = parameters?.comment;
2386
+ }
2387
+ else if (typeof parameters?.comment === "string") {
2388
+ comment = Maybe.of(parameters?.comment);
2389
+ }
2390
+ else if (parameters?.comment === undefined) {
2391
+ comment = Maybe.empty();
2392
+ }
2393
+ else {
2394
+ comment = parameters?.comment;
2395
+ }
2396
+ let label;
2397
+ if (Maybe.isMaybe(parameters?.label)) {
2398
+ label = parameters?.label;
2399
+ }
2400
+ else if (typeof parameters?.label === "string") {
2401
+ label = Maybe.of(parameters?.label);
2402
+ }
2403
+ else if (parameters?.label === undefined) {
2404
+ label = Maybe.empty();
2405
+ }
2406
+ else {
2407
+ label = parameters?.label;
2408
+ }
2409
+ return { $identifier, $type, comment, label };
2410
+ }
2411
+ PropertyGroup.$create = $create;
1705
2412
  let $Identifier;
1706
2413
  (function ($Identifier) {
1707
2414
  $Identifier.fromString = $identifierFromString; // biome-ignore lint/suspicious/noShadowRestrictedNames: allow toString
@@ -1712,12 +2419,12 @@ export var PropertyGroup;
1712
2419
  !$filterIdentifier(filter.$identifier, value.$identifier)) {
1713
2420
  return false;
1714
2421
  }
1715
- if (filter.comments !== undefined &&
1716
- !$filterArray($filterString)(filter.comments, value.comments)) {
2422
+ if (filter.comment !== undefined &&
2423
+ !$filterMaybe($filterString)(filter.comment, value.comment)) {
1717
2424
  return false;
1718
2425
  }
1719
- if (filter.labels !== undefined &&
1720
- !$filterArray($filterString)(filter.labels, value.labels)) {
2426
+ if (filter.label !== undefined &&
2427
+ !$filterMaybe($filterString)(filter.label, value.label)) {
1721
2428
  return false;
1722
2429
  }
1723
2430
  return true;
@@ -1779,32 +2486,396 @@ export var PropertyGroup;
1779
2486
  .chain(($identifier) => Right("PropertyGroup").chain(($type) => $shaclPropertyFromRdf({
1780
2487
  graph: _$options.graph,
1781
2488
  resource: $resource,
1782
- propertySchema: PropertyGroup.$schema.properties.comments,
2489
+ propertySchema: PropertyGroup.$schema.properties.comment,
2490
+ typeFromRdf: (resourceValues) => resourceValues
2491
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2492
+ .chain((values) => values.chainMap((value) => value.toString()))
2493
+ .map((values) => values.length > 0
2494
+ ? values.map((value) => Maybe.of(value))
2495
+ : Resource.Values.fromValue({
2496
+ focusResource: $resource,
2497
+ propertyPath: PropertyShape.$schema.properties.comment.path,
2498
+ value: Maybe.empty(),
2499
+ })),
2500
+ }).chain((comment) => $shaclPropertyFromRdf({
2501
+ graph: _$options.graph,
2502
+ resource: $resource,
2503
+ propertySchema: PropertyGroup.$schema.properties.label,
2504
+ typeFromRdf: (resourceValues) => resourceValues
2505
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2506
+ .chain((values) => values.chainMap((value) => value.toString()))
2507
+ .map((values) => values.length > 0
2508
+ ? values.map((value) => Maybe.of(value))
2509
+ : Resource.Values.fromValue({
2510
+ focusResource: $resource,
2511
+ propertyPath: PropertyShape.$schema.properties.label.path,
2512
+ value: Maybe.empty(),
2513
+ })),
2514
+ }).map((label) => ({ $identifier, $type, comment, label }))))));
2515
+ };
2516
+ PropertyGroup.$schema = {
2517
+ properties: {
2518
+ $identifier: {
2519
+ kind: "Identifier",
2520
+ type: () => ({ kind: "Identifier" }),
2521
+ },
2522
+ $type: {
2523
+ kind: "Discriminant",
2524
+ type: () => ({
2525
+ kind: "TypeDiscriminant",
2526
+ ownValues: ["PropertyGroup"],
2527
+ }),
2528
+ },
2529
+ comment: {
2530
+ kind: "Shacl",
2531
+ type: () => ({
2532
+ kind: "Maybe",
2533
+ item: () => ({ kind: "String" }),
2534
+ }),
2535
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
2536
+ },
2537
+ label: {
2538
+ kind: "Shacl",
2539
+ type: () => ({
2540
+ kind: "Maybe",
2541
+ item: () => ({ kind: "String" }),
2542
+ }),
2543
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
2544
+ },
2545
+ },
2546
+ };
2547
+ function $toRdfResource(_propertyGroup, options) {
2548
+ const resourceSet = options?.resourceSet ??
2549
+ new ResourceSet(datasetFactory.dataset(), { dataFactory: dataFactory });
2550
+ const resource = resourceSet.resource(_propertyGroup.$identifier);
2551
+ if (!options?.ignoreRdfType) {
2552
+ resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup"), options?.graph);
2553
+ }
2554
+ resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), _propertyGroup.comment
2555
+ .toList()
2556
+ .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
2557
+ resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), _propertyGroup.label
2558
+ .toList()
2559
+ .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
2560
+ return resource;
2561
+ }
2562
+ PropertyGroup.$toRdfResource = $toRdfResource;
2563
+ })(PropertyGroup || (PropertyGroup = {}));
2564
+ export var Ontology;
2565
+ (function (Ontology) {
2566
+ function $create(parameters) {
2567
+ let $identifier;
2568
+ if (typeof parameters?.$identifier === "object") {
2569
+ $identifier = parameters?.$identifier;
2570
+ }
2571
+ else if (typeof parameters?.$identifier === "string") {
2572
+ $identifier = dataFactory.namedNode(parameters?.$identifier);
2573
+ }
2574
+ else if (parameters?.$identifier === undefined) {
2575
+ $identifier = dataFactory.blankNode();
2576
+ }
2577
+ else {
2578
+ $identifier = parameters?.$identifier;
2579
+ }
2580
+ const $type = "Ontology";
2581
+ let comment;
2582
+ if (Maybe.isMaybe(parameters?.comment)) {
2583
+ comment = parameters?.comment;
2584
+ }
2585
+ else if (typeof parameters?.comment === "string") {
2586
+ comment = Maybe.of(parameters?.comment);
2587
+ }
2588
+ else if (parameters?.comment === undefined) {
2589
+ comment = Maybe.empty();
2590
+ }
2591
+ else {
2592
+ comment = parameters?.comment;
2593
+ }
2594
+ let label;
2595
+ if (Maybe.isMaybe(parameters?.label)) {
2596
+ label = parameters?.label;
2597
+ }
2598
+ else if (typeof parameters?.label === "string") {
2599
+ label = Maybe.of(parameters?.label);
2600
+ }
2601
+ else if (parameters?.label === undefined) {
2602
+ label = Maybe.empty();
2603
+ }
2604
+ else {
2605
+ label = parameters?.label;
2606
+ }
2607
+ let tsFeatureExcludes;
2608
+ if (parameters?.tsFeatureExcludes === undefined) {
2609
+ tsFeatureExcludes = [];
2610
+ }
2611
+ else if ($isReadonlyObjectArray(parameters?.tsFeatureExcludes)) {
2612
+ tsFeatureExcludes = parameters?.tsFeatureExcludes;
2613
+ }
2614
+ else if ($isReadonlyStringArray(parameters?.tsFeatureExcludes)) {
2615
+ tsFeatureExcludes = parameters?.tsFeatureExcludes.map((item) => dataFactory.namedNode(item));
2616
+ }
2617
+ else {
2618
+ tsFeatureExcludes = parameters?.tsFeatureExcludes;
2619
+ }
2620
+ let tsFeatureIncludes;
2621
+ if (parameters?.tsFeatureIncludes === undefined) {
2622
+ tsFeatureIncludes = [];
2623
+ }
2624
+ else if ($isReadonlyObjectArray(parameters?.tsFeatureIncludes)) {
2625
+ tsFeatureIncludes = parameters?.tsFeatureIncludes;
2626
+ }
2627
+ else if ($isReadonlyStringArray(parameters?.tsFeatureIncludes)) {
2628
+ tsFeatureIncludes = parameters?.tsFeatureIncludes.map((item) => dataFactory.namedNode(item));
2629
+ }
2630
+ else {
2631
+ tsFeatureIncludes = parameters?.tsFeatureIncludes;
2632
+ }
2633
+ let tsImports;
2634
+ if (parameters?.tsImports === undefined) {
2635
+ tsImports = [];
2636
+ }
2637
+ else if (typeof parameters?.tsImports === "object") {
2638
+ tsImports = parameters?.tsImports;
2639
+ }
2640
+ else {
2641
+ tsImports = parameters?.tsImports;
2642
+ }
2643
+ let tsObjectDeclarationType;
2644
+ if (Maybe.isMaybe(parameters?.tsObjectDeclarationType)) {
2645
+ tsObjectDeclarationType = parameters?.tsObjectDeclarationType;
2646
+ }
2647
+ else if (typeof parameters?.tsObjectDeclarationType === "object") {
2648
+ tsObjectDeclarationType = Maybe.of(parameters?.tsObjectDeclarationType);
2649
+ }
2650
+ else if (typeof parameters?.tsObjectDeclarationType === "string") {
2651
+ tsObjectDeclarationType = Maybe.of(dataFactory.namedNode(parameters?.tsObjectDeclarationType));
2652
+ }
2653
+ else if (parameters?.tsObjectDeclarationType === undefined) {
2654
+ tsObjectDeclarationType = Maybe.empty();
2655
+ }
2656
+ else {
2657
+ tsObjectDeclarationType =
2658
+ parameters?.tsObjectDeclarationType;
2659
+ }
2660
+ return {
2661
+ $identifier,
2662
+ $type,
2663
+ comment,
2664
+ label,
2665
+ tsFeatureExcludes,
2666
+ tsFeatureIncludes,
2667
+ tsImports,
2668
+ tsObjectDeclarationType,
2669
+ };
2670
+ }
2671
+ Ontology.$create = $create;
2672
+ let $Identifier;
2673
+ (function ($Identifier) {
2674
+ $Identifier.fromString = $identifierFromString; // biome-ignore lint/suspicious/noShadowRestrictedNames: allow toString
2675
+ $Identifier.toString = Resource.Identifier.toString;
2676
+ })($Identifier = Ontology.$Identifier || (Ontology.$Identifier = {}));
2677
+ function $filter(filter, value) {
2678
+ if (filter.$identifier !== undefined &&
2679
+ !$filterIdentifier(filter.$identifier, value.$identifier)) {
2680
+ return false;
2681
+ }
2682
+ if (filter.comment !== undefined &&
2683
+ !$filterMaybe($filterString)(filter.comment, value.comment)) {
2684
+ return false;
2685
+ }
2686
+ if (filter.label !== undefined &&
2687
+ !$filterMaybe($filterString)(filter.label, value.label)) {
2688
+ return false;
2689
+ }
2690
+ if (filter.tsFeatureExcludes !== undefined &&
2691
+ !$filterArray($filterIri)(filter.tsFeatureExcludes, value.tsFeatureExcludes)) {
2692
+ return false;
2693
+ }
2694
+ if (filter.tsFeatureIncludes !== undefined &&
2695
+ !$filterArray($filterIri)(filter.tsFeatureIncludes, value.tsFeatureIncludes)) {
2696
+ return false;
2697
+ }
2698
+ if (filter.tsImports !== undefined &&
2699
+ !$filterArray($filterString)(filter.tsImports, value.tsImports)) {
2700
+ return false;
2701
+ }
2702
+ if (filter.tsObjectDeclarationType !== undefined &&
2703
+ !$filterMaybe($filterIri)(filter.tsObjectDeclarationType, value.tsObjectDeclarationType)) {
2704
+ return false;
2705
+ }
2706
+ return true;
2707
+ }
2708
+ Ontology.$filter = $filter;
2709
+ Ontology.$fromRdfResource = (resource, options) => {
2710
+ let { context, graph, ignoreRdfType = false, objectSet, preferredLanguages, } = options ?? {};
2711
+ if (!objectSet) {
2712
+ objectSet = new $RdfjsDatasetObjectSet(resource.dataset);
2713
+ }
2714
+ return Ontology.$propertiesFromRdfResource(resource, {
2715
+ context,
2716
+ graph,
2717
+ ignoreRdfType,
2718
+ objectSet,
2719
+ preferredLanguages,
2720
+ });
2721
+ };
2722
+ Ontology.$fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
2723
+ .toResource()
2724
+ .chain((resource) => Ontology.$fromRdfResource(resource, options))));
2725
+ Ontology.$fromRdfType = dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology");
2726
+ function isOntology(object) {
2727
+ switch (object.$type) {
2728
+ case "Ontology":
2729
+ return true;
2730
+ default:
2731
+ return false;
2732
+ }
2733
+ }
2734
+ Ontology.isOntology = isOntology;
2735
+ Ontology.$propertiesFromRdfResource = ($resource, _$options) => {
2736
+ return (!_$options.ignoreRdfType
2737
+ ? $resource
2738
+ .value($RdfVocabularies.rdf.type, { graph: _$options.graph })
2739
+ .chain((actualRdfType) => actualRdfType.toIri())
2740
+ .chain((actualRdfType) => {
2741
+ // Check the expected type and its known subtypes
2742
+ switch (actualRdfType.value) {
2743
+ case "http://www.w3.org/2002/07/owl#Ontology":
2744
+ return Right(true);
2745
+ }
2746
+ // Check arbitrary rdfs:subClassOf's of the expected type
2747
+ if ($resource.isInstanceOf(Ontology.$fromRdfType, {
2748
+ graph: _$options.graph,
2749
+ })) {
2750
+ return Right(true);
2751
+ }
2752
+ return Left(new Error(`${Resource.Identifier.toString($resource.identifier)} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/2002/07/owl#Ontology)`));
2753
+ })
2754
+ : Right(true)).chain((_rdfTypeCheck) => Right(new Resource.Value({
2755
+ dataFactory: dataFactory,
2756
+ focusResource: $resource,
2757
+ propertyPath: $RdfVocabularies.rdf.subject,
2758
+ term: $resource.identifier,
2759
+ }).toValues())
2760
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
2761
+ .chain((values) => values.head())
2762
+ .chain(($identifier) => Right("Ontology").chain(($type) => $shaclPropertyFromRdf({
2763
+ graph: _$options.graph,
2764
+ resource: $resource,
2765
+ propertySchema: Ontology.$schema.properties.comment,
2766
+ typeFromRdf: (resourceValues) => resourceValues
2767
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2768
+ .chain((values) => values.chainMap((value) => value.toString()))
2769
+ .map((values) => values.length > 0
2770
+ ? values.map((value) => Maybe.of(value))
2771
+ : Resource.Values.fromValue({
2772
+ focusResource: $resource,
2773
+ propertyPath: PropertyShape.$schema.properties.comment.path,
2774
+ value: Maybe.empty(),
2775
+ })),
2776
+ }).chain((comment) => $shaclPropertyFromRdf({
2777
+ graph: _$options.graph,
2778
+ resource: $resource,
2779
+ propertySchema: Ontology.$schema.properties.label,
1783
2780
  typeFromRdf: (resourceValues) => resourceValues
1784
2781
  .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1785
2782
  .chain((values) => values.chainMap((value) => value.toString()))
2783
+ .map((values) => values.length > 0
2784
+ ? values.map((value) => Maybe.of(value))
2785
+ : Resource.Values.fromValue({
2786
+ focusResource: $resource,
2787
+ propertyPath: PropertyShape.$schema.properties.label.path,
2788
+ value: Maybe.empty(),
2789
+ })),
2790
+ }).chain((label) => $shaclPropertyFromRdf({
2791
+ graph: _$options.graph,
2792
+ resource: $resource,
2793
+ propertySchema: Ontology.$schema.properties.tsFeatureExcludes,
2794
+ typeFromRdf: (resourceValues) => resourceValues
2795
+ .chain((values) => values.chainMap((value) => value.toIri([
2796
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_All"),
2797
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Create"),
2798
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_Default"),
2799
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Equals"),
2800
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Graphql"),
2801
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Hash"),
2802
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Json"),
2803
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_None"),
2804
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Rdf"),
2805
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Sparql"),
2806
+ ])))
2807
+ .map((values) => values.toArray())
2808
+ .map((valuesArray) => Resource.Values.fromValue({
2809
+ focusResource: $resource,
2810
+ propertyPath: Ontology.$schema.properties.tsFeatureExcludes.path,
2811
+ value: valuesArray,
2812
+ })),
2813
+ }).chain((tsFeatureExcludes) => $shaclPropertyFromRdf({
2814
+ graph: _$options.graph,
2815
+ resource: $resource,
2816
+ propertySchema: Ontology.$schema.properties.tsFeatureIncludes,
2817
+ typeFromRdf: (resourceValues) => resourceValues
2818
+ .chain((values) => values.chainMap((value) => value.toIri([
2819
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_All"),
2820
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Create"),
2821
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_Default"),
2822
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Equals"),
2823
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Graphql"),
2824
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Hash"),
2825
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Json"),
2826
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_None"),
2827
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Rdf"),
2828
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Sparql"),
2829
+ ])))
1786
2830
  .map((values) => values.toArray())
1787
2831
  .map((valuesArray) => Resource.Values.fromValue({
1788
2832
  focusResource: $resource,
1789
- propertyPath: PropertyGroup.$schema.properties.comments.path,
2833
+ propertyPath: Ontology.$schema.properties.tsFeatureIncludes
2834
+ .path,
1790
2835
  value: valuesArray,
1791
2836
  })),
1792
- }).chain((comments) => $shaclPropertyFromRdf({
2837
+ }).chain((tsFeatureIncludes) => $shaclPropertyFromRdf({
1793
2838
  graph: _$options.graph,
1794
2839
  resource: $resource,
1795
- propertySchema: PropertyGroup.$schema.properties.labels,
2840
+ propertySchema: Ontology.$schema.properties.tsImports,
1796
2841
  typeFromRdf: (resourceValues) => resourceValues
1797
2842
  .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1798
2843
  .chain((values) => values.chainMap((value) => value.toString()))
1799
2844
  .map((values) => values.toArray())
1800
2845
  .map((valuesArray) => Resource.Values.fromValue({
1801
2846
  focusResource: $resource,
1802
- propertyPath: PropertyGroup.$schema.properties.labels.path,
2847
+ propertyPath: Ontology.$schema.properties.tsImports.path,
1803
2848
  value: valuesArray,
1804
2849
  })),
1805
- }).map((labels) => ({ $identifier, $type, comments, labels }))))));
2850
+ }).chain((tsImports) => $shaclPropertyFromRdf({
2851
+ graph: _$options.graph,
2852
+ resource: $resource,
2853
+ propertySchema: Ontology.$schema.properties.tsObjectDeclarationType,
2854
+ typeFromRdf: (resourceValues) => resourceValues
2855
+ .chain((values) => values.chainMap((value) => value.toIri([
2856
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Class"),
2857
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Interface"),
2858
+ ])))
2859
+ .map((values) => values.length > 0
2860
+ ? values.map((value) => Maybe.of(value))
2861
+ : Resource.Values.fromValue({
2862
+ focusResource: $resource,
2863
+ propertyPath: Ontology.$schema.properties
2864
+ .tsObjectDeclarationType.path,
2865
+ value: Maybe.empty(),
2866
+ })),
2867
+ }).map((tsObjectDeclarationType) => ({
2868
+ $identifier,
2869
+ $type,
2870
+ comment,
2871
+ label,
2872
+ tsFeatureExcludes,
2873
+ tsFeatureIncludes,
2874
+ tsImports,
2875
+ tsObjectDeclarationType,
2876
+ }))))))))));
1806
2877
  };
1807
- PropertyGroup.$schema = {
2878
+ Ontology.$schema = {
1808
2879
  properties: {
1809
2880
  $identifier: {
1810
2881
  kind: "Identifier",
@@ -1814,334 +2885,850 @@ export var PropertyGroup;
1814
2885
  kind: "Discriminant",
1815
2886
  type: () => ({
1816
2887
  kind: "TypeDiscriminant",
1817
- ownValues: ["PropertyGroup"],
2888
+ ownValues: ["Ontology"],
1818
2889
  }),
1819
2890
  },
1820
- comments: {
2891
+ comment: {
1821
2892
  kind: "Shacl",
1822
2893
  type: () => ({
1823
- kind: "Set",
2894
+ kind: "Maybe",
1824
2895
  item: () => ({ kind: "String" }),
1825
2896
  }),
1826
2897
  path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
1827
2898
  },
1828
- labels: {
2899
+ label: {
1829
2900
  kind: "Shacl",
1830
2901
  type: () => ({
1831
- kind: "Set",
2902
+ kind: "Maybe",
1832
2903
  item: () => ({ kind: "String" }),
1833
2904
  }),
1834
2905
  path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
1835
2906
  },
2907
+ tsFeatureExcludes: {
2908
+ kind: "Shacl",
2909
+ type: () => ({
2910
+ kind: "Set",
2911
+ item: () => ({
2912
+ kind: "Iri",
2913
+ in: [
2914
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_All"),
2915
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Create"),
2916
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_Default"),
2917
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Equals"),
2918
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Graphql"),
2919
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Hash"),
2920
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Json"),
2921
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_None"),
2922
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Rdf"),
2923
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Sparql"),
2924
+ ],
2925
+ }),
2926
+ }),
2927
+ path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureExclude"),
2928
+ },
2929
+ tsFeatureIncludes: {
2930
+ kind: "Shacl",
2931
+ type: () => ({
2932
+ kind: "Set",
2933
+ item: () => ({
2934
+ kind: "Iri",
2935
+ in: [
2936
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_All"),
2937
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Create"),
2938
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_Default"),
2939
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Equals"),
2940
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Graphql"),
2941
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Hash"),
2942
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Json"),
2943
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_None"),
2944
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Rdf"),
2945
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Sparql"),
2946
+ ],
2947
+ }),
2948
+ }),
2949
+ path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureInclude"),
2950
+ },
2951
+ tsImports: {
2952
+ kind: "Shacl",
2953
+ type: () => ({
2954
+ kind: "Set",
2955
+ item: () => ({ kind: "String" }),
2956
+ }),
2957
+ path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsImport"),
2958
+ },
2959
+ tsObjectDeclarationType: {
2960
+ kind: "Shacl",
2961
+ type: () => ({
2962
+ kind: "Maybe",
2963
+ item: () => ({
2964
+ kind: "Iri",
2965
+ in: [
2966
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Class"),
2967
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Interface"),
2968
+ ],
2969
+ }),
2970
+ }),
2971
+ path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsObjectDeclarationType"),
2972
+ },
1836
2973
  },
1837
2974
  };
1838
- function $toRdfResource(_propertyGroup, options) {
2975
+ function $toRdfResource(_ontology, options) {
1839
2976
  const resourceSet = options?.resourceSet ??
1840
2977
  new ResourceSet(datasetFactory.dataset(), { dataFactory: dataFactory });
1841
- const resource = resourceSet.resource(_propertyGroup.$identifier);
2978
+ const resource = resourceSet.resource(_ontology.$identifier);
1842
2979
  if (!options?.ignoreRdfType) {
1843
- resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup"), options?.graph);
2980
+ resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"), options?.graph);
2981
+ }
2982
+ resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), _ontology.comment
2983
+ .toList()
2984
+ .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
2985
+ resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), _ontology.label
2986
+ .toList()
2987
+ .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
2988
+ resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureExclude"), _ontology.tsFeatureExcludes.flatMap((item) => [item]), options?.graph);
2989
+ resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureInclude"), _ontology.tsFeatureIncludes.flatMap((item) => [item]), options?.graph);
2990
+ resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsImport"), _ontology.tsImports.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
2991
+ resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsObjectDeclarationType"), _ontology.tsObjectDeclarationType.toList(), options?.graph);
2992
+ return resource;
2993
+ }
2994
+ Ontology.$toRdfResource = $toRdfResource;
2995
+ })(Ontology || (Ontology = {}));
2996
+ export var NodeShape;
2997
+ (function (NodeShape) {
2998
+ function $create(parameters) {
2999
+ let $identifier;
3000
+ if (typeof parameters?.$identifier === "object") {
3001
+ $identifier = parameters?.$identifier;
3002
+ }
3003
+ else if (typeof parameters?.$identifier === "string") {
3004
+ $identifier = dataFactory.namedNode(parameters?.$identifier);
3005
+ }
3006
+ else if (parameters?.$identifier === undefined) {
3007
+ $identifier = dataFactory.blankNode();
3008
+ }
3009
+ else {
3010
+ $identifier = parameters?.$identifier;
3011
+ }
3012
+ const $type = "NodeShape";
3013
+ let abstract;
3014
+ if (Maybe.isMaybe(parameters?.abstract)) {
3015
+ abstract = parameters?.abstract;
3016
+ }
3017
+ else if (typeof parameters?.abstract === "boolean") {
3018
+ abstract = Maybe.of(parameters?.abstract);
3019
+ }
3020
+ else if (parameters?.abstract === undefined) {
3021
+ abstract = Maybe.empty();
3022
+ }
3023
+ else {
3024
+ abstract = parameters?.abstract;
3025
+ }
3026
+ let and;
3027
+ if (Maybe.isMaybe(parameters?.and)) {
3028
+ and = parameters?.and;
3029
+ }
3030
+ else if ($isReadonlyObjectArray(parameters?.and)) {
3031
+ and = Maybe.of(parameters?.and);
3032
+ }
3033
+ else if ($isReadonlyStringArray(parameters?.and)) {
3034
+ and = Maybe.of(parameters?.and.map((item) => dataFactory.namedNode(item)));
3035
+ }
3036
+ else if (parameters?.and === undefined) {
3037
+ and = Maybe.empty();
3038
+ }
3039
+ else {
3040
+ and = parameters?.and;
3041
+ }
3042
+ let classes;
3043
+ if (parameters?.classes === undefined) {
3044
+ classes = [];
3045
+ }
3046
+ else if ($isReadonlyObjectArray(parameters?.classes)) {
3047
+ classes = parameters?.classes;
3048
+ }
3049
+ else if ($isReadonlyStringArray(parameters?.classes)) {
3050
+ classes = parameters?.classes.map((item) => dataFactory.namedNode(item));
3051
+ }
3052
+ else {
3053
+ classes = parameters?.classes;
3054
+ }
3055
+ let closed;
3056
+ if (Maybe.isMaybe(parameters?.closed)) {
3057
+ closed = parameters?.closed;
3058
+ }
3059
+ else if (typeof parameters?.closed === "boolean") {
3060
+ closed = Maybe.of(parameters?.closed);
3061
+ }
3062
+ else if (parameters?.closed === undefined) {
3063
+ closed = Maybe.empty();
3064
+ }
3065
+ else {
3066
+ closed = parameters?.closed;
3067
+ }
3068
+ let comment;
3069
+ if (Maybe.isMaybe(parameters?.comment)) {
3070
+ comment = parameters?.comment;
3071
+ }
3072
+ else if (typeof parameters?.comment === "string") {
3073
+ comment = Maybe.of(parameters?.comment);
3074
+ }
3075
+ else if (parameters?.comment === undefined) {
3076
+ comment = Maybe.empty();
3077
+ }
3078
+ else {
3079
+ comment = parameters?.comment;
3080
+ }
3081
+ let datatype;
3082
+ if (Maybe.isMaybe(parameters?.datatype)) {
3083
+ datatype = parameters?.datatype;
3084
+ }
3085
+ else if (typeof parameters?.datatype === "object") {
3086
+ datatype = Maybe.of(parameters?.datatype);
3087
+ }
3088
+ else if (typeof parameters?.datatype === "string") {
3089
+ datatype = Maybe.of(dataFactory.namedNode(parameters?.datatype));
3090
+ }
3091
+ else if (parameters?.datatype === undefined) {
3092
+ datatype = Maybe.empty();
3093
+ }
3094
+ else {
3095
+ datatype = parameters?.datatype;
3096
+ }
3097
+ let deactivated;
3098
+ if (Maybe.isMaybe(parameters?.deactivated)) {
3099
+ deactivated = parameters?.deactivated;
3100
+ }
3101
+ else if (typeof parameters?.deactivated === "boolean") {
3102
+ deactivated = Maybe.of(parameters?.deactivated);
3103
+ }
3104
+ else if (parameters?.deactivated === undefined) {
3105
+ deactivated = Maybe.empty();
3106
+ }
3107
+ else {
3108
+ deactivated = parameters?.deactivated;
3109
+ }
3110
+ let discriminantValue;
3111
+ if (Maybe.isMaybe(parameters?.discriminantValue)) {
3112
+ discriminantValue = parameters?.discriminantValue;
3113
+ }
3114
+ else if (typeof parameters?.discriminantValue === "string") {
3115
+ discriminantValue = Maybe.of(parameters?.discriminantValue);
3116
+ }
3117
+ else if (parameters?.discriminantValue === undefined) {
3118
+ discriminantValue = Maybe.empty();
3119
+ }
3120
+ else {
3121
+ discriminantValue = parameters?.discriminantValue;
3122
+ }
3123
+ let extern;
3124
+ if (Maybe.isMaybe(parameters?.extern)) {
3125
+ extern = parameters?.extern;
3126
+ }
3127
+ else if (typeof parameters?.extern === "boolean") {
3128
+ extern = Maybe.of(parameters?.extern);
3129
+ }
3130
+ else if (parameters?.extern === undefined) {
3131
+ extern = Maybe.empty();
3132
+ }
3133
+ else {
3134
+ extern = parameters?.extern;
3135
+ }
3136
+ let flags;
3137
+ if (parameters?.flags === undefined) {
3138
+ flags = [];
3139
+ }
3140
+ else if (typeof parameters?.flags === "object") {
3141
+ flags = parameters?.flags;
3142
+ }
3143
+ else {
3144
+ flags = parameters?.flags;
3145
+ }
3146
+ let fromRdfType;
3147
+ if (Maybe.isMaybe(parameters?.fromRdfType)) {
3148
+ fromRdfType = parameters?.fromRdfType;
3149
+ }
3150
+ else if (typeof parameters?.fromRdfType === "object") {
3151
+ fromRdfType = Maybe.of(parameters?.fromRdfType);
3152
+ }
3153
+ else if (typeof parameters?.fromRdfType === "string") {
3154
+ fromRdfType = Maybe.of(dataFactory.namedNode(parameters?.fromRdfType));
3155
+ }
3156
+ else if (parameters?.fromRdfType === undefined) {
3157
+ fromRdfType = Maybe.empty();
3158
+ }
3159
+ else {
3160
+ fromRdfType = parameters?.fromRdfType;
3161
+ }
3162
+ let hasValues;
3163
+ if (parameters?.hasValues === undefined) {
3164
+ hasValues = [];
3165
+ }
3166
+ else if ($isReadonlyObjectArray(parameters?.hasValues)) {
3167
+ hasValues = parameters?.hasValues;
3168
+ }
3169
+ else if ($isReadonlyBigIntArray(parameters?.hasValues)) {
3170
+ hasValues = parameters?.hasValues.map((item) => $literalFactory.bigint(item));
3171
+ }
3172
+ else if ($isReadonlyBooleanArray(parameters?.hasValues)) {
3173
+ hasValues = parameters?.hasValues.map((item) => $literalFactory.boolean(item));
3174
+ }
3175
+ else if ($isReadonlyNumberArray(parameters?.hasValues)) {
3176
+ hasValues = parameters?.hasValues.map((item) => $literalFactory.number(item));
3177
+ }
3178
+ else if ($isReadonlyStringArray(parameters?.hasValues)) {
3179
+ hasValues = parameters?.hasValues.map((item) => $literalFactory.string(item));
3180
+ }
3181
+ else {
3182
+ hasValues = parameters?.hasValues;
3183
+ }
3184
+ let identifierMintingStrategy;
3185
+ if (Maybe.isMaybe(parameters?.identifierMintingStrategy)) {
3186
+ identifierMintingStrategy = parameters?.identifierMintingStrategy;
3187
+ }
3188
+ else if (typeof parameters?.identifierMintingStrategy === "object") {
3189
+ identifierMintingStrategy = Maybe.of(parameters?.identifierMintingStrategy);
3190
+ }
3191
+ else if (typeof parameters?.identifierMintingStrategy === "string") {
3192
+ identifierMintingStrategy = Maybe.of(dataFactory.namedNode(parameters?.identifierMintingStrategy));
3193
+ }
3194
+ else if (parameters?.identifierMintingStrategy === undefined) {
3195
+ identifierMintingStrategy = Maybe.empty();
3196
+ }
3197
+ else {
3198
+ identifierMintingStrategy =
3199
+ parameters?.identifierMintingStrategy;
3200
+ }
3201
+ let ignoredProperties;
3202
+ if (Maybe.isMaybe(parameters?.ignoredProperties)) {
3203
+ ignoredProperties = parameters?.ignoredProperties;
3204
+ }
3205
+ else if ($isReadonlyObjectArray(parameters?.ignoredProperties)) {
3206
+ ignoredProperties = Maybe.of(parameters?.ignoredProperties);
3207
+ }
3208
+ else if ($isReadonlyStringArray(parameters?.ignoredProperties)) {
3209
+ ignoredProperties = Maybe.of(parameters?.ignoredProperties.map((item) => dataFactory.namedNode(item)));
3210
+ }
3211
+ else if (parameters?.ignoredProperties === undefined) {
3212
+ ignoredProperties = Maybe.empty();
3213
+ }
3214
+ else {
3215
+ ignoredProperties = parameters?.ignoredProperties;
3216
+ }
3217
+ let in_;
3218
+ if (Maybe.isMaybe(parameters?.in_)) {
3219
+ in_ = parameters?.in_;
3220
+ }
3221
+ else if ($isReadonlyObjectArray(parameters?.in_)) {
3222
+ in_ = Maybe.of(parameters?.in_);
3223
+ }
3224
+ else if ($isReadonlyBigIntArray(parameters?.in_)) {
3225
+ in_ = Maybe.of(parameters?.in_.map((item) => $literalFactory.bigint(item)));
3226
+ }
3227
+ else if ($isReadonlyBooleanArray(parameters?.in_)) {
3228
+ in_ = Maybe.of(parameters?.in_.map((item) => $literalFactory.boolean(item)));
1844
3229
  }
1845
- resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), _propertyGroup.comments.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
1846
- resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), _propertyGroup.labels.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
1847
- return resource;
1848
- }
1849
- PropertyGroup.$toRdfResource = $toRdfResource;
1850
- })(PropertyGroup || (PropertyGroup = {}));
1851
- export var Ontology;
1852
- (function (Ontology) {
1853
- let $Identifier;
1854
- (function ($Identifier) {
1855
- $Identifier.fromString = $identifierFromString; // biome-ignore lint/suspicious/noShadowRestrictedNames: allow toString
1856
- $Identifier.toString = Resource.Identifier.toString;
1857
- })($Identifier = Ontology.$Identifier || (Ontology.$Identifier = {}));
1858
- function $filter(filter, value) {
1859
- if (filter.$identifier !== undefined &&
1860
- !$filterIdentifier(filter.$identifier, value.$identifier)) {
1861
- return false;
3230
+ else if ($isReadonlyNumberArray(parameters?.in_)) {
3231
+ in_ = Maybe.of(parameters?.in_.map((item) => $literalFactory.number(item)));
1862
3232
  }
1863
- if (filter.labels !== undefined &&
1864
- !$filterArray($filterString)(filter.labels, value.labels)) {
1865
- return false;
3233
+ else if ($isReadonlyStringArray(parameters?.in_)) {
3234
+ in_ = Maybe.of(parameters?.in_.map((item) => $literalFactory.string(item)));
1866
3235
  }
1867
- if (filter.tsFeatureExcludes !== undefined &&
1868
- !$filterArray($filterIri)(filter.tsFeatureExcludes, value.tsFeatureExcludes)) {
1869
- return false;
3236
+ else if (parameters?.in_ === undefined) {
3237
+ in_ = Maybe.empty();
1870
3238
  }
1871
- if (filter.tsFeatureIncludes !== undefined &&
1872
- !$filterArray($filterIri)(filter.tsFeatureIncludes, value.tsFeatureIncludes)) {
1873
- return false;
3239
+ else {
3240
+ in_ = parameters?.in_;
1874
3241
  }
1875
- if (filter.tsImports !== undefined &&
1876
- !$filterArray($filterString)(filter.tsImports, value.tsImports)) {
1877
- return false;
3242
+ let isDefinedBy;
3243
+ if (Maybe.isMaybe(parameters?.isDefinedBy)) {
3244
+ isDefinedBy = parameters?.isDefinedBy;
1878
3245
  }
1879
- if (filter.tsObjectDeclarationType !== undefined &&
1880
- !$filterMaybe($filterIri)(filter.tsObjectDeclarationType, value.tsObjectDeclarationType)) {
1881
- return false;
3246
+ else if (typeof parameters?.isDefinedBy === "object") {
3247
+ isDefinedBy = Maybe.of(parameters?.isDefinedBy);
1882
3248
  }
1883
- return true;
1884
- }
1885
- Ontology.$filter = $filter;
1886
- Ontology.$fromRdfResource = (resource, options) => {
1887
- let { context, graph, ignoreRdfType = false, objectSet, preferredLanguages, } = options ?? {};
1888
- if (!objectSet) {
1889
- objectSet = new $RdfjsDatasetObjectSet(resource.dataset);
3249
+ else if (typeof parameters?.isDefinedBy === "string") {
3250
+ isDefinedBy = Maybe.of(dataFactory.namedNode(parameters?.isDefinedBy));
1890
3251
  }
1891
- return Ontology.$propertiesFromRdfResource(resource, {
1892
- context,
1893
- graph,
1894
- ignoreRdfType,
1895
- objectSet,
1896
- preferredLanguages,
1897
- });
1898
- };
1899
- Ontology.$fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
1900
- .toResource()
1901
- .chain((resource) => Ontology.$fromRdfResource(resource, options))));
1902
- Ontology.$fromRdfType = dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology");
1903
- function isOntology(object) {
1904
- switch (object.$type) {
1905
- case "Ontology":
1906
- return true;
1907
- default:
1908
- return false;
3252
+ else if (parameters?.isDefinedBy === undefined) {
3253
+ isDefinedBy = Maybe.empty();
1909
3254
  }
1910
- }
1911
- Ontology.isOntology = isOntology;
1912
- Ontology.$propertiesFromRdfResource = ($resource, _$options) => {
1913
- return (!_$options.ignoreRdfType
1914
- ? $resource
1915
- .value($RdfVocabularies.rdf.type, { graph: _$options.graph })
1916
- .chain((actualRdfType) => actualRdfType.toIri())
1917
- .chain((actualRdfType) => {
1918
- // Check the expected type and its known subtypes
1919
- switch (actualRdfType.value) {
1920
- case "http://www.w3.org/2002/07/owl#Ontology":
1921
- return Right(true);
1922
- }
1923
- // Check arbitrary rdfs:subClassOf's of the expected type
1924
- if ($resource.isInstanceOf(Ontology.$fromRdfType, {
1925
- graph: _$options.graph,
1926
- })) {
1927
- return Right(true);
1928
- }
1929
- return Left(new Error(`${Resource.Identifier.toString($resource.identifier)} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/2002/07/owl#Ontology)`));
1930
- })
1931
- : Right(true)).chain((_rdfTypeCheck) => Right(new Resource.Value({
1932
- dataFactory: dataFactory,
1933
- focusResource: $resource,
1934
- propertyPath: $RdfVocabularies.rdf.subject,
1935
- term: $resource.identifier,
1936
- }).toValues())
1937
- .chain((values) => values.chainMap((value) => value.toIdentifier()))
1938
- .chain((values) => values.head())
1939
- .chain(($identifier) => Right("Ontology").chain(($type) => $shaclPropertyFromRdf({
1940
- graph: _$options.graph,
1941
- resource: $resource,
1942
- propertySchema: Ontology.$schema.properties.labels,
1943
- typeFromRdf: (resourceValues) => resourceValues
1944
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1945
- .chain((values) => values.chainMap((value) => value.toString()))
1946
- .map((values) => values.toArray())
1947
- .map((valuesArray) => Resource.Values.fromValue({
1948
- focusResource: $resource,
1949
- propertyPath: Ontology.$schema.properties.labels.path,
1950
- value: valuesArray,
1951
- })),
1952
- }).chain((labels) => $shaclPropertyFromRdf({
1953
- graph: _$options.graph,
1954
- resource: $resource,
1955
- propertySchema: Ontology.$schema.properties.tsFeatureExcludes,
1956
- typeFromRdf: (resourceValues) => resourceValues
1957
- .chain((values) => values.chainMap((value) => value.toIri([
1958
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_All"),
1959
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Create"),
1960
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_Default"),
1961
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Equals"),
1962
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Graphql"),
1963
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Hash"),
1964
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Json"),
1965
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_None"),
1966
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Rdf"),
1967
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Sparql"),
1968
- ])))
1969
- .map((values) => values.toArray())
1970
- .map((valuesArray) => Resource.Values.fromValue({
1971
- focusResource: $resource,
1972
- propertyPath: Ontology.$schema.properties.tsFeatureExcludes.path,
1973
- value: valuesArray,
1974
- })),
1975
- }).chain((tsFeatureExcludes) => $shaclPropertyFromRdf({
1976
- graph: _$options.graph,
1977
- resource: $resource,
1978
- propertySchema: Ontology.$schema.properties.tsFeatureIncludes,
1979
- typeFromRdf: (resourceValues) => resourceValues
1980
- .chain((values) => values.chainMap((value) => value.toIri([
1981
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_All"),
1982
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Create"),
1983
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_Default"),
1984
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Equals"),
1985
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Graphql"),
1986
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Hash"),
1987
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Json"),
1988
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_None"),
1989
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Rdf"),
1990
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Sparql"),
1991
- ])))
1992
- .map((values) => values.toArray())
1993
- .map((valuesArray) => Resource.Values.fromValue({
1994
- focusResource: $resource,
1995
- propertyPath: Ontology.$schema.properties.tsFeatureIncludes.path,
1996
- value: valuesArray,
1997
- })),
1998
- }).chain((tsFeatureIncludes) => $shaclPropertyFromRdf({
1999
- graph: _$options.graph,
2000
- resource: $resource,
2001
- propertySchema: Ontology.$schema.properties.tsImports,
2002
- typeFromRdf: (resourceValues) => resourceValues
2003
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2004
- .chain((values) => values.chainMap((value) => value.toString()))
2005
- .map((values) => values.toArray())
2006
- .map((valuesArray) => Resource.Values.fromValue({
2007
- focusResource: $resource,
2008
- propertyPath: Ontology.$schema.properties.tsImports.path,
2009
- value: valuesArray,
2010
- })),
2011
- }).chain((tsImports) => $shaclPropertyFromRdf({
2012
- graph: _$options.graph,
2013
- resource: $resource,
2014
- propertySchema: Ontology.$schema.properties.tsObjectDeclarationType,
2015
- typeFromRdf: (resourceValues) => resourceValues
2016
- .chain((values) => values.chainMap((value) => value.toIri([
2017
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Class"),
2018
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Interface"),
2019
- ])))
2020
- .map((values) => values.length > 0
2021
- ? values.map((value) => Maybe.of(value))
2022
- : Resource.Values.fromValue({
2023
- focusResource: $resource,
2024
- propertyPath: Ontology.$schema.properties
2025
- .tsObjectDeclarationType.path,
2026
- value: Maybe.empty(),
2027
- })),
2028
- }).map((tsObjectDeclarationType) => ({
3255
+ else {
3256
+ isDefinedBy = parameters?.isDefinedBy;
3257
+ }
3258
+ let label;
3259
+ if (Maybe.isMaybe(parameters?.label)) {
3260
+ label = parameters?.label;
3261
+ }
3262
+ else if (typeof parameters?.label === "string") {
3263
+ label = Maybe.of(parameters?.label);
3264
+ }
3265
+ else if (parameters?.label === undefined) {
3266
+ label = Maybe.empty();
3267
+ }
3268
+ else {
3269
+ label = parameters?.label;
3270
+ }
3271
+ let languageIn;
3272
+ if (Maybe.isMaybe(parameters?.languageIn)) {
3273
+ languageIn = parameters?.languageIn;
3274
+ }
3275
+ else if (typeof parameters?.languageIn === "object") {
3276
+ languageIn = Maybe.of(parameters?.languageIn);
3277
+ }
3278
+ else if (parameters?.languageIn === undefined) {
3279
+ languageIn = Maybe.empty();
3280
+ }
3281
+ else {
3282
+ languageIn = parameters?.languageIn;
3283
+ }
3284
+ let maxCount;
3285
+ if (Maybe.isMaybe(parameters?.maxCount)) {
3286
+ maxCount = parameters?.maxCount;
3287
+ }
3288
+ else if (typeof parameters?.maxCount === "number") {
3289
+ maxCount = Maybe.of(parameters?.maxCount);
3290
+ }
3291
+ else if (parameters?.maxCount === undefined) {
3292
+ maxCount = Maybe.empty();
3293
+ }
3294
+ else {
3295
+ maxCount = parameters?.maxCount;
3296
+ }
3297
+ let maxExclusive;
3298
+ if (Maybe.isMaybe(parameters?.maxExclusive)) {
3299
+ maxExclusive = parameters?.maxExclusive;
3300
+ }
3301
+ else if (typeof parameters?.maxExclusive === "bigint") {
3302
+ maxExclusive = Maybe.of($literalFactory.bigint(parameters?.maxExclusive));
3303
+ }
3304
+ else if (typeof parameters?.maxExclusive === "boolean") {
3305
+ maxExclusive = Maybe.of($literalFactory.boolean(parameters?.maxExclusive));
3306
+ }
3307
+ else if (typeof parameters?.maxExclusive === "object" &&
3308
+ parameters?.maxExclusive instanceof Date) {
3309
+ maxExclusive = Maybe.of($literalFactory.date(parameters?.maxExclusive));
3310
+ }
3311
+ else if (typeof parameters?.maxExclusive === "number") {
3312
+ maxExclusive = Maybe.of($literalFactory.number(parameters?.maxExclusive));
3313
+ }
3314
+ else if (typeof parameters?.maxExclusive === "string") {
3315
+ maxExclusive = Maybe.of($literalFactory.string(parameters?.maxExclusive));
3316
+ }
3317
+ else if (typeof parameters?.maxExclusive === "object") {
3318
+ maxExclusive = Maybe.of(parameters?.maxExclusive);
3319
+ }
3320
+ else if (parameters?.maxExclusive === undefined) {
3321
+ maxExclusive = Maybe.empty();
3322
+ }
3323
+ else {
3324
+ maxExclusive = parameters?.maxExclusive;
3325
+ }
3326
+ let maxInclusive;
3327
+ if (Maybe.isMaybe(parameters?.maxInclusive)) {
3328
+ maxInclusive = parameters?.maxInclusive;
3329
+ }
3330
+ else if (typeof parameters?.maxInclusive === "bigint") {
3331
+ maxInclusive = Maybe.of($literalFactory.bigint(parameters?.maxInclusive));
3332
+ }
3333
+ else if (typeof parameters?.maxInclusive === "boolean") {
3334
+ maxInclusive = Maybe.of($literalFactory.boolean(parameters?.maxInclusive));
3335
+ }
3336
+ else if (typeof parameters?.maxInclusive === "object" &&
3337
+ parameters?.maxInclusive instanceof Date) {
3338
+ maxInclusive = Maybe.of($literalFactory.date(parameters?.maxInclusive));
3339
+ }
3340
+ else if (typeof parameters?.maxInclusive === "number") {
3341
+ maxInclusive = Maybe.of($literalFactory.number(parameters?.maxInclusive));
3342
+ }
3343
+ else if (typeof parameters?.maxInclusive === "string") {
3344
+ maxInclusive = Maybe.of($literalFactory.string(parameters?.maxInclusive));
3345
+ }
3346
+ else if (typeof parameters?.maxInclusive === "object") {
3347
+ maxInclusive = Maybe.of(parameters?.maxInclusive);
3348
+ }
3349
+ else if (parameters?.maxInclusive === undefined) {
3350
+ maxInclusive = Maybe.empty();
3351
+ }
3352
+ else {
3353
+ maxInclusive = parameters?.maxInclusive;
3354
+ }
3355
+ let maxLength;
3356
+ if (Maybe.isMaybe(parameters?.maxLength)) {
3357
+ maxLength = parameters?.maxLength;
3358
+ }
3359
+ else if (typeof parameters?.maxLength === "number") {
3360
+ maxLength = Maybe.of(parameters?.maxLength);
3361
+ }
3362
+ else if (parameters?.maxLength === undefined) {
3363
+ maxLength = Maybe.empty();
3364
+ }
3365
+ else {
3366
+ maxLength = parameters?.maxLength;
3367
+ }
3368
+ let minCount;
3369
+ if (Maybe.isMaybe(parameters?.minCount)) {
3370
+ minCount = parameters?.minCount;
3371
+ }
3372
+ else if (typeof parameters?.minCount === "number") {
3373
+ minCount = Maybe.of(parameters?.minCount);
3374
+ }
3375
+ else if (parameters?.minCount === undefined) {
3376
+ minCount = Maybe.empty();
3377
+ }
3378
+ else {
3379
+ minCount = parameters?.minCount;
3380
+ }
3381
+ let minExclusive;
3382
+ if (Maybe.isMaybe(parameters?.minExclusive)) {
3383
+ minExclusive = parameters?.minExclusive;
3384
+ }
3385
+ else if (typeof parameters?.minExclusive === "bigint") {
3386
+ minExclusive = Maybe.of($literalFactory.bigint(parameters?.minExclusive));
3387
+ }
3388
+ else if (typeof parameters?.minExclusive === "boolean") {
3389
+ minExclusive = Maybe.of($literalFactory.boolean(parameters?.minExclusive));
3390
+ }
3391
+ else if (typeof parameters?.minExclusive === "object" &&
3392
+ parameters?.minExclusive instanceof Date) {
3393
+ minExclusive = Maybe.of($literalFactory.date(parameters?.minExclusive));
3394
+ }
3395
+ else if (typeof parameters?.minExclusive === "number") {
3396
+ minExclusive = Maybe.of($literalFactory.number(parameters?.minExclusive));
3397
+ }
3398
+ else if (typeof parameters?.minExclusive === "string") {
3399
+ minExclusive = Maybe.of($literalFactory.string(parameters?.minExclusive));
3400
+ }
3401
+ else if (typeof parameters?.minExclusive === "object") {
3402
+ minExclusive = Maybe.of(parameters?.minExclusive);
3403
+ }
3404
+ else if (parameters?.minExclusive === undefined) {
3405
+ minExclusive = Maybe.empty();
3406
+ }
3407
+ else {
3408
+ minExclusive = parameters?.minExclusive;
3409
+ }
3410
+ let minInclusive;
3411
+ if (Maybe.isMaybe(parameters?.minInclusive)) {
3412
+ minInclusive = parameters?.minInclusive;
3413
+ }
3414
+ else if (typeof parameters?.minInclusive === "bigint") {
3415
+ minInclusive = Maybe.of($literalFactory.bigint(parameters?.minInclusive));
3416
+ }
3417
+ else if (typeof parameters?.minInclusive === "boolean") {
3418
+ minInclusive = Maybe.of($literalFactory.boolean(parameters?.minInclusive));
3419
+ }
3420
+ else if (typeof parameters?.minInclusive === "object" &&
3421
+ parameters?.minInclusive instanceof Date) {
3422
+ minInclusive = Maybe.of($literalFactory.date(parameters?.minInclusive));
3423
+ }
3424
+ else if (typeof parameters?.minInclusive === "number") {
3425
+ minInclusive = Maybe.of($literalFactory.number(parameters?.minInclusive));
3426
+ }
3427
+ else if (typeof parameters?.minInclusive === "string") {
3428
+ minInclusive = Maybe.of($literalFactory.string(parameters?.minInclusive));
3429
+ }
3430
+ else if (typeof parameters?.minInclusive === "object") {
3431
+ minInclusive = Maybe.of(parameters?.minInclusive);
3432
+ }
3433
+ else if (parameters?.minInclusive === undefined) {
3434
+ minInclusive = Maybe.empty();
3435
+ }
3436
+ else {
3437
+ minInclusive = parameters?.minInclusive;
3438
+ }
3439
+ let minLength;
3440
+ if (Maybe.isMaybe(parameters?.minLength)) {
3441
+ minLength = parameters?.minLength;
3442
+ }
3443
+ else if (typeof parameters?.minLength === "number") {
3444
+ minLength = Maybe.of(parameters?.minLength);
3445
+ }
3446
+ else if (parameters?.minLength === undefined) {
3447
+ minLength = Maybe.empty();
3448
+ }
3449
+ else {
3450
+ minLength = parameters?.minLength;
3451
+ }
3452
+ let mutable;
3453
+ if (Maybe.isMaybe(parameters?.mutable)) {
3454
+ mutable = parameters?.mutable;
3455
+ }
3456
+ else if (typeof parameters?.mutable === "boolean") {
3457
+ mutable = Maybe.of(parameters?.mutable);
3458
+ }
3459
+ else if (parameters?.mutable === undefined) {
3460
+ mutable = Maybe.empty();
3461
+ }
3462
+ else {
3463
+ mutable = parameters?.mutable;
3464
+ }
3465
+ let nodeKind;
3466
+ if (Maybe.isMaybe(parameters?.nodeKind)) {
3467
+ nodeKind = parameters?.nodeKind;
3468
+ }
3469
+ else if (typeof parameters?.nodeKind === "object") {
3470
+ nodeKind = Maybe.of(parameters?.nodeKind);
3471
+ }
3472
+ else if (typeof parameters?.nodeKind === "string") {
3473
+ nodeKind = Maybe.of(dataFactory.namedNode(parameters?.nodeKind));
3474
+ }
3475
+ else if (parameters?.nodeKind === undefined) {
3476
+ nodeKind = Maybe.empty();
3477
+ }
3478
+ else {
3479
+ nodeKind = parameters?.nodeKind;
3480
+ }
3481
+ let nodes;
3482
+ if (parameters?.nodes === undefined) {
3483
+ nodes = [];
3484
+ }
3485
+ else if ($isReadonlyObjectArray(parameters?.nodes)) {
3486
+ nodes = parameters?.nodes;
3487
+ }
3488
+ else if ($isReadonlyStringArray(parameters?.nodes)) {
3489
+ nodes = parameters?.nodes.map((item) => dataFactory.namedNode(item));
3490
+ }
3491
+ else {
3492
+ nodes = parameters?.nodes;
3493
+ }
3494
+ let not;
3495
+ if (parameters?.not === undefined) {
3496
+ not = [];
3497
+ }
3498
+ else if ($isReadonlyObjectArray(parameters?.not)) {
3499
+ not = parameters?.not;
3500
+ }
3501
+ else if ($isReadonlyStringArray(parameters?.not)) {
3502
+ not = parameters?.not.map((item) => dataFactory.namedNode(item));
3503
+ }
3504
+ else {
3505
+ not = parameters?.not;
3506
+ }
3507
+ let or;
3508
+ if (Maybe.isMaybe(parameters?.or)) {
3509
+ or = parameters?.or;
3510
+ }
3511
+ else if ($isReadonlyObjectArray(parameters?.or)) {
3512
+ or = Maybe.of(parameters?.or);
3513
+ }
3514
+ else if ($isReadonlyStringArray(parameters?.or)) {
3515
+ or = Maybe.of(parameters?.or.map((item) => dataFactory.namedNode(item)));
3516
+ }
3517
+ else if (parameters?.or === undefined) {
3518
+ or = Maybe.empty();
3519
+ }
3520
+ else {
3521
+ or = parameters?.or;
3522
+ }
3523
+ let patterns;
3524
+ if (parameters?.patterns === undefined) {
3525
+ patterns = [];
3526
+ }
3527
+ else if (typeof parameters?.patterns === "object") {
3528
+ patterns = parameters?.patterns;
3529
+ }
3530
+ else {
3531
+ patterns = parameters?.patterns;
3532
+ }
3533
+ let properties;
3534
+ if (parameters?.properties === undefined) {
3535
+ properties = [];
3536
+ }
3537
+ else if ($isReadonlyObjectArray(parameters?.properties)) {
3538
+ properties = parameters?.properties;
3539
+ }
3540
+ else if ($isReadonlyStringArray(parameters?.properties)) {
3541
+ properties = parameters?.properties.map((item) => dataFactory.namedNode(item));
3542
+ }
3543
+ else {
3544
+ properties = parameters?.properties;
3545
+ }
3546
+ let rdfType;
3547
+ if (Maybe.isMaybe(parameters?.rdfType)) {
3548
+ rdfType = parameters?.rdfType;
3549
+ }
3550
+ else if (typeof parameters?.rdfType === "object") {
3551
+ rdfType = Maybe.of(parameters?.rdfType);
3552
+ }
3553
+ else if (typeof parameters?.rdfType === "string") {
3554
+ rdfType = Maybe.of(dataFactory.namedNode(parameters?.rdfType));
3555
+ }
3556
+ else if (parameters?.rdfType === undefined) {
3557
+ rdfType = Maybe.empty();
3558
+ }
3559
+ else {
3560
+ rdfType = parameters?.rdfType;
3561
+ }
3562
+ let shaclmateName;
3563
+ if (Maybe.isMaybe(parameters?.shaclmateName)) {
3564
+ shaclmateName = parameters?.shaclmateName;
3565
+ }
3566
+ else if (typeof parameters?.shaclmateName === "string") {
3567
+ shaclmateName = Maybe.of(parameters?.shaclmateName);
3568
+ }
3569
+ else if (parameters?.shaclmateName === undefined) {
3570
+ shaclmateName = Maybe.empty();
3571
+ }
3572
+ else {
3573
+ shaclmateName = parameters?.shaclmateName;
3574
+ }
3575
+ let subClassOf;
3576
+ if (parameters?.subClassOf === undefined) {
3577
+ subClassOf = [];
3578
+ }
3579
+ else if ($isReadonlyObjectArray(parameters?.subClassOf)) {
3580
+ subClassOf = parameters?.subClassOf;
3581
+ }
3582
+ else if ($isReadonlyStringArray(parameters?.subClassOf)) {
3583
+ subClassOf = parameters?.subClassOf.map((item) => dataFactory.namedNode(item));
3584
+ }
3585
+ else {
3586
+ subClassOf = parameters?.subClassOf;
3587
+ }
3588
+ let toRdfTypes;
3589
+ if (parameters?.toRdfTypes === undefined) {
3590
+ toRdfTypes = [];
3591
+ }
3592
+ else if ($isReadonlyObjectArray(parameters?.toRdfTypes)) {
3593
+ toRdfTypes = parameters?.toRdfTypes;
3594
+ }
3595
+ else if ($isReadonlyStringArray(parameters?.toRdfTypes)) {
3596
+ toRdfTypes = parameters?.toRdfTypes.map((item) => dataFactory.namedNode(item));
3597
+ }
3598
+ else {
3599
+ toRdfTypes = parameters?.toRdfTypes;
3600
+ }
3601
+ let tsFeatureExcludes;
3602
+ if (parameters?.tsFeatureExcludes === undefined) {
3603
+ tsFeatureExcludes = [];
3604
+ }
3605
+ else if ($isReadonlyObjectArray(parameters?.tsFeatureExcludes)) {
3606
+ tsFeatureExcludes = parameters?.tsFeatureExcludes;
3607
+ }
3608
+ else if ($isReadonlyStringArray(parameters?.tsFeatureExcludes)) {
3609
+ tsFeatureExcludes = parameters?.tsFeatureExcludes.map((item) => dataFactory.namedNode(item));
3610
+ }
3611
+ else {
3612
+ tsFeatureExcludes = parameters?.tsFeatureExcludes;
3613
+ }
3614
+ let tsFeatureIncludes;
3615
+ if (parameters?.tsFeatureIncludes === undefined) {
3616
+ tsFeatureIncludes = [];
3617
+ }
3618
+ else if ($isReadonlyObjectArray(parameters?.tsFeatureIncludes)) {
3619
+ tsFeatureIncludes = parameters?.tsFeatureIncludes;
3620
+ }
3621
+ else if ($isReadonlyStringArray(parameters?.tsFeatureIncludes)) {
3622
+ tsFeatureIncludes = parameters?.tsFeatureIncludes.map((item) => dataFactory.namedNode(item));
3623
+ }
3624
+ else {
3625
+ tsFeatureIncludes = parameters?.tsFeatureIncludes;
3626
+ }
3627
+ let tsImports;
3628
+ if (parameters?.tsImports === undefined) {
3629
+ tsImports = [];
3630
+ }
3631
+ else if (typeof parameters?.tsImports === "object") {
3632
+ tsImports = parameters?.tsImports;
3633
+ }
3634
+ else {
3635
+ tsImports = parameters?.tsImports;
3636
+ }
3637
+ let tsObjectDeclarationType;
3638
+ if (Maybe.isMaybe(parameters?.tsObjectDeclarationType)) {
3639
+ tsObjectDeclarationType = parameters?.tsObjectDeclarationType;
3640
+ }
3641
+ else if (typeof parameters?.tsObjectDeclarationType === "object") {
3642
+ tsObjectDeclarationType = Maybe.of(parameters?.tsObjectDeclarationType);
3643
+ }
3644
+ else if (typeof parameters?.tsObjectDeclarationType === "string") {
3645
+ tsObjectDeclarationType = Maybe.of(dataFactory.namedNode(parameters?.tsObjectDeclarationType));
3646
+ }
3647
+ else if (parameters?.tsObjectDeclarationType === undefined) {
3648
+ tsObjectDeclarationType = Maybe.empty();
3649
+ }
3650
+ else {
3651
+ tsObjectDeclarationType =
3652
+ parameters?.tsObjectDeclarationType;
3653
+ }
3654
+ let types;
3655
+ if (parameters?.types === undefined) {
3656
+ types = [];
3657
+ }
3658
+ else if ($isReadonlyObjectArray(parameters?.types)) {
3659
+ types = parameters?.types;
3660
+ }
3661
+ else if ($isReadonlyStringArray(parameters?.types)) {
3662
+ types = parameters?.types.map((item) => dataFactory.namedNode(item));
3663
+ }
3664
+ else {
3665
+ types = parameters?.types;
3666
+ }
3667
+ let xone;
3668
+ if (Maybe.isMaybe(parameters?.xone)) {
3669
+ xone = parameters?.xone;
3670
+ }
3671
+ else if ($isReadonlyObjectArray(parameters?.xone)) {
3672
+ xone = Maybe.of(parameters?.xone);
3673
+ }
3674
+ else if ($isReadonlyStringArray(parameters?.xone)) {
3675
+ xone = Maybe.of(parameters?.xone.map((item) => dataFactory.namedNode(item)));
3676
+ }
3677
+ else if (parameters?.xone === undefined) {
3678
+ xone = Maybe.empty();
3679
+ }
3680
+ else {
3681
+ xone = parameters?.xone;
3682
+ }
3683
+ return {
2029
3684
  $identifier,
2030
3685
  $type,
2031
- labels,
3686
+ abstract,
3687
+ and,
3688
+ classes,
3689
+ closed,
3690
+ comment,
3691
+ datatype,
3692
+ deactivated,
3693
+ discriminantValue,
3694
+ extern,
3695
+ flags,
3696
+ fromRdfType,
3697
+ hasValues,
3698
+ identifierMintingStrategy,
3699
+ ignoredProperties,
3700
+ in_,
3701
+ isDefinedBy,
3702
+ label,
3703
+ languageIn,
3704
+ maxCount,
3705
+ maxExclusive,
3706
+ maxInclusive,
3707
+ maxLength,
3708
+ minCount,
3709
+ minExclusive,
3710
+ minInclusive,
3711
+ minLength,
3712
+ mutable,
3713
+ nodeKind,
3714
+ nodes,
3715
+ not,
3716
+ or,
3717
+ patterns,
3718
+ properties,
3719
+ rdfType,
3720
+ shaclmateName,
3721
+ subClassOf,
3722
+ toRdfTypes,
2032
3723
  tsFeatureExcludes,
2033
3724
  tsFeatureIncludes,
2034
3725
  tsImports,
2035
3726
  tsObjectDeclarationType,
2036
- })))))))));
2037
- };
2038
- Ontology.$schema = {
2039
- properties: {
2040
- $identifier: {
2041
- kind: "Identifier",
2042
- type: () => ({ kind: "Identifier" }),
2043
- },
2044
- $type: {
2045
- kind: "Discriminant",
2046
- type: () => ({
2047
- kind: "TypeDiscriminant",
2048
- ownValues: ["Ontology"],
2049
- }),
2050
- },
2051
- labels: {
2052
- kind: "Shacl",
2053
- type: () => ({
2054
- kind: "Set",
2055
- item: () => ({ kind: "String" }),
2056
- }),
2057
- path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
2058
- },
2059
- tsFeatureExcludes: {
2060
- kind: "Shacl",
2061
- type: () => ({
2062
- kind: "Set",
2063
- item: () => ({
2064
- kind: "Iri",
2065
- in: [
2066
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_All"),
2067
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Create"),
2068
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_Default"),
2069
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Equals"),
2070
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Graphql"),
2071
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Hash"),
2072
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Json"),
2073
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_None"),
2074
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Rdf"),
2075
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Sparql"),
2076
- ],
2077
- }),
2078
- }),
2079
- path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureExclude"),
2080
- },
2081
- tsFeatureIncludes: {
2082
- kind: "Shacl",
2083
- type: () => ({
2084
- kind: "Set",
2085
- item: () => ({
2086
- kind: "Iri",
2087
- in: [
2088
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_All"),
2089
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Create"),
2090
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_Default"),
2091
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Equals"),
2092
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Graphql"),
2093
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Hash"),
2094
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Json"),
2095
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_None"),
2096
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Rdf"),
2097
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Sparql"),
2098
- ],
2099
- }),
2100
- }),
2101
- path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureInclude"),
2102
- },
2103
- tsImports: {
2104
- kind: "Shacl",
2105
- type: () => ({
2106
- kind: "Set",
2107
- item: () => ({ kind: "String" }),
2108
- }),
2109
- path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsImport"),
2110
- },
2111
- tsObjectDeclarationType: {
2112
- kind: "Shacl",
2113
- type: () => ({
2114
- kind: "Maybe",
2115
- item: () => ({
2116
- kind: "Iri",
2117
- in: [
2118
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Class"),
2119
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Interface"),
2120
- ],
2121
- }),
2122
- }),
2123
- path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsObjectDeclarationType"),
2124
- },
2125
- },
2126
- };
2127
- function $toRdfResource(_ontology, options) {
2128
- const resourceSet = options?.resourceSet ??
2129
- new ResourceSet(datasetFactory.dataset(), { dataFactory: dataFactory });
2130
- const resource = resourceSet.resource(_ontology.$identifier);
2131
- if (!options?.ignoreRdfType) {
2132
- resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"), options?.graph);
2133
- }
2134
- resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), _ontology.labels.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
2135
- resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureExclude"), _ontology.tsFeatureExcludes.flatMap((item) => [item]), options?.graph);
2136
- resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureInclude"), _ontology.tsFeatureIncludes.flatMap((item) => [item]), options?.graph);
2137
- resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsImport"), _ontology.tsImports.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
2138
- resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsObjectDeclarationType"), _ontology.tsObjectDeclarationType.toList(), options?.graph);
2139
- return resource;
3727
+ types,
3728
+ xone,
3729
+ };
2140
3730
  }
2141
- Ontology.$toRdfResource = $toRdfResource;
2142
- })(Ontology || (Ontology = {}));
2143
- export var NodeShape;
2144
- (function (NodeShape) {
3731
+ NodeShape.$create = $create;
2145
3732
  let $Identifier;
2146
3733
  (function ($Identifier) {
2147
3734
  $Identifier.fromString = $identifierFromString; // biome-ignore lint/suspicious/noShadowRestrictedNames: allow toString
@@ -2157,7 +3744,7 @@ export var NodeShape;
2157
3744
  return false;
2158
3745
  }
2159
3746
  if (filter.and !== undefined &&
2160
- !$filterArray($filterArray($filterIdentifier))(filter.and, value.and)) {
3747
+ !$filterMaybe($filterArray($filterIdentifier))(filter.and, value.and)) {
2161
3748
  return false;
2162
3749
  }
2163
3750
  if (filter.classes !== undefined &&
@@ -2168,8 +3755,8 @@ export var NodeShape;
2168
3755
  !$filterMaybe($filterBoolean)(filter.closed, value.closed)) {
2169
3756
  return false;
2170
3757
  }
2171
- if (filter.comments !== undefined &&
2172
- !$filterArray($filterString)(filter.comments, value.comments)) {
3758
+ if (filter.comment !== undefined &&
3759
+ !$filterMaybe($filterString)(filter.comment, value.comment)) {
2173
3760
  return false;
2174
3761
  }
2175
3762
  if (filter.datatype !== undefined &&
@@ -2216,8 +3803,8 @@ export var NodeShape;
2216
3803
  !$filterMaybe($filterIdentifier)(filter.isDefinedBy, value.isDefinedBy)) {
2217
3804
  return false;
2218
3805
  }
2219
- if (filter.labels !== undefined &&
2220
- !$filterArray($filterString)(filter.labels, value.labels)) {
3806
+ if (filter.label !== undefined &&
3807
+ !$filterMaybe($filterString)(filter.label, value.label)) {
2221
3808
  return false;
2222
3809
  }
2223
3810
  if (filter.languageIn !== undefined &&
@@ -2260,10 +3847,6 @@ export var NodeShape;
2260
3847
  !$filterMaybe($filterBoolean)(filter.mutable, value.mutable)) {
2261
3848
  return false;
2262
3849
  }
2263
- if (filter.name !== undefined &&
2264
- !$filterMaybe($filterString)(filter.name, value.name)) {
2265
- return false;
2266
- }
2267
3850
  if (filter.nodeKind !== undefined &&
2268
3851
  !$filterMaybe($filterIri)(filter.nodeKind, value.nodeKind)) {
2269
3852
  return false;
@@ -2277,7 +3860,7 @@ export var NodeShape;
2277
3860
  return false;
2278
3861
  }
2279
3862
  if (filter.or !== undefined &&
2280
- !$filterArray($filterArray($filterIdentifier))(filter.or, value.or)) {
3863
+ !$filterMaybe($filterArray($filterIdentifier))(filter.or, value.or)) {
2281
3864
  return false;
2282
3865
  }
2283
3866
  if (filter.patterns !== undefined &&
@@ -2292,6 +3875,14 @@ export var NodeShape;
2292
3875
  !$filterMaybe($filterIri)(filter.rdfType, value.rdfType)) {
2293
3876
  return false;
2294
3877
  }
3878
+ if (filter.shaclmateName !== undefined &&
3879
+ !$filterMaybe($filterString)(filter.shaclmateName, value.shaclmateName)) {
3880
+ return false;
3881
+ }
3882
+ if (filter.subClassOf !== undefined &&
3883
+ !$filterArray($filterIri)(filter.subClassOf, value.subClassOf)) {
3884
+ return false;
3885
+ }
2295
3886
  if (filter.toRdfTypes !== undefined &&
2296
3887
  !$filterArray($filterIri)(filter.toRdfTypes, value.toRdfTypes)) {
2297
3888
  return false;
@@ -2312,8 +3903,12 @@ export var NodeShape;
2312
3903
  !$filterMaybe($filterIri)(filter.tsObjectDeclarationType, value.tsObjectDeclarationType)) {
2313
3904
  return false;
2314
3905
  }
3906
+ if (filter.types !== undefined &&
3907
+ !$filterArray($filterIri)(filter.types, value.types)) {
3908
+ return false;
3909
+ }
2315
3910
  if (filter.xone !== undefined &&
2316
- !$filterArray($filterArray($filterIdentifier))(filter.xone, value.xone)) {
3911
+ !$filterMaybe($filterArray($filterIdentifier))(filter.xone, value.xone)) {
2317
3912
  return false;
2318
3913
  }
2319
3914
  return true;
@@ -2397,12 +3992,13 @@ export var NodeShape;
2397
3992
  values: valueList.toArray(),
2398
3993
  })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
2399
3994
  .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
2400
- .map((values) => values.toArray())
2401
- .map((valuesArray) => Resource.Values.fromValue({
2402
- focusResource: $resource,
2403
- propertyPath: PropertyShape.$schema.properties.and.path,
2404
- value: valuesArray,
2405
- })),
3995
+ .map((values) => values.length > 0
3996
+ ? values.map((value) => Maybe.of(value))
3997
+ : Resource.Values.fromValue({
3998
+ focusResource: $resource,
3999
+ propertyPath: PropertyShape.$schema.properties.and.path,
4000
+ value: Maybe.empty(),
4001
+ })),
2406
4002
  }).chain((and) => $shaclPropertyFromRdf({
2407
4003
  graph: _$options.graph,
2408
4004
  resource: $resource,
@@ -2431,17 +4027,19 @@ export var NodeShape;
2431
4027
  }).chain((closed) => $shaclPropertyFromRdf({
2432
4028
  graph: _$options.graph,
2433
4029
  resource: $resource,
2434
- propertySchema: NodeShape.$schema.properties.comments,
4030
+ propertySchema: NodeShape.$schema.properties.comment,
2435
4031
  typeFromRdf: (resourceValues) => resourceValues
2436
4032
  .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2437
4033
  .chain((values) => values.chainMap((value) => value.toString()))
2438
- .map((values) => values.toArray())
2439
- .map((valuesArray) => Resource.Values.fromValue({
2440
- focusResource: $resource,
2441
- propertyPath: PropertyShape.$schema.properties.comments.path,
2442
- value: valuesArray,
2443
- })),
2444
- }).chain((comments) => $shaclPropertyFromRdf({
4034
+ .map((values) => values.length > 0
4035
+ ? values.map((value) => Maybe.of(value))
4036
+ : Resource.Values.fromValue({
4037
+ focusResource: $resource,
4038
+ propertyPath: PropertyShape.$schema.properties.comment
4039
+ .path,
4040
+ value: Maybe.empty(),
4041
+ })),
4042
+ }).chain((comment) => $shaclPropertyFromRdf({
2445
4043
  graph: _$options.graph,
2446
4044
  resource: $resource,
2447
4045
  propertySchema: NodeShape.$schema.properties.datatype,
@@ -2661,19 +4259,21 @@ export var NodeShape;
2661
4259
  }).chain((isDefinedBy) => $shaclPropertyFromRdf({
2662
4260
  graph: _$options.graph,
2663
4261
  resource: $resource,
2664
- propertySchema: NodeShape.$schema.properties.labels,
4262
+ propertySchema: NodeShape.$schema.properties.label,
2665
4263
  typeFromRdf: (resourceValues) => resourceValues
2666
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2667
- .chain((values) => values.chainMap((value) => value.toString()))
2668
- .map((values) => values.toArray())
2669
- .map((valuesArray) => Resource.Values.fromValue({
2670
- focusResource: $resource,
2671
- propertyPath: PropertyShape.$schema
2672
- .properties.labels
2673
- .path,
2674
- value: valuesArray,
2675
- })),
2676
- }).chain((labels) => $shaclPropertyFromRdf({
4264
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
4265
+ .chain((values) => values.chainMap((value) => value.toString()))
4266
+ .map((values) => values.length > 0
4267
+ ? values.map((value) => Maybe.of(value))
4268
+ : Resource.Values.fromValue({
4269
+ focusResource: $resource,
4270
+ propertyPath: PropertyShape
4271
+ .$schema
4272
+ .properties.label
4273
+ .path,
4274
+ value: Maybe.empty(),
4275
+ })),
4276
+ }).chain((label) => $shaclPropertyFromRdf({
2677
4277
  graph: _$options.graph,
2678
4278
  resource: $resource,
2679
4279
  propertySchema: NodeShape.$schema.properties.languageIn,
@@ -2879,27 +4479,6 @@ export var NodeShape;
2879
4479
  value: Maybe.empty(),
2880
4480
  })),
2881
4481
  }).chain((mutable) => $shaclPropertyFromRdf({
2882
- graph: _$options.graph,
2883
- resource: $resource,
2884
- propertySchema: NodeShape.$schema
2885
- .properties
2886
- .name,
2887
- typeFromRdf: (resourceValues) => resourceValues
2888
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2889
- .chain((values) => values.chainMap((value) => value.toString()))
2890
- .map((values) => values.length >
2891
- 0
2892
- ? values.map((value) => Maybe.of(value))
2893
- : Resource.Values.fromValue({
2894
- focusResource: $resource,
2895
- propertyPath: PropertyShape
2896
- .$schema
2897
- .properties
2898
- .name
2899
- .path,
2900
- value: Maybe.empty(),
2901
- })),
2902
- }).chain((name) => $shaclPropertyFromRdf({
2903
4482
  graph: _$options.graph,
2904
4483
  resource: $resource,
2905
4484
  propertySchema: NodeShape.$schema
@@ -2982,16 +4561,18 @@ export var NodeShape;
2982
4561
  values: valueList.toArray(),
2983
4562
  })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
2984
4563
  .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
2985
- .map((values) => values.toArray())
2986
- .map((valuesArray) => Resource.Values.fromValue({
2987
- focusResource: $resource,
2988
- propertyPath: PropertyShape
2989
- .$schema
2990
- .properties
2991
- .or
2992
- .path,
2993
- value: valuesArray,
2994
- })),
4564
+ .map((values) => values.length >
4565
+ 0
4566
+ ? values.map((value) => Maybe.of(value))
4567
+ : Resource.Values.fromValue({
4568
+ focusResource: $resource,
4569
+ propertyPath: PropertyShape
4570
+ .$schema
4571
+ .properties
4572
+ .or
4573
+ .path,
4574
+ value: Maybe.empty(),
4575
+ })),
2995
4576
  }).chain((or) => $shaclPropertyFromRdf({
2996
4577
  graph: _$options.graph,
2997
4578
  resource: $resource,
@@ -3050,6 +4631,45 @@ export var NodeShape;
3050
4631
  value: Maybe.empty(),
3051
4632
  })),
3052
4633
  }).chain((rdfType) => $shaclPropertyFromRdf({
4634
+ graph: _$options.graph,
4635
+ resource: $resource,
4636
+ propertySchema: NodeShape.$schema
4637
+ .properties
4638
+ .shaclmateName,
4639
+ typeFromRdf: (resourceValues) => resourceValues
4640
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
4641
+ .chain((values) => values.chainMap((value) => value.toString()))
4642
+ .map((values) => values.length >
4643
+ 0
4644
+ ? values.map((value) => Maybe.of(value))
4645
+ : Resource.Values.fromValue({
4646
+ focusResource: $resource,
4647
+ propertyPath: PropertyShape
4648
+ .$schema
4649
+ .properties
4650
+ .shaclmateName
4651
+ .path,
4652
+ value: Maybe.empty(),
4653
+ })),
4654
+ }).chain((shaclmateName) => $shaclPropertyFromRdf({
4655
+ graph: _$options.graph,
4656
+ resource: $resource,
4657
+ propertySchema: NodeShape.$schema
4658
+ .properties
4659
+ .subClassOf,
4660
+ typeFromRdf: (resourceValues) => resourceValues
4661
+ .chain((values) => values.chainMap((value) => value.toIri()))
4662
+ .map((values) => values.toArray())
4663
+ .map((valuesArray) => Resource.Values.fromValue({
4664
+ focusResource: $resource,
4665
+ propertyPath: NodeShape
4666
+ .$schema
4667
+ .properties
4668
+ .subClassOf
4669
+ .path,
4670
+ value: valuesArray,
4671
+ })),
4672
+ }).chain((subClassOf) => $shaclPropertyFromRdf({
3053
4673
  graph: _$options.graph,
3054
4674
  resource: $resource,
3055
4675
  propertySchema: NodeShape.$schema
@@ -3168,6 +4788,24 @@ export var NodeShape;
3168
4788
  value: Maybe.empty(),
3169
4789
  })),
3170
4790
  }).chain((tsObjectDeclarationType) => $shaclPropertyFromRdf({
4791
+ graph: _$options.graph,
4792
+ resource: $resource,
4793
+ propertySchema: NodeShape.$schema
4794
+ .properties
4795
+ .types,
4796
+ typeFromRdf: (resourceValues) => resourceValues
4797
+ .chain((values) => values.chainMap((value) => value.toIri()))
4798
+ .map((values) => values.toArray())
4799
+ .map((valuesArray) => Resource.Values.fromValue({
4800
+ focusResource: $resource,
4801
+ propertyPath: NodeShape
4802
+ .$schema
4803
+ .properties
4804
+ .types
4805
+ .path,
4806
+ value: valuesArray,
4807
+ })),
4808
+ }).chain((types) => $shaclPropertyFromRdf({
3171
4809
  graph: _$options.graph,
3172
4810
  resource: $resource,
3173
4811
  propertySchema: NodeShape.$schema
@@ -3187,16 +4825,18 @@ export var NodeShape;
3187
4825
  values: valueList.toArray(),
3188
4826
  })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
3189
4827
  .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
3190
- .map((values) => values.toArray())
3191
- .map((valuesArray) => Resource.Values.fromValue({
3192
- focusResource: $resource,
3193
- propertyPath: PropertyShape
3194
- .$schema
3195
- .properties
3196
- .xone
3197
- .path,
3198
- value: valuesArray,
3199
- })),
4828
+ .map((values) => values.length >
4829
+ 0
4830
+ ? values.map((value) => Maybe.of(value))
4831
+ : Resource.Values.fromValue({
4832
+ focusResource: $resource,
4833
+ propertyPath: PropertyShape
4834
+ .$schema
4835
+ .properties
4836
+ .xone
4837
+ .path,
4838
+ value: Maybe.empty(),
4839
+ })),
3200
4840
  }).map((xone) => ({
3201
4841
  $identifier,
3202
4842
  $type,
@@ -3204,7 +4844,7 @@ export var NodeShape;
3204
4844
  and,
3205
4845
  classes,
3206
4846
  closed,
3207
- comments,
4847
+ comment,
3208
4848
  datatype,
3209
4849
  deactivated,
3210
4850
  discriminantValue,
@@ -3216,7 +4856,7 @@ export var NodeShape;
3216
4856
  ignoredProperties,
3217
4857
  in_,
3218
4858
  isDefinedBy,
3219
- labels,
4859
+ label,
3220
4860
  languageIn,
3221
4861
  maxCount,
3222
4862
  maxExclusive,
@@ -3227,7 +4867,6 @@ export var NodeShape;
3227
4867
  minInclusive,
3228
4868
  minLength,
3229
4869
  mutable,
3230
- name,
3231
4870
  nodeKind,
3232
4871
  nodes,
3233
4872
  not,
@@ -3235,13 +4874,16 @@ export var NodeShape;
3235
4874
  patterns,
3236
4875
  properties,
3237
4876
  rdfType,
4877
+ shaclmateName,
4878
+ subClassOf,
3238
4879
  toRdfTypes,
3239
4880
  tsFeatureExcludes,
3240
4881
  tsFeatureIncludes,
3241
4882
  tsImports,
3242
4883
  tsObjectDeclarationType,
4884
+ types,
3243
4885
  xone,
3244
- })))))))))))))))))))))))))))))))))))))))))))));
4886
+ })))))))))))))))))))))))))))))))))))))))))))))));
3245
4887
  };
3246
4888
  NodeShape.$schema = {
3247
4889
  properties: {
@@ -3267,7 +4909,7 @@ export var NodeShape;
3267
4909
  and: {
3268
4910
  kind: "Shacl",
3269
4911
  type: () => ({
3270
- kind: "Set",
4912
+ kind: "Maybe",
3271
4913
  item: () => ({
3272
4914
  kind: "List",
3273
4915
  item: () => ({ kind: "Identifier" }),
@@ -3291,10 +4933,10 @@ export var NodeShape;
3291
4933
  }),
3292
4934
  path: dataFactory.namedNode("http://www.w3.org/ns/shacl#closed"),
3293
4935
  },
3294
- comments: {
4936
+ comment: {
3295
4937
  kind: "Shacl",
3296
4938
  type: () => ({
3297
- kind: "Set",
4939
+ kind: "Maybe",
3298
4940
  item: () => ({ kind: "String" }),
3299
4941
  }),
3300
4942
  path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
@@ -3400,10 +5042,10 @@ export var NodeShape;
3400
5042
  }),
3401
5043
  path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"),
3402
5044
  },
3403
- labels: {
5045
+ label: {
3404
5046
  kind: "Shacl",
3405
5047
  type: () => ({
3406
- kind: "Set",
5048
+ kind: "Maybe",
3407
5049
  item: () => ({ kind: "String" }),
3408
5050
  }),
3409
5051
  path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
@@ -3491,14 +5133,6 @@ export var NodeShape;
3491
5133
  }),
3492
5134
  path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#mutable"),
3493
5135
  },
3494
- name: {
3495
- kind: "Shacl",
3496
- type: () => ({
3497
- kind: "Maybe",
3498
- item: () => ({ kind: "String" }),
3499
- }),
3500
- path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#name"),
3501
- },
3502
5136
  nodeKind: {
3503
5137
  kind: "Shacl",
3504
5138
  type: () => ({
@@ -3536,7 +5170,7 @@ export var NodeShape;
3536
5170
  or: {
3537
5171
  kind: "Shacl",
3538
5172
  type: () => ({
3539
- kind: "Set",
5173
+ kind: "Maybe",
3540
5174
  item: () => ({
3541
5175
  kind: "List",
3542
5176
  item: () => ({ kind: "Identifier" }),
@@ -3568,6 +5202,22 @@ export var NodeShape;
3568
5202
  }),
3569
5203
  path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#rdfType"),
3570
5204
  },
5205
+ shaclmateName: {
5206
+ kind: "Shacl",
5207
+ type: () => ({
5208
+ kind: "Maybe",
5209
+ item: () => ({ kind: "String" }),
5210
+ }),
5211
+ path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#name"),
5212
+ },
5213
+ subClassOf: {
5214
+ kind: "Shacl",
5215
+ type: () => ({
5216
+ kind: "Set",
5217
+ item: () => ({ kind: "Iri" }),
5218
+ }),
5219
+ path: $RdfVocabularies.rdfs.subClassOf,
5220
+ },
3571
5221
  toRdfTypes: {
3572
5222
  kind: "Shacl",
3573
5223
  type: () => ({
@@ -3642,10 +5292,18 @@ export var NodeShape;
3642
5292
  }),
3643
5293
  path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsObjectDeclarationType"),
3644
5294
  },
3645
- xone: {
5295
+ types: {
3646
5296
  kind: "Shacl",
3647
5297
  type: () => ({
3648
5298
  kind: "Set",
5299
+ item: () => ({ kind: "Iri" }),
5300
+ }),
5301
+ path: $RdfVocabularies.rdf.type,
5302
+ },
5303
+ xone: {
5304
+ kind: "Shacl",
5305
+ type: () => ({
5306
+ kind: "Maybe",
3649
5307
  item: () => ({
3650
5308
  kind: "List",
3651
5309
  item: () => ({ kind: "Identifier" }),
@@ -3667,9 +5325,9 @@ export var NodeShape;
3667
5325
  .flatMap((value) => [
3668
5326
  $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
3669
5327
  ]), options?.graph);
3670
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#and"), _nodeShape.and.flatMap((item) => [
3671
- item.length > 0
3672
- ? item.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
5328
+ resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#and"), _nodeShape.and.toList().flatMap((value) => [
5329
+ value.length > 0
5330
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
3673
5331
  if (itemIndex === 0) {
3674
5332
  currentSubListResource = listResource;
3675
5333
  }
@@ -3695,7 +5353,9 @@ export var NodeShape;
3695
5353
  .flatMap((value) => [
3696
5354
  $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
3697
5355
  ]), options?.graph);
3698
- resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), _nodeShape.comments.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
5356
+ resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), _nodeShape.comment
5357
+ .toList()
5358
+ .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
3699
5359
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#datatype"), _nodeShape.datatype.toList(), options?.graph);
3700
5360
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"), _nodeShape.deactivated
3701
5361
  .toList()
@@ -3759,7 +5419,9 @@ export var NodeShape;
3759
5419
  : $RdfVocabularies.rdf.nil,
3760
5420
  ]), options?.graph);
3761
5421
  resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"), _nodeShape.isDefinedBy.toList(), options?.graph);
3762
- resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), _nodeShape.labels.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
5422
+ resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), _nodeShape.label
5423
+ .toList()
5424
+ .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
3763
5425
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#languageIn"), _nodeShape.languageIn.toList().flatMap((value) => [
3764
5426
  value.length > 0
3765
5427
  ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
@@ -3811,15 +5473,12 @@ export var NodeShape;
3811
5473
  .flatMap((value) => [
3812
5474
  $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
3813
5475
  ]), options?.graph);
3814
- resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#name"), _nodeShape.name
3815
- .toList()
3816
- .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
3817
5476
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"), _nodeShape.nodeKind.toList(), options?.graph);
3818
5477
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#node"), _nodeShape.nodes.flatMap((item) => [item]), options?.graph);
3819
5478
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#not"), _nodeShape.not.flatMap((item) => [item]), options?.graph);
3820
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#or"), _nodeShape.or.flatMap((item) => [
3821
- item.length > 0
3822
- ? item.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
5479
+ resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#or"), _nodeShape.or.toList().flatMap((value) => [
5480
+ value.length > 0
5481
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
3823
5482
  if (itemIndex === 0) {
3824
5483
  currentSubListResource = listResource;
3825
5484
  }
@@ -3842,14 +5501,19 @@ export var NodeShape;
3842
5501
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#pattern"), _nodeShape.patterns.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
3843
5502
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#property"), _nodeShape.properties.flatMap((item) => [item]), options?.graph);
3844
5503
  resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#rdfType"), _nodeShape.rdfType.toList(), options?.graph);
5504
+ resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#name"), _nodeShape.shaclmateName
5505
+ .toList()
5506
+ .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
5507
+ resource.add($RdfVocabularies.rdfs.subClassOf, _nodeShape.subClassOf.flatMap((item) => [item]), options?.graph);
3845
5508
  resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#toRdfType"), _nodeShape.toRdfTypes.flatMap((item) => [item]), options?.graph);
3846
5509
  resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureExclude"), _nodeShape.tsFeatureExcludes.flatMap((item) => [item]), options?.graph);
3847
5510
  resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureInclude"), _nodeShape.tsFeatureIncludes.flatMap((item) => [item]), options?.graph);
3848
5511
  resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsImport"), _nodeShape.tsImports.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
3849
5512
  resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsObjectDeclarationType"), _nodeShape.tsObjectDeclarationType.toList(), options?.graph);
3850
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#xone"), _nodeShape.xone.flatMap((item) => [
3851
- item.length > 0
3852
- ? item.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
5513
+ resource.add($RdfVocabularies.rdf.type, _nodeShape.types.flatMap((item) => [item]), options?.graph);
5514
+ resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#xone"), _nodeShape.xone.toList().flatMap((value) => [
5515
+ value.length > 0
5516
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
3853
5517
  if (itemIndex === 0) {
3854
5518
  currentSubListResource = listResource;
3855
5519
  }
@@ -3875,15 +5539,6 @@ export var NodeShape;
3875
5539
  })(NodeShape || (NodeShape = {}));
3876
5540
  export var Shape;
3877
5541
  (function (Shape) {
3878
- Shape.$toRdfResource = (value, options) => {
3879
- if (NodeShape.isNodeShape(value)) {
3880
- return NodeShape.$toRdfResource(value, options);
3881
- }
3882
- if (PropertyShape.isPropertyShape(value)) {
3883
- return PropertyShape.$toRdfResource(value, options);
3884
- }
3885
- throw new Error("unrecognized type");
3886
- };
3887
5542
  Shape.$filter = (filter, value) => {
3888
5543
  if (filter.$identifier !== undefined &&
3889
5544
  !$filterIdentifier(filter.$identifier, value.$identifier)) {
@@ -3950,7 +5605,7 @@ export var Shape;
3950
5605
  and: {
3951
5606
  kind: "Shacl",
3952
5607
  type: () => ({
3953
- kind: "Set",
5608
+ kind: "Maybe",
3954
5609
  item: () => ({
3955
5610
  kind: "List",
3956
5611
  item: () => ({ kind: "Identifier" }),
@@ -3966,10 +5621,10 @@ export var Shape;
3966
5621
  }),
3967
5622
  path: dataFactory.namedNode("http://www.w3.org/ns/shacl#class"),
3968
5623
  },
3969
- comments: {
5624
+ comment: {
3970
5625
  kind: "Shacl",
3971
5626
  type: () => ({
3972
- kind: "Set",
5627
+ kind: "Maybe",
3973
5628
  item: () => ({ kind: "String" }),
3974
5629
  }),
3975
5630
  path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
@@ -4025,10 +5680,10 @@ export var Shape;
4025
5680
  }),
4026
5681
  path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"),
4027
5682
  },
4028
- labels: {
5683
+ label: {
4029
5684
  kind: "Shacl",
4030
5685
  type: () => ({
4031
- kind: "Set",
5686
+ kind: "Maybe",
4032
5687
  item: () => ({ kind: "String" }),
4033
5688
  }),
4034
5689
  path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
@@ -4116,14 +5771,6 @@ export var Shape;
4116
5771
  }),
4117
5772
  path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#mutable"),
4118
5773
  },
4119
- name: {
4120
- kind: "Shacl",
4121
- type: () => ({
4122
- kind: "Maybe",
4123
- item: () => ({ kind: "String" }),
4124
- }),
4125
- path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#name"),
4126
- },
4127
5774
  nodeKind: {
4128
5775
  kind: "Shacl",
4129
5776
  type: () => ({
@@ -4161,7 +5808,7 @@ export var Shape;
4161
5808
  or: {
4162
5809
  kind: "Shacl",
4163
5810
  type: () => ({
4164
- kind: "Set",
5811
+ kind: "Maybe",
4165
5812
  item: () => ({
4166
5813
  kind: "List",
4167
5814
  item: () => ({ kind: "Identifier" }),
@@ -4177,10 +5824,18 @@ export var Shape;
4177
5824
  }),
4178
5825
  path: dataFactory.namedNode("http://www.w3.org/ns/shacl#pattern"),
4179
5826
  },
5827
+ shaclmateName: {
5828
+ kind: "Shacl",
5829
+ type: () => ({
5830
+ kind: "Maybe",
5831
+ item: () => ({ kind: "String" }),
5832
+ }),
5833
+ path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#name"),
5834
+ },
4180
5835
  xone: {
4181
5836
  kind: "Shacl",
4182
5837
  type: () => ({
4183
- kind: "Set",
5838
+ kind: "Maybe",
4184
5839
  item: () => ({
4185
5840
  kind: "List",
4186
5841
  item: () => ({ kind: "Identifier" }),
@@ -4190,6 +5845,15 @@ export var Shape;
4190
5845
  },
4191
5846
  },
4192
5847
  };
5848
+ Shape.$toRdfResource = (value, options) => {
5849
+ if (NodeShape.isNodeShape(value)) {
5850
+ return NodeShape.$toRdfResource(value, options);
5851
+ }
5852
+ if (PropertyShape.isPropertyShape(value)) {
5853
+ return PropertyShape.$toRdfResource(value, options);
5854
+ }
5855
+ throw new Error("unrecognized type");
5856
+ };
4193
5857
  Shape.$toRdfResourceValues = ((value, _options) => {
4194
5858
  if (NodeShape.isNodeShape(value)) {
4195
5859
  return [
@@ -4216,21 +5880,6 @@ export var Shape;
4216
5880
  })(Shape || (Shape = {}));
4217
5881
  export var $Object;
4218
5882
  (function ($Object) {
4219
- $Object.$toRdfResource = (value, options) => {
4220
- if (NodeShape.isNodeShape(value)) {
4221
- return NodeShape.$toRdfResource(value, options);
4222
- }
4223
- if (Ontology.isOntology(value)) {
4224
- return Ontology.$toRdfResource(value, options);
4225
- }
4226
- if (PropertyGroup.isPropertyGroup(value)) {
4227
- return PropertyGroup.$toRdfResource(value, options);
4228
- }
4229
- if (PropertyShape.isPropertyShape(value)) {
4230
- return PropertyShape.$toRdfResource(value, options);
4231
- }
4232
- throw new Error("unrecognized type");
4233
- };
4234
5883
  $Object.$filter = (filter, value) => {
4235
5884
  if (filter.$identifier !== undefined &&
4236
5885
  !$filterIdentifier(filter.$identifier, value.$identifier)) {
@@ -4337,16 +5986,39 @@ export var $Object;
4337
5986
  },
4338
5987
  },
4339
5988
  properties: {
4340
- labels: {
5989
+ comment: {
4341
5990
  kind: "Shacl",
4342
5991
  type: () => ({
4343
- kind: "Set",
5992
+ kind: "Maybe",
5993
+ item: () => ({ kind: "String" }),
5994
+ }),
5995
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
5996
+ },
5997
+ label: {
5998
+ kind: "Shacl",
5999
+ type: () => ({
6000
+ kind: "Maybe",
4344
6001
  item: () => ({ kind: "String" }),
4345
6002
  }),
4346
6003
  path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
4347
6004
  },
4348
6005
  },
4349
6006
  };
6007
+ $Object.$toRdfResource = (value, options) => {
6008
+ if (NodeShape.isNodeShape(value)) {
6009
+ return NodeShape.$toRdfResource(value, options);
6010
+ }
6011
+ if (Ontology.isOntology(value)) {
6012
+ return Ontology.$toRdfResource(value, options);
6013
+ }
6014
+ if (PropertyGroup.isPropertyGroup(value)) {
6015
+ return PropertyGroup.$toRdfResource(value, options);
6016
+ }
6017
+ if (PropertyShape.isPropertyShape(value)) {
6018
+ return PropertyShape.$toRdfResource(value, options);
6019
+ }
6020
+ throw new Error("unrecognized type");
6021
+ };
4350
6022
  $Object.$toRdfResourceValues = ((value, _options) => {
4351
6023
  if (NodeShape.isNodeShape(value)) {
4352
6024
  return [
@@ -4609,7 +6281,7 @@ export class $RdfjsDatasetObjectSet {
4609
6281
  },
4610
6282
  ], query);
4611
6283
  }
4612
- $objectsSync(objectType, query) {
6284
+ $objectsSync(namedObjectType, query) {
4613
6285
  const graph = query?.graph ?? this.$graph;
4614
6286
  const limit = query?.limit ?? Number.MAX_SAFE_INTEGER;
4615
6287
  if (limit <= 0) {
@@ -4633,11 +6305,11 @@ export class $RdfjsDatasetObjectSet {
4633
6305
  }));
4634
6306
  sortResources = false;
4635
6307
  }
4636
- else if (objectType.$fromRdfTypes.length > 0) {
6308
+ else if (namedObjectType.$fromRdfTypes.length > 0) {
4637
6309
  const identifierSet = new $IdentifierSet();
4638
6310
  resources = [];
4639
6311
  sortResources = true;
4640
- for (const fromRdfType of objectType.$fromRdfTypes) {
6312
+ for (const fromRdfType of namedObjectType.$fromRdfTypes) {
4641
6313
  for (const resource of resourceSet.instancesOf(fromRdfType, {
4642
6314
  graph,
4643
6315
  })) {
@@ -4669,7 +6341,7 @@ export class $RdfjsDatasetObjectSet {
4669
6341
  identifierSet.add(quad.subject);
4670
6342
  const resource = resourceSet.resource(quad.subject);
4671
6343
  // Eagerly eliminate the majority of resources that won't match the object type
4672
- objectType
6344
+ namedObjectType
4673
6345
  .$fromRdfResource(resource, fromRdfResourceOptions)
4674
6346
  .ifRight((object) => {
4675
6347
  resources.push({ object, resource });
@@ -4684,13 +6356,13 @@ export class $RdfjsDatasetObjectSet {
4684
6356
  const objects = [];
4685
6357
  for (let { object, resource } of resources) {
4686
6358
  if (!object) {
4687
- const objectEither = objectType.$fromRdfResource(resource, fromRdfResourceOptions);
6359
+ const objectEither = namedObjectType.$fromRdfResource(resource, fromRdfResourceOptions);
4688
6360
  if (objectEither.isLeft()) {
4689
6361
  return objectEither;
4690
6362
  }
4691
6363
  object = objectEither.unsafeCoerce();
4692
6364
  }
4693
- if (query?.filter && !objectType.$filter(query.filter, object)) {
6365
+ if (query?.filter && !namedObjectType.$filter(query.filter, object)) {
4694
6366
  continue;
4695
6367
  }
4696
6368
  if (objectI++ >= offset) {
@@ -4702,7 +6374,7 @@ export class $RdfjsDatasetObjectSet {
4702
6374
  }
4703
6375
  return Right(objects);
4704
6376
  }
4705
- $objectUnionsSync(objectTypes, query) {
6377
+ $objectUnionsSync(namedObjectTypes, query) {
4706
6378
  const graph = query?.graph ?? this.$graph;
4707
6379
  const limit = query?.limit ?? Number.MAX_SAFE_INTEGER;
4708
6380
  if (limit <= 0) {
@@ -4726,18 +6398,18 @@ export class $RdfjsDatasetObjectSet {
4726
6398
  }));
4727
6399
  sortResources = false;
4728
6400
  }
4729
- else if (objectTypes.every((objectType) => objectType.$fromRdfTypes.length > 0)) {
6401
+ else if (namedObjectTypes.every((namedObjectType) => namedObjectType.$fromRdfTypes.length > 0)) {
4730
6402
  const identifierSet = new $IdentifierSet();
4731
6403
  resources = [];
4732
6404
  sortResources = true;
4733
- for (const objectType of objectTypes) {
4734
- for (const fromRdfType of objectType.$fromRdfTypes) {
6405
+ for (const namedObjectType of namedObjectTypes) {
6406
+ for (const fromRdfType of namedObjectType.$fromRdfTypes) {
4735
6407
  for (const resource of resourceSet.instancesOf(fromRdfType, {
4736
6408
  graph,
4737
6409
  })) {
4738
6410
  if (!identifierSet.has(resource.identifier)) {
4739
6411
  identifierSet.add(resource.identifier);
4740
- resources.push({ objectType, resource });
6412
+ resources.push({ namedObjectType, resource });
4741
6413
  }
4742
6414
  }
4743
6415
  }
@@ -4764,11 +6436,11 @@ export class $RdfjsDatasetObjectSet {
4764
6436
  identifierSet.add(quad.subject);
4765
6437
  // Eagerly eliminate the majority of resources that won't match the object types
4766
6438
  const resource = resourceSet.resource(quad.subject);
4767
- for (const objectType of objectTypes) {
4768
- if (objectType
6439
+ for (const namedObjectType of namedObjectTypes) {
6440
+ if (namedObjectType
4769
6441
  .$fromRdfResource(resource, fromRdfResourceOptions)
4770
6442
  .ifRight((object) => {
4771
- resources.push({ object, objectType, resource });
6443
+ resources.push({ object, namedObjectType, resource });
4772
6444
  })
4773
6445
  .isRight()) {
4774
6446
  break;
@@ -4782,18 +6454,18 @@ export class $RdfjsDatasetObjectSet {
4782
6454
  }
4783
6455
  let objectI = 0;
4784
6456
  const objects = [];
4785
- for (let { object, objectType, resource } of resources) {
6457
+ for (let { object, namedObjectType, resource } of resources) {
4786
6458
  if (!object) {
4787
6459
  let objectEither;
4788
- if (objectType) {
4789
- objectEither = objectType.$fromRdfResource(resource, fromRdfResourceOptions);
6460
+ if (namedObjectType) {
6461
+ objectEither = namedObjectType.$fromRdfResource(resource, fromRdfResourceOptions);
4790
6462
  }
4791
6463
  else {
4792
6464
  objectEither = Left(new Error("no object types"));
4793
- for (const tryObjectType of objectTypes) {
6465
+ for (const tryObjectType of namedObjectTypes) {
4794
6466
  objectEither = tryObjectType.$fromRdfResource(resource, fromRdfResourceOptions);
4795
6467
  if (objectEither.isRight()) {
4796
- objectType = tryObjectType;
6468
+ namedObjectType = tryObjectType;
4797
6469
  break;
4798
6470
  }
4799
6471
  }
@@ -4803,10 +6475,10 @@ export class $RdfjsDatasetObjectSet {
4803
6475
  }
4804
6476
  object = objectEither.unsafeCoerce();
4805
6477
  }
4806
- if (!objectType) {
4807
- throw new Error("objectType should be set here");
6478
+ if (!namedObjectType) {
6479
+ throw new Error("namedObjectType should be set here");
4808
6480
  }
4809
- if (query?.filter && !objectType.$filter(query.filter, object)) {
6481
+ if (query?.filter && !namedObjectType.$filter(query.filter, object)) {
4810
6482
  continue;
4811
6483
  }
4812
6484
  if (objectI++ >= offset) {