@shaclmate/shacl-ast 3.0.2 → 3.0.4
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/generated.d.ts +45 -22
- package/dist/generated.js +652 -450
- package/package.json +14 -4
package/dist/generated.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { StoreFactory as _DatasetFactory
|
|
1
|
+
import { StoreFactory as _DatasetFactory } from "n3";
|
|
2
2
|
const datasetFactory = new _DatasetFactory();
|
|
3
|
+
import { DataFactory as dataFactory } from "n3";
|
|
3
4
|
import * as purify from "purify-ts";
|
|
4
5
|
import * as rdfjsResource from "rdfjs-resource";
|
|
5
6
|
import { PropertyPath } from "./PropertyPath.js";
|
|
@@ -39,7 +40,7 @@ export var BaseShaclCoreShapeStatic;
|
|
|
39
40
|
$Identifier.toString = rdfjsResource.Resource.Identifier.toString;
|
|
40
41
|
})($Identifier = BaseShaclCoreShapeStatic.$Identifier || (BaseShaclCoreShapeStatic.$Identifier = {}));
|
|
41
42
|
function $fromRdf(resource, options) {
|
|
42
|
-
let { ignoreRdfType = false,
|
|
43
|
+
let { ignoreRdfType = false, objectSet, preferredLanguages, ...context } = options ?? {};
|
|
43
44
|
if (!objectSet) {
|
|
44
45
|
objectSet = new $RdfjsDatasetObjectSet({ dataset: resource.dataset });
|
|
45
46
|
}
|
|
@@ -54,7 +55,7 @@ export var BaseShaclCoreShapeStatic;
|
|
|
54
55
|
}));
|
|
55
56
|
}
|
|
56
57
|
BaseShaclCoreShapeStatic.$fromRdf = $fromRdf;
|
|
57
|
-
function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType,
|
|
58
|
+
function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, objectSet: $objectSet, preferredLanguages: $preferredLanguages, resource: $resource,
|
|
58
59
|
// @ts-ignore
|
|
59
60
|
...$context }) {
|
|
60
61
|
const $identifier = $resource.identifier;
|
|
@@ -92,42 +93,34 @@ export var BaseShaclCoreShapeStatic;
|
|
|
92
93
|
const classes = _classesEither.unsafeCoerce();
|
|
93
94
|
const _commentsEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.comments["identifier"], { unique: true }))
|
|
94
95
|
.chain((values) => {
|
|
96
|
+
if (!$preferredLanguages || $preferredLanguages.length === 0) {
|
|
97
|
+
return purify.Either.of(values);
|
|
98
|
+
}
|
|
95
99
|
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
96
100
|
if (literalValuesEither.isLeft()) {
|
|
97
101
|
return literalValuesEither;
|
|
98
102
|
}
|
|
99
103
|
const literalValues = literalValuesEither.unsafeCoerce();
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
return purify.Either.of(literalValues);
|
|
103
|
-
}
|
|
104
|
-
let uniqueLanguageIn;
|
|
105
|
-
if (nonUniqueLanguageIn.length === 1) {
|
|
106
|
-
uniqueLanguageIn = [nonUniqueLanguageIn[0]];
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
uniqueLanguageIn = [];
|
|
110
|
-
for (const languageIn of nonUniqueLanguageIn) {
|
|
111
|
-
if (uniqueLanguageIn.indexOf(languageIn) === -1) {
|
|
112
|
-
uniqueLanguageIn.push(languageIn);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
// Return all literals for the first languageIn, then all literals for the second languageIn, etc.
|
|
117
|
-
// Within a languageIn the literals may be in any order.
|
|
104
|
+
// Return all literals for the first preferredLanguage, then all literals for the second preferredLanguage, etc.
|
|
105
|
+
// Within a preferredLanguage the literals may be in any order.
|
|
118
106
|
let filteredLiteralValues;
|
|
119
|
-
for (const
|
|
107
|
+
for (const preferredLanguage of $preferredLanguages) {
|
|
120
108
|
if (!filteredLiteralValues) {
|
|
121
|
-
filteredLiteralValues = literalValues.filter((value) => value.language ===
|
|
109
|
+
filteredLiteralValues = literalValues.filter((value) => value.language === preferredLanguage);
|
|
122
110
|
}
|
|
123
111
|
else {
|
|
124
112
|
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
125
|
-
.filter((value) => value.language ===
|
|
113
|
+
.filter((value) => value.language === preferredLanguage)
|
|
126
114
|
.toArray());
|
|
127
115
|
}
|
|
128
116
|
}
|
|
129
|
-
return purify.Either.of(filteredLiteralValues)
|
|
117
|
+
return purify.Either.of(filteredLiteralValues.map((literalValue) => new rdfjsResource.Resource.Value({
|
|
118
|
+
object: literalValue,
|
|
119
|
+
predicate: BaseShaclCoreShapeStatic.$properties.comments["identifier"],
|
|
120
|
+
subject: $resource,
|
|
121
|
+
})));
|
|
130
122
|
})
|
|
123
|
+
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
131
124
|
.map((values) => values.toArray())
|
|
132
125
|
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
133
126
|
object: valuesArray,
|
|
@@ -168,6 +161,34 @@ export var BaseShaclCoreShapeStatic;
|
|
|
168
161
|
}
|
|
169
162
|
const deactivated = _deactivatedEither.unsafeCoerce();
|
|
170
163
|
const _flagsEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.flags["identifier"], { unique: true }))
|
|
164
|
+
.chain((values) => {
|
|
165
|
+
if (!$preferredLanguages || $preferredLanguages.length === 0) {
|
|
166
|
+
return purify.Either.of(values);
|
|
167
|
+
}
|
|
168
|
+
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
169
|
+
if (literalValuesEither.isLeft()) {
|
|
170
|
+
return literalValuesEither;
|
|
171
|
+
}
|
|
172
|
+
const literalValues = literalValuesEither.unsafeCoerce();
|
|
173
|
+
// Return all literals for the first preferredLanguage, then all literals for the second preferredLanguage, etc.
|
|
174
|
+
// Within a preferredLanguage the literals may be in any order.
|
|
175
|
+
let filteredLiteralValues;
|
|
176
|
+
for (const preferredLanguage of $preferredLanguages) {
|
|
177
|
+
if (!filteredLiteralValues) {
|
|
178
|
+
filteredLiteralValues = literalValues.filter((value) => value.language === preferredLanguage);
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
182
|
+
.filter((value) => value.language === preferredLanguage)
|
|
183
|
+
.toArray());
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return purify.Either.of(filteredLiteralValues.map((literalValue) => new rdfjsResource.Resource.Value({
|
|
187
|
+
object: literalValue,
|
|
188
|
+
predicate: BaseShaclCoreShapeStatic.$properties.flags["identifier"],
|
|
189
|
+
subject: $resource,
|
|
190
|
+
})));
|
|
191
|
+
})
|
|
171
192
|
.chain((values) => values.chainMap((value) => value.toString()))
|
|
172
193
|
.map((values) => values.toArray())
|
|
173
194
|
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
@@ -255,42 +276,34 @@ export var BaseShaclCoreShapeStatic;
|
|
|
255
276
|
const isDefinedBy = _isDefinedByEither.unsafeCoerce();
|
|
256
277
|
const _labelsEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.labels["identifier"], { unique: true }))
|
|
257
278
|
.chain((values) => {
|
|
279
|
+
if (!$preferredLanguages || $preferredLanguages.length === 0) {
|
|
280
|
+
return purify.Either.of(values);
|
|
281
|
+
}
|
|
258
282
|
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
259
283
|
if (literalValuesEither.isLeft()) {
|
|
260
284
|
return literalValuesEither;
|
|
261
285
|
}
|
|
262
286
|
const literalValues = literalValuesEither.unsafeCoerce();
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
return purify.Either.of(literalValues);
|
|
266
|
-
}
|
|
267
|
-
let uniqueLanguageIn;
|
|
268
|
-
if (nonUniqueLanguageIn.length === 1) {
|
|
269
|
-
uniqueLanguageIn = [nonUniqueLanguageIn[0]];
|
|
270
|
-
}
|
|
271
|
-
else {
|
|
272
|
-
uniqueLanguageIn = [];
|
|
273
|
-
for (const languageIn of nonUniqueLanguageIn) {
|
|
274
|
-
if (uniqueLanguageIn.indexOf(languageIn) === -1) {
|
|
275
|
-
uniqueLanguageIn.push(languageIn);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
// Return all literals for the first languageIn, then all literals for the second languageIn, etc.
|
|
280
|
-
// Within a languageIn the literals may be in any order.
|
|
287
|
+
// Return all literals for the first preferredLanguage, then all literals for the second preferredLanguage, etc.
|
|
288
|
+
// Within a preferredLanguage the literals may be in any order.
|
|
281
289
|
let filteredLiteralValues;
|
|
282
|
-
for (const
|
|
290
|
+
for (const preferredLanguage of $preferredLanguages) {
|
|
283
291
|
if (!filteredLiteralValues) {
|
|
284
|
-
filteredLiteralValues = literalValues.filter((value) => value.language ===
|
|
292
|
+
filteredLiteralValues = literalValues.filter((value) => value.language === preferredLanguage);
|
|
285
293
|
}
|
|
286
294
|
else {
|
|
287
295
|
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
288
|
-
.filter((value) => value.language ===
|
|
296
|
+
.filter((value) => value.language === preferredLanguage)
|
|
289
297
|
.toArray());
|
|
290
298
|
}
|
|
291
299
|
}
|
|
292
|
-
return purify.Either.of(filteredLiteralValues)
|
|
300
|
+
return purify.Either.of(filteredLiteralValues.map((literalValue) => new rdfjsResource.Resource.Value({
|
|
301
|
+
object: literalValue,
|
|
302
|
+
predicate: BaseShaclCoreShapeStatic.$properties.labels["identifier"],
|
|
303
|
+
subject: $resource,
|
|
304
|
+
})));
|
|
293
305
|
})
|
|
306
|
+
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
294
307
|
.map((values) => values.toArray())
|
|
295
308
|
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
296
309
|
object: valuesArray,
|
|
@@ -308,7 +321,36 @@ export var BaseShaclCoreShapeStatic;
|
|
|
308
321
|
objects: valueList,
|
|
309
322
|
predicate: BaseShaclCoreShapeStatic.$properties.languageIn["identifier"],
|
|
310
323
|
subject: $resource,
|
|
311
|
-
}))
|
|
324
|
+
}))
|
|
325
|
+
.chain((values) => {
|
|
326
|
+
if (!$preferredLanguages || $preferredLanguages.length === 0) {
|
|
327
|
+
return purify.Either.of(values);
|
|
328
|
+
}
|
|
329
|
+
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
330
|
+
if (literalValuesEither.isLeft()) {
|
|
331
|
+
return literalValuesEither;
|
|
332
|
+
}
|
|
333
|
+
const literalValues = literalValuesEither.unsafeCoerce();
|
|
334
|
+
// Return all literals for the first preferredLanguage, then all literals for the second preferredLanguage, etc.
|
|
335
|
+
// Within a preferredLanguage the literals may be in any order.
|
|
336
|
+
let filteredLiteralValues;
|
|
337
|
+
for (const preferredLanguage of $preferredLanguages) {
|
|
338
|
+
if (!filteredLiteralValues) {
|
|
339
|
+
filteredLiteralValues = literalValues.filter((value) => value.language === preferredLanguage);
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
343
|
+
.filter((value) => value.language === preferredLanguage)
|
|
344
|
+
.toArray());
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
return purify.Either.of(filteredLiteralValues.map((literalValue) => new rdfjsResource.Resource.Value({
|
|
348
|
+
object: literalValue,
|
|
349
|
+
predicate: BaseShaclCoreShapeStatic.$properties.languageIn["identifier"],
|
|
350
|
+
subject: $resource,
|
|
351
|
+
})));
|
|
352
|
+
})
|
|
353
|
+
.chain((values) => values.chainMap((value) => value.toString()))))
|
|
312
354
|
.map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
|
|
313
355
|
.map((values) => values.length > 0
|
|
314
356
|
? values.map((value) => purify.Maybe.of(value))
|
|
@@ -340,42 +382,34 @@ export var BaseShaclCoreShapeStatic;
|
|
|
340
382
|
unique: true,
|
|
341
383
|
}))
|
|
342
384
|
.chain((values) => {
|
|
385
|
+
if (!$preferredLanguages || $preferredLanguages.length === 0) {
|
|
386
|
+
return purify.Either.of(values);
|
|
387
|
+
}
|
|
343
388
|
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
344
389
|
if (literalValuesEither.isLeft()) {
|
|
345
390
|
return literalValuesEither;
|
|
346
391
|
}
|
|
347
392
|
const literalValues = literalValuesEither.unsafeCoerce();
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
return purify.Either.of(literalValues);
|
|
351
|
-
}
|
|
352
|
-
let uniqueLanguageIn;
|
|
353
|
-
if (nonUniqueLanguageIn.length === 1) {
|
|
354
|
-
uniqueLanguageIn = [nonUniqueLanguageIn[0]];
|
|
355
|
-
}
|
|
356
|
-
else {
|
|
357
|
-
uniqueLanguageIn = [];
|
|
358
|
-
for (const languageIn of nonUniqueLanguageIn) {
|
|
359
|
-
if (uniqueLanguageIn.indexOf(languageIn) === -1) {
|
|
360
|
-
uniqueLanguageIn.push(languageIn);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
// Return all literals for the first languageIn, then all literals for the second languageIn, etc.
|
|
365
|
-
// Within a languageIn the literals may be in any order.
|
|
393
|
+
// Return all literals for the first preferredLanguage, then all literals for the second preferredLanguage, etc.
|
|
394
|
+
// Within a preferredLanguage the literals may be in any order.
|
|
366
395
|
let filteredLiteralValues;
|
|
367
|
-
for (const
|
|
396
|
+
for (const preferredLanguage of $preferredLanguages) {
|
|
368
397
|
if (!filteredLiteralValues) {
|
|
369
|
-
filteredLiteralValues = literalValues.filter((value) => value.language ===
|
|
398
|
+
filteredLiteralValues = literalValues.filter((value) => value.language === preferredLanguage);
|
|
370
399
|
}
|
|
371
400
|
else {
|
|
372
401
|
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
373
|
-
.filter((value) => value.language ===
|
|
402
|
+
.filter((value) => value.language === preferredLanguage)
|
|
374
403
|
.toArray());
|
|
375
404
|
}
|
|
376
405
|
}
|
|
377
|
-
return purify.Either.of(filteredLiteralValues)
|
|
406
|
+
return purify.Either.of(filteredLiteralValues.map((literalValue) => new rdfjsResource.Resource.Value({
|
|
407
|
+
object: literalValue,
|
|
408
|
+
predicate: BaseShaclCoreShapeStatic.$properties.maxExclusive["identifier"],
|
|
409
|
+
subject: $resource,
|
|
410
|
+
})));
|
|
378
411
|
})
|
|
412
|
+
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
379
413
|
.map((values) => values.length > 0
|
|
380
414
|
? values.map((value) => purify.Maybe.of(value))
|
|
381
415
|
: rdfjsResource.Resource.Values.fromValue({
|
|
@@ -392,42 +426,34 @@ export var BaseShaclCoreShapeStatic;
|
|
|
392
426
|
unique: true,
|
|
393
427
|
}))
|
|
394
428
|
.chain((values) => {
|
|
429
|
+
if (!$preferredLanguages || $preferredLanguages.length === 0) {
|
|
430
|
+
return purify.Either.of(values);
|
|
431
|
+
}
|
|
395
432
|
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
396
433
|
if (literalValuesEither.isLeft()) {
|
|
397
434
|
return literalValuesEither;
|
|
398
435
|
}
|
|
399
436
|
const literalValues = literalValuesEither.unsafeCoerce();
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
return purify.Either.of(literalValues);
|
|
403
|
-
}
|
|
404
|
-
let uniqueLanguageIn;
|
|
405
|
-
if (nonUniqueLanguageIn.length === 1) {
|
|
406
|
-
uniqueLanguageIn = [nonUniqueLanguageIn[0]];
|
|
407
|
-
}
|
|
408
|
-
else {
|
|
409
|
-
uniqueLanguageIn = [];
|
|
410
|
-
for (const languageIn of nonUniqueLanguageIn) {
|
|
411
|
-
if (uniqueLanguageIn.indexOf(languageIn) === -1) {
|
|
412
|
-
uniqueLanguageIn.push(languageIn);
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
// Return all literals for the first languageIn, then all literals for the second languageIn, etc.
|
|
417
|
-
// Within a languageIn the literals may be in any order.
|
|
437
|
+
// Return all literals for the first preferredLanguage, then all literals for the second preferredLanguage, etc.
|
|
438
|
+
// Within a preferredLanguage the literals may be in any order.
|
|
418
439
|
let filteredLiteralValues;
|
|
419
|
-
for (const
|
|
440
|
+
for (const preferredLanguage of $preferredLanguages) {
|
|
420
441
|
if (!filteredLiteralValues) {
|
|
421
|
-
filteredLiteralValues = literalValues.filter((value) => value.language ===
|
|
442
|
+
filteredLiteralValues = literalValues.filter((value) => value.language === preferredLanguage);
|
|
422
443
|
}
|
|
423
444
|
else {
|
|
424
445
|
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
425
|
-
.filter((value) => value.language ===
|
|
446
|
+
.filter((value) => value.language === preferredLanguage)
|
|
426
447
|
.toArray());
|
|
427
448
|
}
|
|
428
449
|
}
|
|
429
|
-
return purify.Either.of(filteredLiteralValues)
|
|
450
|
+
return purify.Either.of(filteredLiteralValues.map((literalValue) => new rdfjsResource.Resource.Value({
|
|
451
|
+
object: literalValue,
|
|
452
|
+
predicate: BaseShaclCoreShapeStatic.$properties.maxInclusive["identifier"],
|
|
453
|
+
subject: $resource,
|
|
454
|
+
})));
|
|
430
455
|
})
|
|
456
|
+
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
431
457
|
.map((values) => values.length > 0
|
|
432
458
|
? values.map((value) => purify.Maybe.of(value))
|
|
433
459
|
: rdfjsResource.Resource.Values.fromValue({
|
|
@@ -472,42 +498,34 @@ export var BaseShaclCoreShapeStatic;
|
|
|
472
498
|
unique: true,
|
|
473
499
|
}))
|
|
474
500
|
.chain((values) => {
|
|
501
|
+
if (!$preferredLanguages || $preferredLanguages.length === 0) {
|
|
502
|
+
return purify.Either.of(values);
|
|
503
|
+
}
|
|
475
504
|
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
476
505
|
if (literalValuesEither.isLeft()) {
|
|
477
506
|
return literalValuesEither;
|
|
478
507
|
}
|
|
479
508
|
const literalValues = literalValuesEither.unsafeCoerce();
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
return purify.Either.of(literalValues);
|
|
483
|
-
}
|
|
484
|
-
let uniqueLanguageIn;
|
|
485
|
-
if (nonUniqueLanguageIn.length === 1) {
|
|
486
|
-
uniqueLanguageIn = [nonUniqueLanguageIn[0]];
|
|
487
|
-
}
|
|
488
|
-
else {
|
|
489
|
-
uniqueLanguageIn = [];
|
|
490
|
-
for (const languageIn of nonUniqueLanguageIn) {
|
|
491
|
-
if (uniqueLanguageIn.indexOf(languageIn) === -1) {
|
|
492
|
-
uniqueLanguageIn.push(languageIn);
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
// Return all literals for the first languageIn, then all literals for the second languageIn, etc.
|
|
497
|
-
// Within a languageIn the literals may be in any order.
|
|
509
|
+
// Return all literals for the first preferredLanguage, then all literals for the second preferredLanguage, etc.
|
|
510
|
+
// Within a preferredLanguage the literals may be in any order.
|
|
498
511
|
let filteredLiteralValues;
|
|
499
|
-
for (const
|
|
512
|
+
for (const preferredLanguage of $preferredLanguages) {
|
|
500
513
|
if (!filteredLiteralValues) {
|
|
501
|
-
filteredLiteralValues = literalValues.filter((value) => value.language ===
|
|
514
|
+
filteredLiteralValues = literalValues.filter((value) => value.language === preferredLanguage);
|
|
502
515
|
}
|
|
503
516
|
else {
|
|
504
517
|
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
505
|
-
.filter((value) => value.language ===
|
|
518
|
+
.filter((value) => value.language === preferredLanguage)
|
|
506
519
|
.toArray());
|
|
507
520
|
}
|
|
508
521
|
}
|
|
509
|
-
return purify.Either.of(filteredLiteralValues)
|
|
522
|
+
return purify.Either.of(filteredLiteralValues.map((literalValue) => new rdfjsResource.Resource.Value({
|
|
523
|
+
object: literalValue,
|
|
524
|
+
predicate: BaseShaclCoreShapeStatic.$properties.minExclusive["identifier"],
|
|
525
|
+
subject: $resource,
|
|
526
|
+
})));
|
|
510
527
|
})
|
|
528
|
+
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
511
529
|
.map((values) => values.length > 0
|
|
512
530
|
? values.map((value) => purify.Maybe.of(value))
|
|
513
531
|
: rdfjsResource.Resource.Values.fromValue({
|
|
@@ -524,42 +542,34 @@ export var BaseShaclCoreShapeStatic;
|
|
|
524
542
|
unique: true,
|
|
525
543
|
}))
|
|
526
544
|
.chain((values) => {
|
|
545
|
+
if (!$preferredLanguages || $preferredLanguages.length === 0) {
|
|
546
|
+
return purify.Either.of(values);
|
|
547
|
+
}
|
|
527
548
|
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
528
549
|
if (literalValuesEither.isLeft()) {
|
|
529
550
|
return literalValuesEither;
|
|
530
551
|
}
|
|
531
552
|
const literalValues = literalValuesEither.unsafeCoerce();
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
return purify.Either.of(literalValues);
|
|
535
|
-
}
|
|
536
|
-
let uniqueLanguageIn;
|
|
537
|
-
if (nonUniqueLanguageIn.length === 1) {
|
|
538
|
-
uniqueLanguageIn = [nonUniqueLanguageIn[0]];
|
|
539
|
-
}
|
|
540
|
-
else {
|
|
541
|
-
uniqueLanguageIn = [];
|
|
542
|
-
for (const languageIn of nonUniqueLanguageIn) {
|
|
543
|
-
if (uniqueLanguageIn.indexOf(languageIn) === -1) {
|
|
544
|
-
uniqueLanguageIn.push(languageIn);
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
// Return all literals for the first languageIn, then all literals for the second languageIn, etc.
|
|
549
|
-
// Within a languageIn the literals may be in any order.
|
|
553
|
+
// Return all literals for the first preferredLanguage, then all literals for the second preferredLanguage, etc.
|
|
554
|
+
// Within a preferredLanguage the literals may be in any order.
|
|
550
555
|
let filteredLiteralValues;
|
|
551
|
-
for (const
|
|
556
|
+
for (const preferredLanguage of $preferredLanguages) {
|
|
552
557
|
if (!filteredLiteralValues) {
|
|
553
|
-
filteredLiteralValues = literalValues.filter((value) => value.language ===
|
|
558
|
+
filteredLiteralValues = literalValues.filter((value) => value.language === preferredLanguage);
|
|
554
559
|
}
|
|
555
560
|
else {
|
|
556
561
|
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
557
|
-
.filter((value) => value.language ===
|
|
562
|
+
.filter((value) => value.language === preferredLanguage)
|
|
558
563
|
.toArray());
|
|
559
564
|
}
|
|
560
565
|
}
|
|
561
|
-
return purify.Either.of(filteredLiteralValues)
|
|
566
|
+
return purify.Either.of(filteredLiteralValues.map((literalValue) => new rdfjsResource.Resource.Value({
|
|
567
|
+
object: literalValue,
|
|
568
|
+
predicate: BaseShaclCoreShapeStatic.$properties.minInclusive["identifier"],
|
|
569
|
+
subject: $resource,
|
|
570
|
+
})));
|
|
562
571
|
})
|
|
572
|
+
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
563
573
|
.map((values) => values.length > 0
|
|
564
574
|
? values.map((value) => purify.Maybe.of(value))
|
|
565
575
|
: rdfjsResource.Resource.Values.fromValue({
|
|
@@ -668,6 +678,34 @@ export var BaseShaclCoreShapeStatic;
|
|
|
668
678
|
}
|
|
669
679
|
const or = _orEither.unsafeCoerce();
|
|
670
680
|
const _patternsEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.patterns["identifier"], { unique: true }))
|
|
681
|
+
.chain((values) => {
|
|
682
|
+
if (!$preferredLanguages || $preferredLanguages.length === 0) {
|
|
683
|
+
return purify.Either.of(values);
|
|
684
|
+
}
|
|
685
|
+
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
686
|
+
if (literalValuesEither.isLeft()) {
|
|
687
|
+
return literalValuesEither;
|
|
688
|
+
}
|
|
689
|
+
const literalValues = literalValuesEither.unsafeCoerce();
|
|
690
|
+
// Return all literals for the first preferredLanguage, then all literals for the second preferredLanguage, etc.
|
|
691
|
+
// Within a preferredLanguage the literals may be in any order.
|
|
692
|
+
let filteredLiteralValues;
|
|
693
|
+
for (const preferredLanguage of $preferredLanguages) {
|
|
694
|
+
if (!filteredLiteralValues) {
|
|
695
|
+
filteredLiteralValues = literalValues.filter((value) => value.language === preferredLanguage);
|
|
696
|
+
}
|
|
697
|
+
else {
|
|
698
|
+
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
699
|
+
.filter((value) => value.language === preferredLanguage)
|
|
700
|
+
.toArray());
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
return purify.Either.of(filteredLiteralValues.map((literalValue) => new rdfjsResource.Resource.Value({
|
|
704
|
+
object: literalValue,
|
|
705
|
+
predicate: BaseShaclCoreShapeStatic.$properties.patterns["identifier"],
|
|
706
|
+
subject: $resource,
|
|
707
|
+
})));
|
|
708
|
+
})
|
|
671
709
|
.chain((values) => values.chainMap((value) => value.toString()))
|
|
672
710
|
.map((values) => values.toArray())
|
|
673
711
|
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
@@ -737,126 +775,136 @@ export var BaseShaclCoreShapeStatic;
|
|
|
737
775
|
dataset: datasetFactory.dataset(),
|
|
738
776
|
});
|
|
739
777
|
const resource = resourceSet.mutableResource(_baseShaclCoreShape.$identifier, { mutateGraph });
|
|
740
|
-
resource.add(BaseShaclCoreShapeStatic.$properties.and["identifier"], _baseShaclCoreShape.and.
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
resource.add(BaseShaclCoreShapeStatic.$properties.
|
|
763
|
-
resource.add(BaseShaclCoreShapeStatic.$properties.
|
|
764
|
-
resource.add(BaseShaclCoreShapeStatic.$properties.
|
|
765
|
-
resource.add(BaseShaclCoreShapeStatic.$properties.
|
|
766
|
-
resource.add(BaseShaclCoreShapeStatic.$properties.
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
resource.add(BaseShaclCoreShapeStatic.$properties.
|
|
815
|
-
resource.add(BaseShaclCoreShapeStatic.$properties.
|
|
816
|
-
resource.add(BaseShaclCoreShapeStatic.$properties.
|
|
817
|
-
resource.add(BaseShaclCoreShapeStatic.$properties.
|
|
818
|
-
resource.add(BaseShaclCoreShapeStatic.$properties.
|
|
819
|
-
resource.add(BaseShaclCoreShapeStatic.$properties.
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
}
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
778
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.and["identifier"], ..._baseShaclCoreShape.and.flatMap((item) => [
|
|
779
|
+
item.length > 0
|
|
780
|
+
? item.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
781
|
+
if (itemIndex === 0) {
|
|
782
|
+
currentSubListResource = listResource;
|
|
783
|
+
}
|
|
784
|
+
else {
|
|
785
|
+
const newSubListResource = resourceSet.mutableResource(dataFactory.blankNode(), { mutateGraph });
|
|
786
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier);
|
|
787
|
+
currentSubListResource = newSubListResource;
|
|
788
|
+
}
|
|
789
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, ...[item]);
|
|
790
|
+
if (itemIndex + 1 === list.length) {
|
|
791
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil);
|
|
792
|
+
}
|
|
793
|
+
return { currentSubListResource, listResource };
|
|
794
|
+
}, {
|
|
795
|
+
currentSubListResource: null,
|
|
796
|
+
listResource: resourceSet.mutableResource(dataFactory.blankNode(), { mutateGraph }),
|
|
797
|
+
}).listResource.identifier
|
|
798
|
+
: $RdfVocabularies.rdf.nil,
|
|
799
|
+
]));
|
|
800
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.classes["identifier"], ..._baseShaclCoreShape.classes.flatMap((item) => [item]));
|
|
801
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.comments["identifier"], ..._baseShaclCoreShape.comments.flatMap((item) => [item]));
|
|
802
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.datatype["identifier"], ..._baseShaclCoreShape.datatype.toList());
|
|
803
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.deactivated["identifier"], ..._baseShaclCoreShape.deactivated.toList().flat());
|
|
804
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.flags["identifier"], ..._baseShaclCoreShape.flags.flatMap((item) => [item]));
|
|
805
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.hasValues["identifier"], ..._baseShaclCoreShape.hasValues.flatMap((item) => [item]));
|
|
806
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.in_["identifier"], ..._baseShaclCoreShape.in_.toList().flatMap((value) => [
|
|
807
|
+
value.length > 0
|
|
808
|
+
? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
809
|
+
if (itemIndex === 0) {
|
|
810
|
+
currentSubListResource = listResource;
|
|
811
|
+
}
|
|
812
|
+
else {
|
|
813
|
+
const newSubListResource = resourceSet.mutableResource(dataFactory.blankNode(), { mutateGraph });
|
|
814
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier);
|
|
815
|
+
currentSubListResource = newSubListResource;
|
|
816
|
+
}
|
|
817
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, ...[item]);
|
|
818
|
+
if (itemIndex + 1 === list.length) {
|
|
819
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil);
|
|
820
|
+
}
|
|
821
|
+
return { currentSubListResource, listResource };
|
|
822
|
+
}, {
|
|
823
|
+
currentSubListResource: null,
|
|
824
|
+
listResource: resourceSet.mutableResource(dataFactory.blankNode(), { mutateGraph }),
|
|
825
|
+
}).listResource.identifier
|
|
826
|
+
: $RdfVocabularies.rdf.nil,
|
|
827
|
+
]));
|
|
828
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.isDefinedBy["identifier"], ..._baseShaclCoreShape.isDefinedBy.toList());
|
|
829
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.labels["identifier"], ..._baseShaclCoreShape.labels.flatMap((item) => [item]));
|
|
830
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.languageIn["identifier"], ..._baseShaclCoreShape.languageIn.toList().flatMap((value) => [
|
|
831
|
+
value.length > 0
|
|
832
|
+
? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
833
|
+
if (itemIndex === 0) {
|
|
834
|
+
currentSubListResource = listResource;
|
|
835
|
+
}
|
|
836
|
+
else {
|
|
837
|
+
const newSubListResource = resourceSet.mutableResource(dataFactory.blankNode(), { mutateGraph });
|
|
838
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier);
|
|
839
|
+
currentSubListResource = newSubListResource;
|
|
840
|
+
}
|
|
841
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, ...[item]);
|
|
842
|
+
if (itemIndex + 1 === list.length) {
|
|
843
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil);
|
|
844
|
+
}
|
|
845
|
+
return { currentSubListResource, listResource };
|
|
846
|
+
}, {
|
|
847
|
+
currentSubListResource: null,
|
|
848
|
+
listResource: resourceSet.mutableResource(dataFactory.blankNode(), { mutateGraph }),
|
|
849
|
+
}).listResource.identifier
|
|
850
|
+
: $RdfVocabularies.rdf.nil,
|
|
851
|
+
]));
|
|
852
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.maxCount["identifier"], ..._baseShaclCoreShape.maxCount.toList());
|
|
853
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.maxExclusive["identifier"], ..._baseShaclCoreShape.maxExclusive.toList());
|
|
854
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.maxInclusive["identifier"], ..._baseShaclCoreShape.maxInclusive.toList());
|
|
855
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.maxLength["identifier"], ..._baseShaclCoreShape.maxLength.toList());
|
|
856
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.minCount["identifier"], ..._baseShaclCoreShape.minCount.toList());
|
|
857
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.minExclusive["identifier"], ..._baseShaclCoreShape.minExclusive.toList());
|
|
858
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.minInclusive["identifier"], ..._baseShaclCoreShape.minInclusive.toList());
|
|
859
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.minLength["identifier"], ..._baseShaclCoreShape.minLength.toList());
|
|
860
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.nodeKind["identifier"], ..._baseShaclCoreShape.nodeKind.toList());
|
|
861
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.nodes["identifier"], ..._baseShaclCoreShape.nodes.flatMap((item) => [item]));
|
|
862
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.not["identifier"], ..._baseShaclCoreShape.not.flatMap((item) => [item]));
|
|
863
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.or["identifier"], ..._baseShaclCoreShape.or.flatMap((item) => [
|
|
864
|
+
item.length > 0
|
|
865
|
+
? item.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
866
|
+
if (itemIndex === 0) {
|
|
867
|
+
currentSubListResource = listResource;
|
|
868
|
+
}
|
|
869
|
+
else {
|
|
870
|
+
const newSubListResource = resourceSet.mutableResource(dataFactory.blankNode(), { mutateGraph });
|
|
871
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier);
|
|
872
|
+
currentSubListResource = newSubListResource;
|
|
873
|
+
}
|
|
874
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, ...[item]);
|
|
875
|
+
if (itemIndex + 1 === list.length) {
|
|
876
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil);
|
|
877
|
+
}
|
|
878
|
+
return { currentSubListResource, listResource };
|
|
879
|
+
}, {
|
|
880
|
+
currentSubListResource: null,
|
|
881
|
+
listResource: resourceSet.mutableResource(dataFactory.blankNode(), { mutateGraph }),
|
|
882
|
+
}).listResource.identifier
|
|
883
|
+
: $RdfVocabularies.rdf.nil,
|
|
884
|
+
]));
|
|
885
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.patterns["identifier"], ..._baseShaclCoreShape.patterns.flatMap((item) => [item]));
|
|
886
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.xone["identifier"], ..._baseShaclCoreShape.xone.flatMap((item) => [
|
|
887
|
+
item.length > 0
|
|
888
|
+
? item.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
889
|
+
if (itemIndex === 0) {
|
|
890
|
+
currentSubListResource = listResource;
|
|
891
|
+
}
|
|
892
|
+
else {
|
|
893
|
+
const newSubListResource = resourceSet.mutableResource(dataFactory.blankNode(), { mutateGraph });
|
|
894
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier);
|
|
895
|
+
currentSubListResource = newSubListResource;
|
|
896
|
+
}
|
|
897
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, ...[item]);
|
|
898
|
+
if (itemIndex + 1 === list.length) {
|
|
899
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil);
|
|
900
|
+
}
|
|
901
|
+
return { currentSubListResource, listResource };
|
|
902
|
+
}, {
|
|
903
|
+
currentSubListResource: null,
|
|
904
|
+
listResource: resourceSet.mutableResource(dataFactory.blankNode(), { mutateGraph }),
|
|
905
|
+
}).listResource.identifier
|
|
906
|
+
: $RdfVocabularies.rdf.nil,
|
|
907
|
+
]));
|
|
860
908
|
return resource;
|
|
861
909
|
}
|
|
862
910
|
BaseShaclCoreShapeStatic.$toRdf = $toRdf;
|
|
@@ -939,38 +987,52 @@ export var ShaclCorePropertyShape;
|
|
|
939
987
|
ShaclCorePropertyShape.$fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape");
|
|
940
988
|
ShaclCorePropertyShape.$Identifier = BaseShaclCoreShapeStatic.$Identifier;
|
|
941
989
|
function $fromRdf(resource, options) {
|
|
942
|
-
let { ignoreRdfType = false,
|
|
990
|
+
let { ignoreRdfType = false, objectSet, preferredLanguages, ...context } = options ?? {};
|
|
943
991
|
if (!objectSet) {
|
|
944
992
|
objectSet = new $RdfjsDatasetObjectSet({ dataset: resource.dataset });
|
|
945
993
|
}
|
|
946
994
|
return ShaclCorePropertyShape.$propertiesFromRdf({
|
|
947
995
|
...context,
|
|
948
996
|
ignoreRdfType,
|
|
949
|
-
languageIn,
|
|
950
997
|
objectSet,
|
|
998
|
+
preferredLanguages,
|
|
951
999
|
resource,
|
|
952
1000
|
});
|
|
953
1001
|
}
|
|
954
1002
|
ShaclCorePropertyShape.$fromRdf = $fromRdf;
|
|
955
|
-
function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType,
|
|
1003
|
+
function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, objectSet: $objectSet, preferredLanguages: $preferredLanguages, resource: $resource,
|
|
956
1004
|
// @ts-ignore
|
|
957
1005
|
...$context }) {
|
|
958
1006
|
const $super0Either = BaseShaclCoreShapeStatic.$propertiesFromRdf({
|
|
959
1007
|
...$context,
|
|
960
1008
|
ignoreRdfType: true,
|
|
961
|
-
languageIn: $languageIn,
|
|
962
1009
|
objectSet: $objectSet,
|
|
1010
|
+
preferredLanguages: $preferredLanguages,
|
|
963
1011
|
resource: $resource,
|
|
964
1012
|
});
|
|
965
1013
|
if ($super0Either.isLeft()) {
|
|
966
1014
|
return $super0Either;
|
|
967
1015
|
}
|
|
968
1016
|
const $super0 = $super0Either.unsafeCoerce();
|
|
969
|
-
if (!$ignoreRdfType
|
|
970
|
-
|
|
1017
|
+
if (!$ignoreRdfType) {
|
|
1018
|
+
const $rdfTypeCheck = $resource
|
|
971
1019
|
.value($RdfVocabularies.rdf.type)
|
|
972
1020
|
.chain((actualRdfType) => actualRdfType.toIri())
|
|
973
|
-
.chain((actualRdfType) =>
|
|
1021
|
+
.chain((actualRdfType) => {
|
|
1022
|
+
// Check the expected type and its known subtypes
|
|
1023
|
+
switch (actualRdfType.value) {
|
|
1024
|
+
case "http://www.w3.org/ns/shacl#PropertyShape":
|
|
1025
|
+
return purify.Either.of(true);
|
|
1026
|
+
}
|
|
1027
|
+
// Check arbitrary rdfs:subClassOf's of the expected type
|
|
1028
|
+
if ($resource.isInstanceOf(ShaclCorePropertyShape.$fromRdfType)) {
|
|
1029
|
+
return purify.Either.of(true);
|
|
1030
|
+
}
|
|
1031
|
+
return purify.Left(new Error(`${rdfjsResource.Resource.Identifier.toString($resource.identifier)} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#PropertyShape)`));
|
|
1032
|
+
});
|
|
1033
|
+
if ($rdfTypeCheck.isLeft()) {
|
|
1034
|
+
return $rdfTypeCheck;
|
|
1035
|
+
}
|
|
974
1036
|
}
|
|
975
1037
|
const $identifier = $resource.identifier;
|
|
976
1038
|
const $type = "ShaclCorePropertyShape";
|
|
@@ -1007,42 +1069,34 @@ export var ShaclCorePropertyShape;
|
|
|
1007
1069
|
unique: true,
|
|
1008
1070
|
}))
|
|
1009
1071
|
.chain((values) => {
|
|
1072
|
+
if (!$preferredLanguages || $preferredLanguages.length === 0) {
|
|
1073
|
+
return purify.Either.of(values);
|
|
1074
|
+
}
|
|
1010
1075
|
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
1011
1076
|
if (literalValuesEither.isLeft()) {
|
|
1012
1077
|
return literalValuesEither;
|
|
1013
1078
|
}
|
|
1014
1079
|
const literalValues = literalValuesEither.unsafeCoerce();
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
return purify.Either.of(literalValues);
|
|
1018
|
-
}
|
|
1019
|
-
let uniqueLanguageIn;
|
|
1020
|
-
if (nonUniqueLanguageIn.length === 1) {
|
|
1021
|
-
uniqueLanguageIn = [nonUniqueLanguageIn[0]];
|
|
1022
|
-
}
|
|
1023
|
-
else {
|
|
1024
|
-
uniqueLanguageIn = [];
|
|
1025
|
-
for (const languageIn of nonUniqueLanguageIn) {
|
|
1026
|
-
if (uniqueLanguageIn.indexOf(languageIn) === -1) {
|
|
1027
|
-
uniqueLanguageIn.push(languageIn);
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
// Return all literals for the first languageIn, then all literals for the second languageIn, etc.
|
|
1032
|
-
// Within a languageIn the literals may be in any order.
|
|
1080
|
+
// Return all literals for the first preferredLanguage, then all literals for the second preferredLanguage, etc.
|
|
1081
|
+
// Within a preferredLanguage the literals may be in any order.
|
|
1033
1082
|
let filteredLiteralValues;
|
|
1034
|
-
for (const
|
|
1083
|
+
for (const preferredLanguage of $preferredLanguages) {
|
|
1035
1084
|
if (!filteredLiteralValues) {
|
|
1036
|
-
filteredLiteralValues = literalValues.filter((value) => value.language ===
|
|
1085
|
+
filteredLiteralValues = literalValues.filter((value) => value.language === preferredLanguage);
|
|
1037
1086
|
}
|
|
1038
1087
|
else {
|
|
1039
1088
|
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
1040
|
-
.filter((value) => value.language ===
|
|
1089
|
+
.filter((value) => value.language === preferredLanguage)
|
|
1041
1090
|
.toArray());
|
|
1042
1091
|
}
|
|
1043
1092
|
}
|
|
1044
|
-
return purify.Either.of(filteredLiteralValues)
|
|
1093
|
+
return purify.Either.of(filteredLiteralValues.map((literalValue) => new rdfjsResource.Resource.Value({
|
|
1094
|
+
object: literalValue,
|
|
1095
|
+
predicate: ShaclCorePropertyShape.$properties.descriptions["identifier"],
|
|
1096
|
+
subject: $resource,
|
|
1097
|
+
})));
|
|
1045
1098
|
})
|
|
1099
|
+
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
1046
1100
|
.map((values) => values.toArray())
|
|
1047
1101
|
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
1048
1102
|
object: valuesArray,
|
|
@@ -1069,42 +1123,34 @@ export var ShaclCorePropertyShape;
|
|
|
1069
1123
|
const groups = _groupsEither.unsafeCoerce();
|
|
1070
1124
|
const _namesEither = purify.Either.of($resource.values(ShaclCorePropertyShape.$properties.names["identifier"], { unique: true }))
|
|
1071
1125
|
.chain((values) => {
|
|
1126
|
+
if (!$preferredLanguages || $preferredLanguages.length === 0) {
|
|
1127
|
+
return purify.Either.of(values);
|
|
1128
|
+
}
|
|
1072
1129
|
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
1073
1130
|
if (literalValuesEither.isLeft()) {
|
|
1074
1131
|
return literalValuesEither;
|
|
1075
1132
|
}
|
|
1076
1133
|
const literalValues = literalValuesEither.unsafeCoerce();
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
return purify.Either.of(literalValues);
|
|
1080
|
-
}
|
|
1081
|
-
let uniqueLanguageIn;
|
|
1082
|
-
if (nonUniqueLanguageIn.length === 1) {
|
|
1083
|
-
uniqueLanguageIn = [nonUniqueLanguageIn[0]];
|
|
1084
|
-
}
|
|
1085
|
-
else {
|
|
1086
|
-
uniqueLanguageIn = [];
|
|
1087
|
-
for (const languageIn of nonUniqueLanguageIn) {
|
|
1088
|
-
if (uniqueLanguageIn.indexOf(languageIn) === -1) {
|
|
1089
|
-
uniqueLanguageIn.push(languageIn);
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
1092
|
-
}
|
|
1093
|
-
// Return all literals for the first languageIn, then all literals for the second languageIn, etc.
|
|
1094
|
-
// Within a languageIn the literals may be in any order.
|
|
1134
|
+
// Return all literals for the first preferredLanguage, then all literals for the second preferredLanguage, etc.
|
|
1135
|
+
// Within a preferredLanguage the literals may be in any order.
|
|
1095
1136
|
let filteredLiteralValues;
|
|
1096
|
-
for (const
|
|
1137
|
+
for (const preferredLanguage of $preferredLanguages) {
|
|
1097
1138
|
if (!filteredLiteralValues) {
|
|
1098
|
-
filteredLiteralValues = literalValues.filter((value) => value.language ===
|
|
1139
|
+
filteredLiteralValues = literalValues.filter((value) => value.language === preferredLanguage);
|
|
1099
1140
|
}
|
|
1100
1141
|
else {
|
|
1101
1142
|
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
1102
|
-
.filter((value) => value.language ===
|
|
1143
|
+
.filter((value) => value.language === preferredLanguage)
|
|
1103
1144
|
.toArray());
|
|
1104
1145
|
}
|
|
1105
1146
|
}
|
|
1106
|
-
return purify.Either.of(filteredLiteralValues)
|
|
1147
|
+
return purify.Either.of(filteredLiteralValues.map((literalValue) => new rdfjsResource.Resource.Value({
|
|
1148
|
+
object: literalValue,
|
|
1149
|
+
predicate: ShaclCorePropertyShape.$properties.names["identifier"],
|
|
1150
|
+
subject: $resource,
|
|
1151
|
+
})));
|
|
1107
1152
|
})
|
|
1153
|
+
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
1108
1154
|
.map((values) => values.toArray())
|
|
1109
1155
|
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
1110
1156
|
object: valuesArray,
|
|
@@ -1134,8 +1180,8 @@ export var ShaclCorePropertyShape;
|
|
|
1134
1180
|
.chain((values) => values.chainMap((value) => value.toResource().chain((resource) => PropertyPath.$fromRdf(resource, {
|
|
1135
1181
|
...$context,
|
|
1136
1182
|
ignoreRdfType: true,
|
|
1137
|
-
languageIn: $languageIn,
|
|
1138
1183
|
objectSet: $objectSet,
|
|
1184
|
+
preferredLanguages: $preferredLanguages,
|
|
1139
1185
|
}))))
|
|
1140
1186
|
.chain((values) => values.head());
|
|
1141
1187
|
if (_pathEither.isLeft()) {
|
|
@@ -1187,16 +1233,18 @@ export var ShaclCorePropertyShape;
|
|
|
1187
1233
|
resource.add($RdfVocabularies.rdf.type, resource.dataFactory.namedNode("http://purl.org/shaclmate/ontology#ShaclCorePropertyShape"));
|
|
1188
1234
|
resource.add($RdfVocabularies.rdf.type, resource.dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"));
|
|
1189
1235
|
}
|
|
1190
|
-
resource.add(ShaclCorePropertyShape.$properties.defaultValue["identifier"], _shaclCorePropertyShape.defaultValue);
|
|
1191
|
-
resource.add(ShaclCorePropertyShape.$properties.descriptions["identifier"], _shaclCorePropertyShape.descriptions.
|
|
1192
|
-
resource.add(ShaclCorePropertyShape.$properties.groups["identifier"], _shaclCorePropertyShape.groups.
|
|
1193
|
-
resource.add(ShaclCorePropertyShape.$properties.names["identifier"], _shaclCorePropertyShape.names.
|
|
1194
|
-
resource.add(ShaclCorePropertyShape.$properties.order["identifier"], _shaclCorePropertyShape.order);
|
|
1195
|
-
resource.add(ShaclCorePropertyShape.$properties.path["identifier"],
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1236
|
+
resource.add(ShaclCorePropertyShape.$properties.defaultValue["identifier"], ..._shaclCorePropertyShape.defaultValue.toList());
|
|
1237
|
+
resource.add(ShaclCorePropertyShape.$properties.descriptions["identifier"], ..._shaclCorePropertyShape.descriptions.flatMap((item) => [item]));
|
|
1238
|
+
resource.add(ShaclCorePropertyShape.$properties.groups["identifier"], ..._shaclCorePropertyShape.groups.flatMap((item) => [item]));
|
|
1239
|
+
resource.add(ShaclCorePropertyShape.$properties.names["identifier"], ..._shaclCorePropertyShape.names.flatMap((item) => [item]));
|
|
1240
|
+
resource.add(ShaclCorePropertyShape.$properties.order["identifier"], ..._shaclCorePropertyShape.order.toList());
|
|
1241
|
+
resource.add(ShaclCorePropertyShape.$properties.path["identifier"], ...[
|
|
1242
|
+
PropertyPath.$toRdf(_shaclCorePropertyShape.path, {
|
|
1243
|
+
mutateGraph: mutateGraph,
|
|
1244
|
+
resourceSet: resourceSet,
|
|
1245
|
+
}).identifier,
|
|
1246
|
+
]);
|
|
1247
|
+
resource.add(ShaclCorePropertyShape.$properties.uniqueLang["identifier"], ..._shaclCorePropertyShape.uniqueLang.toList().flat());
|
|
1200
1248
|
return resource;
|
|
1201
1249
|
}
|
|
1202
1250
|
ShaclCorePropertyShape.$toRdf = $toRdf;
|
|
@@ -1240,68 +1288,74 @@ export var ShaclCorePropertyGroup;
|
|
|
1240
1288
|
$Identifier.toString = rdfjsResource.Resource.Identifier.toString;
|
|
1241
1289
|
})($Identifier = ShaclCorePropertyGroup.$Identifier || (ShaclCorePropertyGroup.$Identifier = {}));
|
|
1242
1290
|
function $fromRdf(resource, options) {
|
|
1243
|
-
let { ignoreRdfType = false,
|
|
1291
|
+
let { ignoreRdfType = false, objectSet, preferredLanguages, ...context } = options ?? {};
|
|
1244
1292
|
if (!objectSet) {
|
|
1245
1293
|
objectSet = new $RdfjsDatasetObjectSet({ dataset: resource.dataset });
|
|
1246
1294
|
}
|
|
1247
1295
|
return ShaclCorePropertyGroup.$propertiesFromRdf({
|
|
1248
1296
|
...context,
|
|
1249
1297
|
ignoreRdfType,
|
|
1250
|
-
languageIn,
|
|
1251
1298
|
objectSet,
|
|
1299
|
+
preferredLanguages,
|
|
1252
1300
|
resource,
|
|
1253
1301
|
});
|
|
1254
1302
|
}
|
|
1255
1303
|
ShaclCorePropertyGroup.$fromRdf = $fromRdf;
|
|
1256
|
-
function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType,
|
|
1304
|
+
function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, objectSet: $objectSet, preferredLanguages: $preferredLanguages, resource: $resource,
|
|
1257
1305
|
// @ts-ignore
|
|
1258
1306
|
...$context }) {
|
|
1259
|
-
if (!$ignoreRdfType
|
|
1260
|
-
|
|
1307
|
+
if (!$ignoreRdfType) {
|
|
1308
|
+
const $rdfTypeCheck = $resource
|
|
1261
1309
|
.value($RdfVocabularies.rdf.type)
|
|
1262
1310
|
.chain((actualRdfType) => actualRdfType.toIri())
|
|
1263
|
-
.chain((actualRdfType) =>
|
|
1311
|
+
.chain((actualRdfType) => {
|
|
1312
|
+
// Check the expected type and its known subtypes
|
|
1313
|
+
switch (actualRdfType.value) {
|
|
1314
|
+
case "http://www.w3.org/ns/shacl#PropertyGroup":
|
|
1315
|
+
return purify.Either.of(true);
|
|
1316
|
+
}
|
|
1317
|
+
// Check arbitrary rdfs:subClassOf's of the expected type
|
|
1318
|
+
if ($resource.isInstanceOf(ShaclCorePropertyGroup.$fromRdfType)) {
|
|
1319
|
+
return purify.Either.of(true);
|
|
1320
|
+
}
|
|
1321
|
+
return purify.Left(new Error(`${rdfjsResource.Resource.Identifier.toString($resource.identifier)} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#PropertyGroup)`));
|
|
1322
|
+
});
|
|
1323
|
+
if ($rdfTypeCheck.isLeft()) {
|
|
1324
|
+
return $rdfTypeCheck;
|
|
1325
|
+
}
|
|
1264
1326
|
}
|
|
1265
1327
|
const $identifier = $resource.identifier;
|
|
1266
1328
|
const $type = "ShaclCorePropertyGroup";
|
|
1267
1329
|
const _commentsEither = purify.Either.of($resource.values(ShaclCorePropertyGroup.$properties.comments["identifier"], { unique: true }))
|
|
1268
1330
|
.chain((values) => {
|
|
1331
|
+
if (!$preferredLanguages || $preferredLanguages.length === 0) {
|
|
1332
|
+
return purify.Either.of(values);
|
|
1333
|
+
}
|
|
1269
1334
|
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
1270
1335
|
if (literalValuesEither.isLeft()) {
|
|
1271
1336
|
return literalValuesEither;
|
|
1272
1337
|
}
|
|
1273
1338
|
const literalValues = literalValuesEither.unsafeCoerce();
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
return purify.Either.of(literalValues);
|
|
1277
|
-
}
|
|
1278
|
-
let uniqueLanguageIn;
|
|
1279
|
-
if (nonUniqueLanguageIn.length === 1) {
|
|
1280
|
-
uniqueLanguageIn = [nonUniqueLanguageIn[0]];
|
|
1281
|
-
}
|
|
1282
|
-
else {
|
|
1283
|
-
uniqueLanguageIn = [];
|
|
1284
|
-
for (const languageIn of nonUniqueLanguageIn) {
|
|
1285
|
-
if (uniqueLanguageIn.indexOf(languageIn) === -1) {
|
|
1286
|
-
uniqueLanguageIn.push(languageIn);
|
|
1287
|
-
}
|
|
1288
|
-
}
|
|
1289
|
-
}
|
|
1290
|
-
// Return all literals for the first languageIn, then all literals for the second languageIn, etc.
|
|
1291
|
-
// Within a languageIn the literals may be in any order.
|
|
1339
|
+
// Return all literals for the first preferredLanguage, then all literals for the second preferredLanguage, etc.
|
|
1340
|
+
// Within a preferredLanguage the literals may be in any order.
|
|
1292
1341
|
let filteredLiteralValues;
|
|
1293
|
-
for (const
|
|
1342
|
+
for (const preferredLanguage of $preferredLanguages) {
|
|
1294
1343
|
if (!filteredLiteralValues) {
|
|
1295
|
-
filteredLiteralValues = literalValues.filter((value) => value.language ===
|
|
1344
|
+
filteredLiteralValues = literalValues.filter((value) => value.language === preferredLanguage);
|
|
1296
1345
|
}
|
|
1297
1346
|
else {
|
|
1298
1347
|
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
1299
|
-
.filter((value) => value.language ===
|
|
1348
|
+
.filter((value) => value.language === preferredLanguage)
|
|
1300
1349
|
.toArray());
|
|
1301
1350
|
}
|
|
1302
1351
|
}
|
|
1303
|
-
return purify.Either.of(filteredLiteralValues)
|
|
1352
|
+
return purify.Either.of(filteredLiteralValues.map((literalValue) => new rdfjsResource.Resource.Value({
|
|
1353
|
+
object: literalValue,
|
|
1354
|
+
predicate: ShaclCorePropertyGroup.$properties.comments["identifier"],
|
|
1355
|
+
subject: $resource,
|
|
1356
|
+
})));
|
|
1304
1357
|
})
|
|
1358
|
+
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
1305
1359
|
.map((values) => values.toArray())
|
|
1306
1360
|
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
1307
1361
|
object: valuesArray,
|
|
@@ -1315,42 +1369,34 @@ export var ShaclCorePropertyGroup;
|
|
|
1315
1369
|
const comments = _commentsEither.unsafeCoerce();
|
|
1316
1370
|
const _labelsEither = purify.Either.of($resource.values(ShaclCorePropertyGroup.$properties.labels["identifier"], { unique: true }))
|
|
1317
1371
|
.chain((values) => {
|
|
1372
|
+
if (!$preferredLanguages || $preferredLanguages.length === 0) {
|
|
1373
|
+
return purify.Either.of(values);
|
|
1374
|
+
}
|
|
1318
1375
|
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
1319
1376
|
if (literalValuesEither.isLeft()) {
|
|
1320
1377
|
return literalValuesEither;
|
|
1321
1378
|
}
|
|
1322
1379
|
const literalValues = literalValuesEither.unsafeCoerce();
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
return purify.Either.of(literalValues);
|
|
1326
|
-
}
|
|
1327
|
-
let uniqueLanguageIn;
|
|
1328
|
-
if (nonUniqueLanguageIn.length === 1) {
|
|
1329
|
-
uniqueLanguageIn = [nonUniqueLanguageIn[0]];
|
|
1330
|
-
}
|
|
1331
|
-
else {
|
|
1332
|
-
uniqueLanguageIn = [];
|
|
1333
|
-
for (const languageIn of nonUniqueLanguageIn) {
|
|
1334
|
-
if (uniqueLanguageIn.indexOf(languageIn) === -1) {
|
|
1335
|
-
uniqueLanguageIn.push(languageIn);
|
|
1336
|
-
}
|
|
1337
|
-
}
|
|
1338
|
-
}
|
|
1339
|
-
// Return all literals for the first languageIn, then all literals for the second languageIn, etc.
|
|
1340
|
-
// Within a languageIn the literals may be in any order.
|
|
1380
|
+
// Return all literals for the first preferredLanguage, then all literals for the second preferredLanguage, etc.
|
|
1381
|
+
// Within a preferredLanguage the literals may be in any order.
|
|
1341
1382
|
let filteredLiteralValues;
|
|
1342
|
-
for (const
|
|
1383
|
+
for (const preferredLanguage of $preferredLanguages) {
|
|
1343
1384
|
if (!filteredLiteralValues) {
|
|
1344
|
-
filteredLiteralValues = literalValues.filter((value) => value.language ===
|
|
1385
|
+
filteredLiteralValues = literalValues.filter((value) => value.language === preferredLanguage);
|
|
1345
1386
|
}
|
|
1346
1387
|
else {
|
|
1347
1388
|
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
1348
|
-
.filter((value) => value.language ===
|
|
1389
|
+
.filter((value) => value.language === preferredLanguage)
|
|
1349
1390
|
.toArray());
|
|
1350
1391
|
}
|
|
1351
1392
|
}
|
|
1352
|
-
return purify.Either.of(filteredLiteralValues)
|
|
1393
|
+
return purify.Either.of(filteredLiteralValues.map((literalValue) => new rdfjsResource.Resource.Value({
|
|
1394
|
+
object: literalValue,
|
|
1395
|
+
predicate: ShaclCorePropertyGroup.$properties.labels["identifier"],
|
|
1396
|
+
subject: $resource,
|
|
1397
|
+
})));
|
|
1353
1398
|
})
|
|
1399
|
+
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
1354
1400
|
.map((values) => values.toArray())
|
|
1355
1401
|
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
1356
1402
|
object: valuesArray,
|
|
@@ -1377,8 +1423,8 @@ export var ShaclCorePropertyGroup;
|
|
|
1377
1423
|
if (!ignoreRdfType) {
|
|
1378
1424
|
resource.add($RdfVocabularies.rdf.type, resource.dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup"));
|
|
1379
1425
|
}
|
|
1380
|
-
resource.add(ShaclCorePropertyGroup.$properties.comments["identifier"], _shaclCorePropertyGroup.comments.
|
|
1381
|
-
resource.add(ShaclCorePropertyGroup.$properties.labels["identifier"], _shaclCorePropertyGroup.labels.
|
|
1426
|
+
resource.add(ShaclCorePropertyGroup.$properties.comments["identifier"], ..._shaclCorePropertyGroup.comments.flatMap((item) => [item]));
|
|
1427
|
+
resource.add(ShaclCorePropertyGroup.$properties.labels["identifier"], ..._shaclCorePropertyGroup.labels.flatMap((item) => [item]));
|
|
1382
1428
|
return resource;
|
|
1383
1429
|
}
|
|
1384
1430
|
ShaclCorePropertyGroup.$toRdf = $toRdf;
|
|
@@ -1396,38 +1442,52 @@ export var ShaclCoreNodeShape;
|
|
|
1396
1442
|
ShaclCoreNodeShape.$fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape");
|
|
1397
1443
|
ShaclCoreNodeShape.$Identifier = BaseShaclCoreShapeStatic.$Identifier;
|
|
1398
1444
|
function $fromRdf(resource, options) {
|
|
1399
|
-
let { ignoreRdfType = false,
|
|
1445
|
+
let { ignoreRdfType = false, objectSet, preferredLanguages, ...context } = options ?? {};
|
|
1400
1446
|
if (!objectSet) {
|
|
1401
1447
|
objectSet = new $RdfjsDatasetObjectSet({ dataset: resource.dataset });
|
|
1402
1448
|
}
|
|
1403
1449
|
return ShaclCoreNodeShape.$propertiesFromRdf({
|
|
1404
1450
|
...context,
|
|
1405
1451
|
ignoreRdfType,
|
|
1406
|
-
languageIn,
|
|
1407
1452
|
objectSet,
|
|
1453
|
+
preferredLanguages,
|
|
1408
1454
|
resource,
|
|
1409
1455
|
});
|
|
1410
1456
|
}
|
|
1411
1457
|
ShaclCoreNodeShape.$fromRdf = $fromRdf;
|
|
1412
|
-
function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType,
|
|
1458
|
+
function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, objectSet: $objectSet, preferredLanguages: $preferredLanguages, resource: $resource,
|
|
1413
1459
|
// @ts-ignore
|
|
1414
1460
|
...$context }) {
|
|
1415
1461
|
const $super0Either = BaseShaclCoreShapeStatic.$propertiesFromRdf({
|
|
1416
1462
|
...$context,
|
|
1417
1463
|
ignoreRdfType: true,
|
|
1418
|
-
languageIn: $languageIn,
|
|
1419
1464
|
objectSet: $objectSet,
|
|
1465
|
+
preferredLanguages: $preferredLanguages,
|
|
1420
1466
|
resource: $resource,
|
|
1421
1467
|
});
|
|
1422
1468
|
if ($super0Either.isLeft()) {
|
|
1423
1469
|
return $super0Either;
|
|
1424
1470
|
}
|
|
1425
1471
|
const $super0 = $super0Either.unsafeCoerce();
|
|
1426
|
-
if (!$ignoreRdfType
|
|
1427
|
-
|
|
1472
|
+
if (!$ignoreRdfType) {
|
|
1473
|
+
const $rdfTypeCheck = $resource
|
|
1428
1474
|
.value($RdfVocabularies.rdf.type)
|
|
1429
1475
|
.chain((actualRdfType) => actualRdfType.toIri())
|
|
1430
|
-
.chain((actualRdfType) =>
|
|
1476
|
+
.chain((actualRdfType) => {
|
|
1477
|
+
// Check the expected type and its known subtypes
|
|
1478
|
+
switch (actualRdfType.value) {
|
|
1479
|
+
case "http://www.w3.org/ns/shacl#NodeShape":
|
|
1480
|
+
return purify.Either.of(true);
|
|
1481
|
+
}
|
|
1482
|
+
// Check arbitrary rdfs:subClassOf's of the expected type
|
|
1483
|
+
if ($resource.isInstanceOf(ShaclCoreNodeShape.$fromRdfType)) {
|
|
1484
|
+
return purify.Either.of(true);
|
|
1485
|
+
}
|
|
1486
|
+
return purify.Left(new Error(`${rdfjsResource.Resource.Identifier.toString($resource.identifier)} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#NodeShape)`));
|
|
1487
|
+
});
|
|
1488
|
+
if ($rdfTypeCheck.isLeft()) {
|
|
1489
|
+
return $rdfTypeCheck;
|
|
1490
|
+
}
|
|
1431
1491
|
}
|
|
1432
1492
|
const $identifier = $resource.identifier;
|
|
1433
1493
|
const $type = "ShaclCoreNodeShape";
|
|
@@ -1507,28 +1567,30 @@ export var ShaclCoreNodeShape;
|
|
|
1507
1567
|
resource.add($RdfVocabularies.rdf.type, resource.dataFactory.namedNode("http://purl.org/shaclmate/ontology#ShaclCoreNodeShape"));
|
|
1508
1568
|
resource.add($RdfVocabularies.rdf.type, resource.dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape"));
|
|
1509
1569
|
}
|
|
1510
|
-
resource.add(ShaclCoreNodeShape.$properties.closed["identifier"], _shaclCoreNodeShape.closed);
|
|
1511
|
-
resource.add(ShaclCoreNodeShape.$properties.ignoredProperties["identifier"], _shaclCoreNodeShape.ignoredProperties.
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1570
|
+
resource.add(ShaclCoreNodeShape.$properties.closed["identifier"], ..._shaclCoreNodeShape.closed.toList().flat());
|
|
1571
|
+
resource.add(ShaclCoreNodeShape.$properties.ignoredProperties["identifier"], ..._shaclCoreNodeShape.ignoredProperties.toList().flatMap((value) => [
|
|
1572
|
+
value.length > 0
|
|
1573
|
+
? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
1574
|
+
if (itemIndex === 0) {
|
|
1575
|
+
currentSubListResource = listResource;
|
|
1576
|
+
}
|
|
1577
|
+
else {
|
|
1578
|
+
const newSubListResource = resourceSet.mutableResource(dataFactory.blankNode(), { mutateGraph });
|
|
1579
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier);
|
|
1580
|
+
currentSubListResource = newSubListResource;
|
|
1581
|
+
}
|
|
1582
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, ...[item]);
|
|
1583
|
+
if (itemIndex + 1 === list.length) {
|
|
1584
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil);
|
|
1585
|
+
}
|
|
1586
|
+
return { currentSubListResource, listResource };
|
|
1587
|
+
}, {
|
|
1588
|
+
currentSubListResource: null,
|
|
1589
|
+
listResource: resourceSet.mutableResource(dataFactory.blankNode(), { mutateGraph }),
|
|
1590
|
+
}).listResource.identifier
|
|
1591
|
+
: $RdfVocabularies.rdf.nil,
|
|
1592
|
+
]));
|
|
1593
|
+
resource.add(ShaclCoreNodeShape.$properties.properties["identifier"], ..._shaclCoreNodeShape.properties.flatMap((item) => [item]));
|
|
1532
1594
|
return resource;
|
|
1533
1595
|
}
|
|
1534
1596
|
ShaclCoreNodeShape.$toRdf = $toRdf;
|
|
@@ -1560,68 +1622,74 @@ export var OwlOntology;
|
|
|
1560
1622
|
$Identifier.toString = rdfjsResource.Resource.Identifier.toString;
|
|
1561
1623
|
})($Identifier = OwlOntology.$Identifier || (OwlOntology.$Identifier = {}));
|
|
1562
1624
|
function $fromRdf(resource, options) {
|
|
1563
|
-
let { ignoreRdfType = false,
|
|
1625
|
+
let { ignoreRdfType = false, objectSet, preferredLanguages, ...context } = options ?? {};
|
|
1564
1626
|
if (!objectSet) {
|
|
1565
1627
|
objectSet = new $RdfjsDatasetObjectSet({ dataset: resource.dataset });
|
|
1566
1628
|
}
|
|
1567
1629
|
return OwlOntology.$propertiesFromRdf({
|
|
1568
1630
|
...context,
|
|
1569
1631
|
ignoreRdfType,
|
|
1570
|
-
languageIn,
|
|
1571
1632
|
objectSet,
|
|
1633
|
+
preferredLanguages,
|
|
1572
1634
|
resource,
|
|
1573
1635
|
});
|
|
1574
1636
|
}
|
|
1575
1637
|
OwlOntology.$fromRdf = $fromRdf;
|
|
1576
|
-
function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType,
|
|
1638
|
+
function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, objectSet: $objectSet, preferredLanguages: $preferredLanguages, resource: $resource,
|
|
1577
1639
|
// @ts-ignore
|
|
1578
1640
|
...$context }) {
|
|
1579
|
-
if (!$ignoreRdfType
|
|
1580
|
-
|
|
1641
|
+
if (!$ignoreRdfType) {
|
|
1642
|
+
const $rdfTypeCheck = $resource
|
|
1581
1643
|
.value($RdfVocabularies.rdf.type)
|
|
1582
1644
|
.chain((actualRdfType) => actualRdfType.toIri())
|
|
1583
|
-
.chain((actualRdfType) =>
|
|
1645
|
+
.chain((actualRdfType) => {
|
|
1646
|
+
// Check the expected type and its known subtypes
|
|
1647
|
+
switch (actualRdfType.value) {
|
|
1648
|
+
case "http://www.w3.org/2002/07/owl#Ontology":
|
|
1649
|
+
return purify.Either.of(true);
|
|
1650
|
+
}
|
|
1651
|
+
// Check arbitrary rdfs:subClassOf's of the expected type
|
|
1652
|
+
if ($resource.isInstanceOf(OwlOntology.$fromRdfType)) {
|
|
1653
|
+
return purify.Either.of(true);
|
|
1654
|
+
}
|
|
1655
|
+
return purify.Left(new Error(`${rdfjsResource.Resource.Identifier.toString($resource.identifier)} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/2002/07/owl#Ontology)`));
|
|
1656
|
+
});
|
|
1657
|
+
if ($rdfTypeCheck.isLeft()) {
|
|
1658
|
+
return $rdfTypeCheck;
|
|
1659
|
+
}
|
|
1584
1660
|
}
|
|
1585
1661
|
const $identifier = $resource.identifier;
|
|
1586
1662
|
const $type = "OwlOntology";
|
|
1587
1663
|
const _labelsEither = purify.Either.of($resource.values(OwlOntology.$properties.labels["identifier"], { unique: true }))
|
|
1588
1664
|
.chain((values) => {
|
|
1665
|
+
if (!$preferredLanguages || $preferredLanguages.length === 0) {
|
|
1666
|
+
return purify.Either.of(values);
|
|
1667
|
+
}
|
|
1589
1668
|
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
1590
1669
|
if (literalValuesEither.isLeft()) {
|
|
1591
1670
|
return literalValuesEither;
|
|
1592
1671
|
}
|
|
1593
1672
|
const literalValues = literalValuesEither.unsafeCoerce();
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
return purify.Either.of(literalValues);
|
|
1597
|
-
}
|
|
1598
|
-
let uniqueLanguageIn;
|
|
1599
|
-
if (nonUniqueLanguageIn.length === 1) {
|
|
1600
|
-
uniqueLanguageIn = [nonUniqueLanguageIn[0]];
|
|
1601
|
-
}
|
|
1602
|
-
else {
|
|
1603
|
-
uniqueLanguageIn = [];
|
|
1604
|
-
for (const languageIn of nonUniqueLanguageIn) {
|
|
1605
|
-
if (uniqueLanguageIn.indexOf(languageIn) === -1) {
|
|
1606
|
-
uniqueLanguageIn.push(languageIn);
|
|
1607
|
-
}
|
|
1608
|
-
}
|
|
1609
|
-
}
|
|
1610
|
-
// Return all literals for the first languageIn, then all literals for the second languageIn, etc.
|
|
1611
|
-
// Within a languageIn the literals may be in any order.
|
|
1673
|
+
// Return all literals for the first preferredLanguage, then all literals for the second preferredLanguage, etc.
|
|
1674
|
+
// Within a preferredLanguage the literals may be in any order.
|
|
1612
1675
|
let filteredLiteralValues;
|
|
1613
|
-
for (const
|
|
1676
|
+
for (const preferredLanguage of $preferredLanguages) {
|
|
1614
1677
|
if (!filteredLiteralValues) {
|
|
1615
|
-
filteredLiteralValues = literalValues.filter((value) => value.language ===
|
|
1678
|
+
filteredLiteralValues = literalValues.filter((value) => value.language === preferredLanguage);
|
|
1616
1679
|
}
|
|
1617
1680
|
else {
|
|
1618
1681
|
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
1619
|
-
.filter((value) => value.language ===
|
|
1682
|
+
.filter((value) => value.language === preferredLanguage)
|
|
1620
1683
|
.toArray());
|
|
1621
1684
|
}
|
|
1622
1685
|
}
|
|
1623
|
-
return purify.Either.of(filteredLiteralValues)
|
|
1686
|
+
return purify.Either.of(filteredLiteralValues.map((literalValue) => new rdfjsResource.Resource.Value({
|
|
1687
|
+
object: literalValue,
|
|
1688
|
+
predicate: OwlOntology.$properties.labels["identifier"],
|
|
1689
|
+
subject: $resource,
|
|
1690
|
+
})));
|
|
1624
1691
|
})
|
|
1692
|
+
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
1625
1693
|
.map((values) => values.toArray())
|
|
1626
1694
|
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
1627
1695
|
object: valuesArray,
|
|
@@ -1651,7 +1719,7 @@ export var OwlOntology;
|
|
|
1651
1719
|
resource.add($RdfVocabularies.rdf.type, resource.dataFactory.namedNode("http://purl.org/shaclmate/ontology#OwlOntology"));
|
|
1652
1720
|
resource.add($RdfVocabularies.rdf.type, resource.dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"));
|
|
1653
1721
|
}
|
|
1654
|
-
resource.add(OwlOntology.$properties.labels["identifier"], _owlOntology.labels.
|
|
1722
|
+
resource.add(OwlOntology.$properties.labels["identifier"], ..._owlOntology.labels.flatMap((item) => [item]));
|
|
1655
1723
|
return resource;
|
|
1656
1724
|
}
|
|
1657
1725
|
OwlOntology.$toRdf = $toRdf;
|
|
@@ -1697,6 +1765,68 @@ export var ShaclCoreShape;
|
|
|
1697
1765
|
}
|
|
1698
1766
|
ShaclCoreShape.$toRdf = $toRdf;
|
|
1699
1767
|
})(ShaclCoreShape || (ShaclCoreShape = {}));
|
|
1768
|
+
export class $ForwardingObjectSet {
|
|
1769
|
+
owlOntology(identifier) {
|
|
1770
|
+
return this.$delegate.owlOntology(identifier);
|
|
1771
|
+
}
|
|
1772
|
+
owlOntologyIdentifiers(query) {
|
|
1773
|
+
return this.$delegate.owlOntologyIdentifiers(query);
|
|
1774
|
+
}
|
|
1775
|
+
owlOntologies(query) {
|
|
1776
|
+
return this.$delegate.owlOntologies(query);
|
|
1777
|
+
}
|
|
1778
|
+
owlOntologiesCount(query) {
|
|
1779
|
+
return this.$delegate.owlOntologiesCount(query);
|
|
1780
|
+
}
|
|
1781
|
+
shaclCoreNodeShape(identifier) {
|
|
1782
|
+
return this.$delegate.shaclCoreNodeShape(identifier);
|
|
1783
|
+
}
|
|
1784
|
+
shaclCoreNodeShapeIdentifiers(query) {
|
|
1785
|
+
return this.$delegate.shaclCoreNodeShapeIdentifiers(query);
|
|
1786
|
+
}
|
|
1787
|
+
shaclCoreNodeShapes(query) {
|
|
1788
|
+
return this.$delegate.shaclCoreNodeShapes(query);
|
|
1789
|
+
}
|
|
1790
|
+
shaclCoreNodeShapesCount(query) {
|
|
1791
|
+
return this.$delegate.shaclCoreNodeShapesCount(query);
|
|
1792
|
+
}
|
|
1793
|
+
shaclCorePropertyGroup(identifier) {
|
|
1794
|
+
return this.$delegate.shaclCorePropertyGroup(identifier);
|
|
1795
|
+
}
|
|
1796
|
+
shaclCorePropertyGroupIdentifiers(query) {
|
|
1797
|
+
return this.$delegate.shaclCorePropertyGroupIdentifiers(query);
|
|
1798
|
+
}
|
|
1799
|
+
shaclCorePropertyGroups(query) {
|
|
1800
|
+
return this.$delegate.shaclCorePropertyGroups(query);
|
|
1801
|
+
}
|
|
1802
|
+
shaclCorePropertyGroupsCount(query) {
|
|
1803
|
+
return this.$delegate.shaclCorePropertyGroupsCount(query);
|
|
1804
|
+
}
|
|
1805
|
+
shaclCorePropertyShape(identifier) {
|
|
1806
|
+
return this.$delegate.shaclCorePropertyShape(identifier);
|
|
1807
|
+
}
|
|
1808
|
+
shaclCorePropertyShapeIdentifiers(query) {
|
|
1809
|
+
return this.$delegate.shaclCorePropertyShapeIdentifiers(query);
|
|
1810
|
+
}
|
|
1811
|
+
shaclCorePropertyShapes(query) {
|
|
1812
|
+
return this.$delegate.shaclCorePropertyShapes(query);
|
|
1813
|
+
}
|
|
1814
|
+
shaclCorePropertyShapesCount(query) {
|
|
1815
|
+
return this.$delegate.shaclCorePropertyShapesCount(query);
|
|
1816
|
+
}
|
|
1817
|
+
shaclCoreShape(identifier) {
|
|
1818
|
+
return this.$delegate.shaclCoreShape(identifier);
|
|
1819
|
+
}
|
|
1820
|
+
shaclCoreShapeIdentifiers(query) {
|
|
1821
|
+
return this.$delegate.shaclCoreShapeIdentifiers(query);
|
|
1822
|
+
}
|
|
1823
|
+
shaclCoreShapes(query) {
|
|
1824
|
+
return this.$delegate.shaclCoreShapes(query);
|
|
1825
|
+
}
|
|
1826
|
+
shaclCoreShapesCount(query) {
|
|
1827
|
+
return this.$delegate.shaclCoreShapesCount(query);
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1700
1830
|
export class $RdfjsDatasetObjectSet {
|
|
1701
1831
|
resourceSet;
|
|
1702
1832
|
constructor({ dataset }) {
|
|
@@ -1714,19 +1844,28 @@ export class $RdfjsDatasetObjectSet {
|
|
|
1714
1844
|
return this.owlOntologyIdentifiersSync(query);
|
|
1715
1845
|
}
|
|
1716
1846
|
owlOntologyIdentifiersSync(query) {
|
|
1717
|
-
return this.$objectIdentifiersSync(
|
|
1847
|
+
return this.$objectIdentifiersSync({
|
|
1848
|
+
$fromRdf: OwlOntology.$fromRdf,
|
|
1849
|
+
$fromRdfTypes: [OwlOntology.$fromRdfType],
|
|
1850
|
+
}, query);
|
|
1718
1851
|
}
|
|
1719
1852
|
async owlOntologies(query) {
|
|
1720
1853
|
return this.owlOntologiesSync(query);
|
|
1721
1854
|
}
|
|
1722
1855
|
owlOntologiesSync(query) {
|
|
1723
|
-
return this.$objectsSync(
|
|
1856
|
+
return this.$objectsSync({
|
|
1857
|
+
$fromRdf: OwlOntology.$fromRdf,
|
|
1858
|
+
$fromRdfTypes: [OwlOntology.$fromRdfType],
|
|
1859
|
+
}, query);
|
|
1724
1860
|
}
|
|
1725
1861
|
async owlOntologiesCount(query) {
|
|
1726
1862
|
return this.owlOntologiesCountSync(query);
|
|
1727
1863
|
}
|
|
1728
1864
|
owlOntologiesCountSync(query) {
|
|
1729
|
-
return this.$objectsCountSync(
|
|
1865
|
+
return this.$objectsCountSync({
|
|
1866
|
+
$fromRdf: OwlOntology.$fromRdf,
|
|
1867
|
+
$fromRdfTypes: [OwlOntology.$fromRdfType],
|
|
1868
|
+
}, query);
|
|
1730
1869
|
}
|
|
1731
1870
|
async shaclCoreNodeShape(identifier) {
|
|
1732
1871
|
return this.shaclCoreNodeShapeSync(identifier);
|
|
@@ -1740,19 +1879,28 @@ export class $RdfjsDatasetObjectSet {
|
|
|
1740
1879
|
return this.shaclCoreNodeShapeIdentifiersSync(query);
|
|
1741
1880
|
}
|
|
1742
1881
|
shaclCoreNodeShapeIdentifiersSync(query) {
|
|
1743
|
-
return this.$objectIdentifiersSync(
|
|
1882
|
+
return this.$objectIdentifiersSync({
|
|
1883
|
+
$fromRdf: ShaclCoreNodeShape.$fromRdf,
|
|
1884
|
+
$fromRdfTypes: [ShaclCoreNodeShape.$fromRdfType],
|
|
1885
|
+
}, query);
|
|
1744
1886
|
}
|
|
1745
1887
|
async shaclCoreNodeShapes(query) {
|
|
1746
1888
|
return this.shaclCoreNodeShapesSync(query);
|
|
1747
1889
|
}
|
|
1748
1890
|
shaclCoreNodeShapesSync(query) {
|
|
1749
|
-
return this.$objectsSync(
|
|
1891
|
+
return this.$objectsSync({
|
|
1892
|
+
$fromRdf: ShaclCoreNodeShape.$fromRdf,
|
|
1893
|
+
$fromRdfTypes: [ShaclCoreNodeShape.$fromRdfType],
|
|
1894
|
+
}, query);
|
|
1750
1895
|
}
|
|
1751
1896
|
async shaclCoreNodeShapesCount(query) {
|
|
1752
1897
|
return this.shaclCoreNodeShapesCountSync(query);
|
|
1753
1898
|
}
|
|
1754
1899
|
shaclCoreNodeShapesCountSync(query) {
|
|
1755
|
-
return this.$objectsCountSync(
|
|
1900
|
+
return this.$objectsCountSync({
|
|
1901
|
+
$fromRdf: ShaclCoreNodeShape.$fromRdf,
|
|
1902
|
+
$fromRdfTypes: [ShaclCoreNodeShape.$fromRdfType],
|
|
1903
|
+
}, query);
|
|
1756
1904
|
}
|
|
1757
1905
|
async shaclCorePropertyGroup(identifier) {
|
|
1758
1906
|
return this.shaclCorePropertyGroupSync(identifier);
|
|
@@ -1766,19 +1914,28 @@ export class $RdfjsDatasetObjectSet {
|
|
|
1766
1914
|
return this.shaclCorePropertyGroupIdentifiersSync(query);
|
|
1767
1915
|
}
|
|
1768
1916
|
shaclCorePropertyGroupIdentifiersSync(query) {
|
|
1769
|
-
return this.$objectIdentifiersSync(
|
|
1917
|
+
return this.$objectIdentifiersSync({
|
|
1918
|
+
$fromRdf: ShaclCorePropertyGroup.$fromRdf,
|
|
1919
|
+
$fromRdfTypes: [ShaclCorePropertyGroup.$fromRdfType],
|
|
1920
|
+
}, query);
|
|
1770
1921
|
}
|
|
1771
1922
|
async shaclCorePropertyGroups(query) {
|
|
1772
1923
|
return this.shaclCorePropertyGroupsSync(query);
|
|
1773
1924
|
}
|
|
1774
1925
|
shaclCorePropertyGroupsSync(query) {
|
|
1775
|
-
return this.$objectsSync(
|
|
1926
|
+
return this.$objectsSync({
|
|
1927
|
+
$fromRdf: ShaclCorePropertyGroup.$fromRdf,
|
|
1928
|
+
$fromRdfTypes: [ShaclCorePropertyGroup.$fromRdfType],
|
|
1929
|
+
}, query);
|
|
1776
1930
|
}
|
|
1777
1931
|
async shaclCorePropertyGroupsCount(query) {
|
|
1778
1932
|
return this.shaclCorePropertyGroupsCountSync(query);
|
|
1779
1933
|
}
|
|
1780
1934
|
shaclCorePropertyGroupsCountSync(query) {
|
|
1781
|
-
return this.$objectsCountSync(
|
|
1935
|
+
return this.$objectsCountSync({
|
|
1936
|
+
$fromRdf: ShaclCorePropertyGroup.$fromRdf,
|
|
1937
|
+
$fromRdfTypes: [ShaclCorePropertyGroup.$fromRdfType],
|
|
1938
|
+
}, query);
|
|
1782
1939
|
}
|
|
1783
1940
|
async shaclCorePropertyShape(identifier) {
|
|
1784
1941
|
return this.shaclCorePropertyShapeSync(identifier);
|
|
@@ -1792,19 +1949,28 @@ export class $RdfjsDatasetObjectSet {
|
|
|
1792
1949
|
return this.shaclCorePropertyShapeIdentifiersSync(query);
|
|
1793
1950
|
}
|
|
1794
1951
|
shaclCorePropertyShapeIdentifiersSync(query) {
|
|
1795
|
-
return this.$objectIdentifiersSync(
|
|
1952
|
+
return this.$objectIdentifiersSync({
|
|
1953
|
+
$fromRdf: ShaclCorePropertyShape.$fromRdf,
|
|
1954
|
+
$fromRdfTypes: [ShaclCorePropertyShape.$fromRdfType],
|
|
1955
|
+
}, query);
|
|
1796
1956
|
}
|
|
1797
1957
|
async shaclCorePropertyShapes(query) {
|
|
1798
1958
|
return this.shaclCorePropertyShapesSync(query);
|
|
1799
1959
|
}
|
|
1800
1960
|
shaclCorePropertyShapesSync(query) {
|
|
1801
|
-
return this.$objectsSync(
|
|
1961
|
+
return this.$objectsSync({
|
|
1962
|
+
$fromRdf: ShaclCorePropertyShape.$fromRdf,
|
|
1963
|
+
$fromRdfTypes: [ShaclCorePropertyShape.$fromRdfType],
|
|
1964
|
+
}, query);
|
|
1802
1965
|
}
|
|
1803
1966
|
async shaclCorePropertyShapesCount(query) {
|
|
1804
1967
|
return this.shaclCorePropertyShapesCountSync(query);
|
|
1805
1968
|
}
|
|
1806
1969
|
shaclCorePropertyShapesCountSync(query) {
|
|
1807
|
-
return this.$objectsCountSync(
|
|
1970
|
+
return this.$objectsCountSync({
|
|
1971
|
+
$fromRdf: ShaclCorePropertyShape.$fromRdf,
|
|
1972
|
+
$fromRdfTypes: [ShaclCorePropertyShape.$fromRdfType],
|
|
1973
|
+
}, query);
|
|
1808
1974
|
}
|
|
1809
1975
|
async shaclCoreShape(identifier) {
|
|
1810
1976
|
return this.shaclCoreShapeSync(identifier);
|
|
@@ -1818,19 +1984,46 @@ export class $RdfjsDatasetObjectSet {
|
|
|
1818
1984
|
return this.shaclCoreShapeIdentifiersSync(query);
|
|
1819
1985
|
}
|
|
1820
1986
|
shaclCoreShapeIdentifiersSync(query) {
|
|
1821
|
-
return this.$objectUnionIdentifiersSync([
|
|
1987
|
+
return this.$objectUnionIdentifiersSync([
|
|
1988
|
+
{
|
|
1989
|
+
$fromRdf: ShaclCoreNodeShape.$fromRdf,
|
|
1990
|
+
$fromRdfTypes: [ShaclCoreNodeShape.$fromRdfType],
|
|
1991
|
+
},
|
|
1992
|
+
{
|
|
1993
|
+
$fromRdf: ShaclCorePropertyShape.$fromRdf,
|
|
1994
|
+
$fromRdfTypes: [ShaclCorePropertyShape.$fromRdfType],
|
|
1995
|
+
},
|
|
1996
|
+
], query);
|
|
1822
1997
|
}
|
|
1823
1998
|
async shaclCoreShapes(query) {
|
|
1824
1999
|
return this.shaclCoreShapesSync(query);
|
|
1825
2000
|
}
|
|
1826
2001
|
shaclCoreShapesSync(query) {
|
|
1827
|
-
return this.$objectUnionsSync([
|
|
2002
|
+
return this.$objectUnionsSync([
|
|
2003
|
+
{
|
|
2004
|
+
$fromRdf: ShaclCoreNodeShape.$fromRdf,
|
|
2005
|
+
$fromRdfTypes: [ShaclCoreNodeShape.$fromRdfType],
|
|
2006
|
+
},
|
|
2007
|
+
{
|
|
2008
|
+
$fromRdf: ShaclCorePropertyShape.$fromRdf,
|
|
2009
|
+
$fromRdfTypes: [ShaclCorePropertyShape.$fromRdfType],
|
|
2010
|
+
},
|
|
2011
|
+
], query);
|
|
1828
2012
|
}
|
|
1829
2013
|
async shaclCoreShapesCount(query) {
|
|
1830
2014
|
return this.shaclCoreShapesCountSync(query);
|
|
1831
2015
|
}
|
|
1832
2016
|
shaclCoreShapesCountSync(query) {
|
|
1833
|
-
return this.$objectUnionsCountSync([
|
|
2017
|
+
return this.$objectUnionsCountSync([
|
|
2018
|
+
{
|
|
2019
|
+
$fromRdf: ShaclCoreNodeShape.$fromRdf,
|
|
2020
|
+
$fromRdfTypes: [ShaclCoreNodeShape.$fromRdfType],
|
|
2021
|
+
},
|
|
2022
|
+
{
|
|
2023
|
+
$fromRdf: ShaclCorePropertyShape.$fromRdf,
|
|
2024
|
+
$fromRdfTypes: [ShaclCorePropertyShape.$fromRdfType],
|
|
2025
|
+
},
|
|
2026
|
+
], query);
|
|
1834
2027
|
}
|
|
1835
2028
|
$objectIdentifiersSync(objectType, query) {
|
|
1836
2029
|
return this.$objectsSync(objectType, query).map((objects) => objects.map((object) => object.$identifier));
|
|
@@ -1882,12 +2075,17 @@ export class $RdfjsDatasetObjectSet {
|
|
|
1882
2075
|
}
|
|
1883
2076
|
return purify.Either.of(objects);
|
|
1884
2077
|
}
|
|
1885
|
-
if (
|
|
2078
|
+
if (objectType.$fromRdfTypes.length === 0) {
|
|
1886
2079
|
return purify.Either.of([]);
|
|
1887
2080
|
}
|
|
1888
|
-
const resources = [
|
|
1889
|
-
|
|
1890
|
-
|
|
2081
|
+
const resources = [];
|
|
2082
|
+
for (const fromRdfType of objectType.$fromRdfTypes) {
|
|
2083
|
+
for (const resource of this.resourceSet.instancesOf(fromRdfType)) {
|
|
2084
|
+
if (!resources.some((existingResource) => existingResource.identifier.equals(resource.identifier))) {
|
|
2085
|
+
resources.push(resource);
|
|
2086
|
+
}
|
|
2087
|
+
}
|
|
2088
|
+
}
|
|
1891
2089
|
// Sort resources by identifier so limit and offset are deterministic
|
|
1892
2090
|
resources.sort((left, right) => left.identifier.value.localeCompare(right.identifier.value));
|
|
1893
2091
|
const objects = [];
|
|
@@ -1970,11 +2168,15 @@ export class $RdfjsDatasetObjectSet {
|
|
|
1970
2168
|
}
|
|
1971
2169
|
const resources = [];
|
|
1972
2170
|
for (const objectType of objectTypes) {
|
|
1973
|
-
if (
|
|
2171
|
+
if (objectType.$fromRdfTypes.length === 0) {
|
|
1974
2172
|
continue;
|
|
1975
2173
|
}
|
|
1976
|
-
for (const
|
|
1977
|
-
|
|
2174
|
+
for (const fromRdfType of objectType.$fromRdfTypes) {
|
|
2175
|
+
for (const resource of this.resourceSet.instancesOf(fromRdfType)) {
|
|
2176
|
+
if (!resources.some(({ resource: existingResource }) => existingResource.identifier.equals(resource.identifier))) {
|
|
2177
|
+
resources.push({ objectType, resource });
|
|
2178
|
+
}
|
|
2179
|
+
}
|
|
1978
2180
|
}
|
|
1979
2181
|
}
|
|
1980
2182
|
// Sort resources by identifier so limit and offset are deterministic
|