@shaclmate/compiler 4.0.30 → 4.0.32

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.
Files changed (40) hide show
  1. package/dist/generators/ts/AbstractTermType.js +2 -1
  2. package/dist/generators/ts/AbstractType.d.ts +1 -0
  3. package/dist/generators/ts/AbstractUnionType.d.ts +3 -0
  4. package/dist/generators/ts/AbstractUnionType.js +20 -9
  5. package/dist/generators/ts/ListType.js +1 -1
  6. package/dist/generators/ts/NamedObjectType.js +2 -3
  7. package/dist/generators/ts/NamedObjectUnionType.js +2 -2
  8. package/dist/generators/ts/Snippets.d.ts +5 -1
  9. package/dist/generators/ts/Snippets.js +35 -7
  10. package/dist/generators/ts/_NamedObjectType/AbstractProperty.d.ts +3 -3
  11. package/dist/generators/ts/_NamedObjectType/DiscriminantProperty.d.ts +2 -2
  12. package/dist/generators/ts/_NamedObjectType/DiscriminantProperty.js +15 -21
  13. package/dist/generators/ts/_NamedObjectType/IdentifierProperty.d.ts +1 -1
  14. package/dist/generators/ts/_NamedObjectType/IdentifierProperty.js +4 -4
  15. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js +22 -3
  16. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js +100 -7
  17. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionDeclaration.js +14 -20
  18. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.js +3 -3
  19. package/dist/generators/ts/_NamedObjectType/ShaclProperty.d.ts +1 -1
  20. package/dist/generators/ts/_NamedObjectType/ShaclProperty.js +4 -4
  21. package/dist/generators/ts/_snippets/snippets_ToRdfResourceFunction.js +8 -2
  22. package/dist/generators/ts/_snippets/snippets__FromRdfResourceFunction.d.ts +3 -0
  23. package/dist/generators/ts/_snippets/snippets__FromRdfResourceFunction.js +13 -0
  24. package/dist/generators/ts/_snippets/snippets__ToRdfResourceFunction.d.ts +3 -0
  25. package/dist/generators/ts/_snippets/snippets__ToRdfResourceFunction.js +12 -0
  26. package/dist/generators/ts/_snippets/snippets_sequenceRecord.d.ts +3 -0
  27. package/dist/generators/ts/_snippets/snippets_sequenceRecord.js +18 -0
  28. package/dist/generators/ts/_snippets/snippets_wrap_FromRdfResourceFunction.d.ts +3 -0
  29. package/dist/generators/ts/_snippets/snippets_wrap_FromRdfResourceFunction.js +10 -0
  30. package/dist/generators/ts/_snippets/snippets_wrap_ToRdfResourceFunction.d.ts +3 -0
  31. package/dist/generators/ts/_snippets/snippets_wrap_ToRdfResourceFunction.js +14 -0
  32. package/dist/input/generated.d.ts +34 -116
  33. package/dist/input/generated.js +1698 -2069
  34. package/package.json +2 -2
  35. package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromJsonFunctionDeclaration.d.ts +0 -5
  36. package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromJsonFunctionDeclaration.js +0 -38
  37. package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromRdfResourceFunctionDeclaration.d.ts +0 -5
  38. package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromRdfResourceFunctionDeclaration.js +0 -98
  39. package/dist/generators/ts/_snippets/snippets_PropertiesFromRdfResourceFunction.d.ts +0 -3
  40. package/dist/generators/ts/_snippets/snippets_PropertiesFromRdfResourceFunction.js +0 -13
@@ -255,6 +255,17 @@ var $RdfVocabularies;
255
255
  xsd.unsignedShort = dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#unsignedShort");
256
256
  })(xsd = $RdfVocabularies.xsd || ($RdfVocabularies.xsd = {}));
257
257
  })($RdfVocabularies || ($RdfVocabularies = {}));
258
+ function $sequenceRecord(record) {
259
+ const result = {};
260
+ for (const key of globalThis.Object.keys(record)) {
261
+ const either = record[key];
262
+ if (either.isLeft()) {
263
+ return either;
264
+ }
265
+ result[key] = either.extract();
266
+ }
267
+ return Right(result);
268
+ }
258
269
  function $shaclPropertyFromRdf({ graph, propertySchema, resource, typeFromRdf, }) {
259
270
  return typeFromRdf(Right(resource.values(propertySchema.path, { graph, unique: true }))).chain((values) => values.head());
260
271
  }
@@ -264,6 +275,41 @@ function $shaclPropertyFromRdf({ graph, propertySchema, resource, typeFromRdf, }
264
275
  function $strictEquals(left, right) {
265
276
  return $EqualsResult.fromBooleanEqualsResult(left, right, left === right);
266
277
  }
278
+ function $wrap_FromRdfResourceFunction(_fromRdfResourceFunction) {
279
+ return (resource, options) => {
280
+ let { context, graph, ignoreRdfType = false, objectSet, preferredLanguages, } = options ?? {};
281
+ if (!objectSet) {
282
+ objectSet = new $RdfjsDatasetObjectSet(resource.dataset);
283
+ }
284
+ return _fromRdfResourceFunction(resource, {
285
+ context,
286
+ graph,
287
+ ignoreRdfType,
288
+ objectSet,
289
+ preferredLanguages,
290
+ });
291
+ };
292
+ }
293
+ function $wrap_ToRdfResourceFunction(_toRdfResourceFunction) {
294
+ return (object, options) => {
295
+ let { graph, ignoreRdfType = false, resourceSet } = options ?? {};
296
+ if (!resourceSet) {
297
+ resourceSet = new ResourceSet({
298
+ dataFactory: dataFactory,
299
+ dataset: datasetFactory.dataset(),
300
+ });
301
+ }
302
+ const resource = resourceSet.resource(object.$identifier());
303
+ _toRdfResourceFunction({
304
+ graph,
305
+ ignoreRdfType,
306
+ object,
307
+ resource,
308
+ resourceSet,
309
+ });
310
+ return resource;
311
+ };
312
+ }
267
313
  export var PropertyShape;
268
314
  (function (PropertyShape) {
269
315
  function create(parameters) {
@@ -1069,33 +1115,7 @@ export var PropertyShape;
1069
1115
  return true;
1070
1116
  }
1071
1117
  PropertyShape.filter = filter;
1072
- PropertyShape.fromRdfResource = (resource, options) => {
1073
- let { context, graph, ignoreRdfType = false, objectSet, preferredLanguages, } = options ?? {};
1074
- if (!objectSet) {
1075
- objectSet = new $RdfjsDatasetObjectSet(resource.dataset);
1076
- }
1077
- return PropertyShape.propertiesFromRdfResource(resource, {
1078
- context,
1079
- graph,
1080
- ignoreRdfType,
1081
- objectSet,
1082
- preferredLanguages,
1083
- }).map(create);
1084
- };
1085
- PropertyShape.fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
1086
- .toResource()
1087
- .chain((resource) => PropertyShape.fromRdfResource(resource, options))));
1088
- PropertyShape.fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape");
1089
- function isPropertyShape(object) {
1090
- switch (object.$type) {
1091
- case "PropertyShape":
1092
- return true;
1093
- default:
1094
- return false;
1095
- }
1096
- }
1097
- PropertyShape.isPropertyShape = isPropertyShape;
1098
- PropertyShape.propertiesFromRdfResource = ($resource, _$options) => {
1118
+ PropertyShape._fromRdfResource = ($resource, _$options) => {
1099
1119
  return (!_$options.ignoreRdfType
1100
1120
  ? $resource
1101
1121
  .value($RdfVocabularies.rdf.type, { graph: _$options.graph })
@@ -1114,768 +1134,619 @@ export var PropertyShape;
1114
1134
  }
1115
1135
  return Left(new Error(`${$resource.identifier} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#PropertyShape)`));
1116
1136
  })
1117
- : Right(true)).chain((_rdfTypeCheck) => Right(new Resource.Value({
1118
- dataFactory: dataFactory,
1119
- focusResource: $resource,
1120
- propertyPath: $RdfVocabularies.rdf.subject,
1121
- term: $resource.identifier,
1122
- }).toValues())
1123
- .chain((values) => values.chainMap((value) => value.toIdentifier()))
1124
- .chain((values) => values.head())
1125
- .chain(($identifier) => Right("PropertyShape").chain(($type) => $shaclPropertyFromRdf({
1126
- graph: _$options.graph,
1127
- resource: $resource,
1128
- propertySchema: PropertyShape.schema.properties.and,
1129
- typeFromRdf: (resourceValues) => resourceValues
1130
- .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
1131
- .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
1132
- focusResource: $resource,
1133
- propertyPath: PropertyShape.schema.properties.and.path,
1134
- values: valueList.toArray(),
1135
- })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
1136
- .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
1137
- .map((values) => values.length > 0
1138
- ? values.map((value) => Maybe.of(value))
1139
- : Resource.Values.fromValue({
1140
- focusResource: $resource,
1141
- propertyPath: PropertyShape.schema.properties.and.path,
1142
- value: Maybe.empty(),
1143
- })),
1144
- }).chain((and) => $shaclPropertyFromRdf({
1145
- graph: _$options.graph,
1146
- resource: $resource,
1147
- propertySchema: PropertyShape.schema.properties.classes,
1148
- typeFromRdf: (resourceValues) => resourceValues
1149
- .chain((values) => values.chainMap((value) => value.toIri()))
1150
- .map((values) => values.toArray())
1151
- .map((valuesArray) => Resource.Values.fromValue({
1152
- focusResource: $resource,
1153
- propertyPath: PropertyShape.schema.properties.classes.path,
1154
- value: valuesArray,
1155
- })),
1156
- }).chain((classes) => $shaclPropertyFromRdf({
1157
- graph: _$options.graph,
1158
- resource: $resource,
1159
- propertySchema: PropertyShape.schema.properties.comment,
1160
- typeFromRdf: (resourceValues) => resourceValues
1161
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1162
- .chain((values) => values.chainMap((value) => value.toString()))
1163
- .map((values) => values.length > 0
1164
- ? values.map((value) => Maybe.of(value))
1165
- : Resource.Values.fromValue({
1166
- focusResource: $resource,
1167
- propertyPath: PropertyShape.schema.properties.comment.path,
1168
- value: Maybe.empty(),
1169
- })),
1170
- }).chain((comment) => $shaclPropertyFromRdf({
1171
- graph: _$options.graph,
1172
- resource: $resource,
1173
- propertySchema: PropertyShape.schema.properties.datatype,
1174
- typeFromRdf: (resourceValues) => resourceValues
1175
- .chain((values) => values.chainMap((value) => value.toIri()))
1176
- .map((values) => values.length > 0
1177
- ? values.map((value) => Maybe.of(value))
1178
- : Resource.Values.fromValue({
1179
- focusResource: $resource,
1180
- propertyPath: PropertyShape.schema.properties.datatype.path,
1181
- value: Maybe.empty(),
1182
- })),
1183
- }).chain((datatype) => $shaclPropertyFromRdf({
1184
- graph: _$options.graph,
1185
- resource: $resource,
1186
- propertySchema: PropertyShape.schema.properties.deactivated,
1187
- typeFromRdf: (resourceValues) => resourceValues
1188
- .chain((values) => values.chainMap((value) => value.toBoolean()))
1189
- .map((values) => values.length > 0
1190
- ? values.map((value) => Maybe.of(value))
1191
- : Resource.Values.fromValue({
1192
- focusResource: $resource,
1193
- propertyPath: PropertyShape.schema.properties.deactivated
1194
- .path,
1195
- value: Maybe.empty(),
1196
- })),
1197
- }).chain((deactivated) => $shaclPropertyFromRdf({
1198
- graph: _$options.graph,
1199
- resource: $resource,
1200
- propertySchema: PropertyShape.schema.properties.defaultValue,
1201
- typeFromRdf: (resourceValues) => resourceValues
1202
- .chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
1203
- switch (term.termType) {
1204
- case "NamedNode":
1205
- case "Literal":
1206
- return Either.of(term);
1207
- default:
1208
- return Left(new Resource.MistypedTermValueError({
1209
- actualValue: term,
1210
- expectedValueType: "(NamedNode | Literal)",
1211
- focusResource: $resource,
1212
- propertyPath: PropertyShape.schema.properties
1213
- .defaultValue.path,
1214
- }));
1215
- }
1216
- })))
1217
- .map((values) => values.length > 0
1218
- ? values.map((value) => Maybe.of(value))
1219
- : Resource.Values.fromValue({
1220
- focusResource: $resource,
1221
- propertyPath: PropertyShape.schema.properties
1222
- .defaultValue.path,
1223
- value: Maybe.empty(),
1224
- })),
1225
- }).chain((defaultValue) => $shaclPropertyFromRdf({
1226
- graph: _$options.graph,
1227
- resource: $resource,
1228
- propertySchema: PropertyShape.schema.properties.description,
1229
- typeFromRdf: (resourceValues) => resourceValues
1230
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1231
- .chain((values) => values.chainMap((value) => value.toString()))
1232
- .map((values) => values.length > 0
1233
- ? values.map((value) => Maybe.of(value))
1234
- : Resource.Values.fromValue({
1235
- focusResource: $resource,
1236
- propertyPath: PropertyShape.schema.properties
1237
- .description.path,
1238
- value: Maybe.empty(),
1239
- })),
1240
- }).chain((description) => $shaclPropertyFromRdf({
1241
- graph: _$options.graph,
1242
- resource: $resource,
1243
- propertySchema: PropertyShape.schema.properties.display,
1244
- typeFromRdf: (resourceValues) => resourceValues
1245
- .map((values) => values.length > 0
1246
- ? values
1247
- : new Resource.Value({
1248
- dataFactory: dataFactory,
1249
- focusResource: $resource,
1250
- propertyPath: PropertyShape.schema.properties
1251
- .display.path,
1252
- term: dataFactory.literal("false", $RdfVocabularies.xsd.boolean),
1253
- }).toValues())
1254
- .chain((values) => values.chainMap((value) => value.toBoolean())),
1255
- }).chain((display) => $shaclPropertyFromRdf({
1256
- graph: _$options.graph,
1257
- resource: $resource,
1258
- propertySchema: PropertyShape.schema.properties.flags,
1259
- typeFromRdf: (resourceValues) => resourceValues
1260
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1261
- .chain((values) => values.chainMap((value) => value.toString()))
1262
- .map((values) => values.toArray())
1263
- .map((valuesArray) => Resource.Values.fromValue({
1137
+ : Right(true)).chain((_rdfTypeCheck) => $sequenceRecord({
1138
+ $identifier: Right(new Resource.Value({
1139
+ dataFactory: dataFactory,
1264
1140
  focusResource: $resource,
1265
- propertyPath: PropertyShape.schema.properties.flags
1266
- .path,
1267
- value: valuesArray,
1268
- })),
1269
- }).chain((flags) => $shaclPropertyFromRdf({
1270
- graph: _$options.graph,
1271
- resource: $resource,
1272
- propertySchema: PropertyShape.schema.properties.groups,
1273
- typeFromRdf: (resourceValues) => resourceValues
1141
+ propertyPath: $RdfVocabularies.rdf.subject,
1142
+ term: $resource.identifier,
1143
+ }).toValues())
1274
1144
  .chain((values) => values.chainMap((value) => value.toIdentifier()))
1275
- .map((values) => values.toArray())
1276
- .map((valuesArray) => Resource.Values.fromValue({
1277
- focusResource: $resource,
1278
- propertyPath: PropertyShape.schema.properties.groups
1279
- .path,
1280
- value: valuesArray,
1281
- })),
1282
- }).chain((groups) => $shaclPropertyFromRdf({
1283
- graph: _$options.graph,
1284
- resource: $resource,
1285
- propertySchema: PropertyShape.schema.properties.hasValues,
1286
- typeFromRdf: (resourceValues) => resourceValues
1287
- .chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
1288
- switch (term.termType) {
1289
- case "NamedNode":
1290
- case "Literal":
1291
- return Either.of(term);
1292
- default:
1293
- return Left(new Resource.MistypedTermValueError({
1294
- actualValue: term,
1295
- expectedValueType: "(NamedNode | Literal)",
1296
- focusResource: $resource,
1297
- propertyPath: PropertyShape.schema
1298
- .properties.hasValues
1299
- .path,
1300
- }));
1301
- }
1302
- })))
1303
- .map((values) => values.toArray())
1304
- .map((valuesArray) => Resource.Values.fromValue({
1305
- focusResource: $resource,
1306
- propertyPath: PropertyShape.schema.properties
1307
- .hasValues.path,
1308
- value: valuesArray,
1309
- })),
1310
- }).chain((hasValues) => $shaclPropertyFromRdf({
1311
- graph: _$options.graph,
1312
- resource: $resource,
1313
- propertySchema: PropertyShape.schema.properties.in_,
1314
- typeFromRdf: (resourceValues) => resourceValues
1315
- .chain((values) => values.chainMap((value) => value.toList({
1145
+ .chain((values) => values.head()),
1146
+ and: $shaclPropertyFromRdf({
1316
1147
  graph: _$options.graph,
1317
- })))
1318
- .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
1319
- focusResource: $resource,
1320
- propertyPath: PropertyShape.schema
1321
- .properties.in_.path,
1322
- values: valueList.toArray(),
1323
- })).chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
1324
- switch (term.termType) {
1325
- case "NamedNode":
1326
- case "Literal":
1327
- return Either.of(term);
1328
- default:
1329
- return Left(new Resource.MistypedTermValueError({
1330
- actualValue: term,
1331
- expectedValueType: "(NamedNode | Literal)",
1332
- focusResource: $resource,
1333
- propertyPath: PropertyShape
1334
- .schema
1335
- .properties.in_
1336
- .path,
1337
- }));
1338
- }
1339
- })))))
1340
- .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
1341
- .map((values) => values.length > 0
1342
- ? values.map((value) => Maybe.of(value))
1343
- : Resource.Values.fromValue({
1344
- focusResource: $resource,
1345
- propertyPath: PropertyShape.schema
1346
- .properties.in_.path,
1347
- value: Maybe.empty(),
1348
- })),
1349
- }).chain((in_) => $shaclPropertyFromRdf({
1350
- graph: _$options.graph,
1351
- resource: $resource,
1352
- propertySchema: PropertyShape.schema.properties.isDefinedBy,
1353
- typeFromRdf: (resourceValues) => resourceValues
1354
- .chain((values) => values.chainMap((value) => value.toIdentifier()))
1355
- .map((values) => values.length > 0
1356
- ? values.map((value) => Maybe.of(value))
1357
- : Resource.Values.fromValue({
1358
- focusResource: $resource,
1359
- propertyPath: PropertyShape.schema
1360
- .properties.isDefinedBy
1361
- .path,
1362
- value: Maybe.empty(),
1363
- })),
1364
- }).chain((isDefinedBy) => $shaclPropertyFromRdf({
1365
- graph: _$options.graph,
1366
- resource: $resource,
1367
- propertySchema: PropertyShape.schema.properties.label,
1368
- typeFromRdf: (resourceValues) => resourceValues
1369
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1370
- .chain((values) => values.chainMap((value) => value.toString()))
1371
- .map((values) => values.length > 0
1372
- ? values.map((value) => Maybe.of(value))
1373
- : Resource.Values.fromValue({
1148
+ resource: $resource,
1149
+ propertySchema: PropertyShape.schema.properties.and,
1150
+ typeFromRdf: (resourceValues) => resourceValues
1151
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
1152
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
1374
1153
  focusResource: $resource,
1375
- propertyPath: PropertyShape.schema
1376
- .properties.label.path,
1377
- value: Maybe.empty(),
1378
- })),
1379
- }).chain((label) => $shaclPropertyFromRdf({
1380
- graph: _$options.graph,
1381
- resource: $resource,
1382
- propertySchema: PropertyShape.schema.properties.languageIn,
1383
- typeFromRdf: (resourceValues) => resourceValues
1384
- .chain((values) => values.chainMap((value) => value.toList({
1154
+ propertyPath: PropertyShape.schema.properties.and.path,
1155
+ values: valueList.toArray(),
1156
+ })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
1157
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
1158
+ .map((values) => values.length > 0
1159
+ ? values.map((value) => Maybe.of(value))
1160
+ : Resource.Values.fromValue({
1161
+ focusResource: $resource,
1162
+ propertyPath: PropertyShape.schema.properties.and.path,
1163
+ value: Maybe.empty(),
1164
+ })),
1165
+ }),
1166
+ classes: $shaclPropertyFromRdf({
1385
1167
  graph: _$options.graph,
1386
- })))
1387
- .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
1388
- focusResource: $resource,
1389
- propertyPath: PropertyShape.schema
1390
- .properties
1391
- .languageIn.path,
1392
- values: valueList.toArray(),
1393
- }))
1394
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1395
- .chain((values) => values.chainMap((value) => value.toString()))))
1396
- .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
1397
- .map((values) => values.length > 0
1398
- ? values.map((value) => Maybe.of(value))
1399
- : Resource.Values.fromValue({
1400
- focusResource: $resource,
1401
- propertyPath: PropertyShape.schema
1402
- .properties.languageIn
1403
- .path,
1404
- value: Maybe.empty(),
1405
- })),
1406
- }).chain((languageIn) => $shaclPropertyFromRdf({
1407
- graph: _$options.graph,
1408
- resource: $resource,
1409
- propertySchema: PropertyShape.schema.properties.maxCount,
1410
- typeFromRdf: (resourceValues) => resourceValues
1411
- .chain((values) => values.chainMap((value) => value.toBigInt()))
1412
- .map((values) => values.length > 0
1413
- ? values.map((value) => Maybe.of(value))
1414
- : Resource.Values.fromValue({
1415
- focusResource: $resource,
1416
- propertyPath: PropertyShape.schema
1417
- .properties.maxCount
1418
- .path,
1419
- value: Maybe.empty(),
1420
- })),
1421
- }).chain((maxCount) => $shaclPropertyFromRdf({
1422
- graph: _$options.graph,
1423
- resource: $resource,
1424
- propertySchema: PropertyShape.schema.properties.maxExclusive,
1425
- typeFromRdf: (resourceValues) => resourceValues
1426
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1427
- .chain((values) => values.chainMap((value) => value.toLiteral()))
1428
- .map((values) => values.length > 0
1429
- ? values.map((value) => Maybe.of(value))
1430
- : Resource.Values.fromValue({
1431
- focusResource: $resource,
1432
- propertyPath: PropertyShape.schema
1433
- .properties
1434
- .maxExclusive
1435
- .path,
1436
- value: Maybe.empty(),
1437
- })),
1438
- }).chain((maxExclusive) => $shaclPropertyFromRdf({
1439
- graph: _$options.graph,
1440
- resource: $resource,
1441
- propertySchema: PropertyShape.schema.properties
1442
- .maxInclusive,
1443
- typeFromRdf: (resourceValues) => resourceValues
1444
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1445
- .chain((values) => values.chainMap((value) => value.toLiteral()))
1446
- .map((values) => values.length > 0
1447
- ? values.map((value) => Maybe.of(value))
1448
- : Resource.Values.fromValue({
1449
- focusResource: $resource,
1450
- propertyPath: PropertyShape
1451
- .schema
1452
- .properties
1453
- .maxInclusive
1454
- .path,
1455
- value: Maybe.empty(),
1456
- })),
1457
- }).chain((maxInclusive) => $shaclPropertyFromRdf({
1458
- graph: _$options.graph,
1459
- resource: $resource,
1460
- propertySchema: PropertyShape.schema.properties.maxLength,
1461
- typeFromRdf: (resourceValues) => resourceValues
1462
- .chain((values) => values.chainMap((value) => value.toBigInt()))
1463
- .map((values) => values.length > 0
1464
- ? values.map((value) => Maybe.of(value))
1465
- : Resource.Values.fromValue({
1466
- focusResource: $resource,
1467
- propertyPath: PropertyShape
1468
- .schema
1469
- .properties
1470
- .maxLength
1471
- .path,
1472
- value: Maybe.empty(),
1473
- })),
1474
- }).chain((maxLength) => $shaclPropertyFromRdf({
1475
- graph: _$options.graph,
1476
- resource: $resource,
1477
- propertySchema: PropertyShape.schema.properties
1478
- .minCount,
1479
- typeFromRdf: (resourceValues) => resourceValues
1480
- .chain((values) => values.chainMap((value) => value.toBigInt()))
1481
- .map((values) => values.length > 0
1482
- ? values.map((value) => Maybe.of(value))
1483
- : Resource.Values.fromValue({
1484
- focusResource: $resource,
1485
- propertyPath: PropertyShape
1486
- .schema
1487
- .properties
1488
- .minCount
1489
- .path,
1490
- value: Maybe.empty(),
1491
- })),
1492
- }).chain((minCount) => $shaclPropertyFromRdf({
1493
- graph: _$options.graph,
1494
- resource: $resource,
1495
- propertySchema: PropertyShape.schema.properties
1496
- .minExclusive,
1497
- typeFromRdf: (resourceValues) => resourceValues
1498
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1499
- .chain((values) => values.chainMap((value) => value.toLiteral()))
1500
- .map((values) => values.length > 0
1501
- ? values.map((value) => Maybe.of(value))
1502
- : Resource.Values.fromValue({
1503
- focusResource: $resource,
1504
- propertyPath: PropertyShape
1505
- .schema
1506
- .properties
1507
- .minExclusive
1508
- .path,
1509
- value: Maybe.empty(),
1510
- })),
1511
- }).chain((minExclusive) => $shaclPropertyFromRdf({
1512
- graph: _$options.graph,
1513
- resource: $resource,
1514
- propertySchema: PropertyShape.schema.properties
1515
- .minInclusive,
1516
- typeFromRdf: (resourceValues) => resourceValues
1517
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1518
- .chain((values) => values.chainMap((value) => value.toLiteral()))
1519
- .map((values) => values.length > 0
1520
- ? values.map((value) => Maybe.of(value))
1521
- : Resource.Values.fromValue({
1522
- focusResource: $resource,
1523
- propertyPath: PropertyShape
1524
- .schema
1525
- .properties
1526
- .minInclusive
1527
- .path,
1528
- value: Maybe.empty(),
1529
- })),
1530
- }).chain((minInclusive) => $shaclPropertyFromRdf({
1531
- graph: _$options.graph,
1532
- resource: $resource,
1533
- propertySchema: PropertyShape.schema.properties
1534
- .minLength,
1535
- typeFromRdf: (resourceValues) => resourceValues
1536
- .chain((values) => values.chainMap((value) => value.toBigInt()))
1537
- .map((values) => values.length >
1538
- 0
1539
- ? values.map((value) => Maybe.of(value))
1540
- : Resource.Values.fromValue({
1541
- focusResource: $resource,
1542
- propertyPath: PropertyShape
1543
- .schema
1544
- .properties
1545
- .minLength
1546
- .path,
1547
- value: Maybe.empty(),
1548
- })),
1549
- }).chain((minLength) => $shaclPropertyFromRdf({
1550
- graph: _$options.graph,
1551
- resource: $resource,
1552
- propertySchema: PropertyShape.schema
1553
- .properties
1554
- .mutable,
1555
- typeFromRdf: (resourceValues) => resourceValues
1556
- .chain((values) => values.chainMap((value) => value.toBoolean()))
1557
- .map((values) => values.length >
1558
- 0
1559
- ? values.map((value) => Maybe.of(value))
1560
- : Resource.Values.fromValue({
1168
+ resource: $resource,
1169
+ propertySchema: PropertyShape.schema.properties.classes,
1170
+ typeFromRdf: (resourceValues) => resourceValues
1171
+ .chain((values) => values.chainMap((value) => value.toIri()))
1172
+ .map((values) => values.toArray())
1173
+ .map((valuesArray) => Resource.Values.fromValue({
1561
1174
  focusResource: $resource,
1562
- propertyPath: PropertyShape
1563
- .schema
1564
- .properties
1565
- .mutable
1566
- .path,
1567
- value: Maybe.empty(),
1175
+ propertyPath: PropertyShape.schema.properties.classes.path,
1176
+ value: valuesArray,
1568
1177
  })),
1569
- }).chain((mutable) => $shaclPropertyFromRdf({
1570
- graph: _$options.graph,
1571
- resource: $resource,
1572
- propertySchema: PropertyShape.schema
1573
- .properties
1574
- .name,
1575
- typeFromRdf: (resourceValues) => resourceValues
1576
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1577
- .chain((values) => values.chainMap((value) => value.toString()))
1578
- .map((values) => values.length >
1579
- 0
1580
- ? values.map((value) => Maybe.of(value))
1581
- : Resource.Values.fromValue({
1178
+ }),
1179
+ comment: $shaclPropertyFromRdf({
1180
+ graph: _$options.graph,
1181
+ resource: $resource,
1182
+ propertySchema: PropertyShape.schema.properties.comment,
1183
+ typeFromRdf: (resourceValues) => resourceValues
1184
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1185
+ .chain((values) => values.chainMap((value) => value.toString()))
1186
+ .map((values) => values.length > 0
1187
+ ? values.map((value) => Maybe.of(value))
1188
+ : Resource.Values.fromValue({
1189
+ focusResource: $resource,
1190
+ propertyPath: PropertyShape.schema.properties.comment.path,
1191
+ value: Maybe.empty(),
1192
+ })),
1193
+ }),
1194
+ datatype: $shaclPropertyFromRdf({
1195
+ graph: _$options.graph,
1196
+ resource: $resource,
1197
+ propertySchema: PropertyShape.schema.properties.datatype,
1198
+ typeFromRdf: (resourceValues) => resourceValues
1199
+ .chain((values) => values.chainMap((value) => value.toIri()))
1200
+ .map((values) => values.length > 0
1201
+ ? values.map((value) => Maybe.of(value))
1202
+ : Resource.Values.fromValue({
1203
+ focusResource: $resource,
1204
+ propertyPath: PropertyShape.schema.properties.datatype.path,
1205
+ value: Maybe.empty(),
1206
+ })),
1207
+ }),
1208
+ deactivated: $shaclPropertyFromRdf({
1209
+ graph: _$options.graph,
1210
+ resource: $resource,
1211
+ propertySchema: PropertyShape.schema.properties.deactivated,
1212
+ typeFromRdf: (resourceValues) => resourceValues
1213
+ .chain((values) => values.chainMap((value) => value.toBoolean()))
1214
+ .map((values) => values.length > 0
1215
+ ? values.map((value) => Maybe.of(value))
1216
+ : Resource.Values.fromValue({
1217
+ focusResource: $resource,
1218
+ propertyPath: PropertyShape.schema.properties.deactivated.path,
1219
+ value: Maybe.empty(),
1220
+ })),
1221
+ }),
1222
+ defaultValue: $shaclPropertyFromRdf({
1223
+ graph: _$options.graph,
1224
+ resource: $resource,
1225
+ propertySchema: PropertyShape.schema.properties.defaultValue,
1226
+ typeFromRdf: (resourceValues) => resourceValues
1227
+ .chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
1228
+ switch (term.termType) {
1229
+ case "NamedNode":
1230
+ case "Literal":
1231
+ return Either.of(term);
1232
+ default:
1233
+ return Left(new Resource.MistypedTermValueError({
1234
+ actualValue: term,
1235
+ expectedValueType: "(NamedNode | Literal)",
1236
+ focusResource: $resource,
1237
+ propertyPath: PropertyShape.schema.properties.defaultValue.path,
1238
+ }));
1239
+ }
1240
+ })))
1241
+ .map((values) => values.length > 0
1242
+ ? values.map((value) => Maybe.of(value))
1243
+ : Resource.Values.fromValue({
1244
+ focusResource: $resource,
1245
+ propertyPath: PropertyShape.schema.properties.defaultValue.path,
1246
+ value: Maybe.empty(),
1247
+ })),
1248
+ }),
1249
+ description: $shaclPropertyFromRdf({
1250
+ graph: _$options.graph,
1251
+ resource: $resource,
1252
+ propertySchema: PropertyShape.schema.properties.description,
1253
+ typeFromRdf: (resourceValues) => resourceValues
1254
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1255
+ .chain((values) => values.chainMap((value) => value.toString()))
1256
+ .map((values) => values.length > 0
1257
+ ? values.map((value) => Maybe.of(value))
1258
+ : Resource.Values.fromValue({
1259
+ focusResource: $resource,
1260
+ propertyPath: PropertyShape.schema.properties.description.path,
1261
+ value: Maybe.empty(),
1262
+ })),
1263
+ }),
1264
+ display: $shaclPropertyFromRdf({
1265
+ graph: _$options.graph,
1266
+ resource: $resource,
1267
+ propertySchema: PropertyShape.schema.properties.display,
1268
+ typeFromRdf: (resourceValues) => resourceValues
1269
+ .map((values) => values.length > 0
1270
+ ? values
1271
+ : new Resource.Value({
1272
+ dataFactory: dataFactory,
1273
+ focusResource: $resource,
1274
+ propertyPath: PropertyShape.schema.properties.display.path,
1275
+ term: dataFactory.literal("false", $RdfVocabularies.xsd.boolean),
1276
+ }).toValues())
1277
+ .chain((values) => values.chainMap((value) => value.toBoolean())),
1278
+ }),
1279
+ flags: $shaclPropertyFromRdf({
1280
+ graph: _$options.graph,
1281
+ resource: $resource,
1282
+ propertySchema: PropertyShape.schema.properties.flags,
1283
+ typeFromRdf: (resourceValues) => resourceValues
1284
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1285
+ .chain((values) => values.chainMap((value) => value.toString()))
1286
+ .map((values) => values.toArray())
1287
+ .map((valuesArray) => Resource.Values.fromValue({
1582
1288
  focusResource: $resource,
1583
- propertyPath: PropertyShape
1584
- .schema
1585
- .properties
1586
- .name
1587
- .path,
1588
- value: Maybe.empty(),
1289
+ propertyPath: PropertyShape.schema.properties.flags.path,
1290
+ value: valuesArray,
1589
1291
  })),
1590
- }).chain((name) => $shaclPropertyFromRdf({
1591
- graph: _$options.graph,
1592
- resource: $resource,
1593
- propertySchema: PropertyShape.schema
1594
- .properties
1595
- .node,
1596
- typeFromRdf: (resourceValues) => resourceValues
1597
- .chain((values) => values.chainMap((value) => value.toIdentifier()))
1598
- .map((values) => values.length >
1599
- 0
1600
- ? values.map((value) => Maybe.of(value))
1601
- : Resource.Values.fromValue({
1292
+ }),
1293
+ groups: $shaclPropertyFromRdf({
1294
+ graph: _$options.graph,
1295
+ resource: $resource,
1296
+ propertySchema: PropertyShape.schema.properties.groups,
1297
+ typeFromRdf: (resourceValues) => resourceValues
1298
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
1299
+ .map((values) => values.toArray())
1300
+ .map((valuesArray) => Resource.Values.fromValue({
1602
1301
  focusResource: $resource,
1603
- propertyPath: PropertyShape
1604
- .schema
1605
- .properties
1606
- .node
1607
- .path,
1608
- value: Maybe.empty(),
1302
+ propertyPath: PropertyShape.schema.properties.groups.path,
1303
+ value: valuesArray,
1609
1304
  })),
1610
- }).chain((node) => $shaclPropertyFromRdf({
1611
- graph: _$options.graph,
1612
- resource: $resource,
1613
- propertySchema: PropertyShape.schema
1614
- .properties
1615
- .nodeKind,
1616
- typeFromRdf: (resourceValues) => resourceValues
1617
- .chain((values) => values.chainMap((value) => value.toIri([
1618
- dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNode"),
1619
- dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrIRI"),
1620
- dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrLiteral"),
1621
- dataFactory.namedNode("http://www.w3.org/ns/shacl#IRI"),
1622
- dataFactory.namedNode("http://www.w3.org/ns/shacl#IRIOrLiteral"),
1623
- dataFactory.namedNode("http://www.w3.org/ns/shacl#Literal"),
1624
- ])))
1625
- .map((values) => values.length >
1626
- 0
1627
- ? values.map((value) => Maybe.of(value))
1628
- : Resource.Values.fromValue({
1305
+ }),
1306
+ hasValues: $shaclPropertyFromRdf({
1307
+ graph: _$options.graph,
1308
+ resource: $resource,
1309
+ propertySchema: PropertyShape.schema.properties.hasValues,
1310
+ typeFromRdf: (resourceValues) => resourceValues
1311
+ .chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
1312
+ switch (term.termType) {
1313
+ case "NamedNode":
1314
+ case "Literal":
1315
+ return Either.of(term);
1316
+ default:
1317
+ return Left(new Resource.MistypedTermValueError({
1318
+ actualValue: term,
1319
+ expectedValueType: "(NamedNode | Literal)",
1320
+ focusResource: $resource,
1321
+ propertyPath: PropertyShape.schema.properties.hasValues.path,
1322
+ }));
1323
+ }
1324
+ })))
1325
+ .map((values) => values.toArray())
1326
+ .map((valuesArray) => Resource.Values.fromValue({
1629
1327
  focusResource: $resource,
1630
- propertyPath: PropertyShape
1631
- .schema
1632
- .properties
1633
- .nodeKind
1634
- .path,
1635
- value: Maybe.empty(),
1328
+ propertyPath: PropertyShape.schema.properties.hasValues.path,
1329
+ value: valuesArray,
1636
1330
  })),
1637
- }).chain((nodeKind) => $shaclPropertyFromRdf({
1638
- graph: _$options.graph,
1639
- resource: $resource,
1640
- propertySchema: PropertyShape.schema
1641
- .properties
1642
- .not,
1643
- typeFromRdf: (resourceValues) => resourceValues
1644
- .chain((values) => values.chainMap((value) => value.toIdentifier()))
1645
- .map((values) => values.toArray())
1646
- .map((valuesArray) => Resource.Values.fromValue({
1647
- focusResource: $resource,
1648
- propertyPath: PropertyShape
1649
- .schema
1650
- .properties
1651
- .not
1652
- .path,
1653
- value: valuesArray,
1654
- })),
1655
- }).chain((not) => $shaclPropertyFromRdf({
1656
- graph: _$options.graph,
1657
- resource: $resource,
1658
- propertySchema: PropertyShape.schema
1659
- .properties
1660
- .or,
1661
- typeFromRdf: (resourceValues) => resourceValues
1662
- .chain((values) => values.chainMap((value) => value.toList({
1331
+ }),
1332
+ in_: $shaclPropertyFromRdf({
1663
1333
  graph: _$options.graph,
1664
- })))
1665
- .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
1666
- focusResource: $resource,
1667
- propertyPath: PropertyShape
1668
- .schema
1669
- .properties
1670
- .or
1671
- .path,
1672
- values: valueList.toArray(),
1673
- })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
1674
- .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
1675
- .map((values) => values.length >
1676
- 0
1677
- ? values.map((value) => Maybe.of(value))
1678
- : Resource.Values.fromValue({
1334
+ resource: $resource,
1335
+ propertySchema: PropertyShape.schema.properties.in_,
1336
+ typeFromRdf: (resourceValues) => resourceValues
1337
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
1338
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
1679
1339
  focusResource: $resource,
1680
- propertyPath: PropertyShape
1681
- .schema
1682
- .properties
1683
- .or
1684
- .path,
1685
- value: Maybe.empty(),
1686
- })),
1687
- }).chain((or) => $shaclPropertyFromRdf({
1688
- graph: _$options.graph,
1689
- resource: $resource,
1690
- propertySchema: PropertyShape.schema
1691
- .properties
1692
- .order,
1693
- typeFromRdf: (resourceValues) => resourceValues
1694
- .chain((values) => values.chainMap((value) => value.toFloat()))
1695
- .map((values) => values.length >
1696
- 0
1697
- ? values.map((value) => Maybe.of(value))
1698
- : Resource.Values.fromValue({
1340
+ propertyPath: PropertyShape.schema.properties.in_.path,
1341
+ values: valueList.toArray(),
1342
+ })).chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
1343
+ switch (term.termType) {
1344
+ case "NamedNode":
1345
+ case "Literal":
1346
+ return Either.of(term);
1347
+ default:
1348
+ return Left(new Resource.MistypedTermValueError({
1349
+ actualValue: term,
1350
+ expectedValueType: "(NamedNode | Literal)",
1351
+ focusResource: $resource,
1352
+ propertyPath: PropertyShape.schema.properties.in_.path,
1353
+ }));
1354
+ }
1355
+ })))))
1356
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
1357
+ .map((values) => values.length > 0
1358
+ ? values.map((value) => Maybe.of(value))
1359
+ : Resource.Values.fromValue({
1360
+ focusResource: $resource,
1361
+ propertyPath: PropertyShape.schema.properties.in_.path,
1362
+ value: Maybe.empty(),
1363
+ })),
1364
+ }),
1365
+ isDefinedBy: $shaclPropertyFromRdf({
1366
+ graph: _$options.graph,
1367
+ resource: $resource,
1368
+ propertySchema: PropertyShape.schema.properties.isDefinedBy,
1369
+ typeFromRdf: (resourceValues) => resourceValues
1370
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
1371
+ .map((values) => values.length > 0
1372
+ ? values.map((value) => Maybe.of(value))
1373
+ : Resource.Values.fromValue({
1374
+ focusResource: $resource,
1375
+ propertyPath: PropertyShape.schema.properties.isDefinedBy.path,
1376
+ value: Maybe.empty(),
1377
+ })),
1378
+ }),
1379
+ label: $shaclPropertyFromRdf({
1380
+ graph: _$options.graph,
1381
+ resource: $resource,
1382
+ propertySchema: PropertyShape.schema.properties.label,
1383
+ typeFromRdf: (resourceValues) => resourceValues
1384
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1385
+ .chain((values) => values.chainMap((value) => value.toString()))
1386
+ .map((values) => values.length > 0
1387
+ ? values.map((value) => Maybe.of(value))
1388
+ : Resource.Values.fromValue({
1389
+ focusResource: $resource,
1390
+ propertyPath: PropertyShape.schema.properties.label.path,
1391
+ value: Maybe.empty(),
1392
+ })),
1393
+ }),
1394
+ languageIn: $shaclPropertyFromRdf({
1395
+ graph: _$options.graph,
1396
+ resource: $resource,
1397
+ propertySchema: PropertyShape.schema.properties.languageIn,
1398
+ typeFromRdf: (resourceValues) => resourceValues
1399
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
1400
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
1699
1401
  focusResource: $resource,
1700
- propertyPath: PropertyShape
1701
- .schema
1702
- .properties
1703
- .order
1704
- .path,
1705
- value: Maybe.empty(),
1706
- })),
1707
- }).chain((order) => $shaclPropertyFromRdf({
1708
- graph: _$options.graph,
1709
- resource: $resource,
1710
- propertySchema: PropertyShape.schema
1711
- .properties
1712
- .path,
1713
- typeFromRdf: (resourceValues) => $PropertyPath.fromRdfResourceValues(resourceValues, {
1714
- context: _$options.context,
1402
+ propertyPath: PropertyShape.schema.properties.languageIn.path,
1403
+ values: valueList.toArray(),
1404
+ }))
1405
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1406
+ .chain((values) => values.chainMap((value) => value.toString()))))
1407
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
1408
+ .map((values) => values.length > 0
1409
+ ? values.map((value) => Maybe.of(value))
1410
+ : Resource.Values.fromValue({
1411
+ focusResource: $resource,
1412
+ propertyPath: PropertyShape.schema.properties.languageIn.path,
1413
+ value: Maybe.empty(),
1414
+ })),
1415
+ }),
1416
+ maxCount: $shaclPropertyFromRdf({
1715
1417
  graph: _$options.graph,
1716
- preferredLanguages: _$options.preferredLanguages,
1717
- objectSet: _$options.objectSet,
1718
1418
  resource: $resource,
1719
- ignoreRdfType: true,
1720
- propertyPath: PropertyShape
1721
- .schema
1722
- .properties
1723
- .path
1724
- .path,
1419
+ propertySchema: PropertyShape.schema.properties.maxCount,
1420
+ typeFromRdf: (resourceValues) => resourceValues
1421
+ .chain((values) => values.chainMap((value) => value.toBigInt()))
1422
+ .map((values) => values.length > 0
1423
+ ? values.map((value) => Maybe.of(value))
1424
+ : Resource.Values.fromValue({
1425
+ focusResource: $resource,
1426
+ propertyPath: PropertyShape.schema.properties.maxCount.path,
1427
+ value: Maybe.empty(),
1428
+ })),
1725
1429
  }),
1726
- }).chain((path) => $shaclPropertyFromRdf({
1727
- graph: _$options.graph,
1728
- resource: $resource,
1729
- propertySchema: PropertyShape.schema
1730
- .properties
1731
- .patterns,
1732
- typeFromRdf: (resourceValues) => resourceValues
1733
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1734
- .chain((values) => values.chainMap((value) => value.toString()))
1735
- .map((values) => values.toArray())
1736
- .map((valuesArray) => Resource.Values.fromValue({
1737
- focusResource: $resource,
1738
- propertyPath: PropertyShape
1739
- .schema
1740
- .properties
1741
- .patterns
1742
- .path,
1743
- value: valuesArray,
1744
- })),
1745
- }).chain((patterns) => $shaclPropertyFromRdf({
1746
- graph: _$options.graph,
1747
- resource: $resource,
1748
- propertySchema: PropertyShape.schema
1749
- .properties
1750
- .resolve,
1751
- typeFromRdf: (resourceValues) => resourceValues
1752
- .chain((values) => values.chainMap((value) => value.toIdentifier()))
1753
- .map((values) => values.length >
1754
- 0
1755
- ? values.map((value) => Maybe.of(value))
1756
- : Resource.Values.fromValue({
1430
+ maxExclusive: $shaclPropertyFromRdf({
1431
+ graph: _$options.graph,
1432
+ resource: $resource,
1433
+ propertySchema: PropertyShape.schema.properties.maxExclusive,
1434
+ typeFromRdf: (resourceValues) => resourceValues
1435
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1436
+ .chain((values) => values.chainMap((value) => value.toLiteral()))
1437
+ .map((values) => values.length > 0
1438
+ ? values.map((value) => Maybe.of(value))
1439
+ : Resource.Values.fromValue({
1440
+ focusResource: $resource,
1441
+ propertyPath: PropertyShape.schema.properties.maxExclusive.path,
1442
+ value: Maybe.empty(),
1443
+ })),
1444
+ }),
1445
+ maxInclusive: $shaclPropertyFromRdf({
1446
+ graph: _$options.graph,
1447
+ resource: $resource,
1448
+ propertySchema: PropertyShape.schema.properties.maxInclusive,
1449
+ typeFromRdf: (resourceValues) => resourceValues
1450
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1451
+ .chain((values) => values.chainMap((value) => value.toLiteral()))
1452
+ .map((values) => values.length > 0
1453
+ ? values.map((value) => Maybe.of(value))
1454
+ : Resource.Values.fromValue({
1455
+ focusResource: $resource,
1456
+ propertyPath: PropertyShape.schema.properties.maxInclusive.path,
1457
+ value: Maybe.empty(),
1458
+ })),
1459
+ }),
1460
+ maxLength: $shaclPropertyFromRdf({
1461
+ graph: _$options.graph,
1462
+ resource: $resource,
1463
+ propertySchema: PropertyShape.schema.properties.maxLength,
1464
+ typeFromRdf: (resourceValues) => resourceValues
1465
+ .chain((values) => values.chainMap((value) => value.toBigInt()))
1466
+ .map((values) => values.length > 0
1467
+ ? values.map((value) => Maybe.of(value))
1468
+ : Resource.Values.fromValue({
1469
+ focusResource: $resource,
1470
+ propertyPath: PropertyShape.schema.properties.maxLength.path,
1471
+ value: Maybe.empty(),
1472
+ })),
1473
+ }),
1474
+ minCount: $shaclPropertyFromRdf({
1475
+ graph: _$options.graph,
1476
+ resource: $resource,
1477
+ propertySchema: PropertyShape.schema.properties.minCount,
1478
+ typeFromRdf: (resourceValues) => resourceValues
1479
+ .chain((values) => values.chainMap((value) => value.toBigInt()))
1480
+ .map((values) => values.length > 0
1481
+ ? values.map((value) => Maybe.of(value))
1482
+ : Resource.Values.fromValue({
1483
+ focusResource: $resource,
1484
+ propertyPath: PropertyShape.schema.properties.minCount.path,
1485
+ value: Maybe.empty(),
1486
+ })),
1487
+ }),
1488
+ minExclusive: $shaclPropertyFromRdf({
1489
+ graph: _$options.graph,
1490
+ resource: $resource,
1491
+ propertySchema: PropertyShape.schema.properties.minExclusive,
1492
+ typeFromRdf: (resourceValues) => resourceValues
1493
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1494
+ .chain((values) => values.chainMap((value) => value.toLiteral()))
1495
+ .map((values) => values.length > 0
1496
+ ? values.map((value) => Maybe.of(value))
1497
+ : Resource.Values.fromValue({
1498
+ focusResource: $resource,
1499
+ propertyPath: PropertyShape.schema.properties.minExclusive.path,
1500
+ value: Maybe.empty(),
1501
+ })),
1502
+ }),
1503
+ minInclusive: $shaclPropertyFromRdf({
1504
+ graph: _$options.graph,
1505
+ resource: $resource,
1506
+ propertySchema: PropertyShape.schema.properties.minInclusive,
1507
+ typeFromRdf: (resourceValues) => resourceValues
1508
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1509
+ .chain((values) => values.chainMap((value) => value.toLiteral()))
1510
+ .map((values) => values.length > 0
1511
+ ? values.map((value) => Maybe.of(value))
1512
+ : Resource.Values.fromValue({
1513
+ focusResource: $resource,
1514
+ propertyPath: PropertyShape.schema.properties.minInclusive.path,
1515
+ value: Maybe.empty(),
1516
+ })),
1517
+ }),
1518
+ minLength: $shaclPropertyFromRdf({
1519
+ graph: _$options.graph,
1520
+ resource: $resource,
1521
+ propertySchema: PropertyShape.schema.properties.minLength,
1522
+ typeFromRdf: (resourceValues) => resourceValues
1523
+ .chain((values) => values.chainMap((value) => value.toBigInt()))
1524
+ .map((values) => values.length > 0
1525
+ ? values.map((value) => Maybe.of(value))
1526
+ : Resource.Values.fromValue({
1527
+ focusResource: $resource,
1528
+ propertyPath: PropertyShape.schema.properties.minLength.path,
1529
+ value: Maybe.empty(),
1530
+ })),
1531
+ }),
1532
+ mutable: $shaclPropertyFromRdf({
1533
+ graph: _$options.graph,
1534
+ resource: $resource,
1535
+ propertySchema: PropertyShape.schema.properties.mutable,
1536
+ typeFromRdf: (resourceValues) => resourceValues
1537
+ .chain((values) => values.chainMap((value) => value.toBoolean()))
1538
+ .map((values) => values.length > 0
1539
+ ? values.map((value) => Maybe.of(value))
1540
+ : Resource.Values.fromValue({
1541
+ focusResource: $resource,
1542
+ propertyPath: PropertyShape.schema.properties.mutable.path,
1543
+ value: Maybe.empty(),
1544
+ })),
1545
+ }),
1546
+ name: $shaclPropertyFromRdf({
1547
+ graph: _$options.graph,
1548
+ resource: $resource,
1549
+ propertySchema: PropertyShape.schema.properties.name,
1550
+ typeFromRdf: (resourceValues) => resourceValues
1551
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1552
+ .chain((values) => values.chainMap((value) => value.toString()))
1553
+ .map((values) => values.length > 0
1554
+ ? values.map((value) => Maybe.of(value))
1555
+ : Resource.Values.fromValue({
1556
+ focusResource: $resource,
1557
+ propertyPath: PropertyShape.schema.properties.name.path,
1558
+ value: Maybe.empty(),
1559
+ })),
1560
+ }),
1561
+ node: $shaclPropertyFromRdf({
1562
+ graph: _$options.graph,
1563
+ resource: $resource,
1564
+ propertySchema: PropertyShape.schema.properties.node,
1565
+ typeFromRdf: (resourceValues) => resourceValues
1566
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
1567
+ .map((values) => values.length > 0
1568
+ ? values.map((value) => Maybe.of(value))
1569
+ : Resource.Values.fromValue({
1570
+ focusResource: $resource,
1571
+ propertyPath: PropertyShape.schema.properties.node.path,
1572
+ value: Maybe.empty(),
1573
+ })),
1574
+ }),
1575
+ nodeKind: $shaclPropertyFromRdf({
1576
+ graph: _$options.graph,
1577
+ resource: $resource,
1578
+ propertySchema: PropertyShape.schema.properties.nodeKind,
1579
+ typeFromRdf: (resourceValues) => resourceValues
1580
+ .chain((values) => values.chainMap((value) => value.toIri([
1581
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNode"),
1582
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrIRI"),
1583
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrLiteral"),
1584
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#IRI"),
1585
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#IRIOrLiteral"),
1586
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Literal"),
1587
+ ])))
1588
+ .map((values) => values.length > 0
1589
+ ? values.map((value) => Maybe.of(value))
1590
+ : Resource.Values.fromValue({
1591
+ focusResource: $resource,
1592
+ propertyPath: PropertyShape.schema.properties.nodeKind.path,
1593
+ value: Maybe.empty(),
1594
+ })),
1595
+ }),
1596
+ not: $shaclPropertyFromRdf({
1597
+ graph: _$options.graph,
1598
+ resource: $resource,
1599
+ propertySchema: PropertyShape.schema.properties.not,
1600
+ typeFromRdf: (resourceValues) => resourceValues
1601
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
1602
+ .map((values) => values.toArray())
1603
+ .map((valuesArray) => Resource.Values.fromValue({
1757
1604
  focusResource: $resource,
1758
- propertyPath: PropertyShape
1759
- .schema
1760
- .properties
1761
- .resolve
1762
- .path,
1763
- value: Maybe.empty(),
1605
+ propertyPath: PropertyShape.schema.properties.not.path,
1606
+ value: valuesArray,
1764
1607
  })),
1765
- }).chain((resolve) => $shaclPropertyFromRdf({
1766
- graph: _$options.graph,
1767
- resource: $resource,
1768
- propertySchema: PropertyShape.schema
1769
- .properties
1770
- .shaclmateName,
1771
- typeFromRdf: (resourceValues) => resourceValues
1772
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1773
- .chain((values) => values.chainMap((value) => value.toString()))
1774
- .map((values) => values.length >
1775
- 0
1776
- ? values.map((value) => Maybe.of(value))
1777
- : Resource.Values.fromValue({
1608
+ }),
1609
+ or: $shaclPropertyFromRdf({
1610
+ graph: _$options.graph,
1611
+ resource: $resource,
1612
+ propertySchema: PropertyShape.schema.properties.or,
1613
+ typeFromRdf: (resourceValues) => resourceValues
1614
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
1615
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
1778
1616
  focusResource: $resource,
1779
- propertyPath: PropertyShape
1780
- .schema
1781
- .properties
1782
- .shaclmateName
1783
- .path,
1784
- value: Maybe.empty(),
1785
- })),
1786
- }).chain((shaclmateName) => $shaclPropertyFromRdf({
1787
- graph: _$options.graph,
1788
- resource: $resource,
1789
- propertySchema: PropertyShape.schema
1790
- .properties
1791
- .uniqueLang,
1792
- typeFromRdf: (resourceValues) => resourceValues
1793
- .chain((values) => values.chainMap((value) => value.toBoolean()))
1794
- .map((values) => values.length >
1795
- 0
1796
- ? values.map((value) => Maybe.of(value))
1797
- : Resource.Values.fromValue({
1617
+ propertyPath: PropertyShape.schema.properties.or.path,
1618
+ values: valueList.toArray(),
1619
+ })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
1620
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
1621
+ .map((values) => values.length > 0
1622
+ ? values.map((value) => Maybe.of(value))
1623
+ : Resource.Values.fromValue({
1624
+ focusResource: $resource,
1625
+ propertyPath: PropertyShape.schema.properties.or.path,
1626
+ value: Maybe.empty(),
1627
+ })),
1628
+ }),
1629
+ order: $shaclPropertyFromRdf({
1630
+ graph: _$options.graph,
1631
+ resource: $resource,
1632
+ propertySchema: PropertyShape.schema.properties.order,
1633
+ typeFromRdf: (resourceValues) => resourceValues
1634
+ .chain((values) => values.chainMap((value) => value.toFloat()))
1635
+ .map((values) => values.length > 0
1636
+ ? values.map((value) => Maybe.of(value))
1637
+ : Resource.Values.fromValue({
1638
+ focusResource: $resource,
1639
+ propertyPath: PropertyShape.schema.properties.order.path,
1640
+ value: Maybe.empty(),
1641
+ })),
1642
+ }),
1643
+ path: $shaclPropertyFromRdf({
1644
+ graph: _$options.graph,
1645
+ resource: $resource,
1646
+ propertySchema: PropertyShape.schema.properties.path,
1647
+ typeFromRdf: (resourceValues) => $PropertyPath.fromRdfResourceValues(resourceValues, {
1648
+ context: _$options.context,
1649
+ graph: _$options.graph,
1650
+ objectSet: _$options.objectSet,
1651
+ preferredLanguages: _$options.preferredLanguages,
1652
+ resource: $resource,
1653
+ ignoreRdfType: true,
1654
+ propertyPath: PropertyShape.schema.properties.path.path,
1655
+ }),
1656
+ }),
1657
+ patterns: $shaclPropertyFromRdf({
1658
+ graph: _$options.graph,
1659
+ resource: $resource,
1660
+ propertySchema: PropertyShape.schema.properties.patterns,
1661
+ typeFromRdf: (resourceValues) => resourceValues
1662
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1663
+ .chain((values) => values.chainMap((value) => value.toString()))
1664
+ .map((values) => values.toArray())
1665
+ .map((valuesArray) => Resource.Values.fromValue({
1798
1666
  focusResource: $resource,
1799
- propertyPath: PropertyShape
1800
- .schema
1801
- .properties
1802
- .uniqueLang
1803
- .path,
1804
- value: Maybe.empty(),
1667
+ propertyPath: PropertyShape.schema.properties.patterns.path,
1668
+ value: valuesArray,
1805
1669
  })),
1806
- }).chain((uniqueLang) => $shaclPropertyFromRdf({
1807
- graph: _$options.graph,
1808
- resource: $resource,
1809
- propertySchema: PropertyShape.schema
1810
- .properties
1811
- .xone,
1812
- typeFromRdf: (resourceValues) => resourceValues
1813
- .chain((values) => values.chainMap((value) => value.toList({
1670
+ }),
1671
+ resolve: $shaclPropertyFromRdf({
1814
1672
  graph: _$options.graph,
1815
- })))
1816
- .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
1817
- focusResource: $resource,
1818
- propertyPath: PropertyShape
1819
- .schema
1820
- .properties
1821
- .xone
1822
- .path,
1823
- values: valueList.toArray(),
1824
- })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
1825
- .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
1826
- .map((values) => values.length >
1827
- 0
1828
- ? values.map((value) => Maybe.of(value))
1829
- : Resource.Values.fromValue({
1673
+ resource: $resource,
1674
+ propertySchema: PropertyShape.schema.properties.resolve,
1675
+ typeFromRdf: (resourceValues) => resourceValues
1676
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
1677
+ .map((values) => values.length > 0
1678
+ ? values.map((value) => Maybe.of(value))
1679
+ : Resource.Values.fromValue({
1680
+ focusResource: $resource,
1681
+ propertyPath: PropertyShape.schema.properties.resolve.path,
1682
+ value: Maybe.empty(),
1683
+ })),
1684
+ }),
1685
+ shaclmateName: $shaclPropertyFromRdf({
1686
+ graph: _$options.graph,
1687
+ resource: $resource,
1688
+ propertySchema: PropertyShape.schema.properties.shaclmateName,
1689
+ typeFromRdf: (resourceValues) => resourceValues
1690
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1691
+ .chain((values) => values.chainMap((value) => value.toString()))
1692
+ .map((values) => values.length > 0
1693
+ ? values.map((value) => Maybe.of(value))
1694
+ : Resource.Values.fromValue({
1695
+ focusResource: $resource,
1696
+ propertyPath: PropertyShape.schema.properties.shaclmateName.path,
1697
+ value: Maybe.empty(),
1698
+ })),
1699
+ }),
1700
+ uniqueLang: $shaclPropertyFromRdf({
1701
+ graph: _$options.graph,
1702
+ resource: $resource,
1703
+ propertySchema: PropertyShape.schema.properties.uniqueLang,
1704
+ typeFromRdf: (resourceValues) => resourceValues
1705
+ .chain((values) => values.chainMap((value) => value.toBoolean()))
1706
+ .map((values) => values.length > 0
1707
+ ? values.map((value) => Maybe.of(value))
1708
+ : Resource.Values.fromValue({
1709
+ focusResource: $resource,
1710
+ propertyPath: PropertyShape.schema.properties.uniqueLang.path,
1711
+ value: Maybe.empty(),
1712
+ })),
1713
+ }),
1714
+ xone: $shaclPropertyFromRdf({
1715
+ graph: _$options.graph,
1716
+ resource: $resource,
1717
+ propertySchema: PropertyShape.schema.properties.xone,
1718
+ typeFromRdf: (resourceValues) => resourceValues
1719
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
1720
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
1830
1721
  focusResource: $resource,
1831
- propertyPath: PropertyShape
1832
- .schema
1833
- .properties
1834
- .xone
1835
- .path,
1836
- value: Maybe.empty(),
1837
- })),
1838
- }).map((xone) => ({
1839
- $identifier,
1840
- $type,
1841
- and,
1842
- classes,
1843
- comment,
1844
- datatype,
1845
- deactivated,
1846
- defaultValue,
1847
- description,
1848
- display,
1849
- flags,
1850
- groups,
1851
- hasValues,
1852
- in_,
1853
- isDefinedBy,
1854
- label,
1855
- languageIn,
1856
- maxCount,
1857
- maxExclusive,
1858
- maxInclusive,
1859
- maxLength,
1860
- minCount,
1861
- minExclusive,
1862
- minInclusive,
1863
- minLength,
1864
- mutable,
1865
- name,
1866
- node,
1867
- nodeKind,
1868
- not,
1869
- or,
1870
- order,
1871
- path,
1872
- patterns,
1873
- resolve,
1874
- shaclmateName,
1875
- uniqueLang,
1876
- xone,
1877
- }))))))))))))))))))))))))))))))))))))))));
1722
+ propertyPath: PropertyShape.schema.properties.xone.path,
1723
+ values: valueList.toArray(),
1724
+ })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
1725
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
1726
+ .map((values) => values.length > 0
1727
+ ? values.map((value) => Maybe.of(value))
1728
+ : Resource.Values.fromValue({
1729
+ focusResource: $resource,
1730
+ propertyPath: PropertyShape.schema.properties.xone.path,
1731
+ value: Maybe.empty(),
1732
+ })),
1733
+ }),
1734
+ }).map((properties) => create(properties)));
1878
1735
  };
1736
+ PropertyShape.fromRdfResource = $wrap_FromRdfResourceFunction(PropertyShape._fromRdfResource);
1737
+ PropertyShape.fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
1738
+ .toResource()
1739
+ .chain((resource) => PropertyShape.fromRdfResource(resource, options))));
1740
+ PropertyShape.fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape");
1741
+ function isPropertyShape(object) {
1742
+ switch (object.$type) {
1743
+ case "PropertyShape":
1744
+ return true;
1745
+ default:
1746
+ return false;
1747
+ }
1748
+ }
1749
+ PropertyShape.isPropertyShape = isPropertyShape;
1879
1750
  PropertyShape.schema = {
1880
1751
  properties: {
1881
1752
  $identifier: {
@@ -2202,212 +2073,208 @@ export var PropertyShape;
2202
2073
  },
2203
2074
  },
2204
2075
  };
2205
- function toRdfResource(_propertyShape, options) {
2206
- const resourceSet = options?.resourceSet ??
2207
- new ResourceSet({
2208
- dataFactory: dataFactory,
2209
- dataset: datasetFactory.dataset(),
2210
- });
2211
- const resource = resourceSet.resource(_propertyShape.$identifier());
2212
- if (!options?.ignoreRdfType) {
2213
- resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"), options?.graph);
2076
+ PropertyShape._toRdfResource = (parameters) => {
2077
+ if (!parameters.ignoreRdfType) {
2078
+ parameters.resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"), parameters.graph);
2214
2079
  }
2215
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#and"), _propertyShape.and.toList().flatMap((value) => [
2080
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#and"), parameters.object.and.toList().flatMap((value) => [
2216
2081
  value.length > 0
2217
2082
  ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
2218
2083
  if (itemIndex === 0) {
2219
2084
  currentSubListResource = listResource;
2220
2085
  }
2221
2086
  else {
2222
- const newSubListResource = resourceSet.resource((() => dataFactory.blankNode())());
2223
- currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
2087
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
2088
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
2224
2089
  currentSubListResource = newSubListResource;
2225
2090
  }
2226
- currentSubListResource.add($RdfVocabularies.rdf.first, [item], options?.graph);
2091
+ currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
2227
2092
  if (itemIndex + 1 === list.length) {
2228
- currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
2093
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
2229
2094
  }
2230
2095
  return { currentSubListResource, listResource };
2231
2096
  }, {
2232
2097
  currentSubListResource: null,
2233
- listResource: resourceSet.resource((() => dataFactory.blankNode())()),
2098
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
2234
2099
  }).listResource.identifier
2235
2100
  : $RdfVocabularies.rdf.nil,
2236
- ]), options?.graph);
2237
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#class"), _propertyShape.classes.flatMap((item) => [item]), options?.graph);
2238
- resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), _propertyShape.comment
2101
+ ]), parameters.graph);
2102
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#class"), parameters.object.classes.flatMap((item) => [item]), parameters.graph);
2103
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), parameters.object.comment
2239
2104
  .toList()
2240
- .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
2241
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#datatype"), _propertyShape.datatype.toList(), options?.graph);
2242
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"), _propertyShape.deactivated
2105
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
2106
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#datatype"), parameters.object.datatype.toList(), parameters.graph);
2107
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"), parameters.object.deactivated
2243
2108
  .toList()
2244
2109
  .flatMap((value) => [
2245
2110
  $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
2246
- ]), options?.graph);
2247
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#defaultValue"), _propertyShape.defaultValue.toList(), options?.graph);
2248
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#description"), _propertyShape.description
2111
+ ]), parameters.graph);
2112
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#defaultValue"), parameters.object.defaultValue.toList(), parameters.graph);
2113
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#description"), parameters.object.description
2249
2114
  .toList()
2250
- .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
2251
- resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#display"), $strictEquals(_propertyShape.display, false).isLeft()
2115
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
2116
+ parameters.resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#display"), $strictEquals(parameters.object.display, false).isLeft()
2252
2117
  ? [
2253
- $literalFactory.boolean(_propertyShape.display, $RdfVocabularies.xsd.boolean),
2118
+ $literalFactory.boolean(parameters.object.display, $RdfVocabularies.xsd.boolean),
2254
2119
  ]
2255
- : [], options?.graph);
2256
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#flags"), _propertyShape.flags.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
2257
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#group"), _propertyShape.groups.flatMap((item) => [item]), options?.graph);
2258
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#hasValue"), _propertyShape.hasValues.flatMap((item) => [item]), options?.graph);
2259
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#in"), _propertyShape.in_.toList().flatMap((value) => [
2120
+ : [], parameters.graph);
2121
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#flags"), parameters.object.flags.flatMap((item) => [$literalFactory.string(item)]), parameters.graph);
2122
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#group"), parameters.object.groups.flatMap((item) => [item]), parameters.graph);
2123
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#hasValue"), parameters.object.hasValues.flatMap((item) => [item]), parameters.graph);
2124
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#in"), parameters.object.in_.toList().flatMap((value) => [
2260
2125
  value.length > 0
2261
2126
  ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
2262
2127
  if (itemIndex === 0) {
2263
2128
  currentSubListResource = listResource;
2264
2129
  }
2265
2130
  else {
2266
- const newSubListResource = resourceSet.resource((() => dataFactory.blankNode())());
2267
- currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
2131
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
2132
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
2268
2133
  currentSubListResource = newSubListResource;
2269
2134
  }
2270
- currentSubListResource.add($RdfVocabularies.rdf.first, [item], options?.graph);
2135
+ currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
2271
2136
  if (itemIndex + 1 === list.length) {
2272
- currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
2137
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
2273
2138
  }
2274
2139
  return { currentSubListResource, listResource };
2275
2140
  }, {
2276
2141
  currentSubListResource: null,
2277
- listResource: resourceSet.resource((() => dataFactory.blankNode())()),
2142
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
2278
2143
  }).listResource.identifier
2279
2144
  : $RdfVocabularies.rdf.nil,
2280
- ]), options?.graph);
2281
- resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"), _propertyShape.isDefinedBy.toList(), options?.graph);
2282
- resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), _propertyShape.label
2145
+ ]), parameters.graph);
2146
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"), parameters.object.isDefinedBy.toList(), parameters.graph);
2147
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), parameters.object.label
2283
2148
  .toList()
2284
- .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
2285
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#languageIn"), _propertyShape.languageIn.toList().flatMap((value) => [
2149
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
2150
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#languageIn"), parameters.object.languageIn.toList().flatMap((value) => [
2286
2151
  value.length > 0
2287
2152
  ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
2288
2153
  if (itemIndex === 0) {
2289
2154
  currentSubListResource = listResource;
2290
2155
  }
2291
2156
  else {
2292
- const newSubListResource = resourceSet.resource((() => dataFactory.blankNode())());
2293
- currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
2157
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
2158
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
2294
2159
  currentSubListResource = newSubListResource;
2295
2160
  }
2296
- currentSubListResource.add($RdfVocabularies.rdf.first, [$literalFactory.string(item)], options?.graph);
2161
+ currentSubListResource.add($RdfVocabularies.rdf.first, [$literalFactory.string(item)], parameters.graph);
2297
2162
  if (itemIndex + 1 === list.length) {
2298
- currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
2163
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
2299
2164
  }
2300
2165
  return { currentSubListResource, listResource };
2301
2166
  }, {
2302
2167
  currentSubListResource: null,
2303
- listResource: resourceSet.resource((() => dataFactory.blankNode())()),
2168
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
2304
2169
  }).listResource.identifier
2305
2170
  : $RdfVocabularies.rdf.nil,
2306
- ]), options?.graph);
2307
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxCount"), _propertyShape.maxCount
2171
+ ]), parameters.graph);
2172
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxCount"), parameters.object.maxCount
2308
2173
  .toList()
2309
2174
  .flatMap((value) => [
2310
2175
  $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
2311
- ]), options?.graph);
2312
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxExclusive"), _propertyShape.maxExclusive.toList(), options?.graph);
2313
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxInclusive"), _propertyShape.maxInclusive.toList(), options?.graph);
2314
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxLength"), _propertyShape.maxLength
2176
+ ]), parameters.graph);
2177
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxExclusive"), parameters.object.maxExclusive.toList(), parameters.graph);
2178
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxInclusive"), parameters.object.maxInclusive.toList(), parameters.graph);
2179
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxLength"), parameters.object.maxLength
2315
2180
  .toList()
2316
2181
  .flatMap((value) => [
2317
2182
  $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
2318
- ]), options?.graph);
2319
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minCount"), _propertyShape.minCount
2183
+ ]), parameters.graph);
2184
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minCount"), parameters.object.minCount
2320
2185
  .toList()
2321
2186
  .flatMap((value) => [
2322
2187
  $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
2323
- ]), options?.graph);
2324
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minExclusive"), _propertyShape.minExclusive.toList(), options?.graph);
2325
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minInclusive"), _propertyShape.minInclusive.toList(), options?.graph);
2326
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minLength"), _propertyShape.minLength
2188
+ ]), parameters.graph);
2189
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minExclusive"), parameters.object.minExclusive.toList(), parameters.graph);
2190
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minInclusive"), parameters.object.minInclusive.toList(), parameters.graph);
2191
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minLength"), parameters.object.minLength
2327
2192
  .toList()
2328
2193
  .flatMap((value) => [
2329
2194
  $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
2330
- ]), options?.graph);
2331
- resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#mutable"), _propertyShape.mutable
2195
+ ]), parameters.graph);
2196
+ parameters.resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#mutable"), parameters.object.mutable
2332
2197
  .toList()
2333
2198
  .flatMap((value) => [
2334
2199
  $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
2335
- ]), options?.graph);
2336
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#name"), _propertyShape.name
2200
+ ]), parameters.graph);
2201
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#name"), parameters.object.name
2337
2202
  .toList()
2338
- .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
2339
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#node"), _propertyShape.node.toList(), options?.graph);
2340
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"), _propertyShape.nodeKind.toList(), options?.graph);
2341
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#not"), _propertyShape.not.flatMap((item) => [item]), options?.graph);
2342
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#or"), _propertyShape.or.toList().flatMap((value) => [
2203
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
2204
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#node"), parameters.object.node.toList(), parameters.graph);
2205
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"), parameters.object.nodeKind.toList(), parameters.graph);
2206
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#not"), parameters.object.not.flatMap((item) => [item]), parameters.graph);
2207
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#or"), parameters.object.or.toList().flatMap((value) => [
2343
2208
  value.length > 0
2344
2209
  ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
2345
2210
  if (itemIndex === 0) {
2346
2211
  currentSubListResource = listResource;
2347
2212
  }
2348
2213
  else {
2349
- const newSubListResource = resourceSet.resource((() => dataFactory.blankNode())());
2350
- currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
2214
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
2215
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
2351
2216
  currentSubListResource = newSubListResource;
2352
2217
  }
2353
- currentSubListResource.add($RdfVocabularies.rdf.first, [item], options?.graph);
2218
+ currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
2354
2219
  if (itemIndex + 1 === list.length) {
2355
- currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
2220
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
2356
2221
  }
2357
2222
  return { currentSubListResource, listResource };
2358
2223
  }, {
2359
2224
  currentSubListResource: null,
2360
- listResource: resourceSet.resource((() => dataFactory.blankNode())()),
2225
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
2361
2226
  }).listResource.identifier
2362
2227
  : $RdfVocabularies.rdf.nil,
2363
- ]), options?.graph);
2364
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#order"), _propertyShape.order
2228
+ ]), parameters.graph);
2229
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#order"), parameters.object.order
2365
2230
  .toList()
2366
2231
  .flatMap((value) => [
2367
2232
  $literalFactory.number(value, $RdfVocabularies.xsd.double),
2368
- ]), options?.graph);
2369
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#path"), [
2370
- $PropertyPath.toRdfResource(_propertyShape.path, {
2371
- graph: options?.graph,
2372
- resourceSet: resourceSet,
2233
+ ]), parameters.graph);
2234
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#path"), [
2235
+ $PropertyPath.toRdfResource(parameters.object.path, {
2236
+ graph: parameters.graph,
2237
+ resourceSet: parameters.resourceSet,
2373
2238
  }).identifier,
2374
- ], options?.graph);
2375
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#pattern"), _propertyShape.patterns.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
2376
- resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#resolve"), _propertyShape.resolve.toList(), options?.graph);
2377
- resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#name"), _propertyShape.shaclmateName
2239
+ ], parameters.graph);
2240
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#pattern"), parameters.object.patterns.flatMap((item) => [
2241
+ $literalFactory.string(item),
2242
+ ]), parameters.graph);
2243
+ parameters.resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#resolve"), parameters.object.resolve.toList(), parameters.graph);
2244
+ parameters.resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#name"), parameters.object.shaclmateName
2378
2245
  .toList()
2379
- .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
2380
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#uniqueLang"), _propertyShape.uniqueLang
2246
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
2247
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#uniqueLang"), parameters.object.uniqueLang
2381
2248
  .toList()
2382
2249
  .flatMap((value) => [
2383
2250
  $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
2384
- ]), options?.graph);
2385
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#xone"), _propertyShape.xone.toList().flatMap((value) => [
2251
+ ]), parameters.graph);
2252
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#xone"), parameters.object.xone.toList().flatMap((value) => [
2386
2253
  value.length > 0
2387
2254
  ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
2388
2255
  if (itemIndex === 0) {
2389
2256
  currentSubListResource = listResource;
2390
2257
  }
2391
2258
  else {
2392
- const newSubListResource = resourceSet.resource((() => dataFactory.blankNode())());
2393
- currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
2259
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
2260
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
2394
2261
  currentSubListResource = newSubListResource;
2395
2262
  }
2396
- currentSubListResource.add($RdfVocabularies.rdf.first, [item], options?.graph);
2263
+ currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
2397
2264
  if (itemIndex + 1 === list.length) {
2398
- currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
2265
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
2399
2266
  }
2400
2267
  return { currentSubListResource, listResource };
2401
2268
  }, {
2402
2269
  currentSubListResource: null,
2403
- listResource: resourceSet.resource((() => dataFactory.blankNode())()),
2270
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
2404
2271
  }).listResource.identifier
2405
2272
  : $RdfVocabularies.rdf.nil,
2406
- ]), options?.graph);
2407
- return resource;
2408
- }
2409
- PropertyShape.toRdfResource = toRdfResource;
2410
- function propertiesToStrings(_propertyShape) {
2273
+ ]), parameters.graph);
2274
+ return parameters.resource;
2275
+ };
2276
+ PropertyShape.toRdfResource = $wrap_ToRdfResourceFunction(PropertyShape._toRdfResource);
2277
+ function _propertiesToStrings(_propertyShape) {
2411
2278
  return $compactRecord({
2412
2279
  $identifier: _propertyShape.$identifier().toString(),
2413
2280
  label: _propertyShape.label.map((item) => item.toString()).extract(),
@@ -2418,9 +2285,9 @@ export var PropertyShape;
2418
2285
  .extract(),
2419
2286
  });
2420
2287
  }
2421
- PropertyShape.propertiesToStrings = propertiesToStrings;
2288
+ PropertyShape._propertiesToStrings = _propertiesToStrings;
2422
2289
  function $toString(_propertyShape) {
2423
- return `PropertyShape(${JSON.stringify(propertiesToStrings((_propertyShape ?? this)))})`;
2290
+ return `PropertyShape(${JSON.stringify(_propertiesToStrings((_propertyShape ?? this)))})`;
2424
2291
  }
2425
2292
  PropertyShape.$toString = $toString;
2426
2293
  })(PropertyShape || (PropertyShape = {}));
@@ -2496,33 +2363,7 @@ export var PropertyGroup;
2496
2363
  return true;
2497
2364
  }
2498
2365
  PropertyGroup.filter = filter;
2499
- PropertyGroup.fromRdfResource = (resource, options) => {
2500
- let { context, graph, ignoreRdfType = false, objectSet, preferredLanguages, } = options ?? {};
2501
- if (!objectSet) {
2502
- objectSet = new $RdfjsDatasetObjectSet(resource.dataset);
2503
- }
2504
- return PropertyGroup.propertiesFromRdfResource(resource, {
2505
- context,
2506
- graph,
2507
- ignoreRdfType,
2508
- objectSet,
2509
- preferredLanguages,
2510
- }).map(create);
2511
- };
2512
- PropertyGroup.fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
2513
- .toResource()
2514
- .chain((resource) => PropertyGroup.fromRdfResource(resource, options))));
2515
- PropertyGroup.fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup");
2516
- function isPropertyGroup(object) {
2517
- switch (object.$type) {
2518
- case "PropertyGroup":
2519
- return true;
2520
- default:
2521
- return false;
2522
- }
2523
- }
2524
- PropertyGroup.isPropertyGroup = isPropertyGroup;
2525
- PropertyGroup.propertiesFromRdfResource = ($resource, _$options) => {
2366
+ PropertyGroup._fromRdfResource = ($resource, _$options) => {
2526
2367
  return (!_$options.ignoreRdfType
2527
2368
  ? $resource
2528
2369
  .value($RdfVocabularies.rdf.type, { graph: _$options.graph })
@@ -2541,44 +2382,61 @@ export var PropertyGroup;
2541
2382
  }
2542
2383
  return Left(new Error(`${$resource.identifier} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#PropertyGroup)`));
2543
2384
  })
2544
- : Right(true)).chain((_rdfTypeCheck) => Right(new Resource.Value({
2545
- dataFactory: dataFactory,
2546
- focusResource: $resource,
2547
- propertyPath: $RdfVocabularies.rdf.subject,
2548
- term: $resource.identifier,
2549
- }).toValues())
2550
- .chain((values) => values.chainMap((value) => value.toIdentifier()))
2551
- .chain((values) => values.head())
2552
- .chain(($identifier) => Right("PropertyGroup").chain(($type) => $shaclPropertyFromRdf({
2553
- graph: _$options.graph,
2554
- resource: $resource,
2555
- propertySchema: PropertyGroup.schema.properties.comment,
2556
- typeFromRdf: (resourceValues) => resourceValues
2557
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2558
- .chain((values) => values.chainMap((value) => value.toString()))
2559
- .map((values) => values.length > 0
2560
- ? values.map((value) => Maybe.of(value))
2561
- : Resource.Values.fromValue({
2562
- focusResource: $resource,
2563
- propertyPath: PropertyShape.schema.properties.comment.path,
2564
- value: Maybe.empty(),
2565
- })),
2566
- }).chain((comment) => $shaclPropertyFromRdf({
2567
- graph: _$options.graph,
2568
- resource: $resource,
2569
- propertySchema: PropertyGroup.schema.properties.label,
2570
- typeFromRdf: (resourceValues) => resourceValues
2571
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2572
- .chain((values) => values.chainMap((value) => value.toString()))
2573
- .map((values) => values.length > 0
2574
- ? values.map((value) => Maybe.of(value))
2575
- : Resource.Values.fromValue({
2576
- focusResource: $resource,
2577
- propertyPath: PropertyShape.schema.properties.label.path,
2578
- value: Maybe.empty(),
2579
- })),
2580
- }).map((label) => ({ $identifier, $type, comment, label }))))));
2385
+ : Right(true)).chain((_rdfTypeCheck) => $sequenceRecord({
2386
+ $identifier: Right(new Resource.Value({
2387
+ dataFactory: dataFactory,
2388
+ focusResource: $resource,
2389
+ propertyPath: $RdfVocabularies.rdf.subject,
2390
+ term: $resource.identifier,
2391
+ }).toValues())
2392
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
2393
+ .chain((values) => values.head()),
2394
+ comment: $shaclPropertyFromRdf({
2395
+ graph: _$options.graph,
2396
+ resource: $resource,
2397
+ propertySchema: PropertyGroup.schema.properties.comment,
2398
+ typeFromRdf: (resourceValues) => resourceValues
2399
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2400
+ .chain((values) => values.chainMap((value) => value.toString()))
2401
+ .map((values) => values.length > 0
2402
+ ? values.map((value) => Maybe.of(value))
2403
+ : Resource.Values.fromValue({
2404
+ focusResource: $resource,
2405
+ propertyPath: PropertyShape.schema.properties.comment.path,
2406
+ value: Maybe.empty(),
2407
+ })),
2408
+ }),
2409
+ label: $shaclPropertyFromRdf({
2410
+ graph: _$options.graph,
2411
+ resource: $resource,
2412
+ propertySchema: PropertyGroup.schema.properties.label,
2413
+ typeFromRdf: (resourceValues) => resourceValues
2414
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2415
+ .chain((values) => values.chainMap((value) => value.toString()))
2416
+ .map((values) => values.length > 0
2417
+ ? values.map((value) => Maybe.of(value))
2418
+ : Resource.Values.fromValue({
2419
+ focusResource: $resource,
2420
+ propertyPath: PropertyShape.schema.properties.label.path,
2421
+ value: Maybe.empty(),
2422
+ })),
2423
+ }),
2424
+ }).map((properties) => create(properties)));
2581
2425
  };
2426
+ PropertyGroup.fromRdfResource = $wrap_FromRdfResourceFunction(PropertyGroup._fromRdfResource);
2427
+ PropertyGroup.fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
2428
+ .toResource()
2429
+ .chain((resource) => PropertyGroup.fromRdfResource(resource, options))));
2430
+ PropertyGroup.fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup");
2431
+ function isPropertyGroup(object) {
2432
+ switch (object.$type) {
2433
+ case "PropertyGroup":
2434
+ return true;
2435
+ default:
2436
+ return false;
2437
+ }
2438
+ }
2439
+ PropertyGroup.isPropertyGroup = isPropertyGroup;
2582
2440
  PropertyGroup.schema = {
2583
2441
  properties: {
2584
2442
  $identifier: {
@@ -2610,34 +2468,28 @@ export var PropertyGroup;
2610
2468
  },
2611
2469
  },
2612
2470
  };
2613
- function toRdfResource(_propertyGroup, options) {
2614
- const resourceSet = options?.resourceSet ??
2615
- new ResourceSet({
2616
- dataFactory: dataFactory,
2617
- dataset: datasetFactory.dataset(),
2618
- });
2619
- const resource = resourceSet.resource(_propertyGroup.$identifier());
2620
- if (!options?.ignoreRdfType) {
2621
- resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup"), options?.graph);
2471
+ PropertyGroup._toRdfResource = (parameters) => {
2472
+ if (!parameters.ignoreRdfType) {
2473
+ parameters.resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup"), parameters.graph);
2622
2474
  }
2623
- resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), _propertyGroup.comment
2475
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), parameters.object.comment
2624
2476
  .toList()
2625
- .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
2626
- resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), _propertyGroup.label
2477
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
2478
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), parameters.object.label
2627
2479
  .toList()
2628
- .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
2629
- return resource;
2630
- }
2631
- PropertyGroup.toRdfResource = toRdfResource;
2632
- function propertiesToStrings(_propertyGroup) {
2480
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
2481
+ return parameters.resource;
2482
+ };
2483
+ PropertyGroup.toRdfResource = $wrap_ToRdfResourceFunction(PropertyGroup._toRdfResource);
2484
+ function _propertiesToStrings(_propertyGroup) {
2633
2485
  return $compactRecord({
2634
2486
  $identifier: _propertyGroup.$identifier().toString(),
2635
2487
  label: _propertyGroup.label.map((item) => item.toString()).extract(),
2636
2488
  });
2637
2489
  }
2638
- PropertyGroup.propertiesToStrings = propertiesToStrings;
2490
+ PropertyGroup._propertiesToStrings = _propertiesToStrings;
2639
2491
  function $toString(_propertyGroup) {
2640
- return `PropertyGroup(${JSON.stringify(propertiesToStrings((_propertyGroup ?? this)))})`;
2492
+ return `PropertyGroup(${JSON.stringify(_propertiesToStrings((_propertyGroup ?? this)))})`;
2641
2493
  }
2642
2494
  PropertyGroup.$toString = $toString;
2643
2495
  })(PropertyGroup || (PropertyGroup = {}));
@@ -2769,33 +2621,7 @@ export var Ontology;
2769
2621
  return true;
2770
2622
  }
2771
2623
  Ontology.filter = filter;
2772
- Ontology.fromRdfResource = (resource, options) => {
2773
- let { context, graph, ignoreRdfType = false, objectSet, preferredLanguages, } = options ?? {};
2774
- if (!objectSet) {
2775
- objectSet = new $RdfjsDatasetObjectSet(resource.dataset);
2776
- }
2777
- return Ontology.propertiesFromRdfResource(resource, {
2778
- context,
2779
- graph,
2780
- ignoreRdfType,
2781
- objectSet,
2782
- preferredLanguages,
2783
- }).map(create);
2784
- };
2785
- Ontology.fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
2786
- .toResource()
2787
- .chain((resource) => Ontology.fromRdfResource(resource, options))));
2788
- Ontology.fromRdfType = dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology");
2789
- function isOntology(object) {
2790
- switch (object.$type) {
2791
- case "Ontology":
2792
- return true;
2793
- default:
2794
- return false;
2795
- }
2796
- }
2797
- Ontology.isOntology = isOntology;
2798
- Ontology.propertiesFromRdfResource = ($resource, _$options) => {
2624
+ Ontology._fromRdfResource = ($resource, _$options) => {
2799
2625
  return (!_$options.ignoreRdfType
2800
2626
  ? $resource
2801
2627
  .value($RdfVocabularies.rdf.type, { graph: _$options.graph })
@@ -2814,111 +2640,123 @@ export var Ontology;
2814
2640
  }
2815
2641
  return Left(new Error(`${$resource.identifier} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/2002/07/owl#Ontology)`));
2816
2642
  })
2817
- : Right(true)).chain((_rdfTypeCheck) => Right(new Resource.Value({
2818
- dataFactory: dataFactory,
2819
- focusResource: $resource,
2820
- propertyPath: $RdfVocabularies.rdf.subject,
2821
- term: $resource.identifier,
2822
- }).toValues())
2823
- .chain((values) => values.chainMap((value) => value.toIdentifier()))
2824
- .chain((values) => values.head())
2825
- .chain(($identifier) => Right("Ontology").chain(($type) => $shaclPropertyFromRdf({
2826
- graph: _$options.graph,
2827
- resource: $resource,
2828
- propertySchema: Ontology.schema.properties.comment,
2829
- typeFromRdf: (resourceValues) => resourceValues
2830
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2831
- .chain((values) => values.chainMap((value) => value.toString()))
2832
- .map((values) => values.length > 0
2833
- ? values.map((value) => Maybe.of(value))
2834
- : Resource.Values.fromValue({
2643
+ : Right(true)).chain((_rdfTypeCheck) => $sequenceRecord({
2644
+ $identifier: Right(new Resource.Value({
2645
+ dataFactory: dataFactory,
2646
+ focusResource: $resource,
2647
+ propertyPath: $RdfVocabularies.rdf.subject,
2648
+ term: $resource.identifier,
2649
+ }).toValues())
2650
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
2651
+ .chain((values) => values.head()),
2652
+ comment: $shaclPropertyFromRdf({
2653
+ graph: _$options.graph,
2654
+ resource: $resource,
2655
+ propertySchema: Ontology.schema.properties.comment,
2656
+ typeFromRdf: (resourceValues) => resourceValues
2657
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2658
+ .chain((values) => values.chainMap((value) => value.toString()))
2659
+ .map((values) => values.length > 0
2660
+ ? values.map((value) => Maybe.of(value))
2661
+ : Resource.Values.fromValue({
2662
+ focusResource: $resource,
2663
+ propertyPath: PropertyShape.schema.properties.comment.path,
2664
+ value: Maybe.empty(),
2665
+ })),
2666
+ }),
2667
+ label: $shaclPropertyFromRdf({
2668
+ graph: _$options.graph,
2669
+ resource: $resource,
2670
+ propertySchema: Ontology.schema.properties.label,
2671
+ typeFromRdf: (resourceValues) => resourceValues
2672
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2673
+ .chain((values) => values.chainMap((value) => value.toString()))
2674
+ .map((values) => values.length > 0
2675
+ ? values.map((value) => Maybe.of(value))
2676
+ : Resource.Values.fromValue({
2677
+ focusResource: $resource,
2678
+ propertyPath: PropertyShape.schema.properties.label.path,
2679
+ value: Maybe.empty(),
2680
+ })),
2681
+ }),
2682
+ tsFeatureExcludes: $shaclPropertyFromRdf({
2683
+ graph: _$options.graph,
2684
+ resource: $resource,
2685
+ propertySchema: Ontology.schema.properties.tsFeatureExcludes,
2686
+ typeFromRdf: (resourceValues) => resourceValues
2687
+ .chain((values) => values.chainMap((value) => value.toIri([
2688
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_All"),
2689
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Create"),
2690
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_Default"),
2691
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Equals"),
2692
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Graphql"),
2693
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Hash"),
2694
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Json"),
2695
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_None"),
2696
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Rdf"),
2697
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Sparql"),
2698
+ ])))
2699
+ .map((values) => values.toArray())
2700
+ .map((valuesArray) => Resource.Values.fromValue({
2835
2701
  focusResource: $resource,
2836
- propertyPath: PropertyShape.schema.properties.comment.path,
2837
- value: Maybe.empty(),
2702
+ propertyPath: Ontology.schema.properties.tsFeatureExcludes.path,
2703
+ value: valuesArray,
2838
2704
  })),
2839
- }).chain((comment) => $shaclPropertyFromRdf({
2840
- graph: _$options.graph,
2841
- resource: $resource,
2842
- propertySchema: Ontology.schema.properties.label,
2843
- typeFromRdf: (resourceValues) => resourceValues
2844
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2845
- .chain((values) => values.chainMap((value) => value.toString()))
2846
- .map((values) => values.length > 0
2847
- ? values.map((value) => Maybe.of(value))
2848
- : Resource.Values.fromValue({
2705
+ }),
2706
+ tsFeatureIncludes: $shaclPropertyFromRdf({
2707
+ graph: _$options.graph,
2708
+ resource: $resource,
2709
+ propertySchema: Ontology.schema.properties.tsFeatureIncludes,
2710
+ typeFromRdf: (resourceValues) => resourceValues
2711
+ .chain((values) => values.chainMap((value) => value.toIri([
2712
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_All"),
2713
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Create"),
2714
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_Default"),
2715
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Equals"),
2716
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Graphql"),
2717
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Hash"),
2718
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Json"),
2719
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_None"),
2720
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Rdf"),
2721
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Sparql"),
2722
+ ])))
2723
+ .map((values) => values.toArray())
2724
+ .map((valuesArray) => Resource.Values.fromValue({
2849
2725
  focusResource: $resource,
2850
- propertyPath: PropertyShape.schema.properties.label.path,
2851
- value: Maybe.empty(),
2726
+ propertyPath: Ontology.schema.properties.tsFeatureIncludes.path,
2727
+ value: valuesArray,
2852
2728
  })),
2853
- }).chain((label) => $shaclPropertyFromRdf({
2854
- graph: _$options.graph,
2855
- resource: $resource,
2856
- propertySchema: Ontology.schema.properties.tsFeatureExcludes,
2857
- typeFromRdf: (resourceValues) => resourceValues
2858
- .chain((values) => values.chainMap((value) => value.toIri([
2859
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_All"),
2860
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Create"),
2861
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_Default"),
2862
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Equals"),
2863
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Graphql"),
2864
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Hash"),
2865
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Json"),
2866
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_None"),
2867
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Rdf"),
2868
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Sparql"),
2869
- ])))
2870
- .map((values) => values.toArray())
2871
- .map((valuesArray) => Resource.Values.fromValue({
2872
- focusResource: $resource,
2873
- propertyPath: Ontology.schema.properties.tsFeatureExcludes.path,
2874
- value: valuesArray,
2875
- })),
2876
- }).chain((tsFeatureExcludes) => $shaclPropertyFromRdf({
2877
- graph: _$options.graph,
2878
- resource: $resource,
2879
- propertySchema: Ontology.schema.properties.tsFeatureIncludes,
2880
- typeFromRdf: (resourceValues) => resourceValues
2881
- .chain((values) => values.chainMap((value) => value.toIri([
2882
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_All"),
2883
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Create"),
2884
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_Default"),
2885
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Equals"),
2886
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Graphql"),
2887
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Hash"),
2888
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Json"),
2889
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_None"),
2890
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Rdf"),
2891
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Sparql"),
2892
- ])))
2893
- .map((values) => values.toArray())
2894
- .map((valuesArray) => Resource.Values.fromValue({
2895
- focusResource: $resource,
2896
- propertyPath: Ontology.schema.properties.tsFeatureIncludes.path,
2897
- value: valuesArray,
2898
- })),
2899
- }).chain((tsFeatureIncludes) => $shaclPropertyFromRdf({
2900
- graph: _$options.graph,
2901
- resource: $resource,
2902
- propertySchema: Ontology.schema.properties.tsImports,
2903
- typeFromRdf: (resourceValues) => resourceValues
2904
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2905
- .chain((values) => values.chainMap((value) => value.toString()))
2906
- .map((values) => values.toArray())
2907
- .map((valuesArray) => Resource.Values.fromValue({
2908
- focusResource: $resource,
2909
- propertyPath: Ontology.schema.properties.tsImports.path,
2910
- value: valuesArray,
2911
- })),
2912
- }).map((tsImports) => ({
2913
- $identifier,
2914
- $type,
2915
- comment,
2916
- label,
2917
- tsFeatureExcludes,
2918
- tsFeatureIncludes,
2919
- tsImports,
2920
- })))))))));
2729
+ }),
2730
+ tsImports: $shaclPropertyFromRdf({
2731
+ graph: _$options.graph,
2732
+ resource: $resource,
2733
+ propertySchema: Ontology.schema.properties.tsImports,
2734
+ typeFromRdf: (resourceValues) => resourceValues
2735
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2736
+ .chain((values) => values.chainMap((value) => value.toString()))
2737
+ .map((values) => values.toArray())
2738
+ .map((valuesArray) => Resource.Values.fromValue({
2739
+ focusResource: $resource,
2740
+ propertyPath: Ontology.schema.properties.tsImports.path,
2741
+ value: valuesArray,
2742
+ })),
2743
+ }),
2744
+ }).map((properties) => create(properties)));
2921
2745
  };
2746
+ Ontology.fromRdfResource = $wrap_FromRdfResourceFunction(Ontology._fromRdfResource);
2747
+ Ontology.fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
2748
+ .toResource()
2749
+ .chain((resource) => Ontology.fromRdfResource(resource, options))));
2750
+ Ontology.fromRdfType = dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology");
2751
+ function isOntology(object) {
2752
+ switch (object.$type) {
2753
+ case "Ontology":
2754
+ return true;
2755
+ default:
2756
+ return false;
2757
+ }
2758
+ }
2759
+ Ontology.isOntology = isOntology;
2922
2760
  Ontology.schema = {
2923
2761
  properties: {
2924
2762
  $identifier: {
@@ -3002,37 +2840,33 @@ export var Ontology;
3002
2840
  },
3003
2841
  },
3004
2842
  };
3005
- function toRdfResource(_ontology, options) {
3006
- const resourceSet = options?.resourceSet ??
3007
- new ResourceSet({
3008
- dataFactory: dataFactory,
3009
- dataset: datasetFactory.dataset(),
3010
- });
3011
- const resource = resourceSet.resource(_ontology.$identifier());
3012
- if (!options?.ignoreRdfType) {
3013
- resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"), options?.graph);
2843
+ Ontology._toRdfResource = (parameters) => {
2844
+ if (!parameters.ignoreRdfType) {
2845
+ parameters.resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"), parameters.graph);
3014
2846
  }
3015
- resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), _ontology.comment
2847
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), parameters.object.comment
3016
2848
  .toList()
3017
- .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
3018
- resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), _ontology.label
2849
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
2850
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), parameters.object.label
3019
2851
  .toList()
3020
- .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
3021
- resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureExclude"), _ontology.tsFeatureExcludes.flatMap((item) => [item]), options?.graph);
3022
- resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureInclude"), _ontology.tsFeatureIncludes.flatMap((item) => [item]), options?.graph);
3023
- resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsImport"), _ontology.tsImports.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
3024
- return resource;
3025
- }
3026
- Ontology.toRdfResource = toRdfResource;
3027
- function propertiesToStrings(_ontology) {
2852
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
2853
+ parameters.resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureExclude"), parameters.object.tsFeatureExcludes.flatMap((item) => [item]), parameters.graph);
2854
+ parameters.resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureInclude"), parameters.object.tsFeatureIncludes.flatMap((item) => [item]), parameters.graph);
2855
+ parameters.resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsImport"), parameters.object.tsImports.flatMap((item) => [
2856
+ $literalFactory.string(item),
2857
+ ]), parameters.graph);
2858
+ return parameters.resource;
2859
+ };
2860
+ Ontology.toRdfResource = $wrap_ToRdfResourceFunction(Ontology._toRdfResource);
2861
+ function _propertiesToStrings(_ontology) {
3028
2862
  return $compactRecord({
3029
2863
  $identifier: _ontology.$identifier().toString(),
3030
2864
  label: _ontology.label.map((item) => item.toString()).extract(),
3031
2865
  });
3032
2866
  }
3033
- Ontology.propertiesToStrings = propertiesToStrings;
2867
+ Ontology._propertiesToStrings = _propertiesToStrings;
3034
2868
  function $toString(_ontology) {
3035
- return `Ontology(${JSON.stringify(propertiesToStrings((_ontology ?? this)))})`;
2869
+ return `Ontology(${JSON.stringify(_propertiesToStrings((_ontology ?? this)))})`;
3036
2870
  }
3037
2871
  Ontology.$toString = $toString;
3038
2872
  })(Ontology || (Ontology = {}));
@@ -3898,50 +3732,24 @@ export var NodeShape;
3898
3732
  }
3899
3733
  if (filter.tsFeatureIncludes !== undefined &&
3900
3734
  !$filterArray($filterIri)(filter.tsFeatureIncludes, value.tsFeatureIncludes)) {
3901
- return false;
3902
- }
3903
- if (filter.tsImports !== undefined &&
3904
- !$filterArray($filterString)(filter.tsImports, value.tsImports)) {
3905
- return false;
3906
- }
3907
- if (filter.types !== undefined &&
3908
- !$filterArray($filterIri)(filter.types, value.types)) {
3909
- return false;
3910
- }
3911
- if (filter.xone !== undefined &&
3912
- !$filterMaybe($filterArray($filterIdentifier))(filter.xone, value.xone)) {
3913
- return false;
3914
- }
3915
- return true;
3916
- }
3917
- NodeShape.filter = filter;
3918
- NodeShape.fromRdfResource = (resource, options) => {
3919
- let { context, graph, ignoreRdfType = false, objectSet, preferredLanguages, } = options ?? {};
3920
- if (!objectSet) {
3921
- objectSet = new $RdfjsDatasetObjectSet(resource.dataset);
3922
- }
3923
- return NodeShape.propertiesFromRdfResource(resource, {
3924
- context,
3925
- graph,
3926
- ignoreRdfType,
3927
- objectSet,
3928
- preferredLanguages,
3929
- }).map(create);
3930
- };
3931
- NodeShape.fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
3932
- .toResource()
3933
- .chain((resource) => NodeShape.fromRdfResource(resource, options))));
3934
- NodeShape.fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape");
3935
- function isNodeShape(object) {
3936
- switch (object.$type) {
3937
- case "NodeShape":
3938
- return true;
3939
- default:
3940
- return false;
3735
+ return false;
3736
+ }
3737
+ if (filter.tsImports !== undefined &&
3738
+ !$filterArray($filterString)(filter.tsImports, value.tsImports)) {
3739
+ return false;
3740
+ }
3741
+ if (filter.types !== undefined &&
3742
+ !$filterArray($filterIri)(filter.types, value.types)) {
3743
+ return false;
3744
+ }
3745
+ if (filter.xone !== undefined &&
3746
+ !$filterMaybe($filterArray($filterIdentifier))(filter.xone, value.xone)) {
3747
+ return false;
3941
3748
  }
3749
+ return true;
3942
3750
  }
3943
- NodeShape.isNodeShape = isNodeShape;
3944
- NodeShape.propertiesFromRdfResource = ($resource, _$options) => {
3751
+ NodeShape.filter = filter;
3752
+ NodeShape._fromRdfResource = ($resource, _$options) => {
3945
3753
  return (!_$options.ignoreRdfType
3946
3754
  ? $resource
3947
3755
  .value($RdfVocabularies.rdf.type, { graph: _$options.graph })
@@ -3960,860 +3768,683 @@ export var NodeShape;
3960
3768
  }
3961
3769
  return Left(new Error(`${$resource.identifier} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#NodeShape)`));
3962
3770
  })
3963
- : Right(true)).chain((_rdfTypeCheck) => Right(new Resource.Value({
3964
- dataFactory: dataFactory,
3965
- focusResource: $resource,
3966
- propertyPath: $RdfVocabularies.rdf.subject,
3967
- term: $resource.identifier,
3968
- }).toValues())
3969
- .chain((values) => values.chainMap((value) => value.toIdentifier()))
3970
- .chain((values) => values.head())
3971
- .chain(($identifier) => Right("NodeShape").chain(($type) => $shaclPropertyFromRdf({
3972
- graph: _$options.graph,
3973
- resource: $resource,
3974
- propertySchema: NodeShape.schema.properties.and,
3975
- typeFromRdf: (resourceValues) => resourceValues
3976
- .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
3977
- .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
3771
+ : Right(true)).chain((_rdfTypeCheck) => $sequenceRecord({
3772
+ $identifier: Right(new Resource.Value({
3773
+ dataFactory: dataFactory,
3978
3774
  focusResource: $resource,
3979
- propertyPath: PropertyShape.schema.properties.and.path,
3980
- values: valueList.toArray(),
3981
- })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
3982
- .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
3983
- .map((values) => values.length > 0
3984
- ? values.map((value) => Maybe.of(value))
3985
- : Resource.Values.fromValue({
3775
+ propertyPath: $RdfVocabularies.rdf.subject,
3776
+ term: $resource.identifier,
3777
+ }).toValues())
3778
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
3779
+ .chain((values) => values.head()),
3780
+ and: $shaclPropertyFromRdf({
3781
+ graph: _$options.graph,
3782
+ resource: $resource,
3783
+ propertySchema: NodeShape.schema.properties.and,
3784
+ typeFromRdf: (resourceValues) => resourceValues
3785
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
3786
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
3986
3787
  focusResource: $resource,
3987
3788
  propertyPath: PropertyShape.schema.properties.and.path,
3988
- value: Maybe.empty(),
3989
- })),
3990
- }).chain((and) => $shaclPropertyFromRdf({
3991
- graph: _$options.graph,
3992
- resource: $resource,
3993
- propertySchema: NodeShape.schema.properties.classes,
3994
- typeFromRdf: (resourceValues) => resourceValues
3995
- .chain((values) => values.chainMap((value) => value.toIri()))
3996
- .map((values) => values.toArray())
3997
- .map((valuesArray) => Resource.Values.fromValue({
3998
- focusResource: $resource,
3999
- propertyPath: PropertyShape.schema.properties.classes.path,
4000
- value: valuesArray,
4001
- })),
4002
- }).chain((classes) => $shaclPropertyFromRdf({
4003
- graph: _$options.graph,
4004
- resource: $resource,
4005
- propertySchema: NodeShape.schema.properties.closed,
4006
- typeFromRdf: (resourceValues) => resourceValues
4007
- .chain((values) => values.chainMap((value) => value.toBoolean()))
4008
- .map((values) => values.length > 0
4009
- ? values.map((value) => Maybe.of(value))
4010
- : Resource.Values.fromValue({
4011
- focusResource: $resource,
4012
- propertyPath: NodeShape.schema.properties.closed.path,
4013
- value: Maybe.empty(),
4014
- })),
4015
- }).chain((closed) => $shaclPropertyFromRdf({
4016
- graph: _$options.graph,
4017
- resource: $resource,
4018
- propertySchema: NodeShape.schema.properties.comment,
4019
- typeFromRdf: (resourceValues) => resourceValues
4020
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
4021
- .chain((values) => values.chainMap((value) => value.toString()))
4022
- .map((values) => values.length > 0
4023
- ? values.map((value) => Maybe.of(value))
4024
- : Resource.Values.fromValue({
4025
- focusResource: $resource,
4026
- propertyPath: PropertyShape.schema.properties.comment.path,
4027
- value: Maybe.empty(),
4028
- })),
4029
- }).chain((comment) => $shaclPropertyFromRdf({
4030
- graph: _$options.graph,
4031
- resource: $resource,
4032
- propertySchema: NodeShape.schema.properties.datatype,
4033
- typeFromRdf: (resourceValues) => resourceValues
4034
- .chain((values) => values.chainMap((value) => value.toIri()))
4035
- .map((values) => values.length > 0
4036
- ? values.map((value) => Maybe.of(value))
4037
- : Resource.Values.fromValue({
4038
- focusResource: $resource,
4039
- propertyPath: PropertyShape.schema.properties.datatype
4040
- .path,
4041
- value: Maybe.empty(),
4042
- })),
4043
- }).chain((datatype) => $shaclPropertyFromRdf({
4044
- graph: _$options.graph,
4045
- resource: $resource,
4046
- propertySchema: NodeShape.schema.properties.deactivated,
4047
- typeFromRdf: (resourceValues) => resourceValues
4048
- .chain((values) => values.chainMap((value) => value.toBoolean()))
4049
- .map((values) => values.length > 0
4050
- ? values.map((value) => Maybe.of(value))
4051
- : Resource.Values.fromValue({
4052
- focusResource: $resource,
4053
- propertyPath: PropertyShape.schema.properties
4054
- .deactivated.path,
4055
- value: Maybe.empty(),
4056
- })),
4057
- }).chain((deactivated) => $shaclPropertyFromRdf({
4058
- graph: _$options.graph,
4059
- resource: $resource,
4060
- propertySchema: NodeShape.schema.properties.discriminantValue,
4061
- typeFromRdf: (resourceValues) => resourceValues
4062
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
4063
- .chain((values) => values.chainMap((value) => value.toString()))
4064
- .map((values) => values.length > 0
4065
- ? values.map((value) => Maybe.of(value))
4066
- : Resource.Values.fromValue({
4067
- focusResource: $resource,
4068
- propertyPath: NodeShape.schema.properties
4069
- .discriminantValue.path,
4070
- value: Maybe.empty(),
4071
- })),
4072
- }).chain((discriminantValue) => $shaclPropertyFromRdf({
4073
- graph: _$options.graph,
4074
- resource: $resource,
4075
- propertySchema: NodeShape.schema.properties.extern,
4076
- typeFromRdf: (resourceValues) => resourceValues
4077
- .chain((values) => values.chainMap((value) => value.toBoolean()))
4078
- .map((values) => values.length > 0
4079
- ? values.map((value) => Maybe.of(value))
4080
- : Resource.Values.fromValue({
4081
- focusResource: $resource,
4082
- propertyPath: NodeShape.schema.properties.extern
4083
- .path,
4084
- value: Maybe.empty(),
4085
- })),
4086
- }).chain((extern) => $shaclPropertyFromRdf({
4087
- graph: _$options.graph,
4088
- resource: $resource,
4089
- propertySchema: NodeShape.schema.properties.flags,
4090
- typeFromRdf: (resourceValues) => resourceValues
4091
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
4092
- .chain((values) => values.chainMap((value) => value.toString()))
4093
- .map((values) => values.toArray())
4094
- .map((valuesArray) => Resource.Values.fromValue({
4095
- focusResource: $resource,
4096
- propertyPath: PropertyShape.schema.properties.flags
4097
- .path,
4098
- value: valuesArray,
4099
- })),
4100
- }).chain((flags) => $shaclPropertyFromRdf({
4101
- graph: _$options.graph,
4102
- resource: $resource,
4103
- propertySchema: NodeShape.schema.properties.fromRdfType,
4104
- typeFromRdf: (resourceValues) => resourceValues
4105
- .chain((values) => values.chainMap((value) => value.toIri()))
4106
- .map((values) => values.length > 0
4107
- ? values.map((value) => Maybe.of(value))
4108
- : Resource.Values.fromValue({
4109
- focusResource: $resource,
4110
- propertyPath: NodeShape.schema.properties
4111
- .fromRdfType.path,
4112
- value: Maybe.empty(),
4113
- })),
4114
- }).chain((fromRdfType) => $shaclPropertyFromRdf({
4115
- graph: _$options.graph,
4116
- resource: $resource,
4117
- propertySchema: NodeShape.schema.properties.hasValues,
4118
- typeFromRdf: (resourceValues) => resourceValues
4119
- .chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
4120
- switch (term.termType) {
4121
- case "NamedNode":
4122
- case "Literal":
4123
- return Either.of(term);
4124
- default:
4125
- return Left(new Resource.MistypedTermValueError({
4126
- actualValue: term,
4127
- expectedValueType: "(NamedNode | Literal)",
4128
- focusResource: $resource,
4129
- propertyPath: PropertyShape.schema
4130
- .properties.hasValues
4131
- .path,
4132
- }));
4133
- }
4134
- })))
4135
- .map((values) => values.toArray())
4136
- .map((valuesArray) => Resource.Values.fromValue({
4137
- focusResource: $resource,
4138
- propertyPath: PropertyShape.schema.properties
4139
- .hasValues.path,
4140
- value: valuesArray,
4141
- })),
4142
- }).chain((hasValues) => $shaclPropertyFromRdf({
4143
- graph: _$options.graph,
4144
- resource: $resource,
4145
- propertySchema: NodeShape.schema.properties.ignoredProperties,
4146
- typeFromRdf: (resourceValues) => resourceValues
4147
- .chain((values) => values.chainMap((value) => value.toList({
3789
+ values: valueList.toArray(),
3790
+ })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
3791
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
3792
+ .map((values) => values.length > 0
3793
+ ? values.map((value) => Maybe.of(value))
3794
+ : Resource.Values.fromValue({
3795
+ focusResource: $resource,
3796
+ propertyPath: PropertyShape.schema.properties.and.path,
3797
+ value: Maybe.empty(),
3798
+ })),
3799
+ }),
3800
+ classes: $shaclPropertyFromRdf({
4148
3801
  graph: _$options.graph,
4149
- })))
4150
- .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
4151
- focusResource: $resource,
4152
- propertyPath: NodeShape.schema.properties
4153
- .ignoredProperties.path,
4154
- values: valueList.toArray(),
4155
- })).chain((values) => values.chainMap((value) => value.toIri()))))
4156
- .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
4157
- .map((values) => values.length > 0
4158
- ? values.map((value) => Maybe.of(value))
4159
- : Resource.Values.fromValue({
3802
+ resource: $resource,
3803
+ propertySchema: NodeShape.schema.properties.classes,
3804
+ typeFromRdf: (resourceValues) => resourceValues
3805
+ .chain((values) => values.chainMap((value) => value.toIri()))
3806
+ .map((values) => values.toArray())
3807
+ .map((valuesArray) => Resource.Values.fromValue({
4160
3808
  focusResource: $resource,
4161
- propertyPath: NodeShape.schema.properties
4162
- .ignoredProperties.path,
4163
- value: Maybe.empty(),
3809
+ propertyPath: PropertyShape.schema.properties.classes.path,
3810
+ value: valuesArray,
4164
3811
  })),
4165
- }).chain((ignoredProperties) => $shaclPropertyFromRdf({
4166
- graph: _$options.graph,
4167
- resource: $resource,
4168
- propertySchema: NodeShape.schema.properties.in_,
4169
- typeFromRdf: (resourceValues) => resourceValues
4170
- .chain((values) => values.chainMap((value) => value.toList({
3812
+ }),
3813
+ closed: $shaclPropertyFromRdf({
4171
3814
  graph: _$options.graph,
4172
- })))
4173
- .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
4174
- focusResource: $resource,
4175
- propertyPath: PropertyShape.schema
4176
- .properties.in_.path,
4177
- values: valueList.toArray(),
4178
- })).chain((values) => values.chainMap((value) => value
4179
- .toTerm()
4180
- .chain((term) => {
4181
- switch (term.termType) {
4182
- case "NamedNode":
4183
- case "Literal":
4184
- return Either.of(term);
4185
- default:
4186
- return Left(new Resource.MistypedTermValueError({
4187
- actualValue: term,
4188
- expectedValueType: "(NamedNode | Literal)",
4189
- focusResource: $resource,
4190
- propertyPath: PropertyShape
4191
- .schema
4192
- .properties
4193
- .in_.path,
4194
- }));
4195
- }
4196
- })))))
4197
- .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
4198
- .map((values) => values.length > 0
4199
- ? values.map((value) => Maybe.of(value))
4200
- : Resource.Values.fromValue({
4201
- focusResource: $resource,
4202
- propertyPath: PropertyShape.schema
4203
- .properties.in_.path,
4204
- value: Maybe.empty(),
4205
- })),
4206
- }).chain((in_) => $shaclPropertyFromRdf({
4207
- graph: _$options.graph,
4208
- resource: $resource,
4209
- propertySchema: NodeShape.schema.properties.isDefinedBy,
4210
- typeFromRdf: (resourceValues) => resourceValues
4211
- .chain((values) => values.chainMap((value) => value.toIdentifier()))
4212
- .map((values) => values.length > 0
4213
- ? values.map((value) => Maybe.of(value))
4214
- : Resource.Values.fromValue({
4215
- focusResource: $resource,
4216
- propertyPath: PropertyShape.schema
4217
- .properties.isDefinedBy
4218
- .path,
4219
- value: Maybe.empty(),
4220
- })),
4221
- }).chain((isDefinedBy) => $shaclPropertyFromRdf({
4222
- graph: _$options.graph,
4223
- resource: $resource,
4224
- propertySchema: NodeShape.schema.properties.label,
4225
- typeFromRdf: (resourceValues) => resourceValues
4226
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
4227
- .chain((values) => values.chainMap((value) => value.toString()))
4228
- .map((values) => values.length > 0
4229
- ? values.map((value) => Maybe.of(value))
4230
- : Resource.Values.fromValue({
4231
- focusResource: $resource,
4232
- propertyPath: PropertyShape.schema
4233
- .properties.label
4234
- .path,
4235
- value: Maybe.empty(),
4236
- })),
4237
- }).chain((label) => $shaclPropertyFromRdf({
4238
- graph: _$options.graph,
4239
- resource: $resource,
4240
- propertySchema: NodeShape.schema.properties.languageIn,
4241
- typeFromRdf: (resourceValues) => resourceValues
4242
- .chain((values) => values.chainMap((value) => value.toList({
3815
+ resource: $resource,
3816
+ propertySchema: NodeShape.schema.properties.closed,
3817
+ typeFromRdf: (resourceValues) => resourceValues
3818
+ .chain((values) => values.chainMap((value) => value.toBoolean()))
3819
+ .map((values) => values.length > 0
3820
+ ? values.map((value) => Maybe.of(value))
3821
+ : Resource.Values.fromValue({
3822
+ focusResource: $resource,
3823
+ propertyPath: NodeShape.schema.properties.closed.path,
3824
+ value: Maybe.empty(),
3825
+ })),
3826
+ }),
3827
+ comment: $shaclPropertyFromRdf({
4243
3828
  graph: _$options.graph,
4244
- })))
4245
- .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
4246
- focusResource: $resource,
4247
- propertyPath: PropertyShape
4248
- .schema
4249
- .properties
4250
- .languageIn
4251
- .path,
4252
- values: valueList.toArray(),
4253
- }))
4254
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
4255
- .chain((values) => values.chainMap((value) => value.toString()))))
4256
- .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
4257
- .map((values) => values.length > 0
4258
- ? values.map((value) => Maybe.of(value))
4259
- : Resource.Values.fromValue({
3829
+ resource: $resource,
3830
+ propertySchema: NodeShape.schema.properties.comment,
3831
+ typeFromRdf: (resourceValues) => resourceValues
3832
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
3833
+ .chain((values) => values.chainMap((value) => value.toString()))
3834
+ .map((values) => values.length > 0
3835
+ ? values.map((value) => Maybe.of(value))
3836
+ : Resource.Values.fromValue({
3837
+ focusResource: $resource,
3838
+ propertyPath: PropertyShape.schema.properties.comment.path,
3839
+ value: Maybe.empty(),
3840
+ })),
3841
+ }),
3842
+ datatype: $shaclPropertyFromRdf({
3843
+ graph: _$options.graph,
3844
+ resource: $resource,
3845
+ propertySchema: NodeShape.schema.properties.datatype,
3846
+ typeFromRdf: (resourceValues) => resourceValues
3847
+ .chain((values) => values.chainMap((value) => value.toIri()))
3848
+ .map((values) => values.length > 0
3849
+ ? values.map((value) => Maybe.of(value))
3850
+ : Resource.Values.fromValue({
3851
+ focusResource: $resource,
3852
+ propertyPath: PropertyShape.schema.properties.datatype.path,
3853
+ value: Maybe.empty(),
3854
+ })),
3855
+ }),
3856
+ deactivated: $shaclPropertyFromRdf({
3857
+ graph: _$options.graph,
3858
+ resource: $resource,
3859
+ propertySchema: NodeShape.schema.properties.deactivated,
3860
+ typeFromRdf: (resourceValues) => resourceValues
3861
+ .chain((values) => values.chainMap((value) => value.toBoolean()))
3862
+ .map((values) => values.length > 0
3863
+ ? values.map((value) => Maybe.of(value))
3864
+ : Resource.Values.fromValue({
3865
+ focusResource: $resource,
3866
+ propertyPath: PropertyShape.schema.properties.deactivated.path,
3867
+ value: Maybe.empty(),
3868
+ })),
3869
+ }),
3870
+ discriminantValue: $shaclPropertyFromRdf({
3871
+ graph: _$options.graph,
3872
+ resource: $resource,
3873
+ propertySchema: NodeShape.schema.properties.discriminantValue,
3874
+ typeFromRdf: (resourceValues) => resourceValues
3875
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
3876
+ .chain((values) => values.chainMap((value) => value.toString()))
3877
+ .map((values) => values.length > 0
3878
+ ? values.map((value) => Maybe.of(value))
3879
+ : Resource.Values.fromValue({
3880
+ focusResource: $resource,
3881
+ propertyPath: NodeShape.schema.properties.discriminantValue.path,
3882
+ value: Maybe.empty(),
3883
+ })),
3884
+ }),
3885
+ extern: $shaclPropertyFromRdf({
3886
+ graph: _$options.graph,
3887
+ resource: $resource,
3888
+ propertySchema: NodeShape.schema.properties.extern,
3889
+ typeFromRdf: (resourceValues) => resourceValues
3890
+ .chain((values) => values.chainMap((value) => value.toBoolean()))
3891
+ .map((values) => values.length > 0
3892
+ ? values.map((value) => Maybe.of(value))
3893
+ : Resource.Values.fromValue({
3894
+ focusResource: $resource,
3895
+ propertyPath: NodeShape.schema.properties.extern.path,
3896
+ value: Maybe.empty(),
3897
+ })),
3898
+ }),
3899
+ flags: $shaclPropertyFromRdf({
3900
+ graph: _$options.graph,
3901
+ resource: $resource,
3902
+ propertySchema: NodeShape.schema.properties.flags,
3903
+ typeFromRdf: (resourceValues) => resourceValues
3904
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
3905
+ .chain((values) => values.chainMap((value) => value.toString()))
3906
+ .map((values) => values.toArray())
3907
+ .map((valuesArray) => Resource.Values.fromValue({
4260
3908
  focusResource: $resource,
4261
- propertyPath: PropertyShape.schema
4262
- .properties
4263
- .languageIn.path,
4264
- value: Maybe.empty(),
3909
+ propertyPath: PropertyShape.schema.properties.flags.path,
3910
+ value: valuesArray,
4265
3911
  })),
4266
- }).chain((languageIn) => $shaclPropertyFromRdf({
4267
- graph: _$options.graph,
4268
- resource: $resource,
4269
- propertySchema: NodeShape.schema.properties.maxCount,
4270
- typeFromRdf: (resourceValues) => resourceValues
4271
- .chain((values) => values.chainMap((value) => value.toBigInt()))
4272
- .map((values) => values.length > 0
4273
- ? values.map((value) => Maybe.of(value))
4274
- : Resource.Values.fromValue({
3912
+ }),
3913
+ fromRdfType: $shaclPropertyFromRdf({
3914
+ graph: _$options.graph,
3915
+ resource: $resource,
3916
+ propertySchema: NodeShape.schema.properties.fromRdfType,
3917
+ typeFromRdf: (resourceValues) => resourceValues
3918
+ .chain((values) => values.chainMap((value) => value.toIri()))
3919
+ .map((values) => values.length > 0
3920
+ ? values.map((value) => Maybe.of(value))
3921
+ : Resource.Values.fromValue({
3922
+ focusResource: $resource,
3923
+ propertyPath: NodeShape.schema.properties.fromRdfType.path,
3924
+ value: Maybe.empty(),
3925
+ })),
3926
+ }),
3927
+ hasValues: $shaclPropertyFromRdf({
3928
+ graph: _$options.graph,
3929
+ resource: $resource,
3930
+ propertySchema: NodeShape.schema.properties.hasValues,
3931
+ typeFromRdf: (resourceValues) => resourceValues
3932
+ .chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
3933
+ switch (term.termType) {
3934
+ case "NamedNode":
3935
+ case "Literal":
3936
+ return Either.of(term);
3937
+ default:
3938
+ return Left(new Resource.MistypedTermValueError({
3939
+ actualValue: term,
3940
+ expectedValueType: "(NamedNode | Literal)",
3941
+ focusResource: $resource,
3942
+ propertyPath: PropertyShape.schema.properties.hasValues.path,
3943
+ }));
3944
+ }
3945
+ })))
3946
+ .map((values) => values.toArray())
3947
+ .map((valuesArray) => Resource.Values.fromValue({
4275
3948
  focusResource: $resource,
4276
- propertyPath: PropertyShape.schema
4277
- .properties
4278
- .maxCount.path,
4279
- value: Maybe.empty(),
3949
+ propertyPath: PropertyShape.schema.properties.hasValues.path,
3950
+ value: valuesArray,
4280
3951
  })),
4281
- }).chain((maxCount) => $shaclPropertyFromRdf({
4282
- graph: _$options.graph,
4283
- resource: $resource,
4284
- propertySchema: NodeShape.schema.properties
4285
- .maxExclusive,
4286
- typeFromRdf: (resourceValues) => resourceValues
4287
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
4288
- .chain((values) => values.chainMap((value) => value.toLiteral()))
4289
- .map((values) => values.length > 0
4290
- ? values.map((value) => Maybe.of(value))
4291
- : Resource.Values.fromValue({
3952
+ }),
3953
+ ignoredProperties: $shaclPropertyFromRdf({
3954
+ graph: _$options.graph,
3955
+ resource: $resource,
3956
+ propertySchema: NodeShape.schema.properties.ignoredProperties,
3957
+ typeFromRdf: (resourceValues) => resourceValues
3958
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
3959
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
4292
3960
  focusResource: $resource,
4293
- propertyPath: PropertyShape
4294
- .schema
4295
- .properties
4296
- .maxExclusive
4297
- .path,
4298
- value: Maybe.empty(),
4299
- })),
4300
- }).chain((maxExclusive) => $shaclPropertyFromRdf({
4301
- graph: _$options.graph,
4302
- resource: $resource,
4303
- propertySchema: NodeShape.schema.properties
4304
- .maxInclusive,
4305
- typeFromRdf: (resourceValues) => resourceValues
4306
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
4307
- .chain((values) => values.chainMap((value) => value.toLiteral()))
4308
- .map((values) => values.length > 0
4309
- ? values.map((value) => Maybe.of(value))
4310
- : Resource.Values.fromValue({
3961
+ propertyPath: NodeShape.schema.properties.ignoredProperties.path,
3962
+ values: valueList.toArray(),
3963
+ })).chain((values) => values.chainMap((value) => value.toIri()))))
3964
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
3965
+ .map((values) => values.length > 0
3966
+ ? values.map((value) => Maybe.of(value))
3967
+ : Resource.Values.fromValue({
3968
+ focusResource: $resource,
3969
+ propertyPath: NodeShape.schema.properties.ignoredProperties.path,
3970
+ value: Maybe.empty(),
3971
+ })),
3972
+ }),
3973
+ in_: $shaclPropertyFromRdf({
3974
+ graph: _$options.graph,
3975
+ resource: $resource,
3976
+ propertySchema: NodeShape.schema.properties.in_,
3977
+ typeFromRdf: (resourceValues) => resourceValues
3978
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
3979
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
4311
3980
  focusResource: $resource,
4312
- propertyPath: PropertyShape
4313
- .schema
4314
- .properties
4315
- .maxInclusive
4316
- .path,
4317
- value: Maybe.empty(),
4318
- })),
4319
- }).chain((maxInclusive) => $shaclPropertyFromRdf({
4320
- graph: _$options.graph,
4321
- resource: $resource,
4322
- propertySchema: NodeShape.schema.properties
4323
- .maxLength,
4324
- typeFromRdf: (resourceValues) => resourceValues
4325
- .chain((values) => values.chainMap((value) => value.toBigInt()))
4326
- .map((values) => values.length > 0
4327
- ? values.map((value) => Maybe.of(value))
4328
- : Resource.Values.fromValue({
3981
+ propertyPath: PropertyShape.schema.properties.in_.path,
3982
+ values: valueList.toArray(),
3983
+ })).chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
3984
+ switch (term.termType) {
3985
+ case "NamedNode":
3986
+ case "Literal":
3987
+ return Either.of(term);
3988
+ default:
3989
+ return Left(new Resource.MistypedTermValueError({
3990
+ actualValue: term,
3991
+ expectedValueType: "(NamedNode | Literal)",
3992
+ focusResource: $resource,
3993
+ propertyPath: PropertyShape.schema.properties.in_.path,
3994
+ }));
3995
+ }
3996
+ })))))
3997
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
3998
+ .map((values) => values.length > 0
3999
+ ? values.map((value) => Maybe.of(value))
4000
+ : Resource.Values.fromValue({
4001
+ focusResource: $resource,
4002
+ propertyPath: PropertyShape.schema.properties.in_.path,
4003
+ value: Maybe.empty(),
4004
+ })),
4005
+ }),
4006
+ isDefinedBy: $shaclPropertyFromRdf({
4007
+ graph: _$options.graph,
4008
+ resource: $resource,
4009
+ propertySchema: NodeShape.schema.properties.isDefinedBy,
4010
+ typeFromRdf: (resourceValues) => resourceValues
4011
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
4012
+ .map((values) => values.length > 0
4013
+ ? values.map((value) => Maybe.of(value))
4014
+ : Resource.Values.fromValue({
4015
+ focusResource: $resource,
4016
+ propertyPath: PropertyShape.schema.properties.isDefinedBy.path,
4017
+ value: Maybe.empty(),
4018
+ })),
4019
+ }),
4020
+ label: $shaclPropertyFromRdf({
4021
+ graph: _$options.graph,
4022
+ resource: $resource,
4023
+ propertySchema: NodeShape.schema.properties.label,
4024
+ typeFromRdf: (resourceValues) => resourceValues
4025
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
4026
+ .chain((values) => values.chainMap((value) => value.toString()))
4027
+ .map((values) => values.length > 0
4028
+ ? values.map((value) => Maybe.of(value))
4029
+ : Resource.Values.fromValue({
4030
+ focusResource: $resource,
4031
+ propertyPath: PropertyShape.schema.properties.label.path,
4032
+ value: Maybe.empty(),
4033
+ })),
4034
+ }),
4035
+ languageIn: $shaclPropertyFromRdf({
4036
+ graph: _$options.graph,
4037
+ resource: $resource,
4038
+ propertySchema: NodeShape.schema.properties.languageIn,
4039
+ typeFromRdf: (resourceValues) => resourceValues
4040
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
4041
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
4329
4042
  focusResource: $resource,
4330
- propertyPath: PropertyShape
4331
- .schema
4332
- .properties
4333
- .maxLength
4334
- .path,
4335
- value: Maybe.empty(),
4336
- })),
4337
- }).chain((maxLength) => $shaclPropertyFromRdf({
4338
- graph: _$options.graph,
4339
- resource: $resource,
4340
- propertySchema: NodeShape.schema.properties
4341
- .minCount,
4342
- typeFromRdf: (resourceValues) => resourceValues
4343
- .chain((values) => values.chainMap((value) => value.toBigInt()))
4344
- .map((values) => values.length > 0
4345
- ? values.map((value) => Maybe.of(value))
4346
- : Resource.Values.fromValue({
4043
+ propertyPath: PropertyShape.schema.properties.languageIn.path,
4044
+ values: valueList.toArray(),
4045
+ }))
4046
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
4047
+ .chain((values) => values.chainMap((value) => value.toString()))))
4048
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
4049
+ .map((values) => values.length > 0
4050
+ ? values.map((value) => Maybe.of(value))
4051
+ : Resource.Values.fromValue({
4052
+ focusResource: $resource,
4053
+ propertyPath: PropertyShape.schema.properties.languageIn.path,
4054
+ value: Maybe.empty(),
4055
+ })),
4056
+ }),
4057
+ maxCount: $shaclPropertyFromRdf({
4058
+ graph: _$options.graph,
4059
+ resource: $resource,
4060
+ propertySchema: NodeShape.schema.properties.maxCount,
4061
+ typeFromRdf: (resourceValues) => resourceValues
4062
+ .chain((values) => values.chainMap((value) => value.toBigInt()))
4063
+ .map((values) => values.length > 0
4064
+ ? values.map((value) => Maybe.of(value))
4065
+ : Resource.Values.fromValue({
4066
+ focusResource: $resource,
4067
+ propertyPath: PropertyShape.schema.properties.maxCount.path,
4068
+ value: Maybe.empty(),
4069
+ })),
4070
+ }),
4071
+ maxExclusive: $shaclPropertyFromRdf({
4072
+ graph: _$options.graph,
4073
+ resource: $resource,
4074
+ propertySchema: NodeShape.schema.properties.maxExclusive,
4075
+ typeFromRdf: (resourceValues) => resourceValues
4076
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
4077
+ .chain((values) => values.chainMap((value) => value.toLiteral()))
4078
+ .map((values) => values.length > 0
4079
+ ? values.map((value) => Maybe.of(value))
4080
+ : Resource.Values.fromValue({
4081
+ focusResource: $resource,
4082
+ propertyPath: PropertyShape.schema.properties.maxExclusive.path,
4083
+ value: Maybe.empty(),
4084
+ })),
4085
+ }),
4086
+ maxInclusive: $shaclPropertyFromRdf({
4087
+ graph: _$options.graph,
4088
+ resource: $resource,
4089
+ propertySchema: NodeShape.schema.properties.maxInclusive,
4090
+ typeFromRdf: (resourceValues) => resourceValues
4091
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
4092
+ .chain((values) => values.chainMap((value) => value.toLiteral()))
4093
+ .map((values) => values.length > 0
4094
+ ? values.map((value) => Maybe.of(value))
4095
+ : Resource.Values.fromValue({
4096
+ focusResource: $resource,
4097
+ propertyPath: PropertyShape.schema.properties.maxInclusive.path,
4098
+ value: Maybe.empty(),
4099
+ })),
4100
+ }),
4101
+ maxLength: $shaclPropertyFromRdf({
4102
+ graph: _$options.graph,
4103
+ resource: $resource,
4104
+ propertySchema: NodeShape.schema.properties.maxLength,
4105
+ typeFromRdf: (resourceValues) => resourceValues
4106
+ .chain((values) => values.chainMap((value) => value.toBigInt()))
4107
+ .map((values) => values.length > 0
4108
+ ? values.map((value) => Maybe.of(value))
4109
+ : Resource.Values.fromValue({
4110
+ focusResource: $resource,
4111
+ propertyPath: PropertyShape.schema.properties.maxLength.path,
4112
+ value: Maybe.empty(),
4113
+ })),
4114
+ }),
4115
+ minCount: $shaclPropertyFromRdf({
4116
+ graph: _$options.graph,
4117
+ resource: $resource,
4118
+ propertySchema: NodeShape.schema.properties.minCount,
4119
+ typeFromRdf: (resourceValues) => resourceValues
4120
+ .chain((values) => values.chainMap((value) => value.toBigInt()))
4121
+ .map((values) => values.length > 0
4122
+ ? values.map((value) => Maybe.of(value))
4123
+ : Resource.Values.fromValue({
4124
+ focusResource: $resource,
4125
+ propertyPath: PropertyShape.schema.properties.minCount.path,
4126
+ value: Maybe.empty(),
4127
+ })),
4128
+ }),
4129
+ minExclusive: $shaclPropertyFromRdf({
4130
+ graph: _$options.graph,
4131
+ resource: $resource,
4132
+ propertySchema: NodeShape.schema.properties.minExclusive,
4133
+ typeFromRdf: (resourceValues) => resourceValues
4134
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
4135
+ .chain((values) => values.chainMap((value) => value.toLiteral()))
4136
+ .map((values) => values.length > 0
4137
+ ? values.map((value) => Maybe.of(value))
4138
+ : Resource.Values.fromValue({
4139
+ focusResource: $resource,
4140
+ propertyPath: PropertyShape.schema.properties.minExclusive.path,
4141
+ value: Maybe.empty(),
4142
+ })),
4143
+ }),
4144
+ minInclusive: $shaclPropertyFromRdf({
4145
+ graph: _$options.graph,
4146
+ resource: $resource,
4147
+ propertySchema: NodeShape.schema.properties.minInclusive,
4148
+ typeFromRdf: (resourceValues) => resourceValues
4149
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
4150
+ .chain((values) => values.chainMap((value) => value.toLiteral()))
4151
+ .map((values) => values.length > 0
4152
+ ? values.map((value) => Maybe.of(value))
4153
+ : Resource.Values.fromValue({
4154
+ focusResource: $resource,
4155
+ propertyPath: PropertyShape.schema.properties.minInclusive.path,
4156
+ value: Maybe.empty(),
4157
+ })),
4158
+ }),
4159
+ minLength: $shaclPropertyFromRdf({
4160
+ graph: _$options.graph,
4161
+ resource: $resource,
4162
+ propertySchema: NodeShape.schema.properties.minLength,
4163
+ typeFromRdf: (resourceValues) => resourceValues
4164
+ .chain((values) => values.chainMap((value) => value.toBigInt()))
4165
+ .map((values) => values.length > 0
4166
+ ? values.map((value) => Maybe.of(value))
4167
+ : Resource.Values.fromValue({
4168
+ focusResource: $resource,
4169
+ propertyPath: PropertyShape.schema.properties.minLength.path,
4170
+ value: Maybe.empty(),
4171
+ })),
4172
+ }),
4173
+ mutable: $shaclPropertyFromRdf({
4174
+ graph: _$options.graph,
4175
+ resource: $resource,
4176
+ propertySchema: NodeShape.schema.properties.mutable,
4177
+ typeFromRdf: (resourceValues) => resourceValues
4178
+ .chain((values) => values.chainMap((value) => value.toBoolean()))
4179
+ .map((values) => values.length > 0
4180
+ ? values.map((value) => Maybe.of(value))
4181
+ : Resource.Values.fromValue({
4182
+ focusResource: $resource,
4183
+ propertyPath: PropertyShape.schema.properties.mutable.path,
4184
+ value: Maybe.empty(),
4185
+ })),
4186
+ }),
4187
+ node: $shaclPropertyFromRdf({
4188
+ graph: _$options.graph,
4189
+ resource: $resource,
4190
+ propertySchema: NodeShape.schema.properties.node,
4191
+ typeFromRdf: (resourceValues) => resourceValues
4192
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
4193
+ .map((values) => values.length > 0
4194
+ ? values.map((value) => Maybe.of(value))
4195
+ : Resource.Values.fromValue({
4196
+ focusResource: $resource,
4197
+ propertyPath: PropertyShape.schema.properties.node.path,
4198
+ value: Maybe.empty(),
4199
+ })),
4200
+ }),
4201
+ nodeKind: $shaclPropertyFromRdf({
4202
+ graph: _$options.graph,
4203
+ resource: $resource,
4204
+ propertySchema: NodeShape.schema.properties.nodeKind,
4205
+ typeFromRdf: (resourceValues) => resourceValues
4206
+ .chain((values) => values.chainMap((value) => value.toIri([
4207
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNode"),
4208
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrIRI"),
4209
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrLiteral"),
4210
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#IRI"),
4211
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#IRIOrLiteral"),
4212
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Literal"),
4213
+ ])))
4214
+ .map((values) => values.length > 0
4215
+ ? values.map((value) => Maybe.of(value))
4216
+ : Resource.Values.fromValue({
4217
+ focusResource: $resource,
4218
+ propertyPath: PropertyShape.schema.properties.nodeKind.path,
4219
+ value: Maybe.empty(),
4220
+ })),
4221
+ }),
4222
+ not: $shaclPropertyFromRdf({
4223
+ graph: _$options.graph,
4224
+ resource: $resource,
4225
+ propertySchema: NodeShape.schema.properties.not,
4226
+ typeFromRdf: (resourceValues) => resourceValues
4227
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
4228
+ .map((values) => values.toArray())
4229
+ .map((valuesArray) => Resource.Values.fromValue({
4347
4230
  focusResource: $resource,
4348
- propertyPath: PropertyShape
4349
- .schema
4350
- .properties
4351
- .minCount
4352
- .path,
4353
- value: Maybe.empty(),
4231
+ propertyPath: PropertyShape.schema.properties.not.path,
4232
+ value: valuesArray,
4354
4233
  })),
4355
- }).chain((minCount) => $shaclPropertyFromRdf({
4356
- graph: _$options.graph,
4357
- resource: $resource,
4358
- propertySchema: NodeShape.schema.properties
4359
- .minExclusive,
4360
- typeFromRdf: (resourceValues) => resourceValues
4361
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
4362
- .chain((values) => values.chainMap((value) => value.toLiteral()))
4363
- .map((values) => values.length > 0
4364
- ? values.map((value) => Maybe.of(value))
4365
- : Resource.Values.fromValue({
4234
+ }),
4235
+ or: $shaclPropertyFromRdf({
4236
+ graph: _$options.graph,
4237
+ resource: $resource,
4238
+ propertySchema: NodeShape.schema.properties.or,
4239
+ typeFromRdf: (resourceValues) => resourceValues
4240
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
4241
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
4366
4242
  focusResource: $resource,
4367
- propertyPath: PropertyShape
4368
- .schema
4369
- .properties
4370
- .minExclusive
4371
- .path,
4372
- value: Maybe.empty(),
4373
- })),
4374
- }).chain((minExclusive) => $shaclPropertyFromRdf({
4375
- graph: _$options.graph,
4376
- resource: $resource,
4377
- propertySchema: NodeShape.schema.properties
4378
- .minInclusive,
4379
- typeFromRdf: (resourceValues) => resourceValues
4380
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
4381
- .chain((values) => values.chainMap((value) => value.toLiteral()))
4382
- .map((values) => values.length >
4383
- 0
4384
- ? values.map((value) => Maybe.of(value))
4385
- : Resource.Values.fromValue({
4243
+ propertyPath: PropertyShape.schema.properties.or.path,
4244
+ values: valueList.toArray(),
4245
+ })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
4246
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
4247
+ .map((values) => values.length > 0
4248
+ ? values.map((value) => Maybe.of(value))
4249
+ : Resource.Values.fromValue({
4250
+ focusResource: $resource,
4251
+ propertyPath: PropertyShape.schema.properties.or.path,
4252
+ value: Maybe.empty(),
4253
+ })),
4254
+ }),
4255
+ patterns: $shaclPropertyFromRdf({
4256
+ graph: _$options.graph,
4257
+ resource: $resource,
4258
+ propertySchema: NodeShape.schema.properties.patterns,
4259
+ typeFromRdf: (resourceValues) => resourceValues
4260
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
4261
+ .chain((values) => values.chainMap((value) => value.toString()))
4262
+ .map((values) => values.toArray())
4263
+ .map((valuesArray) => Resource.Values.fromValue({
4386
4264
  focusResource: $resource,
4387
- propertyPath: PropertyShape
4388
- .schema
4389
- .properties
4390
- .minInclusive
4391
- .path,
4392
- value: Maybe.empty(),
4265
+ propertyPath: PropertyShape.schema.properties.patterns.path,
4266
+ value: valuesArray,
4393
4267
  })),
4394
- }).chain((minInclusive) => $shaclPropertyFromRdf({
4395
- graph: _$options.graph,
4396
- resource: $resource,
4397
- propertySchema: NodeShape.schema
4398
- .properties
4399
- .minLength,
4400
- typeFromRdf: (resourceValues) => resourceValues
4401
- .chain((values) => values.chainMap((value) => value.toBigInt()))
4402
- .map((values) => values.length >
4403
- 0
4404
- ? values.map((value) => Maybe.of(value))
4405
- : Resource.Values.fromValue({
4268
+ }),
4269
+ properties: $shaclPropertyFromRdf({
4270
+ graph: _$options.graph,
4271
+ resource: $resource,
4272
+ propertySchema: NodeShape.schema.properties.properties,
4273
+ typeFromRdf: (resourceValues) => resourceValues
4274
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
4275
+ .map((values) => values.toArray())
4276
+ .map((valuesArray) => Resource.Values.fromValue({
4406
4277
  focusResource: $resource,
4407
- propertyPath: PropertyShape
4408
- .schema
4409
- .properties
4410
- .minLength
4411
- .path,
4412
- value: Maybe.empty(),
4278
+ propertyPath: NodeShape.schema.properties.properties.path,
4279
+ value: valuesArray,
4413
4280
  })),
4414
- }).chain((minLength) => $shaclPropertyFromRdf({
4415
- graph: _$options.graph,
4416
- resource: $resource,
4417
- propertySchema: NodeShape.schema
4418
- .properties
4419
- .mutable,
4420
- typeFromRdf: (resourceValues) => resourceValues
4421
- .chain((values) => values.chainMap((value) => value.toBoolean()))
4422
- .map((values) => values.length >
4423
- 0
4424
- ? values.map((value) => Maybe.of(value))
4425
- : Resource.Values.fromValue({
4281
+ }),
4282
+ rdfType: $shaclPropertyFromRdf({
4283
+ graph: _$options.graph,
4284
+ resource: $resource,
4285
+ propertySchema: NodeShape.schema.properties.rdfType,
4286
+ typeFromRdf: (resourceValues) => resourceValues
4287
+ .chain((values) => values.chainMap((value) => value.toIri()))
4288
+ .map((values) => values.length > 0
4289
+ ? values.map((value) => Maybe.of(value))
4290
+ : Resource.Values.fromValue({
4291
+ focusResource: $resource,
4292
+ propertyPath: NodeShape.schema.properties.rdfType.path,
4293
+ value: Maybe.empty(),
4294
+ })),
4295
+ }),
4296
+ shaclmateName: $shaclPropertyFromRdf({
4297
+ graph: _$options.graph,
4298
+ resource: $resource,
4299
+ propertySchema: NodeShape.schema.properties.shaclmateName,
4300
+ typeFromRdf: (resourceValues) => resourceValues
4301
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
4302
+ .chain((values) => values.chainMap((value) => value.toString()))
4303
+ .map((values) => values.length > 0
4304
+ ? values.map((value) => Maybe.of(value))
4305
+ : Resource.Values.fromValue({
4306
+ focusResource: $resource,
4307
+ propertyPath: PropertyShape.schema.properties.shaclmateName.path,
4308
+ value: Maybe.empty(),
4309
+ })),
4310
+ }),
4311
+ subClassOf: $shaclPropertyFromRdf({
4312
+ graph: _$options.graph,
4313
+ resource: $resource,
4314
+ propertySchema: NodeShape.schema.properties.subClassOf,
4315
+ typeFromRdf: (resourceValues) => resourceValues
4316
+ .chain((values) => values.chainMap((value) => value.toIri()))
4317
+ .map((values) => values.toArray())
4318
+ .map((valuesArray) => Resource.Values.fromValue({
4426
4319
  focusResource: $resource,
4427
- propertyPath: PropertyShape
4428
- .schema
4429
- .properties
4430
- .mutable
4431
- .path,
4432
- value: Maybe.empty(),
4320
+ propertyPath: NodeShape.schema.properties.subClassOf.path,
4321
+ value: valuesArray,
4433
4322
  })),
4434
- }).chain((mutable) => $shaclPropertyFromRdf({
4435
- graph: _$options.graph,
4436
- resource: $resource,
4437
- propertySchema: NodeShape.schema
4438
- .properties
4439
- .node,
4440
- typeFromRdf: (resourceValues) => resourceValues
4441
- .chain((values) => values.chainMap((value) => value.toIdentifier()))
4442
- .map((values) => values.length >
4443
- 0
4444
- ? values.map((value) => Maybe.of(value))
4445
- : Resource.Values.fromValue({
4323
+ }),
4324
+ toRdfTypes: $shaclPropertyFromRdf({
4325
+ graph: _$options.graph,
4326
+ resource: $resource,
4327
+ propertySchema: NodeShape.schema.properties.toRdfTypes,
4328
+ typeFromRdf: (resourceValues) => resourceValues
4329
+ .chain((values) => values.chainMap((value) => value.toIri()))
4330
+ .map((values) => values.toArray())
4331
+ .map((valuesArray) => Resource.Values.fromValue({
4446
4332
  focusResource: $resource,
4447
- propertyPath: PropertyShape
4448
- .schema
4449
- .properties
4450
- .node
4451
- .path,
4452
- value: Maybe.empty(),
4333
+ propertyPath: NodeShape.schema.properties.toRdfTypes.path,
4334
+ value: valuesArray,
4453
4335
  })),
4454
- }).chain((node) => $shaclPropertyFromRdf({
4455
- graph: _$options.graph,
4456
- resource: $resource,
4457
- propertySchema: NodeShape.schema
4458
- .properties
4459
- .nodeKind,
4460
- typeFromRdf: (resourceValues) => resourceValues
4461
- .chain((values) => values.chainMap((value) => value.toIri([
4462
- dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNode"),
4463
- dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrIRI"),
4464
- dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrLiteral"),
4465
- dataFactory.namedNode("http://www.w3.org/ns/shacl#IRI"),
4466
- dataFactory.namedNode("http://www.w3.org/ns/shacl#IRIOrLiteral"),
4467
- dataFactory.namedNode("http://www.w3.org/ns/shacl#Literal"),
4468
- ])))
4469
- .map((values) => values.length >
4470
- 0
4471
- ? values.map((value) => Maybe.of(value))
4472
- : Resource.Values.fromValue({
4336
+ }),
4337
+ tsFeatureExcludes: $shaclPropertyFromRdf({
4338
+ graph: _$options.graph,
4339
+ resource: $resource,
4340
+ propertySchema: NodeShape.schema.properties.tsFeatureExcludes,
4341
+ typeFromRdf: (resourceValues) => resourceValues
4342
+ .chain((values) => values.chainMap((value) => value.toIri([
4343
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_All"),
4344
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Create"),
4345
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_Default"),
4346
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Equals"),
4347
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Graphql"),
4348
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Hash"),
4349
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Json"),
4350
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_None"),
4351
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Rdf"),
4352
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Sparql"),
4353
+ ])))
4354
+ .map((values) => values.toArray())
4355
+ .map((valuesArray) => Resource.Values.fromValue({
4473
4356
  focusResource: $resource,
4474
- propertyPath: PropertyShape
4475
- .schema
4476
- .properties
4477
- .nodeKind
4478
- .path,
4479
- value: Maybe.empty(),
4357
+ propertyPath: Ontology.schema.properties.tsFeatureExcludes.path,
4358
+ value: valuesArray,
4480
4359
  })),
4481
- }).chain((nodeKind) => $shaclPropertyFromRdf({
4482
- graph: _$options.graph,
4483
- resource: $resource,
4484
- propertySchema: NodeShape.schema
4485
- .properties
4486
- .not,
4487
- typeFromRdf: (resourceValues) => resourceValues
4488
- .chain((values) => values.chainMap((value) => value.toIdentifier()))
4489
- .map((values) => values.toArray())
4490
- .map((valuesArray) => Resource.Values.fromValue({
4491
- focusResource: $resource,
4492
- propertyPath: PropertyShape
4493
- .schema
4494
- .properties
4495
- .not
4496
- .path,
4497
- value: valuesArray,
4498
- })),
4499
- }).chain((not) => $shaclPropertyFromRdf({
4500
- graph: _$options.graph,
4501
- resource: $resource,
4502
- propertySchema: NodeShape.schema
4503
- .properties
4504
- .or,
4505
- typeFromRdf: (resourceValues) => resourceValues
4506
- .chain((values) => values.chainMap((value) => value.toList({
4360
+ }),
4361
+ tsFeatureIncludes: $shaclPropertyFromRdf({
4507
4362
  graph: _$options.graph,
4508
- })))
4509
- .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
4510
- focusResource: $resource,
4511
- propertyPath: PropertyShape
4512
- .schema
4513
- .properties
4514
- .or
4515
- .path,
4516
- values: valueList.toArray(),
4517
- })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
4518
- .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
4519
- .map((values) => values.length >
4520
- 0
4521
- ? values.map((value) => Maybe.of(value))
4522
- : Resource.Values.fromValue({
4363
+ resource: $resource,
4364
+ propertySchema: NodeShape.schema.properties.tsFeatureIncludes,
4365
+ typeFromRdf: (resourceValues) => resourceValues
4366
+ .chain((values) => values.chainMap((value) => value.toIri([
4367
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_All"),
4368
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Create"),
4369
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_Default"),
4370
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Equals"),
4371
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Graphql"),
4372
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Hash"),
4373
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Json"),
4374
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_None"),
4375
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Rdf"),
4376
+ dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Sparql"),
4377
+ ])))
4378
+ .map((values) => values.toArray())
4379
+ .map((valuesArray) => Resource.Values.fromValue({
4523
4380
  focusResource: $resource,
4524
- propertyPath: PropertyShape
4525
- .schema
4526
- .properties
4527
- .or
4528
- .path,
4529
- value: Maybe.empty(),
4381
+ propertyPath: Ontology.schema.properties.tsFeatureIncludes.path,
4382
+ value: valuesArray,
4530
4383
  })),
4531
- }).chain((or) => $shaclPropertyFromRdf({
4532
- graph: _$options.graph,
4533
- resource: $resource,
4534
- propertySchema: NodeShape.schema
4535
- .properties
4536
- .patterns,
4537
- typeFromRdf: (resourceValues) => resourceValues
4538
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
4539
- .chain((values) => values.chainMap((value) => value.toString()))
4540
- .map((values) => values.toArray())
4541
- .map((valuesArray) => Resource.Values.fromValue({
4542
- focusResource: $resource,
4543
- propertyPath: PropertyShape
4544
- .schema
4545
- .properties
4546
- .patterns
4547
- .path,
4548
- value: valuesArray,
4549
- })),
4550
- }).chain((patterns) => $shaclPropertyFromRdf({
4551
- graph: _$options.graph,
4552
- resource: $resource,
4553
- propertySchema: NodeShape.schema
4554
- .properties
4555
- .properties,
4556
- typeFromRdf: (resourceValues) => resourceValues
4557
- .chain((values) => values.chainMap((value) => value.toIdentifier()))
4558
- .map((values) => values.toArray())
4559
- .map((valuesArray) => Resource.Values.fromValue({
4560
- focusResource: $resource,
4561
- propertyPath: NodeShape
4562
- .schema
4563
- .properties
4564
- .properties
4565
- .path,
4566
- value: valuesArray,
4567
- })),
4568
- }).chain((properties) => $shaclPropertyFromRdf({
4569
- graph: _$options.graph,
4570
- resource: $resource,
4571
- propertySchema: NodeShape.schema
4572
- .properties
4573
- .rdfType,
4574
- typeFromRdf: (resourceValues) => resourceValues
4575
- .chain((values) => values.chainMap((value) => value.toIri()))
4576
- .map((values) => values.length >
4577
- 0
4578
- ? values.map((value) => Maybe.of(value))
4579
- : Resource.Values.fromValue({
4384
+ }),
4385
+ tsImports: $shaclPropertyFromRdf({
4386
+ graph: _$options.graph,
4387
+ resource: $resource,
4388
+ propertySchema: NodeShape.schema.properties.tsImports,
4389
+ typeFromRdf: (resourceValues) => resourceValues
4390
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
4391
+ .chain((values) => values.chainMap((value) => value.toString()))
4392
+ .map((values) => values.toArray())
4393
+ .map((valuesArray) => Resource.Values.fromValue({
4580
4394
  focusResource: $resource,
4581
- propertyPath: NodeShape
4582
- .schema
4583
- .properties
4584
- .rdfType
4585
- .path,
4586
- value: Maybe.empty(),
4395
+ propertyPath: Ontology.schema.properties.tsImports.path,
4396
+ value: valuesArray,
4587
4397
  })),
4588
- }).chain((rdfType) => $shaclPropertyFromRdf({
4589
- graph: _$options.graph,
4590
- resource: $resource,
4591
- propertySchema: NodeShape.schema
4592
- .properties
4593
- .shaclmateName,
4594
- typeFromRdf: (resourceValues) => resourceValues
4595
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
4596
- .chain((values) => values.chainMap((value) => value.toString()))
4597
- .map((values) => values.length >
4598
- 0
4599
- ? values.map((value) => Maybe.of(value))
4600
- : Resource.Values.fromValue({
4398
+ }),
4399
+ types: $shaclPropertyFromRdf({
4400
+ graph: _$options.graph,
4401
+ resource: $resource,
4402
+ propertySchema: NodeShape.schema.properties.types,
4403
+ typeFromRdf: (resourceValues) => resourceValues
4404
+ .chain((values) => values.chainMap((value) => value.toIri()))
4405
+ .map((values) => values.toArray())
4406
+ .map((valuesArray) => Resource.Values.fromValue({
4601
4407
  focusResource: $resource,
4602
- propertyPath: PropertyShape
4603
- .schema
4604
- .properties
4605
- .shaclmateName
4606
- .path,
4607
- value: Maybe.empty(),
4408
+ propertyPath: NodeShape.schema.properties.types.path,
4409
+ value: valuesArray,
4608
4410
  })),
4609
- }).chain((shaclmateName) => $shaclPropertyFromRdf({
4610
- graph: _$options.graph,
4611
- resource: $resource,
4612
- propertySchema: NodeShape.schema
4613
- .properties
4614
- .subClassOf,
4615
- typeFromRdf: (resourceValues) => resourceValues
4616
- .chain((values) => values.chainMap((value) => value.toIri()))
4617
- .map((values) => values.toArray())
4618
- .map((valuesArray) => Resource.Values.fromValue({
4619
- focusResource: $resource,
4620
- propertyPath: NodeShape
4621
- .schema
4622
- .properties
4623
- .subClassOf
4624
- .path,
4625
- value: valuesArray,
4626
- })),
4627
- }).chain((subClassOf) => $shaclPropertyFromRdf({
4628
- graph: _$options.graph,
4629
- resource: $resource,
4630
- propertySchema: NodeShape.schema
4631
- .properties
4632
- .toRdfTypes,
4633
- typeFromRdf: (resourceValues) => resourceValues
4634
- .chain((values) => values.chainMap((value) => value.toIri()))
4635
- .map((values) => values.toArray())
4636
- .map((valuesArray) => Resource.Values.fromValue({
4637
- focusResource: $resource,
4638
- propertyPath: NodeShape
4639
- .schema
4640
- .properties
4641
- .toRdfTypes
4642
- .path,
4643
- value: valuesArray,
4644
- })),
4645
- }).chain((toRdfTypes) => $shaclPropertyFromRdf({
4646
- graph: _$options.graph,
4647
- resource: $resource,
4648
- propertySchema: NodeShape.schema
4649
- .properties
4650
- .tsFeatureExcludes,
4651
- typeFromRdf: (resourceValues) => resourceValues
4652
- .chain((values) => values.chainMap((value) => value.toIri([
4653
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_All"),
4654
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Create"),
4655
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_Default"),
4656
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Equals"),
4657
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Graphql"),
4658
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Hash"),
4659
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Json"),
4660
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_None"),
4661
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Rdf"),
4662
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Sparql"),
4663
- ])))
4664
- .map((values) => values.toArray())
4665
- .map((valuesArray) => Resource.Values.fromValue({
4666
- focusResource: $resource,
4667
- propertyPath: Ontology
4668
- .schema
4669
- .properties
4670
- .tsFeatureExcludes
4671
- .path,
4672
- value: valuesArray,
4673
- })),
4674
- }).chain((tsFeatureExcludes) => $shaclPropertyFromRdf({
4675
- graph: _$options.graph,
4676
- resource: $resource,
4677
- propertySchema: NodeShape.schema
4678
- .properties
4679
- .tsFeatureIncludes,
4680
- typeFromRdf: (resourceValues) => resourceValues
4681
- .chain((values) => values.chainMap((value) => value.toIri([
4682
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_All"),
4683
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Create"),
4684
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_Default"),
4685
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Equals"),
4686
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Graphql"),
4687
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Hash"),
4688
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Json"),
4689
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeatures_None"),
4690
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Rdf"),
4691
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsFeature_Sparql"),
4692
- ])))
4693
- .map((values) => values.toArray())
4694
- .map((valuesArray) => Resource.Values.fromValue({
4695
- focusResource: $resource,
4696
- propertyPath: Ontology
4697
- .schema
4698
- .properties
4699
- .tsFeatureIncludes
4700
- .path,
4701
- value: valuesArray,
4702
- })),
4703
- }).chain((tsFeatureIncludes) => $shaclPropertyFromRdf({
4704
- graph: _$options.graph,
4705
- resource: $resource,
4706
- propertySchema: NodeShape.schema
4707
- .properties
4708
- .tsImports,
4709
- typeFromRdf: (resourceValues) => resourceValues
4710
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
4711
- .chain((values) => values.chainMap((value) => value.toString()))
4712
- .map((values) => values.toArray())
4713
- .map((valuesArray) => Resource.Values.fromValue({
4714
- focusResource: $resource,
4715
- propertyPath: Ontology
4716
- .schema
4717
- .properties
4718
- .tsImports
4719
- .path,
4720
- value: valuesArray,
4721
- })),
4722
- }).chain((tsImports) => $shaclPropertyFromRdf({
4723
- graph: _$options.graph,
4724
- resource: $resource,
4725
- propertySchema: NodeShape.schema
4726
- .properties
4727
- .types,
4728
- typeFromRdf: (resourceValues) => resourceValues
4729
- .chain((values) => values.chainMap((value) => value.toIri()))
4730
- .map((values) => values.toArray())
4731
- .map((valuesArray) => Resource.Values.fromValue({
4732
- focusResource: $resource,
4733
- propertyPath: NodeShape
4734
- .schema
4735
- .properties
4736
- .types
4737
- .path,
4738
- value: valuesArray,
4739
- })),
4740
- }).chain((types) => $shaclPropertyFromRdf({
4741
- graph: _$options.graph,
4742
- resource: $resource,
4743
- propertySchema: NodeShape.schema
4744
- .properties
4745
- .xone,
4746
- typeFromRdf: (resourceValues) => resourceValues
4747
- .chain((values) => values.chainMap((value) => value.toList({
4411
+ }),
4412
+ xone: $shaclPropertyFromRdf({
4748
4413
  graph: _$options.graph,
4749
- })))
4750
- .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
4751
- focusResource: $resource,
4752
- propertyPath: PropertyShape
4753
- .schema
4754
- .properties
4755
- .xone
4756
- .path,
4757
- values: valueList.toArray(),
4758
- })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
4759
- .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
4760
- .map((values) => values.length >
4761
- 0
4762
- ? values.map((value) => Maybe.of(value))
4763
- : Resource.Values.fromValue({
4414
+ resource: $resource,
4415
+ propertySchema: NodeShape.schema.properties.xone,
4416
+ typeFromRdf: (resourceValues) => resourceValues
4417
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
4418
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
4764
4419
  focusResource: $resource,
4765
- propertyPath: PropertyShape
4766
- .schema
4767
- .properties
4768
- .xone
4769
- .path,
4770
- value: Maybe.empty(),
4771
- })),
4772
- }).map((xone) => ({
4773
- $identifier,
4774
- $type,
4775
- and,
4776
- classes,
4777
- closed,
4778
- comment,
4779
- datatype,
4780
- deactivated,
4781
- discriminantValue,
4782
- extern,
4783
- flags,
4784
- fromRdfType,
4785
- hasValues,
4786
- ignoredProperties,
4787
- in_,
4788
- isDefinedBy,
4789
- label,
4790
- languageIn,
4791
- maxCount,
4792
- maxExclusive,
4793
- maxInclusive,
4794
- maxLength,
4795
- minCount,
4796
- minExclusive,
4797
- minInclusive,
4798
- minLength,
4799
- mutable,
4800
- node,
4801
- nodeKind,
4802
- not,
4803
- or,
4804
- patterns,
4805
- properties,
4806
- rdfType,
4807
- shaclmateName,
4808
- subClassOf,
4809
- toRdfTypes,
4810
- tsFeatureExcludes,
4811
- tsFeatureIncludes,
4812
- tsImports,
4813
- types,
4814
- xone,
4815
- }))))))))))))))))))))))))))))))))))))))))))));
4420
+ propertyPath: PropertyShape.schema.properties.xone.path,
4421
+ values: valueList.toArray(),
4422
+ })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
4423
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
4424
+ .map((values) => values.length > 0
4425
+ ? values.map((value) => Maybe.of(value))
4426
+ : Resource.Values.fromValue({
4427
+ focusResource: $resource,
4428
+ propertyPath: PropertyShape.schema.properties.xone.path,
4429
+ value: Maybe.empty(),
4430
+ })),
4431
+ }),
4432
+ }).map((properties) => create(properties)));
4816
4433
  };
4434
+ NodeShape.fromRdfResource = $wrap_FromRdfResourceFunction(NodeShape._fromRdfResource);
4435
+ NodeShape.fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
4436
+ .toResource()
4437
+ .chain((resource) => NodeShape.fromRdfResource(resource, options))));
4438
+ NodeShape.fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape");
4439
+ function isNodeShape(object) {
4440
+ switch (object.$type) {
4441
+ case "NodeShape":
4442
+ return true;
4443
+ default:
4444
+ return false;
4445
+ }
4446
+ }
4447
+ NodeShape.isNodeShape = isNodeShape;
4817
4448
  NodeShape.schema = {
4818
4449
  properties: {
4819
4450
  $identifier: {
@@ -5205,226 +4836,224 @@ export var NodeShape;
5205
4836
  },
5206
4837
  },
5207
4838
  };
5208
- function toRdfResource(_nodeShape, options) {
5209
- const resourceSet = options?.resourceSet ??
5210
- new ResourceSet({
5211
- dataFactory: dataFactory,
5212
- dataset: datasetFactory.dataset(),
5213
- });
5214
- const resource = resourceSet.resource(_nodeShape.$identifier());
5215
- if (!options?.ignoreRdfType) {
5216
- resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape"), options?.graph);
4839
+ NodeShape._toRdfResource = (parameters) => {
4840
+ if (!parameters.ignoreRdfType) {
4841
+ parameters.resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape"), parameters.graph);
5217
4842
  }
5218
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#and"), _nodeShape.and.toList().flatMap((value) => [
4843
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#and"), parameters.object.and.toList().flatMap((value) => [
5219
4844
  value.length > 0
5220
4845
  ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
5221
4846
  if (itemIndex === 0) {
5222
4847
  currentSubListResource = listResource;
5223
4848
  }
5224
4849
  else {
5225
- const newSubListResource = resourceSet.resource((() => dataFactory.blankNode())());
5226
- currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
4850
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
4851
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
5227
4852
  currentSubListResource = newSubListResource;
5228
4853
  }
5229
- currentSubListResource.add($RdfVocabularies.rdf.first, [item], options?.graph);
4854
+ currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
5230
4855
  if (itemIndex + 1 === list.length) {
5231
- currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
4856
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
5232
4857
  }
5233
4858
  return { currentSubListResource, listResource };
5234
4859
  }, {
5235
4860
  currentSubListResource: null,
5236
- listResource: resourceSet.resource((() => dataFactory.blankNode())()),
4861
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
5237
4862
  }).listResource.identifier
5238
4863
  : $RdfVocabularies.rdf.nil,
5239
- ]), options?.graph);
5240
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#class"), _nodeShape.classes.flatMap((item) => [item]), options?.graph);
5241
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#closed"), _nodeShape.closed
4864
+ ]), parameters.graph);
4865
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#class"), parameters.object.classes.flatMap((item) => [item]), parameters.graph);
4866
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#closed"), parameters.object.closed
5242
4867
  .toList()
5243
4868
  .flatMap((value) => [
5244
4869
  $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
5245
- ]), options?.graph);
5246
- resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), _nodeShape.comment
4870
+ ]), parameters.graph);
4871
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), parameters.object.comment
5247
4872
  .toList()
5248
- .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
5249
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#datatype"), _nodeShape.datatype.toList(), options?.graph);
5250
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"), _nodeShape.deactivated
4873
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
4874
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#datatype"), parameters.object.datatype.toList(), parameters.graph);
4875
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"), parameters.object.deactivated
5251
4876
  .toList()
5252
4877
  .flatMap((value) => [
5253
4878
  $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
5254
- ]), options?.graph);
5255
- resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#discriminantValue"), _nodeShape.discriminantValue
4879
+ ]), parameters.graph);
4880
+ parameters.resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#discriminantValue"), parameters.object.discriminantValue
5256
4881
  .toList()
5257
- .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
5258
- resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#extern"), _nodeShape.extern
4882
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
4883
+ parameters.resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#extern"), parameters.object.extern
5259
4884
  .toList()
5260
4885
  .flatMap((value) => [
5261
4886
  $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
5262
- ]), options?.graph);
5263
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#flags"), _nodeShape.flags.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
5264
- resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#fromRdfType"), _nodeShape.fromRdfType.toList(), options?.graph);
5265
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#hasValue"), _nodeShape.hasValues.flatMap((item) => [item]), options?.graph);
5266
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#ignoredProperties"), _nodeShape.ignoredProperties.toList().flatMap((value) => [
4887
+ ]), parameters.graph);
4888
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#flags"), parameters.object.flags.flatMap((item) => [$literalFactory.string(item)]), parameters.graph);
4889
+ parameters.resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#fromRdfType"), parameters.object.fromRdfType.toList(), parameters.graph);
4890
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#hasValue"), parameters.object.hasValues.flatMap((item) => [item]), parameters.graph);
4891
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#ignoredProperties"), parameters.object.ignoredProperties.toList().flatMap((value) => [
5267
4892
  value.length > 0
5268
4893
  ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
5269
4894
  if (itemIndex === 0) {
5270
4895
  currentSubListResource = listResource;
5271
4896
  }
5272
4897
  else {
5273
- const newSubListResource = resourceSet.resource((() => dataFactory.blankNode())());
5274
- currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
4898
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
4899
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
5275
4900
  currentSubListResource = newSubListResource;
5276
4901
  }
5277
- currentSubListResource.add($RdfVocabularies.rdf.first, [item], options?.graph);
4902
+ currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
5278
4903
  if (itemIndex + 1 === list.length) {
5279
- currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
4904
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
5280
4905
  }
5281
4906
  return { currentSubListResource, listResource };
5282
4907
  }, {
5283
4908
  currentSubListResource: null,
5284
- listResource: resourceSet.resource((() => dataFactory.blankNode())()),
4909
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
5285
4910
  }).listResource.identifier
5286
4911
  : $RdfVocabularies.rdf.nil,
5287
- ]), options?.graph);
5288
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#in"), _nodeShape.in_.toList().flatMap((value) => [
4912
+ ]), parameters.graph);
4913
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#in"), parameters.object.in_.toList().flatMap((value) => [
5289
4914
  value.length > 0
5290
4915
  ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
5291
4916
  if (itemIndex === 0) {
5292
4917
  currentSubListResource = listResource;
5293
4918
  }
5294
4919
  else {
5295
- const newSubListResource = resourceSet.resource((() => dataFactory.blankNode())());
5296
- currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
4920
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
4921
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
5297
4922
  currentSubListResource = newSubListResource;
5298
4923
  }
5299
- currentSubListResource.add($RdfVocabularies.rdf.first, [item], options?.graph);
4924
+ currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
5300
4925
  if (itemIndex + 1 === list.length) {
5301
- currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
4926
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
5302
4927
  }
5303
4928
  return { currentSubListResource, listResource };
5304
4929
  }, {
5305
4930
  currentSubListResource: null,
5306
- listResource: resourceSet.resource((() => dataFactory.blankNode())()),
4931
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
5307
4932
  }).listResource.identifier
5308
4933
  : $RdfVocabularies.rdf.nil,
5309
- ]), options?.graph);
5310
- resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"), _nodeShape.isDefinedBy.toList(), options?.graph);
5311
- resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), _nodeShape.label
4934
+ ]), parameters.graph);
4935
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"), parameters.object.isDefinedBy.toList(), parameters.graph);
4936
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), parameters.object.label
5312
4937
  .toList()
5313
- .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
5314
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#languageIn"), _nodeShape.languageIn.toList().flatMap((value) => [
4938
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
4939
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#languageIn"), parameters.object.languageIn.toList().flatMap((value) => [
5315
4940
  value.length > 0
5316
4941
  ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
5317
4942
  if (itemIndex === 0) {
5318
4943
  currentSubListResource = listResource;
5319
4944
  }
5320
4945
  else {
5321
- const newSubListResource = resourceSet.resource((() => dataFactory.blankNode())());
5322
- currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
4946
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
4947
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
5323
4948
  currentSubListResource = newSubListResource;
5324
4949
  }
5325
- currentSubListResource.add($RdfVocabularies.rdf.first, [$literalFactory.string(item)], options?.graph);
4950
+ currentSubListResource.add($RdfVocabularies.rdf.first, [$literalFactory.string(item)], parameters.graph);
5326
4951
  if (itemIndex + 1 === list.length) {
5327
- currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
4952
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
5328
4953
  }
5329
4954
  return { currentSubListResource, listResource };
5330
4955
  }, {
5331
4956
  currentSubListResource: null,
5332
- listResource: resourceSet.resource((() => dataFactory.blankNode())()),
4957
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
5333
4958
  }).listResource.identifier
5334
4959
  : $RdfVocabularies.rdf.nil,
5335
- ]), options?.graph);
5336
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxCount"), _nodeShape.maxCount
4960
+ ]), parameters.graph);
4961
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxCount"), parameters.object.maxCount
5337
4962
  .toList()
5338
4963
  .flatMap((value) => [
5339
4964
  $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
5340
- ]), options?.graph);
5341
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxExclusive"), _nodeShape.maxExclusive.toList(), options?.graph);
5342
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxInclusive"), _nodeShape.maxInclusive.toList(), options?.graph);
5343
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxLength"), _nodeShape.maxLength
4965
+ ]), parameters.graph);
4966
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxExclusive"), parameters.object.maxExclusive.toList(), parameters.graph);
4967
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxInclusive"), parameters.object.maxInclusive.toList(), parameters.graph);
4968
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxLength"), parameters.object.maxLength
5344
4969
  .toList()
5345
4970
  .flatMap((value) => [
5346
4971
  $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
5347
- ]), options?.graph);
5348
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minCount"), _nodeShape.minCount
4972
+ ]), parameters.graph);
4973
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minCount"), parameters.object.minCount
5349
4974
  .toList()
5350
4975
  .flatMap((value) => [
5351
4976
  $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
5352
- ]), options?.graph);
5353
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minExclusive"), _nodeShape.minExclusive.toList(), options?.graph);
5354
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minInclusive"), _nodeShape.minInclusive.toList(), options?.graph);
5355
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minLength"), _nodeShape.minLength
4977
+ ]), parameters.graph);
4978
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minExclusive"), parameters.object.minExclusive.toList(), parameters.graph);
4979
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minInclusive"), parameters.object.minInclusive.toList(), parameters.graph);
4980
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minLength"), parameters.object.minLength
5356
4981
  .toList()
5357
4982
  .flatMap((value) => [
5358
4983
  $literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
5359
- ]), options?.graph);
5360
- resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#mutable"), _nodeShape.mutable
4984
+ ]), parameters.graph);
4985
+ parameters.resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#mutable"), parameters.object.mutable
5361
4986
  .toList()
5362
4987
  .flatMap((value) => [
5363
4988
  $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
5364
- ]), options?.graph);
5365
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#node"), _nodeShape.node.toList(), options?.graph);
5366
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"), _nodeShape.nodeKind.toList(), options?.graph);
5367
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#not"), _nodeShape.not.flatMap((item) => [item]), options?.graph);
5368
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#or"), _nodeShape.or.toList().flatMap((value) => [
4989
+ ]), parameters.graph);
4990
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#node"), parameters.object.node.toList(), parameters.graph);
4991
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"), parameters.object.nodeKind.toList(), parameters.graph);
4992
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#not"), parameters.object.not.flatMap((item) => [item]), parameters.graph);
4993
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#or"), parameters.object.or.toList().flatMap((value) => [
5369
4994
  value.length > 0
5370
4995
  ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
5371
4996
  if (itemIndex === 0) {
5372
4997
  currentSubListResource = listResource;
5373
4998
  }
5374
4999
  else {
5375
- const newSubListResource = resourceSet.resource((() => dataFactory.blankNode())());
5376
- currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
5000
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
5001
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
5377
5002
  currentSubListResource = newSubListResource;
5378
5003
  }
5379
- currentSubListResource.add($RdfVocabularies.rdf.first, [item], options?.graph);
5004
+ currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
5380
5005
  if (itemIndex + 1 === list.length) {
5381
- currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
5006
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
5382
5007
  }
5383
5008
  return { currentSubListResource, listResource };
5384
5009
  }, {
5385
5010
  currentSubListResource: null,
5386
- listResource: resourceSet.resource((() => dataFactory.blankNode())()),
5011
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
5387
5012
  }).listResource.identifier
5388
5013
  : $RdfVocabularies.rdf.nil,
5389
- ]), options?.graph);
5390
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#pattern"), _nodeShape.patterns.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
5391
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#property"), _nodeShape.properties.flatMap((item) => [item]), options?.graph);
5392
- resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#rdfType"), _nodeShape.rdfType.toList(), options?.graph);
5393
- resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#name"), _nodeShape.shaclmateName
5014
+ ]), parameters.graph);
5015
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#pattern"), parameters.object.patterns.flatMap((item) => [
5016
+ $literalFactory.string(item),
5017
+ ]), parameters.graph);
5018
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#property"), parameters.object.properties.flatMap((item) => [item]), parameters.graph);
5019
+ parameters.resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#rdfType"), parameters.object.rdfType.toList(), parameters.graph);
5020
+ parameters.resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#name"), parameters.object.shaclmateName
5394
5021
  .toList()
5395
- .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
5396
- resource.add($RdfVocabularies.rdfs.subClassOf, _nodeShape.subClassOf.flatMap((item) => [item]), options?.graph);
5397
- resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#toRdfType"), _nodeShape.toRdfTypes.flatMap((item) => [item]), options?.graph);
5398
- resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureExclude"), _nodeShape.tsFeatureExcludes.flatMap((item) => [item]), options?.graph);
5399
- resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureInclude"), _nodeShape.tsFeatureIncludes.flatMap((item) => [item]), options?.graph);
5400
- resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsImport"), _nodeShape.tsImports.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
5401
- resource.add($RdfVocabularies.rdf.type, _nodeShape.types.flatMap((item) => [item]), options?.graph);
5402
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#xone"), _nodeShape.xone.toList().flatMap((value) => [
5022
+ .flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
5023
+ parameters.resource.add($RdfVocabularies.rdfs.subClassOf, parameters.object.subClassOf.flatMap((item) => [item]), parameters.graph);
5024
+ parameters.resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#toRdfType"), parameters.object.toRdfTypes.flatMap((item) => [item]), parameters.graph);
5025
+ parameters.resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureExclude"), parameters.object.tsFeatureExcludes.flatMap((item) => [item]), parameters.graph);
5026
+ parameters.resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureInclude"), parameters.object.tsFeatureIncludes.flatMap((item) => [item]), parameters.graph);
5027
+ parameters.resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsImport"), parameters.object.tsImports.flatMap((item) => [
5028
+ $literalFactory.string(item),
5029
+ ]), parameters.graph);
5030
+ parameters.resource.add($RdfVocabularies.rdf.type, parameters.object.types.flatMap((item) => [item]), parameters.graph);
5031
+ parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#xone"), parameters.object.xone.toList().flatMap((value) => [
5403
5032
  value.length > 0
5404
5033
  ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
5405
5034
  if (itemIndex === 0) {
5406
5035
  currentSubListResource = listResource;
5407
5036
  }
5408
5037
  else {
5409
- const newSubListResource = resourceSet.resource((() => dataFactory.blankNode())());
5410
- currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
5038
+ const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
5039
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
5411
5040
  currentSubListResource = newSubListResource;
5412
5041
  }
5413
- currentSubListResource.add($RdfVocabularies.rdf.first, [item], options?.graph);
5042
+ currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
5414
5043
  if (itemIndex + 1 === list.length) {
5415
- currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
5044
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
5416
5045
  }
5417
5046
  return { currentSubListResource, listResource };
5418
5047
  }, {
5419
5048
  currentSubListResource: null,
5420
- listResource: resourceSet.resource((() => dataFactory.blankNode())()),
5049
+ listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
5421
5050
  }).listResource.identifier
5422
5051
  : $RdfVocabularies.rdf.nil,
5423
- ]), options?.graph);
5424
- return resource;
5425
- }
5426
- NodeShape.toRdfResource = toRdfResource;
5427
- function propertiesToStrings(_nodeShape) {
5052
+ ]), parameters.graph);
5053
+ return parameters.resource;
5054
+ };
5055
+ NodeShape.toRdfResource = $wrap_ToRdfResourceFunction(NodeShape._toRdfResource);
5056
+ function _propertiesToStrings(_nodeShape) {
5428
5057
  return $compactRecord({
5429
5058
  $identifier: _nodeShape.$identifier().toString(),
5430
5059
  label: _nodeShape.label.map((item) => item.toString()).extract(),
@@ -5433,9 +5062,9 @@ export var NodeShape;
5433
5062
  .extract(),
5434
5063
  });
5435
5064
  }
5436
- NodeShape.propertiesToStrings = propertiesToStrings;
5065
+ NodeShape._propertiesToStrings = _propertiesToStrings;
5437
5066
  function $toString(_nodeShape) {
5438
- return `NodeShape(${JSON.stringify(propertiesToStrings((_nodeShape ?? this)))})`;
5067
+ return `NodeShape(${JSON.stringify(_propertiesToStrings((_nodeShape ?? this)))})`;
5439
5068
  }
5440
5069
  NodeShape.$toString = $toString;
5441
5070
  })(NodeShape || (NodeShape = {}));
@@ -5760,12 +5389,12 @@ export var Shape;
5760
5389
  },
5761
5390
  },
5762
5391
  };
5763
- Shape.toRdfResource = (value, options) => {
5764
- if (NodeShape.isNodeShape(value)) {
5765
- return NodeShape.toRdfResource(value, options);
5392
+ Shape.toRdfResource = (object, options) => {
5393
+ if (NodeShape.isNodeShape(object)) {
5394
+ return NodeShape.toRdfResource(object, options);
5766
5395
  }
5767
- if (PropertyShape.isPropertyShape(value)) {
5768
- return PropertyShape.toRdfResource(value, options);
5396
+ if (PropertyShape.isPropertyShape(object)) {
5397
+ return PropertyShape.toRdfResource(object, options);
5769
5398
  }
5770
5399
  throw new Error("unrecognized type");
5771
5400
  };
@@ -5930,18 +5559,18 @@ export var $Object;
5930
5559
  },
5931
5560
  },
5932
5561
  };
5933
- $Object.toRdfResource = (value, options) => {
5934
- if (NodeShape.isNodeShape(value)) {
5935
- return NodeShape.toRdfResource(value, options);
5562
+ $Object.toRdfResource = (object, options) => {
5563
+ if (NodeShape.isNodeShape(object)) {
5564
+ return NodeShape.toRdfResource(object, options);
5936
5565
  }
5937
- if (Ontology.isOntology(value)) {
5938
- return Ontology.toRdfResource(value, options);
5566
+ if (Ontology.isOntology(object)) {
5567
+ return Ontology.toRdfResource(object, options);
5939
5568
  }
5940
- if (PropertyGroup.isPropertyGroup(value)) {
5941
- return PropertyGroup.toRdfResource(value, options);
5569
+ if (PropertyGroup.isPropertyGroup(object)) {
5570
+ return PropertyGroup.toRdfResource(object, options);
5942
5571
  }
5943
- if (PropertyShape.isPropertyShape(value)) {
5944
- return PropertyShape.toRdfResource(value, options);
5572
+ if (PropertyShape.isPropertyShape(object)) {
5573
+ return PropertyShape.toRdfResource(object, options);
5945
5574
  }
5946
5575
  throw new Error("unrecognized type");
5947
5576
  };