@shaclmate/shacl-ast 4.0.49 → 4.0.50

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