@shaclmate/shacl-ast 4.0.41 → 4.0.42

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