@shaclmate/shacl-ast 4.0.50 → 4.0.52

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.
@@ -0,0 +1,3265 @@
1
+ import datasetFactory from "@rdfjs/dataset";
2
+ import dataFactory from "@rdfx/data-factory";
3
+ import { LiteralFactory } from "@rdfx/literal";
4
+ import { PropertyPath as RdfxResourcePropertyPath, Resource, ResourceSet, } from "@rdfx/resource";
5
+ import { NTriplesIdentifier, NTriplesTerm } from "@rdfx/string";
6
+ import { Either, Left, Maybe, Right } from "purify-ts";
7
+ function $bigIntFromRdfResourceValues(values, options) {
8
+ return $termLikeFromRdfResourceValues(values, options).chain((values) => values.chainMap((value) => options.schema.in
9
+ ? value.toBigInt(options.schema.in)
10
+ : value.toBigInt()));
11
+ }
12
+ function $booleanFromRdfResourceValues(values, options) {
13
+ return $termLikeFromRdfResourceValues(values, options).chain((values) => values.chainMap((value) => options.schema.in
14
+ ? value.toBoolean(options.schema.in)
15
+ : value.toBoolean()));
16
+ }
17
+ /**
18
+ * Remove undefined values from a record.
19
+ */
20
+ function $compactRecord(record) {
21
+ return globalThis.Object.entries(record).reduce((definedProperties, [propertyName, propertyValue]) => {
22
+ if (propertyValue !== undefined) {
23
+ definedProperties[propertyName] = propertyValue;
24
+ }
25
+ return definedProperties;
26
+ }, {});
27
+ }
28
+ function $convertToIdentifier(value) {
29
+ switch (typeof value) {
30
+ case "object":
31
+ return Either.of(value);
32
+ case "string":
33
+ return Either.of(dataFactory.namedNode(value));
34
+ case "undefined":
35
+ return Either.of(dataFactory.blankNode());
36
+ }
37
+ }
38
+ function $convertToIdentifierProperty(identifier) {
39
+ switch (typeof identifier) {
40
+ case "function":
41
+ return Either.of(identifier);
42
+ case "object": {
43
+ const captureIdentifier = identifier;
44
+ return Either.of(() => captureIdentifier);
45
+ }
46
+ case "string": {
47
+ const captureIdentifier = dataFactory.namedNode(identifier);
48
+ return Either.of(() => captureIdentifier);
49
+ }
50
+ case "undefined": {
51
+ const captureIdentifier = dataFactory.blankNode();
52
+ return Either.of(() => captureIdentifier);
53
+ }
54
+ }
55
+ }
56
+ function $convertToIri(value) {
57
+ switch (typeof value) {
58
+ case "object":
59
+ return Either.of(value);
60
+ case "string":
61
+ return Either.of(dataFactory.namedNode(value));
62
+ }
63
+ }
64
+ function $convertToList(convertToItem, _readonly) {
65
+ return (value) => Either.sequence(value.map(convertToItem));
66
+ }
67
+ function $convertToLiteral(value) {
68
+ if (typeof value === "object") {
69
+ if (value instanceof Date) {
70
+ return Either.of($literalFactory.date(value));
71
+ }
72
+ return Either.of(value);
73
+ }
74
+ return Either.of($literalFactory.primitive(value));
75
+ }
76
+ function $convertToMaybe(convertToItem) {
77
+ return (value) => {
78
+ switch (typeof value) {
79
+ case "object": {
80
+ if (Maybe.isMaybe(value)) {
81
+ return Either.of(value);
82
+ }
83
+ break;
84
+ }
85
+ case "undefined":
86
+ return Either.of(Maybe.empty());
87
+ }
88
+ return convertToItem(value).map(Maybe.of);
89
+ };
90
+ }
91
+ function $convertToScalarSet(convertToItem, _readonly) {
92
+ return (value) => {
93
+ if (typeof value === "undefined") {
94
+ return Either.of([]);
95
+ }
96
+ if (Array.isArray(value)) {
97
+ return Either.sequence(value.map(convertToItem));
98
+ }
99
+ return convertToItem(value).map((value) => [
100
+ value,
101
+ ]);
102
+ };
103
+ }
104
+ function $ensureRdfResourceType(resource, types, options) {
105
+ return resource
106
+ .value($RdfVocabularies.rdf.type, options)
107
+ .chain((actualRdfTypeValue) => actualRdfTypeValue.toIri())
108
+ .chain((actualRdfType) => {
109
+ // Check the expected type and its known subtypes
110
+ for (const type of types) {
111
+ if (resource.isInstanceOf(type, options)) {
112
+ return Right(undefined);
113
+ }
114
+ }
115
+ return Left(new Error(`${resource.identifier} has unexpected RDF type (actual: ${actualRdfType}, expected one of ${types})`));
116
+ });
117
+ }
118
+ function $floatFromRdfResourceValues(values, options) {
119
+ return $termLikeFromRdfResourceValues(values, options).chain((values) => values.chainMap((value) => options.schema.in
120
+ ? value.toFloat(options.schema.in)
121
+ : value.toFloat()));
122
+ }
123
+ function $identifierFromRdfResourceValues(values, options) {
124
+ return $termLikeFromRdfResourceValues(values, options).chain((values) => values.chainMap((value) => value.toIdentifier()));
125
+ }
126
+ function $identityConversionFunction(value) {
127
+ return Either.of(value);
128
+ }
129
+ function $identityValidationFunction(_schema, value) {
130
+ return Either.of(value);
131
+ }
132
+ function $iriFromRdfResourceValues(values, options) {
133
+ return $termLikeFromRdfResourceValues(values, options).chain((values) => values.chainMap((value) => options.schema.in
134
+ ? value.toIri(options.schema.in)
135
+ : value.toIri()));
136
+ }
137
+ function $listFromRdfResourceValues(itemFromRdfResourceValues) {
138
+ return (values, options) => values
139
+ .chainMap((value) => value.toList({ graph: options.graph })) // Resource.Values<Resource.Value> to Resource.Values<Resource.Values>;
140
+ .chain((valueLists) => valueLists.chainMap((valueList) => itemFromRdfResourceValues(Resource.Values.fromArray({
141
+ focusResource: options.focusResource,
142
+ propertyPath: options.propertyPath,
143
+ values: valueList.toArray(),
144
+ }), { ...options, schema: options.schema.itemType }))) // Resource.Values<Resource.Values> to Resource.Values<item type arrays>
145
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray())); // Convert inner Resource.Values to arrays
146
+ }
147
+ const $literalFactory = new LiteralFactory({ dataFactory: dataFactory });
148
+ function $literalFromRdfResourceValues(values, options) {
149
+ return $termLikeFromRdfResourceValues(values, options).chain((values) => values.chainMap((value) => value.toLiteral()));
150
+ }
151
+ function $maybeFromRdfResourceValues(itemFromRdfResourceValues) {
152
+ return (values, options) => itemFromRdfResourceValues(values, {
153
+ ...options,
154
+ schema: options.schema.itemType,
155
+ }).map((values) => values.length > 0
156
+ ? values.map((value) => Maybe.of(value))
157
+ : Resource.Values.fromValue({
158
+ focusResource: options.focusResource,
159
+ propertyPath: options.propertyPath,
160
+ value: Maybe.empty(),
161
+ }));
162
+ }
163
+ function $monkeyPatchObject(obj, methods) {
164
+ if (methods.toJson &&
165
+ (!globalThis.Object.prototype.hasOwnProperty.call(obj, "toJSON") ||
166
+ typeof obj.toJSON === "function")) {
167
+ const toJsonMethod = methods.toJson;
168
+ obj.toJSON = function (_key) {
169
+ return toJsonMethod(this);
170
+ };
171
+ }
172
+ if (methods.$toString &&
173
+ (!globalThis.Object.prototype.hasOwnProperty.call(obj, "toString") ||
174
+ typeof obj.toJSON === "function")) {
175
+ const toStringMethod = methods.$toString;
176
+ obj.toString = function () {
177
+ return toStringMethod(this);
178
+ };
179
+ }
180
+ return obj;
181
+ }
182
+ const $parseIdentifier = NTriplesIdentifier.parser(dataFactory);
183
+ export var $PropertyPath;
184
+ (function ($PropertyPath) {
185
+ $PropertyPath.fromRdfResource = RdfxResourcePropertyPath.fromResource;
186
+ $PropertyPath.fromRdfResourceValues = (values, options) => values.chainMap((value) => value
187
+ .toResource()
188
+ .chain((resource) => $PropertyPath.fromRdfResource(resource, options)));
189
+ $PropertyPath.schema = {};
190
+ $PropertyPath.toRdfResource = RdfxResourcePropertyPath.toResource;
191
+ $PropertyPath.$toString = RdfxResourcePropertyPath.toString;
192
+ })($PropertyPath || ($PropertyPath = {}));
193
+ function $rdfResourceIdentifierValues(resource) {
194
+ return new Resource.Value({
195
+ dataFactory: dataFactory,
196
+ focusResource: resource,
197
+ propertyPath: $RdfVocabularies.rdf.subject,
198
+ term: resource.identifier,
199
+ }).toValues();
200
+ }
201
+ var $RdfVocabularies;
202
+ (function ($RdfVocabularies) {
203
+ $RdfVocabularies.rdf = {
204
+ first: dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#first"),
205
+ nil: dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"),
206
+ rest: dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"),
207
+ subject: dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#subject"),
208
+ type: dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),
209
+ };
210
+ $RdfVocabularies.rdfs = {
211
+ subClassOf: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf"),
212
+ };
213
+ $RdfVocabularies.xsd = {
214
+ boolean: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#boolean"),
215
+ byte: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#byte"),
216
+ date: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#date"),
217
+ dateTime: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#dateTime"),
218
+ decimal: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#decimal"),
219
+ double: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#double"),
220
+ float: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#float"),
221
+ int: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#int"),
222
+ integer: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#integer"),
223
+ long: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#long"),
224
+ negativeInteger: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#negativeInteger"),
225
+ nonNegativeInteger: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#nonNegativeInteger"),
226
+ nonPositiveInteger: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#nonPositiveInteger"),
227
+ positiveInteger: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#positiveInteger"),
228
+ short: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#short"),
229
+ string: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#string"),
230
+ unsignedByte: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#unsignedByte"),
231
+ unsignedInt: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#unsignedInt"),
232
+ unsignedLong: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#unsignedLong"),
233
+ unsignedShort: dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#unsignedShort"),
234
+ };
235
+ })($RdfVocabularies || ($RdfVocabularies = {}));
236
+ function $sequenceRecord(record) {
237
+ const result = {};
238
+ for (const key of globalThis.Object.keys(record)) {
239
+ const either = record[key];
240
+ if (either.isLeft()) {
241
+ return either;
242
+ }
243
+ result[key] = either.extract();
244
+ }
245
+ return Right(result);
246
+ }
247
+ function $setFromRdfResourceValues(itemFromRdfResourceValues) {
248
+ return (values, options) => itemFromRdfResourceValues(values, {
249
+ ...options,
250
+ schema: options.schema.itemType,
251
+ })
252
+ .map((values) => values.toArray())
253
+ .map((valuesArray) => Resource.Values.fromValue({
254
+ focusResource: options.focusResource,
255
+ propertyPath: options.propertyPath,
256
+ value: valuesArray,
257
+ }));
258
+ }
259
+ function $shaclPropertyFromRdf({ focusResource, graph, propertySchema, typeFromRdfResourceValues, ...otherParameters }) {
260
+ return typeFromRdfResourceValues(focusResource.values(propertySchema.path, { graph, unique: true }), {
261
+ ...otherParameters,
262
+ focusResource,
263
+ graph,
264
+ propertyPath: propertySchema.path,
265
+ schema: propertySchema.type,
266
+ }).chain((values) => values.head());
267
+ }
268
+ function $stringFromRdfResourceValues(values, options) {
269
+ return $termLikeFromRdfResourceValues(values, options).chain((values) => values.chainMap((value) => options.schema.in
270
+ ? value.toString(options.schema.in)
271
+ : value.toString()));
272
+ }
273
+ function $termFromRdfResourceValues(values, options) {
274
+ const { focusResource, propertyPath, schema } = options;
275
+ return $termLikeFromRdfResourceValues(values, options).chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
276
+ if (schema.in &&
277
+ schema.in.length > 0 &&
278
+ !schema.in.some((in_) => in_.equals(term))) {
279
+ return Left(new Resource.MistypedTermValueError({
280
+ actualValue: term,
281
+ expectedValueType: "Term in",
282
+ focusResource,
283
+ propertyPath,
284
+ }));
285
+ }
286
+ if (!schema.types.some((type) => term.termType === type)) {
287
+ return Left(new Resource.MistypedTermValueError({
288
+ actualValue: term,
289
+ expectedValueType: "Term types",
290
+ focusResource,
291
+ propertyPath,
292
+ }));
293
+ }
294
+ return Right(term);
295
+ })));
296
+ }
297
+ const $termLikeFromRdfResourceValues = (values, { preferredLanguages, schema: { hasValues, languageIn } }) => {
298
+ let chain = Either.of(values);
299
+ if (hasValues && hasValues.length > 0) {
300
+ chain = chain.chain((values) => Either.sequence(hasValues.map((hasValue) => values.find((value) => value.term.equals(hasValue)))).map(() => values));
301
+ }
302
+ if (languageIn && languageIn.length > 0) {
303
+ chain = chain.chain((values) => values.chainMap((value) => value.toLiteral().chain((literal) => languageIn.includes(literal.language)
304
+ ? Right(value)
305
+ : Left(new Resource.MistypedTermValueError({
306
+ actualValue: literal,
307
+ expectedValueType: "Literal",
308
+ focusResource: value.focusResource,
309
+ propertyPath: value.propertyPath,
310
+ })))));
311
+ }
312
+ if (preferredLanguages && preferredLanguages.length > 0) {
313
+ chain = chain.chain((values) => {
314
+ const literals = [];
315
+ const literalValues = [];
316
+ const nonLiteralValues = [];
317
+ for (const value of values) {
318
+ const term = value.toTerm().unsafeCoerce();
319
+ if (term.termType === "Literal") {
320
+ literals.push(term);
321
+ literalValues.push(value);
322
+ }
323
+ else {
324
+ nonLiteralValues.push(value);
325
+ }
326
+ }
327
+ // Return all literals for the first preferredLanguage, then all literals for the second preferredLanguage, etc.
328
+ // Within a preferredLanguage the literals may be in any order.
329
+ const preferredLanguageLiteralValues = [];
330
+ for (const preferredLanguage of preferredLanguages) {
331
+ for (let literalI = 0; literalI < literals.length; literalI++) {
332
+ if (literals[literalI].language === preferredLanguage) {
333
+ preferredLanguageLiteralValues.push(literalValues[literalI]);
334
+ }
335
+ }
336
+ }
337
+ return Right(Resource.Values.fromArray({
338
+ focusResource: values.focusResource,
339
+ propertyPath: values.propertyPath,
340
+ values: nonLiteralValues.concat(preferredLanguageLiteralValues),
341
+ }));
342
+ });
343
+ }
344
+ return chain;
345
+ };
346
+ function $validateArray(validateItem, _readonly) {
347
+ return (schema, valueArray) => {
348
+ if (schema.minCount !== undefined && valueArray.length < schema.minCount) {
349
+ return Left(new Error(`value array has length (${valueArray.length}) less than minCount (${schema.minCount})`));
350
+ }
351
+ return Either.sequence(valueArray.map((value) => validateItem(schema.itemType, value)));
352
+ };
353
+ }
354
+ function $validateMaybe(validateItem) {
355
+ return (schema, valueMaybe) => valueMaybe
356
+ .map((value) => validateItem(schema.itemType, value).map(() => valueMaybe))
357
+ .orDefault(Either.of(valueMaybe));
358
+ }
359
+ function $wrap_FromRdfResourceFunction(_fromRdfResourceFunction) {
360
+ return (resource, options) => {
361
+ const { context, graph, ignoreRdfType = false, preferredLanguages, } = options ?? {};
362
+ return _fromRdfResourceFunction(resource, {
363
+ context,
364
+ graph,
365
+ ignoreRdfType,
366
+ preferredLanguages,
367
+ });
368
+ };
369
+ }
370
+ function $wrap_ToRdfResourceFunction(_toRdfResourceFunction) {
371
+ return (object, options) => {
372
+ let { graph, ignoreRdfType = false, resourceSet } = options ?? {};
373
+ if (!resourceSet) {
374
+ resourceSet = new ResourceSet({
375
+ dataFactory: dataFactory,
376
+ dataset: datasetFactory.dataset(),
377
+ });
378
+ }
379
+ const resource = resourceSet.resource(object.$identifier());
380
+ _toRdfResourceFunction({
381
+ graph,
382
+ ignoreRdfType,
383
+ object,
384
+ resource,
385
+ resourceSet,
386
+ });
387
+ return resource;
388
+ };
389
+ }
390
+ export var NodeShape;
391
+ (function (NodeShape) {
392
+ NodeShape.create = (parameters) => $sequenceRecord({
393
+ $identifier: $convertToIdentifierProperty(parameters?.$identifier),
394
+ and: $convertToMaybe($convertToList($convertToIdentifier, true))(parameters?.and).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(NodeShape.schema.properties.and.type, value)),
395
+ classes: $convertToScalarSet(($convertToIri), true)(parameters?.classes).chain((value) => $validateArray($identityValidationFunction, true)(NodeShape.schema.properties.classes.type, value)),
396
+ closed: $convertToMaybe($identityConversionFunction)(parameters?.closed).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.closed.type, value)),
397
+ comment: $convertToMaybe($identityConversionFunction)(parameters?.comment).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.comment.type, value)),
398
+ datatype: $convertToMaybe(($convertToIri))(parameters?.datatype).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.datatype.type, value)),
399
+ deactivated: $convertToMaybe($identityConversionFunction)(parameters?.deactivated).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.deactivated.type, value)),
400
+ flags: $convertToMaybe($identityConversionFunction)(parameters?.flags).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.flags.type, value)),
401
+ hasValues: $convertToScalarSet($identityConversionFunction, true)(parameters?.hasValues).chain((value) => $validateArray($identityValidationFunction, true)(NodeShape.schema.properties.hasValues.type, value)),
402
+ ignoredProperties: $convertToMaybe($convertToList(($convertToIri), true))(parameters?.ignoredProperties).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(NodeShape.schema.properties.ignoredProperties.type, value)),
403
+ in_: $convertToMaybe($convertToList($identityConversionFunction, true))(parameters?.in_).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(NodeShape.schema.properties.in_.type, value)),
404
+ isDefinedBy: $convertToMaybe($convertToIdentifier)(parameters?.isDefinedBy).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.isDefinedBy.type, value)),
405
+ label: $convertToMaybe($identityConversionFunction)(parameters?.label).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.label.type, value)),
406
+ languageIn: $convertToMaybe($convertToList($identityConversionFunction, true))(parameters?.languageIn).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(NodeShape.schema.properties.languageIn.type, value)),
407
+ maxExclusive: $convertToMaybe($convertToLiteral)(parameters?.maxExclusive).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.maxExclusive.type, value)),
408
+ maxInclusive: $convertToMaybe($convertToLiteral)(parameters?.maxInclusive).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.maxInclusive.type, value)),
409
+ maxLength: $convertToMaybe($identityConversionFunction)(parameters?.maxLength).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.maxLength.type, value)),
410
+ message: $convertToMaybe($identityConversionFunction)(parameters?.message).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.message.type, value)),
411
+ minExclusive: $convertToMaybe($convertToLiteral)(parameters?.minExclusive).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.minExclusive.type, value)),
412
+ minInclusive: $convertToMaybe($convertToLiteral)(parameters?.minInclusive).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.minInclusive.type, value)),
413
+ minLength: $convertToMaybe($identityConversionFunction)(parameters?.minLength).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.minLength.type, value)),
414
+ node: $convertToMaybe($convertToIdentifier)(parameters?.node).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.node.type, value)),
415
+ nodeKind: $convertToMaybe(($convertToIri))(parameters?.nodeKind).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.nodeKind.type, value)),
416
+ not: $convertToScalarSet($convertToIdentifier, true)(parameters?.not).chain((value) => $validateArray($identityValidationFunction, true)(NodeShape.schema.properties.not.type, value)),
417
+ or: $convertToMaybe($convertToList($convertToIdentifier, true))(parameters?.or).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(NodeShape.schema.properties.or.type, value)),
418
+ pattern: $convertToMaybe($identityConversionFunction)(parameters?.pattern).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.pattern.type, value)),
419
+ properties: $convertToScalarSet($convertToIdentifier, true)(parameters?.properties).chain((value) => $validateArray($identityValidationFunction, true)(NodeShape.schema.properties.properties.type, value)),
420
+ severity: $convertToMaybe(($convertToIri))(parameters?.severity).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.severity.type, value)),
421
+ subClassOf: $convertToScalarSet(($convertToIri), true)(parameters?.subClassOf).chain((value) => $validateArray($identityValidationFunction, true)(NodeShape.schema.properties.subClassOf.type, value)),
422
+ targetClasses: $convertToScalarSet(($convertToIri), true)(parameters?.targetClasses).chain((value) => $validateArray($identityValidationFunction, true)(NodeShape.schema.properties.targetClasses.type, value)),
423
+ targetNodes: $convertToScalarSet($identityConversionFunction, true)(parameters?.targetNodes).chain((value) => $validateArray($identityValidationFunction, true)(NodeShape.schema.properties.targetNodes.type, value)),
424
+ targetObjectsOf: $convertToScalarSet(($convertToIri), true)(parameters?.targetObjectsOf).chain((value) => $validateArray($identityValidationFunction, true)(NodeShape.schema.properties.targetObjectsOf.type, value)),
425
+ targetSubjectsOf: $convertToScalarSet(($convertToIri), true)(parameters?.targetSubjectsOf).chain((value) => $validateArray($identityValidationFunction, true)(NodeShape.schema.properties.targetSubjectsOf.type, value)),
426
+ types: $convertToScalarSet(($convertToIri), true)(parameters?.types).chain((value) => $validateArray($identityValidationFunction, true)(NodeShape.schema.properties.types.type, value)),
427
+ xone: $convertToMaybe($convertToList($convertToIdentifier, true))(parameters?.xone).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(NodeShape.schema.properties.xone.type, value)),
428
+ })
429
+ .map((properties) => ({ ...properties, $type: "NodeShape" }))
430
+ .map((object) => $monkeyPatchObject(object, { $toString: NodeShape.$toString }));
431
+ function createUnsafe(parameters) {
432
+ return NodeShape.create(parameters).unsafeCoerce();
433
+ }
434
+ NodeShape.createUnsafe = createUnsafe;
435
+ NodeShape._fromRdfResource = (resource, options) => (!options.ignoreRdfType
436
+ ? $ensureRdfResourceType(resource, [NodeShape.schema.fromRdfType], {
437
+ graph: options.graph,
438
+ })
439
+ : Right(true)).chain((_rdfTypeCheck) => $sequenceRecord({
440
+ $identifier: $identifierFromRdfResourceValues($rdfResourceIdentifierValues(resource), {
441
+ ...options,
442
+ focusResource: resource,
443
+ propertyPath: $RdfVocabularies.rdf.subject,
444
+ schema: NodeShape.schema.properties.$identifier.type,
445
+ }).chain((values) => values.head()),
446
+ and: $shaclPropertyFromRdf({
447
+ ...options,
448
+ focusResource: resource,
449
+ ignoreRdfType: true,
450
+ propertySchema: NodeShape.schema.properties.and,
451
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues($listFromRdfResourceValues($identifierFromRdfResourceValues)),
452
+ }),
453
+ classes: $shaclPropertyFromRdf({
454
+ ...options,
455
+ focusResource: resource,
456
+ ignoreRdfType: true,
457
+ propertySchema: NodeShape.schema.properties.classes,
458
+ typeFromRdfResourceValues: $setFromRdfResourceValues(($iriFromRdfResourceValues)),
459
+ }),
460
+ closed: $shaclPropertyFromRdf({
461
+ ...options,
462
+ focusResource: resource,
463
+ ignoreRdfType: true,
464
+ propertySchema: NodeShape.schema.properties.closed,
465
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($booleanFromRdfResourceValues)),
466
+ }),
467
+ comment: $shaclPropertyFromRdf({
468
+ ...options,
469
+ focusResource: resource,
470
+ ignoreRdfType: true,
471
+ propertySchema: NodeShape.schema.properties.comment,
472
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($stringFromRdfResourceValues)),
473
+ }),
474
+ datatype: $shaclPropertyFromRdf({
475
+ ...options,
476
+ focusResource: resource,
477
+ ignoreRdfType: true,
478
+ propertySchema: NodeShape.schema.properties.datatype,
479
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($iriFromRdfResourceValues)),
480
+ }),
481
+ deactivated: $shaclPropertyFromRdf({
482
+ ...options,
483
+ focusResource: resource,
484
+ ignoreRdfType: true,
485
+ propertySchema: NodeShape.schema.properties.deactivated,
486
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($booleanFromRdfResourceValues)),
487
+ }),
488
+ flags: $shaclPropertyFromRdf({
489
+ ...options,
490
+ focusResource: resource,
491
+ ignoreRdfType: true,
492
+ propertySchema: NodeShape.schema.properties.flags,
493
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($stringFromRdfResourceValues)),
494
+ }),
495
+ hasValues: $shaclPropertyFromRdf({
496
+ ...options,
497
+ focusResource: resource,
498
+ ignoreRdfType: true,
499
+ propertySchema: NodeShape.schema.properties.hasValues,
500
+ typeFromRdfResourceValues: $setFromRdfResourceValues(($termFromRdfResourceValues)),
501
+ }),
502
+ ignoredProperties: $shaclPropertyFromRdf({
503
+ ...options,
504
+ focusResource: resource,
505
+ ignoreRdfType: true,
506
+ propertySchema: NodeShape.schema.properties.ignoredProperties,
507
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues($listFromRdfResourceValues(($iriFromRdfResourceValues))),
508
+ }),
509
+ in_: $shaclPropertyFromRdf({
510
+ ...options,
511
+ focusResource: resource,
512
+ ignoreRdfType: true,
513
+ propertySchema: NodeShape.schema.properties.in_,
514
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues($listFromRdfResourceValues(($termFromRdfResourceValues))),
515
+ }),
516
+ isDefinedBy: $shaclPropertyFromRdf({
517
+ ...options,
518
+ focusResource: resource,
519
+ ignoreRdfType: true,
520
+ propertySchema: NodeShape.schema.properties.isDefinedBy,
521
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues($identifierFromRdfResourceValues),
522
+ }),
523
+ label: $shaclPropertyFromRdf({
524
+ ...options,
525
+ focusResource: resource,
526
+ ignoreRdfType: true,
527
+ propertySchema: NodeShape.schema.properties.label,
528
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($stringFromRdfResourceValues)),
529
+ }),
530
+ languageIn: $shaclPropertyFromRdf({
531
+ ...options,
532
+ focusResource: resource,
533
+ ignoreRdfType: true,
534
+ propertySchema: NodeShape.schema.properties.languageIn,
535
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues($listFromRdfResourceValues(($stringFromRdfResourceValues))),
536
+ }),
537
+ maxExclusive: $shaclPropertyFromRdf({
538
+ ...options,
539
+ focusResource: resource,
540
+ ignoreRdfType: true,
541
+ propertySchema: NodeShape.schema.properties.maxExclusive,
542
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues($literalFromRdfResourceValues),
543
+ }),
544
+ maxInclusive: $shaclPropertyFromRdf({
545
+ ...options,
546
+ focusResource: resource,
547
+ ignoreRdfType: true,
548
+ propertySchema: NodeShape.schema.properties.maxInclusive,
549
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues($literalFromRdfResourceValues),
550
+ }),
551
+ maxLength: $shaclPropertyFromRdf({
552
+ ...options,
553
+ focusResource: resource,
554
+ ignoreRdfType: true,
555
+ propertySchema: NodeShape.schema.properties.maxLength,
556
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($bigIntFromRdfResourceValues)),
557
+ }),
558
+ message: $shaclPropertyFromRdf({
559
+ ...options,
560
+ focusResource: resource,
561
+ ignoreRdfType: true,
562
+ propertySchema: NodeShape.schema.properties.message,
563
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($stringFromRdfResourceValues)),
564
+ }),
565
+ minExclusive: $shaclPropertyFromRdf({
566
+ ...options,
567
+ focusResource: resource,
568
+ ignoreRdfType: true,
569
+ propertySchema: NodeShape.schema.properties.minExclusive,
570
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues($literalFromRdfResourceValues),
571
+ }),
572
+ minInclusive: $shaclPropertyFromRdf({
573
+ ...options,
574
+ focusResource: resource,
575
+ ignoreRdfType: true,
576
+ propertySchema: NodeShape.schema.properties.minInclusive,
577
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues($literalFromRdfResourceValues),
578
+ }),
579
+ minLength: $shaclPropertyFromRdf({
580
+ ...options,
581
+ focusResource: resource,
582
+ ignoreRdfType: true,
583
+ propertySchema: NodeShape.schema.properties.minLength,
584
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($bigIntFromRdfResourceValues)),
585
+ }),
586
+ node: $shaclPropertyFromRdf({
587
+ ...options,
588
+ focusResource: resource,
589
+ ignoreRdfType: true,
590
+ propertySchema: NodeShape.schema.properties.node,
591
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues($identifierFromRdfResourceValues),
592
+ }),
593
+ nodeKind: $shaclPropertyFromRdf({
594
+ ...options,
595
+ focusResource: resource,
596
+ ignoreRdfType: true,
597
+ propertySchema: NodeShape.schema.properties.nodeKind,
598
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($iriFromRdfResourceValues)),
599
+ }),
600
+ not: $shaclPropertyFromRdf({
601
+ ...options,
602
+ focusResource: resource,
603
+ ignoreRdfType: true,
604
+ propertySchema: NodeShape.schema.properties.not,
605
+ typeFromRdfResourceValues: $setFromRdfResourceValues($identifierFromRdfResourceValues),
606
+ }),
607
+ or: $shaclPropertyFromRdf({
608
+ ...options,
609
+ focusResource: resource,
610
+ ignoreRdfType: true,
611
+ propertySchema: NodeShape.schema.properties.or,
612
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues($listFromRdfResourceValues($identifierFromRdfResourceValues)),
613
+ }),
614
+ pattern: $shaclPropertyFromRdf({
615
+ ...options,
616
+ focusResource: resource,
617
+ ignoreRdfType: true,
618
+ propertySchema: NodeShape.schema.properties.pattern,
619
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($stringFromRdfResourceValues)),
620
+ }),
621
+ properties: $shaclPropertyFromRdf({
622
+ ...options,
623
+ focusResource: resource,
624
+ ignoreRdfType: true,
625
+ propertySchema: NodeShape.schema.properties.properties,
626
+ typeFromRdfResourceValues: $setFromRdfResourceValues($identifierFromRdfResourceValues),
627
+ }),
628
+ severity: $shaclPropertyFromRdf({
629
+ ...options,
630
+ focusResource: resource,
631
+ ignoreRdfType: true,
632
+ propertySchema: NodeShape.schema.properties.severity,
633
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($iriFromRdfResourceValues)),
634
+ }),
635
+ subClassOf: $shaclPropertyFromRdf({
636
+ ...options,
637
+ focusResource: resource,
638
+ ignoreRdfType: true,
639
+ propertySchema: NodeShape.schema.properties.subClassOf,
640
+ typeFromRdfResourceValues: $setFromRdfResourceValues(($iriFromRdfResourceValues)),
641
+ }),
642
+ targetClasses: $shaclPropertyFromRdf({
643
+ ...options,
644
+ focusResource: resource,
645
+ ignoreRdfType: true,
646
+ propertySchema: NodeShape.schema.properties.targetClasses,
647
+ typeFromRdfResourceValues: $setFromRdfResourceValues(($iriFromRdfResourceValues)),
648
+ }),
649
+ targetNodes: $shaclPropertyFromRdf({
650
+ ...options,
651
+ focusResource: resource,
652
+ ignoreRdfType: true,
653
+ propertySchema: NodeShape.schema.properties.targetNodes,
654
+ typeFromRdfResourceValues: $setFromRdfResourceValues(($termFromRdfResourceValues)),
655
+ }),
656
+ targetObjectsOf: $shaclPropertyFromRdf({
657
+ ...options,
658
+ focusResource: resource,
659
+ ignoreRdfType: true,
660
+ propertySchema: NodeShape.schema.properties.targetObjectsOf,
661
+ typeFromRdfResourceValues: $setFromRdfResourceValues(($iriFromRdfResourceValues)),
662
+ }),
663
+ targetSubjectsOf: $shaclPropertyFromRdf({
664
+ ...options,
665
+ focusResource: resource,
666
+ ignoreRdfType: true,
667
+ propertySchema: NodeShape.schema.properties.targetSubjectsOf,
668
+ typeFromRdfResourceValues: $setFromRdfResourceValues(($iriFromRdfResourceValues)),
669
+ }),
670
+ types: $shaclPropertyFromRdf({
671
+ ...options,
672
+ focusResource: resource,
673
+ ignoreRdfType: true,
674
+ propertySchema: NodeShape.schema.properties.types,
675
+ typeFromRdfResourceValues: $setFromRdfResourceValues(($iriFromRdfResourceValues)),
676
+ }),
677
+ xone: $shaclPropertyFromRdf({
678
+ ...options,
679
+ focusResource: resource,
680
+ ignoreRdfType: true,
681
+ propertySchema: NodeShape.schema.properties.xone,
682
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues($listFromRdfResourceValues($identifierFromRdfResourceValues)),
683
+ }),
684
+ }).chain((properties) => NodeShape.create(properties)));
685
+ NodeShape.fromRdfResource = $wrap_FromRdfResourceFunction(NodeShape._fromRdfResource);
686
+ NodeShape.fromRdfResourceValues = (values, options) => values.chainMap((value) => value
687
+ .toResource()
688
+ .chain((resource) => NodeShape.fromRdfResource(resource, options)));
689
+ let Identifier;
690
+ (function (Identifier) {
691
+ Identifier.parse = $parseIdentifier;
692
+ Identifier.stringify = NTriplesTerm.stringify;
693
+ })(Identifier = NodeShape.Identifier || (NodeShape.Identifier = {}));
694
+ function isNodeShape(object) {
695
+ return object.$type === "NodeShape";
696
+ }
697
+ NodeShape.isNodeShape = isNodeShape;
698
+ NodeShape.schema = {
699
+ fromRdfType: dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape"),
700
+ properties: {
701
+ $identifier: {
702
+ kind: "Identifier",
703
+ type: { kind: "Identifier" },
704
+ },
705
+ and: {
706
+ kind: "Shacl",
707
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#and"),
708
+ type: {
709
+ kind: "Option",
710
+ itemType: {
711
+ kind: "List",
712
+ itemType: { kind: "Identifier" },
713
+ },
714
+ },
715
+ },
716
+ classes: {
717
+ kind: "Shacl",
718
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#class"),
719
+ type: { kind: "Set", itemType: { kind: "Iri" } },
720
+ },
721
+ closed: {
722
+ kind: "Shacl",
723
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#closed"),
724
+ type: {
725
+ kind: "Option",
726
+ itemType: { kind: "Boolean" },
727
+ },
728
+ },
729
+ comment: {
730
+ kind: "Shacl",
731
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
732
+ type: {
733
+ kind: "Option",
734
+ itemType: { kind: "String" },
735
+ },
736
+ },
737
+ datatype: {
738
+ kind: "Shacl",
739
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#datatype"),
740
+ type: { kind: "Option", itemType: { kind: "Iri" } },
741
+ },
742
+ deactivated: {
743
+ kind: "Shacl",
744
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"),
745
+ type: {
746
+ kind: "Option",
747
+ itemType: { kind: "Boolean" },
748
+ },
749
+ },
750
+ flags: {
751
+ kind: "Shacl",
752
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#flags"),
753
+ type: {
754
+ kind: "Option",
755
+ itemType: { kind: "String" },
756
+ },
757
+ },
758
+ hasValues: {
759
+ kind: "Shacl",
760
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#hasValue"),
761
+ type: {
762
+ kind: "Set",
763
+ itemType: { kind: "Term", types: ["NamedNode", "Literal"] },
764
+ },
765
+ },
766
+ ignoredProperties: {
767
+ kind: "Shacl",
768
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#ignoredProperties"),
769
+ type: {
770
+ kind: "Option",
771
+ itemType: {
772
+ kind: "List",
773
+ itemType: { kind: "Iri" },
774
+ },
775
+ },
776
+ },
777
+ in_: {
778
+ kind: "Shacl",
779
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#in"),
780
+ type: {
781
+ kind: "Option",
782
+ itemType: {
783
+ kind: "List",
784
+ itemType: {
785
+ kind: "Term",
786
+ types: ["NamedNode", "Literal"],
787
+ },
788
+ },
789
+ },
790
+ },
791
+ isDefinedBy: {
792
+ kind: "Shacl",
793
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"),
794
+ type: {
795
+ kind: "Option",
796
+ itemType: { kind: "Identifier" },
797
+ },
798
+ },
799
+ label: {
800
+ kind: "Shacl",
801
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
802
+ type: {
803
+ kind: "Option",
804
+ itemType: { kind: "String" },
805
+ },
806
+ },
807
+ languageIn: {
808
+ kind: "Shacl",
809
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#languageIn"),
810
+ type: {
811
+ kind: "Option",
812
+ itemType: {
813
+ kind: "List",
814
+ itemType: { kind: "String" },
815
+ },
816
+ },
817
+ },
818
+ maxExclusive: {
819
+ kind: "Shacl",
820
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxExclusive"),
821
+ type: {
822
+ kind: "Option",
823
+ itemType: { kind: "Literal" },
824
+ },
825
+ },
826
+ maxInclusive: {
827
+ kind: "Shacl",
828
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxInclusive"),
829
+ type: {
830
+ kind: "Option",
831
+ itemType: { kind: "Literal" },
832
+ },
833
+ },
834
+ maxLength: {
835
+ kind: "Shacl",
836
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxLength"),
837
+ type: {
838
+ kind: "Option",
839
+ itemType: { kind: "BigInt" },
840
+ },
841
+ },
842
+ message: {
843
+ kind: "Shacl",
844
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#message"),
845
+ type: {
846
+ kind: "Option",
847
+ itemType: { kind: "String" },
848
+ },
849
+ },
850
+ minExclusive: {
851
+ kind: "Shacl",
852
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minExclusive"),
853
+ type: {
854
+ kind: "Option",
855
+ itemType: { kind: "Literal" },
856
+ },
857
+ },
858
+ minInclusive: {
859
+ kind: "Shacl",
860
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minInclusive"),
861
+ type: {
862
+ kind: "Option",
863
+ itemType: { kind: "Literal" },
864
+ },
865
+ },
866
+ minLength: {
867
+ kind: "Shacl",
868
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minLength"),
869
+ type: {
870
+ kind: "Option",
871
+ itemType: { kind: "BigInt" },
872
+ },
873
+ },
874
+ node: {
875
+ kind: "Shacl",
876
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#node"),
877
+ type: {
878
+ kind: "Option",
879
+ itemType: { kind: "Identifier" },
880
+ },
881
+ },
882
+ nodeKind: {
883
+ kind: "Shacl",
884
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"),
885
+ type: {
886
+ kind: "Option",
887
+ itemType: {
888
+ kind: "Iri",
889
+ in: [
890
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNode"),
891
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrIRI"),
892
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrLiteral"),
893
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#IRI"),
894
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#IRIOrLiteral"),
895
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Literal"),
896
+ ],
897
+ },
898
+ },
899
+ },
900
+ not: {
901
+ kind: "Shacl",
902
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#not"),
903
+ type: {
904
+ kind: "Set",
905
+ itemType: { kind: "Identifier" },
906
+ },
907
+ },
908
+ or: {
909
+ kind: "Shacl",
910
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#or"),
911
+ type: {
912
+ kind: "Option",
913
+ itemType: {
914
+ kind: "List",
915
+ itemType: { kind: "Identifier" },
916
+ },
917
+ },
918
+ },
919
+ pattern: {
920
+ kind: "Shacl",
921
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#pattern"),
922
+ type: {
923
+ kind: "Option",
924
+ itemType: { kind: "String" },
925
+ },
926
+ },
927
+ properties: {
928
+ kind: "Shacl",
929
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#property"),
930
+ type: {
931
+ kind: "Set",
932
+ itemType: { kind: "Identifier" },
933
+ },
934
+ },
935
+ severity: {
936
+ kind: "Shacl",
937
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#severity"),
938
+ get type() {
939
+ return {
940
+ kind: "Option",
941
+ get itemType() {
942
+ return {
943
+ kind: "Iri",
944
+ in: [
945
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Info"),
946
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Warning"),
947
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Violation"),
948
+ ],
949
+ };
950
+ },
951
+ };
952
+ },
953
+ },
954
+ subClassOf: {
955
+ kind: "Shacl",
956
+ path: $RdfVocabularies.rdfs.subClassOf,
957
+ type: { kind: "Set", itemType: { kind: "Iri" } },
958
+ },
959
+ targetClasses: {
960
+ kind: "Shacl",
961
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#targetClass"),
962
+ type: { kind: "Set", itemType: { kind: "Iri" } },
963
+ },
964
+ targetNodes: {
965
+ kind: "Shacl",
966
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#targetNode"),
967
+ type: {
968
+ kind: "Set",
969
+ itemType: { kind: "Term", types: ["NamedNode", "Literal"] },
970
+ },
971
+ },
972
+ targetObjectsOf: {
973
+ kind: "Shacl",
974
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#targetObjectsOf"),
975
+ type: { kind: "Set", itemType: { kind: "Iri" } },
976
+ },
977
+ targetSubjectsOf: {
978
+ kind: "Shacl",
979
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#targetSubjectsOf"),
980
+ type: { kind: "Set", itemType: { kind: "Iri" } },
981
+ },
982
+ types: {
983
+ kind: "Shacl",
984
+ path: $RdfVocabularies.rdf.type,
985
+ type: { kind: "Set", itemType: { kind: "Iri" } },
986
+ },
987
+ xone: {
988
+ kind: "Shacl",
989
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#xone"),
990
+ type: {
991
+ kind: "Option",
992
+ itemType: {
993
+ kind: "List",
994
+ itemType: { kind: "Identifier" },
995
+ },
996
+ },
997
+ },
998
+ },
999
+ toRdfTypes: [dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape")],
1000
+ };
1001
+ NodeShape._toRdfResource = (parameters) => {
1002
+ if (!parameters.ignoreRdfType) {
1003
+ parameters.resource.add($RdfVocabularies.rdf.type, NodeShape.schema.toRdfTypes, parameters.graph);
1004
+ }
1005
+ parameters.resource.add(NodeShape.schema.properties.and.path, parameters.object.and.toList().flatMap((value) => [
1006
+ value.length > 0
1007
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
1008
+ if (itemIndex === 0) {
1009
+ currentSubListResource = listResource;
1010
+ }
1011
+ else {
1012
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
1013
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
1014
+ currentSubListResource = newSubListResource;
1015
+ }
1016
+ currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
1017
+ if (itemIndex + 1 === list.length) {
1018
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
1019
+ }
1020
+ return { currentSubListResource, listResource };
1021
+ }, {
1022
+ currentSubListResource: null,
1023
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
1024
+ }).listResource.identifier
1025
+ : $RdfVocabularies.rdf.nil,
1026
+ ]), parameters.graph);
1027
+ parameters.resource.add(NodeShape.schema.properties.classes.path, parameters.object.classes.flatMap((item) => [item]), parameters.graph);
1028
+ parameters.resource.add(NodeShape.schema.properties.closed.path, parameters.object.closed
1029
+ .toList()
1030
+ .flatMap((value) => [
1031
+ $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
1032
+ ]), parameters.graph);
1033
+ parameters.resource.add(NodeShape.schema.properties.comment.path, parameters.object.comment
1034
+ .toList()
1035
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
1036
+ parameters.resource.add(NodeShape.schema.properties.datatype.path, parameters.object.datatype.toList(), parameters.graph);
1037
+ parameters.resource.add(NodeShape.schema.properties.deactivated.path, parameters.object.deactivated
1038
+ .toList()
1039
+ .flatMap((value) => [
1040
+ $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
1041
+ ]), parameters.graph);
1042
+ parameters.resource.add(NodeShape.schema.properties.flags.path, parameters.object.flags
1043
+ .toList()
1044
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
1045
+ parameters.resource.add(NodeShape.schema.properties.hasValues.path, parameters.object.hasValues.flatMap((item) => [item]), parameters.graph);
1046
+ parameters.resource.add(NodeShape.schema.properties.ignoredProperties.path, parameters.object.ignoredProperties.toList().flatMap((value) => [
1047
+ value.length > 0
1048
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
1049
+ if (itemIndex === 0) {
1050
+ currentSubListResource = listResource;
1051
+ }
1052
+ else {
1053
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
1054
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
1055
+ currentSubListResource = newSubListResource;
1056
+ }
1057
+ currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
1058
+ if (itemIndex + 1 === list.length) {
1059
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
1060
+ }
1061
+ return { currentSubListResource, listResource };
1062
+ }, {
1063
+ currentSubListResource: null,
1064
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
1065
+ }).listResource.identifier
1066
+ : $RdfVocabularies.rdf.nil,
1067
+ ]), parameters.graph);
1068
+ parameters.resource.add(NodeShape.schema.properties.in_.path, parameters.object.in_.toList().flatMap((value) => [
1069
+ value.length > 0
1070
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
1071
+ if (itemIndex === 0) {
1072
+ currentSubListResource = listResource;
1073
+ }
1074
+ else {
1075
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
1076
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
1077
+ currentSubListResource = newSubListResource;
1078
+ }
1079
+ currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
1080
+ if (itemIndex + 1 === list.length) {
1081
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
1082
+ }
1083
+ return { currentSubListResource, listResource };
1084
+ }, {
1085
+ currentSubListResource: null,
1086
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
1087
+ }).listResource.identifier
1088
+ : $RdfVocabularies.rdf.nil,
1089
+ ]), parameters.graph);
1090
+ parameters.resource.add(NodeShape.schema.properties.isDefinedBy.path, parameters.object.isDefinedBy.toList(), parameters.graph);
1091
+ parameters.resource.add(NodeShape.schema.properties.label.path, parameters.object.label
1092
+ .toList()
1093
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
1094
+ parameters.resource.add(NodeShape.schema.properties.languageIn.path, parameters.object.languageIn.toList().flatMap((value) => [
1095
+ value.length > 0
1096
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
1097
+ if (itemIndex === 0) {
1098
+ currentSubListResource = listResource;
1099
+ }
1100
+ else {
1101
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
1102
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
1103
+ currentSubListResource = newSubListResource;
1104
+ }
1105
+ currentSubListResource.add($RdfVocabularies.rdf.first, [$literalFactory.string(item)], parameters.graph);
1106
+ if (itemIndex + 1 === list.length) {
1107
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
1108
+ }
1109
+ return { currentSubListResource, listResource };
1110
+ }, {
1111
+ currentSubListResource: null,
1112
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
1113
+ }).listResource.identifier
1114
+ : $RdfVocabularies.rdf.nil,
1115
+ ]), parameters.graph);
1116
+ parameters.resource.add(NodeShape.schema.properties.maxExclusive.path, parameters.object.maxExclusive.toList(), parameters.graph);
1117
+ parameters.resource.add(NodeShape.schema.properties.maxInclusive.path, parameters.object.maxInclusive.toList(), parameters.graph);
1118
+ parameters.resource.add(NodeShape.schema.properties.maxLength.path, parameters.object.maxLength
1119
+ .toList()
1120
+ .flatMap((value) => [
1121
+ $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
1122
+ ]), parameters.graph);
1123
+ parameters.resource.add(NodeShape.schema.properties.message.path, parameters.object.message
1124
+ .toList()
1125
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
1126
+ parameters.resource.add(NodeShape.schema.properties.minExclusive.path, parameters.object.minExclusive.toList(), parameters.graph);
1127
+ parameters.resource.add(NodeShape.schema.properties.minInclusive.path, parameters.object.minInclusive.toList(), parameters.graph);
1128
+ parameters.resource.add(NodeShape.schema.properties.minLength.path, parameters.object.minLength
1129
+ .toList()
1130
+ .flatMap((value) => [
1131
+ $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
1132
+ ]), parameters.graph);
1133
+ parameters.resource.add(NodeShape.schema.properties.node.path, parameters.object.node.toList(), parameters.graph);
1134
+ parameters.resource.add(NodeShape.schema.properties.nodeKind.path, parameters.object.nodeKind.toList(), parameters.graph);
1135
+ parameters.resource.add(NodeShape.schema.properties.not.path, parameters.object.not.flatMap((item) => [item]), parameters.graph);
1136
+ parameters.resource.add(NodeShape.schema.properties.or.path, parameters.object.or.toList().flatMap((value) => [
1137
+ value.length > 0
1138
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
1139
+ if (itemIndex === 0) {
1140
+ currentSubListResource = listResource;
1141
+ }
1142
+ else {
1143
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
1144
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
1145
+ currentSubListResource = newSubListResource;
1146
+ }
1147
+ currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
1148
+ if (itemIndex + 1 === list.length) {
1149
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
1150
+ }
1151
+ return { currentSubListResource, listResource };
1152
+ }, {
1153
+ currentSubListResource: null,
1154
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
1155
+ }).listResource.identifier
1156
+ : $RdfVocabularies.rdf.nil,
1157
+ ]), parameters.graph);
1158
+ parameters.resource.add(NodeShape.schema.properties.pattern.path, parameters.object.pattern
1159
+ .toList()
1160
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
1161
+ parameters.resource.add(NodeShape.schema.properties.properties.path, parameters.object.properties.flatMap((item) => [item]), parameters.graph);
1162
+ parameters.resource.add(NodeShape.schema.properties.severity.path, parameters.object.severity.toList(), parameters.graph);
1163
+ parameters.resource.add(NodeShape.schema.properties.subClassOf.path, parameters.object.subClassOf.flatMap((item) => [item]), parameters.graph);
1164
+ parameters.resource.add(NodeShape.schema.properties.targetClasses.path, parameters.object.targetClasses.flatMap((item) => [item]), parameters.graph);
1165
+ parameters.resource.add(NodeShape.schema.properties.targetNodes.path, parameters.object.targetNodes.flatMap((item) => [item]), parameters.graph);
1166
+ parameters.resource.add(NodeShape.schema.properties.targetObjectsOf.path, parameters.object.targetObjectsOf.flatMap((item) => [item]), parameters.graph);
1167
+ parameters.resource.add(NodeShape.schema.properties.targetSubjectsOf.path, parameters.object.targetSubjectsOf.flatMap((item) => [item]), parameters.graph);
1168
+ parameters.resource.add(NodeShape.schema.properties.types.path, parameters.object.types.flatMap((item) => [item]), parameters.graph);
1169
+ parameters.resource.add(NodeShape.schema.properties.xone.path, parameters.object.xone.toList().flatMap((value) => [
1170
+ value.length > 0
1171
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
1172
+ if (itemIndex === 0) {
1173
+ currentSubListResource = listResource;
1174
+ }
1175
+ else {
1176
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
1177
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
1178
+ currentSubListResource = newSubListResource;
1179
+ }
1180
+ currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
1181
+ if (itemIndex + 1 === list.length) {
1182
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
1183
+ }
1184
+ return { currentSubListResource, listResource };
1185
+ }, {
1186
+ currentSubListResource: null,
1187
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
1188
+ }).listResource.identifier
1189
+ : $RdfVocabularies.rdf.nil,
1190
+ ]), parameters.graph);
1191
+ return parameters.resource;
1192
+ };
1193
+ NodeShape.toRdfResource = $wrap_ToRdfResourceFunction(NodeShape._toRdfResource);
1194
+ NodeShape.$toString = (_nodeShape) => `NodeShape(${JSON.stringify(NodeShape.toStringRecord(_nodeShape))})`;
1195
+ NodeShape.toStringRecord = (_nodeShape) => $compactRecord({
1196
+ $identifier: _nodeShape.$identifier().toString(),
1197
+ label: _nodeShape.label.map((item) => item.toString()).extract(),
1198
+ });
1199
+ })(NodeShape || (NodeShape = {}));
1200
+ export var Ontology;
1201
+ (function (Ontology) {
1202
+ Ontology.create = (parameters) => $sequenceRecord({
1203
+ $identifier: $convertToIdentifierProperty(parameters?.$identifier),
1204
+ comment: $convertToMaybe($identityConversionFunction)(parameters?.comment).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.comment.type, value)),
1205
+ label: $convertToMaybe($identityConversionFunction)(parameters?.label).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.label.type, value)),
1206
+ })
1207
+ .map((properties) => ({ ...properties, $type: "Ontology" }))
1208
+ .map((object) => $monkeyPatchObject(object, { $toString: Ontology.$toString }));
1209
+ function createUnsafe(parameters) {
1210
+ return Ontology.create(parameters).unsafeCoerce();
1211
+ }
1212
+ Ontology.createUnsafe = createUnsafe;
1213
+ Ontology._fromRdfResource = (resource, options) => (!options.ignoreRdfType
1214
+ ? $ensureRdfResourceType(resource, [Ontology.schema.fromRdfType], {
1215
+ graph: options.graph,
1216
+ })
1217
+ : Right(true)).chain((_rdfTypeCheck) => $sequenceRecord({
1218
+ $identifier: $identifierFromRdfResourceValues($rdfResourceIdentifierValues(resource), {
1219
+ ...options,
1220
+ focusResource: resource,
1221
+ propertyPath: $RdfVocabularies.rdf.subject,
1222
+ schema: Ontology.schema.properties.$identifier.type,
1223
+ }).chain((values) => values.head()),
1224
+ comment: $shaclPropertyFromRdf({
1225
+ ...options,
1226
+ focusResource: resource,
1227
+ ignoreRdfType: true,
1228
+ propertySchema: NodeShape.schema.properties.comment,
1229
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($stringFromRdfResourceValues)),
1230
+ }),
1231
+ label: $shaclPropertyFromRdf({
1232
+ ...options,
1233
+ focusResource: resource,
1234
+ ignoreRdfType: true,
1235
+ propertySchema: NodeShape.schema.properties.label,
1236
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($stringFromRdfResourceValues)),
1237
+ }),
1238
+ }).chain((properties) => Ontology.create(properties)));
1239
+ Ontology.fromRdfResource = $wrap_FromRdfResourceFunction(Ontology._fromRdfResource);
1240
+ Ontology.fromRdfResourceValues = (values, options) => values.chainMap((value) => value
1241
+ .toResource()
1242
+ .chain((resource) => Ontology.fromRdfResource(resource, options)));
1243
+ let Identifier;
1244
+ (function (Identifier) {
1245
+ Identifier.parse = $parseIdentifier;
1246
+ Identifier.stringify = NTriplesTerm.stringify;
1247
+ })(Identifier = Ontology.Identifier || (Ontology.Identifier = {}));
1248
+ function isOntology(object) {
1249
+ return object.$type === "Ontology";
1250
+ }
1251
+ Ontology.isOntology = isOntology;
1252
+ Ontology.schema = {
1253
+ fromRdfType: dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"),
1254
+ properties: {
1255
+ $identifier: {
1256
+ kind: "Identifier",
1257
+ type: { kind: "Identifier" },
1258
+ },
1259
+ comment: {
1260
+ kind: "Shacl",
1261
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
1262
+ type: {
1263
+ kind: "Option",
1264
+ itemType: { kind: "String" },
1265
+ },
1266
+ },
1267
+ label: {
1268
+ kind: "Shacl",
1269
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
1270
+ type: {
1271
+ kind: "Option",
1272
+ itemType: { kind: "String" },
1273
+ },
1274
+ },
1275
+ },
1276
+ toRdfTypes: [
1277
+ dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"),
1278
+ ],
1279
+ };
1280
+ Ontology._toRdfResource = (parameters) => {
1281
+ if (!parameters.ignoreRdfType) {
1282
+ parameters.resource.add($RdfVocabularies.rdf.type, Ontology.schema.toRdfTypes, parameters.graph);
1283
+ }
1284
+ parameters.resource.add(NodeShape.schema.properties.comment.path, parameters.object.comment
1285
+ .toList()
1286
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
1287
+ parameters.resource.add(NodeShape.schema.properties.label.path, parameters.object.label
1288
+ .toList()
1289
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
1290
+ return parameters.resource;
1291
+ };
1292
+ Ontology.toRdfResource = $wrap_ToRdfResourceFunction(Ontology._toRdfResource);
1293
+ Ontology.$toString = (_ontology) => `Ontology(${JSON.stringify(Ontology.toStringRecord(_ontology))})`;
1294
+ Ontology.toStringRecord = (_ontology) => $compactRecord({
1295
+ $identifier: _ontology.$identifier().toString(),
1296
+ label: _ontology.label.map((item) => item.toString()).extract(),
1297
+ });
1298
+ })(Ontology || (Ontology = {}));
1299
+ export var PropertyGroup;
1300
+ (function (PropertyGroup) {
1301
+ PropertyGroup.create = (parameters) => $sequenceRecord({
1302
+ $identifier: $convertToIdentifierProperty(parameters?.$identifier),
1303
+ comment: $convertToMaybe($identityConversionFunction)(parameters?.comment).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.comment.type, value)),
1304
+ label: $convertToMaybe($identityConversionFunction)(parameters?.label).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.label.type, value)),
1305
+ })
1306
+ .map((properties) => ({ ...properties, $type: "PropertyGroup" }))
1307
+ .map((object) => $monkeyPatchObject(object, { $toString: PropertyGroup.$toString }));
1308
+ function createUnsafe(parameters) {
1309
+ return PropertyGroup.create(parameters).unsafeCoerce();
1310
+ }
1311
+ PropertyGroup.createUnsafe = createUnsafe;
1312
+ PropertyGroup._fromRdfResource = (resource, options) => (!options.ignoreRdfType
1313
+ ? $ensureRdfResourceType(resource, [PropertyGroup.schema.fromRdfType], {
1314
+ graph: options.graph,
1315
+ })
1316
+ : Right(true)).chain((_rdfTypeCheck) => $sequenceRecord({
1317
+ $identifier: $identifierFromRdfResourceValues($rdfResourceIdentifierValues(resource), {
1318
+ ...options,
1319
+ focusResource: resource,
1320
+ propertyPath: $RdfVocabularies.rdf.subject,
1321
+ schema: PropertyGroup.schema.properties.$identifier.type,
1322
+ }).chain((values) => values.head()),
1323
+ comment: $shaclPropertyFromRdf({
1324
+ ...options,
1325
+ focusResource: resource,
1326
+ ignoreRdfType: true,
1327
+ propertySchema: NodeShape.schema.properties.comment,
1328
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($stringFromRdfResourceValues)),
1329
+ }),
1330
+ label: $shaclPropertyFromRdf({
1331
+ ...options,
1332
+ focusResource: resource,
1333
+ ignoreRdfType: true,
1334
+ propertySchema: NodeShape.schema.properties.label,
1335
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($stringFromRdfResourceValues)),
1336
+ }),
1337
+ }).chain((properties) => PropertyGroup.create(properties)));
1338
+ PropertyGroup.fromRdfResource = $wrap_FromRdfResourceFunction(PropertyGroup._fromRdfResource);
1339
+ PropertyGroup.fromRdfResourceValues = (values, options) => values.chainMap((value) => value
1340
+ .toResource()
1341
+ .chain((resource) => PropertyGroup.fromRdfResource(resource, options)));
1342
+ let Identifier;
1343
+ (function (Identifier) {
1344
+ Identifier.parse = $parseIdentifier;
1345
+ Identifier.stringify = NTriplesTerm.stringify;
1346
+ })(Identifier = PropertyGroup.Identifier || (PropertyGroup.Identifier = {}));
1347
+ function isPropertyGroup(object) {
1348
+ return object.$type === "PropertyGroup";
1349
+ }
1350
+ PropertyGroup.isPropertyGroup = isPropertyGroup;
1351
+ PropertyGroup.schema = {
1352
+ fromRdfType: dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup"),
1353
+ properties: {
1354
+ $identifier: {
1355
+ kind: "Identifier",
1356
+ type: { kind: "Identifier" },
1357
+ },
1358
+ comment: {
1359
+ kind: "Shacl",
1360
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
1361
+ type: {
1362
+ kind: "Option",
1363
+ itemType: { kind: "String" },
1364
+ },
1365
+ },
1366
+ label: {
1367
+ kind: "Shacl",
1368
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
1369
+ type: {
1370
+ kind: "Option",
1371
+ itemType: { kind: "String" },
1372
+ },
1373
+ },
1374
+ },
1375
+ toRdfTypes: [
1376
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup"),
1377
+ ],
1378
+ };
1379
+ PropertyGroup._toRdfResource = (parameters) => {
1380
+ if (!parameters.ignoreRdfType) {
1381
+ parameters.resource.add($RdfVocabularies.rdf.type, PropertyGroup.schema.toRdfTypes, parameters.graph);
1382
+ }
1383
+ parameters.resource.add(NodeShape.schema.properties.comment.path, parameters.object.comment
1384
+ .toList()
1385
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
1386
+ parameters.resource.add(NodeShape.schema.properties.label.path, parameters.object.label
1387
+ .toList()
1388
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
1389
+ return parameters.resource;
1390
+ };
1391
+ PropertyGroup.toRdfResource = $wrap_ToRdfResourceFunction(PropertyGroup._toRdfResource);
1392
+ PropertyGroup.$toString = (_propertyGroup) => `PropertyGroup(${JSON.stringify(PropertyGroup.toStringRecord(_propertyGroup))})`;
1393
+ PropertyGroup.toStringRecord = (_propertyGroup) => $compactRecord({
1394
+ $identifier: _propertyGroup.$identifier().toString(),
1395
+ label: _propertyGroup.label.map((item) => item.toString()).extract(),
1396
+ });
1397
+ })(PropertyGroup || (PropertyGroup = {}));
1398
+ export var PropertyShape;
1399
+ (function (PropertyShape) {
1400
+ PropertyShape.create = (parameters) => $sequenceRecord({
1401
+ $identifier: $convertToIdentifierProperty(parameters.$identifier),
1402
+ and: $convertToMaybe($convertToList($convertToIdentifier, true))(parameters.and).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(NodeShape.schema.properties.and.type, value)),
1403
+ classes: $convertToScalarSet(($convertToIri), true)(parameters.classes).chain((value) => $validateArray($identityValidationFunction, true)(NodeShape.schema.properties.classes.type, value)),
1404
+ comment: $convertToMaybe($identityConversionFunction)(parameters.comment).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.comment.type, value)),
1405
+ datatype: $convertToMaybe(($convertToIri))(parameters.datatype).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.datatype.type, value)),
1406
+ deactivated: $convertToMaybe($identityConversionFunction)(parameters.deactivated).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.deactivated.type, value)),
1407
+ defaultValue: $convertToMaybe($identityConversionFunction)(parameters.defaultValue).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.defaultValue.type, value)),
1408
+ description: $convertToMaybe($identityConversionFunction)(parameters.description).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.description.type, value)),
1409
+ disjoint: $convertToScalarSet(($convertToIri), true)(parameters.disjoint).chain((value) => $validateArray($identityValidationFunction, true)(PropertyShape.schema.properties.disjoint.type, value)),
1410
+ equals: $convertToScalarSet(($convertToIri), true)(parameters.equals).chain((value) => $validateArray($identityValidationFunction, true)(PropertyShape.schema.properties.equals.type, value)),
1411
+ flags: $convertToMaybe($identityConversionFunction)(parameters.flags).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.flags.type, value)),
1412
+ groups: $convertToScalarSet($convertToIdentifier, true)(parameters.groups).chain((value) => $validateArray($identityValidationFunction, true)(PropertyShape.schema.properties.groups.type, value)),
1413
+ hasValues: $convertToScalarSet($identityConversionFunction, true)(parameters.hasValues).chain((value) => $validateArray($identityValidationFunction, true)(NodeShape.schema.properties.hasValues.type, value)),
1414
+ in_: $convertToMaybe($convertToList($identityConversionFunction, true))(parameters.in_).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(NodeShape.schema.properties.in_.type, value)),
1415
+ isDefinedBy: $convertToMaybe($convertToIdentifier)(parameters.isDefinedBy).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.isDefinedBy.type, value)),
1416
+ label: $convertToMaybe($identityConversionFunction)(parameters.label).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.label.type, value)),
1417
+ languageIn: $convertToMaybe($convertToList($identityConversionFunction, true))(parameters.languageIn).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(NodeShape.schema.properties.languageIn.type, value)),
1418
+ lessThan: $convertToScalarSet(($convertToIri), true)(parameters.lessThan).chain((value) => $validateArray($identityValidationFunction, true)(PropertyShape.schema.properties.lessThan.type, value)),
1419
+ lessThanOrEquals: $convertToScalarSet(($convertToIri), true)(parameters.lessThanOrEquals).chain((value) => $validateArray($identityValidationFunction, true)(PropertyShape.schema.properties.lessThanOrEquals.type, value)),
1420
+ maxCount: $convertToMaybe($identityConversionFunction)(parameters.maxCount).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.maxCount.type, value)),
1421
+ maxExclusive: $convertToMaybe($convertToLiteral)(parameters.maxExclusive).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.maxExclusive.type, value)),
1422
+ maxInclusive: $convertToMaybe($convertToLiteral)(parameters.maxInclusive).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.maxInclusive.type, value)),
1423
+ maxLength: $convertToMaybe($identityConversionFunction)(parameters.maxLength).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.maxLength.type, value)),
1424
+ message: $convertToMaybe($identityConversionFunction)(parameters.message).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.message.type, value)),
1425
+ minCount: $convertToMaybe($identityConversionFunction)(parameters.minCount).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.minCount.type, value)),
1426
+ minExclusive: $convertToMaybe($convertToLiteral)(parameters.minExclusive).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.minExclusive.type, value)),
1427
+ minInclusive: $convertToMaybe($convertToLiteral)(parameters.minInclusive).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.minInclusive.type, value)),
1428
+ minLength: $convertToMaybe($identityConversionFunction)(parameters.minLength).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.minLength.type, value)),
1429
+ name: $convertToMaybe($identityConversionFunction)(parameters.name).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.name.type, value)),
1430
+ node: $convertToMaybe($convertToIdentifier)(parameters.node).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.node.type, value)),
1431
+ nodeKind: $convertToMaybe(($convertToIri))(parameters.nodeKind).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.nodeKind.type, value)),
1432
+ not: $convertToScalarSet($convertToIdentifier, true)(parameters.not).chain((value) => $validateArray($identityValidationFunction, true)(NodeShape.schema.properties.not.type, value)),
1433
+ or: $convertToMaybe($convertToList($convertToIdentifier, true))(parameters.or).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(NodeShape.schema.properties.or.type, value)),
1434
+ order: $convertToMaybe($identityConversionFunction)(parameters.order).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.order.type, value)),
1435
+ path: Either.of(parameters.path),
1436
+ pattern: $convertToMaybe($identityConversionFunction)(parameters.pattern).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.pattern.type, value)),
1437
+ qualifiedMaxCount: $convertToMaybe($identityConversionFunction)(parameters.qualifiedMaxCount).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.qualifiedMaxCount.type, value)),
1438
+ qualifiedMinCount: $convertToMaybe($identityConversionFunction)(parameters.qualifiedMinCount).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.qualifiedMinCount.type, value)),
1439
+ qualifiedValueShape: $convertToMaybe($convertToIdentifier)(parameters.qualifiedValueShape).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.qualifiedValueShape.type, value)),
1440
+ qualifiedValueShapesDisjoint: $convertToMaybe($identityConversionFunction)(parameters.qualifiedValueShapesDisjoint).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.qualifiedValueShapesDisjoint.type, value)),
1441
+ severity: $convertToMaybe(($convertToIri))(parameters.severity).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.severity.type, value)),
1442
+ targetClasses: $convertToScalarSet(($convertToIri), true)(parameters.targetClasses).chain((value) => $validateArray($identityValidationFunction, true)(NodeShape.schema.properties.targetClasses.type, value)),
1443
+ targetNodes: $convertToScalarSet($identityConversionFunction, true)(parameters.targetNodes).chain((value) => $validateArray($identityValidationFunction, true)(NodeShape.schema.properties.targetNodes.type, value)),
1444
+ targetObjectsOf: $convertToScalarSet(($convertToIri), true)(parameters.targetObjectsOf).chain((value) => $validateArray($identityValidationFunction, true)(NodeShape.schema.properties.targetObjectsOf.type, value)),
1445
+ targetSubjectsOf: $convertToScalarSet(($convertToIri), true)(parameters.targetSubjectsOf).chain((value) => $validateArray($identityValidationFunction, true)(NodeShape.schema.properties.targetSubjectsOf.type, value)),
1446
+ uniqueLang: $convertToMaybe($identityConversionFunction)(parameters.uniqueLang).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.uniqueLang.type, value)),
1447
+ xone: $convertToMaybe($convertToList($convertToIdentifier, true))(parameters.xone).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(NodeShape.schema.properties.xone.type, value)),
1448
+ })
1449
+ .map((properties) => ({ ...properties, $type: "PropertyShape" }))
1450
+ .map((object) => $monkeyPatchObject(object, { $toString: PropertyShape.$toString }));
1451
+ function createUnsafe(parameters) {
1452
+ return PropertyShape.create(parameters).unsafeCoerce();
1453
+ }
1454
+ PropertyShape.createUnsafe = createUnsafe;
1455
+ PropertyShape._fromRdfResource = (resource, options) => (!options.ignoreRdfType
1456
+ ? $ensureRdfResourceType(resource, [PropertyShape.schema.fromRdfType], {
1457
+ graph: options.graph,
1458
+ })
1459
+ : Right(true)).chain((_rdfTypeCheck) => $sequenceRecord({
1460
+ $identifier: $identifierFromRdfResourceValues($rdfResourceIdentifierValues(resource), {
1461
+ ...options,
1462
+ focusResource: resource,
1463
+ propertyPath: $RdfVocabularies.rdf.subject,
1464
+ schema: PropertyShape.schema.properties.$identifier.type,
1465
+ }).chain((values) => values.head()),
1466
+ and: $shaclPropertyFromRdf({
1467
+ ...options,
1468
+ focusResource: resource,
1469
+ ignoreRdfType: true,
1470
+ propertySchema: NodeShape.schema.properties.and,
1471
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues($listFromRdfResourceValues($identifierFromRdfResourceValues)),
1472
+ }),
1473
+ classes: $shaclPropertyFromRdf({
1474
+ ...options,
1475
+ focusResource: resource,
1476
+ ignoreRdfType: true,
1477
+ propertySchema: NodeShape.schema.properties.classes,
1478
+ typeFromRdfResourceValues: $setFromRdfResourceValues(($iriFromRdfResourceValues)),
1479
+ }),
1480
+ comment: $shaclPropertyFromRdf({
1481
+ ...options,
1482
+ focusResource: resource,
1483
+ ignoreRdfType: true,
1484
+ propertySchema: NodeShape.schema.properties.comment,
1485
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($stringFromRdfResourceValues)),
1486
+ }),
1487
+ datatype: $shaclPropertyFromRdf({
1488
+ ...options,
1489
+ focusResource: resource,
1490
+ ignoreRdfType: true,
1491
+ propertySchema: NodeShape.schema.properties.datatype,
1492
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($iriFromRdfResourceValues)),
1493
+ }),
1494
+ deactivated: $shaclPropertyFromRdf({
1495
+ ...options,
1496
+ focusResource: resource,
1497
+ ignoreRdfType: true,
1498
+ propertySchema: NodeShape.schema.properties.deactivated,
1499
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($booleanFromRdfResourceValues)),
1500
+ }),
1501
+ defaultValue: $shaclPropertyFromRdf({
1502
+ ...options,
1503
+ focusResource: resource,
1504
+ ignoreRdfType: true,
1505
+ propertySchema: PropertyShape.schema.properties.defaultValue,
1506
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($termFromRdfResourceValues)),
1507
+ }),
1508
+ description: $shaclPropertyFromRdf({
1509
+ ...options,
1510
+ focusResource: resource,
1511
+ ignoreRdfType: true,
1512
+ propertySchema: PropertyShape.schema.properties.description,
1513
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($stringFromRdfResourceValues)),
1514
+ }),
1515
+ disjoint: $shaclPropertyFromRdf({
1516
+ ...options,
1517
+ focusResource: resource,
1518
+ ignoreRdfType: true,
1519
+ propertySchema: PropertyShape.schema.properties.disjoint,
1520
+ typeFromRdfResourceValues: $setFromRdfResourceValues(($iriFromRdfResourceValues)),
1521
+ }),
1522
+ equals: $shaclPropertyFromRdf({
1523
+ ...options,
1524
+ focusResource: resource,
1525
+ ignoreRdfType: true,
1526
+ propertySchema: PropertyShape.schema.properties.equals,
1527
+ typeFromRdfResourceValues: $setFromRdfResourceValues(($iriFromRdfResourceValues)),
1528
+ }),
1529
+ flags: $shaclPropertyFromRdf({
1530
+ ...options,
1531
+ focusResource: resource,
1532
+ ignoreRdfType: true,
1533
+ propertySchema: NodeShape.schema.properties.flags,
1534
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($stringFromRdfResourceValues)),
1535
+ }),
1536
+ groups: $shaclPropertyFromRdf({
1537
+ ...options,
1538
+ focusResource: resource,
1539
+ ignoreRdfType: true,
1540
+ propertySchema: PropertyShape.schema.properties.groups,
1541
+ typeFromRdfResourceValues: $setFromRdfResourceValues($identifierFromRdfResourceValues),
1542
+ }),
1543
+ hasValues: $shaclPropertyFromRdf({
1544
+ ...options,
1545
+ focusResource: resource,
1546
+ ignoreRdfType: true,
1547
+ propertySchema: NodeShape.schema.properties.hasValues,
1548
+ typeFromRdfResourceValues: $setFromRdfResourceValues(($termFromRdfResourceValues)),
1549
+ }),
1550
+ in_: $shaclPropertyFromRdf({
1551
+ ...options,
1552
+ focusResource: resource,
1553
+ ignoreRdfType: true,
1554
+ propertySchema: NodeShape.schema.properties.in_,
1555
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues($listFromRdfResourceValues(($termFromRdfResourceValues))),
1556
+ }),
1557
+ isDefinedBy: $shaclPropertyFromRdf({
1558
+ ...options,
1559
+ focusResource: resource,
1560
+ ignoreRdfType: true,
1561
+ propertySchema: NodeShape.schema.properties.isDefinedBy,
1562
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues($identifierFromRdfResourceValues),
1563
+ }),
1564
+ label: $shaclPropertyFromRdf({
1565
+ ...options,
1566
+ focusResource: resource,
1567
+ ignoreRdfType: true,
1568
+ propertySchema: NodeShape.schema.properties.label,
1569
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($stringFromRdfResourceValues)),
1570
+ }),
1571
+ languageIn: $shaclPropertyFromRdf({
1572
+ ...options,
1573
+ focusResource: resource,
1574
+ ignoreRdfType: true,
1575
+ propertySchema: NodeShape.schema.properties.languageIn,
1576
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues($listFromRdfResourceValues(($stringFromRdfResourceValues))),
1577
+ }),
1578
+ lessThan: $shaclPropertyFromRdf({
1579
+ ...options,
1580
+ focusResource: resource,
1581
+ ignoreRdfType: true,
1582
+ propertySchema: PropertyShape.schema.properties.lessThan,
1583
+ typeFromRdfResourceValues: $setFromRdfResourceValues(($iriFromRdfResourceValues)),
1584
+ }),
1585
+ lessThanOrEquals: $shaclPropertyFromRdf({
1586
+ ...options,
1587
+ focusResource: resource,
1588
+ ignoreRdfType: true,
1589
+ propertySchema: PropertyShape.schema.properties.lessThanOrEquals,
1590
+ typeFromRdfResourceValues: $setFromRdfResourceValues(($iriFromRdfResourceValues)),
1591
+ }),
1592
+ maxCount: $shaclPropertyFromRdf({
1593
+ ...options,
1594
+ focusResource: resource,
1595
+ ignoreRdfType: true,
1596
+ propertySchema: PropertyShape.schema.properties.maxCount,
1597
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($bigIntFromRdfResourceValues)),
1598
+ }),
1599
+ maxExclusive: $shaclPropertyFromRdf({
1600
+ ...options,
1601
+ focusResource: resource,
1602
+ ignoreRdfType: true,
1603
+ propertySchema: NodeShape.schema.properties.maxExclusive,
1604
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues($literalFromRdfResourceValues),
1605
+ }),
1606
+ maxInclusive: $shaclPropertyFromRdf({
1607
+ ...options,
1608
+ focusResource: resource,
1609
+ ignoreRdfType: true,
1610
+ propertySchema: NodeShape.schema.properties.maxInclusive,
1611
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues($literalFromRdfResourceValues),
1612
+ }),
1613
+ maxLength: $shaclPropertyFromRdf({
1614
+ ...options,
1615
+ focusResource: resource,
1616
+ ignoreRdfType: true,
1617
+ propertySchema: NodeShape.schema.properties.maxLength,
1618
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($bigIntFromRdfResourceValues)),
1619
+ }),
1620
+ message: $shaclPropertyFromRdf({
1621
+ ...options,
1622
+ focusResource: resource,
1623
+ ignoreRdfType: true,
1624
+ propertySchema: NodeShape.schema.properties.message,
1625
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($stringFromRdfResourceValues)),
1626
+ }),
1627
+ minCount: $shaclPropertyFromRdf({
1628
+ ...options,
1629
+ focusResource: resource,
1630
+ ignoreRdfType: true,
1631
+ propertySchema: PropertyShape.schema.properties.minCount,
1632
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($bigIntFromRdfResourceValues)),
1633
+ }),
1634
+ minExclusive: $shaclPropertyFromRdf({
1635
+ ...options,
1636
+ focusResource: resource,
1637
+ ignoreRdfType: true,
1638
+ propertySchema: NodeShape.schema.properties.minExclusive,
1639
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues($literalFromRdfResourceValues),
1640
+ }),
1641
+ minInclusive: $shaclPropertyFromRdf({
1642
+ ...options,
1643
+ focusResource: resource,
1644
+ ignoreRdfType: true,
1645
+ propertySchema: NodeShape.schema.properties.minInclusive,
1646
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues($literalFromRdfResourceValues),
1647
+ }),
1648
+ minLength: $shaclPropertyFromRdf({
1649
+ ...options,
1650
+ focusResource: resource,
1651
+ ignoreRdfType: true,
1652
+ propertySchema: NodeShape.schema.properties.minLength,
1653
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($bigIntFromRdfResourceValues)),
1654
+ }),
1655
+ name: $shaclPropertyFromRdf({
1656
+ ...options,
1657
+ focusResource: resource,
1658
+ ignoreRdfType: true,
1659
+ propertySchema: PropertyShape.schema.properties.name,
1660
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($stringFromRdfResourceValues)),
1661
+ }),
1662
+ node: $shaclPropertyFromRdf({
1663
+ ...options,
1664
+ focusResource: resource,
1665
+ ignoreRdfType: true,
1666
+ propertySchema: NodeShape.schema.properties.node,
1667
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues($identifierFromRdfResourceValues),
1668
+ }),
1669
+ nodeKind: $shaclPropertyFromRdf({
1670
+ ...options,
1671
+ focusResource: resource,
1672
+ ignoreRdfType: true,
1673
+ propertySchema: NodeShape.schema.properties.nodeKind,
1674
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($iriFromRdfResourceValues)),
1675
+ }),
1676
+ not: $shaclPropertyFromRdf({
1677
+ ...options,
1678
+ focusResource: resource,
1679
+ ignoreRdfType: true,
1680
+ propertySchema: NodeShape.schema.properties.not,
1681
+ typeFromRdfResourceValues: $setFromRdfResourceValues($identifierFromRdfResourceValues),
1682
+ }),
1683
+ or: $shaclPropertyFromRdf({
1684
+ ...options,
1685
+ focusResource: resource,
1686
+ ignoreRdfType: true,
1687
+ propertySchema: NodeShape.schema.properties.or,
1688
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues($listFromRdfResourceValues($identifierFromRdfResourceValues)),
1689
+ }),
1690
+ order: $shaclPropertyFromRdf({
1691
+ ...options,
1692
+ focusResource: resource,
1693
+ ignoreRdfType: true,
1694
+ propertySchema: PropertyShape.schema.properties.order,
1695
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($floatFromRdfResourceValues)),
1696
+ }),
1697
+ path: $shaclPropertyFromRdf({
1698
+ ...options,
1699
+ focusResource: resource,
1700
+ ignoreRdfType: true,
1701
+ propertySchema: PropertyShape.schema.properties.path,
1702
+ typeFromRdfResourceValues: $PropertyPath.fromRdfResourceValues,
1703
+ }),
1704
+ pattern: $shaclPropertyFromRdf({
1705
+ ...options,
1706
+ focusResource: resource,
1707
+ ignoreRdfType: true,
1708
+ propertySchema: NodeShape.schema.properties.pattern,
1709
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($stringFromRdfResourceValues)),
1710
+ }),
1711
+ qualifiedMaxCount: $shaclPropertyFromRdf({
1712
+ ...options,
1713
+ focusResource: resource,
1714
+ ignoreRdfType: true,
1715
+ propertySchema: PropertyShape.schema.properties.qualifiedMaxCount,
1716
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($bigIntFromRdfResourceValues)),
1717
+ }),
1718
+ qualifiedMinCount: $shaclPropertyFromRdf({
1719
+ ...options,
1720
+ focusResource: resource,
1721
+ ignoreRdfType: true,
1722
+ propertySchema: PropertyShape.schema.properties.qualifiedMinCount,
1723
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($bigIntFromRdfResourceValues)),
1724
+ }),
1725
+ qualifiedValueShape: $shaclPropertyFromRdf({
1726
+ ...options,
1727
+ focusResource: resource,
1728
+ ignoreRdfType: true,
1729
+ propertySchema: PropertyShape.schema.properties.qualifiedValueShape,
1730
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues($identifierFromRdfResourceValues),
1731
+ }),
1732
+ qualifiedValueShapesDisjoint: $shaclPropertyFromRdf({
1733
+ ...options,
1734
+ focusResource: resource,
1735
+ ignoreRdfType: true,
1736
+ propertySchema: PropertyShape.schema.properties.qualifiedValueShapesDisjoint,
1737
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($booleanFromRdfResourceValues)),
1738
+ }),
1739
+ severity: $shaclPropertyFromRdf({
1740
+ ...options,
1741
+ focusResource: resource,
1742
+ ignoreRdfType: true,
1743
+ propertySchema: NodeShape.schema.properties.severity,
1744
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($iriFromRdfResourceValues)),
1745
+ }),
1746
+ targetClasses: $shaclPropertyFromRdf({
1747
+ ...options,
1748
+ focusResource: resource,
1749
+ ignoreRdfType: true,
1750
+ propertySchema: NodeShape.schema.properties.targetClasses,
1751
+ typeFromRdfResourceValues: $setFromRdfResourceValues(($iriFromRdfResourceValues)),
1752
+ }),
1753
+ targetNodes: $shaclPropertyFromRdf({
1754
+ ...options,
1755
+ focusResource: resource,
1756
+ ignoreRdfType: true,
1757
+ propertySchema: NodeShape.schema.properties.targetNodes,
1758
+ typeFromRdfResourceValues: $setFromRdfResourceValues(($termFromRdfResourceValues)),
1759
+ }),
1760
+ targetObjectsOf: $shaclPropertyFromRdf({
1761
+ ...options,
1762
+ focusResource: resource,
1763
+ ignoreRdfType: true,
1764
+ propertySchema: NodeShape.schema.properties.targetObjectsOf,
1765
+ typeFromRdfResourceValues: $setFromRdfResourceValues(($iriFromRdfResourceValues)),
1766
+ }),
1767
+ targetSubjectsOf: $shaclPropertyFromRdf({
1768
+ ...options,
1769
+ focusResource: resource,
1770
+ ignoreRdfType: true,
1771
+ propertySchema: NodeShape.schema.properties.targetSubjectsOf,
1772
+ typeFromRdfResourceValues: $setFromRdfResourceValues(($iriFromRdfResourceValues)),
1773
+ }),
1774
+ uniqueLang: $shaclPropertyFromRdf({
1775
+ ...options,
1776
+ focusResource: resource,
1777
+ ignoreRdfType: true,
1778
+ propertySchema: PropertyShape.schema.properties.uniqueLang,
1779
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($booleanFromRdfResourceValues)),
1780
+ }),
1781
+ xone: $shaclPropertyFromRdf({
1782
+ ...options,
1783
+ focusResource: resource,
1784
+ ignoreRdfType: true,
1785
+ propertySchema: NodeShape.schema.properties.xone,
1786
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues($listFromRdfResourceValues($identifierFromRdfResourceValues)),
1787
+ }),
1788
+ }).chain((properties) => PropertyShape.create(properties)));
1789
+ PropertyShape.fromRdfResource = $wrap_FromRdfResourceFunction(PropertyShape._fromRdfResource);
1790
+ PropertyShape.fromRdfResourceValues = (values, options) => values.chainMap((value) => value
1791
+ .toResource()
1792
+ .chain((resource) => PropertyShape.fromRdfResource(resource, options)));
1793
+ let Identifier;
1794
+ (function (Identifier) {
1795
+ Identifier.parse = $parseIdentifier;
1796
+ Identifier.stringify = NTriplesTerm.stringify;
1797
+ })(Identifier = PropertyShape.Identifier || (PropertyShape.Identifier = {}));
1798
+ function isPropertyShape(object) {
1799
+ return object.$type === "PropertyShape";
1800
+ }
1801
+ PropertyShape.isPropertyShape = isPropertyShape;
1802
+ PropertyShape.schema = {
1803
+ fromRdfType: dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"),
1804
+ properties: {
1805
+ $identifier: {
1806
+ kind: "Identifier",
1807
+ type: { kind: "Identifier" },
1808
+ },
1809
+ and: {
1810
+ kind: "Shacl",
1811
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#and"),
1812
+ type: {
1813
+ kind: "Option",
1814
+ itemType: {
1815
+ kind: "List",
1816
+ itemType: { kind: "Identifier" },
1817
+ },
1818
+ },
1819
+ },
1820
+ classes: {
1821
+ kind: "Shacl",
1822
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#class"),
1823
+ type: { kind: "Set", itemType: { kind: "Iri" } },
1824
+ },
1825
+ comment: {
1826
+ kind: "Shacl",
1827
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
1828
+ type: {
1829
+ kind: "Option",
1830
+ itemType: { kind: "String" },
1831
+ },
1832
+ },
1833
+ datatype: {
1834
+ kind: "Shacl",
1835
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#datatype"),
1836
+ type: { kind: "Option", itemType: { kind: "Iri" } },
1837
+ },
1838
+ deactivated: {
1839
+ kind: "Shacl",
1840
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"),
1841
+ type: {
1842
+ kind: "Option",
1843
+ itemType: { kind: "Boolean" },
1844
+ },
1845
+ },
1846
+ defaultValue: {
1847
+ kind: "Shacl",
1848
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#defaultValue"),
1849
+ type: {
1850
+ kind: "Option",
1851
+ itemType: { kind: "Term", types: ["NamedNode", "Literal"] },
1852
+ },
1853
+ },
1854
+ description: {
1855
+ kind: "Shacl",
1856
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#description"),
1857
+ type: {
1858
+ kind: "Option",
1859
+ itemType: { kind: "String" },
1860
+ },
1861
+ },
1862
+ disjoint: {
1863
+ kind: "Shacl",
1864
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#disjoint"),
1865
+ type: { kind: "Set", itemType: { kind: "Iri" } },
1866
+ },
1867
+ equals: {
1868
+ kind: "Shacl",
1869
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#equals"),
1870
+ type: { kind: "Set", itemType: { kind: "Iri" } },
1871
+ },
1872
+ flags: {
1873
+ kind: "Shacl",
1874
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#flags"),
1875
+ type: {
1876
+ kind: "Option",
1877
+ itemType: { kind: "String" },
1878
+ },
1879
+ },
1880
+ groups: {
1881
+ kind: "Shacl",
1882
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#group"),
1883
+ type: {
1884
+ kind: "Set",
1885
+ itemType: { kind: "Identifier" },
1886
+ },
1887
+ },
1888
+ hasValues: {
1889
+ kind: "Shacl",
1890
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#hasValue"),
1891
+ type: {
1892
+ kind: "Set",
1893
+ itemType: { kind: "Term", types: ["NamedNode", "Literal"] },
1894
+ },
1895
+ },
1896
+ in_: {
1897
+ kind: "Shacl",
1898
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#in"),
1899
+ type: {
1900
+ kind: "Option",
1901
+ itemType: {
1902
+ kind: "List",
1903
+ itemType: {
1904
+ kind: "Term",
1905
+ types: ["NamedNode", "Literal"],
1906
+ },
1907
+ },
1908
+ },
1909
+ },
1910
+ isDefinedBy: {
1911
+ kind: "Shacl",
1912
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"),
1913
+ type: {
1914
+ kind: "Option",
1915
+ itemType: { kind: "Identifier" },
1916
+ },
1917
+ },
1918
+ label: {
1919
+ kind: "Shacl",
1920
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
1921
+ type: {
1922
+ kind: "Option",
1923
+ itemType: { kind: "String" },
1924
+ },
1925
+ },
1926
+ languageIn: {
1927
+ kind: "Shacl",
1928
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#languageIn"),
1929
+ type: {
1930
+ kind: "Option",
1931
+ itemType: {
1932
+ kind: "List",
1933
+ itemType: { kind: "String" },
1934
+ },
1935
+ },
1936
+ },
1937
+ lessThan: {
1938
+ kind: "Shacl",
1939
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#lessThan"),
1940
+ type: { kind: "Set", itemType: { kind: "Iri" } },
1941
+ },
1942
+ lessThanOrEquals: {
1943
+ kind: "Shacl",
1944
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#lessThanOrEquals"),
1945
+ type: { kind: "Set", itemType: { kind: "Iri" } },
1946
+ },
1947
+ maxCount: {
1948
+ kind: "Shacl",
1949
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxCount"),
1950
+ type: {
1951
+ kind: "Option",
1952
+ itemType: { kind: "BigInt" },
1953
+ },
1954
+ },
1955
+ maxExclusive: {
1956
+ kind: "Shacl",
1957
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxExclusive"),
1958
+ type: {
1959
+ kind: "Option",
1960
+ itemType: { kind: "Literal" },
1961
+ },
1962
+ },
1963
+ maxInclusive: {
1964
+ kind: "Shacl",
1965
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxInclusive"),
1966
+ type: {
1967
+ kind: "Option",
1968
+ itemType: { kind: "Literal" },
1969
+ },
1970
+ },
1971
+ maxLength: {
1972
+ kind: "Shacl",
1973
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxLength"),
1974
+ type: {
1975
+ kind: "Option",
1976
+ itemType: { kind: "BigInt" },
1977
+ },
1978
+ },
1979
+ message: {
1980
+ kind: "Shacl",
1981
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#message"),
1982
+ type: {
1983
+ kind: "Option",
1984
+ itemType: { kind: "String" },
1985
+ },
1986
+ },
1987
+ minCount: {
1988
+ kind: "Shacl",
1989
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minCount"),
1990
+ type: {
1991
+ kind: "Option",
1992
+ itemType: { kind: "BigInt" },
1993
+ },
1994
+ },
1995
+ minExclusive: {
1996
+ kind: "Shacl",
1997
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minExclusive"),
1998
+ type: {
1999
+ kind: "Option",
2000
+ itemType: { kind: "Literal" },
2001
+ },
2002
+ },
2003
+ minInclusive: {
2004
+ kind: "Shacl",
2005
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minInclusive"),
2006
+ type: {
2007
+ kind: "Option",
2008
+ itemType: { kind: "Literal" },
2009
+ },
2010
+ },
2011
+ minLength: {
2012
+ kind: "Shacl",
2013
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minLength"),
2014
+ type: {
2015
+ kind: "Option",
2016
+ itemType: { kind: "BigInt" },
2017
+ },
2018
+ },
2019
+ name: {
2020
+ kind: "Shacl",
2021
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#name"),
2022
+ type: {
2023
+ kind: "Option",
2024
+ itemType: { kind: "String" },
2025
+ },
2026
+ },
2027
+ node: {
2028
+ kind: "Shacl",
2029
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#node"),
2030
+ type: {
2031
+ kind: "Option",
2032
+ itemType: { kind: "Identifier" },
2033
+ },
2034
+ },
2035
+ nodeKind: {
2036
+ kind: "Shacl",
2037
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"),
2038
+ type: {
2039
+ kind: "Option",
2040
+ itemType: {
2041
+ kind: "Iri",
2042
+ in: [
2043
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNode"),
2044
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrIRI"),
2045
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrLiteral"),
2046
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#IRI"),
2047
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#IRIOrLiteral"),
2048
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Literal"),
2049
+ ],
2050
+ },
2051
+ },
2052
+ },
2053
+ not: {
2054
+ kind: "Shacl",
2055
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#not"),
2056
+ type: {
2057
+ kind: "Set",
2058
+ itemType: { kind: "Identifier" },
2059
+ },
2060
+ },
2061
+ or: {
2062
+ kind: "Shacl",
2063
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#or"),
2064
+ type: {
2065
+ kind: "Option",
2066
+ itemType: {
2067
+ kind: "List",
2068
+ itemType: { kind: "Identifier" },
2069
+ },
2070
+ },
2071
+ },
2072
+ order: {
2073
+ kind: "Shacl",
2074
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#order"),
2075
+ type: { kind: "Option", itemType: { kind: "Float" } },
2076
+ },
2077
+ path: {
2078
+ kind: "Shacl",
2079
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#path"),
2080
+ get type() {
2081
+ return $PropertyPath.schema;
2082
+ },
2083
+ },
2084
+ pattern: {
2085
+ kind: "Shacl",
2086
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#pattern"),
2087
+ type: {
2088
+ kind: "Option",
2089
+ itemType: { kind: "String" },
2090
+ },
2091
+ },
2092
+ qualifiedMaxCount: {
2093
+ kind: "Shacl",
2094
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#qualifiedMaxCount"),
2095
+ type: {
2096
+ kind: "Option",
2097
+ itemType: { kind: "BigInt" },
2098
+ },
2099
+ },
2100
+ qualifiedMinCount: {
2101
+ kind: "Shacl",
2102
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#qualifiedMinCount"),
2103
+ type: {
2104
+ kind: "Option",
2105
+ itemType: { kind: "BigInt" },
2106
+ },
2107
+ },
2108
+ qualifiedValueShape: {
2109
+ kind: "Shacl",
2110
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#qualifiedValueShape"),
2111
+ type: {
2112
+ kind: "Option",
2113
+ itemType: { kind: "Identifier" },
2114
+ },
2115
+ },
2116
+ qualifiedValueShapesDisjoint: {
2117
+ kind: "Shacl",
2118
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#qualifiedValueShapesDisjoint"),
2119
+ type: {
2120
+ kind: "Option",
2121
+ itemType: { kind: "Boolean" },
2122
+ },
2123
+ },
2124
+ severity: {
2125
+ kind: "Shacl",
2126
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#severity"),
2127
+ get type() {
2128
+ return {
2129
+ kind: "Option",
2130
+ get itemType() {
2131
+ return {
2132
+ kind: "Iri",
2133
+ in: [
2134
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Info"),
2135
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Warning"),
2136
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Violation"),
2137
+ ],
2138
+ };
2139
+ },
2140
+ };
2141
+ },
2142
+ },
2143
+ targetClasses: {
2144
+ kind: "Shacl",
2145
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#targetClass"),
2146
+ type: { kind: "Set", itemType: { kind: "Iri" } },
2147
+ },
2148
+ targetNodes: {
2149
+ kind: "Shacl",
2150
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#targetNode"),
2151
+ type: {
2152
+ kind: "Set",
2153
+ itemType: { kind: "Term", types: ["NamedNode", "Literal"] },
2154
+ },
2155
+ },
2156
+ targetObjectsOf: {
2157
+ kind: "Shacl",
2158
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#targetObjectsOf"),
2159
+ type: { kind: "Set", itemType: { kind: "Iri" } },
2160
+ },
2161
+ targetSubjectsOf: {
2162
+ kind: "Shacl",
2163
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#targetSubjectsOf"),
2164
+ type: { kind: "Set", itemType: { kind: "Iri" } },
2165
+ },
2166
+ uniqueLang: {
2167
+ kind: "Shacl",
2168
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#uniqueLang"),
2169
+ type: {
2170
+ kind: "Option",
2171
+ itemType: { kind: "Boolean" },
2172
+ },
2173
+ },
2174
+ xone: {
2175
+ kind: "Shacl",
2176
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#xone"),
2177
+ type: {
2178
+ kind: "Option",
2179
+ itemType: {
2180
+ kind: "List",
2181
+ itemType: { kind: "Identifier" },
2182
+ },
2183
+ },
2184
+ },
2185
+ },
2186
+ toRdfTypes: [
2187
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"),
2188
+ ],
2189
+ };
2190
+ PropertyShape._toRdfResource = (parameters) => {
2191
+ if (!parameters.ignoreRdfType) {
2192
+ parameters.resource.add($RdfVocabularies.rdf.type, PropertyShape.schema.toRdfTypes, parameters.graph);
2193
+ }
2194
+ parameters.resource.add(NodeShape.schema.properties.and.path, parameters.object.and.toList().flatMap((value) => [
2195
+ value.length > 0
2196
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
2197
+ if (itemIndex === 0) {
2198
+ currentSubListResource = listResource;
2199
+ }
2200
+ else {
2201
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
2202
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
2203
+ currentSubListResource = newSubListResource;
2204
+ }
2205
+ currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
2206
+ if (itemIndex + 1 === list.length) {
2207
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
2208
+ }
2209
+ return { currentSubListResource, listResource };
2210
+ }, {
2211
+ currentSubListResource: null,
2212
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
2213
+ }).listResource.identifier
2214
+ : $RdfVocabularies.rdf.nil,
2215
+ ]), parameters.graph);
2216
+ parameters.resource.add(NodeShape.schema.properties.classes.path, parameters.object.classes.flatMap((item) => [item]), parameters.graph);
2217
+ parameters.resource.add(NodeShape.schema.properties.comment.path, parameters.object.comment
2218
+ .toList()
2219
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
2220
+ parameters.resource.add(NodeShape.schema.properties.datatype.path, parameters.object.datatype.toList(), parameters.graph);
2221
+ parameters.resource.add(NodeShape.schema.properties.deactivated.path, parameters.object.deactivated
2222
+ .toList()
2223
+ .flatMap((value) => [
2224
+ $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
2225
+ ]), parameters.graph);
2226
+ parameters.resource.add(PropertyShape.schema.properties.defaultValue.path, parameters.object.defaultValue.toList(), parameters.graph);
2227
+ parameters.resource.add(PropertyShape.schema.properties.description.path, parameters.object.description
2228
+ .toList()
2229
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
2230
+ parameters.resource.add(PropertyShape.schema.properties.disjoint.path, parameters.object.disjoint.flatMap((item) => [item]), parameters.graph);
2231
+ parameters.resource.add(PropertyShape.schema.properties.equals.path, parameters.object.equals.flatMap((item) => [item]), parameters.graph);
2232
+ parameters.resource.add(NodeShape.schema.properties.flags.path, parameters.object.flags
2233
+ .toList()
2234
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
2235
+ parameters.resource.add(PropertyShape.schema.properties.groups.path, parameters.object.groups.flatMap((item) => [item]), parameters.graph);
2236
+ parameters.resource.add(NodeShape.schema.properties.hasValues.path, parameters.object.hasValues.flatMap((item) => [item]), parameters.graph);
2237
+ parameters.resource.add(NodeShape.schema.properties.in_.path, parameters.object.in_.toList().flatMap((value) => [
2238
+ value.length > 0
2239
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
2240
+ if (itemIndex === 0) {
2241
+ currentSubListResource = listResource;
2242
+ }
2243
+ else {
2244
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
2245
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
2246
+ currentSubListResource = newSubListResource;
2247
+ }
2248
+ currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
2249
+ if (itemIndex + 1 === list.length) {
2250
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
2251
+ }
2252
+ return { currentSubListResource, listResource };
2253
+ }, {
2254
+ currentSubListResource: null,
2255
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
2256
+ }).listResource.identifier
2257
+ : $RdfVocabularies.rdf.nil,
2258
+ ]), parameters.graph);
2259
+ parameters.resource.add(NodeShape.schema.properties.isDefinedBy.path, parameters.object.isDefinedBy.toList(), parameters.graph);
2260
+ parameters.resource.add(NodeShape.schema.properties.label.path, parameters.object.label
2261
+ .toList()
2262
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
2263
+ parameters.resource.add(NodeShape.schema.properties.languageIn.path, parameters.object.languageIn.toList().flatMap((value) => [
2264
+ value.length > 0
2265
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
2266
+ if (itemIndex === 0) {
2267
+ currentSubListResource = listResource;
2268
+ }
2269
+ else {
2270
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
2271
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
2272
+ currentSubListResource = newSubListResource;
2273
+ }
2274
+ currentSubListResource.add($RdfVocabularies.rdf.first, [$literalFactory.string(item)], parameters.graph);
2275
+ if (itemIndex + 1 === list.length) {
2276
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
2277
+ }
2278
+ return { currentSubListResource, listResource };
2279
+ }, {
2280
+ currentSubListResource: null,
2281
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
2282
+ }).listResource.identifier
2283
+ : $RdfVocabularies.rdf.nil,
2284
+ ]), parameters.graph);
2285
+ parameters.resource.add(PropertyShape.schema.properties.lessThan.path, parameters.object.lessThan.flatMap((item) => [item]), parameters.graph);
2286
+ parameters.resource.add(PropertyShape.schema.properties.lessThanOrEquals.path, parameters.object.lessThanOrEquals.flatMap((item) => [item]), parameters.graph);
2287
+ parameters.resource.add(PropertyShape.schema.properties.maxCount.path, parameters.object.maxCount
2288
+ .toList()
2289
+ .flatMap((value) => [
2290
+ $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
2291
+ ]), parameters.graph);
2292
+ parameters.resource.add(NodeShape.schema.properties.maxExclusive.path, parameters.object.maxExclusive.toList(), parameters.graph);
2293
+ parameters.resource.add(NodeShape.schema.properties.maxInclusive.path, parameters.object.maxInclusive.toList(), parameters.graph);
2294
+ parameters.resource.add(NodeShape.schema.properties.maxLength.path, parameters.object.maxLength
2295
+ .toList()
2296
+ .flatMap((value) => [
2297
+ $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
2298
+ ]), parameters.graph);
2299
+ parameters.resource.add(NodeShape.schema.properties.message.path, parameters.object.message
2300
+ .toList()
2301
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
2302
+ parameters.resource.add(PropertyShape.schema.properties.minCount.path, parameters.object.minCount
2303
+ .toList()
2304
+ .flatMap((value) => [
2305
+ $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
2306
+ ]), parameters.graph);
2307
+ parameters.resource.add(NodeShape.schema.properties.minExclusive.path, parameters.object.minExclusive.toList(), parameters.graph);
2308
+ parameters.resource.add(NodeShape.schema.properties.minInclusive.path, parameters.object.minInclusive.toList(), parameters.graph);
2309
+ parameters.resource.add(NodeShape.schema.properties.minLength.path, parameters.object.minLength
2310
+ .toList()
2311
+ .flatMap((value) => [
2312
+ $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
2313
+ ]), parameters.graph);
2314
+ parameters.resource.add(PropertyShape.schema.properties.name.path, parameters.object.name
2315
+ .toList()
2316
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
2317
+ parameters.resource.add(NodeShape.schema.properties.node.path, parameters.object.node.toList(), parameters.graph);
2318
+ parameters.resource.add(NodeShape.schema.properties.nodeKind.path, parameters.object.nodeKind.toList(), parameters.graph);
2319
+ parameters.resource.add(NodeShape.schema.properties.not.path, parameters.object.not.flatMap((item) => [item]), parameters.graph);
2320
+ parameters.resource.add(NodeShape.schema.properties.or.path, parameters.object.or.toList().flatMap((value) => [
2321
+ value.length > 0
2322
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
2323
+ if (itemIndex === 0) {
2324
+ currentSubListResource = listResource;
2325
+ }
2326
+ else {
2327
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
2328
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
2329
+ currentSubListResource = newSubListResource;
2330
+ }
2331
+ currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
2332
+ if (itemIndex + 1 === list.length) {
2333
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
2334
+ }
2335
+ return { currentSubListResource, listResource };
2336
+ }, {
2337
+ currentSubListResource: null,
2338
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
2339
+ }).listResource.identifier
2340
+ : $RdfVocabularies.rdf.nil,
2341
+ ]), parameters.graph);
2342
+ parameters.resource.add(PropertyShape.schema.properties.order.path, parameters.object.order
2343
+ .toList()
2344
+ .flatMap((value) => [
2345
+ $literalFactory.number(value, $RdfVocabularies.xsd.double),
2346
+ ]), parameters.graph);
2347
+ parameters.resource.add(PropertyShape.schema.properties.path.path, [
2348
+ $PropertyPath.toRdfResource(parameters.object.path, {
2349
+ graph: parameters.graph,
2350
+ resourceSet: parameters.resourceSet,
2351
+ }).identifier,
2352
+ ], parameters.graph);
2353
+ parameters.resource.add(NodeShape.schema.properties.pattern.path, parameters.object.pattern
2354
+ .toList()
2355
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
2356
+ parameters.resource.add(PropertyShape.schema.properties.qualifiedMaxCount.path, parameters.object.qualifiedMaxCount
2357
+ .toList()
2358
+ .flatMap((value) => [
2359
+ $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
2360
+ ]), parameters.graph);
2361
+ parameters.resource.add(PropertyShape.schema.properties.qualifiedMinCount.path, parameters.object.qualifiedMinCount
2362
+ .toList()
2363
+ .flatMap((value) => [
2364
+ $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
2365
+ ]), parameters.graph);
2366
+ parameters.resource.add(PropertyShape.schema.properties.qualifiedValueShape.path, parameters.object.qualifiedValueShape.toList(), parameters.graph);
2367
+ parameters.resource.add(PropertyShape.schema.properties.qualifiedValueShapesDisjoint.path, parameters.object.qualifiedValueShapesDisjoint
2368
+ .toList()
2369
+ .flatMap((value) => [
2370
+ $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
2371
+ ]), parameters.graph);
2372
+ parameters.resource.add(NodeShape.schema.properties.severity.path, parameters.object.severity.toList(), parameters.graph);
2373
+ parameters.resource.add(NodeShape.schema.properties.targetClasses.path, parameters.object.targetClasses.flatMap((item) => [item]), parameters.graph);
2374
+ parameters.resource.add(NodeShape.schema.properties.targetNodes.path, parameters.object.targetNodes.flatMap((item) => [item]), parameters.graph);
2375
+ parameters.resource.add(NodeShape.schema.properties.targetObjectsOf.path, parameters.object.targetObjectsOf.flatMap((item) => [item]), parameters.graph);
2376
+ parameters.resource.add(NodeShape.schema.properties.targetSubjectsOf.path, parameters.object.targetSubjectsOf.flatMap((item) => [item]), parameters.graph);
2377
+ parameters.resource.add(PropertyShape.schema.properties.uniqueLang.path, parameters.object.uniqueLang
2378
+ .toList()
2379
+ .flatMap((value) => [
2380
+ $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
2381
+ ]), parameters.graph);
2382
+ parameters.resource.add(NodeShape.schema.properties.xone.path, parameters.object.xone.toList().flatMap((value) => [
2383
+ value.length > 0
2384
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
2385
+ if (itemIndex === 0) {
2386
+ currentSubListResource = listResource;
2387
+ }
2388
+ else {
2389
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
2390
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
2391
+ currentSubListResource = newSubListResource;
2392
+ }
2393
+ currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
2394
+ if (itemIndex + 1 === list.length) {
2395
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
2396
+ }
2397
+ return { currentSubListResource, listResource };
2398
+ }, {
2399
+ currentSubListResource: null,
2400
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
2401
+ }).listResource.identifier
2402
+ : $RdfVocabularies.rdf.nil,
2403
+ ]), parameters.graph);
2404
+ return parameters.resource;
2405
+ };
2406
+ PropertyShape.toRdfResource = $wrap_ToRdfResourceFunction(PropertyShape._toRdfResource);
2407
+ PropertyShape.$toString = (_propertyShape) => `PropertyShape(${JSON.stringify(PropertyShape.toStringRecord(_propertyShape))})`;
2408
+ PropertyShape.toStringRecord = (_propertyShape) => $compactRecord({
2409
+ $identifier: _propertyShape.$identifier().toString(),
2410
+ label: _propertyShape.label.map((item) => item.toString()).extract(),
2411
+ name: _propertyShape.name.map((item) => item.toString()).extract(),
2412
+ path: $PropertyPath.$toString(_propertyShape.path),
2413
+ });
2414
+ })(PropertyShape || (PropertyShape = {}));
2415
+ export var ValidationReport;
2416
+ (function (ValidationReport) {
2417
+ ValidationReport.create = (parameters) => $sequenceRecord({
2418
+ $identifier: $convertToIdentifierProperty(parameters.$identifier),
2419
+ conforms: Either.of(parameters.conforms),
2420
+ results: $convertToScalarSet($identityConversionFunction, true)(parameters.results).chain((value) => $validateArray($identityValidationFunction, true)(ValidationReport.schema.properties.results.type, value)),
2421
+ shapesGraphWellFormed: $convertToMaybe($identityConversionFunction)(parameters.shapesGraphWellFormed).chain((value) => $validateMaybe($identityValidationFunction)(ValidationReport.schema.properties.shapesGraphWellFormed.type, value)),
2422
+ })
2423
+ .map((properties) => ({
2424
+ ...properties,
2425
+ $type: "ValidationReport",
2426
+ }))
2427
+ .map((object) => $monkeyPatchObject(object, { $toString: ValidationReport.$toString }));
2428
+ function createUnsafe(parameters) {
2429
+ return ValidationReport.create(parameters).unsafeCoerce();
2430
+ }
2431
+ ValidationReport.createUnsafe = createUnsafe;
2432
+ ValidationReport._fromRdfResource = (resource, options) => (!options.ignoreRdfType
2433
+ ? $ensureRdfResourceType(resource, [ValidationReport.schema.fromRdfType], { graph: options.graph })
2434
+ : Right(true)).chain((_rdfTypeCheck) => $sequenceRecord({
2435
+ $identifier: $identifierFromRdfResourceValues($rdfResourceIdentifierValues(resource), {
2436
+ ...options,
2437
+ focusResource: resource,
2438
+ propertyPath: $RdfVocabularies.rdf.subject,
2439
+ schema: ValidationReport.schema.properties.$identifier.type,
2440
+ }).chain((values) => values.head()),
2441
+ conforms: $shaclPropertyFromRdf({
2442
+ ...options,
2443
+ focusResource: resource,
2444
+ ignoreRdfType: true,
2445
+ propertySchema: ValidationReport.schema.properties.conforms,
2446
+ typeFromRdfResourceValues: ($booleanFromRdfResourceValues),
2447
+ }),
2448
+ results: $shaclPropertyFromRdf({
2449
+ ...options,
2450
+ focusResource: resource,
2451
+ ignoreRdfType: true,
2452
+ propertySchema: ValidationReport.schema.properties.results,
2453
+ typeFromRdfResourceValues: $setFromRdfResourceValues(ValidationResult.fromRdfResourceValues),
2454
+ }),
2455
+ shapesGraphWellFormed: $shaclPropertyFromRdf({
2456
+ ...options,
2457
+ focusResource: resource,
2458
+ ignoreRdfType: true,
2459
+ propertySchema: ValidationReport.schema.properties.shapesGraphWellFormed,
2460
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($booleanFromRdfResourceValues)),
2461
+ }),
2462
+ }).chain((properties) => ValidationReport.create(properties)));
2463
+ ValidationReport.fromRdfResource = $wrap_FromRdfResourceFunction(ValidationReport._fromRdfResource);
2464
+ ValidationReport.fromRdfResourceValues = (values, options) => values.chainMap((value) => value
2465
+ .toResource()
2466
+ .chain((resource) => ValidationReport.fromRdfResource(resource, options)));
2467
+ let Identifier;
2468
+ (function (Identifier) {
2469
+ Identifier.parse = $parseIdentifier;
2470
+ Identifier.stringify = NTriplesTerm.stringify;
2471
+ })(Identifier = ValidationReport.Identifier || (ValidationReport.Identifier = {}));
2472
+ function isValidationReport(object) {
2473
+ return object.$type === "ValidationReport";
2474
+ }
2475
+ ValidationReport.isValidationReport = isValidationReport;
2476
+ ValidationReport.schema = {
2477
+ fromRdfType: dataFactory.namedNode("http://www.w3.org/ns/shacl#ValidationReport"),
2478
+ properties: {
2479
+ $identifier: {
2480
+ kind: "Identifier",
2481
+ type: { kind: "Identifier" },
2482
+ },
2483
+ conforms: {
2484
+ kind: "Shacl",
2485
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#conforms"),
2486
+ type: { kind: "Boolean" },
2487
+ },
2488
+ results: {
2489
+ kind: "Shacl",
2490
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#result"),
2491
+ get type() {
2492
+ return {
2493
+ kind: "Set",
2494
+ get itemType() {
2495
+ return ValidationResult.schema;
2496
+ },
2497
+ };
2498
+ },
2499
+ },
2500
+ shapesGraphWellFormed: {
2501
+ kind: "Shacl",
2502
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#shapesGraphWellFormed"),
2503
+ type: {
2504
+ kind: "Option",
2505
+ itemType: { kind: "Boolean" },
2506
+ },
2507
+ },
2508
+ },
2509
+ toRdfTypes: [
2510
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#ValidationReport"),
2511
+ ],
2512
+ };
2513
+ ValidationReport._toRdfResource = (parameters) => {
2514
+ if (!parameters.ignoreRdfType) {
2515
+ parameters.resource.add($RdfVocabularies.rdf.type, ValidationReport.schema.toRdfTypes, parameters.graph);
2516
+ }
2517
+ parameters.resource.add(ValidationReport.schema.properties.conforms.path, [
2518
+ $literalFactory.boolean(parameters.object.conforms, $RdfVocabularies.xsd.boolean),
2519
+ ], parameters.graph);
2520
+ parameters.resource.add(ValidationReport.schema.properties.results.path, parameters.object.results.flatMap((item) => [
2521
+ ValidationResult.toRdfResource(item, {
2522
+ graph: parameters.graph,
2523
+ resourceSet: parameters.resourceSet,
2524
+ }).identifier,
2525
+ ]), parameters.graph);
2526
+ parameters.resource.add(ValidationReport.schema.properties.shapesGraphWellFormed.path, parameters.object.shapesGraphWellFormed
2527
+ .toList()
2528
+ .flatMap((value) => [
2529
+ $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
2530
+ ]), parameters.graph);
2531
+ return parameters.resource;
2532
+ };
2533
+ ValidationReport.toRdfResource = $wrap_ToRdfResourceFunction(ValidationReport._toRdfResource);
2534
+ ValidationReport.$toString = (_validationReport) => `ValidationReport(${JSON.stringify(ValidationReport.toStringRecord(_validationReport))})`;
2535
+ ValidationReport.toStringRecord = (_validationReport) => $compactRecord({ $identifier: _validationReport.$identifier().toString() });
2536
+ })(ValidationReport || (ValidationReport = {}));
2537
+ export var ValidationResult;
2538
+ (function (ValidationResult) {
2539
+ ValidationResult.create = (parameters) => $sequenceRecord({
2540
+ $identifier: $convertToIdentifierProperty(parameters.$identifier),
2541
+ details: $convertToScalarSet($identityConversionFunction, true)(parameters.details).chain((value) => $validateArray($identityValidationFunction, true)(ValidationResult.schema.properties.details.type, value)),
2542
+ focusNode: Either.of(parameters.focusNode),
2543
+ message: $convertToMaybe($identityConversionFunction)(parameters.message).chain((value) => $validateMaybe($identityValidationFunction)(ValidationResult.schema.properties.message.type, value)),
2544
+ path: $convertToMaybe($identityConversionFunction)(parameters.path).chain((value) => $validateMaybe($identityValidationFunction)(ValidationResult.schema.properties.path.type, value)),
2545
+ severity: $convertToIri(parameters.severity),
2546
+ sourceConstraintComponent: $convertToIri(parameters.sourceConstraintComponent),
2547
+ sourceShape: $convertToMaybe($convertToIdentifier)(parameters.sourceShape).chain((value) => $validateMaybe($identityValidationFunction)(ValidationResult.schema.properties.sourceShape.type, value)),
2548
+ value: $convertToMaybe($identityConversionFunction)(parameters.value).chain((value) => $validateMaybe($identityValidationFunction)(ValidationResult.schema.properties.value.type, value)),
2549
+ })
2550
+ .map((properties) => ({
2551
+ ...properties,
2552
+ $type: "ValidationResult",
2553
+ }))
2554
+ .map((object) => $monkeyPatchObject(object, { $toString: ValidationResult.$toString }));
2555
+ function createUnsafe(parameters) {
2556
+ return ValidationResult.create(parameters).unsafeCoerce();
2557
+ }
2558
+ ValidationResult.createUnsafe = createUnsafe;
2559
+ ValidationResult._fromRdfResource = (resource, options) => (!options.ignoreRdfType
2560
+ ? $ensureRdfResourceType(resource, [ValidationResult.schema.fromRdfType], { graph: options.graph })
2561
+ : Right(true)).chain((_rdfTypeCheck) => $sequenceRecord({
2562
+ $identifier: $identifierFromRdfResourceValues($rdfResourceIdentifierValues(resource), {
2563
+ ...options,
2564
+ focusResource: resource,
2565
+ propertyPath: $RdfVocabularies.rdf.subject,
2566
+ schema: ValidationResult.schema.properties.$identifier.type,
2567
+ }).chain((values) => values.head()),
2568
+ details: $shaclPropertyFromRdf({
2569
+ ...options,
2570
+ focusResource: resource,
2571
+ ignoreRdfType: true,
2572
+ propertySchema: ValidationResult.schema.properties.details,
2573
+ typeFromRdfResourceValues: $setFromRdfResourceValues(($termFromRdfResourceValues)),
2574
+ }),
2575
+ focusNode: $shaclPropertyFromRdf({
2576
+ ...options,
2577
+ focusResource: resource,
2578
+ ignoreRdfType: true,
2579
+ propertySchema: ValidationResult.schema.properties.focusNode,
2580
+ typeFromRdfResourceValues: ($termFromRdfResourceValues),
2581
+ }),
2582
+ message: $shaclPropertyFromRdf({
2583
+ ...options,
2584
+ focusResource: resource,
2585
+ ignoreRdfType: true,
2586
+ propertySchema: ValidationResult.schema.properties.message,
2587
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($stringFromRdfResourceValues)),
2588
+ }),
2589
+ path: $shaclPropertyFromRdf({
2590
+ ...options,
2591
+ focusResource: resource,
2592
+ ignoreRdfType: true,
2593
+ propertySchema: ValidationResult.schema.properties.path,
2594
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues($PropertyPath.fromRdfResourceValues),
2595
+ }),
2596
+ severity: $shaclPropertyFromRdf({
2597
+ ...options,
2598
+ focusResource: resource,
2599
+ ignoreRdfType: true,
2600
+ propertySchema: ValidationResult.schema.properties.severity,
2601
+ typeFromRdfResourceValues: ($iriFromRdfResourceValues),
2602
+ }),
2603
+ sourceConstraintComponent: $shaclPropertyFromRdf({
2604
+ ...options,
2605
+ focusResource: resource,
2606
+ ignoreRdfType: true,
2607
+ propertySchema: ValidationResult.schema.properties.sourceConstraintComponent,
2608
+ typeFromRdfResourceValues: ($iriFromRdfResourceValues),
2609
+ }),
2610
+ sourceShape: $shaclPropertyFromRdf({
2611
+ ...options,
2612
+ focusResource: resource,
2613
+ ignoreRdfType: true,
2614
+ propertySchema: ValidationResult.schema.properties.sourceShape,
2615
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues($identifierFromRdfResourceValues),
2616
+ }),
2617
+ value: $shaclPropertyFromRdf({
2618
+ ...options,
2619
+ focusResource: resource,
2620
+ ignoreRdfType: true,
2621
+ propertySchema: ValidationResult.schema.properties.value,
2622
+ typeFromRdfResourceValues: $maybeFromRdfResourceValues(($termFromRdfResourceValues)),
2623
+ }),
2624
+ }).chain((properties) => ValidationResult.create(properties)));
2625
+ ValidationResult.fromRdfResource = $wrap_FromRdfResourceFunction(ValidationResult._fromRdfResource);
2626
+ ValidationResult.fromRdfResourceValues = (values, options) => values.chainMap((value) => value
2627
+ .toResource()
2628
+ .chain((resource) => ValidationResult.fromRdfResource(resource, options)));
2629
+ let Identifier;
2630
+ (function (Identifier) {
2631
+ Identifier.parse = $parseIdentifier;
2632
+ Identifier.stringify = NTriplesTerm.stringify;
2633
+ })(Identifier = ValidationResult.Identifier || (ValidationResult.Identifier = {}));
2634
+ function isValidationResult(object) {
2635
+ return object.$type === "ValidationResult";
2636
+ }
2637
+ ValidationResult.isValidationResult = isValidationResult;
2638
+ ValidationResult.schema = {
2639
+ fromRdfType: dataFactory.namedNode("http://www.w3.org/ns/shacl#ValidationResult"),
2640
+ properties: {
2641
+ $identifier: {
2642
+ kind: "Identifier",
2643
+ type: { kind: "Identifier" },
2644
+ },
2645
+ details: {
2646
+ kind: "Shacl",
2647
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#detail"),
2648
+ type: {
2649
+ kind: "Set",
2650
+ itemType: {
2651
+ kind: "Term",
2652
+ types: ["BlankNode", "NamedNode", "Literal"],
2653
+ },
2654
+ },
2655
+ },
2656
+ focusNode: {
2657
+ kind: "Shacl",
2658
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#focusNode"),
2659
+ type: {
2660
+ kind: "Term",
2661
+ types: ["BlankNode", "NamedNode", "Literal"],
2662
+ },
2663
+ },
2664
+ message: {
2665
+ kind: "Shacl",
2666
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#resultMessage"),
2667
+ type: {
2668
+ kind: "Option",
2669
+ itemType: { kind: "String" },
2670
+ },
2671
+ },
2672
+ path: {
2673
+ kind: "Shacl",
2674
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#resultPath"),
2675
+ get type() {
2676
+ return {
2677
+ kind: "Option",
2678
+ get itemType() {
2679
+ return $PropertyPath.schema;
2680
+ },
2681
+ };
2682
+ },
2683
+ },
2684
+ severity: {
2685
+ kind: "Shacl",
2686
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#resultSeverity"),
2687
+ get type() {
2688
+ return {
2689
+ kind: "Iri",
2690
+ in: [
2691
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Info"),
2692
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Warning"),
2693
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Violation"),
2694
+ ],
2695
+ };
2696
+ },
2697
+ },
2698
+ sourceConstraintComponent: {
2699
+ kind: "Shacl",
2700
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#sourceConstraintComponent"),
2701
+ type: { kind: "Iri" },
2702
+ },
2703
+ sourceShape: {
2704
+ kind: "Shacl",
2705
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#sourceShape"),
2706
+ type: {
2707
+ kind: "Option",
2708
+ itemType: { kind: "Identifier" },
2709
+ },
2710
+ },
2711
+ value: {
2712
+ kind: "Shacl",
2713
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#value"),
2714
+ type: {
2715
+ kind: "Option",
2716
+ itemType: {
2717
+ kind: "Term",
2718
+ types: ["BlankNode", "NamedNode", "Literal"],
2719
+ },
2720
+ },
2721
+ },
2722
+ },
2723
+ toRdfTypes: [
2724
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#ValidationResult"),
2725
+ ],
2726
+ };
2727
+ ValidationResult._toRdfResource = (parameters) => {
2728
+ if (!parameters.ignoreRdfType) {
2729
+ parameters.resource.add($RdfVocabularies.rdf.type, ValidationResult.schema.toRdfTypes, parameters.graph);
2730
+ }
2731
+ parameters.resource.add(ValidationResult.schema.properties.details.path, parameters.object.details.flatMap((item) => [item]), parameters.graph);
2732
+ parameters.resource.add(ValidationResult.schema.properties.focusNode.path, [parameters.object.focusNode], parameters.graph);
2733
+ parameters.resource.add(ValidationResult.schema.properties.message.path, parameters.object.message
2734
+ .toList()
2735
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
2736
+ parameters.resource.add(ValidationResult.schema.properties.path.path, parameters.object.path.toList().flatMap((value) => [
2737
+ $PropertyPath.toRdfResource(value, {
2738
+ graph: parameters.graph,
2739
+ resourceSet: parameters.resourceSet,
2740
+ }).identifier,
2741
+ ]), parameters.graph);
2742
+ parameters.resource.add(ValidationResult.schema.properties.severity.path, [parameters.object.severity], parameters.graph);
2743
+ parameters.resource.add(ValidationResult.schema.properties.sourceConstraintComponent.path, [parameters.object.sourceConstraintComponent], parameters.graph);
2744
+ parameters.resource.add(ValidationResult.schema.properties.sourceShape.path, parameters.object.sourceShape.toList(), parameters.graph);
2745
+ parameters.resource.add(ValidationResult.schema.properties.value.path, parameters.object.value.toList(), parameters.graph);
2746
+ return parameters.resource;
2747
+ };
2748
+ ValidationResult.toRdfResource = $wrap_ToRdfResourceFunction(ValidationResult._toRdfResource);
2749
+ ValidationResult.$toString = (_validationResult) => `ValidationResult(${JSON.stringify(ValidationResult.toStringRecord(_validationResult))})`;
2750
+ ValidationResult.toStringRecord = (_validationResult) => $compactRecord({ $identifier: _validationResult.$identifier().toString() });
2751
+ })(ValidationResult || (ValidationResult = {}));
2752
+ export var Shape;
2753
+ (function (Shape) {
2754
+ Shape.$toString = (value) => {
2755
+ if (NodeShape.isNodeShape(value)) {
2756
+ return NodeShape.$toString(value);
2757
+ }
2758
+ if (PropertyShape.isPropertyShape(value)) {
2759
+ return PropertyShape.$toString(value);
2760
+ }
2761
+ throw new Error("unable to serialize to string");
2762
+ };
2763
+ Shape.fromRdfResource = (resource, options) => NodeShape.fromRdfResource(resource, {
2764
+ ...options,
2765
+ ignoreRdfType: false,
2766
+ }).altLazy(() => PropertyShape.fromRdfResource(resource, {
2767
+ ...options,
2768
+ ignoreRdfType: false,
2769
+ }));
2770
+ Shape.fromRdfResourceValues = ((values, options) => values.chainMap((value) => {
2771
+ const valueAsValues = value.toValues();
2772
+ return NodeShape.fromRdfResourceValues(valueAsValues, {
2773
+ ...options,
2774
+ schema: options.schema.members["NodeShape"].type,
2775
+ })
2776
+ .altLazy(() => PropertyShape.fromRdfResourceValues(valueAsValues, {
2777
+ ...options,
2778
+ schema: options.schema.members["PropertyShape"].type,
2779
+ }))
2780
+ .chain((values) => values.head());
2781
+ }));
2782
+ let Identifier;
2783
+ (function (Identifier) {
2784
+ Identifier.parse = $parseIdentifier;
2785
+ Identifier.stringify = NTriplesTerm.stringify;
2786
+ })(Identifier = Shape.Identifier || (Shape.Identifier = {}));
2787
+ function isShape(object) {
2788
+ return (NodeShape.isNodeShape(object) || PropertyShape.isPropertyShape(object));
2789
+ }
2790
+ Shape.isShape = isShape;
2791
+ Shape.schema = {
2792
+ kind: "ObjectUnion",
2793
+ members: {
2794
+ NodeShape: { discriminantValues: ["NodeShape"], type: NodeShape.schema },
2795
+ PropertyShape: {
2796
+ discriminantValues: ["PropertyShape"],
2797
+ type: PropertyShape.schema,
2798
+ },
2799
+ },
2800
+ properties: {
2801
+ and: {
2802
+ kind: "Shacl",
2803
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#and"),
2804
+ type: {
2805
+ kind: "Option",
2806
+ itemType: {
2807
+ kind: "List",
2808
+ itemType: { kind: "Identifier" },
2809
+ },
2810
+ },
2811
+ },
2812
+ classes: {
2813
+ kind: "Shacl",
2814
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#class"),
2815
+ type: { kind: "Set", itemType: { kind: "Iri" } },
2816
+ },
2817
+ comment: {
2818
+ kind: "Shacl",
2819
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
2820
+ type: {
2821
+ kind: "Option",
2822
+ itemType: { kind: "String" },
2823
+ },
2824
+ },
2825
+ datatype: {
2826
+ kind: "Shacl",
2827
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#datatype"),
2828
+ type: { kind: "Option", itemType: { kind: "Iri" } },
2829
+ },
2830
+ deactivated: {
2831
+ kind: "Shacl",
2832
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"),
2833
+ type: {
2834
+ kind: "Option",
2835
+ itemType: { kind: "Boolean" },
2836
+ },
2837
+ },
2838
+ flags: {
2839
+ kind: "Shacl",
2840
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#flags"),
2841
+ type: {
2842
+ kind: "Option",
2843
+ itemType: { kind: "String" },
2844
+ },
2845
+ },
2846
+ hasValues: {
2847
+ kind: "Shacl",
2848
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#hasValue"),
2849
+ type: {
2850
+ kind: "Set",
2851
+ itemType: { kind: "Term", types: ["NamedNode", "Literal"] },
2852
+ },
2853
+ },
2854
+ in_: {
2855
+ kind: "Shacl",
2856
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#in"),
2857
+ type: {
2858
+ kind: "Option",
2859
+ itemType: {
2860
+ kind: "List",
2861
+ itemType: {
2862
+ kind: "Term",
2863
+ types: ["NamedNode", "Literal"],
2864
+ },
2865
+ },
2866
+ },
2867
+ },
2868
+ isDefinedBy: {
2869
+ kind: "Shacl",
2870
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"),
2871
+ type: {
2872
+ kind: "Option",
2873
+ itemType: { kind: "Identifier" },
2874
+ },
2875
+ },
2876
+ label: {
2877
+ kind: "Shacl",
2878
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
2879
+ type: {
2880
+ kind: "Option",
2881
+ itemType: { kind: "String" },
2882
+ },
2883
+ },
2884
+ languageIn: {
2885
+ kind: "Shacl",
2886
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#languageIn"),
2887
+ type: {
2888
+ kind: "Option",
2889
+ itemType: {
2890
+ kind: "List",
2891
+ itemType: { kind: "String" },
2892
+ },
2893
+ },
2894
+ },
2895
+ maxExclusive: {
2896
+ kind: "Shacl",
2897
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxExclusive"),
2898
+ type: {
2899
+ kind: "Option",
2900
+ itemType: { kind: "Literal" },
2901
+ },
2902
+ },
2903
+ maxInclusive: {
2904
+ kind: "Shacl",
2905
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxInclusive"),
2906
+ type: {
2907
+ kind: "Option",
2908
+ itemType: { kind: "Literal" },
2909
+ },
2910
+ },
2911
+ maxLength: {
2912
+ kind: "Shacl",
2913
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxLength"),
2914
+ type: {
2915
+ kind: "Option",
2916
+ itemType: { kind: "BigInt" },
2917
+ },
2918
+ },
2919
+ message: {
2920
+ kind: "Shacl",
2921
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#message"),
2922
+ type: {
2923
+ kind: "Option",
2924
+ itemType: { kind: "String" },
2925
+ },
2926
+ },
2927
+ minExclusive: {
2928
+ kind: "Shacl",
2929
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minExclusive"),
2930
+ type: {
2931
+ kind: "Option",
2932
+ itemType: { kind: "Literal" },
2933
+ },
2934
+ },
2935
+ minInclusive: {
2936
+ kind: "Shacl",
2937
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minInclusive"),
2938
+ type: {
2939
+ kind: "Option",
2940
+ itemType: { kind: "Literal" },
2941
+ },
2942
+ },
2943
+ minLength: {
2944
+ kind: "Shacl",
2945
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minLength"),
2946
+ type: {
2947
+ kind: "Option",
2948
+ itemType: { kind: "BigInt" },
2949
+ },
2950
+ },
2951
+ node: {
2952
+ kind: "Shacl",
2953
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#node"),
2954
+ type: {
2955
+ kind: "Option",
2956
+ itemType: { kind: "Identifier" },
2957
+ },
2958
+ },
2959
+ nodeKind: {
2960
+ kind: "Shacl",
2961
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"),
2962
+ type: {
2963
+ kind: "Option",
2964
+ itemType: {
2965
+ kind: "Iri",
2966
+ in: [
2967
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNode"),
2968
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrIRI"),
2969
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrLiteral"),
2970
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#IRI"),
2971
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#IRIOrLiteral"),
2972
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Literal"),
2973
+ ],
2974
+ },
2975
+ },
2976
+ },
2977
+ not: {
2978
+ kind: "Shacl",
2979
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#not"),
2980
+ type: {
2981
+ kind: "Set",
2982
+ itemType: { kind: "Identifier" },
2983
+ },
2984
+ },
2985
+ or: {
2986
+ kind: "Shacl",
2987
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#or"),
2988
+ type: {
2989
+ kind: "Option",
2990
+ itemType: {
2991
+ kind: "List",
2992
+ itemType: { kind: "Identifier" },
2993
+ },
2994
+ },
2995
+ },
2996
+ pattern: {
2997
+ kind: "Shacl",
2998
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#pattern"),
2999
+ type: {
3000
+ kind: "Option",
3001
+ itemType: { kind: "String" },
3002
+ },
3003
+ },
3004
+ severity: {
3005
+ kind: "Shacl",
3006
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#severity"),
3007
+ get type() {
3008
+ return {
3009
+ kind: "Option",
3010
+ get itemType() {
3011
+ return {
3012
+ kind: "Iri",
3013
+ in: [
3014
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Info"),
3015
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Warning"),
3016
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Violation"),
3017
+ ],
3018
+ };
3019
+ },
3020
+ };
3021
+ },
3022
+ },
3023
+ targetClasses: {
3024
+ kind: "Shacl",
3025
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#targetClass"),
3026
+ type: { kind: "Set", itemType: { kind: "Iri" } },
3027
+ },
3028
+ targetNodes: {
3029
+ kind: "Shacl",
3030
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#targetNode"),
3031
+ type: {
3032
+ kind: "Set",
3033
+ itemType: { kind: "Term", types: ["NamedNode", "Literal"] },
3034
+ },
3035
+ },
3036
+ targetObjectsOf: {
3037
+ kind: "Shacl",
3038
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#targetObjectsOf"),
3039
+ type: { kind: "Set", itemType: { kind: "Iri" } },
3040
+ },
3041
+ targetSubjectsOf: {
3042
+ kind: "Shacl",
3043
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#targetSubjectsOf"),
3044
+ type: { kind: "Set", itemType: { kind: "Iri" } },
3045
+ },
3046
+ xone: {
3047
+ kind: "Shacl",
3048
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#xone"),
3049
+ type: {
3050
+ kind: "Option",
3051
+ itemType: {
3052
+ kind: "List",
3053
+ itemType: { kind: "Identifier" },
3054
+ },
3055
+ },
3056
+ },
3057
+ },
3058
+ };
3059
+ Shape.toRdfResource = (object, options) => {
3060
+ if (NodeShape.isNodeShape(object)) {
3061
+ return NodeShape.toRdfResource(object, options);
3062
+ }
3063
+ if (PropertyShape.isPropertyShape(object)) {
3064
+ return PropertyShape.toRdfResource(object, options);
3065
+ }
3066
+ throw new Error("unrecognized type");
3067
+ };
3068
+ Shape.toRdfResourceValues = ((value, _options) => {
3069
+ if (NodeShape.isNodeShape(value)) {
3070
+ return [
3071
+ NodeShape.toRdfResource(value, {
3072
+ graph: _options.graph,
3073
+ resourceSet: _options.resourceSet,
3074
+ }).identifier,
3075
+ ];
3076
+ }
3077
+ if (PropertyShape.isPropertyShape(value)) {
3078
+ return [
3079
+ PropertyShape.toRdfResource(value, {
3080
+ graph: _options.graph,
3081
+ resourceSet: _options.resourceSet,
3082
+ }).identifier,
3083
+ ];
3084
+ }
3085
+ throw new Error("unable to serialize to RDF");
3086
+ });
3087
+ })(Shape || (Shape = {}));
3088
+ export var $Object;
3089
+ (function ($Object) {
3090
+ $Object.$toString = (value) => {
3091
+ if (NodeShape.isNodeShape(value)) {
3092
+ return NodeShape.$toString(value);
3093
+ }
3094
+ if (Ontology.isOntology(value)) {
3095
+ return Ontology.$toString(value);
3096
+ }
3097
+ if (PropertyGroup.isPropertyGroup(value)) {
3098
+ return PropertyGroup.$toString(value);
3099
+ }
3100
+ if (PropertyShape.isPropertyShape(value)) {
3101
+ return PropertyShape.$toString(value);
3102
+ }
3103
+ if (ValidationReport.isValidationReport(value)) {
3104
+ return ValidationReport.$toString(value);
3105
+ }
3106
+ if (ValidationResult.isValidationResult(value)) {
3107
+ return ValidationResult.$toString(value);
3108
+ }
3109
+ throw new Error("unable to serialize to string");
3110
+ };
3111
+ $Object.fromRdfResource = (resource, options) => NodeShape.fromRdfResource(resource, {
3112
+ ...options,
3113
+ ignoreRdfType: false,
3114
+ })
3115
+ .altLazy(() => Ontology.fromRdfResource(resource, {
3116
+ ...options,
3117
+ ignoreRdfType: false,
3118
+ }))
3119
+ .altLazy(() => PropertyGroup.fromRdfResource(resource, {
3120
+ ...options,
3121
+ ignoreRdfType: false,
3122
+ }))
3123
+ .altLazy(() => PropertyShape.fromRdfResource(resource, {
3124
+ ...options,
3125
+ ignoreRdfType: false,
3126
+ }))
3127
+ .altLazy(() => ValidationReport.fromRdfResource(resource, {
3128
+ ...options,
3129
+ ignoreRdfType: false,
3130
+ }))
3131
+ .altLazy(() => ValidationResult.fromRdfResource(resource, {
3132
+ ...options,
3133
+ ignoreRdfType: false,
3134
+ }));
3135
+ $Object.fromRdfResourceValues = ((values, options) => values.chainMap((value) => {
3136
+ const valueAsValues = value.toValues();
3137
+ return NodeShape.fromRdfResourceValues(valueAsValues, {
3138
+ ...options,
3139
+ schema: options.schema.members["NodeShape"].type,
3140
+ })
3141
+ .altLazy(() => Ontology.fromRdfResourceValues(valueAsValues, {
3142
+ ...options,
3143
+ schema: options.schema.members["Ontology"].type,
3144
+ }))
3145
+ .altLazy(() => PropertyGroup.fromRdfResourceValues(valueAsValues, {
3146
+ ...options,
3147
+ schema: options.schema.members["PropertyGroup"].type,
3148
+ }))
3149
+ .altLazy(() => PropertyShape.fromRdfResourceValues(valueAsValues, {
3150
+ ...options,
3151
+ schema: options.schema.members["PropertyShape"].type,
3152
+ }))
3153
+ .altLazy(() => ValidationReport.fromRdfResourceValues(valueAsValues, {
3154
+ ...options,
3155
+ schema: options.schema.members["ValidationReport"].type,
3156
+ }))
3157
+ .altLazy(() => ValidationResult.fromRdfResourceValues(valueAsValues, {
3158
+ ...options,
3159
+ schema: options.schema.members["ValidationResult"].type,
3160
+ }))
3161
+ .chain((values) => values.head());
3162
+ }));
3163
+ let Identifier;
3164
+ (function (Identifier) {
3165
+ Identifier.parse = $parseIdentifier;
3166
+ Identifier.stringify = NTriplesTerm.stringify;
3167
+ })(Identifier = $Object.Identifier || ($Object.Identifier = {}));
3168
+ $Object.schema = {
3169
+ kind: "ObjectUnion",
3170
+ members: {
3171
+ NodeShape: { discriminantValues: ["NodeShape"], type: NodeShape.schema },
3172
+ Ontology: { discriminantValues: ["Ontology"], type: Ontology.schema },
3173
+ PropertyGroup: {
3174
+ discriminantValues: ["PropertyGroup"],
3175
+ type: PropertyGroup.schema,
3176
+ },
3177
+ PropertyShape: {
3178
+ discriminantValues: ["PropertyShape"],
3179
+ type: PropertyShape.schema,
3180
+ },
3181
+ ValidationReport: {
3182
+ discriminantValues: ["ValidationReport"],
3183
+ type: ValidationReport.schema,
3184
+ },
3185
+ ValidationResult: {
3186
+ discriminantValues: ["ValidationResult"],
3187
+ type: ValidationResult.schema,
3188
+ },
3189
+ },
3190
+ properties: {},
3191
+ };
3192
+ $Object.toRdfResource = (object, options) => {
3193
+ if (NodeShape.isNodeShape(object)) {
3194
+ return NodeShape.toRdfResource(object, options);
3195
+ }
3196
+ if (Ontology.isOntology(object)) {
3197
+ return Ontology.toRdfResource(object, options);
3198
+ }
3199
+ if (PropertyGroup.isPropertyGroup(object)) {
3200
+ return PropertyGroup.toRdfResource(object, options);
3201
+ }
3202
+ if (PropertyShape.isPropertyShape(object)) {
3203
+ return PropertyShape.toRdfResource(object, options);
3204
+ }
3205
+ if (ValidationReport.isValidationReport(object)) {
3206
+ return ValidationReport.toRdfResource(object, options);
3207
+ }
3208
+ if (ValidationResult.isValidationResult(object)) {
3209
+ return ValidationResult.toRdfResource(object, options);
3210
+ }
3211
+ throw new Error("unrecognized type");
3212
+ };
3213
+ $Object.toRdfResourceValues = ((value, _options) => {
3214
+ if (NodeShape.isNodeShape(value)) {
3215
+ return [
3216
+ NodeShape.toRdfResource(value, {
3217
+ graph: _options.graph,
3218
+ resourceSet: _options.resourceSet,
3219
+ }).identifier,
3220
+ ];
3221
+ }
3222
+ if (Ontology.isOntology(value)) {
3223
+ return [
3224
+ Ontology.toRdfResource(value, {
3225
+ graph: _options.graph,
3226
+ resourceSet: _options.resourceSet,
3227
+ }).identifier,
3228
+ ];
3229
+ }
3230
+ if (PropertyGroup.isPropertyGroup(value)) {
3231
+ return [
3232
+ PropertyGroup.toRdfResource(value, {
3233
+ graph: _options.graph,
3234
+ resourceSet: _options.resourceSet,
3235
+ }).identifier,
3236
+ ];
3237
+ }
3238
+ if (PropertyShape.isPropertyShape(value)) {
3239
+ return [
3240
+ PropertyShape.toRdfResource(value, {
3241
+ graph: _options.graph,
3242
+ resourceSet: _options.resourceSet,
3243
+ }).identifier,
3244
+ ];
3245
+ }
3246
+ if (ValidationReport.isValidationReport(value)) {
3247
+ return [
3248
+ ValidationReport.toRdfResource(value, {
3249
+ graph: _options.graph,
3250
+ resourceSet: _options.resourceSet,
3251
+ }).identifier,
3252
+ ];
3253
+ }
3254
+ if (ValidationResult.isValidationResult(value)) {
3255
+ return [
3256
+ ValidationResult.toRdfResource(value, {
3257
+ graph: _options.graph,
3258
+ resourceSet: _options.resourceSet,
3259
+ }).identifier,
3260
+ ];
3261
+ }
3262
+ throw new Error("unable to serialize to RDF");
3263
+ });
3264
+ })($Object || ($Object = {}));
3265
+ //# sourceMappingURL=shacl-ast.shaclmate.js.map