@rdfx/builder 0.0.19

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/shapes.js ADDED
@@ -0,0 +1,2499 @@
1
+ import datasetFactory from "@rdfjs/dataset";
2
+ import dataFactory from "@rdfx/data-factory";
3
+ import { LiteralFactory } from "@rdfx/literal";
4
+ import { PropertyPath as RdfxResourcePropertyPath, ResourceSet, } from "@rdfx/resource";
5
+ import { NTriplesIdentifier, NTriplesTerm } from "@rdfx/string";
6
+ import { Either, Left, Maybe, Right } from "purify-ts";
7
+ /**
8
+ * Remove undefined values from a record.
9
+ */
10
+ function $compactRecord(record) {
11
+ return globalThis.Object.entries(record).reduce((definedProperties, [propertyName, propertyValue]) => {
12
+ if (propertyValue !== undefined) {
13
+ definedProperties[propertyName] = propertyValue;
14
+ }
15
+ return definedProperties;
16
+ }, {});
17
+ }
18
+ function $convertToIdentifier(value) {
19
+ switch (typeof value) {
20
+ case "object":
21
+ return Either.of(value);
22
+ case "string":
23
+ return Either.of(dataFactory.namedNode(value));
24
+ case "undefined":
25
+ return Either.of(dataFactory.blankNode());
26
+ }
27
+ }
28
+ function $convertToIdentifierProperty(identifier) {
29
+ switch (typeof identifier) {
30
+ case "function":
31
+ return Either.of(identifier);
32
+ case "object": {
33
+ const captureIdentifier = identifier;
34
+ return Either.of(() => captureIdentifier);
35
+ }
36
+ case "string": {
37
+ const captureIdentifier = dataFactory.namedNode(identifier);
38
+ return Either.of(() => captureIdentifier);
39
+ }
40
+ case "undefined": {
41
+ const captureIdentifier = dataFactory.blankNode();
42
+ return Either.of(() => captureIdentifier);
43
+ }
44
+ }
45
+ }
46
+ function $convertToIri(value) {
47
+ switch (typeof value) {
48
+ case "object":
49
+ return Either.of(value);
50
+ case "string":
51
+ return Either.of(dataFactory.namedNode(value));
52
+ }
53
+ }
54
+ function $convertToList(convertToItem, _readonly) {
55
+ return (value) => Either.sequence(value.map(convertToItem));
56
+ }
57
+ function $convertToLiteral(value) {
58
+ if (typeof value === "object") {
59
+ if (value instanceof Date) {
60
+ return Either.of($literalFactory.date(value));
61
+ }
62
+ return Either.of(value);
63
+ }
64
+ return Either.of($literalFactory.primitive(value));
65
+ }
66
+ function $convertToMaybe(convertToItem) {
67
+ return (value) => {
68
+ switch (typeof value) {
69
+ case "object": {
70
+ if (Maybe.isMaybe(value)) {
71
+ return Either.of(value);
72
+ }
73
+ break;
74
+ }
75
+ case "undefined":
76
+ return Either.of(Maybe.empty());
77
+ }
78
+ return convertToItem(value).map(Maybe.of);
79
+ };
80
+ }
81
+ function $convertToScalarSet(convertToItem, _readonly) {
82
+ return (value) => {
83
+ if (typeof value === "undefined") {
84
+ return Either.of([]);
85
+ }
86
+ if (Array.isArray(value)) {
87
+ return Either.sequence(value.map(convertToItem));
88
+ }
89
+ return convertToItem(value).map((value) => [
90
+ value,
91
+ ]);
92
+ };
93
+ }
94
+ function $convertWithDefaultValue(convertToItem, defaultValue) {
95
+ return (value) => {
96
+ if (typeof value === "undefined") {
97
+ return convertToItem(defaultValue);
98
+ }
99
+ return convertToItem(value);
100
+ };
101
+ }
102
+ export var $EqualsResult;
103
+ (function ($EqualsResult) {
104
+ $EqualsResult.Equal = Right(true);
105
+ function fromBooleanEqualsResult(left, right, equalsResult) {
106
+ if (typeof equalsResult !== "boolean") {
107
+ return equalsResult;
108
+ }
109
+ if (equalsResult) {
110
+ return $EqualsResult.Equal;
111
+ }
112
+ return Left({ left, right, type: "boolean" });
113
+ }
114
+ $EqualsResult.fromBooleanEqualsResult = fromBooleanEqualsResult;
115
+ })($EqualsResult || ($EqualsResult = {}));
116
+ function $identityConversionFunction(value) {
117
+ return Either.of(value);
118
+ }
119
+ function $identityValidationFunction(_schema, value) {
120
+ return Either.of(value);
121
+ }
122
+ const $literalFactory = new LiteralFactory({ dataFactory: dataFactory });
123
+ function $monkeyPatchObject(obj, methods) {
124
+ if (methods.toJson &&
125
+ (!globalThis.Object.prototype.hasOwnProperty.call(obj, "toJSON") ||
126
+ typeof obj.toJSON === "function")) {
127
+ const toJsonMethod = methods.toJson;
128
+ obj.toJSON = function (_key) {
129
+ return toJsonMethod(this);
130
+ };
131
+ }
132
+ if (methods.$toString &&
133
+ (!globalThis.Object.prototype.hasOwnProperty.call(obj, "toString") ||
134
+ typeof obj.toJSON === "function")) {
135
+ const toStringMethod = methods.$toString;
136
+ obj.toString = function () {
137
+ return toStringMethod(this);
138
+ };
139
+ }
140
+ return obj;
141
+ }
142
+ const $parseIdentifier = NTriplesIdentifier.parser(dataFactory);
143
+ export var $PropertyPath;
144
+ (function ($PropertyPath) {
145
+ $PropertyPath.schema = {};
146
+ $PropertyPath.toRdfResource = RdfxResourcePropertyPath.toResource;
147
+ $PropertyPath.$toString = RdfxResourcePropertyPath.toString;
148
+ })($PropertyPath || ($PropertyPath = {}));
149
+ var $RdfVocabularies;
150
+ (function ($RdfVocabularies) {
151
+ $RdfVocabularies.rdf = {
152
+ first: dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#first"),
153
+ nil: dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"),
154
+ rest: dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"),
155
+ subject: dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#subject"),
156
+ type: dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),
157
+ };
158
+ $RdfVocabularies.rdfs = {
159
+ subClassOf: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf"),
160
+ };
161
+ $RdfVocabularies.xsd = {
162
+ boolean: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#boolean"),
163
+ byte: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#byte"),
164
+ date: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#date"),
165
+ dateTime: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#dateTime"),
166
+ decimal: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#decimal"),
167
+ double: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#double"),
168
+ float: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#float"),
169
+ int: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#int"),
170
+ integer: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#integer"),
171
+ long: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#long"),
172
+ negativeInteger: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#negativeInteger"),
173
+ nonNegativeInteger: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#nonNegativeInteger"),
174
+ nonPositiveInteger: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#nonPositiveInteger"),
175
+ positiveInteger: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#positiveInteger"),
176
+ short: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#short"),
177
+ string: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#string"),
178
+ unsignedByte: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#unsignedByte"),
179
+ unsignedInt: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#unsignedInt"),
180
+ unsignedLong: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#unsignedLong"),
181
+ unsignedShort: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#unsignedShort"),
182
+ };
183
+ })($RdfVocabularies || ($RdfVocabularies = {}));
184
+ function $sequenceRecord(record) {
185
+ const result = {};
186
+ for (const key of globalThis.Object.keys(record)) {
187
+ const either = record[key];
188
+ if (either.isLeft()) {
189
+ return either;
190
+ }
191
+ result[key] = either.extract();
192
+ }
193
+ return Right(result);
194
+ }
195
+ /**
196
+ * Compare two values for strict equality (===), returning an $EqualsResult rather than a boolean.
197
+ */
198
+ function $strictEquals(left, right) {
199
+ return $EqualsResult.fromBooleanEqualsResult(left, right, left === right);
200
+ }
201
+ function $validateArray(validateItem, _readonly) {
202
+ return (schema, valueArray) => {
203
+ if (schema.minCount !== undefined && valueArray.length < schema.minCount) {
204
+ return Left(new Error(`value array has length (${valueArray.length}) less than minCount (${schema.minCount})`));
205
+ }
206
+ return Either.sequence(valueArray.map((value) => validateItem(schema.itemType, value)));
207
+ };
208
+ }
209
+ function $validateMaybe(validateItem) {
210
+ return (schema, valueMaybe) => valueMaybe
211
+ .map((value) => validateItem(schema.itemType, value).map(() => valueMaybe))
212
+ .orDefault(Either.of(valueMaybe));
213
+ }
214
+ function $wrap_ToRdfResourceFunction(_toRdfResourceFunction) {
215
+ return (object, options) => {
216
+ let { graph, ignoreRdfType = false, resourceSet } = options ?? {};
217
+ if (!resourceSet) {
218
+ resourceSet = new ResourceSet({
219
+ dataFactory: dataFactory,
220
+ dataset: datasetFactory.dataset(),
221
+ });
222
+ }
223
+ const resource = resourceSet.resource(object.$identifier());
224
+ _toRdfResourceFunction({
225
+ graph,
226
+ ignoreRdfType,
227
+ object,
228
+ resource,
229
+ resourceSet,
230
+ });
231
+ return resource;
232
+ };
233
+ }
234
+ export var sh_NodeShape;
235
+ (function (sh_NodeShape) {
236
+ sh_NodeShape.create = (parameters) => $sequenceRecord({
237
+ $identifier: $convertToIdentifierProperty(parameters?.$identifier),
238
+ and: $convertToMaybe($convertToList($convertToIdentifier, true))(parameters?.and).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(sh_NodeShape.schema.properties.and.type, value)),
239
+ classes: $convertToScalarSet(($convertToIri), true)(parameters?.classes).chain((value) => $validateArray($identityValidationFunction, true)(sh_NodeShape.schema.properties.classes.type, value)),
240
+ closed: $convertToMaybe($identityConversionFunction)(parameters?.closed).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.closed.type, value)),
241
+ comment: $convertToMaybe($identityConversionFunction)(parameters?.comment).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.comment.type, value)),
242
+ datatype: $convertToMaybe(($convertToIri))(parameters?.datatype).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.datatype.type, value)),
243
+ deactivated: $convertToMaybe($identityConversionFunction)(parameters?.deactivated).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.deactivated.type, value)),
244
+ discriminantValue: $convertToMaybe($identityConversionFunction)(parameters?.discriminantValue).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.discriminantValue.type, value)),
245
+ extern: $convertToMaybe($identityConversionFunction)(parameters?.extern).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.extern.type, value)),
246
+ flags: $convertToMaybe($identityConversionFunction)(parameters?.flags).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.flags.type, value)),
247
+ fromRdfType: $convertToMaybe(($convertToIri))(parameters?.fromRdfType).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.fromRdfType.type, value)),
248
+ hasValues: $convertToScalarSet($identityConversionFunction, true)(parameters?.hasValues).chain((value) => $validateArray($identityValidationFunction, true)(sh_NodeShape.schema.properties.hasValues.type, value)),
249
+ ignore: $convertWithDefaultValue($identityConversionFunction, false)(parameters?.ignore),
250
+ ignoredProperties: $convertToMaybe($convertToList(($convertToIri), true))(parameters?.ignoredProperties).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(sh_NodeShape.schema.properties.ignoredProperties.type, value)),
251
+ in_: $convertToMaybe($convertToList($identityConversionFunction, true))(parameters?.in_).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(sh_NodeShape.schema.properties.in_.type, value)),
252
+ isDefinedBy: $convertToMaybe($convertToIdentifier)(parameters?.isDefinedBy).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.isDefinedBy.type, value)),
253
+ label: $convertToMaybe($identityConversionFunction)(parameters?.label).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.label.type, value)),
254
+ languageIn: $convertToMaybe($convertToList($identityConversionFunction, true))(parameters?.languageIn).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(sh_NodeShape.schema.properties.languageIn.type, value)),
255
+ maxExclusive: $convertToMaybe($convertToLiteral)(parameters?.maxExclusive).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.maxExclusive.type, value)),
256
+ maxInclusive: $convertToMaybe($convertToLiteral)(parameters?.maxInclusive).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.maxInclusive.type, value)),
257
+ maxLength: $convertToMaybe($identityConversionFunction)(parameters?.maxLength).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.maxLength.type, value)),
258
+ message: $convertToMaybe($identityConversionFunction)(parameters?.message).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.message.type, value)),
259
+ minExclusive: $convertToMaybe($convertToLiteral)(parameters?.minExclusive).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.minExclusive.type, value)),
260
+ minInclusive: $convertToMaybe($convertToLiteral)(parameters?.minInclusive).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.minInclusive.type, value)),
261
+ minLength: $convertToMaybe($identityConversionFunction)(parameters?.minLength).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.minLength.type, value)),
262
+ mutable: $convertToMaybe($identityConversionFunction)(parameters?.mutable).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.mutable.type, value)),
263
+ node: $convertToMaybe($convertToIdentifier)(parameters?.node).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.node.type, value)),
264
+ nodeKind: $convertToMaybe(($convertToIri))(parameters?.nodeKind).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.nodeKind.type, value)),
265
+ not: $convertToScalarSet($convertToIdentifier, true)(parameters?.not).chain((value) => $validateArray($identityValidationFunction, true)(sh_NodeShape.schema.properties.not.type, value)),
266
+ or: $convertToMaybe($convertToList($convertToIdentifier, true))(parameters?.or).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(sh_NodeShape.schema.properties.or.type, value)),
267
+ pattern: $convertToMaybe($identityConversionFunction)(parameters?.pattern).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.pattern.type, value)),
268
+ properties: $convertToScalarSet($convertToIdentifier, true)(parameters?.properties).chain((value) => $validateArray($identityValidationFunction, true)(sh_NodeShape.schema.properties.properties.type, value)),
269
+ rdfType: $convertToMaybe(($convertToIri))(parameters?.rdfType).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.rdfType.type, value)),
270
+ severity: $convertToMaybe(($convertToIri))(parameters?.severity).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.severity.type, value)),
271
+ shaclmateName: $convertToMaybe($identityConversionFunction)(parameters?.shaclmateName).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.shaclmateName.type, value)),
272
+ subClassOf: $convertToScalarSet(($convertToIri), true)(parameters?.subClassOf).chain((value) => $validateArray($identityValidationFunction, true)(sh_NodeShape.schema.properties.subClassOf.type, value)),
273
+ targetClasses: $convertToScalarSet(($convertToIri), true)(parameters?.targetClasses).chain((value) => $validateArray($identityValidationFunction, true)(sh_NodeShape.schema.properties.targetClasses.type, value)),
274
+ targetNodes: $convertToScalarSet($identityConversionFunction, true)(parameters?.targetNodes).chain((value) => $validateArray($identityValidationFunction, true)(sh_NodeShape.schema.properties.targetNodes.type, value)),
275
+ targetObjectsOf: $convertToScalarSet(($convertToIri), true)(parameters?.targetObjectsOf).chain((value) => $validateArray($identityValidationFunction, true)(sh_NodeShape.schema.properties.targetObjectsOf.type, value)),
276
+ targetSubjectsOf: $convertToScalarSet(($convertToIri), true)(parameters?.targetSubjectsOf).chain((value) => $validateArray($identityValidationFunction, true)(sh_NodeShape.schema.properties.targetSubjectsOf.type, value)),
277
+ toRdfTypes: $convertToScalarSet(($convertToIri), true)(parameters?.toRdfTypes).chain((value) => $validateArray($identityValidationFunction, true)(sh_NodeShape.schema.properties.toRdfTypes.type, value)),
278
+ tsImports: $convertToScalarSet($identityConversionFunction, true)(parameters?.tsImports).chain((value) => $validateArray($identityValidationFunction, true)(sh_NodeShape.schema.properties.tsImports.type, value)),
279
+ types: $convertToScalarSet(($convertToIri), true)(parameters?.types).chain((value) => $validateArray($identityValidationFunction, true)(sh_NodeShape.schema.properties.types.type, value)),
280
+ xone: $convertToMaybe($convertToList($convertToIdentifier, true))(parameters?.xone).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(sh_NodeShape.schema.properties.xone.type, value)),
281
+ })
282
+ .map((properties) => ({ ...properties, $type: "sh_NodeShape" }))
283
+ .map((object) => $monkeyPatchObject(object, { $toString: sh_NodeShape.$toString }));
284
+ function createUnsafe(parameters) {
285
+ return sh_NodeShape.create(parameters).unsafeCoerce();
286
+ }
287
+ sh_NodeShape.createUnsafe = createUnsafe;
288
+ let Identifier;
289
+ (function (Identifier) {
290
+ Identifier.parse = $parseIdentifier;
291
+ Identifier.stringify = NTriplesTerm.stringify;
292
+ })(Identifier = sh_NodeShape.Identifier || (sh_NodeShape.Identifier = {}));
293
+ function issh_NodeShape(object) {
294
+ return object.$type === "sh_NodeShape";
295
+ }
296
+ sh_NodeShape.issh_NodeShape = issh_NodeShape;
297
+ sh_NodeShape.schema = {
298
+ fromRdfType: dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape"),
299
+ properties: {
300
+ $identifier: {
301
+ kind: "Identifier",
302
+ type: { kind: "Identifier" },
303
+ },
304
+ and: {
305
+ kind: "Shacl",
306
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#and"),
307
+ type: {
308
+ kind: "Option",
309
+ itemType: {
310
+ kind: "List",
311
+ itemType: { kind: "Identifier" },
312
+ },
313
+ },
314
+ },
315
+ classes: {
316
+ kind: "Shacl",
317
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#class"),
318
+ type: { kind: "Set", itemType: { kind: "Iri" } },
319
+ },
320
+ closed: {
321
+ kind: "Shacl",
322
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#closed"),
323
+ type: {
324
+ kind: "Option",
325
+ itemType: { kind: "Boolean" },
326
+ },
327
+ },
328
+ comment: {
329
+ kind: "Shacl",
330
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
331
+ type: {
332
+ kind: "Option",
333
+ itemType: { kind: "String" },
334
+ },
335
+ },
336
+ datatype: {
337
+ kind: "Shacl",
338
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#datatype"),
339
+ type: { kind: "Option", itemType: { kind: "Iri" } },
340
+ },
341
+ deactivated: {
342
+ kind: "Shacl",
343
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"),
344
+ type: {
345
+ kind: "Option",
346
+ itemType: { kind: "Boolean" },
347
+ },
348
+ },
349
+ discriminantValue: {
350
+ kind: "Shacl",
351
+ path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#discriminantValue"),
352
+ type: {
353
+ kind: "Option",
354
+ itemType: { kind: "String" },
355
+ },
356
+ },
357
+ extern: {
358
+ kind: "Shacl",
359
+ path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#extern"),
360
+ type: {
361
+ kind: "Option",
362
+ itemType: { kind: "Boolean" },
363
+ },
364
+ },
365
+ flags: {
366
+ kind: "Shacl",
367
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#flags"),
368
+ type: {
369
+ kind: "Option",
370
+ itemType: { kind: "String" },
371
+ },
372
+ },
373
+ fromRdfType: {
374
+ kind: "Shacl",
375
+ path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#fromRdfType"),
376
+ type: { kind: "Option", itemType: { kind: "Iri" } },
377
+ },
378
+ hasValues: {
379
+ kind: "Shacl",
380
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#hasValue"),
381
+ type: {
382
+ kind: "Set",
383
+ itemType: { kind: "Term", types: ["NamedNode", "Literal"] },
384
+ },
385
+ },
386
+ ignore: {
387
+ kind: "Shacl",
388
+ path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#ignore"),
389
+ type: {
390
+ kind: "DefaultValue",
391
+ itemType: { kind: "Boolean" },
392
+ defaultValue: dataFactory.literal("false", $RdfVocabularies.xsd.boolean),
393
+ },
394
+ },
395
+ ignoredProperties: {
396
+ kind: "Shacl",
397
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#ignoredProperties"),
398
+ type: {
399
+ kind: "Option",
400
+ itemType: {
401
+ kind: "List",
402
+ itemType: { kind: "Iri" },
403
+ },
404
+ },
405
+ },
406
+ in_: {
407
+ kind: "Shacl",
408
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#in"),
409
+ type: {
410
+ kind: "Option",
411
+ itemType: {
412
+ kind: "List",
413
+ itemType: {
414
+ kind: "Term",
415
+ types: ["NamedNode", "Literal"],
416
+ },
417
+ },
418
+ },
419
+ },
420
+ isDefinedBy: {
421
+ kind: "Shacl",
422
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"),
423
+ type: {
424
+ kind: "Option",
425
+ itemType: { kind: "Identifier" },
426
+ },
427
+ },
428
+ label: {
429
+ kind: "Shacl",
430
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
431
+ type: {
432
+ kind: "Option",
433
+ itemType: { kind: "String" },
434
+ },
435
+ },
436
+ languageIn: {
437
+ kind: "Shacl",
438
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#languageIn"),
439
+ type: {
440
+ kind: "Option",
441
+ itemType: {
442
+ kind: "List",
443
+ itemType: { kind: "String" },
444
+ },
445
+ },
446
+ },
447
+ maxExclusive: {
448
+ kind: "Shacl",
449
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxExclusive"),
450
+ type: {
451
+ kind: "Option",
452
+ itemType: { kind: "Literal" },
453
+ },
454
+ },
455
+ maxInclusive: {
456
+ kind: "Shacl",
457
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxInclusive"),
458
+ type: {
459
+ kind: "Option",
460
+ itemType: { kind: "Literal" },
461
+ },
462
+ },
463
+ maxLength: {
464
+ kind: "Shacl",
465
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxLength"),
466
+ type: {
467
+ kind: "Option",
468
+ itemType: { kind: "BigInt" },
469
+ },
470
+ },
471
+ message: {
472
+ kind: "Shacl",
473
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#message"),
474
+ type: {
475
+ kind: "Option",
476
+ itemType: { kind: "String" },
477
+ },
478
+ },
479
+ minExclusive: {
480
+ kind: "Shacl",
481
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minExclusive"),
482
+ type: {
483
+ kind: "Option",
484
+ itemType: { kind: "Literal" },
485
+ },
486
+ },
487
+ minInclusive: {
488
+ kind: "Shacl",
489
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minInclusive"),
490
+ type: {
491
+ kind: "Option",
492
+ itemType: { kind: "Literal" },
493
+ },
494
+ },
495
+ minLength: {
496
+ kind: "Shacl",
497
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minLength"),
498
+ type: {
499
+ kind: "Option",
500
+ itemType: { kind: "BigInt" },
501
+ },
502
+ },
503
+ mutable: {
504
+ kind: "Shacl",
505
+ path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#mutable"),
506
+ type: {
507
+ kind: "Option",
508
+ itemType: { kind: "Boolean" },
509
+ },
510
+ },
511
+ node: {
512
+ kind: "Shacl",
513
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#node"),
514
+ type: {
515
+ kind: "Option",
516
+ itemType: { kind: "Identifier" },
517
+ },
518
+ },
519
+ nodeKind: {
520
+ kind: "Shacl",
521
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"),
522
+ type: {
523
+ kind: "Option",
524
+ itemType: {
525
+ kind: "Iri",
526
+ in: [
527
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNode"),
528
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrIRI"),
529
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrLiteral"),
530
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#IRI"),
531
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#IRIOrLiteral"),
532
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Literal"),
533
+ ],
534
+ },
535
+ },
536
+ },
537
+ not: {
538
+ kind: "Shacl",
539
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#not"),
540
+ type: {
541
+ kind: "Set",
542
+ itemType: { kind: "Identifier" },
543
+ },
544
+ },
545
+ or: {
546
+ kind: "Shacl",
547
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#or"),
548
+ type: {
549
+ kind: "Option",
550
+ itemType: {
551
+ kind: "List",
552
+ itemType: { kind: "Identifier" },
553
+ },
554
+ },
555
+ },
556
+ pattern: {
557
+ kind: "Shacl",
558
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#pattern"),
559
+ type: {
560
+ kind: "Option",
561
+ itemType: { kind: "String" },
562
+ },
563
+ },
564
+ properties: {
565
+ kind: "Shacl",
566
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#property"),
567
+ type: {
568
+ kind: "Set",
569
+ itemType: { kind: "Identifier" },
570
+ },
571
+ },
572
+ rdfType: {
573
+ kind: "Shacl",
574
+ path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#rdfType"),
575
+ type: { kind: "Option", itemType: { kind: "Iri" } },
576
+ },
577
+ severity: {
578
+ kind: "Shacl",
579
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#severity"),
580
+ get type() {
581
+ return {
582
+ kind: "Option",
583
+ get itemType() {
584
+ return {
585
+ kind: "Iri",
586
+ in: [
587
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Info"),
588
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Warning"),
589
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Violation"),
590
+ ],
591
+ };
592
+ },
593
+ };
594
+ },
595
+ },
596
+ shaclmateName: {
597
+ kind: "Shacl",
598
+ path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#name"),
599
+ type: {
600
+ kind: "Option",
601
+ itemType: { kind: "String" },
602
+ },
603
+ },
604
+ subClassOf: {
605
+ kind: "Shacl",
606
+ path: $RdfVocabularies.rdfs.subClassOf,
607
+ type: { kind: "Set", itemType: { kind: "Iri" } },
608
+ },
609
+ targetClasses: {
610
+ kind: "Shacl",
611
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#targetClass"),
612
+ type: { kind: "Set", itemType: { kind: "Iri" } },
613
+ },
614
+ targetNodes: {
615
+ kind: "Shacl",
616
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#targetNode"),
617
+ type: {
618
+ kind: "Set",
619
+ itemType: { kind: "Term", types: ["NamedNode", "Literal"] },
620
+ },
621
+ },
622
+ targetObjectsOf: {
623
+ kind: "Shacl",
624
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#targetObjectsOf"),
625
+ type: { kind: "Set", itemType: { kind: "Iri" } },
626
+ },
627
+ targetSubjectsOf: {
628
+ kind: "Shacl",
629
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#targetSubjectsOf"),
630
+ type: { kind: "Set", itemType: { kind: "Iri" } },
631
+ },
632
+ toRdfTypes: {
633
+ kind: "Shacl",
634
+ path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#toRdfType"),
635
+ type: { kind: "Set", itemType: { kind: "Iri" } },
636
+ },
637
+ tsImports: {
638
+ kind: "Shacl",
639
+ path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsImport"),
640
+ type: { kind: "Set", itemType: { kind: "String" } },
641
+ },
642
+ types: {
643
+ kind: "Shacl",
644
+ path: $RdfVocabularies.rdf.type,
645
+ type: { kind: "Set", itemType: { kind: "Iri" } },
646
+ },
647
+ xone: {
648
+ kind: "Shacl",
649
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#xone"),
650
+ type: {
651
+ kind: "Option",
652
+ itemType: {
653
+ kind: "List",
654
+ itemType: { kind: "Identifier" },
655
+ },
656
+ },
657
+ },
658
+ },
659
+ toRdfTypes: [dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape")],
660
+ };
661
+ sh_NodeShape._toRdfResource = (parameters) => {
662
+ if (!parameters.ignoreRdfType) {
663
+ parameters.resource.add($RdfVocabularies.rdf.type, sh_NodeShape.schema.toRdfTypes, parameters.graph);
664
+ }
665
+ parameters.resource.add(sh_NodeShape.schema.properties.and.path, parameters.object.and.toList().flatMap((value) => [
666
+ value.length > 0
667
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
668
+ if (itemIndex === 0) {
669
+ currentSubListResource = listResource;
670
+ }
671
+ else {
672
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
673
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
674
+ currentSubListResource = newSubListResource;
675
+ }
676
+ currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
677
+ if (itemIndex + 1 === list.length) {
678
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
679
+ }
680
+ return { currentSubListResource, listResource };
681
+ }, {
682
+ currentSubListResource: null,
683
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
684
+ }).listResource.identifier
685
+ : $RdfVocabularies.rdf.nil,
686
+ ]), parameters.graph);
687
+ parameters.resource.add(sh_NodeShape.schema.properties.classes.path, parameters.object.classes.flatMap((item) => [item]), parameters.graph);
688
+ parameters.resource.add(sh_NodeShape.schema.properties.closed.path, parameters.object.closed
689
+ .toList()
690
+ .flatMap((value) => [
691
+ $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
692
+ ]), parameters.graph);
693
+ parameters.resource.add(sh_NodeShape.schema.properties.comment.path, parameters.object.comment
694
+ .toList()
695
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
696
+ parameters.resource.add(sh_NodeShape.schema.properties.datatype.path, parameters.object.datatype.toList(), parameters.graph);
697
+ parameters.resource.add(sh_NodeShape.schema.properties.deactivated.path, parameters.object.deactivated
698
+ .toList()
699
+ .flatMap((value) => [
700
+ $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
701
+ ]), parameters.graph);
702
+ parameters.resource.add(sh_NodeShape.schema.properties.discriminantValue.path, parameters.object.discriminantValue
703
+ .toList()
704
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
705
+ parameters.resource.add(sh_NodeShape.schema.properties.extern.path, parameters.object.extern
706
+ .toList()
707
+ .flatMap((value) => [
708
+ $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
709
+ ]), parameters.graph);
710
+ parameters.resource.add(sh_NodeShape.schema.properties.flags.path, parameters.object.flags
711
+ .toList()
712
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
713
+ parameters.resource.add(sh_NodeShape.schema.properties.fromRdfType.path, parameters.object.fromRdfType.toList(), parameters.graph);
714
+ parameters.resource.add(sh_NodeShape.schema.properties.hasValues.path, parameters.object.hasValues.flatMap((item) => [item]), parameters.graph);
715
+ parameters.resource.add(sh_NodeShape.schema.properties.ignore.path, $strictEquals(parameters.object.ignore, false).isLeft()
716
+ ? [
717
+ $literalFactory.boolean(parameters.object.ignore, $RdfVocabularies.xsd.boolean),
718
+ ]
719
+ : [], parameters.graph);
720
+ parameters.resource.add(sh_NodeShape.schema.properties.ignoredProperties.path, parameters.object.ignoredProperties.toList().flatMap((value) => [
721
+ value.length > 0
722
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
723
+ if (itemIndex === 0) {
724
+ currentSubListResource = listResource;
725
+ }
726
+ else {
727
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
728
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
729
+ currentSubListResource = newSubListResource;
730
+ }
731
+ currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
732
+ if (itemIndex + 1 === list.length) {
733
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
734
+ }
735
+ return { currentSubListResource, listResource };
736
+ }, {
737
+ currentSubListResource: null,
738
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
739
+ }).listResource.identifier
740
+ : $RdfVocabularies.rdf.nil,
741
+ ]), parameters.graph);
742
+ parameters.resource.add(sh_NodeShape.schema.properties.in_.path, parameters.object.in_.toList().flatMap((value) => [
743
+ value.length > 0
744
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
745
+ if (itemIndex === 0) {
746
+ currentSubListResource = listResource;
747
+ }
748
+ else {
749
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
750
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
751
+ currentSubListResource = newSubListResource;
752
+ }
753
+ currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
754
+ if (itemIndex + 1 === list.length) {
755
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
756
+ }
757
+ return { currentSubListResource, listResource };
758
+ }, {
759
+ currentSubListResource: null,
760
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
761
+ }).listResource.identifier
762
+ : $RdfVocabularies.rdf.nil,
763
+ ]), parameters.graph);
764
+ parameters.resource.add(sh_NodeShape.schema.properties.isDefinedBy.path, parameters.object.isDefinedBy.toList(), parameters.graph);
765
+ parameters.resource.add(sh_NodeShape.schema.properties.label.path, parameters.object.label
766
+ .toList()
767
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
768
+ parameters.resource.add(sh_NodeShape.schema.properties.languageIn.path, parameters.object.languageIn.toList().flatMap((value) => [
769
+ value.length > 0
770
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
771
+ if (itemIndex === 0) {
772
+ currentSubListResource = listResource;
773
+ }
774
+ else {
775
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
776
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
777
+ currentSubListResource = newSubListResource;
778
+ }
779
+ currentSubListResource.add($RdfVocabularies.rdf.first, [$literalFactory.string(item)], parameters.graph);
780
+ if (itemIndex + 1 === list.length) {
781
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
782
+ }
783
+ return { currentSubListResource, listResource };
784
+ }, {
785
+ currentSubListResource: null,
786
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
787
+ }).listResource.identifier
788
+ : $RdfVocabularies.rdf.nil,
789
+ ]), parameters.graph);
790
+ parameters.resource.add(sh_NodeShape.schema.properties.maxExclusive.path, parameters.object.maxExclusive.toList(), parameters.graph);
791
+ parameters.resource.add(sh_NodeShape.schema.properties.maxInclusive.path, parameters.object.maxInclusive.toList(), parameters.graph);
792
+ parameters.resource.add(sh_NodeShape.schema.properties.maxLength.path, parameters.object.maxLength
793
+ .toList()
794
+ .flatMap((value) => [
795
+ $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
796
+ ]), parameters.graph);
797
+ parameters.resource.add(sh_NodeShape.schema.properties.message.path, parameters.object.message
798
+ .toList()
799
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
800
+ parameters.resource.add(sh_NodeShape.schema.properties.minExclusive.path, parameters.object.minExclusive.toList(), parameters.graph);
801
+ parameters.resource.add(sh_NodeShape.schema.properties.minInclusive.path, parameters.object.minInclusive.toList(), parameters.graph);
802
+ parameters.resource.add(sh_NodeShape.schema.properties.minLength.path, parameters.object.minLength
803
+ .toList()
804
+ .flatMap((value) => [
805
+ $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
806
+ ]), parameters.graph);
807
+ parameters.resource.add(sh_NodeShape.schema.properties.mutable.path, parameters.object.mutable
808
+ .toList()
809
+ .flatMap((value) => [
810
+ $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
811
+ ]), parameters.graph);
812
+ parameters.resource.add(sh_NodeShape.schema.properties.node.path, parameters.object.node.toList(), parameters.graph);
813
+ parameters.resource.add(sh_NodeShape.schema.properties.nodeKind.path, parameters.object.nodeKind.toList(), parameters.graph);
814
+ parameters.resource.add(sh_NodeShape.schema.properties.not.path, parameters.object.not.flatMap((item) => [item]), parameters.graph);
815
+ parameters.resource.add(sh_NodeShape.schema.properties.or.path, parameters.object.or.toList().flatMap((value) => [
816
+ value.length > 0
817
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
818
+ if (itemIndex === 0) {
819
+ currentSubListResource = listResource;
820
+ }
821
+ else {
822
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
823
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
824
+ currentSubListResource = newSubListResource;
825
+ }
826
+ currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
827
+ if (itemIndex + 1 === list.length) {
828
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
829
+ }
830
+ return { currentSubListResource, listResource };
831
+ }, {
832
+ currentSubListResource: null,
833
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
834
+ }).listResource.identifier
835
+ : $RdfVocabularies.rdf.nil,
836
+ ]), parameters.graph);
837
+ parameters.resource.add(sh_NodeShape.schema.properties.pattern.path, parameters.object.pattern
838
+ .toList()
839
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
840
+ parameters.resource.add(sh_NodeShape.schema.properties.properties.path, parameters.object.properties.flatMap((item) => [item]), parameters.graph);
841
+ parameters.resource.add(sh_NodeShape.schema.properties.rdfType.path, parameters.object.rdfType.toList(), parameters.graph);
842
+ parameters.resource.add(sh_NodeShape.schema.properties.severity.path, parameters.object.severity.toList(), parameters.graph);
843
+ parameters.resource.add(sh_NodeShape.schema.properties.shaclmateName.path, parameters.object.shaclmateName
844
+ .toList()
845
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
846
+ parameters.resource.add(sh_NodeShape.schema.properties.subClassOf.path, parameters.object.subClassOf.flatMap((item) => [item]), parameters.graph);
847
+ parameters.resource.add(sh_NodeShape.schema.properties.targetClasses.path, parameters.object.targetClasses.flatMap((item) => [item]), parameters.graph);
848
+ parameters.resource.add(sh_NodeShape.schema.properties.targetNodes.path, parameters.object.targetNodes.flatMap((item) => [item]), parameters.graph);
849
+ parameters.resource.add(sh_NodeShape.schema.properties.targetObjectsOf.path, parameters.object.targetObjectsOf.flatMap((item) => [item]), parameters.graph);
850
+ parameters.resource.add(sh_NodeShape.schema.properties.targetSubjectsOf.path, parameters.object.targetSubjectsOf.flatMap((item) => [item]), parameters.graph);
851
+ parameters.resource.add(sh_NodeShape.schema.properties.toRdfTypes.path, parameters.object.toRdfTypes.flatMap((item) => [item]), parameters.graph);
852
+ parameters.resource.add(sh_NodeShape.schema.properties.tsImports.path, parameters.object.tsImports.flatMap((item) => [
853
+ $literalFactory.string(item),
854
+ ]), parameters.graph);
855
+ parameters.resource.add(sh_NodeShape.schema.properties.types.path, parameters.object.types.flatMap((item) => [item]), parameters.graph);
856
+ parameters.resource.add(sh_NodeShape.schema.properties.xone.path, parameters.object.xone.toList().flatMap((value) => [
857
+ value.length > 0
858
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
859
+ if (itemIndex === 0) {
860
+ currentSubListResource = listResource;
861
+ }
862
+ else {
863
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
864
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
865
+ currentSubListResource = newSubListResource;
866
+ }
867
+ currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
868
+ if (itemIndex + 1 === list.length) {
869
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
870
+ }
871
+ return { currentSubListResource, listResource };
872
+ }, {
873
+ currentSubListResource: null,
874
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
875
+ }).listResource.identifier
876
+ : $RdfVocabularies.rdf.nil,
877
+ ]), parameters.graph);
878
+ return parameters.resource;
879
+ };
880
+ sh_NodeShape.toRdfResource = $wrap_ToRdfResourceFunction(sh_NodeShape._toRdfResource);
881
+ sh_NodeShape.$toString = (_shNodeShape) => `sh_NodeShape(${JSON.stringify(sh_NodeShape.toStringRecord(_shNodeShape))})`;
882
+ sh_NodeShape.toStringRecord = (_shNodeShape) => $compactRecord({
883
+ $identifier: _shNodeShape.$identifier().toString(),
884
+ label: _shNodeShape.label.map((item) => item.toString()).extract(),
885
+ shaclmateName: _shNodeShape.shaclmateName
886
+ .map((item) => item.toString())
887
+ .extract(),
888
+ });
889
+ })(sh_NodeShape || (sh_NodeShape = {}));
890
+ export var sh_Ontology;
891
+ (function (sh_Ontology) {
892
+ sh_Ontology.create = (parameters) => $sequenceRecord({
893
+ $identifier: $convertToIdentifierProperty(parameters?.$identifier),
894
+ comment: $convertToMaybe($identityConversionFunction)(parameters?.comment).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.comment.type, value)),
895
+ label: $convertToMaybe($identityConversionFunction)(parameters?.label).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.label.type, value)),
896
+ })
897
+ .map((properties) => ({ ...properties, $type: "sh_Ontology" }))
898
+ .map((object) => $monkeyPatchObject(object, { $toString: sh_Ontology.$toString }));
899
+ function createUnsafe(parameters) {
900
+ return sh_Ontology.create(parameters).unsafeCoerce();
901
+ }
902
+ sh_Ontology.createUnsafe = createUnsafe;
903
+ let Identifier;
904
+ (function (Identifier) {
905
+ Identifier.parse = $parseIdentifier;
906
+ Identifier.stringify = NTriplesTerm.stringify;
907
+ })(Identifier = sh_Ontology.Identifier || (sh_Ontology.Identifier = {}));
908
+ function issh_Ontology(object) {
909
+ return object.$type === "sh_Ontology";
910
+ }
911
+ sh_Ontology.issh_Ontology = issh_Ontology;
912
+ sh_Ontology.schema = {
913
+ fromRdfType: dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"),
914
+ properties: {
915
+ $identifier: {
916
+ kind: "Identifier",
917
+ type: { kind: "Identifier" },
918
+ },
919
+ comment: {
920
+ kind: "Shacl",
921
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
922
+ type: {
923
+ kind: "Option",
924
+ itemType: { kind: "String" },
925
+ },
926
+ },
927
+ label: {
928
+ kind: "Shacl",
929
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
930
+ type: {
931
+ kind: "Option",
932
+ itemType: { kind: "String" },
933
+ },
934
+ },
935
+ },
936
+ toRdfTypes: [
937
+ dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"),
938
+ ],
939
+ };
940
+ sh_Ontology._toRdfResource = (parameters) => {
941
+ if (!parameters.ignoreRdfType) {
942
+ parameters.resource.add($RdfVocabularies.rdf.type, sh_Ontology.schema.toRdfTypes, parameters.graph);
943
+ }
944
+ parameters.resource.add(sh_NodeShape.schema.properties.comment.path, parameters.object.comment
945
+ .toList()
946
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
947
+ parameters.resource.add(sh_NodeShape.schema.properties.label.path, parameters.object.label
948
+ .toList()
949
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
950
+ return parameters.resource;
951
+ };
952
+ sh_Ontology.toRdfResource = $wrap_ToRdfResourceFunction(sh_Ontology._toRdfResource);
953
+ sh_Ontology.$toString = (_shOntology) => `sh_Ontology(${JSON.stringify(sh_Ontology.toStringRecord(_shOntology))})`;
954
+ sh_Ontology.toStringRecord = (_shOntology) => $compactRecord({
955
+ $identifier: _shOntology.$identifier().toString(),
956
+ label: _shOntology.label.map((item) => item.toString()).extract(),
957
+ });
958
+ })(sh_Ontology || (sh_Ontology = {}));
959
+ export var sh_PropertyGroup;
960
+ (function (sh_PropertyGroup) {
961
+ sh_PropertyGroup.create = (parameters) => $sequenceRecord({
962
+ $identifier: $convertToIdentifierProperty(parameters?.$identifier),
963
+ comment: $convertToMaybe($identityConversionFunction)(parameters?.comment).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.comment.type, value)),
964
+ label: $convertToMaybe($identityConversionFunction)(parameters?.label).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.label.type, value)),
965
+ })
966
+ .map((properties) => ({
967
+ ...properties,
968
+ $type: "sh_PropertyGroup",
969
+ }))
970
+ .map((object) => $monkeyPatchObject(object, { $toString: sh_PropertyGroup.$toString }));
971
+ function createUnsafe(parameters) {
972
+ return sh_PropertyGroup.create(parameters).unsafeCoerce();
973
+ }
974
+ sh_PropertyGroup.createUnsafe = createUnsafe;
975
+ let Identifier;
976
+ (function (Identifier) {
977
+ Identifier.parse = $parseIdentifier;
978
+ Identifier.stringify = NTriplesTerm.stringify;
979
+ })(Identifier = sh_PropertyGroup.Identifier || (sh_PropertyGroup.Identifier = {}));
980
+ function issh_PropertyGroup(object) {
981
+ return object.$type === "sh_PropertyGroup";
982
+ }
983
+ sh_PropertyGroup.issh_PropertyGroup = issh_PropertyGroup;
984
+ sh_PropertyGroup.schema = {
985
+ fromRdfType: dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup"),
986
+ properties: {
987
+ $identifier: {
988
+ kind: "Identifier",
989
+ type: { kind: "Identifier" },
990
+ },
991
+ comment: {
992
+ kind: "Shacl",
993
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
994
+ type: {
995
+ kind: "Option",
996
+ itemType: { kind: "String" },
997
+ },
998
+ },
999
+ label: {
1000
+ kind: "Shacl",
1001
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
1002
+ type: {
1003
+ kind: "Option",
1004
+ itemType: { kind: "String" },
1005
+ },
1006
+ },
1007
+ },
1008
+ toRdfTypes: [
1009
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup"),
1010
+ ],
1011
+ };
1012
+ sh_PropertyGroup._toRdfResource = (parameters) => {
1013
+ if (!parameters.ignoreRdfType) {
1014
+ parameters.resource.add($RdfVocabularies.rdf.type, sh_PropertyGroup.schema.toRdfTypes, parameters.graph);
1015
+ }
1016
+ parameters.resource.add(sh_NodeShape.schema.properties.comment.path, parameters.object.comment
1017
+ .toList()
1018
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
1019
+ parameters.resource.add(sh_NodeShape.schema.properties.label.path, parameters.object.label
1020
+ .toList()
1021
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
1022
+ return parameters.resource;
1023
+ };
1024
+ sh_PropertyGroup.toRdfResource = $wrap_ToRdfResourceFunction(sh_PropertyGroup._toRdfResource);
1025
+ sh_PropertyGroup.$toString = (_shPropertyGroup) => `sh_PropertyGroup(${JSON.stringify(sh_PropertyGroup.toStringRecord(_shPropertyGroup))})`;
1026
+ sh_PropertyGroup.toStringRecord = (_shPropertyGroup) => $compactRecord({
1027
+ $identifier: _shPropertyGroup.$identifier().toString(),
1028
+ label: _shPropertyGroup.label.map((item) => item.toString()).extract(),
1029
+ });
1030
+ })(sh_PropertyGroup || (sh_PropertyGroup = {}));
1031
+ export var sh_PropertyShape;
1032
+ (function (sh_PropertyShape) {
1033
+ sh_PropertyShape.create = (parameters) => $sequenceRecord({
1034
+ $identifier: $convertToIdentifierProperty(parameters.$identifier),
1035
+ and: $convertToMaybe($convertToList($convertToIdentifier, true))(parameters.and).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(sh_NodeShape.schema.properties.and.type, value)),
1036
+ classes: $convertToScalarSet(($convertToIri), true)(parameters.classes).chain((value) => $validateArray($identityValidationFunction, true)(sh_NodeShape.schema.properties.classes.type, value)),
1037
+ comment: $convertToMaybe($identityConversionFunction)(parameters.comment).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.comment.type, value)),
1038
+ datatype: $convertToMaybe(($convertToIri))(parameters.datatype).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.datatype.type, value)),
1039
+ deactivated: $convertToMaybe($identityConversionFunction)(parameters.deactivated).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.deactivated.type, value)),
1040
+ defaultValue: $convertToMaybe($identityConversionFunction)(parameters.defaultValue).chain((value) => $validateMaybe($identityValidationFunction)(sh_PropertyShape.schema.properties.defaultValue.type, value)),
1041
+ description: $convertToMaybe($identityConversionFunction)(parameters.description).chain((value) => $validateMaybe($identityValidationFunction)(sh_PropertyShape.schema.properties.description.type, value)),
1042
+ disjoint: $convertToScalarSet(($convertToIri), true)(parameters.disjoint).chain((value) => $validateArray($identityValidationFunction, true)(sh_PropertyShape.schema.properties.disjoint.type, value)),
1043
+ display: $convertWithDefaultValue($identityConversionFunction, false)(parameters.display),
1044
+ equals: $convertToScalarSet(($convertToIri), true)(parameters.equals).chain((value) => $validateArray($identityValidationFunction, true)(sh_PropertyShape.schema.properties.equals.type, value)),
1045
+ flags: $convertToMaybe($identityConversionFunction)(parameters.flags).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.flags.type, value)),
1046
+ groups: $convertToScalarSet($convertToIdentifier, true)(parameters.groups).chain((value) => $validateArray($identityValidationFunction, true)(sh_PropertyShape.schema.properties.groups.type, value)),
1047
+ hasValues: $convertToScalarSet($identityConversionFunction, true)(parameters.hasValues).chain((value) => $validateArray($identityValidationFunction, true)(sh_NodeShape.schema.properties.hasValues.type, value)),
1048
+ ignore: $convertWithDefaultValue($identityConversionFunction, false)(parameters.ignore),
1049
+ in_: $convertToMaybe($convertToList($identityConversionFunction, true))(parameters.in_).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(sh_NodeShape.schema.properties.in_.type, value)),
1050
+ isDefinedBy: $convertToMaybe($convertToIdentifier)(parameters.isDefinedBy).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.isDefinedBy.type, value)),
1051
+ label: $convertToMaybe($identityConversionFunction)(parameters.label).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.label.type, value)),
1052
+ languageIn: $convertToMaybe($convertToList($identityConversionFunction, true))(parameters.languageIn).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(sh_NodeShape.schema.properties.languageIn.type, value)),
1053
+ lessThan: $convertToScalarSet(($convertToIri), true)(parameters.lessThan).chain((value) => $validateArray($identityValidationFunction, true)(sh_PropertyShape.schema.properties.lessThan.type, value)),
1054
+ lessThanOrEquals: $convertToScalarSet(($convertToIri), true)(parameters.lessThanOrEquals).chain((value) => $validateArray($identityValidationFunction, true)(sh_PropertyShape.schema.properties.lessThanOrEquals.type, value)),
1055
+ maxCount: $convertToMaybe($identityConversionFunction)(parameters.maxCount).chain((value) => $validateMaybe($identityValidationFunction)(sh_PropertyShape.schema.properties.maxCount.type, value)),
1056
+ maxExclusive: $convertToMaybe($convertToLiteral)(parameters.maxExclusive).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.maxExclusive.type, value)),
1057
+ maxInclusive: $convertToMaybe($convertToLiteral)(parameters.maxInclusive).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.maxInclusive.type, value)),
1058
+ maxLength: $convertToMaybe($identityConversionFunction)(parameters.maxLength).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.maxLength.type, value)),
1059
+ message: $convertToMaybe($identityConversionFunction)(parameters.message).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.message.type, value)),
1060
+ minCount: $convertToMaybe($identityConversionFunction)(parameters.minCount).chain((value) => $validateMaybe($identityValidationFunction)(sh_PropertyShape.schema.properties.minCount.type, value)),
1061
+ minExclusive: $convertToMaybe($convertToLiteral)(parameters.minExclusive).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.minExclusive.type, value)),
1062
+ minInclusive: $convertToMaybe($convertToLiteral)(parameters.minInclusive).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.minInclusive.type, value)),
1063
+ minLength: $convertToMaybe($identityConversionFunction)(parameters.minLength).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.minLength.type, value)),
1064
+ mutable: $convertToMaybe($identityConversionFunction)(parameters.mutable).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.mutable.type, value)),
1065
+ name: $convertToMaybe($identityConversionFunction)(parameters.name).chain((value) => $validateMaybe($identityValidationFunction)(sh_PropertyShape.schema.properties.name.type, value)),
1066
+ node: $convertToMaybe($convertToIdentifier)(parameters.node).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.node.type, value)),
1067
+ nodeKind: $convertToMaybe(($convertToIri))(parameters.nodeKind).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.nodeKind.type, value)),
1068
+ not: $convertToScalarSet($convertToIdentifier, true)(parameters.not).chain((value) => $validateArray($identityValidationFunction, true)(sh_NodeShape.schema.properties.not.type, value)),
1069
+ or: $convertToMaybe($convertToList($convertToIdentifier, true))(parameters.or).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(sh_NodeShape.schema.properties.or.type, value)),
1070
+ order: $convertToMaybe($identityConversionFunction)(parameters.order).chain((value) => $validateMaybe($identityValidationFunction)(sh_PropertyShape.schema.properties.order.type, value)),
1071
+ path: Either.of(parameters.path),
1072
+ pattern: $convertToMaybe($identityConversionFunction)(parameters.pattern).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.pattern.type, value)),
1073
+ qualifiedMaxCount: $convertToMaybe($identityConversionFunction)(parameters.qualifiedMaxCount).chain((value) => $validateMaybe($identityValidationFunction)(sh_PropertyShape.schema.properties.qualifiedMaxCount.type, value)),
1074
+ qualifiedMinCount: $convertToMaybe($identityConversionFunction)(parameters.qualifiedMinCount).chain((value) => $validateMaybe($identityValidationFunction)(sh_PropertyShape.schema.properties.qualifiedMinCount.type, value)),
1075
+ qualifiedValueShape: $convertToMaybe($convertToIdentifier)(parameters.qualifiedValueShape).chain((value) => $validateMaybe($identityValidationFunction)(sh_PropertyShape.schema.properties.qualifiedValueShape.type, value)),
1076
+ qualifiedValueShapesDisjoint: $convertToMaybe($identityConversionFunction)(parameters.qualifiedValueShapesDisjoint).chain((value) => $validateMaybe($identityValidationFunction)(sh_PropertyShape.schema.properties.qualifiedValueShapesDisjoint.type, value)),
1077
+ resolve: $convertToMaybe($convertToIdentifier)(parameters.resolve).chain((value) => $validateMaybe($identityValidationFunction)(sh_PropertyShape.schema.properties.resolve.type, value)),
1078
+ severity: $convertToMaybe(($convertToIri))(parameters.severity).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.severity.type, value)),
1079
+ shaclmateName: $convertToMaybe($identityConversionFunction)(parameters.shaclmateName).chain((value) => $validateMaybe($identityValidationFunction)(sh_NodeShape.schema.properties.shaclmateName.type, value)),
1080
+ targetClasses: $convertToScalarSet(($convertToIri), true)(parameters.targetClasses).chain((value) => $validateArray($identityValidationFunction, true)(sh_NodeShape.schema.properties.targetClasses.type, value)),
1081
+ targetNodes: $convertToScalarSet($identityConversionFunction, true)(parameters.targetNodes).chain((value) => $validateArray($identityValidationFunction, true)(sh_NodeShape.schema.properties.targetNodes.type, value)),
1082
+ targetObjectsOf: $convertToScalarSet(($convertToIri), true)(parameters.targetObjectsOf).chain((value) => $validateArray($identityValidationFunction, true)(sh_NodeShape.schema.properties.targetObjectsOf.type, value)),
1083
+ targetSubjectsOf: $convertToScalarSet(($convertToIri), true)(parameters.targetSubjectsOf).chain((value) => $validateArray($identityValidationFunction, true)(sh_NodeShape.schema.properties.targetSubjectsOf.type, value)),
1084
+ uniqueLang: $convertToMaybe($identityConversionFunction)(parameters.uniqueLang).chain((value) => $validateMaybe($identityValidationFunction)(sh_PropertyShape.schema.properties.uniqueLang.type, value)),
1085
+ xone: $convertToMaybe($convertToList($convertToIdentifier, true))(parameters.xone).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(sh_NodeShape.schema.properties.xone.type, value)),
1086
+ })
1087
+ .map((properties) => ({
1088
+ ...properties,
1089
+ $type: "sh_PropertyShape",
1090
+ }))
1091
+ .map((object) => $monkeyPatchObject(object, { $toString: sh_PropertyShape.$toString }));
1092
+ function createUnsafe(parameters) {
1093
+ return sh_PropertyShape.create(parameters).unsafeCoerce();
1094
+ }
1095
+ sh_PropertyShape.createUnsafe = createUnsafe;
1096
+ let Identifier;
1097
+ (function (Identifier) {
1098
+ Identifier.parse = $parseIdentifier;
1099
+ Identifier.stringify = NTriplesTerm.stringify;
1100
+ })(Identifier = sh_PropertyShape.Identifier || (sh_PropertyShape.Identifier = {}));
1101
+ function issh_PropertyShape(object) {
1102
+ return object.$type === "sh_PropertyShape";
1103
+ }
1104
+ sh_PropertyShape.issh_PropertyShape = issh_PropertyShape;
1105
+ sh_PropertyShape.schema = {
1106
+ fromRdfType: dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"),
1107
+ properties: {
1108
+ $identifier: {
1109
+ kind: "Identifier",
1110
+ type: { kind: "Identifier" },
1111
+ },
1112
+ and: {
1113
+ kind: "Shacl",
1114
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#and"),
1115
+ type: {
1116
+ kind: "Option",
1117
+ itemType: {
1118
+ kind: "List",
1119
+ itemType: { kind: "Identifier" },
1120
+ },
1121
+ },
1122
+ },
1123
+ classes: {
1124
+ kind: "Shacl",
1125
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#class"),
1126
+ type: { kind: "Set", itemType: { kind: "Iri" } },
1127
+ },
1128
+ comment: {
1129
+ kind: "Shacl",
1130
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
1131
+ type: {
1132
+ kind: "Option",
1133
+ itemType: { kind: "String" },
1134
+ },
1135
+ },
1136
+ datatype: {
1137
+ kind: "Shacl",
1138
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#datatype"),
1139
+ type: { kind: "Option", itemType: { kind: "Iri" } },
1140
+ },
1141
+ deactivated: {
1142
+ kind: "Shacl",
1143
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"),
1144
+ type: {
1145
+ kind: "Option",
1146
+ itemType: { kind: "Boolean" },
1147
+ },
1148
+ },
1149
+ defaultValue: {
1150
+ kind: "Shacl",
1151
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#defaultValue"),
1152
+ type: {
1153
+ kind: "Option",
1154
+ itemType: { kind: "Term", types: ["NamedNode", "Literal"] },
1155
+ },
1156
+ },
1157
+ description: {
1158
+ kind: "Shacl",
1159
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#description"),
1160
+ type: {
1161
+ kind: "Option",
1162
+ itemType: { kind: "String" },
1163
+ },
1164
+ },
1165
+ disjoint: {
1166
+ kind: "Shacl",
1167
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#disjoint"),
1168
+ type: { kind: "Set", itemType: { kind: "Iri" } },
1169
+ },
1170
+ display: {
1171
+ kind: "Shacl",
1172
+ path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#display"),
1173
+ type: {
1174
+ kind: "DefaultValue",
1175
+ itemType: { kind: "Boolean" },
1176
+ defaultValue: dataFactory.literal("false", $RdfVocabularies.xsd.boolean),
1177
+ },
1178
+ },
1179
+ equals: {
1180
+ kind: "Shacl",
1181
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#equals"),
1182
+ type: { kind: "Set", itemType: { kind: "Iri" } },
1183
+ },
1184
+ flags: {
1185
+ kind: "Shacl",
1186
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#flags"),
1187
+ type: {
1188
+ kind: "Option",
1189
+ itemType: { kind: "String" },
1190
+ },
1191
+ },
1192
+ groups: {
1193
+ kind: "Shacl",
1194
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#group"),
1195
+ type: {
1196
+ kind: "Set",
1197
+ itemType: { kind: "Identifier" },
1198
+ },
1199
+ },
1200
+ hasValues: {
1201
+ kind: "Shacl",
1202
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#hasValue"),
1203
+ type: {
1204
+ kind: "Set",
1205
+ itemType: { kind: "Term", types: ["NamedNode", "Literal"] },
1206
+ },
1207
+ },
1208
+ ignore: {
1209
+ kind: "Shacl",
1210
+ path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#ignore"),
1211
+ type: {
1212
+ kind: "DefaultValue",
1213
+ itemType: { kind: "Boolean" },
1214
+ defaultValue: dataFactory.literal("false", $RdfVocabularies.xsd.boolean),
1215
+ },
1216
+ },
1217
+ in_: {
1218
+ kind: "Shacl",
1219
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#in"),
1220
+ type: {
1221
+ kind: "Option",
1222
+ itemType: {
1223
+ kind: "List",
1224
+ itemType: {
1225
+ kind: "Term",
1226
+ types: ["NamedNode", "Literal"],
1227
+ },
1228
+ },
1229
+ },
1230
+ },
1231
+ isDefinedBy: {
1232
+ kind: "Shacl",
1233
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"),
1234
+ type: {
1235
+ kind: "Option",
1236
+ itemType: { kind: "Identifier" },
1237
+ },
1238
+ },
1239
+ label: {
1240
+ kind: "Shacl",
1241
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
1242
+ type: {
1243
+ kind: "Option",
1244
+ itemType: { kind: "String" },
1245
+ },
1246
+ },
1247
+ languageIn: {
1248
+ kind: "Shacl",
1249
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#languageIn"),
1250
+ type: {
1251
+ kind: "Option",
1252
+ itemType: {
1253
+ kind: "List",
1254
+ itemType: { kind: "String" },
1255
+ },
1256
+ },
1257
+ },
1258
+ lessThan: {
1259
+ kind: "Shacl",
1260
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#lessThan"),
1261
+ type: { kind: "Set", itemType: { kind: "Iri" } },
1262
+ },
1263
+ lessThanOrEquals: {
1264
+ kind: "Shacl",
1265
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#lessThanOrEquals"),
1266
+ type: { kind: "Set", itemType: { kind: "Iri" } },
1267
+ },
1268
+ maxCount: {
1269
+ kind: "Shacl",
1270
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxCount"),
1271
+ type: {
1272
+ kind: "Option",
1273
+ itemType: { kind: "BigInt" },
1274
+ },
1275
+ },
1276
+ maxExclusive: {
1277
+ kind: "Shacl",
1278
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxExclusive"),
1279
+ type: {
1280
+ kind: "Option",
1281
+ itemType: { kind: "Literal" },
1282
+ },
1283
+ },
1284
+ maxInclusive: {
1285
+ kind: "Shacl",
1286
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxInclusive"),
1287
+ type: {
1288
+ kind: "Option",
1289
+ itemType: { kind: "Literal" },
1290
+ },
1291
+ },
1292
+ maxLength: {
1293
+ kind: "Shacl",
1294
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxLength"),
1295
+ type: {
1296
+ kind: "Option",
1297
+ itemType: { kind: "BigInt" },
1298
+ },
1299
+ },
1300
+ message: {
1301
+ kind: "Shacl",
1302
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#message"),
1303
+ type: {
1304
+ kind: "Option",
1305
+ itemType: { kind: "String" },
1306
+ },
1307
+ },
1308
+ minCount: {
1309
+ kind: "Shacl",
1310
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minCount"),
1311
+ type: {
1312
+ kind: "Option",
1313
+ itemType: { kind: "BigInt" },
1314
+ },
1315
+ },
1316
+ minExclusive: {
1317
+ kind: "Shacl",
1318
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minExclusive"),
1319
+ type: {
1320
+ kind: "Option",
1321
+ itemType: { kind: "Literal" },
1322
+ },
1323
+ },
1324
+ minInclusive: {
1325
+ kind: "Shacl",
1326
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minInclusive"),
1327
+ type: {
1328
+ kind: "Option",
1329
+ itemType: { kind: "Literal" },
1330
+ },
1331
+ },
1332
+ minLength: {
1333
+ kind: "Shacl",
1334
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minLength"),
1335
+ type: {
1336
+ kind: "Option",
1337
+ itemType: { kind: "BigInt" },
1338
+ },
1339
+ },
1340
+ mutable: {
1341
+ kind: "Shacl",
1342
+ path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#mutable"),
1343
+ type: {
1344
+ kind: "Option",
1345
+ itemType: { kind: "Boolean" },
1346
+ },
1347
+ },
1348
+ name: {
1349
+ kind: "Shacl",
1350
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#name"),
1351
+ type: {
1352
+ kind: "Option",
1353
+ itemType: { kind: "String" },
1354
+ },
1355
+ },
1356
+ node: {
1357
+ kind: "Shacl",
1358
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#node"),
1359
+ type: {
1360
+ kind: "Option",
1361
+ itemType: { kind: "Identifier" },
1362
+ },
1363
+ },
1364
+ nodeKind: {
1365
+ kind: "Shacl",
1366
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"),
1367
+ type: {
1368
+ kind: "Option",
1369
+ itemType: {
1370
+ kind: "Iri",
1371
+ in: [
1372
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNode"),
1373
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrIRI"),
1374
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrLiteral"),
1375
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#IRI"),
1376
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#IRIOrLiteral"),
1377
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Literal"),
1378
+ ],
1379
+ },
1380
+ },
1381
+ },
1382
+ not: {
1383
+ kind: "Shacl",
1384
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#not"),
1385
+ type: {
1386
+ kind: "Set",
1387
+ itemType: { kind: "Identifier" },
1388
+ },
1389
+ },
1390
+ or: {
1391
+ kind: "Shacl",
1392
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#or"),
1393
+ type: {
1394
+ kind: "Option",
1395
+ itemType: {
1396
+ kind: "List",
1397
+ itemType: { kind: "Identifier" },
1398
+ },
1399
+ },
1400
+ },
1401
+ order: {
1402
+ kind: "Shacl",
1403
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#order"),
1404
+ type: { kind: "Option", itemType: { kind: "Float" } },
1405
+ },
1406
+ path: {
1407
+ kind: "Shacl",
1408
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#path"),
1409
+ get type() {
1410
+ return $PropertyPath.schema;
1411
+ },
1412
+ },
1413
+ pattern: {
1414
+ kind: "Shacl",
1415
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#pattern"),
1416
+ type: {
1417
+ kind: "Option",
1418
+ itemType: { kind: "String" },
1419
+ },
1420
+ },
1421
+ qualifiedMaxCount: {
1422
+ kind: "Shacl",
1423
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#qualifiedMaxCount"),
1424
+ type: {
1425
+ kind: "Option",
1426
+ itemType: { kind: "BigInt" },
1427
+ },
1428
+ },
1429
+ qualifiedMinCount: {
1430
+ kind: "Shacl",
1431
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#qualifiedMinCount"),
1432
+ type: {
1433
+ kind: "Option",
1434
+ itemType: { kind: "BigInt" },
1435
+ },
1436
+ },
1437
+ qualifiedValueShape: {
1438
+ kind: "Shacl",
1439
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#qualifiedValueShape"),
1440
+ type: {
1441
+ kind: "Option",
1442
+ itemType: { kind: "Identifier" },
1443
+ },
1444
+ },
1445
+ qualifiedValueShapesDisjoint: {
1446
+ kind: "Shacl",
1447
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#qualifiedValueShapesDisjoint"),
1448
+ type: {
1449
+ kind: "Option",
1450
+ itemType: { kind: "Boolean" },
1451
+ },
1452
+ },
1453
+ resolve: {
1454
+ kind: "Shacl",
1455
+ path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#resolve"),
1456
+ type: {
1457
+ kind: "Option",
1458
+ itemType: { kind: "Identifier" },
1459
+ },
1460
+ },
1461
+ severity: {
1462
+ kind: "Shacl",
1463
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#severity"),
1464
+ get type() {
1465
+ return {
1466
+ kind: "Option",
1467
+ get itemType() {
1468
+ return {
1469
+ kind: "Iri",
1470
+ in: [
1471
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Info"),
1472
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Warning"),
1473
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Violation"),
1474
+ ],
1475
+ };
1476
+ },
1477
+ };
1478
+ },
1479
+ },
1480
+ shaclmateName: {
1481
+ kind: "Shacl",
1482
+ path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#name"),
1483
+ type: {
1484
+ kind: "Option",
1485
+ itemType: { kind: "String" },
1486
+ },
1487
+ },
1488
+ targetClasses: {
1489
+ kind: "Shacl",
1490
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#targetClass"),
1491
+ type: { kind: "Set", itemType: { kind: "Iri" } },
1492
+ },
1493
+ targetNodes: {
1494
+ kind: "Shacl",
1495
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#targetNode"),
1496
+ type: {
1497
+ kind: "Set",
1498
+ itemType: { kind: "Term", types: ["NamedNode", "Literal"] },
1499
+ },
1500
+ },
1501
+ targetObjectsOf: {
1502
+ kind: "Shacl",
1503
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#targetObjectsOf"),
1504
+ type: { kind: "Set", itemType: { kind: "Iri" } },
1505
+ },
1506
+ targetSubjectsOf: {
1507
+ kind: "Shacl",
1508
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#targetSubjectsOf"),
1509
+ type: { kind: "Set", itemType: { kind: "Iri" } },
1510
+ },
1511
+ uniqueLang: {
1512
+ kind: "Shacl",
1513
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#uniqueLang"),
1514
+ type: {
1515
+ kind: "Option",
1516
+ itemType: { kind: "Boolean" },
1517
+ },
1518
+ },
1519
+ xone: {
1520
+ kind: "Shacl",
1521
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#xone"),
1522
+ type: {
1523
+ kind: "Option",
1524
+ itemType: {
1525
+ kind: "List",
1526
+ itemType: { kind: "Identifier" },
1527
+ },
1528
+ },
1529
+ },
1530
+ },
1531
+ toRdfTypes: [
1532
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"),
1533
+ ],
1534
+ };
1535
+ sh_PropertyShape._toRdfResource = (parameters) => {
1536
+ if (!parameters.ignoreRdfType) {
1537
+ parameters.resource.add($RdfVocabularies.rdf.type, sh_PropertyShape.schema.toRdfTypes, parameters.graph);
1538
+ }
1539
+ parameters.resource.add(sh_NodeShape.schema.properties.and.path, parameters.object.and.toList().flatMap((value) => [
1540
+ value.length > 0
1541
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
1542
+ if (itemIndex === 0) {
1543
+ currentSubListResource = listResource;
1544
+ }
1545
+ else {
1546
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
1547
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
1548
+ currentSubListResource = newSubListResource;
1549
+ }
1550
+ currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
1551
+ if (itemIndex + 1 === list.length) {
1552
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
1553
+ }
1554
+ return { currentSubListResource, listResource };
1555
+ }, {
1556
+ currentSubListResource: null,
1557
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
1558
+ }).listResource.identifier
1559
+ : $RdfVocabularies.rdf.nil,
1560
+ ]), parameters.graph);
1561
+ parameters.resource.add(sh_NodeShape.schema.properties.classes.path, parameters.object.classes.flatMap((item) => [item]), parameters.graph);
1562
+ parameters.resource.add(sh_NodeShape.schema.properties.comment.path, parameters.object.comment
1563
+ .toList()
1564
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
1565
+ parameters.resource.add(sh_NodeShape.schema.properties.datatype.path, parameters.object.datatype.toList(), parameters.graph);
1566
+ parameters.resource.add(sh_NodeShape.schema.properties.deactivated.path, parameters.object.deactivated
1567
+ .toList()
1568
+ .flatMap((value) => [
1569
+ $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
1570
+ ]), parameters.graph);
1571
+ parameters.resource.add(sh_PropertyShape.schema.properties.defaultValue.path, parameters.object.defaultValue.toList(), parameters.graph);
1572
+ parameters.resource.add(sh_PropertyShape.schema.properties.description.path, parameters.object.description
1573
+ .toList()
1574
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
1575
+ parameters.resource.add(sh_PropertyShape.schema.properties.disjoint.path, parameters.object.disjoint.flatMap((item) => [item]), parameters.graph);
1576
+ parameters.resource.add(sh_PropertyShape.schema.properties.display.path, $strictEquals(parameters.object.display, false).isLeft()
1577
+ ? [
1578
+ $literalFactory.boolean(parameters.object.display, $RdfVocabularies.xsd.boolean),
1579
+ ]
1580
+ : [], parameters.graph);
1581
+ parameters.resource.add(sh_PropertyShape.schema.properties.equals.path, parameters.object.equals.flatMap((item) => [item]), parameters.graph);
1582
+ parameters.resource.add(sh_NodeShape.schema.properties.flags.path, parameters.object.flags
1583
+ .toList()
1584
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
1585
+ parameters.resource.add(sh_PropertyShape.schema.properties.groups.path, parameters.object.groups.flatMap((item) => [item]), parameters.graph);
1586
+ parameters.resource.add(sh_NodeShape.schema.properties.hasValues.path, parameters.object.hasValues.flatMap((item) => [item]), parameters.graph);
1587
+ parameters.resource.add(sh_NodeShape.schema.properties.ignore.path, $strictEquals(parameters.object.ignore, false).isLeft()
1588
+ ? [
1589
+ $literalFactory.boolean(parameters.object.ignore, $RdfVocabularies.xsd.boolean),
1590
+ ]
1591
+ : [], parameters.graph);
1592
+ parameters.resource.add(sh_NodeShape.schema.properties.in_.path, parameters.object.in_.toList().flatMap((value) => [
1593
+ value.length > 0
1594
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
1595
+ if (itemIndex === 0) {
1596
+ currentSubListResource = listResource;
1597
+ }
1598
+ else {
1599
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
1600
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
1601
+ currentSubListResource = newSubListResource;
1602
+ }
1603
+ currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
1604
+ if (itemIndex + 1 === list.length) {
1605
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
1606
+ }
1607
+ return { currentSubListResource, listResource };
1608
+ }, {
1609
+ currentSubListResource: null,
1610
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
1611
+ }).listResource.identifier
1612
+ : $RdfVocabularies.rdf.nil,
1613
+ ]), parameters.graph);
1614
+ parameters.resource.add(sh_NodeShape.schema.properties.isDefinedBy.path, parameters.object.isDefinedBy.toList(), parameters.graph);
1615
+ parameters.resource.add(sh_NodeShape.schema.properties.label.path, parameters.object.label
1616
+ .toList()
1617
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
1618
+ parameters.resource.add(sh_NodeShape.schema.properties.languageIn.path, parameters.object.languageIn.toList().flatMap((value) => [
1619
+ value.length > 0
1620
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
1621
+ if (itemIndex === 0) {
1622
+ currentSubListResource = listResource;
1623
+ }
1624
+ else {
1625
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
1626
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
1627
+ currentSubListResource = newSubListResource;
1628
+ }
1629
+ currentSubListResource.add($RdfVocabularies.rdf.first, [$literalFactory.string(item)], parameters.graph);
1630
+ if (itemIndex + 1 === list.length) {
1631
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
1632
+ }
1633
+ return { currentSubListResource, listResource };
1634
+ }, {
1635
+ currentSubListResource: null,
1636
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
1637
+ }).listResource.identifier
1638
+ : $RdfVocabularies.rdf.nil,
1639
+ ]), parameters.graph);
1640
+ parameters.resource.add(sh_PropertyShape.schema.properties.lessThan.path, parameters.object.lessThan.flatMap((item) => [item]), parameters.graph);
1641
+ parameters.resource.add(sh_PropertyShape.schema.properties.lessThanOrEquals.path, parameters.object.lessThanOrEquals.flatMap((item) => [item]), parameters.graph);
1642
+ parameters.resource.add(sh_PropertyShape.schema.properties.maxCount.path, parameters.object.maxCount
1643
+ .toList()
1644
+ .flatMap((value) => [
1645
+ $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
1646
+ ]), parameters.graph);
1647
+ parameters.resource.add(sh_NodeShape.schema.properties.maxExclusive.path, parameters.object.maxExclusive.toList(), parameters.graph);
1648
+ parameters.resource.add(sh_NodeShape.schema.properties.maxInclusive.path, parameters.object.maxInclusive.toList(), parameters.graph);
1649
+ parameters.resource.add(sh_NodeShape.schema.properties.maxLength.path, parameters.object.maxLength
1650
+ .toList()
1651
+ .flatMap((value) => [
1652
+ $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
1653
+ ]), parameters.graph);
1654
+ parameters.resource.add(sh_NodeShape.schema.properties.message.path, parameters.object.message
1655
+ .toList()
1656
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
1657
+ parameters.resource.add(sh_PropertyShape.schema.properties.minCount.path, parameters.object.minCount
1658
+ .toList()
1659
+ .flatMap((value) => [
1660
+ $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
1661
+ ]), parameters.graph);
1662
+ parameters.resource.add(sh_NodeShape.schema.properties.minExclusive.path, parameters.object.minExclusive.toList(), parameters.graph);
1663
+ parameters.resource.add(sh_NodeShape.schema.properties.minInclusive.path, parameters.object.minInclusive.toList(), parameters.graph);
1664
+ parameters.resource.add(sh_NodeShape.schema.properties.minLength.path, parameters.object.minLength
1665
+ .toList()
1666
+ .flatMap((value) => [
1667
+ $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
1668
+ ]), parameters.graph);
1669
+ parameters.resource.add(sh_NodeShape.schema.properties.mutable.path, parameters.object.mutable
1670
+ .toList()
1671
+ .flatMap((value) => [
1672
+ $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
1673
+ ]), parameters.graph);
1674
+ parameters.resource.add(sh_PropertyShape.schema.properties.name.path, parameters.object.name
1675
+ .toList()
1676
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
1677
+ parameters.resource.add(sh_NodeShape.schema.properties.node.path, parameters.object.node.toList(), parameters.graph);
1678
+ parameters.resource.add(sh_NodeShape.schema.properties.nodeKind.path, parameters.object.nodeKind.toList(), parameters.graph);
1679
+ parameters.resource.add(sh_NodeShape.schema.properties.not.path, parameters.object.not.flatMap((item) => [item]), parameters.graph);
1680
+ parameters.resource.add(sh_NodeShape.schema.properties.or.path, parameters.object.or.toList().flatMap((value) => [
1681
+ value.length > 0
1682
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
1683
+ if (itemIndex === 0) {
1684
+ currentSubListResource = listResource;
1685
+ }
1686
+ else {
1687
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
1688
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
1689
+ currentSubListResource = newSubListResource;
1690
+ }
1691
+ currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
1692
+ if (itemIndex + 1 === list.length) {
1693
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
1694
+ }
1695
+ return { currentSubListResource, listResource };
1696
+ }, {
1697
+ currentSubListResource: null,
1698
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
1699
+ }).listResource.identifier
1700
+ : $RdfVocabularies.rdf.nil,
1701
+ ]), parameters.graph);
1702
+ parameters.resource.add(sh_PropertyShape.schema.properties.order.path, parameters.object.order
1703
+ .toList()
1704
+ .flatMap((value) => [
1705
+ $literalFactory.number(value, $RdfVocabularies.xsd.double),
1706
+ ]), parameters.graph);
1707
+ parameters.resource.add(sh_PropertyShape.schema.properties.path.path, [
1708
+ $PropertyPath.toRdfResource(parameters.object.path, {
1709
+ graph: parameters.graph,
1710
+ resourceSet: parameters.resourceSet,
1711
+ }).identifier,
1712
+ ], parameters.graph);
1713
+ parameters.resource.add(sh_NodeShape.schema.properties.pattern.path, parameters.object.pattern
1714
+ .toList()
1715
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
1716
+ parameters.resource.add(sh_PropertyShape.schema.properties.qualifiedMaxCount.path, parameters.object.qualifiedMaxCount
1717
+ .toList()
1718
+ .flatMap((value) => [
1719
+ $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
1720
+ ]), parameters.graph);
1721
+ parameters.resource.add(sh_PropertyShape.schema.properties.qualifiedMinCount.path, parameters.object.qualifiedMinCount
1722
+ .toList()
1723
+ .flatMap((value) => [
1724
+ $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
1725
+ ]), parameters.graph);
1726
+ parameters.resource.add(sh_PropertyShape.schema.properties.qualifiedValueShape.path, parameters.object.qualifiedValueShape.toList(), parameters.graph);
1727
+ parameters.resource.add(sh_PropertyShape.schema.properties.qualifiedValueShapesDisjoint.path, parameters.object.qualifiedValueShapesDisjoint
1728
+ .toList()
1729
+ .flatMap((value) => [
1730
+ $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
1731
+ ]), parameters.graph);
1732
+ parameters.resource.add(sh_PropertyShape.schema.properties.resolve.path, parameters.object.resolve.toList(), parameters.graph);
1733
+ parameters.resource.add(sh_NodeShape.schema.properties.severity.path, parameters.object.severity.toList(), parameters.graph);
1734
+ parameters.resource.add(sh_NodeShape.schema.properties.shaclmateName.path, parameters.object.shaclmateName
1735
+ .toList()
1736
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
1737
+ parameters.resource.add(sh_NodeShape.schema.properties.targetClasses.path, parameters.object.targetClasses.flatMap((item) => [item]), parameters.graph);
1738
+ parameters.resource.add(sh_NodeShape.schema.properties.targetNodes.path, parameters.object.targetNodes.flatMap((item) => [item]), parameters.graph);
1739
+ parameters.resource.add(sh_NodeShape.schema.properties.targetObjectsOf.path, parameters.object.targetObjectsOf.flatMap((item) => [item]), parameters.graph);
1740
+ parameters.resource.add(sh_NodeShape.schema.properties.targetSubjectsOf.path, parameters.object.targetSubjectsOf.flatMap((item) => [item]), parameters.graph);
1741
+ parameters.resource.add(sh_PropertyShape.schema.properties.uniqueLang.path, parameters.object.uniqueLang
1742
+ .toList()
1743
+ .flatMap((value) => [
1744
+ $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
1745
+ ]), parameters.graph);
1746
+ parameters.resource.add(sh_NodeShape.schema.properties.xone.path, parameters.object.xone.toList().flatMap((value) => [
1747
+ value.length > 0
1748
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
1749
+ if (itemIndex === 0) {
1750
+ currentSubListResource = listResource;
1751
+ }
1752
+ else {
1753
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
1754
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
1755
+ currentSubListResource = newSubListResource;
1756
+ }
1757
+ currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
1758
+ if (itemIndex + 1 === list.length) {
1759
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
1760
+ }
1761
+ return { currentSubListResource, listResource };
1762
+ }, {
1763
+ currentSubListResource: null,
1764
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
1765
+ }).listResource.identifier
1766
+ : $RdfVocabularies.rdf.nil,
1767
+ ]), parameters.graph);
1768
+ return parameters.resource;
1769
+ };
1770
+ sh_PropertyShape.toRdfResource = $wrap_ToRdfResourceFunction(sh_PropertyShape._toRdfResource);
1771
+ sh_PropertyShape.$toString = (_shPropertyShape) => `sh_PropertyShape(${JSON.stringify(sh_PropertyShape.toStringRecord(_shPropertyShape))})`;
1772
+ sh_PropertyShape.toStringRecord = (_shPropertyShape) => $compactRecord({
1773
+ $identifier: _shPropertyShape.$identifier().toString(),
1774
+ label: _shPropertyShape.label.map((item) => item.toString()).extract(),
1775
+ name: _shPropertyShape.name.map((item) => item.toString()).extract(),
1776
+ path: $PropertyPath.$toString(_shPropertyShape.path),
1777
+ shaclmateName: _shPropertyShape.shaclmateName
1778
+ .map((item) => item.toString())
1779
+ .extract(),
1780
+ });
1781
+ })(sh_PropertyShape || (sh_PropertyShape = {}));
1782
+ export var sh_ValidationReport;
1783
+ (function (sh_ValidationReport) {
1784
+ sh_ValidationReport.create = (parameters) => $sequenceRecord({
1785
+ $identifier: $convertToIdentifierProperty(parameters.$identifier),
1786
+ conforms: Either.of(parameters.conforms),
1787
+ results: $convertToScalarSet($identityConversionFunction, true)(parameters.results).chain((value) => $validateArray($identityValidationFunction, true)(sh_ValidationReport.schema.properties.results.type, value)),
1788
+ shapesGraphWellFormed: $convertToMaybe($identityConversionFunction)(parameters.shapesGraphWellFormed).chain((value) => $validateMaybe($identityValidationFunction)(sh_ValidationReport.schema.properties.shapesGraphWellFormed.type, value)),
1789
+ })
1790
+ .map((properties) => ({
1791
+ ...properties,
1792
+ $type: "sh_ValidationReport",
1793
+ }))
1794
+ .map((object) => $monkeyPatchObject(object, {
1795
+ $toString: sh_ValidationReport.$toString,
1796
+ }));
1797
+ function createUnsafe(parameters) {
1798
+ return sh_ValidationReport.create(parameters).unsafeCoerce();
1799
+ }
1800
+ sh_ValidationReport.createUnsafe = createUnsafe;
1801
+ let Identifier;
1802
+ (function (Identifier) {
1803
+ Identifier.parse = $parseIdentifier;
1804
+ Identifier.stringify = NTriplesTerm.stringify;
1805
+ })(Identifier = sh_ValidationReport.Identifier || (sh_ValidationReport.Identifier = {}));
1806
+ function issh_ValidationReport(object) {
1807
+ return object.$type === "sh_ValidationReport";
1808
+ }
1809
+ sh_ValidationReport.issh_ValidationReport = issh_ValidationReport;
1810
+ sh_ValidationReport.schema = {
1811
+ fromRdfType: dataFactory.namedNode("http://www.w3.org/ns/shacl#ValidationReport"),
1812
+ properties: {
1813
+ $identifier: {
1814
+ kind: "Identifier",
1815
+ type: { kind: "Identifier" },
1816
+ },
1817
+ conforms: {
1818
+ kind: "Shacl",
1819
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#conforms"),
1820
+ type: { kind: "Boolean" },
1821
+ },
1822
+ results: {
1823
+ kind: "Shacl",
1824
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#result"),
1825
+ get type() {
1826
+ return {
1827
+ kind: "Set",
1828
+ get itemType() {
1829
+ return sh_ValidationResult.schema;
1830
+ },
1831
+ };
1832
+ },
1833
+ },
1834
+ shapesGraphWellFormed: {
1835
+ kind: "Shacl",
1836
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#shapesGraphWellFormed"),
1837
+ type: {
1838
+ kind: "Option",
1839
+ itemType: { kind: "Boolean" },
1840
+ },
1841
+ },
1842
+ },
1843
+ toRdfTypes: [
1844
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#ValidationReport"),
1845
+ ],
1846
+ };
1847
+ sh_ValidationReport._toRdfResource = (parameters) => {
1848
+ if (!parameters.ignoreRdfType) {
1849
+ parameters.resource.add($RdfVocabularies.rdf.type, sh_ValidationReport.schema.toRdfTypes, parameters.graph);
1850
+ }
1851
+ parameters.resource.add(sh_ValidationReport.schema.properties.conforms.path, [
1852
+ $literalFactory.boolean(parameters.object.conforms, $RdfVocabularies.xsd.boolean),
1853
+ ], parameters.graph);
1854
+ parameters.resource.add(sh_ValidationReport.schema.properties.results.path, parameters.object.results.flatMap((item) => [
1855
+ sh_ValidationResult.toRdfResource(item, {
1856
+ graph: parameters.graph,
1857
+ resourceSet: parameters.resourceSet,
1858
+ }).identifier,
1859
+ ]), parameters.graph);
1860
+ parameters.resource.add(sh_ValidationReport.schema.properties.shapesGraphWellFormed.path, parameters.object.shapesGraphWellFormed
1861
+ .toList()
1862
+ .flatMap((value) => [
1863
+ $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
1864
+ ]), parameters.graph);
1865
+ return parameters.resource;
1866
+ };
1867
+ sh_ValidationReport.toRdfResource = $wrap_ToRdfResourceFunction(sh_ValidationReport._toRdfResource);
1868
+ sh_ValidationReport.$toString = (_shValidationReport) => `sh_ValidationReport(${JSON.stringify(sh_ValidationReport.toStringRecord(_shValidationReport))})`;
1869
+ sh_ValidationReport.toStringRecord = (_shValidationReport) => $compactRecord({
1870
+ $identifier: _shValidationReport.$identifier().toString(),
1871
+ });
1872
+ })(sh_ValidationReport || (sh_ValidationReport = {}));
1873
+ export var sh_ValidationResult;
1874
+ (function (sh_ValidationResult) {
1875
+ sh_ValidationResult.create = (parameters) => $sequenceRecord({
1876
+ $identifier: $convertToIdentifierProperty(parameters.$identifier),
1877
+ details: $convertToScalarSet($identityConversionFunction, true)(parameters.details).chain((value) => $validateArray($identityValidationFunction, true)(sh_ValidationResult.schema.properties.details.type, value)),
1878
+ focusNode: Either.of(parameters.focusNode),
1879
+ message: $convertToMaybe($identityConversionFunction)(parameters.message).chain((value) => $validateMaybe($identityValidationFunction)(sh_ValidationResult.schema.properties.message.type, value)),
1880
+ path: $convertToMaybe($identityConversionFunction)(parameters.path).chain((value) => $validateMaybe($identityValidationFunction)(sh_ValidationResult.schema.properties.path.type, value)),
1881
+ severity: $convertToIri(parameters.severity),
1882
+ sourceConstraintComponent: $convertToIri(parameters.sourceConstraintComponent),
1883
+ sourceShape: $convertToMaybe($convertToIdentifier)(parameters.sourceShape).chain((value) => $validateMaybe($identityValidationFunction)(sh_ValidationResult.schema.properties.sourceShape.type, value)),
1884
+ value: $convertToMaybe($identityConversionFunction)(parameters.value).chain((value) => $validateMaybe($identityValidationFunction)(sh_ValidationResult.schema.properties.value.type, value)),
1885
+ })
1886
+ .map((properties) => ({
1887
+ ...properties,
1888
+ $type: "sh_ValidationResult",
1889
+ }))
1890
+ .map((object) => $monkeyPatchObject(object, {
1891
+ $toString: sh_ValidationResult.$toString,
1892
+ }));
1893
+ function createUnsafe(parameters) {
1894
+ return sh_ValidationResult.create(parameters).unsafeCoerce();
1895
+ }
1896
+ sh_ValidationResult.createUnsafe = createUnsafe;
1897
+ let Identifier;
1898
+ (function (Identifier) {
1899
+ Identifier.parse = $parseIdentifier;
1900
+ Identifier.stringify = NTriplesTerm.stringify;
1901
+ })(Identifier = sh_ValidationResult.Identifier || (sh_ValidationResult.Identifier = {}));
1902
+ function issh_ValidationResult(object) {
1903
+ return object.$type === "sh_ValidationResult";
1904
+ }
1905
+ sh_ValidationResult.issh_ValidationResult = issh_ValidationResult;
1906
+ sh_ValidationResult.schema = {
1907
+ fromRdfType: dataFactory.namedNode("http://www.w3.org/ns/shacl#ValidationResult"),
1908
+ properties: {
1909
+ $identifier: {
1910
+ kind: "Identifier",
1911
+ type: { kind: "Identifier" },
1912
+ },
1913
+ details: {
1914
+ kind: "Shacl",
1915
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#detail"),
1916
+ type: {
1917
+ kind: "Set",
1918
+ itemType: {
1919
+ kind: "Term",
1920
+ types: ["BlankNode", "NamedNode", "Literal"],
1921
+ },
1922
+ },
1923
+ },
1924
+ focusNode: {
1925
+ kind: "Shacl",
1926
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#focusNode"),
1927
+ type: {
1928
+ kind: "Term",
1929
+ types: ["BlankNode", "NamedNode", "Literal"],
1930
+ },
1931
+ },
1932
+ message: {
1933
+ kind: "Shacl",
1934
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#resultMessage"),
1935
+ type: {
1936
+ kind: "Option",
1937
+ itemType: { kind: "String" },
1938
+ },
1939
+ },
1940
+ path: {
1941
+ kind: "Shacl",
1942
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#resultPath"),
1943
+ get type() {
1944
+ return {
1945
+ kind: "Option",
1946
+ get itemType() {
1947
+ return $PropertyPath.schema;
1948
+ },
1949
+ };
1950
+ },
1951
+ },
1952
+ severity: {
1953
+ kind: "Shacl",
1954
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#resultSeverity"),
1955
+ get type() {
1956
+ return {
1957
+ kind: "Iri",
1958
+ in: [
1959
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Info"),
1960
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Warning"),
1961
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Violation"),
1962
+ ],
1963
+ };
1964
+ },
1965
+ },
1966
+ sourceConstraintComponent: {
1967
+ kind: "Shacl",
1968
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#sourceConstraintComponent"),
1969
+ type: { kind: "Iri" },
1970
+ },
1971
+ sourceShape: {
1972
+ kind: "Shacl",
1973
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#sourceShape"),
1974
+ type: {
1975
+ kind: "Option",
1976
+ itemType: { kind: "Identifier" },
1977
+ },
1978
+ },
1979
+ value: {
1980
+ kind: "Shacl",
1981
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#value"),
1982
+ type: {
1983
+ kind: "Option",
1984
+ itemType: {
1985
+ kind: "Term",
1986
+ types: ["BlankNode", "NamedNode", "Literal"],
1987
+ },
1988
+ },
1989
+ },
1990
+ },
1991
+ toRdfTypes: [
1992
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#ValidationResult"),
1993
+ ],
1994
+ };
1995
+ sh_ValidationResult._toRdfResource = (parameters) => {
1996
+ if (!parameters.ignoreRdfType) {
1997
+ parameters.resource.add($RdfVocabularies.rdf.type, sh_ValidationResult.schema.toRdfTypes, parameters.graph);
1998
+ }
1999
+ parameters.resource.add(sh_ValidationResult.schema.properties.details.path, parameters.object.details.flatMap((item) => [item]), parameters.graph);
2000
+ parameters.resource.add(sh_ValidationResult.schema.properties.focusNode.path, [parameters.object.focusNode], parameters.graph);
2001
+ parameters.resource.add(sh_ValidationResult.schema.properties.message.path, parameters.object.message
2002
+ .toList()
2003
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
2004
+ parameters.resource.add(sh_ValidationResult.schema.properties.path.path, parameters.object.path.toList().flatMap((value) => [
2005
+ $PropertyPath.toRdfResource(value, {
2006
+ graph: parameters.graph,
2007
+ resourceSet: parameters.resourceSet,
2008
+ }).identifier,
2009
+ ]), parameters.graph);
2010
+ parameters.resource.add(sh_ValidationResult.schema.properties.severity.path, [parameters.object.severity], parameters.graph);
2011
+ parameters.resource.add(sh_ValidationResult.schema.properties.sourceConstraintComponent.path, [parameters.object.sourceConstraintComponent], parameters.graph);
2012
+ parameters.resource.add(sh_ValidationResult.schema.properties.sourceShape.path, parameters.object.sourceShape.toList(), parameters.graph);
2013
+ parameters.resource.add(sh_ValidationResult.schema.properties.value.path, parameters.object.value.toList(), parameters.graph);
2014
+ return parameters.resource;
2015
+ };
2016
+ sh_ValidationResult.toRdfResource = $wrap_ToRdfResourceFunction(sh_ValidationResult._toRdfResource);
2017
+ sh_ValidationResult.$toString = (_shValidationResult) => `sh_ValidationResult(${JSON.stringify(sh_ValidationResult.toStringRecord(_shValidationResult))})`;
2018
+ sh_ValidationResult.toStringRecord = (_shValidationResult) => $compactRecord({
2019
+ $identifier: _shValidationResult.$identifier().toString(),
2020
+ });
2021
+ })(sh_ValidationResult || (sh_ValidationResult = {}));
2022
+ export var sh_Shape;
2023
+ (function (sh_Shape) {
2024
+ sh_Shape.$toString = (value) => {
2025
+ if (sh_NodeShape.issh_NodeShape(value)) {
2026
+ return sh_NodeShape.$toString(value);
2027
+ }
2028
+ if (sh_PropertyShape.issh_PropertyShape(value)) {
2029
+ return sh_PropertyShape.$toString(value);
2030
+ }
2031
+ throw new Error("unable to serialize to string");
2032
+ };
2033
+ let Identifier;
2034
+ (function (Identifier) {
2035
+ Identifier.parse = $parseIdentifier;
2036
+ Identifier.stringify = NTriplesTerm.stringify;
2037
+ })(Identifier = sh_Shape.Identifier || (sh_Shape.Identifier = {}));
2038
+ function issh_Shape(object) {
2039
+ return (sh_NodeShape.issh_NodeShape(object) ||
2040
+ sh_PropertyShape.issh_PropertyShape(object));
2041
+ }
2042
+ sh_Shape.issh_Shape = issh_Shape;
2043
+ sh_Shape.schema = {
2044
+ kind: "ObjectUnion",
2045
+ members: {
2046
+ sh_NodeShape: {
2047
+ discriminantValues: ["sh_NodeShape"],
2048
+ type: sh_NodeShape.schema,
2049
+ },
2050
+ sh_PropertyShape: {
2051
+ discriminantValues: ["sh_PropertyShape"],
2052
+ type: sh_PropertyShape.schema,
2053
+ },
2054
+ },
2055
+ properties: {
2056
+ and: {
2057
+ kind: "Shacl",
2058
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#and"),
2059
+ type: {
2060
+ kind: "Option",
2061
+ itemType: {
2062
+ kind: "List",
2063
+ itemType: { kind: "Identifier" },
2064
+ },
2065
+ },
2066
+ },
2067
+ classes: {
2068
+ kind: "Shacl",
2069
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#class"),
2070
+ type: { kind: "Set", itemType: { kind: "Iri" } },
2071
+ },
2072
+ comment: {
2073
+ kind: "Shacl",
2074
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
2075
+ type: {
2076
+ kind: "Option",
2077
+ itemType: { kind: "String" },
2078
+ },
2079
+ },
2080
+ datatype: {
2081
+ kind: "Shacl",
2082
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#datatype"),
2083
+ type: { kind: "Option", itemType: { kind: "Iri" } },
2084
+ },
2085
+ deactivated: {
2086
+ kind: "Shacl",
2087
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"),
2088
+ type: {
2089
+ kind: "Option",
2090
+ itemType: { kind: "Boolean" },
2091
+ },
2092
+ },
2093
+ flags: {
2094
+ kind: "Shacl",
2095
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#flags"),
2096
+ type: {
2097
+ kind: "Option",
2098
+ itemType: { kind: "String" },
2099
+ },
2100
+ },
2101
+ hasValues: {
2102
+ kind: "Shacl",
2103
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#hasValue"),
2104
+ type: {
2105
+ kind: "Set",
2106
+ itemType: { kind: "Term", types: ["NamedNode", "Literal"] },
2107
+ },
2108
+ },
2109
+ ignore: {
2110
+ kind: "Shacl",
2111
+ path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#ignore"),
2112
+ type: {
2113
+ kind: "DefaultValue",
2114
+ itemType: { kind: "Boolean" },
2115
+ defaultValue: dataFactory.literal("false", $RdfVocabularies.xsd.boolean),
2116
+ },
2117
+ },
2118
+ in_: {
2119
+ kind: "Shacl",
2120
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#in"),
2121
+ type: {
2122
+ kind: "Option",
2123
+ itemType: {
2124
+ kind: "List",
2125
+ itemType: {
2126
+ kind: "Term",
2127
+ types: ["NamedNode", "Literal"],
2128
+ },
2129
+ },
2130
+ },
2131
+ },
2132
+ isDefinedBy: {
2133
+ kind: "Shacl",
2134
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"),
2135
+ type: {
2136
+ kind: "Option",
2137
+ itemType: { kind: "Identifier" },
2138
+ },
2139
+ },
2140
+ label: {
2141
+ kind: "Shacl",
2142
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
2143
+ type: {
2144
+ kind: "Option",
2145
+ itemType: { kind: "String" },
2146
+ },
2147
+ },
2148
+ languageIn: {
2149
+ kind: "Shacl",
2150
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#languageIn"),
2151
+ type: {
2152
+ kind: "Option",
2153
+ itemType: {
2154
+ kind: "List",
2155
+ itemType: { kind: "String" },
2156
+ },
2157
+ },
2158
+ },
2159
+ maxExclusive: {
2160
+ kind: "Shacl",
2161
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxExclusive"),
2162
+ type: {
2163
+ kind: "Option",
2164
+ itemType: { kind: "Literal" },
2165
+ },
2166
+ },
2167
+ maxInclusive: {
2168
+ kind: "Shacl",
2169
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxInclusive"),
2170
+ type: {
2171
+ kind: "Option",
2172
+ itemType: { kind: "Literal" },
2173
+ },
2174
+ },
2175
+ maxLength: {
2176
+ kind: "Shacl",
2177
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxLength"),
2178
+ type: {
2179
+ kind: "Option",
2180
+ itemType: { kind: "BigInt" },
2181
+ },
2182
+ },
2183
+ message: {
2184
+ kind: "Shacl",
2185
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#message"),
2186
+ type: {
2187
+ kind: "Option",
2188
+ itemType: { kind: "String" },
2189
+ },
2190
+ },
2191
+ minExclusive: {
2192
+ kind: "Shacl",
2193
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minExclusive"),
2194
+ type: {
2195
+ kind: "Option",
2196
+ itemType: { kind: "Literal" },
2197
+ },
2198
+ },
2199
+ minInclusive: {
2200
+ kind: "Shacl",
2201
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minInclusive"),
2202
+ type: {
2203
+ kind: "Option",
2204
+ itemType: { kind: "Literal" },
2205
+ },
2206
+ },
2207
+ minLength: {
2208
+ kind: "Shacl",
2209
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minLength"),
2210
+ type: {
2211
+ kind: "Option",
2212
+ itemType: { kind: "BigInt" },
2213
+ },
2214
+ },
2215
+ mutable: {
2216
+ kind: "Shacl",
2217
+ path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#mutable"),
2218
+ type: {
2219
+ kind: "Option",
2220
+ itemType: { kind: "Boolean" },
2221
+ },
2222
+ },
2223
+ node: {
2224
+ kind: "Shacl",
2225
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#node"),
2226
+ type: {
2227
+ kind: "Option",
2228
+ itemType: { kind: "Identifier" },
2229
+ },
2230
+ },
2231
+ nodeKind: {
2232
+ kind: "Shacl",
2233
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"),
2234
+ type: {
2235
+ kind: "Option",
2236
+ itemType: {
2237
+ kind: "Iri",
2238
+ in: [
2239
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNode"),
2240
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrIRI"),
2241
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrLiteral"),
2242
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#IRI"),
2243
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#IRIOrLiteral"),
2244
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Literal"),
2245
+ ],
2246
+ },
2247
+ },
2248
+ },
2249
+ not: {
2250
+ kind: "Shacl",
2251
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#not"),
2252
+ type: {
2253
+ kind: "Set",
2254
+ itemType: { kind: "Identifier" },
2255
+ },
2256
+ },
2257
+ or: {
2258
+ kind: "Shacl",
2259
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#or"),
2260
+ type: {
2261
+ kind: "Option",
2262
+ itemType: {
2263
+ kind: "List",
2264
+ itemType: { kind: "Identifier" },
2265
+ },
2266
+ },
2267
+ },
2268
+ pattern: {
2269
+ kind: "Shacl",
2270
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#pattern"),
2271
+ type: {
2272
+ kind: "Option",
2273
+ itemType: { kind: "String" },
2274
+ },
2275
+ },
2276
+ severity: {
2277
+ kind: "Shacl",
2278
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#severity"),
2279
+ get type() {
2280
+ return {
2281
+ kind: "Option",
2282
+ get itemType() {
2283
+ return {
2284
+ kind: "Iri",
2285
+ in: [
2286
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Info"),
2287
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Warning"),
2288
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Violation"),
2289
+ ],
2290
+ };
2291
+ },
2292
+ };
2293
+ },
2294
+ },
2295
+ shaclmateName: {
2296
+ kind: "Shacl",
2297
+ path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#name"),
2298
+ type: {
2299
+ kind: "Option",
2300
+ itemType: { kind: "String" },
2301
+ },
2302
+ },
2303
+ targetClasses: {
2304
+ kind: "Shacl",
2305
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#targetClass"),
2306
+ type: { kind: "Set", itemType: { kind: "Iri" } },
2307
+ },
2308
+ targetNodes: {
2309
+ kind: "Shacl",
2310
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#targetNode"),
2311
+ type: {
2312
+ kind: "Set",
2313
+ itemType: { kind: "Term", types: ["NamedNode", "Literal"] },
2314
+ },
2315
+ },
2316
+ targetObjectsOf: {
2317
+ kind: "Shacl",
2318
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#targetObjectsOf"),
2319
+ type: { kind: "Set", itemType: { kind: "Iri" } },
2320
+ },
2321
+ targetSubjectsOf: {
2322
+ kind: "Shacl",
2323
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#targetSubjectsOf"),
2324
+ type: { kind: "Set", itemType: { kind: "Iri" } },
2325
+ },
2326
+ xone: {
2327
+ kind: "Shacl",
2328
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#xone"),
2329
+ type: {
2330
+ kind: "Option",
2331
+ itemType: {
2332
+ kind: "List",
2333
+ itemType: { kind: "Identifier" },
2334
+ },
2335
+ },
2336
+ },
2337
+ },
2338
+ };
2339
+ sh_Shape.toRdfResource = (object, options) => {
2340
+ if (sh_NodeShape.issh_NodeShape(object)) {
2341
+ return sh_NodeShape.toRdfResource(object, options);
2342
+ }
2343
+ if (sh_PropertyShape.issh_PropertyShape(object)) {
2344
+ return sh_PropertyShape.toRdfResource(object, options);
2345
+ }
2346
+ throw new Error("unrecognized type");
2347
+ };
2348
+ sh_Shape.toRdfResourceValues = ((value, _options) => {
2349
+ if (sh_NodeShape.issh_NodeShape(value)) {
2350
+ return [
2351
+ sh_NodeShape.toRdfResource(value, {
2352
+ graph: _options.graph,
2353
+ resourceSet: _options.resourceSet,
2354
+ }).identifier,
2355
+ ];
2356
+ }
2357
+ if (sh_PropertyShape.issh_PropertyShape(value)) {
2358
+ return [
2359
+ sh_PropertyShape.toRdfResource(value, {
2360
+ graph: _options.graph,
2361
+ resourceSet: _options.resourceSet,
2362
+ }).identifier,
2363
+ ];
2364
+ }
2365
+ throw new Error("unable to serialize to RDF");
2366
+ });
2367
+ })(sh_Shape || (sh_Shape = {}));
2368
+ export var $Object;
2369
+ (function ($Object) {
2370
+ $Object.$toString = (value) => {
2371
+ if (sh_NodeShape.issh_NodeShape(value)) {
2372
+ return sh_NodeShape.$toString(value);
2373
+ }
2374
+ if (sh_Ontology.issh_Ontology(value)) {
2375
+ return sh_Ontology.$toString(value);
2376
+ }
2377
+ if (sh_PropertyGroup.issh_PropertyGroup(value)) {
2378
+ return sh_PropertyGroup.$toString(value);
2379
+ }
2380
+ if (sh_PropertyShape.issh_PropertyShape(value)) {
2381
+ return sh_PropertyShape.$toString(value);
2382
+ }
2383
+ if (sh_ValidationReport.issh_ValidationReport(value)) {
2384
+ return sh_ValidationReport.$toString(value);
2385
+ }
2386
+ if (sh_ValidationResult.issh_ValidationResult(value)) {
2387
+ return sh_ValidationResult.$toString(value);
2388
+ }
2389
+ throw new Error("unable to serialize to string");
2390
+ };
2391
+ let Identifier;
2392
+ (function (Identifier) {
2393
+ Identifier.parse = $parseIdentifier;
2394
+ Identifier.stringify = NTriplesTerm.stringify;
2395
+ })(Identifier = $Object.Identifier || ($Object.Identifier = {}));
2396
+ $Object.schema = {
2397
+ kind: "ObjectUnion",
2398
+ members: {
2399
+ sh_NodeShape: {
2400
+ discriminantValues: ["sh_NodeShape"],
2401
+ type: sh_NodeShape.schema,
2402
+ },
2403
+ sh_Ontology: {
2404
+ discriminantValues: ["sh_Ontology"],
2405
+ type: sh_Ontology.schema,
2406
+ },
2407
+ sh_PropertyGroup: {
2408
+ discriminantValues: ["sh_PropertyGroup"],
2409
+ type: sh_PropertyGroup.schema,
2410
+ },
2411
+ sh_PropertyShape: {
2412
+ discriminantValues: ["sh_PropertyShape"],
2413
+ type: sh_PropertyShape.schema,
2414
+ },
2415
+ sh_ValidationReport: {
2416
+ discriminantValues: ["sh_ValidationReport"],
2417
+ type: sh_ValidationReport.schema,
2418
+ },
2419
+ sh_ValidationResult: {
2420
+ discriminantValues: ["sh_ValidationResult"],
2421
+ type: sh_ValidationResult.schema,
2422
+ },
2423
+ },
2424
+ properties: {},
2425
+ };
2426
+ $Object.toRdfResource = (object, options) => {
2427
+ if (sh_NodeShape.issh_NodeShape(object)) {
2428
+ return sh_NodeShape.toRdfResource(object, options);
2429
+ }
2430
+ if (sh_Ontology.issh_Ontology(object)) {
2431
+ return sh_Ontology.toRdfResource(object, options);
2432
+ }
2433
+ if (sh_PropertyGroup.issh_PropertyGroup(object)) {
2434
+ return sh_PropertyGroup.toRdfResource(object, options);
2435
+ }
2436
+ if (sh_PropertyShape.issh_PropertyShape(object)) {
2437
+ return sh_PropertyShape.toRdfResource(object, options);
2438
+ }
2439
+ if (sh_ValidationReport.issh_ValidationReport(object)) {
2440
+ return sh_ValidationReport.toRdfResource(object, options);
2441
+ }
2442
+ if (sh_ValidationResult.issh_ValidationResult(object)) {
2443
+ return sh_ValidationResult.toRdfResource(object, options);
2444
+ }
2445
+ throw new Error("unrecognized type");
2446
+ };
2447
+ $Object.toRdfResourceValues = ((value, _options) => {
2448
+ if (sh_NodeShape.issh_NodeShape(value)) {
2449
+ return [
2450
+ sh_NodeShape.toRdfResource(value, {
2451
+ graph: _options.graph,
2452
+ resourceSet: _options.resourceSet,
2453
+ }).identifier,
2454
+ ];
2455
+ }
2456
+ if (sh_Ontology.issh_Ontology(value)) {
2457
+ return [
2458
+ sh_Ontology.toRdfResource(value, {
2459
+ graph: _options.graph,
2460
+ resourceSet: _options.resourceSet,
2461
+ }).identifier,
2462
+ ];
2463
+ }
2464
+ if (sh_PropertyGroup.issh_PropertyGroup(value)) {
2465
+ return [
2466
+ sh_PropertyGroup.toRdfResource(value, {
2467
+ graph: _options.graph,
2468
+ resourceSet: _options.resourceSet,
2469
+ }).identifier,
2470
+ ];
2471
+ }
2472
+ if (sh_PropertyShape.issh_PropertyShape(value)) {
2473
+ return [
2474
+ sh_PropertyShape.toRdfResource(value, {
2475
+ graph: _options.graph,
2476
+ resourceSet: _options.resourceSet,
2477
+ }).identifier,
2478
+ ];
2479
+ }
2480
+ if (sh_ValidationReport.issh_ValidationReport(value)) {
2481
+ return [
2482
+ sh_ValidationReport.toRdfResource(value, {
2483
+ graph: _options.graph,
2484
+ resourceSet: _options.resourceSet,
2485
+ }).identifier,
2486
+ ];
2487
+ }
2488
+ if (sh_ValidationResult.issh_ValidationResult(value)) {
2489
+ return [
2490
+ sh_ValidationResult.toRdfResource(value, {
2491
+ graph: _options.graph,
2492
+ resourceSet: _options.resourceSet,
2493
+ }).identifier,
2494
+ ];
2495
+ }
2496
+ throw new Error("unable to serialize to RDF");
2497
+ });
2498
+ })($Object || ($Object = {}));
2499
+ //# sourceMappingURL=shapes.js.map