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