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