@shaclmate/shacl-ast 4.0.6 → 4.0.8
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.
- package/dist/NodeShape.d.ts +3 -3
- package/dist/NodeShape.js +9 -9
- package/dist/Ontology.d.ts +1 -1
- package/dist/PropertyGroup.d.ts +1 -1
- package/dist/PropertyShape.d.ts +2 -2
- package/dist/PropertyShape.js +11 -11
- package/dist/Shape.d.ts +4 -4
- package/dist/Shape.js +28 -28
- package/dist/ShapesGraph.js +4 -4
- package/dist/generated.d.ts +399 -602
- package/dist/generated.js +2049 -1062
- package/package.json +1 -1
package/dist/generated.js
CHANGED
|
@@ -204,8 +204,13 @@ var $RdfVocabularies;
|
|
|
204
204
|
function $shaclPropertyFromRdf({ graph, propertySchema, resource, typeFromRdf, }) {
|
|
205
205
|
return typeFromRdf(Right(resource.values(propertySchema.path, { graph, unique: true }))).chain((values) => values.head());
|
|
206
206
|
}
|
|
207
|
-
export var
|
|
208
|
-
(function (
|
|
207
|
+
export var PropertyShape;
|
|
208
|
+
(function (PropertyShape) {
|
|
209
|
+
let $Identifier;
|
|
210
|
+
(function ($Identifier) {
|
|
211
|
+
$Identifier.fromString = $identifierFromString; // biome-ignore lint/suspicious/noShadowRestrictedNames: allow toString
|
|
212
|
+
$Identifier.toString = Resource.Identifier.toString;
|
|
213
|
+
})($Identifier = PropertyShape.$Identifier || (PropertyShape.$Identifier = {}));
|
|
209
214
|
function $filter(filter, value) {
|
|
210
215
|
if (filter.$identifier !== undefined &&
|
|
211
216
|
!$filterIdentifier(filter.$identifier, value.$identifier)) {
|
|
@@ -231,10 +236,22 @@ export var BaseShaclCoreShapeStatic;
|
|
|
231
236
|
!$filterMaybe($filterBoolean)(filter.deactivated, value.deactivated)) {
|
|
232
237
|
return false;
|
|
233
238
|
}
|
|
239
|
+
if (filter.defaultValue !== undefined &&
|
|
240
|
+
!$filterMaybe($filterTerm)(filter.defaultValue, value.defaultValue)) {
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
if (filter.descriptions !== undefined &&
|
|
244
|
+
!$filterArray($filterString)(filter.descriptions, value.descriptions)) {
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
234
247
|
if (filter.flags !== undefined &&
|
|
235
248
|
!$filterArray($filterString)(filter.flags, value.flags)) {
|
|
236
249
|
return false;
|
|
237
250
|
}
|
|
251
|
+
if (filter.groups !== undefined &&
|
|
252
|
+
!$filterArray($filterIdentifier)(filter.groups, value.groups)) {
|
|
253
|
+
return false;
|
|
254
|
+
}
|
|
238
255
|
if (filter.hasValues !== undefined &&
|
|
239
256
|
!$filterArray($filterTerm)(filter.hasValues, value.hasValues)) {
|
|
240
257
|
return false;
|
|
@@ -287,6 +304,10 @@ export var BaseShaclCoreShapeStatic;
|
|
|
287
304
|
!$filterMaybe(($filterNumeric))(filter.minLength, value.minLength)) {
|
|
288
305
|
return false;
|
|
289
306
|
}
|
|
307
|
+
if (filter.names !== undefined &&
|
|
308
|
+
!$filterArray($filterString)(filter.names, value.names)) {
|
|
309
|
+
return false;
|
|
310
|
+
}
|
|
290
311
|
if (filter.nodeKind !== undefined &&
|
|
291
312
|
!$filterMaybe($filterIri)(filter.nodeKind, value.nodeKind)) {
|
|
292
313
|
return false;
|
|
@@ -303,34 +324,73 @@ export var BaseShaclCoreShapeStatic;
|
|
|
303
324
|
!$filterArray($filterArray($filterIdentifier))(filter.or, value.or)) {
|
|
304
325
|
return false;
|
|
305
326
|
}
|
|
327
|
+
if (filter.order !== undefined &&
|
|
328
|
+
!$filterMaybe(($filterNumeric))(filter.order, value.order)) {
|
|
329
|
+
return false;
|
|
330
|
+
}
|
|
331
|
+
if (filter.path !== undefined &&
|
|
332
|
+
!PropertyPath.$filter(filter.path, value.path)) {
|
|
333
|
+
return false;
|
|
334
|
+
}
|
|
306
335
|
if (filter.patterns !== undefined &&
|
|
307
336
|
!$filterArray($filterString)(filter.patterns, value.patterns)) {
|
|
308
337
|
return false;
|
|
309
338
|
}
|
|
339
|
+
if (filter.uniqueLang !== undefined &&
|
|
340
|
+
!$filterMaybe($filterBoolean)(filter.uniqueLang, value.uniqueLang)) {
|
|
341
|
+
return false;
|
|
342
|
+
}
|
|
310
343
|
if (filter.xone !== undefined &&
|
|
311
344
|
!$filterArray($filterArray($filterIdentifier))(filter.xone, value.xone)) {
|
|
312
345
|
return false;
|
|
313
346
|
}
|
|
314
347
|
return true;
|
|
315
348
|
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
349
|
+
PropertyShape.$filter = $filter;
|
|
350
|
+
function $fromRdf(resource, options) {
|
|
351
|
+
let { context, ignoreRdfType = false, objectSet, preferredLanguages, } = options ?? {};
|
|
352
|
+
if (!objectSet) {
|
|
353
|
+
objectSet = new $RdfjsDatasetObjectSet(resource.dataset);
|
|
354
|
+
}
|
|
355
|
+
return PropertyShape.$propertiesFromRdf({
|
|
356
|
+
context,
|
|
357
|
+
ignoreRdfType,
|
|
358
|
+
objectSet,
|
|
359
|
+
preferredLanguages,
|
|
360
|
+
resource,
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
PropertyShape.$fromRdf = $fromRdf;
|
|
364
|
+
PropertyShape.$fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape");
|
|
365
|
+
function isPropertyShape(object) {
|
|
323
366
|
switch (object.$type) {
|
|
324
|
-
case "
|
|
325
|
-
case "ShaclCorePropertyShape":
|
|
367
|
+
case "PropertyShape":
|
|
326
368
|
return true;
|
|
327
369
|
default:
|
|
328
370
|
return false;
|
|
329
371
|
}
|
|
330
372
|
}
|
|
331
|
-
|
|
373
|
+
PropertyShape.isPropertyShape = isPropertyShape;
|
|
332
374
|
function $propertiesFromRdf($parameters) {
|
|
333
|
-
return
|
|
375
|
+
return (!$parameters.ignoreRdfType
|
|
376
|
+
? $parameters.resource
|
|
377
|
+
.value($RdfVocabularies.rdf.type, { graph: $parameters.graph })
|
|
378
|
+
.chain((actualRdfType) => actualRdfType.toIri())
|
|
379
|
+
.chain((actualRdfType) => {
|
|
380
|
+
// Check the expected type and its known subtypes
|
|
381
|
+
switch (actualRdfType.value) {
|
|
382
|
+
case "http://www.w3.org/ns/shacl#PropertyShape":
|
|
383
|
+
return Right(true);
|
|
384
|
+
}
|
|
385
|
+
// Check arbitrary rdfs:subClassOf's of the expected type
|
|
386
|
+
if ($parameters.resource.isInstanceOf(PropertyShape.$fromRdfType, {
|
|
387
|
+
graph: $parameters.graph,
|
|
388
|
+
})) {
|
|
389
|
+
return Right(true);
|
|
390
|
+
}
|
|
391
|
+
return Left(new Error(`${Resource.Identifier.toString($parameters.resource.identifier)} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#PropertyShape)`));
|
|
392
|
+
})
|
|
393
|
+
: Right(true)).chain((_rdfTypeCheck) => Right(new Resource.Value({
|
|
334
394
|
dataFactory: dataFactory,
|
|
335
395
|
focusResource: $parameters.resource,
|
|
336
396
|
propertyPath: $RdfVocabularies.rdf.subject,
|
|
@@ -338,96 +398,150 @@ export var BaseShaclCoreShapeStatic;
|
|
|
338
398
|
}).toValues())
|
|
339
399
|
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
340
400
|
.chain((values) => values.head())
|
|
341
|
-
.chain(($identifier) => $shaclPropertyFromRdf({
|
|
401
|
+
.chain(($identifier) => Right("PropertyShape").chain(($type) => $shaclPropertyFromRdf({
|
|
342
402
|
graph: $parameters.graph,
|
|
343
403
|
resource: $parameters.resource,
|
|
344
|
-
propertySchema:
|
|
404
|
+
propertySchema: PropertyShape.$schema.properties.and,
|
|
345
405
|
typeFromRdf: (resourceValues) => resourceValues
|
|
346
406
|
.chain((values) => values.chainMap((value) => value.toList({ graph: $parameters.graph })))
|
|
347
407
|
.chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
|
|
348
408
|
focusResource: $parameters.resource,
|
|
349
|
-
propertyPath:
|
|
409
|
+
propertyPath: PropertyShape.$schema.properties.and.path,
|
|
350
410
|
values: valueList.toArray(),
|
|
351
411
|
})).chain((values) => values.chainMap((value) => value.toIdentifier()))))
|
|
352
412
|
.map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
|
|
353
413
|
.map((values) => values.toArray())
|
|
354
414
|
.map((valuesArray) => Resource.Values.fromValue({
|
|
355
415
|
focusResource: $parameters.resource,
|
|
356
|
-
propertyPath:
|
|
416
|
+
propertyPath: PropertyShape.$schema.properties.and.path,
|
|
357
417
|
value: valuesArray,
|
|
358
418
|
})),
|
|
359
419
|
}).chain((and) => $shaclPropertyFromRdf({
|
|
360
420
|
graph: $parameters.graph,
|
|
361
421
|
resource: $parameters.resource,
|
|
362
|
-
propertySchema:
|
|
422
|
+
propertySchema: PropertyShape.$schema.properties.classes,
|
|
363
423
|
typeFromRdf: (resourceValues) => resourceValues
|
|
364
424
|
.chain((values) => values.chainMap((value) => value.toIri()))
|
|
365
425
|
.map((values) => values.toArray())
|
|
366
426
|
.map((valuesArray) => Resource.Values.fromValue({
|
|
367
427
|
focusResource: $parameters.resource,
|
|
368
|
-
propertyPath:
|
|
428
|
+
propertyPath: PropertyShape.$schema.properties.classes.path,
|
|
369
429
|
value: valuesArray,
|
|
370
430
|
})),
|
|
371
431
|
}).chain((classes) => $shaclPropertyFromRdf({
|
|
372
432
|
graph: $parameters.graph,
|
|
373
433
|
resource: $parameters.resource,
|
|
374
|
-
propertySchema:
|
|
434
|
+
propertySchema: PropertyShape.$schema.properties.comments,
|
|
375
435
|
typeFromRdf: (resourceValues) => resourceValues
|
|
376
436
|
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
377
437
|
.chain((values) => values.chainMap((value) => value.toString()))
|
|
378
438
|
.map((values) => values.toArray())
|
|
379
439
|
.map((valuesArray) => Resource.Values.fromValue({
|
|
380
440
|
focusResource: $parameters.resource,
|
|
381
|
-
propertyPath:
|
|
382
|
-
.path,
|
|
441
|
+
propertyPath: PropertyShape.$schema.properties.comments.path,
|
|
383
442
|
value: valuesArray,
|
|
384
443
|
})),
|
|
385
444
|
}).chain((comments) => $shaclPropertyFromRdf({
|
|
386
445
|
graph: $parameters.graph,
|
|
387
446
|
resource: $parameters.resource,
|
|
388
|
-
propertySchema:
|
|
447
|
+
propertySchema: PropertyShape.$schema.properties.datatype,
|
|
389
448
|
typeFromRdf: (resourceValues) => resourceValues
|
|
390
449
|
.chain((values) => values.chainMap((value) => value.toIri()))
|
|
391
450
|
.map((values) => values.length > 0
|
|
392
451
|
? values.map((value) => Maybe.of(value))
|
|
393
452
|
: Resource.Values.fromValue({
|
|
394
453
|
focusResource: $parameters.resource,
|
|
395
|
-
propertyPath:
|
|
396
|
-
.
|
|
454
|
+
propertyPath: PropertyShape.$schema.properties.datatype
|
|
455
|
+
.path,
|
|
397
456
|
value: Maybe.empty(),
|
|
398
457
|
})),
|
|
399
458
|
}).chain((datatype) => $shaclPropertyFromRdf({
|
|
400
459
|
graph: $parameters.graph,
|
|
401
460
|
resource: $parameters.resource,
|
|
402
|
-
propertySchema:
|
|
461
|
+
propertySchema: PropertyShape.$schema.properties.deactivated,
|
|
403
462
|
typeFromRdf: (resourceValues) => resourceValues
|
|
404
463
|
.chain((values) => values.chainMap((value) => value.toBoolean()))
|
|
405
464
|
.map((values) => values.length > 0
|
|
406
465
|
? values.map((value) => Maybe.of(value))
|
|
407
466
|
: Resource.Values.fromValue({
|
|
408
467
|
focusResource: $parameters.resource,
|
|
409
|
-
propertyPath:
|
|
410
|
-
.
|
|
468
|
+
propertyPath: PropertyShape.$schema.properties.deactivated
|
|
469
|
+
.path,
|
|
411
470
|
value: Maybe.empty(),
|
|
412
471
|
})),
|
|
413
472
|
}).chain((deactivated) => $shaclPropertyFromRdf({
|
|
414
473
|
graph: $parameters.graph,
|
|
415
474
|
resource: $parameters.resource,
|
|
416
|
-
propertySchema:
|
|
475
|
+
propertySchema: PropertyShape.$schema.properties.defaultValue,
|
|
476
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
477
|
+
.chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
|
|
478
|
+
switch (term.termType) {
|
|
479
|
+
case "NamedNode":
|
|
480
|
+
case "Literal":
|
|
481
|
+
return Either.of(term);
|
|
482
|
+
default:
|
|
483
|
+
return Left(new Resource.MistypedTermValueError({
|
|
484
|
+
actualValue: term,
|
|
485
|
+
expectedValueType: "(NamedNode | Literal)",
|
|
486
|
+
focusResource: $parameters.resource,
|
|
487
|
+
propertyPath: PropertyShape.$schema.properties
|
|
488
|
+
.defaultValue.path,
|
|
489
|
+
}));
|
|
490
|
+
}
|
|
491
|
+
})))
|
|
492
|
+
.map((values) => values.length > 0
|
|
493
|
+
? values.map((value) => Maybe.of(value))
|
|
494
|
+
: Resource.Values.fromValue({
|
|
495
|
+
focusResource: $parameters.resource,
|
|
496
|
+
propertyPath: PropertyShape.$schema.properties
|
|
497
|
+
.defaultValue.path,
|
|
498
|
+
value: Maybe.empty(),
|
|
499
|
+
})),
|
|
500
|
+
}).chain((defaultValue) => $shaclPropertyFromRdf({
|
|
501
|
+
graph: $parameters.graph,
|
|
502
|
+
resource: $parameters.resource,
|
|
503
|
+
propertySchema: PropertyShape.$schema.properties.descriptions,
|
|
504
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
505
|
+
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
506
|
+
.chain((values) => values.chainMap((value) => value.toString()))
|
|
507
|
+
.map((values) => values.toArray())
|
|
508
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
509
|
+
focusResource: $parameters.resource,
|
|
510
|
+
propertyPath: PropertyShape.$schema.properties
|
|
511
|
+
.descriptions.path,
|
|
512
|
+
value: valuesArray,
|
|
513
|
+
})),
|
|
514
|
+
}).chain((descriptions) => $shaclPropertyFromRdf({
|
|
515
|
+
graph: $parameters.graph,
|
|
516
|
+
resource: $parameters.resource,
|
|
517
|
+
propertySchema: PropertyShape.$schema.properties.flags,
|
|
417
518
|
typeFromRdf: (resourceValues) => resourceValues
|
|
418
519
|
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
419
520
|
.chain((values) => values.chainMap((value) => value.toString()))
|
|
420
521
|
.map((values) => values.toArray())
|
|
421
522
|
.map((valuesArray) => Resource.Values.fromValue({
|
|
422
523
|
focusResource: $parameters.resource,
|
|
423
|
-
propertyPath:
|
|
524
|
+
propertyPath: PropertyShape.$schema.properties.flags
|
|
424
525
|
.path,
|
|
425
526
|
value: valuesArray,
|
|
426
527
|
})),
|
|
427
528
|
}).chain((flags) => $shaclPropertyFromRdf({
|
|
428
529
|
graph: $parameters.graph,
|
|
429
530
|
resource: $parameters.resource,
|
|
430
|
-
propertySchema:
|
|
531
|
+
propertySchema: PropertyShape.$schema.properties.groups,
|
|
532
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
533
|
+
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
534
|
+
.map((values) => values.toArray())
|
|
535
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
536
|
+
focusResource: $parameters.resource,
|
|
537
|
+
propertyPath: PropertyShape.$schema.properties.groups
|
|
538
|
+
.path,
|
|
539
|
+
value: valuesArray,
|
|
540
|
+
})),
|
|
541
|
+
}).chain((groups) => $shaclPropertyFromRdf({
|
|
542
|
+
graph: $parameters.graph,
|
|
543
|
+
resource: $parameters.resource,
|
|
544
|
+
propertySchema: PropertyShape.$schema.properties.hasValues,
|
|
431
545
|
typeFromRdf: (resourceValues) => resourceValues
|
|
432
546
|
.chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
|
|
433
547
|
switch (term.termType) {
|
|
@@ -439,28 +553,31 @@ export var BaseShaclCoreShapeStatic;
|
|
|
439
553
|
actualValue: term,
|
|
440
554
|
expectedValueType: "(NamedNode | Literal)",
|
|
441
555
|
focusResource: $parameters.resource,
|
|
442
|
-
propertyPath:
|
|
443
|
-
.properties.hasValues
|
|
556
|
+
propertyPath: PropertyShape.$schema
|
|
557
|
+
.properties.hasValues
|
|
558
|
+
.path,
|
|
444
559
|
}));
|
|
445
560
|
}
|
|
446
561
|
})))
|
|
447
562
|
.map((values) => values.toArray())
|
|
448
563
|
.map((valuesArray) => Resource.Values.fromValue({
|
|
449
564
|
focusResource: $parameters.resource,
|
|
450
|
-
propertyPath:
|
|
565
|
+
propertyPath: PropertyShape.$schema.properties
|
|
451
566
|
.hasValues.path,
|
|
452
567
|
value: valuesArray,
|
|
453
568
|
})),
|
|
454
569
|
}).chain((hasValues) => $shaclPropertyFromRdf({
|
|
455
570
|
graph: $parameters.graph,
|
|
456
571
|
resource: $parameters.resource,
|
|
457
|
-
propertySchema:
|
|
572
|
+
propertySchema: PropertyShape.$schema.properties.in_,
|
|
458
573
|
typeFromRdf: (resourceValues) => resourceValues
|
|
459
|
-
.chain((values) => values.chainMap((value) => value.toList({
|
|
574
|
+
.chain((values) => values.chainMap((value) => value.toList({
|
|
575
|
+
graph: $parameters.graph,
|
|
576
|
+
})))
|
|
460
577
|
.chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
|
|
461
578
|
focusResource: $parameters.resource,
|
|
462
|
-
propertyPath:
|
|
463
|
-
.
|
|
579
|
+
propertyPath: PropertyShape.$schema.properties
|
|
580
|
+
.in_.path,
|
|
464
581
|
values: valueList.toArray(),
|
|
465
582
|
})).chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
|
|
466
583
|
switch (term.termType) {
|
|
@@ -472,8 +589,9 @@ export var BaseShaclCoreShapeStatic;
|
|
|
472
589
|
actualValue: term,
|
|
473
590
|
expectedValueType: "(NamedNode | Literal)",
|
|
474
591
|
focusResource: $parameters.resource,
|
|
475
|
-
propertyPath:
|
|
476
|
-
.$schema
|
|
592
|
+
propertyPath: PropertyShape
|
|
593
|
+
.$schema
|
|
594
|
+
.properties.in_
|
|
477
595
|
.path,
|
|
478
596
|
}));
|
|
479
597
|
}
|
|
@@ -483,50 +601,52 @@ export var BaseShaclCoreShapeStatic;
|
|
|
483
601
|
? values.map((value) => Maybe.of(value))
|
|
484
602
|
: Resource.Values.fromValue({
|
|
485
603
|
focusResource: $parameters.resource,
|
|
486
|
-
propertyPath:
|
|
487
|
-
.
|
|
604
|
+
propertyPath: PropertyShape.$schema.properties
|
|
605
|
+
.in_.path,
|
|
488
606
|
value: Maybe.empty(),
|
|
489
607
|
})),
|
|
490
608
|
}).chain((in_) => $shaclPropertyFromRdf({
|
|
491
609
|
graph: $parameters.graph,
|
|
492
610
|
resource: $parameters.resource,
|
|
493
|
-
propertySchema:
|
|
611
|
+
propertySchema: PropertyShape.$schema.properties.isDefinedBy,
|
|
494
612
|
typeFromRdf: (resourceValues) => resourceValues
|
|
495
613
|
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
496
614
|
.map((values) => values.length > 0
|
|
497
615
|
? values.map((value) => Maybe.of(value))
|
|
498
616
|
: Resource.Values.fromValue({
|
|
499
617
|
focusResource: $parameters.resource,
|
|
500
|
-
propertyPath:
|
|
501
|
-
.properties.isDefinedBy
|
|
618
|
+
propertyPath: PropertyShape.$schema
|
|
619
|
+
.properties.isDefinedBy
|
|
620
|
+
.path,
|
|
502
621
|
value: Maybe.empty(),
|
|
503
622
|
})),
|
|
504
623
|
}).chain((isDefinedBy) => $shaclPropertyFromRdf({
|
|
505
624
|
graph: $parameters.graph,
|
|
506
625
|
resource: $parameters.resource,
|
|
507
|
-
propertySchema:
|
|
626
|
+
propertySchema: PropertyShape.$schema.properties.labels,
|
|
508
627
|
typeFromRdf: (resourceValues) => resourceValues
|
|
509
628
|
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
510
629
|
.chain((values) => values.chainMap((value) => value.toString()))
|
|
511
630
|
.map((values) => values.toArray())
|
|
512
631
|
.map((valuesArray) => Resource.Values.fromValue({
|
|
513
632
|
focusResource: $parameters.resource,
|
|
514
|
-
propertyPath:
|
|
515
|
-
.
|
|
633
|
+
propertyPath: PropertyShape.$schema.properties
|
|
634
|
+
.labels.path,
|
|
516
635
|
value: valuesArray,
|
|
517
636
|
})),
|
|
518
637
|
}).chain((labels) => $shaclPropertyFromRdf({
|
|
519
638
|
graph: $parameters.graph,
|
|
520
639
|
resource: $parameters.resource,
|
|
521
|
-
propertySchema:
|
|
640
|
+
propertySchema: PropertyShape.$schema.properties.languageIn,
|
|
522
641
|
typeFromRdf: (resourceValues) => resourceValues
|
|
523
642
|
.chain((values) => values.chainMap((value) => value.toList({
|
|
524
643
|
graph: $parameters.graph,
|
|
525
644
|
})))
|
|
526
645
|
.chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
|
|
527
646
|
focusResource: $parameters.resource,
|
|
528
|
-
propertyPath:
|
|
529
|
-
.properties.languageIn
|
|
647
|
+
propertyPath: PropertyShape.$schema
|
|
648
|
+
.properties.languageIn
|
|
649
|
+
.path,
|
|
530
650
|
values: valueList.toArray(),
|
|
531
651
|
}))
|
|
532
652
|
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
@@ -536,28 +656,30 @@ export var BaseShaclCoreShapeStatic;
|
|
|
536
656
|
? values.map((value) => Maybe.of(value))
|
|
537
657
|
: Resource.Values.fromValue({
|
|
538
658
|
focusResource: $parameters.resource,
|
|
539
|
-
propertyPath:
|
|
540
|
-
.properties.languageIn
|
|
659
|
+
propertyPath: PropertyShape.$schema
|
|
660
|
+
.properties.languageIn
|
|
661
|
+
.path,
|
|
541
662
|
value: Maybe.empty(),
|
|
542
663
|
})),
|
|
543
664
|
}).chain((languageIn) => $shaclPropertyFromRdf({
|
|
544
665
|
graph: $parameters.graph,
|
|
545
666
|
resource: $parameters.resource,
|
|
546
|
-
propertySchema:
|
|
667
|
+
propertySchema: PropertyShape.$schema.properties.maxCount,
|
|
547
668
|
typeFromRdf: (resourceValues) => resourceValues
|
|
548
669
|
.chain((values) => values.chainMap((value) => value.toInt()))
|
|
549
670
|
.map((values) => values.length > 0
|
|
550
671
|
? values.map((value) => Maybe.of(value))
|
|
551
672
|
: Resource.Values.fromValue({
|
|
552
673
|
focusResource: $parameters.resource,
|
|
553
|
-
propertyPath:
|
|
554
|
-
.properties.maxCount
|
|
674
|
+
propertyPath: PropertyShape.$schema
|
|
675
|
+
.properties.maxCount
|
|
676
|
+
.path,
|
|
555
677
|
value: Maybe.empty(),
|
|
556
678
|
})),
|
|
557
679
|
}).chain((maxCount) => $shaclPropertyFromRdf({
|
|
558
680
|
graph: $parameters.graph,
|
|
559
681
|
resource: $parameters.resource,
|
|
560
|
-
propertySchema:
|
|
682
|
+
propertySchema: PropertyShape.$schema.properties.maxExclusive,
|
|
561
683
|
typeFromRdf: (resourceValues) => resourceValues
|
|
562
684
|
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
563
685
|
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
@@ -565,14 +687,15 @@ export var BaseShaclCoreShapeStatic;
|
|
|
565
687
|
? values.map((value) => Maybe.of(value))
|
|
566
688
|
: Resource.Values.fromValue({
|
|
567
689
|
focusResource: $parameters.resource,
|
|
568
|
-
propertyPath:
|
|
569
|
-
.properties
|
|
690
|
+
propertyPath: PropertyShape.$schema
|
|
691
|
+
.properties
|
|
692
|
+
.maxExclusive.path,
|
|
570
693
|
value: Maybe.empty(),
|
|
571
694
|
})),
|
|
572
695
|
}).chain((maxExclusive) => $shaclPropertyFromRdf({
|
|
573
696
|
graph: $parameters.graph,
|
|
574
697
|
resource: $parameters.resource,
|
|
575
|
-
propertySchema:
|
|
698
|
+
propertySchema: PropertyShape.$schema.properties.maxInclusive,
|
|
576
699
|
typeFromRdf: (resourceValues) => resourceValues
|
|
577
700
|
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
578
701
|
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
@@ -580,45 +703,51 @@ export var BaseShaclCoreShapeStatic;
|
|
|
580
703
|
? values.map((value) => Maybe.of(value))
|
|
581
704
|
: Resource.Values.fromValue({
|
|
582
705
|
focusResource: $parameters.resource,
|
|
583
|
-
propertyPath:
|
|
584
|
-
.$schema
|
|
585
|
-
.
|
|
706
|
+
propertyPath: PropertyShape
|
|
707
|
+
.$schema
|
|
708
|
+
.properties
|
|
709
|
+
.maxInclusive
|
|
710
|
+
.path,
|
|
586
711
|
value: Maybe.empty(),
|
|
587
712
|
})),
|
|
588
713
|
}).chain((maxInclusive) => $shaclPropertyFromRdf({
|
|
589
714
|
graph: $parameters.graph,
|
|
590
715
|
resource: $parameters.resource,
|
|
591
|
-
propertySchema:
|
|
716
|
+
propertySchema: PropertyShape.$schema.properties.maxLength,
|
|
592
717
|
typeFromRdf: (resourceValues) => resourceValues
|
|
593
718
|
.chain((values) => values.chainMap((value) => value.toInt()))
|
|
594
719
|
.map((values) => values.length > 0
|
|
595
720
|
? values.map((value) => Maybe.of(value))
|
|
596
721
|
: Resource.Values.fromValue({
|
|
597
722
|
focusResource: $parameters.resource,
|
|
598
|
-
propertyPath:
|
|
599
|
-
.$schema
|
|
723
|
+
propertyPath: PropertyShape
|
|
724
|
+
.$schema
|
|
725
|
+
.properties
|
|
600
726
|
.maxLength.path,
|
|
601
727
|
value: Maybe.empty(),
|
|
602
728
|
})),
|
|
603
729
|
}).chain((maxLength) => $shaclPropertyFromRdf({
|
|
604
730
|
graph: $parameters.graph,
|
|
605
731
|
resource: $parameters.resource,
|
|
606
|
-
propertySchema:
|
|
732
|
+
propertySchema: PropertyShape.$schema.properties.minCount,
|
|
607
733
|
typeFromRdf: (resourceValues) => resourceValues
|
|
608
734
|
.chain((values) => values.chainMap((value) => value.toInt()))
|
|
609
735
|
.map((values) => values.length > 0
|
|
610
736
|
? values.map((value) => Maybe.of(value))
|
|
611
737
|
: Resource.Values.fromValue({
|
|
612
738
|
focusResource: $parameters.resource,
|
|
613
|
-
propertyPath:
|
|
614
|
-
.$schema
|
|
615
|
-
.
|
|
739
|
+
propertyPath: PropertyShape
|
|
740
|
+
.$schema
|
|
741
|
+
.properties
|
|
742
|
+
.minCount
|
|
743
|
+
.path,
|
|
616
744
|
value: Maybe.empty(),
|
|
617
745
|
})),
|
|
618
746
|
}).chain((minCount) => $shaclPropertyFromRdf({
|
|
619
747
|
graph: $parameters.graph,
|
|
620
748
|
resource: $parameters.resource,
|
|
621
|
-
propertySchema:
|
|
749
|
+
propertySchema: PropertyShape.$schema.properties
|
|
750
|
+
.minExclusive,
|
|
622
751
|
typeFromRdf: (resourceValues) => resourceValues
|
|
623
752
|
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
624
753
|
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
@@ -626,15 +755,18 @@ export var BaseShaclCoreShapeStatic;
|
|
|
626
755
|
? values.map((value) => Maybe.of(value))
|
|
627
756
|
: Resource.Values.fromValue({
|
|
628
757
|
focusResource: $parameters.resource,
|
|
629
|
-
propertyPath:
|
|
630
|
-
.$schema
|
|
631
|
-
.
|
|
758
|
+
propertyPath: PropertyShape
|
|
759
|
+
.$schema
|
|
760
|
+
.properties
|
|
761
|
+
.minExclusive
|
|
762
|
+
.path,
|
|
632
763
|
value: Maybe.empty(),
|
|
633
764
|
})),
|
|
634
765
|
}).chain((minExclusive) => $shaclPropertyFromRdf({
|
|
635
766
|
graph: $parameters.graph,
|
|
636
767
|
resource: $parameters.resource,
|
|
637
|
-
propertySchema:
|
|
768
|
+
propertySchema: PropertyShape.$schema.properties
|
|
769
|
+
.minInclusive,
|
|
638
770
|
typeFromRdf: (resourceValues) => resourceValues
|
|
639
771
|
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
640
772
|
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
@@ -642,31 +774,55 @@ export var BaseShaclCoreShapeStatic;
|
|
|
642
774
|
? values.map((value) => Maybe.of(value))
|
|
643
775
|
: Resource.Values.fromValue({
|
|
644
776
|
focusResource: $parameters.resource,
|
|
645
|
-
propertyPath:
|
|
646
|
-
.$schema
|
|
647
|
-
.
|
|
777
|
+
propertyPath: PropertyShape
|
|
778
|
+
.$schema
|
|
779
|
+
.properties
|
|
780
|
+
.minInclusive
|
|
781
|
+
.path,
|
|
648
782
|
value: Maybe.empty(),
|
|
649
783
|
})),
|
|
650
784
|
}).chain((minInclusive) => $shaclPropertyFromRdf({
|
|
651
785
|
graph: $parameters.graph,
|
|
652
786
|
resource: $parameters.resource,
|
|
653
|
-
propertySchema:
|
|
787
|
+
propertySchema: PropertyShape.$schema.properties
|
|
788
|
+
.minLength,
|
|
654
789
|
typeFromRdf: (resourceValues) => resourceValues
|
|
655
790
|
.chain((values) => values.chainMap((value) => value.toInt()))
|
|
656
791
|
.map((values) => values.length > 0
|
|
657
792
|
? values.map((value) => Maybe.of(value))
|
|
658
793
|
: Resource.Values.fromValue({
|
|
659
794
|
focusResource: $parameters.resource,
|
|
660
|
-
propertyPath:
|
|
795
|
+
propertyPath: PropertyShape
|
|
661
796
|
.$schema
|
|
662
797
|
.properties
|
|
663
|
-
.minLength
|
|
798
|
+
.minLength
|
|
799
|
+
.path,
|
|
664
800
|
value: Maybe.empty(),
|
|
665
801
|
})),
|
|
666
802
|
}).chain((minLength) => $shaclPropertyFromRdf({
|
|
667
803
|
graph: $parameters.graph,
|
|
668
804
|
resource: $parameters.resource,
|
|
669
|
-
propertySchema:
|
|
805
|
+
propertySchema: PropertyShape.$schema.properties
|
|
806
|
+
.names,
|
|
807
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
808
|
+
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
809
|
+
.chain((values) => values.chainMap((value) => value.toString()))
|
|
810
|
+
.map((values) => values.toArray())
|
|
811
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
812
|
+
focusResource: $parameters.resource,
|
|
813
|
+
propertyPath: PropertyShape
|
|
814
|
+
.$schema
|
|
815
|
+
.properties
|
|
816
|
+
.names
|
|
817
|
+
.path,
|
|
818
|
+
value: valuesArray,
|
|
819
|
+
})),
|
|
820
|
+
}).chain((names) => $shaclPropertyFromRdf({
|
|
821
|
+
graph: $parameters.graph,
|
|
822
|
+
resource: $parameters.resource,
|
|
823
|
+
propertySchema: PropertyShape.$schema
|
|
824
|
+
.properties
|
|
825
|
+
.nodeKind,
|
|
670
826
|
typeFromRdf: (resourceValues) => resourceValues
|
|
671
827
|
.chain((values) => values.chainMap((value) => value.toIri([
|
|
672
828
|
dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNode"),
|
|
@@ -676,57 +832,67 @@ export var BaseShaclCoreShapeStatic;
|
|
|
676
832
|
dataFactory.namedNode("http://www.w3.org/ns/shacl#IRIOrLiteral"),
|
|
677
833
|
dataFactory.namedNode("http://www.w3.org/ns/shacl#Literal"),
|
|
678
834
|
])))
|
|
679
|
-
.map((values) => values.length >
|
|
835
|
+
.map((values) => values.length >
|
|
836
|
+
0
|
|
680
837
|
? values.map((value) => Maybe.of(value))
|
|
681
838
|
: Resource.Values.fromValue({
|
|
682
839
|
focusResource: $parameters.resource,
|
|
683
|
-
propertyPath:
|
|
840
|
+
propertyPath: PropertyShape
|
|
684
841
|
.$schema
|
|
685
842
|
.properties
|
|
686
|
-
.nodeKind
|
|
843
|
+
.nodeKind
|
|
844
|
+
.path,
|
|
687
845
|
value: Maybe.empty(),
|
|
688
846
|
})),
|
|
689
847
|
}).chain((nodeKind) => $shaclPropertyFromRdf({
|
|
690
848
|
graph: $parameters.graph,
|
|
691
849
|
resource: $parameters.resource,
|
|
692
|
-
propertySchema:
|
|
850
|
+
propertySchema: PropertyShape.$schema
|
|
851
|
+
.properties
|
|
852
|
+
.nodes,
|
|
693
853
|
typeFromRdf: (resourceValues) => resourceValues
|
|
694
854
|
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
695
855
|
.map((values) => values.toArray())
|
|
696
856
|
.map((valuesArray) => Resource.Values.fromValue({
|
|
697
857
|
focusResource: $parameters.resource,
|
|
698
|
-
propertyPath:
|
|
858
|
+
propertyPath: PropertyShape
|
|
699
859
|
.$schema
|
|
700
860
|
.properties
|
|
701
|
-
.nodes
|
|
861
|
+
.nodes
|
|
862
|
+
.path,
|
|
702
863
|
value: valuesArray,
|
|
703
864
|
})),
|
|
704
865
|
}).chain((nodes) => $shaclPropertyFromRdf({
|
|
705
866
|
graph: $parameters.graph,
|
|
706
867
|
resource: $parameters.resource,
|
|
707
|
-
propertySchema:
|
|
868
|
+
propertySchema: PropertyShape.$schema
|
|
869
|
+
.properties
|
|
870
|
+
.not,
|
|
708
871
|
typeFromRdf: (resourceValues) => resourceValues
|
|
709
872
|
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
710
873
|
.map((values) => values.toArray())
|
|
711
874
|
.map((valuesArray) => Resource.Values.fromValue({
|
|
712
875
|
focusResource: $parameters.resource,
|
|
713
|
-
propertyPath:
|
|
876
|
+
propertyPath: PropertyShape
|
|
714
877
|
.$schema
|
|
715
878
|
.properties
|
|
716
|
-
.not
|
|
879
|
+
.not
|
|
880
|
+
.path,
|
|
717
881
|
value: valuesArray,
|
|
718
882
|
})),
|
|
719
883
|
}).chain((not) => $shaclPropertyFromRdf({
|
|
720
884
|
graph: $parameters.graph,
|
|
721
885
|
resource: $parameters.resource,
|
|
722
|
-
propertySchema:
|
|
886
|
+
propertySchema: PropertyShape.$schema
|
|
887
|
+
.properties
|
|
888
|
+
.or,
|
|
723
889
|
typeFromRdf: (resourceValues) => resourceValues
|
|
724
890
|
.chain((values) => values.chainMap((value) => value.toList({
|
|
725
891
|
graph: $parameters.graph,
|
|
726
892
|
})))
|
|
727
893
|
.chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
|
|
728
894
|
focusResource: $parameters.resource,
|
|
729
|
-
propertyPath:
|
|
895
|
+
propertyPath: PropertyShape
|
|
730
896
|
.$schema
|
|
731
897
|
.properties
|
|
732
898
|
.or
|
|
@@ -737,16 +903,52 @@ export var BaseShaclCoreShapeStatic;
|
|
|
737
903
|
.map((values) => values.toArray())
|
|
738
904
|
.map((valuesArray) => Resource.Values.fromValue({
|
|
739
905
|
focusResource: $parameters.resource,
|
|
740
|
-
propertyPath:
|
|
906
|
+
propertyPath: PropertyShape
|
|
741
907
|
.$schema
|
|
742
908
|
.properties
|
|
743
|
-
.or
|
|
909
|
+
.or
|
|
910
|
+
.path,
|
|
744
911
|
value: valuesArray,
|
|
745
912
|
})),
|
|
746
913
|
}).chain((or) => $shaclPropertyFromRdf({
|
|
747
914
|
graph: $parameters.graph,
|
|
748
915
|
resource: $parameters.resource,
|
|
749
|
-
propertySchema:
|
|
916
|
+
propertySchema: PropertyShape.$schema
|
|
917
|
+
.properties
|
|
918
|
+
.order,
|
|
919
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
920
|
+
.chain((values) => values.chainMap((value) => value.toFloat()))
|
|
921
|
+
.map((values) => values.length >
|
|
922
|
+
0
|
|
923
|
+
? values.map((value) => Maybe.of(value))
|
|
924
|
+
: Resource.Values.fromValue({
|
|
925
|
+
focusResource: $parameters.resource,
|
|
926
|
+
propertyPath: PropertyShape
|
|
927
|
+
.$schema
|
|
928
|
+
.properties
|
|
929
|
+
.order
|
|
930
|
+
.path,
|
|
931
|
+
value: Maybe.empty(),
|
|
932
|
+
})),
|
|
933
|
+
}).chain((order) => $shaclPropertyFromRdf({
|
|
934
|
+
graph: $parameters.graph,
|
|
935
|
+
resource: $parameters.resource,
|
|
936
|
+
propertySchema: PropertyShape.$schema
|
|
937
|
+
.properties
|
|
938
|
+
.path,
|
|
939
|
+
typeFromRdf: (resourceValues) => resourceValues.chain((values) => values.chainMap((value) => value
|
|
940
|
+
.toResource()
|
|
941
|
+
.chain((resource) => PropertyPath.$fromRdf(resource, {
|
|
942
|
+
context: $parameters.context,
|
|
943
|
+
ignoreRdfType: true,
|
|
944
|
+
objectSet: $parameters.objectSet,
|
|
945
|
+
preferredLanguages: $parameters.preferredLanguages,
|
|
946
|
+
})))),
|
|
947
|
+
}).chain((path) => $shaclPropertyFromRdf({
|
|
948
|
+
graph: $parameters.graph,
|
|
949
|
+
resource: $parameters.resource,
|
|
950
|
+
propertySchema: PropertyShape.$schema
|
|
951
|
+
.properties
|
|
750
952
|
.patterns,
|
|
751
953
|
typeFromRdf: (resourceValues) => resourceValues
|
|
752
954
|
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
@@ -754,7 +956,7 @@ export var BaseShaclCoreShapeStatic;
|
|
|
754
956
|
.map((values) => values.toArray())
|
|
755
957
|
.map((valuesArray) => Resource.Values.fromValue({
|
|
756
958
|
focusResource: $parameters.resource,
|
|
757
|
-
propertyPath:
|
|
959
|
+
propertyPath: PropertyShape
|
|
758
960
|
.$schema
|
|
759
961
|
.properties
|
|
760
962
|
.patterns
|
|
@@ -764,7 +966,28 @@ export var BaseShaclCoreShapeStatic;
|
|
|
764
966
|
}).chain((patterns) => $shaclPropertyFromRdf({
|
|
765
967
|
graph: $parameters.graph,
|
|
766
968
|
resource: $parameters.resource,
|
|
767
|
-
propertySchema:
|
|
969
|
+
propertySchema: PropertyShape.$schema
|
|
970
|
+
.properties
|
|
971
|
+
.uniqueLang,
|
|
972
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
973
|
+
.chain((values) => values.chainMap((value) => value.toBoolean()))
|
|
974
|
+
.map((values) => values.length >
|
|
975
|
+
0
|
|
976
|
+
? values.map((value) => Maybe.of(value))
|
|
977
|
+
: Resource.Values.fromValue({
|
|
978
|
+
focusResource: $parameters.resource,
|
|
979
|
+
propertyPath: PropertyShape
|
|
980
|
+
.$schema
|
|
981
|
+
.properties
|
|
982
|
+
.uniqueLang
|
|
983
|
+
.path,
|
|
984
|
+
value: Maybe.empty(),
|
|
985
|
+
})),
|
|
986
|
+
}).chain((uniqueLang) => $shaclPropertyFromRdf({
|
|
987
|
+
graph: $parameters.graph,
|
|
988
|
+
resource: $parameters.resource,
|
|
989
|
+
propertySchema: PropertyShape.$schema
|
|
990
|
+
.properties
|
|
768
991
|
.xone,
|
|
769
992
|
typeFromRdf: (resourceValues) => resourceValues
|
|
770
993
|
.chain((values) => values.chainMap((value) => value.toList({
|
|
@@ -772,7 +995,7 @@ export var BaseShaclCoreShapeStatic;
|
|
|
772
995
|
})))
|
|
773
996
|
.chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
|
|
774
997
|
focusResource: $parameters.resource,
|
|
775
|
-
propertyPath:
|
|
998
|
+
propertyPath: PropertyShape
|
|
776
999
|
.$schema
|
|
777
1000
|
.properties
|
|
778
1001
|
.xone
|
|
@@ -783,7 +1006,7 @@ export var BaseShaclCoreShapeStatic;
|
|
|
783
1006
|
.map((values) => values.toArray())
|
|
784
1007
|
.map((valuesArray) => Resource.Values.fromValue({
|
|
785
1008
|
focusResource: $parameters.resource,
|
|
786
|
-
propertyPath:
|
|
1009
|
+
propertyPath: PropertyShape
|
|
787
1010
|
.$schema
|
|
788
1011
|
.properties
|
|
789
1012
|
.xone
|
|
@@ -792,12 +1015,16 @@ export var BaseShaclCoreShapeStatic;
|
|
|
792
1015
|
})),
|
|
793
1016
|
}).map((xone) => ({
|
|
794
1017
|
$identifier,
|
|
1018
|
+
$type,
|
|
795
1019
|
and,
|
|
796
1020
|
classes,
|
|
797
1021
|
comments,
|
|
798
1022
|
datatype,
|
|
799
1023
|
deactivated,
|
|
1024
|
+
defaultValue,
|
|
1025
|
+
descriptions,
|
|
800
1026
|
flags,
|
|
1027
|
+
groups,
|
|
801
1028
|
hasValues,
|
|
802
1029
|
in_,
|
|
803
1030
|
isDefinedBy,
|
|
@@ -811,181 +1038,20 @@ export var BaseShaclCoreShapeStatic;
|
|
|
811
1038
|
minExclusive,
|
|
812
1039
|
minInclusive,
|
|
813
1040
|
minLength,
|
|
1041
|
+
names,
|
|
814
1042
|
nodeKind,
|
|
815
1043
|
nodes,
|
|
816
1044
|
not,
|
|
817
1045
|
or,
|
|
1046
|
+
order,
|
|
1047
|
+
path,
|
|
818
1048
|
patterns,
|
|
1049
|
+
uniqueLang,
|
|
819
1050
|
xone,
|
|
820
|
-
})))))))))))))))))))))))))));
|
|
1051
|
+
}))))))))))))))))))))))))))))))))))));
|
|
821
1052
|
}
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
const resourceSet = options?.resourceSet ??
|
|
825
|
-
new ResourceSet(datasetFactory.dataset(), { dataFactory: dataFactory });
|
|
826
|
-
const resource = resourceSet.resource(_baseShaclCoreShape.$identifier);
|
|
827
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#and"), _baseShaclCoreShape.and.flatMap((item) => [
|
|
828
|
-
item.length > 0
|
|
829
|
-
? item.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
830
|
-
if (itemIndex === 0) {
|
|
831
|
-
currentSubListResource = listResource;
|
|
832
|
-
}
|
|
833
|
-
else {
|
|
834
|
-
const newSubListResource = resourceSet.resource(dataFactory.blankNode());
|
|
835
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
|
|
836
|
-
currentSubListResource = newSubListResource;
|
|
837
|
-
}
|
|
838
|
-
currentSubListResource.add($RdfVocabularies.rdf.first, [item], options?.graph);
|
|
839
|
-
if (itemIndex + 1 === list.length) {
|
|
840
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
|
|
841
|
-
}
|
|
842
|
-
return { currentSubListResource, listResource };
|
|
843
|
-
}, {
|
|
844
|
-
currentSubListResource: null,
|
|
845
|
-
listResource: resourceSet.resource(dataFactory.blankNode()),
|
|
846
|
-
}).listResource.identifier
|
|
847
|
-
: $RdfVocabularies.rdf.nil,
|
|
848
|
-
]), options?.graph);
|
|
849
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#class"), _baseShaclCoreShape.classes.flatMap((item) => [item]), options?.graph);
|
|
850
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), _baseShaclCoreShape.comments.flatMap((item) => [
|
|
851
|
-
$literalFactory.string(item),
|
|
852
|
-
]), options?.graph);
|
|
853
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#datatype"), _baseShaclCoreShape.datatype.toList(), options?.graph);
|
|
854
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"), _baseShaclCoreShape.deactivated
|
|
855
|
-
.toList()
|
|
856
|
-
.flatMap((value) => [
|
|
857
|
-
$literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
|
|
858
|
-
]), options?.graph);
|
|
859
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#flags"), _baseShaclCoreShape.flags.flatMap((item) => [
|
|
860
|
-
$literalFactory.string(item),
|
|
861
|
-
]), options?.graph);
|
|
862
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#hasValue"), _baseShaclCoreShape.hasValues.flatMap((item) => [item]), options?.graph);
|
|
863
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#in"), _baseShaclCoreShape.in_.toList().flatMap((value) => [
|
|
864
|
-
value.length > 0
|
|
865
|
-
? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
866
|
-
if (itemIndex === 0) {
|
|
867
|
-
currentSubListResource = listResource;
|
|
868
|
-
}
|
|
869
|
-
else {
|
|
870
|
-
const newSubListResource = resourceSet.resource(dataFactory.blankNode());
|
|
871
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
|
|
872
|
-
currentSubListResource = newSubListResource;
|
|
873
|
-
}
|
|
874
|
-
currentSubListResource.add($RdfVocabularies.rdf.first, [item], options?.graph);
|
|
875
|
-
if (itemIndex + 1 === list.length) {
|
|
876
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
|
|
877
|
-
}
|
|
878
|
-
return { currentSubListResource, listResource };
|
|
879
|
-
}, {
|
|
880
|
-
currentSubListResource: null,
|
|
881
|
-
listResource: resourceSet.resource(dataFactory.blankNode()),
|
|
882
|
-
}).listResource.identifier
|
|
883
|
-
: $RdfVocabularies.rdf.nil,
|
|
884
|
-
]), options?.graph);
|
|
885
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"), _baseShaclCoreShape.isDefinedBy.toList(), options?.graph);
|
|
886
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), _baseShaclCoreShape.labels.flatMap((item) => [
|
|
887
|
-
$literalFactory.string(item),
|
|
888
|
-
]), options?.graph);
|
|
889
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#languageIn"), _baseShaclCoreShape.languageIn.toList().flatMap((value) => [
|
|
890
|
-
value.length > 0
|
|
891
|
-
? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
892
|
-
if (itemIndex === 0) {
|
|
893
|
-
currentSubListResource = listResource;
|
|
894
|
-
}
|
|
895
|
-
else {
|
|
896
|
-
const newSubListResource = resourceSet.resource(dataFactory.blankNode());
|
|
897
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
|
|
898
|
-
currentSubListResource = newSubListResource;
|
|
899
|
-
}
|
|
900
|
-
currentSubListResource.add($RdfVocabularies.rdf.first, [$literalFactory.string(item)], options?.graph);
|
|
901
|
-
if (itemIndex + 1 === list.length) {
|
|
902
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
|
|
903
|
-
}
|
|
904
|
-
return { currentSubListResource, listResource };
|
|
905
|
-
}, {
|
|
906
|
-
currentSubListResource: null,
|
|
907
|
-
listResource: resourceSet.resource(dataFactory.blankNode()),
|
|
908
|
-
}).listResource.identifier
|
|
909
|
-
: $RdfVocabularies.rdf.nil,
|
|
910
|
-
]), options?.graph);
|
|
911
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxCount"), _baseShaclCoreShape.maxCount
|
|
912
|
-
.toList()
|
|
913
|
-
.flatMap((value) => [
|
|
914
|
-
$literalFactory.number(value, $RdfVocabularies.xsd.unsignedInt),
|
|
915
|
-
]), options?.graph);
|
|
916
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxExclusive"), _baseShaclCoreShape.maxExclusive.toList(), options?.graph);
|
|
917
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxInclusive"), _baseShaclCoreShape.maxInclusive.toList(), options?.graph);
|
|
918
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxLength"), _baseShaclCoreShape.maxLength
|
|
919
|
-
.toList()
|
|
920
|
-
.flatMap((value) => [
|
|
921
|
-
$literalFactory.number(value, $RdfVocabularies.xsd.unsignedInt),
|
|
922
|
-
]), options?.graph);
|
|
923
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minCount"), _baseShaclCoreShape.minCount
|
|
924
|
-
.toList()
|
|
925
|
-
.flatMap((value) => [
|
|
926
|
-
$literalFactory.number(value, $RdfVocabularies.xsd.unsignedInt),
|
|
927
|
-
]), options?.graph);
|
|
928
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minExclusive"), _baseShaclCoreShape.minExclusive.toList(), options?.graph);
|
|
929
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minInclusive"), _baseShaclCoreShape.minInclusive.toList(), options?.graph);
|
|
930
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minLength"), _baseShaclCoreShape.minLength
|
|
931
|
-
.toList()
|
|
932
|
-
.flatMap((value) => [
|
|
933
|
-
$literalFactory.number(value, $RdfVocabularies.xsd.unsignedInt),
|
|
934
|
-
]), options?.graph);
|
|
935
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"), _baseShaclCoreShape.nodeKind.toList(), options?.graph);
|
|
936
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#node"), _baseShaclCoreShape.nodes.flatMap((item) => [item]), options?.graph);
|
|
937
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#not"), _baseShaclCoreShape.not.flatMap((item) => [item]), options?.graph);
|
|
938
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#or"), _baseShaclCoreShape.or.flatMap((item) => [
|
|
939
|
-
item.length > 0
|
|
940
|
-
? item.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
941
|
-
if (itemIndex === 0) {
|
|
942
|
-
currentSubListResource = listResource;
|
|
943
|
-
}
|
|
944
|
-
else {
|
|
945
|
-
const newSubListResource = resourceSet.resource(dataFactory.blankNode());
|
|
946
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
|
|
947
|
-
currentSubListResource = newSubListResource;
|
|
948
|
-
}
|
|
949
|
-
currentSubListResource.add($RdfVocabularies.rdf.first, [item], options?.graph);
|
|
950
|
-
if (itemIndex + 1 === list.length) {
|
|
951
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
|
|
952
|
-
}
|
|
953
|
-
return { currentSubListResource, listResource };
|
|
954
|
-
}, {
|
|
955
|
-
currentSubListResource: null,
|
|
956
|
-
listResource: resourceSet.resource(dataFactory.blankNode()),
|
|
957
|
-
}).listResource.identifier
|
|
958
|
-
: $RdfVocabularies.rdf.nil,
|
|
959
|
-
]), options?.graph);
|
|
960
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#pattern"), _baseShaclCoreShape.patterns.flatMap((item) => [
|
|
961
|
-
$literalFactory.string(item),
|
|
962
|
-
]), options?.graph);
|
|
963
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#xone"), _baseShaclCoreShape.xone.flatMap((item) => [
|
|
964
|
-
item.length > 0
|
|
965
|
-
? item.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
966
|
-
if (itemIndex === 0) {
|
|
967
|
-
currentSubListResource = listResource;
|
|
968
|
-
}
|
|
969
|
-
else {
|
|
970
|
-
const newSubListResource = resourceSet.resource(dataFactory.blankNode());
|
|
971
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
|
|
972
|
-
currentSubListResource = newSubListResource;
|
|
973
|
-
}
|
|
974
|
-
currentSubListResource.add($RdfVocabularies.rdf.first, [item], options?.graph);
|
|
975
|
-
if (itemIndex + 1 === list.length) {
|
|
976
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
|
|
977
|
-
}
|
|
978
|
-
return { currentSubListResource, listResource };
|
|
979
|
-
}, {
|
|
980
|
-
currentSubListResource: null,
|
|
981
|
-
listResource: resourceSet.resource(dataFactory.blankNode()),
|
|
982
|
-
}).listResource.identifier
|
|
983
|
-
: $RdfVocabularies.rdf.nil,
|
|
984
|
-
]), options?.graph);
|
|
985
|
-
return resource;
|
|
986
|
-
}
|
|
987
|
-
BaseShaclCoreShapeStatic.$toRdf = $toRdf;
|
|
988
|
-
BaseShaclCoreShapeStatic.$schema = {
|
|
1053
|
+
PropertyShape.$propertiesFromRdf = $propertiesFromRdf;
|
|
1054
|
+
PropertyShape.$schema = {
|
|
989
1055
|
properties: {
|
|
990
1056
|
$identifier: {
|
|
991
1057
|
kind: "Identifier",
|
|
@@ -994,8 +1060,8 @@ export var BaseShaclCoreShapeStatic;
|
|
|
994
1060
|
$type: {
|
|
995
1061
|
kind: "TypeDiscriminant",
|
|
996
1062
|
type: () => ({
|
|
997
|
-
descendantValues: ["ShaclCoreNodeShape", "ShaclCorePropertyShape"],
|
|
998
1063
|
kind: "TypeDiscriminant",
|
|
1064
|
+
ownValues: ["PropertyShape"],
|
|
999
1065
|
}),
|
|
1000
1066
|
},
|
|
1001
1067
|
and: {
|
|
@@ -1041,6 +1107,22 @@ export var BaseShaclCoreShapeStatic;
|
|
|
1041
1107
|
}),
|
|
1042
1108
|
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"),
|
|
1043
1109
|
},
|
|
1110
|
+
defaultValue: {
|
|
1111
|
+
kind: "Shacl",
|
|
1112
|
+
type: () => ({
|
|
1113
|
+
kind: "Maybe",
|
|
1114
|
+
item: () => ({ kind: "Term" }),
|
|
1115
|
+
}),
|
|
1116
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#defaultValue"),
|
|
1117
|
+
},
|
|
1118
|
+
descriptions: {
|
|
1119
|
+
kind: "Shacl",
|
|
1120
|
+
type: () => ({
|
|
1121
|
+
kind: "Set",
|
|
1122
|
+
item: () => ({ kind: "String" }),
|
|
1123
|
+
}),
|
|
1124
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#description"),
|
|
1125
|
+
},
|
|
1044
1126
|
flags: {
|
|
1045
1127
|
kind: "Shacl",
|
|
1046
1128
|
type: () => ({
|
|
@@ -1049,6 +1131,14 @@ export var BaseShaclCoreShapeStatic;
|
|
|
1049
1131
|
}),
|
|
1050
1132
|
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#flags"),
|
|
1051
1133
|
},
|
|
1134
|
+
groups: {
|
|
1135
|
+
kind: "Shacl",
|
|
1136
|
+
type: () => ({
|
|
1137
|
+
kind: "Set",
|
|
1138
|
+
item: () => ({ kind: "Identifier" }),
|
|
1139
|
+
}),
|
|
1140
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#group"),
|
|
1141
|
+
},
|
|
1052
1142
|
hasValues: {
|
|
1053
1143
|
kind: "Shacl",
|
|
1054
1144
|
type: () => ({
|
|
@@ -1159,6 +1249,14 @@ export var BaseShaclCoreShapeStatic;
|
|
|
1159
1249
|
}),
|
|
1160
1250
|
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minLength"),
|
|
1161
1251
|
},
|
|
1252
|
+
names: {
|
|
1253
|
+
kind: "Shacl",
|
|
1254
|
+
type: () => ({
|
|
1255
|
+
kind: "Set",
|
|
1256
|
+
item: () => ({ kind: "String" }),
|
|
1257
|
+
}),
|
|
1258
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#name"),
|
|
1259
|
+
},
|
|
1162
1260
|
nodeKind: {
|
|
1163
1261
|
kind: "Shacl",
|
|
1164
1262
|
type: () => ({
|
|
@@ -1204,6 +1302,19 @@ export var BaseShaclCoreShapeStatic;
|
|
|
1204
1302
|
}),
|
|
1205
1303
|
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#or"),
|
|
1206
1304
|
},
|
|
1305
|
+
order: {
|
|
1306
|
+
kind: "Shacl",
|
|
1307
|
+
type: () => ({
|
|
1308
|
+
kind: "Maybe",
|
|
1309
|
+
item: () => ({ kind: "Float" }),
|
|
1310
|
+
}),
|
|
1311
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#order"),
|
|
1312
|
+
},
|
|
1313
|
+
path: {
|
|
1314
|
+
kind: "Shacl",
|
|
1315
|
+
type: () => PropertyPath.$schema,
|
|
1316
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#path"),
|
|
1317
|
+
},
|
|
1207
1318
|
patterns: {
|
|
1208
1319
|
kind: "Shacl",
|
|
1209
1320
|
type: () => ({
|
|
@@ -1212,6 +1323,14 @@ export var BaseShaclCoreShapeStatic;
|
|
|
1212
1323
|
}),
|
|
1213
1324
|
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#pattern"),
|
|
1214
1325
|
},
|
|
1326
|
+
uniqueLang: {
|
|
1327
|
+
kind: "Shacl",
|
|
1328
|
+
type: () => ({
|
|
1329
|
+
kind: "Maybe",
|
|
1330
|
+
item: () => ({ kind: "Boolean" }),
|
|
1331
|
+
}),
|
|
1332
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#uniqueLang"),
|
|
1333
|
+
},
|
|
1215
1334
|
xone: {
|
|
1216
1335
|
kind: "Shacl",
|
|
1217
1336
|
type: () => ({
|
|
@@ -1225,321 +1344,196 @@ export var BaseShaclCoreShapeStatic;
|
|
|
1225
1344
|
},
|
|
1226
1345
|
},
|
|
1227
1346
|
};
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
if (!
|
|
1233
|
-
|
|
1234
|
-
}
|
|
1235
|
-
if (filter.defaultValue !== undefined &&
|
|
1236
|
-
!$filterMaybe($filterTerm)(filter.defaultValue, value.defaultValue)) {
|
|
1237
|
-
return false;
|
|
1238
|
-
}
|
|
1239
|
-
if (filter.descriptions !== undefined &&
|
|
1240
|
-
!$filterArray($filterString)(filter.descriptions, value.descriptions)) {
|
|
1241
|
-
return false;
|
|
1242
|
-
}
|
|
1243
|
-
if (filter.groups !== undefined &&
|
|
1244
|
-
!$filterArray($filterIdentifier)(filter.groups, value.groups)) {
|
|
1245
|
-
return false;
|
|
1246
|
-
}
|
|
1247
|
-
if (filter.names !== undefined &&
|
|
1248
|
-
!$filterArray($filterString)(filter.names, value.names)) {
|
|
1249
|
-
return false;
|
|
1250
|
-
}
|
|
1251
|
-
if (filter.order !== undefined &&
|
|
1252
|
-
!$filterMaybe(($filterNumeric))(filter.order, value.order)) {
|
|
1253
|
-
return false;
|
|
1254
|
-
}
|
|
1255
|
-
if (filter.path !== undefined &&
|
|
1256
|
-
!PropertyPath.$filter(filter.path, value.path)) {
|
|
1257
|
-
return false;
|
|
1258
|
-
}
|
|
1259
|
-
if (filter.uniqueLang !== undefined &&
|
|
1260
|
-
!$filterMaybe($filterBoolean)(filter.uniqueLang, value.uniqueLang)) {
|
|
1261
|
-
return false;
|
|
1262
|
-
}
|
|
1263
|
-
return true;
|
|
1264
|
-
}
|
|
1265
|
-
ShaclCorePropertyShape.$filter = $filter;
|
|
1266
|
-
ShaclCorePropertyShape.$fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape");
|
|
1267
|
-
let $Identifier;
|
|
1268
|
-
(function ($Identifier) {
|
|
1269
|
-
$Identifier.fromString = $identifierFromString; // biome-ignore lint/suspicious/noShadowRestrictedNames: allow toString
|
|
1270
|
-
$Identifier.toString = Resource.Identifier.toString;
|
|
1271
|
-
})($Identifier = ShaclCorePropertyShape.$Identifier || (ShaclCorePropertyShape.$Identifier = {}));
|
|
1272
|
-
function isShaclCorePropertyShape(object) {
|
|
1273
|
-
switch (object.$type) {
|
|
1274
|
-
case "ShaclCorePropertyShape":
|
|
1275
|
-
return true;
|
|
1276
|
-
default:
|
|
1277
|
-
return false;
|
|
1278
|
-
}
|
|
1279
|
-
}
|
|
1280
|
-
ShaclCorePropertyShape.isShaclCorePropertyShape = isShaclCorePropertyShape;
|
|
1281
|
-
function $fromRdf(resource, options) {
|
|
1282
|
-
let { context, ignoreRdfType = false, objectSet, preferredLanguages, } = options ?? {};
|
|
1283
|
-
if (!objectSet) {
|
|
1284
|
-
objectSet = new $RdfjsDatasetObjectSet(resource.dataset);
|
|
1347
|
+
function $toRdf(_propertyShape, options) {
|
|
1348
|
+
const resourceSet = options?.resourceSet ??
|
|
1349
|
+
new ResourceSet(datasetFactory.dataset(), { dataFactory: dataFactory });
|
|
1350
|
+
const resource = resourceSet.resource(_propertyShape.$identifier);
|
|
1351
|
+
if (!options?.ignoreRdfType) {
|
|
1352
|
+
resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"), options?.graph);
|
|
1285
1353
|
}
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
: Right(true)).chain((_rdfTypeCheck) => Right(new Resource.Value({
|
|
1316
|
-
dataFactory: dataFactory,
|
|
1317
|
-
focusResource: $parameters.resource,
|
|
1318
|
-
propertyPath: $RdfVocabularies.rdf.subject,
|
|
1319
|
-
term: $parameters.resource.identifier,
|
|
1320
|
-
}).toValues())
|
|
1321
|
-
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
1322
|
-
.chain((values) => values.head())
|
|
1323
|
-
.chain(($identifier) => Right("ShaclCorePropertyShape").chain(($type) => $shaclPropertyFromRdf({
|
|
1324
|
-
graph: $parameters.graph,
|
|
1325
|
-
resource: $parameters.resource,
|
|
1326
|
-
propertySchema: ShaclCorePropertyShape.$schema.properties.defaultValue,
|
|
1327
|
-
typeFromRdf: (resourceValues) => resourceValues
|
|
1328
|
-
.chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
|
|
1329
|
-
switch (term.termType) {
|
|
1330
|
-
case "NamedNode":
|
|
1331
|
-
case "Literal":
|
|
1332
|
-
return Either.of(term);
|
|
1333
|
-
default:
|
|
1334
|
-
return Left(new Resource.MistypedTermValueError({
|
|
1335
|
-
actualValue: term,
|
|
1336
|
-
expectedValueType: "(NamedNode | Literal)",
|
|
1337
|
-
focusResource: $parameters.resource,
|
|
1338
|
-
propertyPath: ShaclCorePropertyShape.$schema.properties
|
|
1339
|
-
.defaultValue.path,
|
|
1340
|
-
}));
|
|
1341
|
-
}
|
|
1342
|
-
})))
|
|
1343
|
-
.map((values) => values.length > 0
|
|
1344
|
-
? values.map((value) => Maybe.of(value))
|
|
1345
|
-
: Resource.Values.fromValue({
|
|
1346
|
-
focusResource: $parameters.resource,
|
|
1347
|
-
propertyPath: ShaclCorePropertyShape.$schema.properties
|
|
1348
|
-
.defaultValue.path,
|
|
1349
|
-
value: Maybe.empty(),
|
|
1350
|
-
})),
|
|
1351
|
-
}).chain((defaultValue) => $shaclPropertyFromRdf({
|
|
1352
|
-
graph: $parameters.graph,
|
|
1353
|
-
resource: $parameters.resource,
|
|
1354
|
-
propertySchema: ShaclCorePropertyShape.$schema.properties.descriptions,
|
|
1355
|
-
typeFromRdf: (resourceValues) => resourceValues
|
|
1356
|
-
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
1357
|
-
.chain((values) => values.chainMap((value) => value.toString()))
|
|
1358
|
-
.map((values) => values.toArray())
|
|
1359
|
-
.map((valuesArray) => Resource.Values.fromValue({
|
|
1360
|
-
focusResource: $parameters.resource,
|
|
1361
|
-
propertyPath: ShaclCorePropertyShape.$schema.properties
|
|
1362
|
-
.descriptions.path,
|
|
1363
|
-
value: valuesArray,
|
|
1364
|
-
})),
|
|
1365
|
-
}).chain((descriptions) => $shaclPropertyFromRdf({
|
|
1366
|
-
graph: $parameters.graph,
|
|
1367
|
-
resource: $parameters.resource,
|
|
1368
|
-
propertySchema: ShaclCorePropertyShape.$schema.properties.groups,
|
|
1369
|
-
typeFromRdf: (resourceValues) => resourceValues
|
|
1370
|
-
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
1371
|
-
.map((values) => values.toArray())
|
|
1372
|
-
.map((valuesArray) => Resource.Values.fromValue({
|
|
1373
|
-
focusResource: $parameters.resource,
|
|
1374
|
-
propertyPath: ShaclCorePropertyShape.$schema.properties.groups
|
|
1375
|
-
.path,
|
|
1376
|
-
value: valuesArray,
|
|
1377
|
-
})),
|
|
1378
|
-
}).chain((groups) => $shaclPropertyFromRdf({
|
|
1379
|
-
graph: $parameters.graph,
|
|
1380
|
-
resource: $parameters.resource,
|
|
1381
|
-
propertySchema: ShaclCorePropertyShape.$schema.properties.names,
|
|
1382
|
-
typeFromRdf: (resourceValues) => resourceValues
|
|
1383
|
-
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
1384
|
-
.chain((values) => values.chainMap((value) => value.toString()))
|
|
1385
|
-
.map((values) => values.toArray())
|
|
1386
|
-
.map((valuesArray) => Resource.Values.fromValue({
|
|
1387
|
-
focusResource: $parameters.resource,
|
|
1388
|
-
propertyPath: ShaclCorePropertyShape.$schema.properties.names
|
|
1389
|
-
.path,
|
|
1390
|
-
value: valuesArray,
|
|
1391
|
-
})),
|
|
1392
|
-
}).chain((names) => $shaclPropertyFromRdf({
|
|
1393
|
-
graph: $parameters.graph,
|
|
1394
|
-
resource: $parameters.resource,
|
|
1395
|
-
propertySchema: ShaclCorePropertyShape.$schema.properties.order,
|
|
1396
|
-
typeFromRdf: (resourceValues) => resourceValues
|
|
1397
|
-
.chain((values) => values.chainMap((value) => value.toFloat()))
|
|
1398
|
-
.map((values) => values.length > 0
|
|
1399
|
-
? values.map((value) => Maybe.of(value))
|
|
1400
|
-
: Resource.Values.fromValue({
|
|
1401
|
-
focusResource: $parameters.resource,
|
|
1402
|
-
propertyPath: ShaclCorePropertyShape.$schema.properties
|
|
1403
|
-
.order.path,
|
|
1404
|
-
value: Maybe.empty(),
|
|
1405
|
-
})),
|
|
1406
|
-
}).chain((order) => $shaclPropertyFromRdf({
|
|
1407
|
-
graph: $parameters.graph,
|
|
1408
|
-
resource: $parameters.resource,
|
|
1409
|
-
propertySchema: ShaclCorePropertyShape.$schema.properties.path,
|
|
1410
|
-
typeFromRdf: (resourceValues) => resourceValues.chain((values) => values.chainMap((value) => value.toResource().chain((resource) => PropertyPath.$fromRdf(resource, {
|
|
1411
|
-
context: $parameters.context,
|
|
1412
|
-
ignoreRdfType: true,
|
|
1413
|
-
objectSet: $parameters.objectSet,
|
|
1414
|
-
preferredLanguages: $parameters.preferredLanguages,
|
|
1415
|
-
})))),
|
|
1416
|
-
}).chain((path) => $shaclPropertyFromRdf({
|
|
1417
|
-
graph: $parameters.graph,
|
|
1418
|
-
resource: $parameters.resource,
|
|
1419
|
-
propertySchema: ShaclCorePropertyShape.$schema.properties.uniqueLang,
|
|
1420
|
-
typeFromRdf: (resourceValues) => resourceValues
|
|
1421
|
-
.chain((values) => values.chainMap((value) => value.toBoolean()))
|
|
1422
|
-
.map((values) => values.length > 0
|
|
1423
|
-
? values.map((value) => Maybe.of(value))
|
|
1424
|
-
: Resource.Values.fromValue({
|
|
1425
|
-
focusResource: $parameters.resource,
|
|
1426
|
-
propertyPath: ShaclCorePropertyShape.$schema
|
|
1427
|
-
.properties.uniqueLang.path,
|
|
1428
|
-
value: Maybe.empty(),
|
|
1429
|
-
})),
|
|
1430
|
-
}).map((uniqueLang) => ({
|
|
1431
|
-
...$super0,
|
|
1432
|
-
$identifier,
|
|
1433
|
-
$type,
|
|
1434
|
-
defaultValue,
|
|
1435
|
-
descriptions,
|
|
1436
|
-
groups,
|
|
1437
|
-
names,
|
|
1438
|
-
order,
|
|
1439
|
-
path,
|
|
1440
|
-
uniqueLang,
|
|
1441
|
-
}))))))))))));
|
|
1442
|
-
}
|
|
1443
|
-
ShaclCorePropertyShape.$propertiesFromRdf = $propertiesFromRdf;
|
|
1444
|
-
function $toRdf(_shaclCorePropertyShape, options) {
|
|
1445
|
-
const resourceSet = options?.resourceSet ??
|
|
1446
|
-
new ResourceSet(datasetFactory.dataset(), { dataFactory: dataFactory });
|
|
1447
|
-
const resource = BaseShaclCoreShapeStatic.$toRdf(_shaclCorePropertyShape, {
|
|
1448
|
-
ignoreRdfType: true,
|
|
1449
|
-
graph: options?.graph,
|
|
1450
|
-
resourceSet,
|
|
1451
|
-
});
|
|
1452
|
-
if (!options?.ignoreRdfType) {
|
|
1453
|
-
resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"), options?.graph);
|
|
1454
|
-
}
|
|
1455
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#defaultValue"), _shaclCorePropertyShape.defaultValue.toList(), options?.graph);
|
|
1456
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#description"), _shaclCorePropertyShape.descriptions.flatMap((item) => [
|
|
1457
|
-
$literalFactory.string(item),
|
|
1354
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#and"), _propertyShape.and.flatMap((item) => [
|
|
1355
|
+
item.length > 0
|
|
1356
|
+
? item.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
1357
|
+
if (itemIndex === 0) {
|
|
1358
|
+
currentSubListResource = listResource;
|
|
1359
|
+
}
|
|
1360
|
+
else {
|
|
1361
|
+
const newSubListResource = resourceSet.resource(dataFactory.blankNode());
|
|
1362
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
|
|
1363
|
+
currentSubListResource = newSubListResource;
|
|
1364
|
+
}
|
|
1365
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, [item], options?.graph);
|
|
1366
|
+
if (itemIndex + 1 === list.length) {
|
|
1367
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
|
|
1368
|
+
}
|
|
1369
|
+
return { currentSubListResource, listResource };
|
|
1370
|
+
}, {
|
|
1371
|
+
currentSubListResource: null,
|
|
1372
|
+
listResource: resourceSet.resource(dataFactory.blankNode()),
|
|
1373
|
+
}).listResource.identifier
|
|
1374
|
+
: $RdfVocabularies.rdf.nil,
|
|
1375
|
+
]), options?.graph);
|
|
1376
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#class"), _propertyShape.classes.flatMap((item) => [item]), options?.graph);
|
|
1377
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), _propertyShape.comments.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
|
|
1378
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#datatype"), _propertyShape.datatype.toList(), options?.graph);
|
|
1379
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"), _propertyShape.deactivated
|
|
1380
|
+
.toList()
|
|
1381
|
+
.flatMap((value) => [
|
|
1382
|
+
$literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
|
|
1458
1383
|
]), options?.graph);
|
|
1459
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#
|
|
1460
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#
|
|
1384
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#defaultValue"), _propertyShape.defaultValue.toList(), options?.graph);
|
|
1385
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#description"), _propertyShape.descriptions.flatMap((item) => [
|
|
1461
1386
|
$literalFactory.string(item),
|
|
1462
1387
|
]), options?.graph);
|
|
1463
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#
|
|
1388
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#flags"), _propertyShape.flags.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
|
|
1389
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#group"), _propertyShape.groups.flatMap((item) => [item]), options?.graph);
|
|
1390
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#hasValue"), _propertyShape.hasValues.flatMap((item) => [item]), options?.graph);
|
|
1391
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#in"), _propertyShape.in_.toList().flatMap((value) => [
|
|
1392
|
+
value.length > 0
|
|
1393
|
+
? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
1394
|
+
if (itemIndex === 0) {
|
|
1395
|
+
currentSubListResource = listResource;
|
|
1396
|
+
}
|
|
1397
|
+
else {
|
|
1398
|
+
const newSubListResource = resourceSet.resource(dataFactory.blankNode());
|
|
1399
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
|
|
1400
|
+
currentSubListResource = newSubListResource;
|
|
1401
|
+
}
|
|
1402
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, [item], options?.graph);
|
|
1403
|
+
if (itemIndex + 1 === list.length) {
|
|
1404
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
|
|
1405
|
+
}
|
|
1406
|
+
return { currentSubListResource, listResource };
|
|
1407
|
+
}, {
|
|
1408
|
+
currentSubListResource: null,
|
|
1409
|
+
listResource: resourceSet.resource(dataFactory.blankNode()),
|
|
1410
|
+
}).listResource.identifier
|
|
1411
|
+
: $RdfVocabularies.rdf.nil,
|
|
1412
|
+
]), options?.graph);
|
|
1413
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"), _propertyShape.isDefinedBy.toList(), options?.graph);
|
|
1414
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), _propertyShape.labels.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
|
|
1415
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#languageIn"), _propertyShape.languageIn.toList().flatMap((value) => [
|
|
1416
|
+
value.length > 0
|
|
1417
|
+
? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
1418
|
+
if (itemIndex === 0) {
|
|
1419
|
+
currentSubListResource = listResource;
|
|
1420
|
+
}
|
|
1421
|
+
else {
|
|
1422
|
+
const newSubListResource = resourceSet.resource(dataFactory.blankNode());
|
|
1423
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
|
|
1424
|
+
currentSubListResource = newSubListResource;
|
|
1425
|
+
}
|
|
1426
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, [$literalFactory.string(item)], options?.graph);
|
|
1427
|
+
if (itemIndex + 1 === list.length) {
|
|
1428
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
|
|
1429
|
+
}
|
|
1430
|
+
return { currentSubListResource, listResource };
|
|
1431
|
+
}, {
|
|
1432
|
+
currentSubListResource: null,
|
|
1433
|
+
listResource: resourceSet.resource(dataFactory.blankNode()),
|
|
1434
|
+
}).listResource.identifier
|
|
1435
|
+
: $RdfVocabularies.rdf.nil,
|
|
1436
|
+
]), options?.graph);
|
|
1437
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxCount"), _propertyShape.maxCount
|
|
1438
|
+
.toList()
|
|
1439
|
+
.flatMap((value) => [
|
|
1440
|
+
$literalFactory.number(value, $RdfVocabularies.xsd.unsignedInt),
|
|
1441
|
+
]), options?.graph);
|
|
1442
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxExclusive"), _propertyShape.maxExclusive.toList(), options?.graph);
|
|
1443
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxInclusive"), _propertyShape.maxInclusive.toList(), options?.graph);
|
|
1444
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxLength"), _propertyShape.maxLength
|
|
1445
|
+
.toList()
|
|
1446
|
+
.flatMap((value) => [
|
|
1447
|
+
$literalFactory.number(value, $RdfVocabularies.xsd.unsignedInt),
|
|
1448
|
+
]), options?.graph);
|
|
1449
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minCount"), _propertyShape.minCount
|
|
1450
|
+
.toList()
|
|
1451
|
+
.flatMap((value) => [
|
|
1452
|
+
$literalFactory.number(value, $RdfVocabularies.xsd.unsignedInt),
|
|
1453
|
+
]), options?.graph);
|
|
1454
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minExclusive"), _propertyShape.minExclusive.toList(), options?.graph);
|
|
1455
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minInclusive"), _propertyShape.minInclusive.toList(), options?.graph);
|
|
1456
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minLength"), _propertyShape.minLength
|
|
1457
|
+
.toList()
|
|
1458
|
+
.flatMap((value) => [
|
|
1459
|
+
$literalFactory.number(value, $RdfVocabularies.xsd.unsignedInt),
|
|
1460
|
+
]), options?.graph);
|
|
1461
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#name"), _propertyShape.names.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
|
|
1462
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"), _propertyShape.nodeKind.toList(), options?.graph);
|
|
1463
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#node"), _propertyShape.nodes.flatMap((item) => [item]), options?.graph);
|
|
1464
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#not"), _propertyShape.not.flatMap((item) => [item]), options?.graph);
|
|
1465
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#or"), _propertyShape.or.flatMap((item) => [
|
|
1466
|
+
item.length > 0
|
|
1467
|
+
? item.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
1468
|
+
if (itemIndex === 0) {
|
|
1469
|
+
currentSubListResource = listResource;
|
|
1470
|
+
}
|
|
1471
|
+
else {
|
|
1472
|
+
const newSubListResource = resourceSet.resource(dataFactory.blankNode());
|
|
1473
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
|
|
1474
|
+
currentSubListResource = newSubListResource;
|
|
1475
|
+
}
|
|
1476
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, [item], options?.graph);
|
|
1477
|
+
if (itemIndex + 1 === list.length) {
|
|
1478
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
|
|
1479
|
+
}
|
|
1480
|
+
return { currentSubListResource, listResource };
|
|
1481
|
+
}, {
|
|
1482
|
+
currentSubListResource: null,
|
|
1483
|
+
listResource: resourceSet.resource(dataFactory.blankNode()),
|
|
1484
|
+
}).listResource.identifier
|
|
1485
|
+
: $RdfVocabularies.rdf.nil,
|
|
1486
|
+
]), options?.graph);
|
|
1487
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#order"), _propertyShape.order
|
|
1464
1488
|
.toList()
|
|
1465
1489
|
.flatMap((value) => [
|
|
1466
1490
|
$literalFactory.number(value, $RdfVocabularies.xsd.double),
|
|
1467
1491
|
]), options?.graph);
|
|
1468
1492
|
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#path"), [
|
|
1469
|
-
PropertyPath.$toRdf(
|
|
1493
|
+
PropertyPath.$toRdf(_propertyShape.path, {
|
|
1470
1494
|
graph: options?.graph,
|
|
1471
1495
|
resourceSet: resourceSet,
|
|
1472
1496
|
}).identifier,
|
|
1473
1497
|
], options?.graph);
|
|
1474
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#
|
|
1498
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#pattern"), _propertyShape.patterns.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
|
|
1499
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#uniqueLang"), _propertyShape.uniqueLang
|
|
1475
1500
|
.toList()
|
|
1476
1501
|
.flatMap((value) => [
|
|
1477
1502
|
$literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
|
|
1478
1503
|
]), options?.graph);
|
|
1504
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#xone"), _propertyShape.xone.flatMap((item) => [
|
|
1505
|
+
item.length > 0
|
|
1506
|
+
? item.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
1507
|
+
if (itemIndex === 0) {
|
|
1508
|
+
currentSubListResource = listResource;
|
|
1509
|
+
}
|
|
1510
|
+
else {
|
|
1511
|
+
const newSubListResource = resourceSet.resource(dataFactory.blankNode());
|
|
1512
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
|
|
1513
|
+
currentSubListResource = newSubListResource;
|
|
1514
|
+
}
|
|
1515
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, [item], options?.graph);
|
|
1516
|
+
if (itemIndex + 1 === list.length) {
|
|
1517
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
|
|
1518
|
+
}
|
|
1519
|
+
return { currentSubListResource, listResource };
|
|
1520
|
+
}, {
|
|
1521
|
+
currentSubListResource: null,
|
|
1522
|
+
listResource: resourceSet.resource(dataFactory.blankNode()),
|
|
1523
|
+
}).listResource.identifier
|
|
1524
|
+
: $RdfVocabularies.rdf.nil,
|
|
1525
|
+
]), options?.graph);
|
|
1479
1526
|
return resource;
|
|
1480
1527
|
}
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
}),
|
|
1491
|
-
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#defaultValue"),
|
|
1492
|
-
},
|
|
1493
|
-
descriptions: {
|
|
1494
|
-
kind: "Shacl",
|
|
1495
|
-
type: () => ({
|
|
1496
|
-
kind: "Set",
|
|
1497
|
-
item: () => ({ kind: "String" }),
|
|
1498
|
-
}),
|
|
1499
|
-
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#description"),
|
|
1500
|
-
},
|
|
1501
|
-
groups: {
|
|
1502
|
-
kind: "Shacl",
|
|
1503
|
-
type: () => ({
|
|
1504
|
-
kind: "Set",
|
|
1505
|
-
item: () => ({ kind: "Identifier" }),
|
|
1506
|
-
}),
|
|
1507
|
-
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#group"),
|
|
1508
|
-
},
|
|
1509
|
-
names: {
|
|
1510
|
-
kind: "Shacl",
|
|
1511
|
-
type: () => ({
|
|
1512
|
-
kind: "Set",
|
|
1513
|
-
item: () => ({ kind: "String" }),
|
|
1514
|
-
}),
|
|
1515
|
-
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#name"),
|
|
1516
|
-
},
|
|
1517
|
-
order: {
|
|
1518
|
-
kind: "Shacl",
|
|
1519
|
-
type: () => ({
|
|
1520
|
-
kind: "Maybe",
|
|
1521
|
-
item: () => ({ kind: "Float" }),
|
|
1522
|
-
}),
|
|
1523
|
-
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#order"),
|
|
1524
|
-
},
|
|
1525
|
-
path: {
|
|
1526
|
-
kind: "Shacl",
|
|
1527
|
-
type: () => PropertyPath.$schema,
|
|
1528
|
-
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#path"),
|
|
1529
|
-
},
|
|
1530
|
-
uniqueLang: {
|
|
1531
|
-
kind: "Shacl",
|
|
1532
|
-
type: () => ({
|
|
1533
|
-
kind: "Maybe",
|
|
1534
|
-
item: () => ({ kind: "Boolean" }),
|
|
1535
|
-
}),
|
|
1536
|
-
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#uniqueLang"),
|
|
1537
|
-
},
|
|
1538
|
-
},
|
|
1539
|
-
};
|
|
1540
|
-
})(ShaclCorePropertyShape || (ShaclCorePropertyShape = {}));
|
|
1541
|
-
export var ShaclCorePropertyGroup;
|
|
1542
|
-
(function (ShaclCorePropertyGroup) {
|
|
1528
|
+
PropertyShape.$toRdf = $toRdf;
|
|
1529
|
+
})(PropertyShape || (PropertyShape = {}));
|
|
1530
|
+
export var PropertyGroup;
|
|
1531
|
+
(function (PropertyGroup) {
|
|
1532
|
+
let $Identifier;
|
|
1533
|
+
(function ($Identifier) {
|
|
1534
|
+
$Identifier.fromString = $identifierFromString; // biome-ignore lint/suspicious/noShadowRestrictedNames: allow toString
|
|
1535
|
+
$Identifier.toString = Resource.Identifier.toString;
|
|
1536
|
+
})($Identifier = PropertyGroup.$Identifier || (PropertyGroup.$Identifier = {}));
|
|
1543
1537
|
function $filter(filter, value) {
|
|
1544
1538
|
if (filter.$identifier !== undefined &&
|
|
1545
1539
|
!$filterIdentifier(filter.$identifier, value.$identifier)) {
|
|
@@ -1555,28 +1549,13 @@ export var ShaclCorePropertyGroup;
|
|
|
1555
1549
|
}
|
|
1556
1550
|
return true;
|
|
1557
1551
|
}
|
|
1558
|
-
|
|
1559
|
-
ShaclCorePropertyGroup.$fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup");
|
|
1560
|
-
let $Identifier;
|
|
1561
|
-
(function ($Identifier) {
|
|
1562
|
-
$Identifier.fromString = $identifierFromString; // biome-ignore lint/suspicious/noShadowRestrictedNames: allow toString
|
|
1563
|
-
$Identifier.toString = Resource.Identifier.toString;
|
|
1564
|
-
})($Identifier = ShaclCorePropertyGroup.$Identifier || (ShaclCorePropertyGroup.$Identifier = {}));
|
|
1565
|
-
function isShaclCorePropertyGroup(object) {
|
|
1566
|
-
switch (object.$type) {
|
|
1567
|
-
case "ShaclCorePropertyGroup":
|
|
1568
|
-
return true;
|
|
1569
|
-
default:
|
|
1570
|
-
return false;
|
|
1571
|
-
}
|
|
1572
|
-
}
|
|
1573
|
-
ShaclCorePropertyGroup.isShaclCorePropertyGroup = isShaclCorePropertyGroup;
|
|
1552
|
+
PropertyGroup.$filter = $filter;
|
|
1574
1553
|
function $fromRdf(resource, options) {
|
|
1575
1554
|
let { context, ignoreRdfType = false, objectSet, preferredLanguages, } = options ?? {};
|
|
1576
1555
|
if (!objectSet) {
|
|
1577
1556
|
objectSet = new $RdfjsDatasetObjectSet(resource.dataset);
|
|
1578
1557
|
}
|
|
1579
|
-
return
|
|
1558
|
+
return PropertyGroup.$propertiesFromRdf({
|
|
1580
1559
|
context,
|
|
1581
1560
|
ignoreRdfType,
|
|
1582
1561
|
objectSet,
|
|
@@ -1584,7 +1563,17 @@ export var ShaclCorePropertyGroup;
|
|
|
1584
1563
|
resource,
|
|
1585
1564
|
});
|
|
1586
1565
|
}
|
|
1587
|
-
|
|
1566
|
+
PropertyGroup.$fromRdf = $fromRdf;
|
|
1567
|
+
PropertyGroup.$fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup");
|
|
1568
|
+
function isPropertyGroup(object) {
|
|
1569
|
+
switch (object.$type) {
|
|
1570
|
+
case "PropertyGroup":
|
|
1571
|
+
return true;
|
|
1572
|
+
default:
|
|
1573
|
+
return false;
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
PropertyGroup.isPropertyGroup = isPropertyGroup;
|
|
1588
1577
|
function $propertiesFromRdf($parameters) {
|
|
1589
1578
|
return (!$parameters.ignoreRdfType
|
|
1590
1579
|
? $parameters.resource
|
|
@@ -1597,7 +1586,9 @@ export var ShaclCorePropertyGroup;
|
|
|
1597
1586
|
return Right(true);
|
|
1598
1587
|
}
|
|
1599
1588
|
// Check arbitrary rdfs:subClassOf's of the expected type
|
|
1600
|
-
if ($parameters.resource.isInstanceOf(
|
|
1589
|
+
if ($parameters.resource.isInstanceOf(PropertyGroup.$fromRdfType, {
|
|
1590
|
+
graph: $parameters.graph,
|
|
1591
|
+
})) {
|
|
1601
1592
|
return Right(true);
|
|
1602
1593
|
}
|
|
1603
1594
|
return Left(new Error(`${Resource.Identifier.toString($parameters.resource.identifier)} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#PropertyGroup)`));
|
|
@@ -1610,52 +1601,36 @@ export var ShaclCorePropertyGroup;
|
|
|
1610
1601
|
}).toValues())
|
|
1611
1602
|
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
1612
1603
|
.chain((values) => values.head())
|
|
1613
|
-
.chain(($identifier) => Right("
|
|
1604
|
+
.chain(($identifier) => Right("PropertyGroup").chain(($type) => $shaclPropertyFromRdf({
|
|
1614
1605
|
graph: $parameters.graph,
|
|
1615
1606
|
resource: $parameters.resource,
|
|
1616
|
-
propertySchema:
|
|
1607
|
+
propertySchema: PropertyGroup.$schema.properties.comments,
|
|
1617
1608
|
typeFromRdf: (resourceValues) => resourceValues
|
|
1618
1609
|
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
1619
1610
|
.chain((values) => values.chainMap((value) => value.toString()))
|
|
1620
1611
|
.map((values) => values.toArray())
|
|
1621
1612
|
.map((valuesArray) => Resource.Values.fromValue({
|
|
1622
1613
|
focusResource: $parameters.resource,
|
|
1623
|
-
propertyPath:
|
|
1614
|
+
propertyPath: PropertyGroup.$schema.properties.comments.path,
|
|
1624
1615
|
value: valuesArray,
|
|
1625
1616
|
})),
|
|
1626
1617
|
}).chain((comments) => $shaclPropertyFromRdf({
|
|
1627
1618
|
graph: $parameters.graph,
|
|
1628
1619
|
resource: $parameters.resource,
|
|
1629
|
-
propertySchema:
|
|
1620
|
+
propertySchema: PropertyGroup.$schema.properties.labels,
|
|
1630
1621
|
typeFromRdf: (resourceValues) => resourceValues
|
|
1631
1622
|
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
1632
1623
|
.chain((values) => values.chainMap((value) => value.toString()))
|
|
1633
1624
|
.map((values) => values.toArray())
|
|
1634
1625
|
.map((valuesArray) => Resource.Values.fromValue({
|
|
1635
1626
|
focusResource: $parameters.resource,
|
|
1636
|
-
propertyPath:
|
|
1627
|
+
propertyPath: PropertyGroup.$schema.properties.labels.path,
|
|
1637
1628
|
value: valuesArray,
|
|
1638
1629
|
})),
|
|
1639
1630
|
}).map((labels) => ({ $identifier, $type, comments, labels }))))));
|
|
1640
1631
|
}
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
const resourceSet = options?.resourceSet ??
|
|
1644
|
-
new ResourceSet(datasetFactory.dataset(), { dataFactory: dataFactory });
|
|
1645
|
-
const resource = resourceSet.resource(_shaclCorePropertyGroup.$identifier);
|
|
1646
|
-
if (!options?.ignoreRdfType) {
|
|
1647
|
-
resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup"), options?.graph);
|
|
1648
|
-
}
|
|
1649
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), _shaclCorePropertyGroup.comments.flatMap((item) => [
|
|
1650
|
-
$literalFactory.string(item),
|
|
1651
|
-
]), options?.graph);
|
|
1652
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), _shaclCorePropertyGroup.labels.flatMap((item) => [
|
|
1653
|
-
$literalFactory.string(item),
|
|
1654
|
-
]), options?.graph);
|
|
1655
|
-
return resource;
|
|
1656
|
-
}
|
|
1657
|
-
ShaclCorePropertyGroup.$toRdf = $toRdf;
|
|
1658
|
-
ShaclCorePropertyGroup.$schema = {
|
|
1632
|
+
PropertyGroup.$propertiesFromRdf = $propertiesFromRdf;
|
|
1633
|
+
PropertyGroup.$schema = {
|
|
1659
1634
|
properties: {
|
|
1660
1635
|
$identifier: {
|
|
1661
1636
|
kind: "Identifier",
|
|
@@ -1665,7 +1640,7 @@ export var ShaclCorePropertyGroup;
|
|
|
1665
1640
|
kind: "TypeDiscriminant",
|
|
1666
1641
|
type: () => ({
|
|
1667
1642
|
kind: "TypeDiscriminant",
|
|
1668
|
-
ownValues: ["
|
|
1643
|
+
ownValues: ["PropertyGroup"],
|
|
1669
1644
|
}),
|
|
1670
1645
|
},
|
|
1671
1646
|
comments: {
|
|
@@ -1686,49 +1661,44 @@ export var ShaclCorePropertyGroup;
|
|
|
1686
1661
|
},
|
|
1687
1662
|
},
|
|
1688
1663
|
};
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
if (!
|
|
1694
|
-
|
|
1695
|
-
}
|
|
1696
|
-
if (filter.closed !== undefined &&
|
|
1697
|
-
!$filterMaybe($filterBoolean)(filter.closed, value.closed)) {
|
|
1698
|
-
return false;
|
|
1699
|
-
}
|
|
1700
|
-
if (filter.ignoredProperties !== undefined &&
|
|
1701
|
-
!$filterMaybe($filterArray($filterIri))(filter.ignoredProperties, value.ignoredProperties)) {
|
|
1702
|
-
return false;
|
|
1703
|
-
}
|
|
1704
|
-
if (filter.properties !== undefined &&
|
|
1705
|
-
!$filterArray($filterIdentifier)(filter.properties, value.properties)) {
|
|
1706
|
-
return false;
|
|
1664
|
+
function $toRdf(_propertyGroup, options) {
|
|
1665
|
+
const resourceSet = options?.resourceSet ??
|
|
1666
|
+
new ResourceSet(datasetFactory.dataset(), { dataFactory: dataFactory });
|
|
1667
|
+
const resource = resourceSet.resource(_propertyGroup.$identifier);
|
|
1668
|
+
if (!options?.ignoreRdfType) {
|
|
1669
|
+
resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup"), options?.graph);
|
|
1707
1670
|
}
|
|
1708
|
-
|
|
1671
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), _propertyGroup.comments.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
|
|
1672
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), _propertyGroup.labels.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
|
|
1673
|
+
return resource;
|
|
1709
1674
|
}
|
|
1710
|
-
|
|
1711
|
-
|
|
1675
|
+
PropertyGroup.$toRdf = $toRdf;
|
|
1676
|
+
})(PropertyGroup || (PropertyGroup = {}));
|
|
1677
|
+
export var Ontology;
|
|
1678
|
+
(function (Ontology) {
|
|
1712
1679
|
let $Identifier;
|
|
1713
1680
|
(function ($Identifier) {
|
|
1714
1681
|
$Identifier.fromString = $identifierFromString; // biome-ignore lint/suspicious/noShadowRestrictedNames: allow toString
|
|
1715
1682
|
$Identifier.toString = Resource.Identifier.toString;
|
|
1716
|
-
})($Identifier =
|
|
1717
|
-
function
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1683
|
+
})($Identifier = Ontology.$Identifier || (Ontology.$Identifier = {}));
|
|
1684
|
+
function $filter(filter, value) {
|
|
1685
|
+
if (filter.$identifier !== undefined &&
|
|
1686
|
+
!$filterIdentifier(filter.$identifier, value.$identifier)) {
|
|
1687
|
+
return false;
|
|
1688
|
+
}
|
|
1689
|
+
if (filter.labels !== undefined &&
|
|
1690
|
+
!$filterArray($filterString)(filter.labels, value.labels)) {
|
|
1691
|
+
return false;
|
|
1723
1692
|
}
|
|
1693
|
+
return true;
|
|
1724
1694
|
}
|
|
1725
|
-
|
|
1695
|
+
Ontology.$filter = $filter;
|
|
1726
1696
|
function $fromRdf(resource, options) {
|
|
1727
1697
|
let { context, ignoreRdfType = false, objectSet, preferredLanguages, } = options ?? {};
|
|
1728
1698
|
if (!objectSet) {
|
|
1729
1699
|
objectSet = new $RdfjsDatasetObjectSet(resource.dataset);
|
|
1730
1700
|
}
|
|
1731
|
-
return
|
|
1701
|
+
return Ontology.$propertiesFromRdf({
|
|
1732
1702
|
context,
|
|
1733
1703
|
ignoreRdfType,
|
|
1734
1704
|
objectSet,
|
|
@@ -1736,26 +1706,35 @@ export var ShaclCoreNodeShape;
|
|
|
1736
1706
|
resource,
|
|
1737
1707
|
});
|
|
1738
1708
|
}
|
|
1739
|
-
|
|
1709
|
+
Ontology.$fromRdf = $fromRdf;
|
|
1710
|
+
Ontology.$fromRdfType = dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology");
|
|
1711
|
+
function isOntology(object) {
|
|
1712
|
+
switch (object.$type) {
|
|
1713
|
+
case "Ontology":
|
|
1714
|
+
return true;
|
|
1715
|
+
default:
|
|
1716
|
+
return false;
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
Ontology.isOntology = isOntology;
|
|
1740
1720
|
function $propertiesFromRdf($parameters) {
|
|
1741
|
-
return
|
|
1742
|
-
...$parameters,
|
|
1743
|
-
ignoreRdfType: true,
|
|
1744
|
-
}).chain(($super0) => (!$parameters.ignoreRdfType
|
|
1721
|
+
return (!$parameters.ignoreRdfType
|
|
1745
1722
|
? $parameters.resource
|
|
1746
1723
|
.value($RdfVocabularies.rdf.type, { graph: $parameters.graph })
|
|
1747
1724
|
.chain((actualRdfType) => actualRdfType.toIri())
|
|
1748
1725
|
.chain((actualRdfType) => {
|
|
1749
1726
|
// Check the expected type and its known subtypes
|
|
1750
1727
|
switch (actualRdfType.value) {
|
|
1751
|
-
case "http://www.w3.org/
|
|
1728
|
+
case "http://www.w3.org/2002/07/owl#Ontology":
|
|
1752
1729
|
return Right(true);
|
|
1753
1730
|
}
|
|
1754
1731
|
// Check arbitrary rdfs:subClassOf's of the expected type
|
|
1755
|
-
if ($parameters.resource.isInstanceOf(
|
|
1732
|
+
if ($parameters.resource.isInstanceOf(Ontology.$fromRdfType, {
|
|
1733
|
+
graph: $parameters.graph,
|
|
1734
|
+
})) {
|
|
1756
1735
|
return Right(true);
|
|
1757
1736
|
}
|
|
1758
|
-
return Left(new Error(`${Resource.Identifier.toString($parameters.resource.identifier)} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/
|
|
1737
|
+
return Left(new Error(`${Resource.Identifier.toString($parameters.resource.identifier)} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/2002/07/owl#Ontology)`));
|
|
1759
1738
|
})
|
|
1760
1739
|
: Right(true)).chain((_rdfTypeCheck) => Right(new Resource.Value({
|
|
1761
1740
|
dataFactory: dataFactory,
|
|
@@ -1765,83 +1744,1234 @@ export var ShaclCoreNodeShape;
|
|
|
1765
1744
|
}).toValues())
|
|
1766
1745
|
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
1767
1746
|
.chain((values) => values.head())
|
|
1768
|
-
.chain(($identifier) => Right("
|
|
1769
|
-
graph: $parameters.graph,
|
|
1770
|
-
resource: $parameters.resource,
|
|
1771
|
-
propertySchema: ShaclCoreNodeShape.$schema.properties.closed,
|
|
1772
|
-
typeFromRdf: (resourceValues) => resourceValues
|
|
1773
|
-
.chain((values) => values.chainMap((value) => value.toBoolean()))
|
|
1774
|
-
.map((values) => values.length > 0
|
|
1775
|
-
? values.map((value) => Maybe.of(value))
|
|
1776
|
-
: Resource.Values.fromValue({
|
|
1777
|
-
focusResource: $parameters.resource,
|
|
1778
|
-
propertyPath: ShaclCoreNodeShape.$schema.properties.closed
|
|
1779
|
-
.path,
|
|
1780
|
-
value: Maybe.empty(),
|
|
1781
|
-
})),
|
|
1782
|
-
}).chain((closed) => $shaclPropertyFromRdf({
|
|
1783
|
-
graph: $parameters.graph,
|
|
1784
|
-
resource: $parameters.resource,
|
|
1785
|
-
propertySchema: ShaclCoreNodeShape.$schema.properties.ignoredProperties,
|
|
1786
|
-
typeFromRdf: (resourceValues) => resourceValues
|
|
1787
|
-
.chain((values) => values.chainMap((value) => value.toList({ graph: $parameters.graph })))
|
|
1788
|
-
.chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
|
|
1789
|
-
focusResource: $parameters.resource,
|
|
1790
|
-
propertyPath: ShaclCoreNodeShape.$schema.properties
|
|
1791
|
-
.ignoredProperties.path,
|
|
1792
|
-
values: valueList.toArray(),
|
|
1793
|
-
})).chain((values) => values.chainMap((value) => value.toIri()))))
|
|
1794
|
-
.map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
|
|
1795
|
-
.map((values) => values.length > 0
|
|
1796
|
-
? values.map((value) => Maybe.of(value))
|
|
1797
|
-
: Resource.Values.fromValue({
|
|
1798
|
-
focusResource: $parameters.resource,
|
|
1799
|
-
propertyPath: ShaclCoreNodeShape.$schema.properties
|
|
1800
|
-
.ignoredProperties.path,
|
|
1801
|
-
value: Maybe.empty(),
|
|
1802
|
-
})),
|
|
1803
|
-
}).chain((ignoredProperties) => $shaclPropertyFromRdf({
|
|
1747
|
+
.chain(($identifier) => Right("Ontology").chain(($type) => $shaclPropertyFromRdf({
|
|
1804
1748
|
graph: $parameters.graph,
|
|
1805
1749
|
resource: $parameters.resource,
|
|
1806
|
-
propertySchema:
|
|
1750
|
+
propertySchema: Ontology.$schema.properties.labels,
|
|
1807
1751
|
typeFromRdf: (resourceValues) => resourceValues
|
|
1808
|
-
.chain((values) => values
|
|
1752
|
+
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
1753
|
+
.chain((values) => values.chainMap((value) => value.toString()))
|
|
1809
1754
|
.map((values) => values.toArray())
|
|
1810
1755
|
.map((valuesArray) => Resource.Values.fromValue({
|
|
1811
1756
|
focusResource: $parameters.resource,
|
|
1812
|
-
propertyPath:
|
|
1813
|
-
.path,
|
|
1757
|
+
propertyPath: Ontology.$schema.properties.labels.path,
|
|
1814
1758
|
value: valuesArray,
|
|
1815
1759
|
})),
|
|
1816
|
-
}).map((
|
|
1817
|
-
...$super0,
|
|
1818
|
-
$identifier,
|
|
1819
|
-
$type,
|
|
1820
|
-
closed,
|
|
1821
|
-
ignoredProperties,
|
|
1822
|
-
properties,
|
|
1823
|
-
}))))))));
|
|
1760
|
+
}).map((labels) => ({ $identifier, $type, labels })))));
|
|
1824
1761
|
}
|
|
1825
|
-
|
|
1826
|
-
|
|
1762
|
+
Ontology.$propertiesFromRdf = $propertiesFromRdf;
|
|
1763
|
+
Ontology.$schema = {
|
|
1764
|
+
properties: {
|
|
1765
|
+
$identifier: {
|
|
1766
|
+
kind: "Identifier",
|
|
1767
|
+
type: () => ({ kind: "Identifier" }),
|
|
1768
|
+
},
|
|
1769
|
+
$type: {
|
|
1770
|
+
kind: "TypeDiscriminant",
|
|
1771
|
+
type: () => ({
|
|
1772
|
+
kind: "TypeDiscriminant",
|
|
1773
|
+
ownValues: ["Ontology"],
|
|
1774
|
+
}),
|
|
1775
|
+
},
|
|
1776
|
+
labels: {
|
|
1777
|
+
kind: "Shacl",
|
|
1778
|
+
type: () => ({
|
|
1779
|
+
kind: "Set",
|
|
1780
|
+
item: () => ({ kind: "String" }),
|
|
1781
|
+
}),
|
|
1782
|
+
path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
|
|
1783
|
+
},
|
|
1784
|
+
},
|
|
1785
|
+
};
|
|
1786
|
+
function $toRdf(_ontology, options) {
|
|
1827
1787
|
const resourceSet = options?.resourceSet ??
|
|
1828
1788
|
new ResourceSet(datasetFactory.dataset(), { dataFactory: dataFactory });
|
|
1829
|
-
const resource =
|
|
1830
|
-
ignoreRdfType: true,
|
|
1831
|
-
graph: options?.graph,
|
|
1832
|
-
resourceSet,
|
|
1833
|
-
});
|
|
1789
|
+
const resource = resourceSet.resource(_ontology.$identifier);
|
|
1834
1790
|
if (!options?.ignoreRdfType) {
|
|
1835
|
-
resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/
|
|
1791
|
+
resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"), options?.graph);
|
|
1836
1792
|
}
|
|
1837
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1793
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), _ontology.labels.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
|
|
1794
|
+
return resource;
|
|
1795
|
+
}
|
|
1796
|
+
Ontology.$toRdf = $toRdf;
|
|
1797
|
+
})(Ontology || (Ontology = {}));
|
|
1798
|
+
export var NodeShape;
|
|
1799
|
+
(function (NodeShape) {
|
|
1800
|
+
let $Identifier;
|
|
1801
|
+
(function ($Identifier) {
|
|
1802
|
+
$Identifier.fromString = $identifierFromString; // biome-ignore lint/suspicious/noShadowRestrictedNames: allow toString
|
|
1803
|
+
$Identifier.toString = Resource.Identifier.toString;
|
|
1804
|
+
})($Identifier = NodeShape.$Identifier || (NodeShape.$Identifier = {}));
|
|
1805
|
+
function $filter(filter, value) {
|
|
1806
|
+
if (filter.$identifier !== undefined &&
|
|
1807
|
+
!$filterIdentifier(filter.$identifier, value.$identifier)) {
|
|
1808
|
+
return false;
|
|
1809
|
+
}
|
|
1810
|
+
if (filter.and !== undefined &&
|
|
1811
|
+
!$filterArray($filterArray($filterIdentifier))(filter.and, value.and)) {
|
|
1812
|
+
return false;
|
|
1813
|
+
}
|
|
1814
|
+
if (filter.classes !== undefined &&
|
|
1815
|
+
!$filterArray($filterIri)(filter.classes, value.classes)) {
|
|
1816
|
+
return false;
|
|
1817
|
+
}
|
|
1818
|
+
if (filter.closed !== undefined &&
|
|
1819
|
+
!$filterMaybe($filterBoolean)(filter.closed, value.closed)) {
|
|
1820
|
+
return false;
|
|
1821
|
+
}
|
|
1822
|
+
if (filter.comments !== undefined &&
|
|
1823
|
+
!$filterArray($filterString)(filter.comments, value.comments)) {
|
|
1824
|
+
return false;
|
|
1825
|
+
}
|
|
1826
|
+
if (filter.datatype !== undefined &&
|
|
1827
|
+
!$filterMaybe($filterIri)(filter.datatype, value.datatype)) {
|
|
1828
|
+
return false;
|
|
1829
|
+
}
|
|
1830
|
+
if (filter.deactivated !== undefined &&
|
|
1831
|
+
!$filterMaybe($filterBoolean)(filter.deactivated, value.deactivated)) {
|
|
1832
|
+
return false;
|
|
1833
|
+
}
|
|
1834
|
+
if (filter.flags !== undefined &&
|
|
1835
|
+
!$filterArray($filterString)(filter.flags, value.flags)) {
|
|
1836
|
+
return false;
|
|
1837
|
+
}
|
|
1838
|
+
if (filter.hasValues !== undefined &&
|
|
1839
|
+
!$filterArray($filterTerm)(filter.hasValues, value.hasValues)) {
|
|
1840
|
+
return false;
|
|
1841
|
+
}
|
|
1842
|
+
if (filter.ignoredProperties !== undefined &&
|
|
1843
|
+
!$filterMaybe($filterArray($filterIri))(filter.ignoredProperties, value.ignoredProperties)) {
|
|
1844
|
+
return false;
|
|
1845
|
+
}
|
|
1846
|
+
if (filter.in_ !== undefined &&
|
|
1847
|
+
!$filterMaybe($filterArray($filterTerm))(filter.in_, value.in_)) {
|
|
1848
|
+
return false;
|
|
1849
|
+
}
|
|
1850
|
+
if (filter.isDefinedBy !== undefined &&
|
|
1851
|
+
!$filterMaybe($filterIdentifier)(filter.isDefinedBy, value.isDefinedBy)) {
|
|
1852
|
+
return false;
|
|
1853
|
+
}
|
|
1854
|
+
if (filter.labels !== undefined &&
|
|
1855
|
+
!$filterArray($filterString)(filter.labels, value.labels)) {
|
|
1856
|
+
return false;
|
|
1857
|
+
}
|
|
1858
|
+
if (filter.languageIn !== undefined &&
|
|
1859
|
+
!$filterMaybe($filterArray($filterString))(filter.languageIn, value.languageIn)) {
|
|
1860
|
+
return false;
|
|
1861
|
+
}
|
|
1862
|
+
if (filter.maxCount !== undefined &&
|
|
1863
|
+
!$filterMaybe(($filterNumeric))(filter.maxCount, value.maxCount)) {
|
|
1864
|
+
return false;
|
|
1865
|
+
}
|
|
1866
|
+
if (filter.maxExclusive !== undefined &&
|
|
1867
|
+
!$filterMaybe($filterLiteral)(filter.maxExclusive, value.maxExclusive)) {
|
|
1868
|
+
return false;
|
|
1869
|
+
}
|
|
1870
|
+
if (filter.maxInclusive !== undefined &&
|
|
1871
|
+
!$filterMaybe($filterLiteral)(filter.maxInclusive, value.maxInclusive)) {
|
|
1872
|
+
return false;
|
|
1873
|
+
}
|
|
1874
|
+
if (filter.maxLength !== undefined &&
|
|
1875
|
+
!$filterMaybe(($filterNumeric))(filter.maxLength, value.maxLength)) {
|
|
1876
|
+
return false;
|
|
1877
|
+
}
|
|
1878
|
+
if (filter.minCount !== undefined &&
|
|
1879
|
+
!$filterMaybe(($filterNumeric))(filter.minCount, value.minCount)) {
|
|
1880
|
+
return false;
|
|
1881
|
+
}
|
|
1882
|
+
if (filter.minExclusive !== undefined &&
|
|
1883
|
+
!$filterMaybe($filterLiteral)(filter.minExclusive, value.minExclusive)) {
|
|
1884
|
+
return false;
|
|
1885
|
+
}
|
|
1886
|
+
if (filter.minInclusive !== undefined &&
|
|
1887
|
+
!$filterMaybe($filterLiteral)(filter.minInclusive, value.minInclusive)) {
|
|
1888
|
+
return false;
|
|
1889
|
+
}
|
|
1890
|
+
if (filter.minLength !== undefined &&
|
|
1891
|
+
!$filterMaybe(($filterNumeric))(filter.minLength, value.minLength)) {
|
|
1892
|
+
return false;
|
|
1893
|
+
}
|
|
1894
|
+
if (filter.nodeKind !== undefined &&
|
|
1895
|
+
!$filterMaybe($filterIri)(filter.nodeKind, value.nodeKind)) {
|
|
1896
|
+
return false;
|
|
1897
|
+
}
|
|
1898
|
+
if (filter.nodes !== undefined &&
|
|
1899
|
+
!$filterArray($filterIdentifier)(filter.nodes, value.nodes)) {
|
|
1900
|
+
return false;
|
|
1901
|
+
}
|
|
1902
|
+
if (filter.not !== undefined &&
|
|
1903
|
+
!$filterArray($filterIdentifier)(filter.not, value.not)) {
|
|
1904
|
+
return false;
|
|
1905
|
+
}
|
|
1906
|
+
if (filter.or !== undefined &&
|
|
1907
|
+
!$filterArray($filterArray($filterIdentifier))(filter.or, value.or)) {
|
|
1908
|
+
return false;
|
|
1909
|
+
}
|
|
1910
|
+
if (filter.patterns !== undefined &&
|
|
1911
|
+
!$filterArray($filterString)(filter.patterns, value.patterns)) {
|
|
1912
|
+
return false;
|
|
1913
|
+
}
|
|
1914
|
+
if (filter.properties !== undefined &&
|
|
1915
|
+
!$filterArray($filterIdentifier)(filter.properties, value.properties)) {
|
|
1916
|
+
return false;
|
|
1917
|
+
}
|
|
1918
|
+
if (filter.xone !== undefined &&
|
|
1919
|
+
!$filterArray($filterArray($filterIdentifier))(filter.xone, value.xone)) {
|
|
1920
|
+
return false;
|
|
1921
|
+
}
|
|
1922
|
+
return true;
|
|
1923
|
+
}
|
|
1924
|
+
NodeShape.$filter = $filter;
|
|
1925
|
+
function $fromRdf(resource, options) {
|
|
1926
|
+
let { context, ignoreRdfType = false, objectSet, preferredLanguages, } = options ?? {};
|
|
1927
|
+
if (!objectSet) {
|
|
1928
|
+
objectSet = new $RdfjsDatasetObjectSet(resource.dataset);
|
|
1929
|
+
}
|
|
1930
|
+
return NodeShape.$propertiesFromRdf({
|
|
1931
|
+
context,
|
|
1932
|
+
ignoreRdfType,
|
|
1933
|
+
objectSet,
|
|
1934
|
+
preferredLanguages,
|
|
1935
|
+
resource,
|
|
1936
|
+
});
|
|
1937
|
+
}
|
|
1938
|
+
NodeShape.$fromRdf = $fromRdf;
|
|
1939
|
+
NodeShape.$fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape");
|
|
1940
|
+
function isNodeShape(object) {
|
|
1941
|
+
switch (object.$type) {
|
|
1942
|
+
case "NodeShape":
|
|
1943
|
+
return true;
|
|
1944
|
+
default:
|
|
1945
|
+
return false;
|
|
1946
|
+
}
|
|
1947
|
+
}
|
|
1948
|
+
NodeShape.isNodeShape = isNodeShape;
|
|
1949
|
+
function $propertiesFromRdf($parameters) {
|
|
1950
|
+
return (!$parameters.ignoreRdfType
|
|
1951
|
+
? $parameters.resource
|
|
1952
|
+
.value($RdfVocabularies.rdf.type, { graph: $parameters.graph })
|
|
1953
|
+
.chain((actualRdfType) => actualRdfType.toIri())
|
|
1954
|
+
.chain((actualRdfType) => {
|
|
1955
|
+
// Check the expected type and its known subtypes
|
|
1956
|
+
switch (actualRdfType.value) {
|
|
1957
|
+
case "http://www.w3.org/ns/shacl#NodeShape":
|
|
1958
|
+
return Right(true);
|
|
1959
|
+
}
|
|
1960
|
+
// Check arbitrary rdfs:subClassOf's of the expected type
|
|
1961
|
+
if ($parameters.resource.isInstanceOf(NodeShape.$fromRdfType, {
|
|
1962
|
+
graph: $parameters.graph,
|
|
1963
|
+
})) {
|
|
1964
|
+
return Right(true);
|
|
1965
|
+
}
|
|
1966
|
+
return Left(new Error(`${Resource.Identifier.toString($parameters.resource.identifier)} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#NodeShape)`));
|
|
1967
|
+
})
|
|
1968
|
+
: Right(true)).chain((_rdfTypeCheck) => Right(new Resource.Value({
|
|
1969
|
+
dataFactory: dataFactory,
|
|
1970
|
+
focusResource: $parameters.resource,
|
|
1971
|
+
propertyPath: $RdfVocabularies.rdf.subject,
|
|
1972
|
+
term: $parameters.resource.identifier,
|
|
1973
|
+
}).toValues())
|
|
1974
|
+
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
1975
|
+
.chain((values) => values.head())
|
|
1976
|
+
.chain(($identifier) => Right("NodeShape").chain(($type) => $shaclPropertyFromRdf({
|
|
1977
|
+
graph: $parameters.graph,
|
|
1978
|
+
resource: $parameters.resource,
|
|
1979
|
+
propertySchema: NodeShape.$schema.properties.and,
|
|
1980
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
1981
|
+
.chain((values) => values.chainMap((value) => value.toList({ graph: $parameters.graph })))
|
|
1982
|
+
.chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
|
|
1983
|
+
focusResource: $parameters.resource,
|
|
1984
|
+
propertyPath: PropertyShape.$schema.properties.and.path,
|
|
1985
|
+
values: valueList.toArray(),
|
|
1986
|
+
})).chain((values) => values.chainMap((value) => value.toIdentifier()))))
|
|
1987
|
+
.map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
|
|
1988
|
+
.map((values) => values.toArray())
|
|
1989
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
1990
|
+
focusResource: $parameters.resource,
|
|
1991
|
+
propertyPath: PropertyShape.$schema.properties.and.path,
|
|
1992
|
+
value: valuesArray,
|
|
1993
|
+
})),
|
|
1994
|
+
}).chain((and) => $shaclPropertyFromRdf({
|
|
1995
|
+
graph: $parameters.graph,
|
|
1996
|
+
resource: $parameters.resource,
|
|
1997
|
+
propertySchema: NodeShape.$schema.properties.classes,
|
|
1998
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
1999
|
+
.chain((values) => values.chainMap((value) => value.toIri()))
|
|
2000
|
+
.map((values) => values.toArray())
|
|
2001
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
2002
|
+
focusResource: $parameters.resource,
|
|
2003
|
+
propertyPath: PropertyShape.$schema.properties.classes.path,
|
|
2004
|
+
value: valuesArray,
|
|
2005
|
+
})),
|
|
2006
|
+
}).chain((classes) => $shaclPropertyFromRdf({
|
|
2007
|
+
graph: $parameters.graph,
|
|
2008
|
+
resource: $parameters.resource,
|
|
2009
|
+
propertySchema: NodeShape.$schema.properties.closed,
|
|
2010
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
2011
|
+
.chain((values) => values.chainMap((value) => value.toBoolean()))
|
|
2012
|
+
.map((values) => values.length > 0
|
|
2013
|
+
? values.map((value) => Maybe.of(value))
|
|
2014
|
+
: Resource.Values.fromValue({
|
|
2015
|
+
focusResource: $parameters.resource,
|
|
2016
|
+
propertyPath: NodeShape.$schema.properties.closed.path,
|
|
2017
|
+
value: Maybe.empty(),
|
|
2018
|
+
})),
|
|
2019
|
+
}).chain((closed) => $shaclPropertyFromRdf({
|
|
2020
|
+
graph: $parameters.graph,
|
|
2021
|
+
resource: $parameters.resource,
|
|
2022
|
+
propertySchema: NodeShape.$schema.properties.comments,
|
|
2023
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
2024
|
+
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
2025
|
+
.chain((values) => values.chainMap((value) => value.toString()))
|
|
2026
|
+
.map((values) => values.toArray())
|
|
2027
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
2028
|
+
focusResource: $parameters.resource,
|
|
2029
|
+
propertyPath: PropertyShape.$schema.properties.comments.path,
|
|
2030
|
+
value: valuesArray,
|
|
2031
|
+
})),
|
|
2032
|
+
}).chain((comments) => $shaclPropertyFromRdf({
|
|
2033
|
+
graph: $parameters.graph,
|
|
2034
|
+
resource: $parameters.resource,
|
|
2035
|
+
propertySchema: NodeShape.$schema.properties.datatype,
|
|
2036
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
2037
|
+
.chain((values) => values.chainMap((value) => value.toIri()))
|
|
2038
|
+
.map((values) => values.length > 0
|
|
2039
|
+
? values.map((value) => Maybe.of(value))
|
|
2040
|
+
: Resource.Values.fromValue({
|
|
2041
|
+
focusResource: $parameters.resource,
|
|
2042
|
+
propertyPath: PropertyShape.$schema.properties.datatype
|
|
2043
|
+
.path,
|
|
2044
|
+
value: Maybe.empty(),
|
|
2045
|
+
})),
|
|
2046
|
+
}).chain((datatype) => $shaclPropertyFromRdf({
|
|
2047
|
+
graph: $parameters.graph,
|
|
2048
|
+
resource: $parameters.resource,
|
|
2049
|
+
propertySchema: NodeShape.$schema.properties.deactivated,
|
|
2050
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
2051
|
+
.chain((values) => values.chainMap((value) => value.toBoolean()))
|
|
2052
|
+
.map((values) => values.length > 0
|
|
2053
|
+
? values.map((value) => Maybe.of(value))
|
|
2054
|
+
: Resource.Values.fromValue({
|
|
2055
|
+
focusResource: $parameters.resource,
|
|
2056
|
+
propertyPath: PropertyShape.$schema.properties
|
|
2057
|
+
.deactivated.path,
|
|
2058
|
+
value: Maybe.empty(),
|
|
2059
|
+
})),
|
|
2060
|
+
}).chain((deactivated) => $shaclPropertyFromRdf({
|
|
2061
|
+
graph: $parameters.graph,
|
|
2062
|
+
resource: $parameters.resource,
|
|
2063
|
+
propertySchema: NodeShape.$schema.properties.flags,
|
|
2064
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
2065
|
+
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
2066
|
+
.chain((values) => values.chainMap((value) => value.toString()))
|
|
2067
|
+
.map((values) => values.toArray())
|
|
2068
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
2069
|
+
focusResource: $parameters.resource,
|
|
2070
|
+
propertyPath: PropertyShape.$schema.properties.flags.path,
|
|
2071
|
+
value: valuesArray,
|
|
2072
|
+
})),
|
|
2073
|
+
}).chain((flags) => $shaclPropertyFromRdf({
|
|
2074
|
+
graph: $parameters.graph,
|
|
2075
|
+
resource: $parameters.resource,
|
|
2076
|
+
propertySchema: NodeShape.$schema.properties.hasValues,
|
|
2077
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
2078
|
+
.chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
|
|
2079
|
+
switch (term.termType) {
|
|
2080
|
+
case "NamedNode":
|
|
2081
|
+
case "Literal":
|
|
2082
|
+
return Either.of(term);
|
|
2083
|
+
default:
|
|
2084
|
+
return Left(new Resource.MistypedTermValueError({
|
|
2085
|
+
actualValue: term,
|
|
2086
|
+
expectedValueType: "(NamedNode | Literal)",
|
|
2087
|
+
focusResource: $parameters.resource,
|
|
2088
|
+
propertyPath: PropertyShape.$schema
|
|
2089
|
+
.properties.hasValues.path,
|
|
2090
|
+
}));
|
|
2091
|
+
}
|
|
2092
|
+
})))
|
|
2093
|
+
.map((values) => values.toArray())
|
|
2094
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
2095
|
+
focusResource: $parameters.resource,
|
|
2096
|
+
propertyPath: PropertyShape.$schema.properties.hasValues
|
|
2097
|
+
.path,
|
|
2098
|
+
value: valuesArray,
|
|
2099
|
+
})),
|
|
2100
|
+
}).chain((hasValues) => $shaclPropertyFromRdf({
|
|
2101
|
+
graph: $parameters.graph,
|
|
2102
|
+
resource: $parameters.resource,
|
|
2103
|
+
propertySchema: NodeShape.$schema.properties.ignoredProperties,
|
|
2104
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
2105
|
+
.chain((values) => values.chainMap((value) => value.toList({
|
|
2106
|
+
graph: $parameters.graph,
|
|
2107
|
+
})))
|
|
2108
|
+
.chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
|
|
2109
|
+
focusResource: $parameters.resource,
|
|
2110
|
+
propertyPath: NodeShape.$schema.properties
|
|
2111
|
+
.ignoredProperties.path,
|
|
2112
|
+
values: valueList.toArray(),
|
|
2113
|
+
})).chain((values) => values.chainMap((value) => value.toIri()))))
|
|
2114
|
+
.map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
|
|
2115
|
+
.map((values) => values.length > 0
|
|
2116
|
+
? values.map((value) => Maybe.of(value))
|
|
2117
|
+
: Resource.Values.fromValue({
|
|
2118
|
+
focusResource: $parameters.resource,
|
|
2119
|
+
propertyPath: NodeShape.$schema.properties
|
|
2120
|
+
.ignoredProperties.path,
|
|
2121
|
+
value: Maybe.empty(),
|
|
2122
|
+
})),
|
|
2123
|
+
}).chain((ignoredProperties) => $shaclPropertyFromRdf({
|
|
2124
|
+
graph: $parameters.graph,
|
|
2125
|
+
resource: $parameters.resource,
|
|
2126
|
+
propertySchema: NodeShape.$schema.properties.in_,
|
|
2127
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
2128
|
+
.chain((values) => values.chainMap((value) => value.toList({
|
|
2129
|
+
graph: $parameters.graph,
|
|
2130
|
+
})))
|
|
2131
|
+
.chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
|
|
2132
|
+
focusResource: $parameters.resource,
|
|
2133
|
+
propertyPath: PropertyShape.$schema.properties
|
|
2134
|
+
.in_.path,
|
|
2135
|
+
values: valueList.toArray(),
|
|
2136
|
+
})).chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
|
|
2137
|
+
switch (term.termType) {
|
|
2138
|
+
case "NamedNode":
|
|
2139
|
+
case "Literal":
|
|
2140
|
+
return Either.of(term);
|
|
2141
|
+
default:
|
|
2142
|
+
return Left(new Resource.MistypedTermValueError({
|
|
2143
|
+
actualValue: term,
|
|
2144
|
+
expectedValueType: "(NamedNode | Literal)",
|
|
2145
|
+
focusResource: $parameters.resource,
|
|
2146
|
+
propertyPath: PropertyShape.$schema
|
|
2147
|
+
.properties.in_
|
|
2148
|
+
.path,
|
|
2149
|
+
}));
|
|
2150
|
+
}
|
|
2151
|
+
})))))
|
|
2152
|
+
.map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
|
|
2153
|
+
.map((values) => values.length > 0
|
|
2154
|
+
? values.map((value) => Maybe.of(value))
|
|
2155
|
+
: Resource.Values.fromValue({
|
|
2156
|
+
focusResource: $parameters.resource,
|
|
2157
|
+
propertyPath: PropertyShape.$schema.properties
|
|
2158
|
+
.in_.path,
|
|
2159
|
+
value: Maybe.empty(),
|
|
2160
|
+
})),
|
|
2161
|
+
}).chain((in_) => $shaclPropertyFromRdf({
|
|
2162
|
+
graph: $parameters.graph,
|
|
2163
|
+
resource: $parameters.resource,
|
|
2164
|
+
propertySchema: NodeShape.$schema.properties.isDefinedBy,
|
|
2165
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
2166
|
+
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
2167
|
+
.map((values) => values.length > 0
|
|
2168
|
+
? values.map((value) => Maybe.of(value))
|
|
2169
|
+
: Resource.Values.fromValue({
|
|
2170
|
+
focusResource: $parameters.resource,
|
|
2171
|
+
propertyPath: PropertyShape.$schema.properties
|
|
2172
|
+
.isDefinedBy.path,
|
|
2173
|
+
value: Maybe.empty(),
|
|
2174
|
+
})),
|
|
2175
|
+
}).chain((isDefinedBy) => $shaclPropertyFromRdf({
|
|
2176
|
+
graph: $parameters.graph,
|
|
2177
|
+
resource: $parameters.resource,
|
|
2178
|
+
propertySchema: NodeShape.$schema.properties.labels,
|
|
2179
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
2180
|
+
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
2181
|
+
.chain((values) => values.chainMap((value) => value.toString()))
|
|
2182
|
+
.map((values) => values.toArray())
|
|
2183
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
2184
|
+
focusResource: $parameters.resource,
|
|
2185
|
+
propertyPath: PropertyShape.$schema.properties
|
|
2186
|
+
.labels.path,
|
|
2187
|
+
value: valuesArray,
|
|
2188
|
+
})),
|
|
2189
|
+
}).chain((labels) => $shaclPropertyFromRdf({
|
|
2190
|
+
graph: $parameters.graph,
|
|
2191
|
+
resource: $parameters.resource,
|
|
2192
|
+
propertySchema: NodeShape.$schema.properties.languageIn,
|
|
2193
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
2194
|
+
.chain((values) => values.chainMap((value) => value.toList({
|
|
2195
|
+
graph: $parameters.graph,
|
|
2196
|
+
})))
|
|
2197
|
+
.chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
|
|
2198
|
+
focusResource: $parameters.resource,
|
|
2199
|
+
propertyPath: PropertyShape.$schema
|
|
2200
|
+
.properties.languageIn
|
|
2201
|
+
.path,
|
|
2202
|
+
values: valueList.toArray(),
|
|
2203
|
+
}))
|
|
2204
|
+
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
2205
|
+
.chain((values) => values.chainMap((value) => value.toString()))))
|
|
2206
|
+
.map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
|
|
2207
|
+
.map((values) => values.length > 0
|
|
2208
|
+
? values.map((value) => Maybe.of(value))
|
|
2209
|
+
: Resource.Values.fromValue({
|
|
2210
|
+
focusResource: $parameters.resource,
|
|
2211
|
+
propertyPath: PropertyShape.$schema
|
|
2212
|
+
.properties.languageIn
|
|
2213
|
+
.path,
|
|
2214
|
+
value: Maybe.empty(),
|
|
2215
|
+
})),
|
|
2216
|
+
}).chain((languageIn) => $shaclPropertyFromRdf({
|
|
2217
|
+
graph: $parameters.graph,
|
|
2218
|
+
resource: $parameters.resource,
|
|
2219
|
+
propertySchema: NodeShape.$schema.properties.maxCount,
|
|
2220
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
2221
|
+
.chain((values) => values.chainMap((value) => value.toInt()))
|
|
2222
|
+
.map((values) => values.length > 0
|
|
2223
|
+
? values.map((value) => Maybe.of(value))
|
|
2224
|
+
: Resource.Values.fromValue({
|
|
2225
|
+
focusResource: $parameters.resource,
|
|
2226
|
+
propertyPath: PropertyShape.$schema
|
|
2227
|
+
.properties.maxCount
|
|
2228
|
+
.path,
|
|
2229
|
+
value: Maybe.empty(),
|
|
2230
|
+
})),
|
|
2231
|
+
}).chain((maxCount) => $shaclPropertyFromRdf({
|
|
2232
|
+
graph: $parameters.graph,
|
|
2233
|
+
resource: $parameters.resource,
|
|
2234
|
+
propertySchema: NodeShape.$schema.properties.maxExclusive,
|
|
2235
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
2236
|
+
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
2237
|
+
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
2238
|
+
.map((values) => values.length > 0
|
|
2239
|
+
? values.map((value) => Maybe.of(value))
|
|
2240
|
+
: Resource.Values.fromValue({
|
|
2241
|
+
focusResource: $parameters.resource,
|
|
2242
|
+
propertyPath: PropertyShape.$schema
|
|
2243
|
+
.properties
|
|
2244
|
+
.maxExclusive.path,
|
|
2245
|
+
value: Maybe.empty(),
|
|
2246
|
+
})),
|
|
2247
|
+
}).chain((maxExclusive) => $shaclPropertyFromRdf({
|
|
2248
|
+
graph: $parameters.graph,
|
|
2249
|
+
resource: $parameters.resource,
|
|
2250
|
+
propertySchema: NodeShape.$schema.properties.maxInclusive,
|
|
2251
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
2252
|
+
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
2253
|
+
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
2254
|
+
.map((values) => values.length > 0
|
|
2255
|
+
? values.map((value) => Maybe.of(value))
|
|
2256
|
+
: Resource.Values.fromValue({
|
|
2257
|
+
focusResource: $parameters.resource,
|
|
2258
|
+
propertyPath: PropertyShape.$schema
|
|
2259
|
+
.properties
|
|
2260
|
+
.maxInclusive.path,
|
|
2261
|
+
value: Maybe.empty(),
|
|
2262
|
+
})),
|
|
2263
|
+
}).chain((maxInclusive) => $shaclPropertyFromRdf({
|
|
2264
|
+
graph: $parameters.graph,
|
|
2265
|
+
resource: $parameters.resource,
|
|
2266
|
+
propertySchema: NodeShape.$schema.properties.maxLength,
|
|
2267
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
2268
|
+
.chain((values) => values.chainMap((value) => value.toInt()))
|
|
2269
|
+
.map((values) => values.length > 0
|
|
2270
|
+
? values.map((value) => Maybe.of(value))
|
|
2271
|
+
: Resource.Values.fromValue({
|
|
2272
|
+
focusResource: $parameters.resource,
|
|
2273
|
+
propertyPath: PropertyShape
|
|
2274
|
+
.$schema
|
|
2275
|
+
.properties
|
|
2276
|
+
.maxLength.path,
|
|
2277
|
+
value: Maybe.empty(),
|
|
2278
|
+
})),
|
|
2279
|
+
}).chain((maxLength) => $shaclPropertyFromRdf({
|
|
2280
|
+
graph: $parameters.graph,
|
|
2281
|
+
resource: $parameters.resource,
|
|
2282
|
+
propertySchema: NodeShape.$schema.properties.minCount,
|
|
2283
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
2284
|
+
.chain((values) => values.chainMap((value) => value.toInt()))
|
|
2285
|
+
.map((values) => values.length > 0
|
|
2286
|
+
? values.map((value) => Maybe.of(value))
|
|
2287
|
+
: Resource.Values.fromValue({
|
|
2288
|
+
focusResource: $parameters.resource,
|
|
2289
|
+
propertyPath: PropertyShape
|
|
2290
|
+
.$schema
|
|
2291
|
+
.properties
|
|
2292
|
+
.minCount.path,
|
|
2293
|
+
value: Maybe.empty(),
|
|
2294
|
+
})),
|
|
2295
|
+
}).chain((minCount) => $shaclPropertyFromRdf({
|
|
2296
|
+
graph: $parameters.graph,
|
|
2297
|
+
resource: $parameters.resource,
|
|
2298
|
+
propertySchema: NodeShape.$schema.properties
|
|
2299
|
+
.minExclusive,
|
|
2300
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
2301
|
+
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
2302
|
+
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
2303
|
+
.map((values) => values.length > 0
|
|
2304
|
+
? values.map((value) => Maybe.of(value))
|
|
2305
|
+
: Resource.Values.fromValue({
|
|
2306
|
+
focusResource: $parameters.resource,
|
|
2307
|
+
propertyPath: PropertyShape
|
|
2308
|
+
.$schema
|
|
2309
|
+
.properties
|
|
2310
|
+
.minExclusive
|
|
2311
|
+
.path,
|
|
2312
|
+
value: Maybe.empty(),
|
|
2313
|
+
})),
|
|
2314
|
+
}).chain((minExclusive) => $shaclPropertyFromRdf({
|
|
2315
|
+
graph: $parameters.graph,
|
|
2316
|
+
resource: $parameters.resource,
|
|
2317
|
+
propertySchema: NodeShape.$schema.properties
|
|
2318
|
+
.minInclusive,
|
|
2319
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
2320
|
+
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
2321
|
+
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
2322
|
+
.map((values) => values.length > 0
|
|
2323
|
+
? values.map((value) => Maybe.of(value))
|
|
2324
|
+
: Resource.Values.fromValue({
|
|
2325
|
+
focusResource: $parameters.resource,
|
|
2326
|
+
propertyPath: PropertyShape
|
|
2327
|
+
.$schema
|
|
2328
|
+
.properties
|
|
2329
|
+
.minInclusive
|
|
2330
|
+
.path,
|
|
2331
|
+
value: Maybe.empty(),
|
|
2332
|
+
})),
|
|
2333
|
+
}).chain((minInclusive) => $shaclPropertyFromRdf({
|
|
2334
|
+
graph: $parameters.graph,
|
|
2335
|
+
resource: $parameters.resource,
|
|
2336
|
+
propertySchema: NodeShape.$schema.properties
|
|
2337
|
+
.minLength,
|
|
2338
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
2339
|
+
.chain((values) => values.chainMap((value) => value.toInt()))
|
|
2340
|
+
.map((values) => values.length > 0
|
|
2341
|
+
? values.map((value) => Maybe.of(value))
|
|
2342
|
+
: Resource.Values.fromValue({
|
|
2343
|
+
focusResource: $parameters.resource,
|
|
2344
|
+
propertyPath: PropertyShape
|
|
2345
|
+
.$schema
|
|
2346
|
+
.properties
|
|
2347
|
+
.minLength
|
|
2348
|
+
.path,
|
|
2349
|
+
value: Maybe.empty(),
|
|
2350
|
+
})),
|
|
2351
|
+
}).chain((minLength) => $shaclPropertyFromRdf({
|
|
2352
|
+
graph: $parameters.graph,
|
|
2353
|
+
resource: $parameters.resource,
|
|
2354
|
+
propertySchema: NodeShape.$schema.properties
|
|
2355
|
+
.nodeKind,
|
|
2356
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
2357
|
+
.chain((values) => values.chainMap((value) => value.toIri([
|
|
2358
|
+
dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNode"),
|
|
2359
|
+
dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrIRI"),
|
|
2360
|
+
dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrLiteral"),
|
|
2361
|
+
dataFactory.namedNode("http://www.w3.org/ns/shacl#IRI"),
|
|
2362
|
+
dataFactory.namedNode("http://www.w3.org/ns/shacl#IRIOrLiteral"),
|
|
2363
|
+
dataFactory.namedNode("http://www.w3.org/ns/shacl#Literal"),
|
|
2364
|
+
])))
|
|
2365
|
+
.map((values) => values.length > 0
|
|
2366
|
+
? values.map((value) => Maybe.of(value))
|
|
2367
|
+
: Resource.Values.fromValue({
|
|
2368
|
+
focusResource: $parameters.resource,
|
|
2369
|
+
propertyPath: PropertyShape
|
|
2370
|
+
.$schema
|
|
2371
|
+
.properties
|
|
2372
|
+
.nodeKind
|
|
2373
|
+
.path,
|
|
2374
|
+
value: Maybe.empty(),
|
|
2375
|
+
})),
|
|
2376
|
+
}).chain((nodeKind) => $shaclPropertyFromRdf({
|
|
2377
|
+
graph: $parameters.graph,
|
|
2378
|
+
resource: $parameters.resource,
|
|
2379
|
+
propertySchema: NodeShape.$schema.properties
|
|
2380
|
+
.nodes,
|
|
2381
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
2382
|
+
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
2383
|
+
.map((values) => values.toArray())
|
|
2384
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
2385
|
+
focusResource: $parameters.resource,
|
|
2386
|
+
propertyPath: PropertyShape
|
|
2387
|
+
.$schema
|
|
2388
|
+
.properties
|
|
2389
|
+
.nodes
|
|
2390
|
+
.path,
|
|
2391
|
+
value: valuesArray,
|
|
2392
|
+
})),
|
|
2393
|
+
}).chain((nodes) => $shaclPropertyFromRdf({
|
|
2394
|
+
graph: $parameters.graph,
|
|
2395
|
+
resource: $parameters.resource,
|
|
2396
|
+
propertySchema: NodeShape.$schema
|
|
2397
|
+
.properties
|
|
2398
|
+
.not,
|
|
2399
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
2400
|
+
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
2401
|
+
.map((values) => values.toArray())
|
|
2402
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
2403
|
+
focusResource: $parameters.resource,
|
|
2404
|
+
propertyPath: PropertyShape
|
|
2405
|
+
.$schema
|
|
2406
|
+
.properties
|
|
2407
|
+
.not
|
|
2408
|
+
.path,
|
|
2409
|
+
value: valuesArray,
|
|
2410
|
+
})),
|
|
2411
|
+
}).chain((not) => $shaclPropertyFromRdf({
|
|
2412
|
+
graph: $parameters.graph,
|
|
2413
|
+
resource: $parameters.resource,
|
|
2414
|
+
propertySchema: NodeShape.$schema
|
|
2415
|
+
.properties
|
|
2416
|
+
.or,
|
|
2417
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
2418
|
+
.chain((values) => values.chainMap((value) => value.toList({
|
|
2419
|
+
graph: $parameters.graph,
|
|
2420
|
+
})))
|
|
2421
|
+
.chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
|
|
2422
|
+
focusResource: $parameters.resource,
|
|
2423
|
+
propertyPath: PropertyShape
|
|
2424
|
+
.$schema
|
|
2425
|
+
.properties
|
|
2426
|
+
.or
|
|
2427
|
+
.path,
|
|
2428
|
+
values: valueList.toArray(),
|
|
2429
|
+
})).chain((values) => values.chainMap((value) => value.toIdentifier()))))
|
|
2430
|
+
.map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
|
|
2431
|
+
.map((values) => values.toArray())
|
|
2432
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
2433
|
+
focusResource: $parameters.resource,
|
|
2434
|
+
propertyPath: PropertyShape
|
|
2435
|
+
.$schema
|
|
2436
|
+
.properties
|
|
2437
|
+
.or
|
|
2438
|
+
.path,
|
|
2439
|
+
value: valuesArray,
|
|
2440
|
+
})),
|
|
2441
|
+
}).chain((or) => $shaclPropertyFromRdf({
|
|
2442
|
+
graph: $parameters.graph,
|
|
2443
|
+
resource: $parameters.resource,
|
|
2444
|
+
propertySchema: NodeShape.$schema
|
|
2445
|
+
.properties
|
|
2446
|
+
.patterns,
|
|
2447
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
2448
|
+
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
2449
|
+
.chain((values) => values.chainMap((value) => value.toString()))
|
|
2450
|
+
.map((values) => values.toArray())
|
|
2451
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
2452
|
+
focusResource: $parameters.resource,
|
|
2453
|
+
propertyPath: PropertyShape
|
|
2454
|
+
.$schema
|
|
2455
|
+
.properties
|
|
2456
|
+
.patterns
|
|
2457
|
+
.path,
|
|
2458
|
+
value: valuesArray,
|
|
2459
|
+
})),
|
|
2460
|
+
}).chain((patterns) => $shaclPropertyFromRdf({
|
|
2461
|
+
graph: $parameters.graph,
|
|
2462
|
+
resource: $parameters.resource,
|
|
2463
|
+
propertySchema: NodeShape.$schema
|
|
2464
|
+
.properties
|
|
2465
|
+
.properties,
|
|
2466
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
2467
|
+
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
2468
|
+
.map((values) => values.toArray())
|
|
2469
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
2470
|
+
focusResource: $parameters.resource,
|
|
2471
|
+
propertyPath: NodeShape
|
|
2472
|
+
.$schema
|
|
2473
|
+
.properties
|
|
2474
|
+
.properties
|
|
2475
|
+
.path,
|
|
2476
|
+
value: valuesArray,
|
|
2477
|
+
})),
|
|
2478
|
+
}).chain((properties) => $shaclPropertyFromRdf({
|
|
2479
|
+
graph: $parameters.graph,
|
|
2480
|
+
resource: $parameters.resource,
|
|
2481
|
+
propertySchema: NodeShape.$schema
|
|
2482
|
+
.properties
|
|
2483
|
+
.xone,
|
|
2484
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
2485
|
+
.chain((values) => values.chainMap((value) => value.toList({
|
|
2486
|
+
graph: $parameters.graph,
|
|
2487
|
+
})))
|
|
2488
|
+
.chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
|
|
2489
|
+
focusResource: $parameters.resource,
|
|
2490
|
+
propertyPath: PropertyShape
|
|
2491
|
+
.$schema
|
|
2492
|
+
.properties
|
|
2493
|
+
.xone
|
|
2494
|
+
.path,
|
|
2495
|
+
values: valueList.toArray(),
|
|
2496
|
+
})).chain((values) => values.chainMap((value) => value.toIdentifier()))))
|
|
2497
|
+
.map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
|
|
2498
|
+
.map((values) => values.toArray())
|
|
2499
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
2500
|
+
focusResource: $parameters.resource,
|
|
2501
|
+
propertyPath: PropertyShape
|
|
2502
|
+
.$schema
|
|
2503
|
+
.properties
|
|
2504
|
+
.xone
|
|
2505
|
+
.path,
|
|
2506
|
+
value: valuesArray,
|
|
2507
|
+
})),
|
|
2508
|
+
}).map((xone) => ({
|
|
2509
|
+
$identifier,
|
|
2510
|
+
$type,
|
|
2511
|
+
and,
|
|
2512
|
+
classes,
|
|
2513
|
+
closed,
|
|
2514
|
+
comments,
|
|
2515
|
+
datatype,
|
|
2516
|
+
deactivated,
|
|
2517
|
+
flags,
|
|
2518
|
+
hasValues,
|
|
2519
|
+
ignoredProperties,
|
|
2520
|
+
in_,
|
|
2521
|
+
isDefinedBy,
|
|
2522
|
+
labels,
|
|
2523
|
+
languageIn,
|
|
2524
|
+
maxCount,
|
|
2525
|
+
maxExclusive,
|
|
2526
|
+
maxInclusive,
|
|
2527
|
+
maxLength,
|
|
2528
|
+
minCount,
|
|
2529
|
+
minExclusive,
|
|
2530
|
+
minInclusive,
|
|
2531
|
+
minLength,
|
|
2532
|
+
nodeKind,
|
|
2533
|
+
nodes,
|
|
2534
|
+
not,
|
|
2535
|
+
or,
|
|
2536
|
+
patterns,
|
|
2537
|
+
properties,
|
|
2538
|
+
xone,
|
|
2539
|
+
}))))))))))))))))))))))))))))))));
|
|
2540
|
+
}
|
|
2541
|
+
NodeShape.$propertiesFromRdf = $propertiesFromRdf;
|
|
2542
|
+
NodeShape.$schema = {
|
|
2543
|
+
properties: {
|
|
2544
|
+
$identifier: {
|
|
2545
|
+
kind: "Identifier",
|
|
2546
|
+
type: () => ({ kind: "Identifier" }),
|
|
2547
|
+
},
|
|
2548
|
+
$type: {
|
|
2549
|
+
kind: "TypeDiscriminant",
|
|
2550
|
+
type: () => ({
|
|
2551
|
+
kind: "TypeDiscriminant",
|
|
2552
|
+
ownValues: ["NodeShape"],
|
|
2553
|
+
}),
|
|
2554
|
+
},
|
|
2555
|
+
and: {
|
|
2556
|
+
kind: "Shacl",
|
|
2557
|
+
type: () => ({
|
|
2558
|
+
kind: "Set",
|
|
2559
|
+
item: () => ({
|
|
2560
|
+
kind: "List",
|
|
2561
|
+
item: () => ({ kind: "Identifier" }),
|
|
2562
|
+
}),
|
|
2563
|
+
}),
|
|
2564
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#and"),
|
|
2565
|
+
},
|
|
2566
|
+
classes: {
|
|
2567
|
+
kind: "Shacl",
|
|
2568
|
+
type: () => ({
|
|
2569
|
+
kind: "Set",
|
|
2570
|
+
item: () => ({ kind: "Iri" }),
|
|
2571
|
+
}),
|
|
2572
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#class"),
|
|
2573
|
+
},
|
|
2574
|
+
closed: {
|
|
2575
|
+
kind: "Shacl",
|
|
2576
|
+
type: () => ({
|
|
2577
|
+
kind: "Maybe",
|
|
2578
|
+
item: () => ({ kind: "Boolean" }),
|
|
2579
|
+
}),
|
|
2580
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#closed"),
|
|
2581
|
+
},
|
|
2582
|
+
comments: {
|
|
2583
|
+
kind: "Shacl",
|
|
2584
|
+
type: () => ({
|
|
2585
|
+
kind: "Set",
|
|
2586
|
+
item: () => ({ kind: "String" }),
|
|
2587
|
+
}),
|
|
2588
|
+
path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
|
|
2589
|
+
},
|
|
2590
|
+
datatype: {
|
|
2591
|
+
kind: "Shacl",
|
|
2592
|
+
type: () => ({
|
|
2593
|
+
kind: "Maybe",
|
|
2594
|
+
item: () => ({ kind: "Iri" }),
|
|
2595
|
+
}),
|
|
2596
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#datatype"),
|
|
2597
|
+
},
|
|
2598
|
+
deactivated: {
|
|
2599
|
+
kind: "Shacl",
|
|
2600
|
+
type: () => ({
|
|
2601
|
+
kind: "Maybe",
|
|
2602
|
+
item: () => ({ kind: "Boolean" }),
|
|
2603
|
+
}),
|
|
2604
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"),
|
|
2605
|
+
},
|
|
2606
|
+
flags: {
|
|
2607
|
+
kind: "Shacl",
|
|
2608
|
+
type: () => ({
|
|
2609
|
+
kind: "Set",
|
|
2610
|
+
item: () => ({ kind: "String" }),
|
|
2611
|
+
}),
|
|
2612
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#flags"),
|
|
2613
|
+
},
|
|
2614
|
+
hasValues: {
|
|
2615
|
+
kind: "Shacl",
|
|
2616
|
+
type: () => ({
|
|
2617
|
+
kind: "Set",
|
|
2618
|
+
item: () => ({ kind: "Term" }),
|
|
2619
|
+
}),
|
|
2620
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#hasValue"),
|
|
2621
|
+
},
|
|
2622
|
+
ignoredProperties: {
|
|
2623
|
+
kind: "Shacl",
|
|
2624
|
+
type: () => ({
|
|
2625
|
+
kind: "Maybe",
|
|
2626
|
+
item: () => ({
|
|
2627
|
+
kind: "List",
|
|
2628
|
+
item: () => ({ kind: "Iri" }),
|
|
2629
|
+
}),
|
|
2630
|
+
}),
|
|
2631
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#ignoredProperties"),
|
|
2632
|
+
},
|
|
2633
|
+
in_: {
|
|
2634
|
+
kind: "Shacl",
|
|
2635
|
+
type: () => ({
|
|
2636
|
+
kind: "Maybe",
|
|
2637
|
+
item: () => ({
|
|
2638
|
+
kind: "List",
|
|
2639
|
+
item: () => ({ kind: "Term" }),
|
|
2640
|
+
}),
|
|
2641
|
+
}),
|
|
2642
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#in"),
|
|
2643
|
+
},
|
|
2644
|
+
isDefinedBy: {
|
|
2645
|
+
kind: "Shacl",
|
|
2646
|
+
type: () => ({
|
|
2647
|
+
kind: "Maybe",
|
|
2648
|
+
item: () => ({ kind: "Identifier" }),
|
|
2649
|
+
}),
|
|
2650
|
+
path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"),
|
|
2651
|
+
},
|
|
2652
|
+
labels: {
|
|
2653
|
+
kind: "Shacl",
|
|
2654
|
+
type: () => ({
|
|
2655
|
+
kind: "Set",
|
|
2656
|
+
item: () => ({ kind: "String" }),
|
|
2657
|
+
}),
|
|
2658
|
+
path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
|
|
2659
|
+
},
|
|
2660
|
+
languageIn: {
|
|
2661
|
+
kind: "Shacl",
|
|
2662
|
+
type: () => ({
|
|
2663
|
+
kind: "Maybe",
|
|
2664
|
+
item: () => ({
|
|
2665
|
+
kind: "List",
|
|
2666
|
+
item: () => ({ kind: "String" }),
|
|
2667
|
+
}),
|
|
2668
|
+
}),
|
|
2669
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#languageIn"),
|
|
2670
|
+
},
|
|
2671
|
+
maxCount: {
|
|
2672
|
+
kind: "Shacl",
|
|
2673
|
+
type: () => ({
|
|
2674
|
+
kind: "Maybe",
|
|
2675
|
+
item: () => ({ kind: "Int" }),
|
|
2676
|
+
}),
|
|
2677
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxCount"),
|
|
2678
|
+
},
|
|
2679
|
+
maxExclusive: {
|
|
2680
|
+
kind: "Shacl",
|
|
2681
|
+
type: () => ({
|
|
2682
|
+
kind: "Maybe",
|
|
2683
|
+
item: () => ({ kind: "Literal" }),
|
|
2684
|
+
}),
|
|
2685
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxExclusive"),
|
|
2686
|
+
},
|
|
2687
|
+
maxInclusive: {
|
|
2688
|
+
kind: "Shacl",
|
|
2689
|
+
type: () => ({
|
|
2690
|
+
kind: "Maybe",
|
|
2691
|
+
item: () => ({ kind: "Literal" }),
|
|
2692
|
+
}),
|
|
2693
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxInclusive"),
|
|
2694
|
+
},
|
|
2695
|
+
maxLength: {
|
|
2696
|
+
kind: "Shacl",
|
|
2697
|
+
type: () => ({
|
|
2698
|
+
kind: "Maybe",
|
|
2699
|
+
item: () => ({ kind: "Int" }),
|
|
2700
|
+
}),
|
|
2701
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxLength"),
|
|
2702
|
+
},
|
|
2703
|
+
minCount: {
|
|
2704
|
+
kind: "Shacl",
|
|
2705
|
+
type: () => ({
|
|
2706
|
+
kind: "Maybe",
|
|
2707
|
+
item: () => ({ kind: "Int" }),
|
|
2708
|
+
}),
|
|
2709
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minCount"),
|
|
2710
|
+
},
|
|
2711
|
+
minExclusive: {
|
|
2712
|
+
kind: "Shacl",
|
|
2713
|
+
type: () => ({
|
|
2714
|
+
kind: "Maybe",
|
|
2715
|
+
item: () => ({ kind: "Literal" }),
|
|
2716
|
+
}),
|
|
2717
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minExclusive"),
|
|
2718
|
+
},
|
|
2719
|
+
minInclusive: {
|
|
2720
|
+
kind: "Shacl",
|
|
2721
|
+
type: () => ({
|
|
2722
|
+
kind: "Maybe",
|
|
2723
|
+
item: () => ({ kind: "Literal" }),
|
|
2724
|
+
}),
|
|
2725
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minInclusive"),
|
|
2726
|
+
},
|
|
2727
|
+
minLength: {
|
|
2728
|
+
kind: "Shacl",
|
|
2729
|
+
type: () => ({
|
|
2730
|
+
kind: "Maybe",
|
|
2731
|
+
item: () => ({ kind: "Int" }),
|
|
2732
|
+
}),
|
|
2733
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minLength"),
|
|
2734
|
+
},
|
|
2735
|
+
nodeKind: {
|
|
2736
|
+
kind: "Shacl",
|
|
2737
|
+
type: () => ({
|
|
2738
|
+
kind: "Maybe",
|
|
2739
|
+
item: () => ({
|
|
2740
|
+
kind: "Iri",
|
|
2741
|
+
in: [
|
|
2742
|
+
dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNode"),
|
|
2743
|
+
dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrIRI"),
|
|
2744
|
+
dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrLiteral"),
|
|
2745
|
+
dataFactory.namedNode("http://www.w3.org/ns/shacl#IRI"),
|
|
2746
|
+
dataFactory.namedNode("http://www.w3.org/ns/shacl#IRIOrLiteral"),
|
|
2747
|
+
dataFactory.namedNode("http://www.w3.org/ns/shacl#Literal"),
|
|
2748
|
+
],
|
|
2749
|
+
}),
|
|
2750
|
+
}),
|
|
2751
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"),
|
|
2752
|
+
},
|
|
2753
|
+
nodes: {
|
|
2754
|
+
kind: "Shacl",
|
|
2755
|
+
type: () => ({
|
|
2756
|
+
kind: "Set",
|
|
2757
|
+
item: () => ({ kind: "Identifier" }),
|
|
2758
|
+
}),
|
|
2759
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#node"),
|
|
2760
|
+
},
|
|
2761
|
+
not: {
|
|
2762
|
+
kind: "Shacl",
|
|
2763
|
+
type: () => ({
|
|
2764
|
+
kind: "Set",
|
|
2765
|
+
item: () => ({ kind: "Identifier" }),
|
|
2766
|
+
}),
|
|
2767
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#not"),
|
|
2768
|
+
},
|
|
2769
|
+
or: {
|
|
2770
|
+
kind: "Shacl",
|
|
2771
|
+
type: () => ({
|
|
2772
|
+
kind: "Set",
|
|
2773
|
+
item: () => ({
|
|
2774
|
+
kind: "List",
|
|
2775
|
+
item: () => ({ kind: "Identifier" }),
|
|
2776
|
+
}),
|
|
2777
|
+
}),
|
|
2778
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#or"),
|
|
2779
|
+
},
|
|
2780
|
+
patterns: {
|
|
2781
|
+
kind: "Shacl",
|
|
2782
|
+
type: () => ({
|
|
2783
|
+
kind: "Set",
|
|
2784
|
+
item: () => ({ kind: "String" }),
|
|
2785
|
+
}),
|
|
2786
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#pattern"),
|
|
2787
|
+
},
|
|
2788
|
+
properties: {
|
|
2789
|
+
kind: "Shacl",
|
|
2790
|
+
type: () => ({
|
|
2791
|
+
kind: "Set",
|
|
2792
|
+
item: () => ({ kind: "Identifier" }),
|
|
2793
|
+
}),
|
|
2794
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#property"),
|
|
2795
|
+
},
|
|
2796
|
+
xone: {
|
|
2797
|
+
kind: "Shacl",
|
|
2798
|
+
type: () => ({
|
|
2799
|
+
kind: "Set",
|
|
2800
|
+
item: () => ({
|
|
2801
|
+
kind: "List",
|
|
2802
|
+
item: () => ({ kind: "Identifier" }),
|
|
2803
|
+
}),
|
|
2804
|
+
}),
|
|
2805
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#xone"),
|
|
2806
|
+
},
|
|
2807
|
+
},
|
|
2808
|
+
};
|
|
2809
|
+
function $toRdf(_nodeShape, options) {
|
|
2810
|
+
const resourceSet = options?.resourceSet ??
|
|
2811
|
+
new ResourceSet(datasetFactory.dataset(), { dataFactory: dataFactory });
|
|
2812
|
+
const resource = resourceSet.resource(_nodeShape.$identifier);
|
|
2813
|
+
if (!options?.ignoreRdfType) {
|
|
2814
|
+
resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape"), options?.graph);
|
|
2815
|
+
}
|
|
2816
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#and"), _nodeShape.and.flatMap((item) => [
|
|
2817
|
+
item.length > 0
|
|
2818
|
+
? item.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
2819
|
+
if (itemIndex === 0) {
|
|
2820
|
+
currentSubListResource = listResource;
|
|
2821
|
+
}
|
|
2822
|
+
else {
|
|
2823
|
+
const newSubListResource = resourceSet.resource(dataFactory.blankNode());
|
|
2824
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
|
|
2825
|
+
currentSubListResource = newSubListResource;
|
|
2826
|
+
}
|
|
2827
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, [item], options?.graph);
|
|
2828
|
+
if (itemIndex + 1 === list.length) {
|
|
2829
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
|
|
2830
|
+
}
|
|
2831
|
+
return { currentSubListResource, listResource };
|
|
2832
|
+
}, {
|
|
2833
|
+
currentSubListResource: null,
|
|
2834
|
+
listResource: resourceSet.resource(dataFactory.blankNode()),
|
|
2835
|
+
}).listResource.identifier
|
|
2836
|
+
: $RdfVocabularies.rdf.nil,
|
|
2837
|
+
]), options?.graph);
|
|
2838
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#class"), _nodeShape.classes.flatMap((item) => [item]), options?.graph);
|
|
2839
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#closed"), _nodeShape.closed
|
|
2840
|
+
.toList()
|
|
2841
|
+
.flatMap((value) => [
|
|
2842
|
+
$literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
|
|
2843
|
+
]), options?.graph);
|
|
2844
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), _nodeShape.comments.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
|
|
2845
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#datatype"), _nodeShape.datatype.toList(), options?.graph);
|
|
2846
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"), _nodeShape.deactivated
|
|
2847
|
+
.toList()
|
|
2848
|
+
.flatMap((value) => [
|
|
2849
|
+
$literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
|
|
2850
|
+
]), options?.graph);
|
|
2851
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#flags"), _nodeShape.flags.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
|
|
2852
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#hasValue"), _nodeShape.hasValues.flatMap((item) => [item]), options?.graph);
|
|
2853
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#ignoredProperties"), _nodeShape.ignoredProperties.toList().flatMap((value) => [
|
|
2854
|
+
value.length > 0
|
|
2855
|
+
? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
2856
|
+
if (itemIndex === 0) {
|
|
2857
|
+
currentSubListResource = listResource;
|
|
2858
|
+
}
|
|
2859
|
+
else {
|
|
2860
|
+
const newSubListResource = resourceSet.resource(dataFactory.blankNode());
|
|
2861
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
|
|
2862
|
+
currentSubListResource = newSubListResource;
|
|
2863
|
+
}
|
|
2864
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, [item], options?.graph);
|
|
2865
|
+
if (itemIndex + 1 === list.length) {
|
|
2866
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
|
|
2867
|
+
}
|
|
2868
|
+
return { currentSubListResource, listResource };
|
|
2869
|
+
}, {
|
|
2870
|
+
currentSubListResource: null,
|
|
2871
|
+
listResource: resourceSet.resource(dataFactory.blankNode()),
|
|
2872
|
+
}).listResource.identifier
|
|
2873
|
+
: $RdfVocabularies.rdf.nil,
|
|
2874
|
+
]), options?.graph);
|
|
2875
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#in"), _nodeShape.in_.toList().flatMap((value) => [
|
|
2876
|
+
value.length > 0
|
|
2877
|
+
? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
2878
|
+
if (itemIndex === 0) {
|
|
2879
|
+
currentSubListResource = listResource;
|
|
2880
|
+
}
|
|
2881
|
+
else {
|
|
2882
|
+
const newSubListResource = resourceSet.resource(dataFactory.blankNode());
|
|
2883
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
|
|
2884
|
+
currentSubListResource = newSubListResource;
|
|
2885
|
+
}
|
|
2886
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, [item], options?.graph);
|
|
2887
|
+
if (itemIndex + 1 === list.length) {
|
|
2888
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
|
|
2889
|
+
}
|
|
2890
|
+
return { currentSubListResource, listResource };
|
|
2891
|
+
}, {
|
|
2892
|
+
currentSubListResource: null,
|
|
2893
|
+
listResource: resourceSet.resource(dataFactory.blankNode()),
|
|
2894
|
+
}).listResource.identifier
|
|
2895
|
+
: $RdfVocabularies.rdf.nil,
|
|
1841
2896
|
]), options?.graph);
|
|
1842
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/
|
|
2897
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"), _nodeShape.isDefinedBy.toList(), options?.graph);
|
|
2898
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), _nodeShape.labels.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
|
|
2899
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#languageIn"), _nodeShape.languageIn.toList().flatMap((value) => [
|
|
1843
2900
|
value.length > 0
|
|
1844
2901
|
? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
2902
|
+
if (itemIndex === 0) {
|
|
2903
|
+
currentSubListResource = listResource;
|
|
2904
|
+
}
|
|
2905
|
+
else {
|
|
2906
|
+
const newSubListResource = resourceSet.resource(dataFactory.blankNode());
|
|
2907
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
|
|
2908
|
+
currentSubListResource = newSubListResource;
|
|
2909
|
+
}
|
|
2910
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, [$literalFactory.string(item)], options?.graph);
|
|
2911
|
+
if (itemIndex + 1 === list.length) {
|
|
2912
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
|
|
2913
|
+
}
|
|
2914
|
+
return { currentSubListResource, listResource };
|
|
2915
|
+
}, {
|
|
2916
|
+
currentSubListResource: null,
|
|
2917
|
+
listResource: resourceSet.resource(dataFactory.blankNode()),
|
|
2918
|
+
}).listResource.identifier
|
|
2919
|
+
: $RdfVocabularies.rdf.nil,
|
|
2920
|
+
]), options?.graph);
|
|
2921
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxCount"), _nodeShape.maxCount
|
|
2922
|
+
.toList()
|
|
2923
|
+
.flatMap((value) => [
|
|
2924
|
+
$literalFactory.number(value, $RdfVocabularies.xsd.unsignedInt),
|
|
2925
|
+
]), options?.graph);
|
|
2926
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxExclusive"), _nodeShape.maxExclusive.toList(), options?.graph);
|
|
2927
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxInclusive"), _nodeShape.maxInclusive.toList(), options?.graph);
|
|
2928
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxLength"), _nodeShape.maxLength
|
|
2929
|
+
.toList()
|
|
2930
|
+
.flatMap((value) => [
|
|
2931
|
+
$literalFactory.number(value, $RdfVocabularies.xsd.unsignedInt),
|
|
2932
|
+
]), options?.graph);
|
|
2933
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minCount"), _nodeShape.minCount
|
|
2934
|
+
.toList()
|
|
2935
|
+
.flatMap((value) => [
|
|
2936
|
+
$literalFactory.number(value, $RdfVocabularies.xsd.unsignedInt),
|
|
2937
|
+
]), options?.graph);
|
|
2938
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minExclusive"), _nodeShape.minExclusive.toList(), options?.graph);
|
|
2939
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minInclusive"), _nodeShape.minInclusive.toList(), options?.graph);
|
|
2940
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minLength"), _nodeShape.minLength
|
|
2941
|
+
.toList()
|
|
2942
|
+
.flatMap((value) => [
|
|
2943
|
+
$literalFactory.number(value, $RdfVocabularies.xsd.unsignedInt),
|
|
2944
|
+
]), options?.graph);
|
|
2945
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"), _nodeShape.nodeKind.toList(), options?.graph);
|
|
2946
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#node"), _nodeShape.nodes.flatMap((item) => [item]), options?.graph);
|
|
2947
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#not"), _nodeShape.not.flatMap((item) => [item]), options?.graph);
|
|
2948
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#or"), _nodeShape.or.flatMap((item) => [
|
|
2949
|
+
item.length > 0
|
|
2950
|
+
? item.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
2951
|
+
if (itemIndex === 0) {
|
|
2952
|
+
currentSubListResource = listResource;
|
|
2953
|
+
}
|
|
2954
|
+
else {
|
|
2955
|
+
const newSubListResource = resourceSet.resource(dataFactory.blankNode());
|
|
2956
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
|
|
2957
|
+
currentSubListResource = newSubListResource;
|
|
2958
|
+
}
|
|
2959
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, [item], options?.graph);
|
|
2960
|
+
if (itemIndex + 1 === list.length) {
|
|
2961
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
|
|
2962
|
+
}
|
|
2963
|
+
return { currentSubListResource, listResource };
|
|
2964
|
+
}, {
|
|
2965
|
+
currentSubListResource: null,
|
|
2966
|
+
listResource: resourceSet.resource(dataFactory.blankNode()),
|
|
2967
|
+
}).listResource.identifier
|
|
2968
|
+
: $RdfVocabularies.rdf.nil,
|
|
2969
|
+
]), options?.graph);
|
|
2970
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#pattern"), _nodeShape.patterns.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
|
|
2971
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#property"), _nodeShape.properties.flatMap((item) => [item]), options?.graph);
|
|
2972
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#xone"), _nodeShape.xone.flatMap((item) => [
|
|
2973
|
+
item.length > 0
|
|
2974
|
+
? item.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
1845
2975
|
if (itemIndex === 0) {
|
|
1846
2976
|
currentSubListResource = listResource;
|
|
1847
2977
|
}
|
|
@@ -1861,195 +2991,50 @@ export var ShaclCoreNodeShape;
|
|
|
1861
2991
|
}).listResource.identifier
|
|
1862
2992
|
: $RdfVocabularies.rdf.nil,
|
|
1863
2993
|
]), options?.graph);
|
|
1864
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#property"), _shaclCoreNodeShape.properties.flatMap((item) => [item]), options?.graph);
|
|
1865
2994
|
return resource;
|
|
1866
2995
|
}
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
closed: {
|
|
1872
|
-
kind: "Shacl",
|
|
1873
|
-
type: () => ({
|
|
1874
|
-
kind: "Maybe",
|
|
1875
|
-
item: () => ({ kind: "Boolean" }),
|
|
1876
|
-
}),
|
|
1877
|
-
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#closed"),
|
|
1878
|
-
},
|
|
1879
|
-
ignoredProperties: {
|
|
1880
|
-
kind: "Shacl",
|
|
1881
|
-
type: () => ({
|
|
1882
|
-
kind: "Maybe",
|
|
1883
|
-
item: () => ({
|
|
1884
|
-
kind: "List",
|
|
1885
|
-
item: () => ({ kind: "Iri" }),
|
|
1886
|
-
}),
|
|
1887
|
-
}),
|
|
1888
|
-
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#ignoredProperties"),
|
|
1889
|
-
},
|
|
1890
|
-
properties: {
|
|
1891
|
-
kind: "Shacl",
|
|
1892
|
-
type: () => ({
|
|
1893
|
-
kind: "Set",
|
|
1894
|
-
item: () => ({ kind: "Identifier" }),
|
|
1895
|
-
}),
|
|
1896
|
-
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#property"),
|
|
1897
|
-
},
|
|
1898
|
-
},
|
|
1899
|
-
};
|
|
1900
|
-
})(ShaclCoreNodeShape || (ShaclCoreNodeShape = {}));
|
|
1901
|
-
export var OwlOntology;
|
|
1902
|
-
(function (OwlOntology) {
|
|
1903
|
-
function $filter(filter, value) {
|
|
1904
|
-
if (filter.$identifier !== undefined &&
|
|
1905
|
-
!$filterIdentifier(filter.$identifier, value.$identifier)) {
|
|
1906
|
-
return false;
|
|
1907
|
-
}
|
|
1908
|
-
if (filter.labels !== undefined &&
|
|
1909
|
-
!$filterArray($filterString)(filter.labels, value.labels)) {
|
|
1910
|
-
return false;
|
|
1911
|
-
}
|
|
1912
|
-
return true;
|
|
1913
|
-
}
|
|
1914
|
-
OwlOntology.$filter = $filter;
|
|
1915
|
-
OwlOntology.$fromRdfType = dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology");
|
|
2996
|
+
NodeShape.$toRdf = $toRdf;
|
|
2997
|
+
})(NodeShape || (NodeShape = {}));
|
|
2998
|
+
export var Shape;
|
|
2999
|
+
(function (Shape) {
|
|
1916
3000
|
let $Identifier;
|
|
1917
3001
|
(function ($Identifier) {
|
|
1918
3002
|
$Identifier.fromString = $identifierFromString; // biome-ignore lint/suspicious/noShadowRestrictedNames: allow toString
|
|
1919
3003
|
$Identifier.toString = Resource.Identifier.toString;
|
|
1920
|
-
})($Identifier =
|
|
1921
|
-
function isOwlOntology(object) {
|
|
1922
|
-
switch (object.$type) {
|
|
1923
|
-
case "OwlOntology":
|
|
1924
|
-
return true;
|
|
1925
|
-
default:
|
|
1926
|
-
return false;
|
|
1927
|
-
}
|
|
1928
|
-
}
|
|
1929
|
-
OwlOntology.isOwlOntology = isOwlOntology;
|
|
1930
|
-
function $fromRdf(resource, options) {
|
|
1931
|
-
let { context, ignoreRdfType = false, objectSet, preferredLanguages, } = options ?? {};
|
|
1932
|
-
if (!objectSet) {
|
|
1933
|
-
objectSet = new $RdfjsDatasetObjectSet(resource.dataset);
|
|
1934
|
-
}
|
|
1935
|
-
return OwlOntology.$propertiesFromRdf({
|
|
1936
|
-
context,
|
|
1937
|
-
ignoreRdfType,
|
|
1938
|
-
objectSet,
|
|
1939
|
-
preferredLanguages,
|
|
1940
|
-
resource,
|
|
1941
|
-
});
|
|
1942
|
-
}
|
|
1943
|
-
OwlOntology.$fromRdf = $fromRdf;
|
|
1944
|
-
function $propertiesFromRdf($parameters) {
|
|
1945
|
-
return (!$parameters.ignoreRdfType
|
|
1946
|
-
? $parameters.resource
|
|
1947
|
-
.value($RdfVocabularies.rdf.type, { graph: $parameters.graph })
|
|
1948
|
-
.chain((actualRdfType) => actualRdfType.toIri())
|
|
1949
|
-
.chain((actualRdfType) => {
|
|
1950
|
-
// Check the expected type and its known subtypes
|
|
1951
|
-
switch (actualRdfType.value) {
|
|
1952
|
-
case "http://www.w3.org/2002/07/owl#Ontology":
|
|
1953
|
-
return Right(true);
|
|
1954
|
-
}
|
|
1955
|
-
// Check arbitrary rdfs:subClassOf's of the expected type
|
|
1956
|
-
if ($parameters.resource.isInstanceOf(OwlOntology.$fromRdfType, {
|
|
1957
|
-
graph: $parameters.graph,
|
|
1958
|
-
})) {
|
|
1959
|
-
return Right(true);
|
|
1960
|
-
}
|
|
1961
|
-
return Left(new Error(`${Resource.Identifier.toString($parameters.resource.identifier)} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/2002/07/owl#Ontology)`));
|
|
1962
|
-
})
|
|
1963
|
-
: Right(true)).chain((_rdfTypeCheck) => Right(new Resource.Value({
|
|
1964
|
-
dataFactory: dataFactory,
|
|
1965
|
-
focusResource: $parameters.resource,
|
|
1966
|
-
propertyPath: $RdfVocabularies.rdf.subject,
|
|
1967
|
-
term: $parameters.resource.identifier,
|
|
1968
|
-
}).toValues())
|
|
1969
|
-
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
1970
|
-
.chain((values) => values.head())
|
|
1971
|
-
.chain(($identifier) => Right("OwlOntology").chain(($type) => $shaclPropertyFromRdf({
|
|
1972
|
-
graph: $parameters.graph,
|
|
1973
|
-
resource: $parameters.resource,
|
|
1974
|
-
propertySchema: OwlOntology.$schema.properties.labels,
|
|
1975
|
-
typeFromRdf: (resourceValues) => resourceValues
|
|
1976
|
-
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
1977
|
-
.chain((values) => values.chainMap((value) => value.toString()))
|
|
1978
|
-
.map((values) => values.toArray())
|
|
1979
|
-
.map((valuesArray) => Resource.Values.fromValue({
|
|
1980
|
-
focusResource: $parameters.resource,
|
|
1981
|
-
propertyPath: OwlOntology.$schema.properties.labels.path,
|
|
1982
|
-
value: valuesArray,
|
|
1983
|
-
})),
|
|
1984
|
-
}).map((labels) => ({ $identifier, $type, labels })))));
|
|
1985
|
-
}
|
|
1986
|
-
OwlOntology.$propertiesFromRdf = $propertiesFromRdf;
|
|
1987
|
-
function $toRdf(_owlOntology, options) {
|
|
1988
|
-
const resourceSet = options?.resourceSet ??
|
|
1989
|
-
new ResourceSet(datasetFactory.dataset(), { dataFactory: dataFactory });
|
|
1990
|
-
const resource = resourceSet.resource(_owlOntology.$identifier);
|
|
1991
|
-
if (!options?.ignoreRdfType) {
|
|
1992
|
-
resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"), options?.graph);
|
|
1993
|
-
}
|
|
1994
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), _owlOntology.labels.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
|
|
1995
|
-
return resource;
|
|
1996
|
-
}
|
|
1997
|
-
OwlOntology.$toRdf = $toRdf;
|
|
1998
|
-
OwlOntology.$schema = {
|
|
1999
|
-
properties: {
|
|
2000
|
-
$identifier: {
|
|
2001
|
-
kind: "Identifier",
|
|
2002
|
-
type: () => ({ kind: "Identifier" }),
|
|
2003
|
-
},
|
|
2004
|
-
$type: {
|
|
2005
|
-
kind: "TypeDiscriminant",
|
|
2006
|
-
type: () => ({
|
|
2007
|
-
kind: "TypeDiscriminant",
|
|
2008
|
-
ownValues: ["OwlOntology"],
|
|
2009
|
-
}),
|
|
2010
|
-
},
|
|
2011
|
-
labels: {
|
|
2012
|
-
kind: "Shacl",
|
|
2013
|
-
type: () => ({
|
|
2014
|
-
kind: "Set",
|
|
2015
|
-
item: () => ({ kind: "String" }),
|
|
2016
|
-
}),
|
|
2017
|
-
path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
|
|
2018
|
-
},
|
|
2019
|
-
},
|
|
2020
|
-
};
|
|
2021
|
-
})(OwlOntology || (OwlOntology = {}));
|
|
2022
|
-
export var ShaclCoreShape;
|
|
2023
|
-
(function (ShaclCoreShape) {
|
|
3004
|
+
})($Identifier = Shape.$Identifier || (Shape.$Identifier = {}));
|
|
2024
3005
|
function $filter(filter, value) {
|
|
2025
3006
|
if (filter.$identifier !== undefined &&
|
|
2026
3007
|
!$filterIdentifier(filter.$identifier, value.$identifier)) {
|
|
2027
3008
|
return false;
|
|
2028
3009
|
}
|
|
2029
|
-
if (
|
|
2030
|
-
filter.on?.
|
|
2031
|
-
!
|
|
3010
|
+
if (NodeShape.isNodeShape(value) &&
|
|
3011
|
+
filter.on?.NodeShape &&
|
|
3012
|
+
!NodeShape.$filter(filter.on.NodeShape, value)) {
|
|
2032
3013
|
return false;
|
|
2033
3014
|
}
|
|
2034
|
-
if (
|
|
2035
|
-
filter.on?.
|
|
2036
|
-
!
|
|
3015
|
+
if (PropertyShape.isPropertyShape(value) &&
|
|
3016
|
+
filter.on?.PropertyShape &&
|
|
3017
|
+
!PropertyShape.$filter(filter.on.PropertyShape, value)) {
|
|
2037
3018
|
return false;
|
|
2038
3019
|
}
|
|
2039
3020
|
return true;
|
|
2040
3021
|
}
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
3022
|
+
Shape.$filter = $filter;
|
|
3023
|
+
function $fromRdf(resource, options) {
|
|
3024
|
+
return NodeShape.$fromRdf(resource, {
|
|
3025
|
+
...options,
|
|
3026
|
+
ignoreRdfType: false,
|
|
3027
|
+
}).altLazy(() => PropertyShape.$fromRdf(resource, {
|
|
3028
|
+
...options,
|
|
3029
|
+
ignoreRdfType: false,
|
|
3030
|
+
}));
|
|
3031
|
+
}
|
|
3032
|
+
Shape.$fromRdf = $fromRdf;
|
|
3033
|
+
function isShape(object) {
|
|
3034
|
+
return (NodeShape.isNodeShape(object) || PropertyShape.isPropertyShape(object));
|
|
2050
3035
|
}
|
|
2051
|
-
|
|
2052
|
-
|
|
3036
|
+
Shape.isShape = isShape;
|
|
3037
|
+
Shape.$schema = {
|
|
2053
3038
|
properties: {
|
|
2054
3039
|
and: {
|
|
2055
3040
|
kind: "Shacl",
|
|
@@ -2278,110 +3263,95 @@ export var ShaclCoreShape;
|
|
|
2278
3263
|
},
|
|
2279
3264
|
},
|
|
2280
3265
|
};
|
|
2281
|
-
function $
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
ignoreRdfType: false,
|
|
2285
|
-
}).altLazy(() => ShaclCorePropertyShape.$fromRdf(resource, {
|
|
2286
|
-
...options,
|
|
2287
|
-
ignoreRdfType: false,
|
|
2288
|
-
}));
|
|
2289
|
-
}
|
|
2290
|
-
ShaclCoreShape.$fromRdf = $fromRdf;
|
|
2291
|
-
function $toRdf(_shaclCoreShape, _parameters) {
|
|
2292
|
-
if (ShaclCoreNodeShape.isShaclCoreNodeShape(_shaclCoreShape)) {
|
|
2293
|
-
return ShaclCoreNodeShape.$toRdf(_shaclCoreShape, _parameters);
|
|
3266
|
+
function $toRdf(_shape, _parameters) {
|
|
3267
|
+
if (NodeShape.isNodeShape(_shape)) {
|
|
3268
|
+
return NodeShape.$toRdf(_shape, _parameters);
|
|
2294
3269
|
}
|
|
2295
|
-
if (
|
|
2296
|
-
return
|
|
3270
|
+
if (PropertyShape.isPropertyShape(_shape)) {
|
|
3271
|
+
return PropertyShape.$toRdf(_shape, _parameters);
|
|
2297
3272
|
}
|
|
2298
3273
|
throw new Error("unrecognized type");
|
|
2299
3274
|
}
|
|
2300
|
-
|
|
2301
|
-
})(
|
|
3275
|
+
Shape.$toRdf = $toRdf;
|
|
3276
|
+
})(Shape || (Shape = {}));
|
|
2302
3277
|
export var $Object;
|
|
2303
3278
|
(function ($Object) {
|
|
3279
|
+
let $Identifier;
|
|
3280
|
+
(function ($Identifier) {
|
|
3281
|
+
$Identifier.fromString = $identifierFromString; // biome-ignore lint/suspicious/noShadowRestrictedNames: allow toString
|
|
3282
|
+
$Identifier.toString = Resource.Identifier.toString;
|
|
3283
|
+
})($Identifier = $Object.$Identifier || ($Object.$Identifier = {}));
|
|
2304
3284
|
function $filter(filter, value) {
|
|
2305
3285
|
if (filter.$identifier !== undefined &&
|
|
2306
3286
|
!$filterIdentifier(filter.$identifier, value.$identifier)) {
|
|
2307
3287
|
return false;
|
|
2308
3288
|
}
|
|
2309
|
-
if (
|
|
2310
|
-
filter.on?.
|
|
2311
|
-
!
|
|
2312
|
-
return false;
|
|
2313
|
-
}
|
|
2314
|
-
if (ShaclCoreNodeShape.isShaclCoreNodeShape(value) &&
|
|
2315
|
-
filter.on?.ShaclCoreNodeShape &&
|
|
2316
|
-
!ShaclCoreNodeShape.$filter(filter.on.ShaclCoreNodeShape, value)) {
|
|
3289
|
+
if (NodeShape.isNodeShape(value) &&
|
|
3290
|
+
filter.on?.NodeShape &&
|
|
3291
|
+
!NodeShape.$filter(filter.on.NodeShape, value)) {
|
|
2317
3292
|
return false;
|
|
2318
3293
|
}
|
|
2319
|
-
if (
|
|
2320
|
-
filter.on?.
|
|
2321
|
-
!
|
|
3294
|
+
if (Ontology.isOntology(value) &&
|
|
3295
|
+
filter.on?.Ontology &&
|
|
3296
|
+
!Ontology.$filter(filter.on.Ontology, value)) {
|
|
2322
3297
|
return false;
|
|
2323
3298
|
}
|
|
2324
|
-
if (
|
|
2325
|
-
filter.on?.
|
|
2326
|
-
!
|
|
3299
|
+
if (PropertyGroup.isPropertyGroup(value) &&
|
|
3300
|
+
filter.on?.PropertyGroup &&
|
|
3301
|
+
!PropertyGroup.$filter(filter.on.PropertyGroup, value)) {
|
|
2327
3302
|
return false;
|
|
2328
3303
|
}
|
|
2329
|
-
if (
|
|
2330
|
-
filter.on?.
|
|
2331
|
-
!
|
|
3304
|
+
if (PropertyShape.isPropertyShape(value) &&
|
|
3305
|
+
filter.on?.PropertyShape &&
|
|
3306
|
+
!PropertyShape.$filter(filter.on.PropertyShape, value)) {
|
|
2332
3307
|
return false;
|
|
2333
3308
|
}
|
|
2334
3309
|
return true;
|
|
2335
3310
|
}
|
|
2336
3311
|
$Object.$filter = $filter;
|
|
2337
|
-
let $Identifier;
|
|
2338
|
-
(function ($Identifier) {
|
|
2339
|
-
$Identifier.fromString = $identifierFromString; // biome-ignore lint/suspicious/noShadowRestrictedNames: allow toString
|
|
2340
|
-
$Identifier.toString = Resource.Identifier.toString;
|
|
2341
|
-
})($Identifier = $Object.$Identifier || ($Object.$Identifier = {}));
|
|
2342
|
-
$Object.$schema = {
|
|
2343
|
-
properties: {
|
|
2344
|
-
labels: {
|
|
2345
|
-
kind: "Shacl",
|
|
2346
|
-
type: () => ({
|
|
2347
|
-
kind: "Set",
|
|
2348
|
-
item: () => ({ kind: "String" }),
|
|
2349
|
-
}),
|
|
2350
|
-
path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
|
|
2351
|
-
},
|
|
2352
|
-
},
|
|
2353
|
-
};
|
|
2354
3312
|
function $fromRdf(resource, options) {
|
|
2355
|
-
return
|
|
3313
|
+
return NodeShape.$fromRdf(resource, {
|
|
2356
3314
|
...options,
|
|
2357
3315
|
ignoreRdfType: false,
|
|
2358
3316
|
})
|
|
2359
|
-
.altLazy(() =>
|
|
3317
|
+
.altLazy(() => Ontology.$fromRdf(resource, {
|
|
2360
3318
|
...options,
|
|
2361
3319
|
ignoreRdfType: false,
|
|
2362
3320
|
}))
|
|
2363
|
-
.altLazy(() =>
|
|
3321
|
+
.altLazy(() => PropertyGroup.$fromRdf(resource, {
|
|
2364
3322
|
...options,
|
|
2365
3323
|
ignoreRdfType: false,
|
|
2366
3324
|
}))
|
|
2367
|
-
.altLazy(() =>
|
|
3325
|
+
.altLazy(() => PropertyShape.$fromRdf(resource, {
|
|
2368
3326
|
...options,
|
|
2369
3327
|
ignoreRdfType: false,
|
|
2370
3328
|
}));
|
|
2371
3329
|
}
|
|
2372
3330
|
$Object.$fromRdf = $fromRdf;
|
|
3331
|
+
$Object.$schema = {
|
|
3332
|
+
properties: {
|
|
3333
|
+
labels: {
|
|
3334
|
+
kind: "Shacl",
|
|
3335
|
+
type: () => ({
|
|
3336
|
+
kind: "Set",
|
|
3337
|
+
item: () => ({ kind: "String" }),
|
|
3338
|
+
}),
|
|
3339
|
+
path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
|
|
3340
|
+
},
|
|
3341
|
+
},
|
|
3342
|
+
};
|
|
2373
3343
|
function $toRdf(_object, _parameters) {
|
|
2374
|
-
if (
|
|
2375
|
-
return
|
|
3344
|
+
if (NodeShape.isNodeShape(_object)) {
|
|
3345
|
+
return NodeShape.$toRdf(_object, _parameters);
|
|
2376
3346
|
}
|
|
2377
|
-
if (
|
|
2378
|
-
return
|
|
3347
|
+
if (Ontology.isOntology(_object)) {
|
|
3348
|
+
return Ontology.$toRdf(_object, _parameters);
|
|
2379
3349
|
}
|
|
2380
|
-
if (
|
|
2381
|
-
return
|
|
3350
|
+
if (PropertyGroup.isPropertyGroup(_object)) {
|
|
3351
|
+
return PropertyGroup.$toRdf(_object, _parameters);
|
|
2382
3352
|
}
|
|
2383
|
-
if (
|
|
2384
|
-
return
|
|
3353
|
+
if (PropertyShape.isPropertyShape(_object)) {
|
|
3354
|
+
return PropertyShape.$toRdf(_object, _parameters);
|
|
2385
3355
|
}
|
|
2386
3356
|
throw new Error("unrecognized type");
|
|
2387
3357
|
}
|
|
@@ -2403,158 +3373,176 @@ export class $RdfjsDatasetObjectSet {
|
|
|
2403
3373
|
$resourceSet() {
|
|
2404
3374
|
return new ResourceSet(this.$dataset(), { dataFactory: dataFactory });
|
|
2405
3375
|
}
|
|
2406
|
-
async
|
|
2407
|
-
return this.
|
|
3376
|
+
async nodeShape(identifier, options) {
|
|
3377
|
+
return this.nodeShapeSync(identifier, options);
|
|
2408
3378
|
}
|
|
2409
|
-
|
|
2410
|
-
return this.
|
|
3379
|
+
nodeShapeSync(identifier, options) {
|
|
3380
|
+
return this.nodeShapesSync({
|
|
3381
|
+
identifiers: [identifier],
|
|
3382
|
+
preferredLanguages: options?.preferredLanguages,
|
|
3383
|
+
}).map((objects) => objects[0]);
|
|
2411
3384
|
}
|
|
2412
|
-
async
|
|
2413
|
-
return this.
|
|
3385
|
+
async nodeShapeCount(query) {
|
|
3386
|
+
return this.nodeShapeCountSync(query);
|
|
2414
3387
|
}
|
|
2415
|
-
|
|
2416
|
-
return this.
|
|
3388
|
+
nodeShapeCountSync(query) {
|
|
3389
|
+
return this.nodeShapesSync(query).map((objects) => objects.length);
|
|
2417
3390
|
}
|
|
2418
|
-
async
|
|
2419
|
-
return this.
|
|
3391
|
+
async nodeShapeIdentifiers(query) {
|
|
3392
|
+
return this.nodeShapeIdentifiersSync(query);
|
|
2420
3393
|
}
|
|
2421
|
-
|
|
2422
|
-
return this.
|
|
3394
|
+
nodeShapeIdentifiersSync(query) {
|
|
3395
|
+
return this.nodeShapesSync(query).map((objects) => objects.map((object) => object.$identifier));
|
|
2423
3396
|
}
|
|
2424
|
-
async
|
|
2425
|
-
return this.
|
|
3397
|
+
async nodeShapes(query) {
|
|
3398
|
+
return this.nodeShapesSync(query);
|
|
2426
3399
|
}
|
|
2427
|
-
|
|
3400
|
+
nodeShapesSync(query) {
|
|
2428
3401
|
return this.$objectsSync({
|
|
2429
|
-
$filter:
|
|
2430
|
-
$fromRdf:
|
|
2431
|
-
$fromRdfTypes: [
|
|
3402
|
+
$filter: NodeShape.$filter,
|
|
3403
|
+
$fromRdf: NodeShape.$fromRdf,
|
|
3404
|
+
$fromRdfTypes: [NodeShape.$fromRdfType],
|
|
2432
3405
|
}, query);
|
|
2433
3406
|
}
|
|
2434
|
-
async
|
|
2435
|
-
return this.
|
|
3407
|
+
async ontology(identifier, options) {
|
|
3408
|
+
return this.ontologySync(identifier, options);
|
|
2436
3409
|
}
|
|
2437
|
-
|
|
2438
|
-
return this.
|
|
3410
|
+
ontologySync(identifier, options) {
|
|
3411
|
+
return this.ontologiesSync({
|
|
3412
|
+
identifiers: [identifier],
|
|
3413
|
+
preferredLanguages: options?.preferredLanguages,
|
|
3414
|
+
}).map((objects) => objects[0]);
|
|
2439
3415
|
}
|
|
2440
|
-
async
|
|
2441
|
-
return this.
|
|
3416
|
+
async ontologyCount(query) {
|
|
3417
|
+
return this.ontologyCountSync(query);
|
|
2442
3418
|
}
|
|
2443
|
-
|
|
2444
|
-
return this.
|
|
3419
|
+
ontologyCountSync(query) {
|
|
3420
|
+
return this.ontologiesSync(query).map((objects) => objects.length);
|
|
2445
3421
|
}
|
|
2446
|
-
async
|
|
2447
|
-
return this.
|
|
3422
|
+
async ontologyIdentifiers(query) {
|
|
3423
|
+
return this.ontologyIdentifiersSync(query);
|
|
2448
3424
|
}
|
|
2449
|
-
|
|
2450
|
-
return this.
|
|
3425
|
+
ontologyIdentifiersSync(query) {
|
|
3426
|
+
return this.ontologiesSync(query).map((objects) => objects.map((object) => object.$identifier));
|
|
2451
3427
|
}
|
|
2452
|
-
async
|
|
2453
|
-
return this.
|
|
3428
|
+
async ontologies(query) {
|
|
3429
|
+
return this.ontologiesSync(query);
|
|
2454
3430
|
}
|
|
2455
|
-
|
|
3431
|
+
ontologiesSync(query) {
|
|
2456
3432
|
return this.$objectsSync({
|
|
2457
|
-
$filter:
|
|
2458
|
-
$fromRdf:
|
|
2459
|
-
$fromRdfTypes: [
|
|
3433
|
+
$filter: Ontology.$filter,
|
|
3434
|
+
$fromRdf: Ontology.$fromRdf,
|
|
3435
|
+
$fromRdfTypes: [Ontology.$fromRdfType],
|
|
2460
3436
|
}, query);
|
|
2461
3437
|
}
|
|
2462
|
-
async
|
|
2463
|
-
return this.
|
|
3438
|
+
async propertyGroup(identifier, options) {
|
|
3439
|
+
return this.propertyGroupSync(identifier, options);
|
|
2464
3440
|
}
|
|
2465
|
-
|
|
2466
|
-
return this.
|
|
3441
|
+
propertyGroupSync(identifier, options) {
|
|
3442
|
+
return this.propertyGroupsSync({
|
|
3443
|
+
identifiers: [identifier],
|
|
3444
|
+
preferredLanguages: options?.preferredLanguages,
|
|
3445
|
+
}).map((objects) => objects[0]);
|
|
2467
3446
|
}
|
|
2468
|
-
async
|
|
2469
|
-
return this.
|
|
3447
|
+
async propertyGroupCount(query) {
|
|
3448
|
+
return this.propertyGroupCountSync(query);
|
|
2470
3449
|
}
|
|
2471
|
-
|
|
2472
|
-
return this.
|
|
3450
|
+
propertyGroupCountSync(query) {
|
|
3451
|
+
return this.propertyGroupsSync(query).map((objects) => objects.length);
|
|
2473
3452
|
}
|
|
2474
|
-
async
|
|
2475
|
-
return this.
|
|
3453
|
+
async propertyGroupIdentifiers(query) {
|
|
3454
|
+
return this.propertyGroupIdentifiersSync(query);
|
|
2476
3455
|
}
|
|
2477
|
-
|
|
2478
|
-
return this.
|
|
3456
|
+
propertyGroupIdentifiersSync(query) {
|
|
3457
|
+
return this.propertyGroupsSync(query).map((objects) => objects.map((object) => object.$identifier));
|
|
2479
3458
|
}
|
|
2480
|
-
async
|
|
2481
|
-
return this.
|
|
3459
|
+
async propertyGroups(query) {
|
|
3460
|
+
return this.propertyGroupsSync(query);
|
|
2482
3461
|
}
|
|
2483
|
-
|
|
3462
|
+
propertyGroupsSync(query) {
|
|
2484
3463
|
return this.$objectsSync({
|
|
2485
|
-
$filter:
|
|
2486
|
-
$fromRdf:
|
|
2487
|
-
$fromRdfTypes: [
|
|
3464
|
+
$filter: PropertyGroup.$filter,
|
|
3465
|
+
$fromRdf: PropertyGroup.$fromRdf,
|
|
3466
|
+
$fromRdfTypes: [PropertyGroup.$fromRdfType],
|
|
2488
3467
|
}, query);
|
|
2489
3468
|
}
|
|
2490
|
-
async
|
|
2491
|
-
return this.
|
|
3469
|
+
async propertyShape(identifier, options) {
|
|
3470
|
+
return this.propertyShapeSync(identifier, options);
|
|
2492
3471
|
}
|
|
2493
|
-
|
|
2494
|
-
return this.
|
|
3472
|
+
propertyShapeSync(identifier, options) {
|
|
3473
|
+
return this.propertyShapesSync({
|
|
3474
|
+
identifiers: [identifier],
|
|
3475
|
+
preferredLanguages: options?.preferredLanguages,
|
|
3476
|
+
}).map((objects) => objects[0]);
|
|
2495
3477
|
}
|
|
2496
|
-
async
|
|
2497
|
-
return this.
|
|
3478
|
+
async propertyShapeCount(query) {
|
|
3479
|
+
return this.propertyShapeCountSync(query);
|
|
2498
3480
|
}
|
|
2499
|
-
|
|
2500
|
-
return this.
|
|
3481
|
+
propertyShapeCountSync(query) {
|
|
3482
|
+
return this.propertyShapesSync(query).map((objects) => objects.length);
|
|
2501
3483
|
}
|
|
2502
|
-
async
|
|
2503
|
-
return this.
|
|
3484
|
+
async propertyShapeIdentifiers(query) {
|
|
3485
|
+
return this.propertyShapeIdentifiersSync(query);
|
|
2504
3486
|
}
|
|
2505
|
-
|
|
2506
|
-
return this.
|
|
3487
|
+
propertyShapeIdentifiersSync(query) {
|
|
3488
|
+
return this.propertyShapesSync(query).map((objects) => objects.map((object) => object.$identifier));
|
|
2507
3489
|
}
|
|
2508
|
-
async
|
|
2509
|
-
return this.
|
|
3490
|
+
async propertyShapes(query) {
|
|
3491
|
+
return this.propertyShapesSync(query);
|
|
2510
3492
|
}
|
|
2511
|
-
|
|
3493
|
+
propertyShapesSync(query) {
|
|
2512
3494
|
return this.$objectsSync({
|
|
2513
|
-
$filter:
|
|
2514
|
-
$fromRdf:
|
|
2515
|
-
$fromRdfTypes: [
|
|
3495
|
+
$filter: PropertyShape.$filter,
|
|
3496
|
+
$fromRdf: PropertyShape.$fromRdf,
|
|
3497
|
+
$fromRdfTypes: [PropertyShape.$fromRdfType],
|
|
2516
3498
|
}, query);
|
|
2517
3499
|
}
|
|
2518
|
-
async
|
|
2519
|
-
return this.
|
|
3500
|
+
async shape(identifier, options) {
|
|
3501
|
+
return this.shapeSync(identifier, options);
|
|
2520
3502
|
}
|
|
2521
|
-
|
|
2522
|
-
return this.
|
|
3503
|
+
shapeSync(identifier, options) {
|
|
3504
|
+
return this.shapesSync({
|
|
3505
|
+
identifiers: [identifier],
|
|
3506
|
+
preferredLanguages: options?.preferredLanguages,
|
|
3507
|
+
}).map((objects) => objects[0]);
|
|
2523
3508
|
}
|
|
2524
|
-
async
|
|
2525
|
-
return this.
|
|
3509
|
+
async shapeCount(query) {
|
|
3510
|
+
return this.shapeCountSync(query);
|
|
2526
3511
|
}
|
|
2527
|
-
|
|
2528
|
-
return this.
|
|
3512
|
+
shapeCountSync(query) {
|
|
3513
|
+
return this.shapesSync(query).map((objects) => objects.length);
|
|
2529
3514
|
}
|
|
2530
|
-
async
|
|
2531
|
-
return this.
|
|
3515
|
+
async shapeIdentifiers(query) {
|
|
3516
|
+
return this.shapeIdentifiersSync(query);
|
|
2532
3517
|
}
|
|
2533
|
-
|
|
2534
|
-
return this.
|
|
3518
|
+
shapeIdentifiersSync(query) {
|
|
3519
|
+
return this.shapesSync(query).map((objects) => objects.map((object) => object.$identifier));
|
|
2535
3520
|
}
|
|
2536
|
-
async
|
|
2537
|
-
return this.
|
|
3521
|
+
async shapes(query) {
|
|
3522
|
+
return this.shapesSync(query);
|
|
2538
3523
|
}
|
|
2539
|
-
|
|
3524
|
+
shapesSync(query) {
|
|
2540
3525
|
return this.$objectUnionsSync([
|
|
2541
3526
|
{
|
|
2542
|
-
$filter:
|
|
2543
|
-
$fromRdf:
|
|
2544
|
-
$fromRdfTypes: [
|
|
3527
|
+
$filter: Shape.$filter,
|
|
3528
|
+
$fromRdf: NodeShape.$fromRdf,
|
|
3529
|
+
$fromRdfTypes: [NodeShape.$fromRdfType],
|
|
2545
3530
|
},
|
|
2546
3531
|
{
|
|
2547
|
-
$filter:
|
|
2548
|
-
$fromRdf:
|
|
2549
|
-
$fromRdfTypes: [
|
|
3532
|
+
$filter: Shape.$filter,
|
|
3533
|
+
$fromRdf: PropertyShape.$fromRdf,
|
|
3534
|
+
$fromRdfTypes: [PropertyShape.$fromRdfType],
|
|
2550
3535
|
},
|
|
2551
3536
|
], query);
|
|
2552
3537
|
}
|
|
2553
|
-
async object(identifier) {
|
|
2554
|
-
return this.objectSync(identifier);
|
|
3538
|
+
async object(identifier, options) {
|
|
3539
|
+
return this.objectSync(identifier, options);
|
|
2555
3540
|
}
|
|
2556
|
-
objectSync(identifier) {
|
|
2557
|
-
return this.objectsSync({
|
|
3541
|
+
objectSync(identifier, options) {
|
|
3542
|
+
return this.objectsSync({
|
|
3543
|
+
identifiers: [identifier],
|
|
3544
|
+
preferredLanguages: options?.preferredLanguages,
|
|
3545
|
+
}).map((objects) => objects[0]);
|
|
2558
3546
|
}
|
|
2559
3547
|
async objectCount(query) {
|
|
2560
3548
|
return this.objectCountSync(query);
|
|
@@ -2575,23 +3563,23 @@ export class $RdfjsDatasetObjectSet {
|
|
|
2575
3563
|
return this.$objectUnionsSync([
|
|
2576
3564
|
{
|
|
2577
3565
|
$filter: $Object.$filter,
|
|
2578
|
-
$fromRdf:
|
|
2579
|
-
$fromRdfTypes: [
|
|
3566
|
+
$fromRdf: NodeShape.$fromRdf,
|
|
3567
|
+
$fromRdfTypes: [NodeShape.$fromRdfType],
|
|
2580
3568
|
},
|
|
2581
3569
|
{
|
|
2582
3570
|
$filter: $Object.$filter,
|
|
2583
|
-
$fromRdf:
|
|
2584
|
-
$fromRdfTypes: [
|
|
3571
|
+
$fromRdf: Ontology.$fromRdf,
|
|
3572
|
+
$fromRdfTypes: [Ontology.$fromRdfType],
|
|
2585
3573
|
},
|
|
2586
3574
|
{
|
|
2587
3575
|
$filter: $Object.$filter,
|
|
2588
|
-
$fromRdf:
|
|
2589
|
-
$fromRdfTypes: [
|
|
3576
|
+
$fromRdf: PropertyGroup.$fromRdf,
|
|
3577
|
+
$fromRdfTypes: [PropertyGroup.$fromRdfType],
|
|
2590
3578
|
},
|
|
2591
3579
|
{
|
|
2592
3580
|
$filter: $Object.$filter,
|
|
2593
|
-
$fromRdf:
|
|
2594
|
-
$fromRdfTypes: [
|
|
3581
|
+
$fromRdf: PropertyShape.$fromRdf,
|
|
3582
|
+
$fromRdfTypes: [PropertyShape.$fromRdfType],
|
|
2595
3583
|
},
|
|
2596
3584
|
], query);
|
|
2597
3585
|
}
|
|
@@ -2605,6 +3593,11 @@ export class $RdfjsDatasetObjectSet {
|
|
|
2605
3593
|
if (offset < 0) {
|
|
2606
3594
|
offset = 0;
|
|
2607
3595
|
}
|
|
3596
|
+
const fromRdfOptions = {
|
|
3597
|
+
graph,
|
|
3598
|
+
objectSet: this,
|
|
3599
|
+
preferredLanguages: query?.preferredLanguages,
|
|
3600
|
+
};
|
|
2608
3601
|
let resources;
|
|
2609
3602
|
const resourceSet = this.$resourceSet(); // Access once, in case it's instantiated lazily
|
|
2610
3603
|
let sortResources;
|
|
@@ -2650,9 +3643,7 @@ export class $RdfjsDatasetObjectSet {
|
|
|
2650
3643
|
identifierSet.add(quad.subject);
|
|
2651
3644
|
const resource = resourceSet.resource(quad.subject);
|
|
2652
3645
|
// Eagerly eliminate the majority of resources that won't match the object type
|
|
2653
|
-
objectType
|
|
2654
|
-
.$fromRdf(resource, { graph, objectSet: this })
|
|
2655
|
-
.ifRight((object) => {
|
|
3646
|
+
objectType.$fromRdf(resource, fromRdfOptions).ifRight((object) => {
|
|
2656
3647
|
resources.push({ object, resource });
|
|
2657
3648
|
});
|
|
2658
3649
|
}
|
|
@@ -2665,10 +3656,7 @@ export class $RdfjsDatasetObjectSet {
|
|
|
2665
3656
|
const objects = [];
|
|
2666
3657
|
for (let { object, resource } of resources) {
|
|
2667
3658
|
if (!object) {
|
|
2668
|
-
const objectEither = objectType.$fromRdf(resource,
|
|
2669
|
-
graph,
|
|
2670
|
-
objectSet: this,
|
|
2671
|
-
});
|
|
3659
|
+
const objectEither = objectType.$fromRdf(resource, fromRdfOptions);
|
|
2672
3660
|
if (objectEither.isLeft()) {
|
|
2673
3661
|
return objectEither;
|
|
2674
3662
|
}
|
|
@@ -2696,6 +3684,11 @@ export class $RdfjsDatasetObjectSet {
|
|
|
2696
3684
|
if (offset < 0) {
|
|
2697
3685
|
offset = 0;
|
|
2698
3686
|
}
|
|
3687
|
+
const fromRdfOptions = {
|
|
3688
|
+
graph,
|
|
3689
|
+
objectSet: this,
|
|
3690
|
+
preferredLanguages: query?.preferredLanguages,
|
|
3691
|
+
};
|
|
2699
3692
|
let resources;
|
|
2700
3693
|
const resourceSet = this.$resourceSet(); // Access once, in case it's instantiated lazily
|
|
2701
3694
|
let sortResources;
|
|
@@ -2745,7 +3738,7 @@ export class $RdfjsDatasetObjectSet {
|
|
|
2745
3738
|
const resource = resourceSet.resource(quad.subject);
|
|
2746
3739
|
for (const objectType of objectTypes) {
|
|
2747
3740
|
if (objectType
|
|
2748
|
-
.$fromRdf(resource,
|
|
3741
|
+
.$fromRdf(resource, fromRdfOptions)
|
|
2749
3742
|
.ifRight((object) => {
|
|
2750
3743
|
resources.push({ object, objectType, resource });
|
|
2751
3744
|
})
|
|
@@ -2765,18 +3758,12 @@ export class $RdfjsDatasetObjectSet {
|
|
|
2765
3758
|
if (!object) {
|
|
2766
3759
|
let objectEither;
|
|
2767
3760
|
if (objectType) {
|
|
2768
|
-
objectEither = objectType.$fromRdf(resource,
|
|
2769
|
-
graph,
|
|
2770
|
-
objectSet: this,
|
|
2771
|
-
});
|
|
3761
|
+
objectEither = objectType.$fromRdf(resource, fromRdfOptions);
|
|
2772
3762
|
}
|
|
2773
3763
|
else {
|
|
2774
3764
|
objectEither = Left(new Error("no object types"));
|
|
2775
3765
|
for (const tryObjectType of objectTypes) {
|
|
2776
|
-
objectEither = tryObjectType.$fromRdf(resource,
|
|
2777
|
-
graph,
|
|
2778
|
-
objectSet: this,
|
|
2779
|
-
});
|
|
3766
|
+
objectEither = tryObjectType.$fromRdf(resource, fromRdfOptions);
|
|
2780
3767
|
if (objectEither.isRight()) {
|
|
2781
3768
|
objectType = tryObjectType;
|
|
2782
3769
|
break;
|