@shaclmate/shacl-ast 4.0.31 → 4.0.33

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 (2) hide show
  1. package/dist/generated.js +1099 -1294
  2. package/package.json +4 -4
package/dist/generated.js CHANGED
@@ -241,6 +241,17 @@ var $RdfVocabularies;
241
241
  xsd.unsignedShort = dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#unsignedShort");
242
242
  })(xsd = $RdfVocabularies.xsd || ($RdfVocabularies.xsd = {}));
243
243
  })($RdfVocabularies || ($RdfVocabularies = {}));
244
+ function $sequenceRecord(record) {
245
+ const result = {};
246
+ for (const key of globalThis.Object.keys(record)) {
247
+ const either = record[key];
248
+ if (either.isLeft()) {
249
+ return either;
250
+ }
251
+ result[key] = either.extract();
252
+ }
253
+ return Right(result);
254
+ }
244
255
  function $shaclPropertyFromRdf({ graph, propertySchema, resource, typeFromRdf, }) {
245
256
  return typeFromRdf(Right(resource.values(propertySchema.path, { graph, unique: true }))).chain((values) => values.head());
246
257
  }
@@ -833,7 +844,7 @@ export var PropertyShape;
833
844
  else {
834
845
  xone = parameters.xone;
835
846
  }
836
- return {
847
+ const $object = {
837
848
  $identifier,
838
849
  $type,
839
850
  and,
@@ -869,6 +880,10 @@ export var PropertyShape;
869
880
  uniqueLang,
870
881
  xone,
871
882
  };
883
+ if (!globalThis.Object.prototype.hasOwnProperty.call($object, "toString")) {
884
+ $object.toString = $toString;
885
+ }
886
+ return $object;
872
887
  }
873
888
  PropertyShape.create = create;
874
889
  let Identifier;
@@ -1031,671 +1046,546 @@ export var PropertyShape;
1031
1046
  }
1032
1047
  return Left(new Error(`${$resource.identifier} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#PropertyShape)`));
1033
1048
  })
1034
- : Right(true)).chain((_rdfTypeCheck) => Right(new Resource.Value({
1035
- dataFactory: dataFactory,
1036
- focusResource: $resource,
1037
- propertyPath: $RdfVocabularies.rdf.subject,
1038
- term: $resource.identifier,
1039
- }).toValues())
1040
- .chain((values) => values.chainMap((value) => value.toIdentifier()))
1041
- .chain((values) => values.head())
1042
- .chain(($identifier) => $shaclPropertyFromRdf({
1043
- graph: _$options.graph,
1044
- resource: $resource,
1045
- propertySchema: PropertyShape.schema.properties.and,
1046
- typeFromRdf: (resourceValues) => resourceValues
1047
- .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
1048
- .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
1049
- focusResource: $resource,
1050
- propertyPath: PropertyShape.schema.properties.and.path,
1051
- values: valueList.toArray(),
1052
- })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
1053
- .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
1054
- .map((values) => values.length > 0
1055
- ? values.map((value) => Maybe.of(value))
1056
- : Resource.Values.fromValue({
1057
- focusResource: $resource,
1058
- propertyPath: PropertyShape.schema.properties.and.path,
1059
- value: Maybe.empty(),
1060
- })),
1061
- }).chain((and) => $shaclPropertyFromRdf({
1062
- graph: _$options.graph,
1063
- resource: $resource,
1064
- propertySchema: PropertyShape.schema.properties.classes,
1065
- typeFromRdf: (resourceValues) => resourceValues
1066
- .chain((values) => values.chainMap((value) => value.toIri()))
1067
- .map((values) => values.toArray())
1068
- .map((valuesArray) => Resource.Values.fromValue({
1069
- focusResource: $resource,
1070
- propertyPath: PropertyShape.schema.properties.classes.path,
1071
- value: valuesArray,
1072
- })),
1073
- }).chain((classes) => $shaclPropertyFromRdf({
1074
- graph: _$options.graph,
1075
- resource: $resource,
1076
- propertySchema: PropertyShape.schema.properties.comment,
1077
- typeFromRdf: (resourceValues) => resourceValues
1078
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1079
- .chain((values) => values.chainMap((value) => value.toString()))
1080
- .map((values) => values.length > 0
1081
- ? values.map((value) => Maybe.of(value))
1082
- : Resource.Values.fromValue({
1083
- focusResource: $resource,
1084
- propertyPath: PropertyShape.schema.properties.comment.path,
1085
- value: Maybe.empty(),
1086
- })),
1087
- }).chain((comment) => $shaclPropertyFromRdf({
1088
- graph: _$options.graph,
1089
- resource: $resource,
1090
- propertySchema: PropertyShape.schema.properties.datatype,
1091
- typeFromRdf: (resourceValues) => resourceValues
1092
- .chain((values) => values.chainMap((value) => value.toIri()))
1093
- .map((values) => values.length > 0
1094
- ? values.map((value) => Maybe.of(value))
1095
- : Resource.Values.fromValue({
1096
- focusResource: $resource,
1097
- propertyPath: PropertyShape.schema.properties.datatype.path,
1098
- value: Maybe.empty(),
1099
- })),
1100
- }).chain((datatype) => $shaclPropertyFromRdf({
1101
- graph: _$options.graph,
1102
- resource: $resource,
1103
- propertySchema: PropertyShape.schema.properties.deactivated,
1104
- typeFromRdf: (resourceValues) => resourceValues
1105
- .chain((values) => values.chainMap((value) => value.toBoolean()))
1106
- .map((values) => values.length > 0
1107
- ? values.map((value) => Maybe.of(value))
1108
- : Resource.Values.fromValue({
1109
- focusResource: $resource,
1110
- propertyPath: PropertyShape.schema.properties.deactivated
1111
- .path,
1112
- value: Maybe.empty(),
1113
- })),
1114
- }).chain((deactivated) => $shaclPropertyFromRdf({
1115
- graph: _$options.graph,
1116
- resource: $resource,
1117
- propertySchema: PropertyShape.schema.properties.defaultValue,
1118
- typeFromRdf: (resourceValues) => resourceValues
1119
- .chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
1120
- switch (term.termType) {
1121
- case "NamedNode":
1122
- case "Literal":
1123
- return Either.of(term);
1124
- default:
1125
- return Left(new Resource.MistypedTermValueError({
1126
- actualValue: term,
1127
- expectedValueType: "(NamedNode | Literal)",
1128
- focusResource: $resource,
1129
- propertyPath: PropertyShape.schema.properties
1130
- .defaultValue.path,
1131
- }));
1132
- }
1133
- })))
1134
- .map((values) => values.length > 0
1135
- ? values.map((value) => Maybe.of(value))
1136
- : Resource.Values.fromValue({
1137
- focusResource: $resource,
1138
- propertyPath: PropertyShape.schema.properties.defaultValue
1139
- .path,
1140
- value: Maybe.empty(),
1141
- })),
1142
- }).chain((defaultValue) => $shaclPropertyFromRdf({
1143
- graph: _$options.graph,
1144
- resource: $resource,
1145
- propertySchema: PropertyShape.schema.properties.description,
1146
- typeFromRdf: (resourceValues) => resourceValues
1147
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1148
- .chain((values) => values.chainMap((value) => value.toString()))
1149
- .map((values) => values.length > 0
1150
- ? values.map((value) => Maybe.of(value))
1151
- : Resource.Values.fromValue({
1152
- focusResource: $resource,
1153
- propertyPath: PropertyShape.schema.properties
1154
- .description.path,
1155
- value: Maybe.empty(),
1156
- })),
1157
- }).chain((description) => $shaclPropertyFromRdf({
1158
- graph: _$options.graph,
1159
- resource: $resource,
1160
- propertySchema: PropertyShape.schema.properties.flags,
1161
- typeFromRdf: (resourceValues) => resourceValues
1162
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1163
- .chain((values) => values.chainMap((value) => value.toString()))
1164
- .map((values) => values.toArray())
1165
- .map((valuesArray) => Resource.Values.fromValue({
1049
+ : Right(true)).chain((_rdfTypeCheck) => $sequenceRecord({
1050
+ $identifier: Right(new Resource.Value({
1051
+ dataFactory: dataFactory,
1166
1052
  focusResource: $resource,
1167
- propertyPath: PropertyShape.schema.properties.flags.path,
1168
- value: valuesArray,
1169
- })),
1170
- }).chain((flags) => $shaclPropertyFromRdf({
1171
- graph: _$options.graph,
1172
- resource: $resource,
1173
- propertySchema: PropertyShape.schema.properties.groups,
1174
- typeFromRdf: (resourceValues) => resourceValues
1053
+ propertyPath: $RdfVocabularies.rdf.subject,
1054
+ term: $resource.identifier,
1055
+ }).toValues())
1175
1056
  .chain((values) => values.chainMap((value) => value.toIdentifier()))
1176
- .map((values) => values.toArray())
1177
- .map((valuesArray) => Resource.Values.fromValue({
1178
- focusResource: $resource,
1179
- propertyPath: PropertyShape.schema.properties.groups
1180
- .path,
1181
- value: valuesArray,
1182
- })),
1183
- }).chain((groups) => $shaclPropertyFromRdf({
1184
- graph: _$options.graph,
1185
- resource: $resource,
1186
- propertySchema: PropertyShape.schema.properties.hasValues,
1187
- typeFromRdf: (resourceValues) => resourceValues
1188
- .chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
1189
- switch (term.termType) {
1190
- case "NamedNode":
1191
- case "Literal":
1192
- return Either.of(term);
1193
- default:
1194
- return Left(new Resource.MistypedTermValueError({
1195
- actualValue: term,
1196
- expectedValueType: "(NamedNode | Literal)",
1197
- focusResource: $resource,
1198
- propertyPath: PropertyShape.schema
1199
- .properties.hasValues
1200
- .path,
1201
- }));
1202
- }
1203
- })))
1204
- .map((values) => values.toArray())
1205
- .map((valuesArray) => Resource.Values.fromValue({
1206
- focusResource: $resource,
1207
- propertyPath: PropertyShape.schema.properties
1208
- .hasValues.path,
1209
- value: valuesArray,
1210
- })),
1211
- }).chain((hasValues) => $shaclPropertyFromRdf({
1212
- graph: _$options.graph,
1213
- resource: $resource,
1214
- propertySchema: PropertyShape.schema.properties.in_,
1215
- typeFromRdf: (resourceValues) => resourceValues
1216
- .chain((values) => values.chainMap((value) => value.toList({
1057
+ .chain((values) => values.head()),
1058
+ and: $shaclPropertyFromRdf({
1217
1059
  graph: _$options.graph,
1218
- })))
1219
- .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
1220
- focusResource: $resource,
1221
- propertyPath: PropertyShape.schema.properties
1222
- .in_.path,
1223
- values: valueList.toArray(),
1224
- })).chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
1225
- switch (term.termType) {
1226
- case "NamedNode":
1227
- case "Literal":
1228
- return Either.of(term);
1229
- default:
1230
- return Left(new Resource.MistypedTermValueError({
1231
- actualValue: term,
1232
- expectedValueType: "(NamedNode | Literal)",
1233
- focusResource: $resource,
1234
- propertyPath: PropertyShape.schema
1235
- .properties.in_
1236
- .path,
1237
- }));
1238
- }
1239
- })))))
1240
- .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
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
1246
- .in_.path,
1247
- value: Maybe.empty(),
1248
- })),
1249
- }).chain((in_) => $shaclPropertyFromRdf({
1250
- graph: _$options.graph,
1251
- resource: $resource,
1252
- propertySchema: PropertyShape.schema.properties.isDefinedBy,
1253
- typeFromRdf: (resourceValues) => resourceValues
1254
- .chain((values) => values.chainMap((value) => value.toIdentifier()))
1255
- .map((values) => values.length > 0
1256
- ? values.map((value) => Maybe.of(value))
1257
- : Resource.Values.fromValue({
1258
- focusResource: $resource,
1259
- propertyPath: PropertyShape.schema.properties
1260
- .isDefinedBy.path,
1261
- value: Maybe.empty(),
1262
- })),
1263
- }).chain((isDefinedBy) => $shaclPropertyFromRdf({
1264
- graph: _$options.graph,
1265
- resource: $resource,
1266
- propertySchema: PropertyShape.schema.properties.label,
1267
- typeFromRdf: (resourceValues) => resourceValues
1268
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1269
- .chain((values) => values.chainMap((value) => value.toString()))
1270
- .map((values) => values.length > 0
1271
- ? values.map((value) => Maybe.of(value))
1272
- : Resource.Values.fromValue({
1060
+ resource: $resource,
1061
+ propertySchema: PropertyShape.schema.properties.and,
1062
+ typeFromRdf: (resourceValues) => resourceValues
1063
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
1064
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
1273
1065
  focusResource: $resource,
1274
- propertyPath: PropertyShape.schema
1275
- .properties.label.path,
1276
- value: Maybe.empty(),
1277
- })),
1278
- }).chain((label) => $shaclPropertyFromRdf({
1279
- graph: _$options.graph,
1280
- resource: $resource,
1281
- propertySchema: PropertyShape.schema.properties.languageIn,
1282
- typeFromRdf: (resourceValues) => resourceValues
1283
- .chain((values) => values.chainMap((value) => value.toList({
1066
+ propertyPath: PropertyShape.schema.properties.and.path,
1067
+ values: valueList.toArray(),
1068
+ })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
1069
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
1070
+ .map((values) => values.length > 0
1071
+ ? values.map((value) => Maybe.of(value))
1072
+ : Resource.Values.fromValue({
1073
+ focusResource: $resource,
1074
+ propertyPath: PropertyShape.schema.properties.and.path,
1075
+ value: Maybe.empty(),
1076
+ })),
1077
+ }),
1078
+ classes: $shaclPropertyFromRdf({
1284
1079
  graph: _$options.graph,
1285
- })))
1286
- .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
1287
- focusResource: $resource,
1288
- propertyPath: PropertyShape.schema
1289
- .properties.languageIn
1290
- .path,
1291
- values: valueList.toArray(),
1292
- }))
1293
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1294
- .chain((values) => values.chainMap((value) => value.toString()))))
1295
- .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
1296
- .map((values) => values.length > 0
1297
- ? values.map((value) => Maybe.of(value))
1298
- : Resource.Values.fromValue({
1299
- focusResource: $resource,
1300
- propertyPath: PropertyShape.schema
1301
- .properties.languageIn
1302
- .path,
1303
- value: Maybe.empty(),
1304
- })),
1305
- }).chain((languageIn) => $shaclPropertyFromRdf({
1306
- graph: _$options.graph,
1307
- resource: $resource,
1308
- propertySchema: PropertyShape.schema.properties.maxCount,
1309
- typeFromRdf: (resourceValues) => resourceValues
1310
- .chain((values) => values.chainMap((value) => value.toBigInt()))
1311
- .map((values) => values.length > 0
1312
- ? values.map((value) => Maybe.of(value))
1313
- : Resource.Values.fromValue({
1314
- focusResource: $resource,
1315
- propertyPath: PropertyShape.schema
1316
- .properties.maxCount
1317
- .path,
1318
- value: Maybe.empty(),
1319
- })),
1320
- }).chain((maxCount) => $shaclPropertyFromRdf({
1321
- graph: _$options.graph,
1322
- resource: $resource,
1323
- propertySchema: PropertyShape.schema.properties.maxExclusive,
1324
- typeFromRdf: (resourceValues) => resourceValues
1325
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1326
- .chain((values) => values.chainMap((value) => value.toLiteral()))
1327
- .map((values) => values.length > 0
1328
- ? values.map((value) => Maybe.of(value))
1329
- : Resource.Values.fromValue({
1330
- focusResource: $resource,
1331
- propertyPath: PropertyShape.schema
1332
- .properties
1333
- .maxExclusive.path,
1334
- value: Maybe.empty(),
1335
- })),
1336
- }).chain((maxExclusive) => $shaclPropertyFromRdf({
1337
- graph: _$options.graph,
1338
- resource: $resource,
1339
- propertySchema: PropertyShape.schema.properties.maxInclusive,
1340
- typeFromRdf: (resourceValues) => resourceValues
1341
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1342
- .chain((values) => values.chainMap((value) => value.toLiteral()))
1343
- .map((values) => values.length > 0
1344
- ? values.map((value) => Maybe.of(value))
1345
- : Resource.Values.fromValue({
1346
- focusResource: $resource,
1347
- propertyPath: PropertyShape.schema
1348
- .properties
1349
- .maxInclusive.path,
1350
- value: Maybe.empty(),
1351
- })),
1352
- }).chain((maxInclusive) => $shaclPropertyFromRdf({
1353
- graph: _$options.graph,
1354
- resource: $resource,
1355
- propertySchema: PropertyShape.schema.properties.maxLength,
1356
- typeFromRdf: (resourceValues) => resourceValues
1357
- .chain((values) => values.chainMap((value) => value.toBigInt()))
1358
- .map((values) => values.length > 0
1359
- ? values.map((value) => Maybe.of(value))
1360
- : Resource.Values.fromValue({
1361
- focusResource: $resource,
1362
- propertyPath: PropertyShape.schema
1363
- .properties
1364
- .maxLength.path,
1365
- value: Maybe.empty(),
1366
- })),
1367
- }).chain((maxLength) => $shaclPropertyFromRdf({
1368
- graph: _$options.graph,
1369
- resource: $resource,
1370
- propertySchema: PropertyShape.schema.properties.minCount,
1371
- typeFromRdf: (resourceValues) => resourceValues
1372
- .chain((values) => values.chainMap((value) => value.toBigInt()))
1373
- .map((values) => values.length > 0
1374
- ? values.map((value) => Maybe.of(value))
1375
- : Resource.Values.fromValue({
1376
- focusResource: $resource,
1377
- propertyPath: PropertyShape
1378
- .schema
1379
- .properties
1380
- .minCount.path,
1381
- value: Maybe.empty(),
1382
- })),
1383
- }).chain((minCount) => $shaclPropertyFromRdf({
1384
- graph: _$options.graph,
1385
- resource: $resource,
1386
- propertySchema: PropertyShape.schema.properties
1387
- .minExclusive,
1388
- typeFromRdf: (resourceValues) => resourceValues
1389
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1390
- .chain((values) => values.chainMap((value) => value.toLiteral()))
1391
- .map((values) => values.length > 0
1392
- ? values.map((value) => Maybe.of(value))
1393
- : Resource.Values.fromValue({
1080
+ resource: $resource,
1081
+ propertySchema: PropertyShape.schema.properties.classes,
1082
+ typeFromRdf: (resourceValues) => resourceValues
1083
+ .chain((values) => values.chainMap((value) => value.toIri()))
1084
+ .map((values) => values.toArray())
1085
+ .map((valuesArray) => Resource.Values.fromValue({
1394
1086
  focusResource: $resource,
1395
- propertyPath: PropertyShape
1396
- .schema
1397
- .properties
1398
- .minExclusive
1399
- .path,
1400
- value: Maybe.empty(),
1087
+ propertyPath: PropertyShape.schema.properties.classes.path,
1088
+ value: valuesArray,
1401
1089
  })),
1402
- }).chain((minExclusive) => $shaclPropertyFromRdf({
1403
- graph: _$options.graph,
1404
- resource: $resource,
1405
- propertySchema: PropertyShape.schema.properties
1406
- .minInclusive,
1407
- typeFromRdf: (resourceValues) => resourceValues
1408
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1409
- .chain((values) => values.chainMap((value) => value.toLiteral()))
1410
- .map((values) => values.length > 0
1411
- ? values.map((value) => Maybe.of(value))
1412
- : Resource.Values.fromValue({
1090
+ }),
1091
+ comment: $shaclPropertyFromRdf({
1092
+ graph: _$options.graph,
1093
+ resource: $resource,
1094
+ propertySchema: PropertyShape.schema.properties.comment,
1095
+ typeFromRdf: (resourceValues) => resourceValues
1096
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1097
+ .chain((values) => values.chainMap((value) => value.toString()))
1098
+ .map((values) => values.length > 0
1099
+ ? values.map((value) => Maybe.of(value))
1100
+ : Resource.Values.fromValue({
1101
+ focusResource: $resource,
1102
+ propertyPath: PropertyShape.schema.properties.comment.path,
1103
+ value: Maybe.empty(),
1104
+ })),
1105
+ }),
1106
+ datatype: $shaclPropertyFromRdf({
1107
+ graph: _$options.graph,
1108
+ resource: $resource,
1109
+ propertySchema: PropertyShape.schema.properties.datatype,
1110
+ typeFromRdf: (resourceValues) => resourceValues
1111
+ .chain((values) => values.chainMap((value) => value.toIri()))
1112
+ .map((values) => values.length > 0
1113
+ ? values.map((value) => Maybe.of(value))
1114
+ : Resource.Values.fromValue({
1115
+ focusResource: $resource,
1116
+ propertyPath: PropertyShape.schema.properties.datatype.path,
1117
+ value: Maybe.empty(),
1118
+ })),
1119
+ }),
1120
+ deactivated: $shaclPropertyFromRdf({
1121
+ graph: _$options.graph,
1122
+ resource: $resource,
1123
+ propertySchema: PropertyShape.schema.properties.deactivated,
1124
+ typeFromRdf: (resourceValues) => resourceValues
1125
+ .chain((values) => values.chainMap((value) => value.toBoolean()))
1126
+ .map((values) => values.length > 0
1127
+ ? values.map((value) => Maybe.of(value))
1128
+ : Resource.Values.fromValue({
1129
+ focusResource: $resource,
1130
+ propertyPath: PropertyShape.schema.properties.deactivated.path,
1131
+ value: Maybe.empty(),
1132
+ })),
1133
+ }),
1134
+ defaultValue: $shaclPropertyFromRdf({
1135
+ graph: _$options.graph,
1136
+ resource: $resource,
1137
+ propertySchema: PropertyShape.schema.properties.defaultValue,
1138
+ typeFromRdf: (resourceValues) => resourceValues
1139
+ .chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
1140
+ switch (term.termType) {
1141
+ case "NamedNode":
1142
+ case "Literal":
1143
+ return Either.of(term);
1144
+ default:
1145
+ return Left(new Resource.MistypedTermValueError({
1146
+ actualValue: term,
1147
+ expectedValueType: "(NamedNode | Literal)",
1148
+ focusResource: $resource,
1149
+ propertyPath: PropertyShape.schema.properties.defaultValue.path,
1150
+ }));
1151
+ }
1152
+ })))
1153
+ .map((values) => values.length > 0
1154
+ ? values.map((value) => Maybe.of(value))
1155
+ : Resource.Values.fromValue({
1156
+ focusResource: $resource,
1157
+ propertyPath: PropertyShape.schema.properties.defaultValue.path,
1158
+ value: Maybe.empty(),
1159
+ })),
1160
+ }),
1161
+ description: $shaclPropertyFromRdf({
1162
+ graph: _$options.graph,
1163
+ resource: $resource,
1164
+ propertySchema: PropertyShape.schema.properties.description,
1165
+ typeFromRdf: (resourceValues) => resourceValues
1166
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1167
+ .chain((values) => values.chainMap((value) => value.toString()))
1168
+ .map((values) => values.length > 0
1169
+ ? values.map((value) => Maybe.of(value))
1170
+ : Resource.Values.fromValue({
1171
+ focusResource: $resource,
1172
+ propertyPath: PropertyShape.schema.properties.description.path,
1173
+ value: Maybe.empty(),
1174
+ })),
1175
+ }),
1176
+ flags: $shaclPropertyFromRdf({
1177
+ graph: _$options.graph,
1178
+ resource: $resource,
1179
+ propertySchema: PropertyShape.schema.properties.flags,
1180
+ typeFromRdf: (resourceValues) => resourceValues
1181
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1182
+ .chain((values) => values.chainMap((value) => value.toString()))
1183
+ .map((values) => values.toArray())
1184
+ .map((valuesArray) => Resource.Values.fromValue({
1413
1185
  focusResource: $resource,
1414
- propertyPath: PropertyShape
1415
- .schema
1416
- .properties
1417
- .minInclusive
1418
- .path,
1419
- value: Maybe.empty(),
1186
+ propertyPath: PropertyShape.schema.properties.flags.path,
1187
+ value: valuesArray,
1420
1188
  })),
1421
- }).chain((minInclusive) => $shaclPropertyFromRdf({
1422
- graph: _$options.graph,
1423
- resource: $resource,
1424
- propertySchema: PropertyShape.schema.properties
1425
- .minLength,
1426
- typeFromRdf: (resourceValues) => resourceValues
1427
- .chain((values) => values.chainMap((value) => value.toBigInt()))
1428
- .map((values) => values.length > 0
1429
- ? values.map((value) => Maybe.of(value))
1430
- : Resource.Values.fromValue({
1189
+ }),
1190
+ groups: $shaclPropertyFromRdf({
1191
+ graph: _$options.graph,
1192
+ resource: $resource,
1193
+ propertySchema: PropertyShape.schema.properties.groups,
1194
+ typeFromRdf: (resourceValues) => resourceValues
1195
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
1196
+ .map((values) => values.toArray())
1197
+ .map((valuesArray) => Resource.Values.fromValue({
1431
1198
  focusResource: $resource,
1432
- propertyPath: PropertyShape
1433
- .schema
1434
- .properties
1435
- .minLength
1436
- .path,
1437
- value: Maybe.empty(),
1199
+ propertyPath: PropertyShape.schema.properties.groups.path,
1200
+ value: valuesArray,
1438
1201
  })),
1439
- }).chain((minLength) => $shaclPropertyFromRdf({
1440
- graph: _$options.graph,
1441
- resource: $resource,
1442
- propertySchema: PropertyShape.schema.properties
1443
- .name,
1444
- typeFromRdf: (resourceValues) => resourceValues
1445
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1446
- .chain((values) => values.chainMap((value) => value.toString()))
1447
- .map((values) => values.length > 0
1448
- ? values.map((value) => Maybe.of(value))
1449
- : Resource.Values.fromValue({
1202
+ }),
1203
+ hasValues: $shaclPropertyFromRdf({
1204
+ graph: _$options.graph,
1205
+ resource: $resource,
1206
+ propertySchema: PropertyShape.schema.properties.hasValues,
1207
+ typeFromRdf: (resourceValues) => resourceValues
1208
+ .chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
1209
+ switch (term.termType) {
1210
+ case "NamedNode":
1211
+ case "Literal":
1212
+ return Either.of(term);
1213
+ default:
1214
+ return Left(new Resource.MistypedTermValueError({
1215
+ actualValue: term,
1216
+ expectedValueType: "(NamedNode | Literal)",
1217
+ focusResource: $resource,
1218
+ propertyPath: PropertyShape.schema.properties.hasValues.path,
1219
+ }));
1220
+ }
1221
+ })))
1222
+ .map((values) => values.toArray())
1223
+ .map((valuesArray) => Resource.Values.fromValue({
1450
1224
  focusResource: $resource,
1451
- propertyPath: PropertyShape
1452
- .schema
1453
- .properties
1454
- .name
1455
- .path,
1456
- value: Maybe.empty(),
1225
+ propertyPath: PropertyShape.schema.properties.hasValues.path,
1226
+ value: valuesArray,
1457
1227
  })),
1458
- }).chain((name) => $shaclPropertyFromRdf({
1459
- graph: _$options.graph,
1460
- resource: $resource,
1461
- propertySchema: PropertyShape.schema.properties
1462
- .node,
1463
- typeFromRdf: (resourceValues) => resourceValues
1464
- .chain((values) => values.chainMap((value) => value.toIdentifier()))
1465
- .map((values) => values.length >
1466
- 0
1467
- ? values.map((value) => Maybe.of(value))
1468
- : Resource.Values.fromValue({
1228
+ }),
1229
+ in_: $shaclPropertyFromRdf({
1230
+ graph: _$options.graph,
1231
+ resource: $resource,
1232
+ propertySchema: PropertyShape.schema.properties.in_,
1233
+ typeFromRdf: (resourceValues) => resourceValues
1234
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
1235
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
1469
1236
  focusResource: $resource,
1470
- propertyPath: PropertyShape
1471
- .schema
1472
- .properties
1473
- .node
1474
- .path,
1475
- value: Maybe.empty(),
1476
- })),
1477
- }).chain((node) => $shaclPropertyFromRdf({
1478
- graph: _$options.graph,
1479
- resource: $resource,
1480
- propertySchema: PropertyShape.schema
1481
- .properties
1482
- .nodeKind,
1483
- typeFromRdf: (resourceValues) => resourceValues
1484
- .chain((values) => values.chainMap((value) => value.toIri([
1485
- dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNode"),
1486
- dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrIRI"),
1487
- dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrLiteral"),
1488
- dataFactory.namedNode("http://www.w3.org/ns/shacl#IRI"),
1489
- dataFactory.namedNode("http://www.w3.org/ns/shacl#IRIOrLiteral"),
1490
- dataFactory.namedNode("http://www.w3.org/ns/shacl#Literal"),
1491
- ])))
1492
- .map((values) => values.length >
1493
- 0
1494
- ? values.map((value) => Maybe.of(value))
1495
- : Resource.Values.fromValue({
1237
+ propertyPath: PropertyShape.schema.properties.in_.path,
1238
+ values: valueList.toArray(),
1239
+ })).chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
1240
+ switch (term.termType) {
1241
+ case "NamedNode":
1242
+ case "Literal":
1243
+ return Either.of(term);
1244
+ default:
1245
+ return Left(new Resource.MistypedTermValueError({
1246
+ actualValue: term,
1247
+ expectedValueType: "(NamedNode | Literal)",
1248
+ focusResource: $resource,
1249
+ propertyPath: PropertyShape.schema.properties.in_.path,
1250
+ }));
1251
+ }
1252
+ })))))
1253
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
1254
+ .map((values) => values.length > 0
1255
+ ? values.map((value) => Maybe.of(value))
1256
+ : Resource.Values.fromValue({
1257
+ focusResource: $resource,
1258
+ propertyPath: PropertyShape.schema.properties.in_.path,
1259
+ value: Maybe.empty(),
1260
+ })),
1261
+ }),
1262
+ isDefinedBy: $shaclPropertyFromRdf({
1263
+ graph: _$options.graph,
1264
+ resource: $resource,
1265
+ propertySchema: PropertyShape.schema.properties.isDefinedBy,
1266
+ typeFromRdf: (resourceValues) => resourceValues
1267
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
1268
+ .map((values) => values.length > 0
1269
+ ? values.map((value) => Maybe.of(value))
1270
+ : Resource.Values.fromValue({
1271
+ focusResource: $resource,
1272
+ propertyPath: PropertyShape.schema.properties.isDefinedBy.path,
1273
+ value: Maybe.empty(),
1274
+ })),
1275
+ }),
1276
+ label: $shaclPropertyFromRdf({
1277
+ graph: _$options.graph,
1278
+ resource: $resource,
1279
+ propertySchema: PropertyShape.schema.properties.label,
1280
+ typeFromRdf: (resourceValues) => resourceValues
1281
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1282
+ .chain((values) => values.chainMap((value) => value.toString()))
1283
+ .map((values) => values.length > 0
1284
+ ? values.map((value) => Maybe.of(value))
1285
+ : Resource.Values.fromValue({
1286
+ focusResource: $resource,
1287
+ propertyPath: PropertyShape.schema.properties.label.path,
1288
+ value: Maybe.empty(),
1289
+ })),
1290
+ }),
1291
+ languageIn: $shaclPropertyFromRdf({
1292
+ graph: _$options.graph,
1293
+ resource: $resource,
1294
+ propertySchema: PropertyShape.schema.properties.languageIn,
1295
+ typeFromRdf: (resourceValues) => resourceValues
1296
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
1297
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
1496
1298
  focusResource: $resource,
1497
- propertyPath: PropertyShape
1498
- .schema
1499
- .properties
1500
- .nodeKind
1501
- .path,
1502
- value: Maybe.empty(),
1503
- })),
1504
- }).chain((nodeKind) => $shaclPropertyFromRdf({
1505
- graph: _$options.graph,
1506
- resource: $resource,
1507
- propertySchema: PropertyShape.schema
1508
- .properties
1509
- .not,
1510
- typeFromRdf: (resourceValues) => resourceValues
1511
- .chain((values) => values.chainMap((value) => value.toIdentifier()))
1512
- .map((values) => values.toArray())
1513
- .map((valuesArray) => Resource.Values.fromValue({
1514
- focusResource: $resource,
1515
- propertyPath: PropertyShape
1516
- .schema
1517
- .properties
1518
- .not
1519
- .path,
1520
- value: valuesArray,
1521
- })),
1522
- }).chain((not) => $shaclPropertyFromRdf({
1523
- graph: _$options.graph,
1524
- resource: $resource,
1525
- propertySchema: PropertyShape.schema
1526
- .properties
1527
- .or,
1528
- typeFromRdf: (resourceValues) => resourceValues
1529
- .chain((values) => values.chainMap((value) => value.toList({
1299
+ propertyPath: PropertyShape.schema.properties.languageIn.path,
1300
+ values: valueList.toArray(),
1301
+ }))
1302
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1303
+ .chain((values) => values.chainMap((value) => value.toString()))))
1304
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
1305
+ .map((values) => values.length > 0
1306
+ ? values.map((value) => Maybe.of(value))
1307
+ : Resource.Values.fromValue({
1308
+ focusResource: $resource,
1309
+ propertyPath: PropertyShape.schema.properties.languageIn.path,
1310
+ value: Maybe.empty(),
1311
+ })),
1312
+ }),
1313
+ maxCount: $shaclPropertyFromRdf({
1530
1314
  graph: _$options.graph,
1531
- })))
1532
- .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
1533
- focusResource: $resource,
1534
- propertyPath: PropertyShape
1535
- .schema
1536
- .properties
1537
- .or
1538
- .path,
1539
- values: valueList.toArray(),
1540
- })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
1541
- .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
1542
- .map((values) => values.length >
1543
- 0
1544
- ? values.map((value) => Maybe.of(value))
1545
- : Resource.Values.fromValue({
1315
+ resource: $resource,
1316
+ propertySchema: PropertyShape.schema.properties.maxCount,
1317
+ typeFromRdf: (resourceValues) => resourceValues
1318
+ .chain((values) => values.chainMap((value) => value.toBigInt()))
1319
+ .map((values) => values.length > 0
1320
+ ? values.map((value) => Maybe.of(value))
1321
+ : Resource.Values.fromValue({
1322
+ focusResource: $resource,
1323
+ propertyPath: PropertyShape.schema.properties.maxCount.path,
1324
+ value: Maybe.empty(),
1325
+ })),
1326
+ }),
1327
+ maxExclusive: $shaclPropertyFromRdf({
1328
+ graph: _$options.graph,
1329
+ resource: $resource,
1330
+ propertySchema: PropertyShape.schema.properties.maxExclusive,
1331
+ typeFromRdf: (resourceValues) => resourceValues
1332
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1333
+ .chain((values) => values.chainMap((value) => value.toLiteral()))
1334
+ .map((values) => values.length > 0
1335
+ ? values.map((value) => Maybe.of(value))
1336
+ : Resource.Values.fromValue({
1337
+ focusResource: $resource,
1338
+ propertyPath: PropertyShape.schema.properties.maxExclusive.path,
1339
+ value: Maybe.empty(),
1340
+ })),
1341
+ }),
1342
+ maxInclusive: $shaclPropertyFromRdf({
1343
+ graph: _$options.graph,
1344
+ resource: $resource,
1345
+ propertySchema: PropertyShape.schema.properties.maxInclusive,
1346
+ typeFromRdf: (resourceValues) => resourceValues
1347
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1348
+ .chain((values) => values.chainMap((value) => value.toLiteral()))
1349
+ .map((values) => values.length > 0
1350
+ ? values.map((value) => Maybe.of(value))
1351
+ : Resource.Values.fromValue({
1352
+ focusResource: $resource,
1353
+ propertyPath: PropertyShape.schema.properties.maxInclusive.path,
1354
+ value: Maybe.empty(),
1355
+ })),
1356
+ }),
1357
+ maxLength: $shaclPropertyFromRdf({
1358
+ graph: _$options.graph,
1359
+ resource: $resource,
1360
+ propertySchema: PropertyShape.schema.properties.maxLength,
1361
+ typeFromRdf: (resourceValues) => resourceValues
1362
+ .chain((values) => values.chainMap((value) => value.toBigInt()))
1363
+ .map((values) => values.length > 0
1364
+ ? values.map((value) => Maybe.of(value))
1365
+ : Resource.Values.fromValue({
1366
+ focusResource: $resource,
1367
+ propertyPath: PropertyShape.schema.properties.maxLength.path,
1368
+ value: Maybe.empty(),
1369
+ })),
1370
+ }),
1371
+ minCount: $shaclPropertyFromRdf({
1372
+ graph: _$options.graph,
1373
+ resource: $resource,
1374
+ propertySchema: PropertyShape.schema.properties.minCount,
1375
+ typeFromRdf: (resourceValues) => resourceValues
1376
+ .chain((values) => values.chainMap((value) => value.toBigInt()))
1377
+ .map((values) => values.length > 0
1378
+ ? values.map((value) => Maybe.of(value))
1379
+ : Resource.Values.fromValue({
1380
+ focusResource: $resource,
1381
+ propertyPath: PropertyShape.schema.properties.minCount.path,
1382
+ value: Maybe.empty(),
1383
+ })),
1384
+ }),
1385
+ minExclusive: $shaclPropertyFromRdf({
1386
+ graph: _$options.graph,
1387
+ resource: $resource,
1388
+ propertySchema: PropertyShape.schema.properties.minExclusive,
1389
+ typeFromRdf: (resourceValues) => resourceValues
1390
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1391
+ .chain((values) => values.chainMap((value) => value.toLiteral()))
1392
+ .map((values) => values.length > 0
1393
+ ? values.map((value) => Maybe.of(value))
1394
+ : Resource.Values.fromValue({
1395
+ focusResource: $resource,
1396
+ propertyPath: PropertyShape.schema.properties.minExclusive.path,
1397
+ value: Maybe.empty(),
1398
+ })),
1399
+ }),
1400
+ minInclusive: $shaclPropertyFromRdf({
1401
+ graph: _$options.graph,
1402
+ resource: $resource,
1403
+ propertySchema: PropertyShape.schema.properties.minInclusive,
1404
+ typeFromRdf: (resourceValues) => resourceValues
1405
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1406
+ .chain((values) => values.chainMap((value) => value.toLiteral()))
1407
+ .map((values) => values.length > 0
1408
+ ? values.map((value) => Maybe.of(value))
1409
+ : Resource.Values.fromValue({
1410
+ focusResource: $resource,
1411
+ propertyPath: PropertyShape.schema.properties.minInclusive.path,
1412
+ value: Maybe.empty(),
1413
+ })),
1414
+ }),
1415
+ minLength: $shaclPropertyFromRdf({
1416
+ graph: _$options.graph,
1417
+ resource: $resource,
1418
+ propertySchema: PropertyShape.schema.properties.minLength,
1419
+ typeFromRdf: (resourceValues) => resourceValues
1420
+ .chain((values) => values.chainMap((value) => value.toBigInt()))
1421
+ .map((values) => values.length > 0
1422
+ ? values.map((value) => Maybe.of(value))
1423
+ : Resource.Values.fromValue({
1424
+ focusResource: $resource,
1425
+ propertyPath: PropertyShape.schema.properties.minLength.path,
1426
+ value: Maybe.empty(),
1427
+ })),
1428
+ }),
1429
+ name: $shaclPropertyFromRdf({
1430
+ graph: _$options.graph,
1431
+ resource: $resource,
1432
+ propertySchema: PropertyShape.schema.properties.name,
1433
+ typeFromRdf: (resourceValues) => resourceValues
1434
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1435
+ .chain((values) => values.chainMap((value) => value.toString()))
1436
+ .map((values) => values.length > 0
1437
+ ? values.map((value) => Maybe.of(value))
1438
+ : Resource.Values.fromValue({
1439
+ focusResource: $resource,
1440
+ propertyPath: PropertyShape.schema.properties.name.path,
1441
+ value: Maybe.empty(),
1442
+ })),
1443
+ }),
1444
+ node: $shaclPropertyFromRdf({
1445
+ graph: _$options.graph,
1446
+ resource: $resource,
1447
+ propertySchema: PropertyShape.schema.properties.node,
1448
+ typeFromRdf: (resourceValues) => resourceValues
1449
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
1450
+ .map((values) => values.length > 0
1451
+ ? values.map((value) => Maybe.of(value))
1452
+ : Resource.Values.fromValue({
1453
+ focusResource: $resource,
1454
+ propertyPath: PropertyShape.schema.properties.node.path,
1455
+ value: Maybe.empty(),
1456
+ })),
1457
+ }),
1458
+ nodeKind: $shaclPropertyFromRdf({
1459
+ graph: _$options.graph,
1460
+ resource: $resource,
1461
+ propertySchema: PropertyShape.schema.properties.nodeKind,
1462
+ typeFromRdf: (resourceValues) => resourceValues
1463
+ .chain((values) => values.chainMap((value) => value.toIri([
1464
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNode"),
1465
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrIRI"),
1466
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrLiteral"),
1467
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#IRI"),
1468
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#IRIOrLiteral"),
1469
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Literal"),
1470
+ ])))
1471
+ .map((values) => values.length > 0
1472
+ ? values.map((value) => Maybe.of(value))
1473
+ : Resource.Values.fromValue({
1474
+ focusResource: $resource,
1475
+ propertyPath: PropertyShape.schema.properties.nodeKind.path,
1476
+ value: Maybe.empty(),
1477
+ })),
1478
+ }),
1479
+ not: $shaclPropertyFromRdf({
1480
+ graph: _$options.graph,
1481
+ resource: $resource,
1482
+ propertySchema: PropertyShape.schema.properties.not,
1483
+ typeFromRdf: (resourceValues) => resourceValues
1484
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
1485
+ .map((values) => values.toArray())
1486
+ .map((valuesArray) => Resource.Values.fromValue({
1546
1487
  focusResource: $resource,
1547
- propertyPath: PropertyShape
1548
- .schema
1549
- .properties
1550
- .or
1551
- .path,
1552
- value: Maybe.empty(),
1488
+ propertyPath: PropertyShape.schema.properties.not.path,
1489
+ value: valuesArray,
1553
1490
  })),
1554
- }).chain((or) => $shaclPropertyFromRdf({
1555
- graph: _$options.graph,
1556
- resource: $resource,
1557
- propertySchema: PropertyShape.schema
1558
- .properties
1559
- .order,
1560
- typeFromRdf: (resourceValues) => resourceValues
1561
- .chain((values) => values.chainMap((value) => value.toFloat()))
1562
- .map((values) => values.length >
1563
- 0
1564
- ? values.map((value) => Maybe.of(value))
1565
- : Resource.Values.fromValue({
1491
+ }),
1492
+ or: $shaclPropertyFromRdf({
1493
+ graph: _$options.graph,
1494
+ resource: $resource,
1495
+ propertySchema: PropertyShape.schema.properties.or,
1496
+ typeFromRdf: (resourceValues) => resourceValues
1497
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
1498
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
1566
1499
  focusResource: $resource,
1567
- propertyPath: PropertyShape
1568
- .schema
1569
- .properties
1570
- .order
1571
- .path,
1572
- value: Maybe.empty(),
1573
- })),
1574
- }).chain((order) => $shaclPropertyFromRdf({
1575
- graph: _$options.graph,
1576
- resource: $resource,
1577
- propertySchema: PropertyShape.schema
1578
- .properties
1579
- .path,
1580
- typeFromRdf: (resourceValues) => $PropertyPath.fromRdfResourceValues(resourceValues, {
1581
- context: _$options.context,
1500
+ propertyPath: PropertyShape.schema.properties.or.path,
1501
+ values: valueList.toArray(),
1502
+ })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
1503
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
1504
+ .map((values) => values.length > 0
1505
+ ? values.map((value) => Maybe.of(value))
1506
+ : Resource.Values.fromValue({
1507
+ focusResource: $resource,
1508
+ propertyPath: PropertyShape.schema.properties.or.path,
1509
+ value: Maybe.empty(),
1510
+ })),
1511
+ }),
1512
+ order: $shaclPropertyFromRdf({
1582
1513
  graph: _$options.graph,
1583
- preferredLanguages: _$options.preferredLanguages,
1584
- objectSet: _$options.objectSet,
1585
1514
  resource: $resource,
1586
- ignoreRdfType: true,
1587
- propertyPath: PropertyShape
1588
- .schema
1589
- .properties
1590
- .path
1591
- .path,
1515
+ propertySchema: PropertyShape.schema.properties.order,
1516
+ typeFromRdf: (resourceValues) => resourceValues
1517
+ .chain((values) => values.chainMap((value) => value.toFloat()))
1518
+ .map((values) => values.length > 0
1519
+ ? values.map((value) => Maybe.of(value))
1520
+ : Resource.Values.fromValue({
1521
+ focusResource: $resource,
1522
+ propertyPath: PropertyShape.schema.properties.order.path,
1523
+ value: Maybe.empty(),
1524
+ })),
1592
1525
  }),
1593
- }).chain((path) => $shaclPropertyFromRdf({
1594
- graph: _$options.graph,
1595
- resource: $resource,
1596
- propertySchema: PropertyShape.schema
1597
- .properties
1598
- .patterns,
1599
- typeFromRdf: (resourceValues) => resourceValues
1600
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1601
- .chain((values) => values.chainMap((value) => value.toString()))
1602
- .map((values) => values.toArray())
1603
- .map((valuesArray) => Resource.Values.fromValue({
1604
- focusResource: $resource,
1605
- propertyPath: PropertyShape
1606
- .schema
1607
- .properties
1608
- .patterns
1609
- .path,
1610
- value: valuesArray,
1611
- })),
1612
- }).chain((patterns) => $shaclPropertyFromRdf({
1613
- graph: _$options.graph,
1614
- resource: $resource,
1615
- propertySchema: PropertyShape.schema
1616
- .properties
1617
- .uniqueLang,
1618
- typeFromRdf: (resourceValues) => resourceValues
1619
- .chain((values) => values.chainMap((value) => value.toBoolean()))
1620
- .map((values) => values.length >
1621
- 0
1622
- ? values.map((value) => Maybe.of(value))
1623
- : Resource.Values.fromValue({
1526
+ path: $shaclPropertyFromRdf({
1527
+ graph: _$options.graph,
1528
+ resource: $resource,
1529
+ propertySchema: PropertyShape.schema.properties.path,
1530
+ typeFromRdf: (resourceValues) => $PropertyPath.fromRdfResourceValues(resourceValues, {
1531
+ context: _$options.context,
1532
+ graph: _$options.graph,
1533
+ objectSet: _$options.objectSet,
1534
+ preferredLanguages: _$options.preferredLanguages,
1535
+ resource: $resource,
1536
+ ignoreRdfType: true,
1537
+ propertyPath: PropertyShape.schema.properties.path.path,
1538
+ }),
1539
+ }),
1540
+ patterns: $shaclPropertyFromRdf({
1541
+ graph: _$options.graph,
1542
+ resource: $resource,
1543
+ propertySchema: PropertyShape.schema.properties.patterns,
1544
+ typeFromRdf: (resourceValues) => resourceValues
1545
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1546
+ .chain((values) => values.chainMap((value) => value.toString()))
1547
+ .map((values) => values.toArray())
1548
+ .map((valuesArray) => Resource.Values.fromValue({
1624
1549
  focusResource: $resource,
1625
- propertyPath: PropertyShape
1626
- .schema
1627
- .properties
1628
- .uniqueLang
1629
- .path,
1630
- value: Maybe.empty(),
1550
+ propertyPath: PropertyShape.schema.properties.patterns.path,
1551
+ value: valuesArray,
1631
1552
  })),
1632
- }).chain((uniqueLang) => $shaclPropertyFromRdf({
1633
- graph: _$options.graph,
1634
- resource: $resource,
1635
- propertySchema: PropertyShape.schema
1636
- .properties
1637
- .xone,
1638
- typeFromRdf: (resourceValues) => resourceValues
1639
- .chain((values) => values.chainMap((value) => value.toList({
1553
+ }),
1554
+ uniqueLang: $shaclPropertyFromRdf({
1640
1555
  graph: _$options.graph,
1641
- })))
1642
- .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
1643
- focusResource: $resource,
1644
- propertyPath: PropertyShape
1645
- .schema
1646
- .properties
1647
- .xone
1648
- .path,
1649
- values: valueList.toArray(),
1650
- })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
1651
- .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
1652
- .map((values) => values.length >
1653
- 0
1654
- ? values.map((value) => Maybe.of(value))
1655
- : Resource.Values.fromValue({
1556
+ resource: $resource,
1557
+ propertySchema: PropertyShape.schema.properties.uniqueLang,
1558
+ typeFromRdf: (resourceValues) => resourceValues
1559
+ .chain((values) => values.chainMap((value) => value.toBoolean()))
1560
+ .map((values) => values.length > 0
1561
+ ? values.map((value) => Maybe.of(value))
1562
+ : Resource.Values.fromValue({
1563
+ focusResource: $resource,
1564
+ propertyPath: PropertyShape.schema.properties.uniqueLang.path,
1565
+ value: Maybe.empty(),
1566
+ })),
1567
+ }),
1568
+ xone: $shaclPropertyFromRdf({
1569
+ graph: _$options.graph,
1570
+ resource: $resource,
1571
+ propertySchema: PropertyShape.schema.properties.xone,
1572
+ typeFromRdf: (resourceValues) => resourceValues
1573
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
1574
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
1656
1575
  focusResource: $resource,
1657
- propertyPath: PropertyShape
1658
- .schema
1659
- .properties
1660
- .xone
1661
- .path,
1662
- value: Maybe.empty(),
1663
- })),
1664
- }).map((xone) => create({
1665
- $identifier,
1666
- and,
1667
- classes,
1668
- comment,
1669
- datatype,
1670
- deactivated,
1671
- defaultValue,
1672
- description,
1673
- flags,
1674
- groups,
1675
- hasValues,
1676
- in_,
1677
- isDefinedBy,
1678
- label,
1679
- languageIn,
1680
- maxCount,
1681
- maxExclusive,
1682
- maxInclusive,
1683
- maxLength,
1684
- minCount,
1685
- minExclusive,
1686
- minInclusive,
1687
- minLength,
1688
- name,
1689
- node,
1690
- nodeKind,
1691
- not,
1692
- or,
1693
- order,
1694
- path,
1695
- patterns,
1696
- uniqueLang,
1697
- xone,
1698
- })))))))))))))))))))))))))))))))))));
1576
+ propertyPath: PropertyShape.schema.properties.xone.path,
1577
+ values: valueList.toArray(),
1578
+ })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
1579
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
1580
+ .map((values) => values.length > 0
1581
+ ? values.map((value) => Maybe.of(value))
1582
+ : Resource.Values.fromValue({
1583
+ focusResource: $resource,
1584
+ propertyPath: PropertyShape.schema.properties.xone.path,
1585
+ value: Maybe.empty(),
1586
+ })),
1587
+ }),
1588
+ }).map((properties) => create(properties)));
1699
1589
  };
1700
1590
  PropertyShape.fromRdfResource = $wrap_FromRdfResourceFunction(PropertyShape._fromRdfResource);
1701
1591
  PropertyShape.fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
@@ -2253,7 +2143,11 @@ export var PropertyGroup;
2253
2143
  else {
2254
2144
  label = parameters?.label;
2255
2145
  }
2256
- return { $identifier, $type, comment, label };
2146
+ const $object = { $identifier, $type, comment, label };
2147
+ if (!globalThis.Object.prototype.hasOwnProperty.call($object, "toString")) {
2148
+ $object.toString = $toString;
2149
+ }
2150
+ return $object;
2257
2151
  }
2258
2152
  PropertyGroup.create = create;
2259
2153
  let Identifier;
@@ -2296,43 +2190,46 @@ export var PropertyGroup;
2296
2190
  }
2297
2191
  return Left(new Error(`${$resource.identifier} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#PropertyGroup)`));
2298
2192
  })
2299
- : Right(true)).chain((_rdfTypeCheck) => Right(new Resource.Value({
2300
- dataFactory: dataFactory,
2301
- focusResource: $resource,
2302
- propertyPath: $RdfVocabularies.rdf.subject,
2303
- term: $resource.identifier,
2304
- }).toValues())
2305
- .chain((values) => values.chainMap((value) => value.toIdentifier()))
2306
- .chain((values) => values.head())
2307
- .chain(($identifier) => $shaclPropertyFromRdf({
2308
- graph: _$options.graph,
2309
- resource: $resource,
2310
- propertySchema: PropertyGroup.schema.properties.comment,
2311
- typeFromRdf: (resourceValues) => resourceValues
2312
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2313
- .chain((values) => values.chainMap((value) => value.toString()))
2314
- .map((values) => values.length > 0
2315
- ? values.map((value) => Maybe.of(value))
2316
- : Resource.Values.fromValue({
2317
- focusResource: $resource,
2318
- propertyPath: PropertyShape.schema.properties.comment.path,
2319
- value: Maybe.empty(),
2320
- })),
2321
- }).chain((comment) => $shaclPropertyFromRdf({
2322
- graph: _$options.graph,
2323
- resource: $resource,
2324
- propertySchema: PropertyGroup.schema.properties.label,
2325
- typeFromRdf: (resourceValues) => resourceValues
2326
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2327
- .chain((values) => values.chainMap((value) => value.toString()))
2328
- .map((values) => values.length > 0
2329
- ? values.map((value) => Maybe.of(value))
2330
- : Resource.Values.fromValue({
2331
- focusResource: $resource,
2332
- propertyPath: PropertyShape.schema.properties.label.path,
2333
- value: Maybe.empty(),
2334
- })),
2335
- }).map((label) => create({ $identifier, comment, label })))));
2193
+ : Right(true)).chain((_rdfTypeCheck) => $sequenceRecord({
2194
+ $identifier: Right(new Resource.Value({
2195
+ dataFactory: dataFactory,
2196
+ focusResource: $resource,
2197
+ propertyPath: $RdfVocabularies.rdf.subject,
2198
+ term: $resource.identifier,
2199
+ }).toValues())
2200
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
2201
+ .chain((values) => values.head()),
2202
+ comment: $shaclPropertyFromRdf({
2203
+ graph: _$options.graph,
2204
+ resource: $resource,
2205
+ propertySchema: PropertyGroup.schema.properties.comment,
2206
+ typeFromRdf: (resourceValues) => resourceValues
2207
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2208
+ .chain((values) => values.chainMap((value) => value.toString()))
2209
+ .map((values) => values.length > 0
2210
+ ? values.map((value) => Maybe.of(value))
2211
+ : Resource.Values.fromValue({
2212
+ focusResource: $resource,
2213
+ propertyPath: PropertyShape.schema.properties.comment.path,
2214
+ value: Maybe.empty(),
2215
+ })),
2216
+ }),
2217
+ label: $shaclPropertyFromRdf({
2218
+ graph: _$options.graph,
2219
+ resource: $resource,
2220
+ propertySchema: PropertyGroup.schema.properties.label,
2221
+ typeFromRdf: (resourceValues) => resourceValues
2222
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2223
+ .chain((values) => values.chainMap((value) => value.toString()))
2224
+ .map((values) => values.length > 0
2225
+ ? values.map((value) => Maybe.of(value))
2226
+ : Resource.Values.fromValue({
2227
+ focusResource: $resource,
2228
+ propertyPath: PropertyShape.schema.properties.label.path,
2229
+ value: Maybe.empty(),
2230
+ })),
2231
+ }),
2232
+ }).map((properties) => create(properties)));
2336
2233
  };
2337
2234
  PropertyGroup.fromRdfResource = $wrap_FromRdfResourceFunction(PropertyGroup._fromRdfResource);
2338
2235
  PropertyGroup.fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
@@ -2452,7 +2349,11 @@ export var Ontology;
2452
2349
  else {
2453
2350
  label = parameters?.label;
2454
2351
  }
2455
- return { $identifier, $type, comment, label };
2352
+ const $object = { $identifier, $type, comment, label };
2353
+ if (!globalThis.Object.prototype.hasOwnProperty.call($object, "toString")) {
2354
+ $object.toString = $toString;
2355
+ }
2356
+ return $object;
2456
2357
  }
2457
2358
  Ontology.create = create;
2458
2359
  let Identifier;
@@ -2495,43 +2396,46 @@ export var Ontology;
2495
2396
  }
2496
2397
  return Left(new Error(`${$resource.identifier} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/2002/07/owl#Ontology)`));
2497
2398
  })
2498
- : Right(true)).chain((_rdfTypeCheck) => Right(new Resource.Value({
2499
- dataFactory: dataFactory,
2500
- focusResource: $resource,
2501
- propertyPath: $RdfVocabularies.rdf.subject,
2502
- term: $resource.identifier,
2503
- }).toValues())
2504
- .chain((values) => values.chainMap((value) => value.toIdentifier()))
2505
- .chain((values) => values.head())
2506
- .chain(($identifier) => $shaclPropertyFromRdf({
2507
- graph: _$options.graph,
2508
- resource: $resource,
2509
- propertySchema: Ontology.schema.properties.comment,
2510
- typeFromRdf: (resourceValues) => resourceValues
2511
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2512
- .chain((values) => values.chainMap((value) => value.toString()))
2513
- .map((values) => values.length > 0
2514
- ? values.map((value) => Maybe.of(value))
2515
- : Resource.Values.fromValue({
2516
- focusResource: $resource,
2517
- propertyPath: PropertyShape.schema.properties.comment.path,
2518
- value: Maybe.empty(),
2519
- })),
2520
- }).chain((comment) => $shaclPropertyFromRdf({
2521
- graph: _$options.graph,
2522
- resource: $resource,
2523
- propertySchema: Ontology.schema.properties.label,
2524
- typeFromRdf: (resourceValues) => resourceValues
2525
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2526
- .chain((values) => values.chainMap((value) => value.toString()))
2527
- .map((values) => values.length > 0
2528
- ? values.map((value) => Maybe.of(value))
2529
- : Resource.Values.fromValue({
2530
- focusResource: $resource,
2531
- propertyPath: PropertyShape.schema.properties.label.path,
2532
- value: Maybe.empty(),
2533
- })),
2534
- }).map((label) => create({ $identifier, comment, label })))));
2399
+ : Right(true)).chain((_rdfTypeCheck) => $sequenceRecord({
2400
+ $identifier: Right(new Resource.Value({
2401
+ dataFactory: dataFactory,
2402
+ focusResource: $resource,
2403
+ propertyPath: $RdfVocabularies.rdf.subject,
2404
+ term: $resource.identifier,
2405
+ }).toValues())
2406
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
2407
+ .chain((values) => values.head()),
2408
+ comment: $shaclPropertyFromRdf({
2409
+ graph: _$options.graph,
2410
+ resource: $resource,
2411
+ propertySchema: Ontology.schema.properties.comment,
2412
+ typeFromRdf: (resourceValues) => resourceValues
2413
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2414
+ .chain((values) => values.chainMap((value) => value.toString()))
2415
+ .map((values) => values.length > 0
2416
+ ? values.map((value) => Maybe.of(value))
2417
+ : Resource.Values.fromValue({
2418
+ focusResource: $resource,
2419
+ propertyPath: PropertyShape.schema.properties.comment.path,
2420
+ value: Maybe.empty(),
2421
+ })),
2422
+ }),
2423
+ label: $shaclPropertyFromRdf({
2424
+ graph: _$options.graph,
2425
+ resource: $resource,
2426
+ propertySchema: Ontology.schema.properties.label,
2427
+ typeFromRdf: (resourceValues) => resourceValues
2428
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2429
+ .chain((values) => values.chainMap((value) => value.toString()))
2430
+ .map((values) => values.length > 0
2431
+ ? values.map((value) => Maybe.of(value))
2432
+ : Resource.Values.fromValue({
2433
+ focusResource: $resource,
2434
+ propertyPath: PropertyShape.schema.properties.label.path,
2435
+ value: Maybe.empty(),
2436
+ })),
2437
+ }),
2438
+ }).map((properties) => create(properties)));
2535
2439
  };
2536
2440
  Ontology.fromRdfResource = $wrap_FromRdfResourceFunction(Ontology._fromRdfResource);
2537
2441
  Ontology.fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
@@ -3130,7 +3034,7 @@ export var NodeShape;
3130
3034
  else {
3131
3035
  xone = parameters?.xone;
3132
3036
  }
3133
- return {
3037
+ const $object = {
3134
3038
  $identifier,
3135
3039
  $type,
3136
3040
  and,
@@ -3164,6 +3068,10 @@ export var NodeShape;
3164
3068
  types,
3165
3069
  xone,
3166
3070
  };
3071
+ if (!globalThis.Object.prototype.hasOwnProperty.call($object, "toString")) {
3072
+ $object.toString = $toString;
3073
+ }
3074
+ return $object;
3167
3075
  }
3168
3076
  NodeShape.create = create;
3169
3077
  let Identifier;
@@ -3318,610 +3226,507 @@ export var NodeShape;
3318
3226
  }
3319
3227
  return Left(new Error(`${$resource.identifier} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#NodeShape)`));
3320
3228
  })
3321
- : Right(true)).chain((_rdfTypeCheck) => Right(new Resource.Value({
3322
- dataFactory: dataFactory,
3323
- focusResource: $resource,
3324
- propertyPath: $RdfVocabularies.rdf.subject,
3325
- term: $resource.identifier,
3326
- }).toValues())
3327
- .chain((values) => values.chainMap((value) => value.toIdentifier()))
3328
- .chain((values) => values.head())
3329
- .chain(($identifier) => $shaclPropertyFromRdf({
3330
- graph: _$options.graph,
3331
- resource: $resource,
3332
- propertySchema: NodeShape.schema.properties.and,
3333
- typeFromRdf: (resourceValues) => resourceValues
3334
- .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
3335
- .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
3336
- focusResource: $resource,
3337
- propertyPath: PropertyShape.schema.properties.and.path,
3338
- values: valueList.toArray(),
3339
- })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
3340
- .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
3341
- .map((values) => values.length > 0
3342
- ? values.map((value) => Maybe.of(value))
3343
- : Resource.Values.fromValue({
3344
- focusResource: $resource,
3345
- propertyPath: PropertyShape.schema.properties.and.path,
3346
- value: Maybe.empty(),
3347
- })),
3348
- }).chain((and) => $shaclPropertyFromRdf({
3349
- graph: _$options.graph,
3350
- resource: $resource,
3351
- propertySchema: NodeShape.schema.properties.classes,
3352
- typeFromRdf: (resourceValues) => resourceValues
3353
- .chain((values) => values.chainMap((value) => value.toIri()))
3354
- .map((values) => values.toArray())
3355
- .map((valuesArray) => Resource.Values.fromValue({
3356
- focusResource: $resource,
3357
- propertyPath: PropertyShape.schema.properties.classes.path,
3358
- value: valuesArray,
3359
- })),
3360
- }).chain((classes) => $shaclPropertyFromRdf({
3361
- graph: _$options.graph,
3362
- resource: $resource,
3363
- propertySchema: NodeShape.schema.properties.closed,
3364
- typeFromRdf: (resourceValues) => resourceValues
3365
- .chain((values) => values.chainMap((value) => value.toBoolean()))
3366
- .map((values) => values.length > 0
3367
- ? values.map((value) => Maybe.of(value))
3368
- : Resource.Values.fromValue({
3369
- focusResource: $resource,
3370
- propertyPath: NodeShape.schema.properties.closed.path,
3371
- value: Maybe.empty(),
3372
- })),
3373
- }).chain((closed) => $shaclPropertyFromRdf({
3374
- graph: _$options.graph,
3375
- resource: $resource,
3376
- propertySchema: NodeShape.schema.properties.comment,
3377
- typeFromRdf: (resourceValues) => resourceValues
3378
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
3379
- .chain((values) => values.chainMap((value) => value.toString()))
3380
- .map((values) => values.length > 0
3381
- ? values.map((value) => Maybe.of(value))
3382
- : Resource.Values.fromValue({
3383
- focusResource: $resource,
3384
- propertyPath: PropertyShape.schema.properties.comment.path,
3385
- value: Maybe.empty(),
3386
- })),
3387
- }).chain((comment) => $shaclPropertyFromRdf({
3388
- graph: _$options.graph,
3389
- resource: $resource,
3390
- propertySchema: NodeShape.schema.properties.datatype,
3391
- typeFromRdf: (resourceValues) => resourceValues
3392
- .chain((values) => values.chainMap((value) => value.toIri()))
3393
- .map((values) => values.length > 0
3394
- ? values.map((value) => Maybe.of(value))
3395
- : Resource.Values.fromValue({
3396
- focusResource: $resource,
3397
- propertyPath: PropertyShape.schema.properties.datatype.path,
3398
- value: Maybe.empty(),
3399
- })),
3400
- }).chain((datatype) => $shaclPropertyFromRdf({
3401
- graph: _$options.graph,
3402
- resource: $resource,
3403
- propertySchema: NodeShape.schema.properties.deactivated,
3404
- typeFromRdf: (resourceValues) => resourceValues
3405
- .chain((values) => values.chainMap((value) => value.toBoolean()))
3406
- .map((values) => values.length > 0
3407
- ? values.map((value) => Maybe.of(value))
3408
- : Resource.Values.fromValue({
3409
- focusResource: $resource,
3410
- propertyPath: PropertyShape.schema.properties.deactivated
3411
- .path,
3412
- value: Maybe.empty(),
3413
- })),
3414
- }).chain((deactivated) => $shaclPropertyFromRdf({
3415
- graph: _$options.graph,
3416
- resource: $resource,
3417
- propertySchema: NodeShape.schema.properties.flags,
3418
- typeFromRdf: (resourceValues) => resourceValues
3419
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
3420
- .chain((values) => values.chainMap((value) => value.toString()))
3421
- .map((values) => values.toArray())
3422
- .map((valuesArray) => Resource.Values.fromValue({
3423
- focusResource: $resource,
3424
- propertyPath: PropertyShape.schema.properties.flags.path,
3425
- value: valuesArray,
3426
- })),
3427
- }).chain((flags) => $shaclPropertyFromRdf({
3428
- graph: _$options.graph,
3429
- resource: $resource,
3430
- propertySchema: NodeShape.schema.properties.hasValues,
3431
- typeFromRdf: (resourceValues) => resourceValues
3432
- .chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
3433
- switch (term.termType) {
3434
- case "NamedNode":
3435
- case "Literal":
3436
- return Either.of(term);
3437
- default:
3438
- return Left(new Resource.MistypedTermValueError({
3439
- actualValue: term,
3440
- expectedValueType: "(NamedNode | Literal)",
3441
- focusResource: $resource,
3442
- propertyPath: PropertyShape.schema.properties
3443
- .hasValues.path,
3444
- }));
3445
- }
3446
- })))
3447
- .map((values) => values.toArray())
3448
- .map((valuesArray) => Resource.Values.fromValue({
3449
- focusResource: $resource,
3450
- propertyPath: PropertyShape.schema.properties.hasValues
3451
- .path,
3452
- value: valuesArray,
3453
- })),
3454
- }).chain((hasValues) => $shaclPropertyFromRdf({
3455
- graph: _$options.graph,
3456
- resource: $resource,
3457
- propertySchema: NodeShape.schema.properties.ignoredProperties,
3458
- typeFromRdf: (resourceValues) => resourceValues
3459
- .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
3460
- .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
3461
- focusResource: $resource,
3462
- propertyPath: NodeShape.schema.properties
3463
- .ignoredProperties.path,
3464
- values: valueList.toArray(),
3465
- })).chain((values) => values.chainMap((value) => value.toIri()))))
3466
- .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
3467
- .map((values) => values.length > 0
3468
- ? values.map((value) => Maybe.of(value))
3469
- : Resource.Values.fromValue({
3470
- focusResource: $resource,
3471
- propertyPath: NodeShape.schema.properties
3472
- .ignoredProperties.path,
3473
- value: Maybe.empty(),
3474
- })),
3475
- }).chain((ignoredProperties) => $shaclPropertyFromRdf({
3476
- graph: _$options.graph,
3477
- resource: $resource,
3478
- propertySchema: NodeShape.schema.properties.in_,
3479
- typeFromRdf: (resourceValues) => resourceValues
3480
- .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
3481
- .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
3229
+ : Right(true)).chain((_rdfTypeCheck) => $sequenceRecord({
3230
+ $identifier: Right(new Resource.Value({
3231
+ dataFactory: dataFactory,
3482
3232
  focusResource: $resource,
3483
- propertyPath: PropertyShape.schema.properties.in_
3484
- .path,
3485
- values: valueList.toArray(),
3486
- })).chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
3487
- switch (term.termType) {
3488
- case "NamedNode":
3489
- case "Literal":
3490
- return Either.of(term);
3491
- default:
3492
- return Left(new Resource.MistypedTermValueError({
3493
- actualValue: term,
3494
- expectedValueType: "(NamedNode | Literal)",
3495
- focusResource: $resource,
3496
- propertyPath: PropertyShape.schema
3497
- .properties.in_.path,
3498
- }));
3499
- }
3500
- })))))
3501
- .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
3502
- .map((values) => values.length > 0
3503
- ? values.map((value) => Maybe.of(value))
3504
- : Resource.Values.fromValue({
3505
- focusResource: $resource,
3506
- propertyPath: PropertyShape.schema.properties.in_
3507
- .path,
3508
- value: Maybe.empty(),
3509
- })),
3510
- }).chain((in_) => $shaclPropertyFromRdf({
3511
- graph: _$options.graph,
3512
- resource: $resource,
3513
- propertySchema: NodeShape.schema.properties.isDefinedBy,
3514
- typeFromRdf: (resourceValues) => resourceValues
3233
+ propertyPath: $RdfVocabularies.rdf.subject,
3234
+ term: $resource.identifier,
3235
+ }).toValues())
3515
3236
  .chain((values) => values.chainMap((value) => value.toIdentifier()))
3516
- .map((values) => values.length > 0
3517
- ? values.map((value) => Maybe.of(value))
3518
- : Resource.Values.fromValue({
3519
- focusResource: $resource,
3520
- propertyPath: PropertyShape.schema.properties
3521
- .isDefinedBy.path,
3522
- value: Maybe.empty(),
3523
- })),
3524
- }).chain((isDefinedBy) => $shaclPropertyFromRdf({
3525
- graph: _$options.graph,
3526
- resource: $resource,
3527
- propertySchema: NodeShape.schema.properties.label,
3528
- typeFromRdf: (resourceValues) => resourceValues
3529
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
3530
- .chain((values) => values.chainMap((value) => value.toString()))
3531
- .map((values) => values.length > 0
3532
- ? values.map((value) => Maybe.of(value))
3533
- : Resource.Values.fromValue({
3237
+ .chain((values) => values.head()),
3238
+ and: $shaclPropertyFromRdf({
3239
+ graph: _$options.graph,
3240
+ resource: $resource,
3241
+ propertySchema: NodeShape.schema.properties.and,
3242
+ typeFromRdf: (resourceValues) => resourceValues
3243
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
3244
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
3534
3245
  focusResource: $resource,
3535
- propertyPath: PropertyShape.schema.properties
3536
- .label.path,
3537
- value: Maybe.empty(),
3538
- })),
3539
- }).chain((label) => $shaclPropertyFromRdf({
3540
- graph: _$options.graph,
3541
- resource: $resource,
3542
- propertySchema: NodeShape.schema.properties.languageIn,
3543
- typeFromRdf: (resourceValues) => resourceValues
3544
- .chain((values) => values.chainMap((value) => value.toList({
3246
+ propertyPath: PropertyShape.schema.properties.and.path,
3247
+ values: valueList.toArray(),
3248
+ })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
3249
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
3250
+ .map((values) => values.length > 0
3251
+ ? values.map((value) => Maybe.of(value))
3252
+ : Resource.Values.fromValue({
3253
+ focusResource: $resource,
3254
+ propertyPath: PropertyShape.schema.properties.and.path,
3255
+ value: Maybe.empty(),
3256
+ })),
3257
+ }),
3258
+ classes: $shaclPropertyFromRdf({
3545
3259
  graph: _$options.graph,
3546
- })))
3547
- .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
3548
- focusResource: $resource,
3549
- propertyPath: PropertyShape.schema
3550
- .properties.languageIn.path,
3551
- values: valueList.toArray(),
3552
- }))
3553
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
3554
- .chain((values) => values.chainMap((value) => value.toString()))))
3555
- .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
3556
- .map((values) => values.length > 0
3557
- ? values.map((value) => Maybe.of(value))
3558
- : Resource.Values.fromValue({
3260
+ resource: $resource,
3261
+ propertySchema: NodeShape.schema.properties.classes,
3262
+ typeFromRdf: (resourceValues) => resourceValues
3263
+ .chain((values) => values.chainMap((value) => value.toIri()))
3264
+ .map((values) => values.toArray())
3265
+ .map((valuesArray) => Resource.Values.fromValue({
3559
3266
  focusResource: $resource,
3560
- propertyPath: PropertyShape.schema
3561
- .properties.languageIn.path,
3562
- value: Maybe.empty(),
3267
+ propertyPath: PropertyShape.schema.properties.classes.path,
3268
+ value: valuesArray,
3563
3269
  })),
3564
- }).chain((languageIn) => $shaclPropertyFromRdf({
3565
- graph: _$options.graph,
3566
- resource: $resource,
3567
- propertySchema: NodeShape.schema.properties.maxCount,
3568
- typeFromRdf: (resourceValues) => resourceValues
3569
- .chain((values) => values.chainMap((value) => value.toBigInt()))
3570
- .map((values) => values.length > 0
3571
- ? values.map((value) => Maybe.of(value))
3572
- : Resource.Values.fromValue({
3270
+ }),
3271
+ closed: $shaclPropertyFromRdf({
3272
+ graph: _$options.graph,
3273
+ resource: $resource,
3274
+ propertySchema: NodeShape.schema.properties.closed,
3275
+ typeFromRdf: (resourceValues) => resourceValues
3276
+ .chain((values) => values.chainMap((value) => value.toBoolean()))
3277
+ .map((values) => values.length > 0
3278
+ ? values.map((value) => Maybe.of(value))
3279
+ : Resource.Values.fromValue({
3280
+ focusResource: $resource,
3281
+ propertyPath: NodeShape.schema.properties.closed.path,
3282
+ value: Maybe.empty(),
3283
+ })),
3284
+ }),
3285
+ comment: $shaclPropertyFromRdf({
3286
+ graph: _$options.graph,
3287
+ resource: $resource,
3288
+ propertySchema: NodeShape.schema.properties.comment,
3289
+ typeFromRdf: (resourceValues) => resourceValues
3290
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
3291
+ .chain((values) => values.chainMap((value) => value.toString()))
3292
+ .map((values) => values.length > 0
3293
+ ? values.map((value) => Maybe.of(value))
3294
+ : Resource.Values.fromValue({
3295
+ focusResource: $resource,
3296
+ propertyPath: PropertyShape.schema.properties.comment.path,
3297
+ value: Maybe.empty(),
3298
+ })),
3299
+ }),
3300
+ datatype: $shaclPropertyFromRdf({
3301
+ graph: _$options.graph,
3302
+ resource: $resource,
3303
+ propertySchema: NodeShape.schema.properties.datatype,
3304
+ typeFromRdf: (resourceValues) => resourceValues
3305
+ .chain((values) => values.chainMap((value) => value.toIri()))
3306
+ .map((values) => values.length > 0
3307
+ ? values.map((value) => Maybe.of(value))
3308
+ : Resource.Values.fromValue({
3309
+ focusResource: $resource,
3310
+ propertyPath: PropertyShape.schema.properties.datatype.path,
3311
+ value: Maybe.empty(),
3312
+ })),
3313
+ }),
3314
+ deactivated: $shaclPropertyFromRdf({
3315
+ graph: _$options.graph,
3316
+ resource: $resource,
3317
+ propertySchema: NodeShape.schema.properties.deactivated,
3318
+ typeFromRdf: (resourceValues) => resourceValues
3319
+ .chain((values) => values.chainMap((value) => value.toBoolean()))
3320
+ .map((values) => values.length > 0
3321
+ ? values.map((value) => Maybe.of(value))
3322
+ : Resource.Values.fromValue({
3323
+ focusResource: $resource,
3324
+ propertyPath: PropertyShape.schema.properties.deactivated.path,
3325
+ value: Maybe.empty(),
3326
+ })),
3327
+ }),
3328
+ flags: $shaclPropertyFromRdf({
3329
+ graph: _$options.graph,
3330
+ resource: $resource,
3331
+ propertySchema: NodeShape.schema.properties.flags,
3332
+ typeFromRdf: (resourceValues) => resourceValues
3333
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
3334
+ .chain((values) => values.chainMap((value) => value.toString()))
3335
+ .map((values) => values.toArray())
3336
+ .map((valuesArray) => Resource.Values.fromValue({
3573
3337
  focusResource: $resource,
3574
- propertyPath: PropertyShape.schema
3575
- .properties.maxCount.path,
3576
- value: Maybe.empty(),
3338
+ propertyPath: PropertyShape.schema.properties.flags.path,
3339
+ value: valuesArray,
3577
3340
  })),
3578
- }).chain((maxCount) => $shaclPropertyFromRdf({
3579
- graph: _$options.graph,
3580
- resource: $resource,
3581
- propertySchema: NodeShape.schema.properties.maxExclusive,
3582
- typeFromRdf: (resourceValues) => resourceValues
3583
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
3584
- .chain((values) => values.chainMap((value) => value.toLiteral()))
3585
- .map((values) => values.length > 0
3586
- ? values.map((value) => Maybe.of(value))
3587
- : Resource.Values.fromValue({
3341
+ }),
3342
+ hasValues: $shaclPropertyFromRdf({
3343
+ graph: _$options.graph,
3344
+ resource: $resource,
3345
+ propertySchema: NodeShape.schema.properties.hasValues,
3346
+ typeFromRdf: (resourceValues) => resourceValues
3347
+ .chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
3348
+ switch (term.termType) {
3349
+ case "NamedNode":
3350
+ case "Literal":
3351
+ return Either.of(term);
3352
+ default:
3353
+ return Left(new Resource.MistypedTermValueError({
3354
+ actualValue: term,
3355
+ expectedValueType: "(NamedNode | Literal)",
3356
+ focusResource: $resource,
3357
+ propertyPath: PropertyShape.schema.properties.hasValues.path,
3358
+ }));
3359
+ }
3360
+ })))
3361
+ .map((values) => values.toArray())
3362
+ .map((valuesArray) => Resource.Values.fromValue({
3588
3363
  focusResource: $resource,
3589
- propertyPath: PropertyShape.schema
3590
- .properties.maxExclusive
3591
- .path,
3592
- value: Maybe.empty(),
3364
+ propertyPath: PropertyShape.schema.properties.hasValues.path,
3365
+ value: valuesArray,
3593
3366
  })),
3594
- }).chain((maxExclusive) => $shaclPropertyFromRdf({
3595
- graph: _$options.graph,
3596
- resource: $resource,
3597
- propertySchema: NodeShape.schema.properties.maxInclusive,
3598
- typeFromRdf: (resourceValues) => resourceValues
3599
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
3600
- .chain((values) => values.chainMap((value) => value.toLiteral()))
3601
- .map((values) => values.length > 0
3602
- ? values.map((value) => Maybe.of(value))
3603
- : Resource.Values.fromValue({
3367
+ }),
3368
+ ignoredProperties: $shaclPropertyFromRdf({
3369
+ graph: _$options.graph,
3370
+ resource: $resource,
3371
+ propertySchema: NodeShape.schema.properties.ignoredProperties,
3372
+ typeFromRdf: (resourceValues) => resourceValues
3373
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
3374
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
3604
3375
  focusResource: $resource,
3605
- propertyPath: PropertyShape.schema
3606
- .properties
3607
- .maxInclusive.path,
3608
- value: Maybe.empty(),
3609
- })),
3610
- }).chain((maxInclusive) => $shaclPropertyFromRdf({
3611
- graph: _$options.graph,
3612
- resource: $resource,
3613
- propertySchema: NodeShape.schema.properties.maxLength,
3614
- typeFromRdf: (resourceValues) => resourceValues
3615
- .chain((values) => values.chainMap((value) => value.toBigInt()))
3616
- .map((values) => values.length > 0
3617
- ? values.map((value) => Maybe.of(value))
3618
- : Resource.Values.fromValue({
3376
+ propertyPath: NodeShape.schema.properties.ignoredProperties.path,
3377
+ values: valueList.toArray(),
3378
+ })).chain((values) => values.chainMap((value) => value.toIri()))))
3379
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
3380
+ .map((values) => values.length > 0
3381
+ ? values.map((value) => Maybe.of(value))
3382
+ : Resource.Values.fromValue({
3383
+ focusResource: $resource,
3384
+ propertyPath: NodeShape.schema.properties.ignoredProperties.path,
3385
+ value: Maybe.empty(),
3386
+ })),
3387
+ }),
3388
+ in_: $shaclPropertyFromRdf({
3389
+ graph: _$options.graph,
3390
+ resource: $resource,
3391
+ propertySchema: NodeShape.schema.properties.in_,
3392
+ typeFromRdf: (resourceValues) => resourceValues
3393
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
3394
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
3619
3395
  focusResource: $resource,
3620
- propertyPath: PropertyShape.schema
3621
- .properties
3622
- .maxLength.path,
3623
- value: Maybe.empty(),
3624
- })),
3625
- }).chain((maxLength) => $shaclPropertyFromRdf({
3626
- graph: _$options.graph,
3627
- resource: $resource,
3628
- propertySchema: NodeShape.schema.properties.minCount,
3629
- typeFromRdf: (resourceValues) => resourceValues
3630
- .chain((values) => values.chainMap((value) => value.toBigInt()))
3631
- .map((values) => values.length > 0
3632
- ? values.map((value) => Maybe.of(value))
3633
- : Resource.Values.fromValue({
3396
+ propertyPath: PropertyShape.schema.properties.in_.path,
3397
+ values: valueList.toArray(),
3398
+ })).chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
3399
+ switch (term.termType) {
3400
+ case "NamedNode":
3401
+ case "Literal":
3402
+ return Either.of(term);
3403
+ default:
3404
+ return Left(new Resource.MistypedTermValueError({
3405
+ actualValue: term,
3406
+ expectedValueType: "(NamedNode | Literal)",
3407
+ focusResource: $resource,
3408
+ propertyPath: PropertyShape.schema.properties.in_.path,
3409
+ }));
3410
+ }
3411
+ })))))
3412
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
3413
+ .map((values) => values.length > 0
3414
+ ? values.map((value) => Maybe.of(value))
3415
+ : Resource.Values.fromValue({
3416
+ focusResource: $resource,
3417
+ propertyPath: PropertyShape.schema.properties.in_.path,
3418
+ value: Maybe.empty(),
3419
+ })),
3420
+ }),
3421
+ isDefinedBy: $shaclPropertyFromRdf({
3422
+ graph: _$options.graph,
3423
+ resource: $resource,
3424
+ propertySchema: NodeShape.schema.properties.isDefinedBy,
3425
+ typeFromRdf: (resourceValues) => resourceValues
3426
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
3427
+ .map((values) => values.length > 0
3428
+ ? values.map((value) => Maybe.of(value))
3429
+ : Resource.Values.fromValue({
3430
+ focusResource: $resource,
3431
+ propertyPath: PropertyShape.schema.properties.isDefinedBy.path,
3432
+ value: Maybe.empty(),
3433
+ })),
3434
+ }),
3435
+ label: $shaclPropertyFromRdf({
3436
+ graph: _$options.graph,
3437
+ resource: $resource,
3438
+ propertySchema: NodeShape.schema.properties.label,
3439
+ typeFromRdf: (resourceValues) => resourceValues
3440
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
3441
+ .chain((values) => values.chainMap((value) => value.toString()))
3442
+ .map((values) => values.length > 0
3443
+ ? values.map((value) => Maybe.of(value))
3444
+ : Resource.Values.fromValue({
3445
+ focusResource: $resource,
3446
+ propertyPath: PropertyShape.schema.properties.label.path,
3447
+ value: Maybe.empty(),
3448
+ })),
3449
+ }),
3450
+ languageIn: $shaclPropertyFromRdf({
3451
+ graph: _$options.graph,
3452
+ resource: $resource,
3453
+ propertySchema: NodeShape.schema.properties.languageIn,
3454
+ typeFromRdf: (resourceValues) => resourceValues
3455
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
3456
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
3634
3457
  focusResource: $resource,
3635
- propertyPath: PropertyShape.schema
3636
- .properties
3637
- .minCount.path,
3638
- value: Maybe.empty(),
3639
- })),
3640
- }).chain((minCount) => $shaclPropertyFromRdf({
3641
- graph: _$options.graph,
3642
- resource: $resource,
3643
- propertySchema: NodeShape.schema.properties
3644
- .minExclusive,
3645
- typeFromRdf: (resourceValues) => resourceValues
3646
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
3647
- .chain((values) => values.chainMap((value) => value.toLiteral()))
3648
- .map((values) => values.length > 0
3649
- ? values.map((value) => Maybe.of(value))
3650
- : Resource.Values.fromValue({
3458
+ propertyPath: PropertyShape.schema.properties.languageIn.path,
3459
+ values: valueList.toArray(),
3460
+ }))
3461
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
3462
+ .chain((values) => values.chainMap((value) => value.toString()))))
3463
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
3464
+ .map((values) => values.length > 0
3465
+ ? values.map((value) => Maybe.of(value))
3466
+ : Resource.Values.fromValue({
3467
+ focusResource: $resource,
3468
+ propertyPath: PropertyShape.schema.properties.languageIn.path,
3469
+ value: Maybe.empty(),
3470
+ })),
3471
+ }),
3472
+ maxCount: $shaclPropertyFromRdf({
3473
+ graph: _$options.graph,
3474
+ resource: $resource,
3475
+ propertySchema: NodeShape.schema.properties.maxCount,
3476
+ typeFromRdf: (resourceValues) => resourceValues
3477
+ .chain((values) => values.chainMap((value) => value.toBigInt()))
3478
+ .map((values) => values.length > 0
3479
+ ? values.map((value) => Maybe.of(value))
3480
+ : Resource.Values.fromValue({
3481
+ focusResource: $resource,
3482
+ propertyPath: PropertyShape.schema.properties.maxCount.path,
3483
+ value: Maybe.empty(),
3484
+ })),
3485
+ }),
3486
+ maxExclusive: $shaclPropertyFromRdf({
3487
+ graph: _$options.graph,
3488
+ resource: $resource,
3489
+ propertySchema: NodeShape.schema.properties.maxExclusive,
3490
+ typeFromRdf: (resourceValues) => resourceValues
3491
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
3492
+ .chain((values) => values.chainMap((value) => value.toLiteral()))
3493
+ .map((values) => values.length > 0
3494
+ ? values.map((value) => Maybe.of(value))
3495
+ : Resource.Values.fromValue({
3496
+ focusResource: $resource,
3497
+ propertyPath: PropertyShape.schema.properties.maxExclusive.path,
3498
+ value: Maybe.empty(),
3499
+ })),
3500
+ }),
3501
+ maxInclusive: $shaclPropertyFromRdf({
3502
+ graph: _$options.graph,
3503
+ resource: $resource,
3504
+ propertySchema: NodeShape.schema.properties.maxInclusive,
3505
+ typeFromRdf: (resourceValues) => resourceValues
3506
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
3507
+ .chain((values) => values.chainMap((value) => value.toLiteral()))
3508
+ .map((values) => values.length > 0
3509
+ ? values.map((value) => Maybe.of(value))
3510
+ : Resource.Values.fromValue({
3511
+ focusResource: $resource,
3512
+ propertyPath: PropertyShape.schema.properties.maxInclusive.path,
3513
+ value: Maybe.empty(),
3514
+ })),
3515
+ }),
3516
+ maxLength: $shaclPropertyFromRdf({
3517
+ graph: _$options.graph,
3518
+ resource: $resource,
3519
+ propertySchema: NodeShape.schema.properties.maxLength,
3520
+ typeFromRdf: (resourceValues) => resourceValues
3521
+ .chain((values) => values.chainMap((value) => value.toBigInt()))
3522
+ .map((values) => values.length > 0
3523
+ ? values.map((value) => Maybe.of(value))
3524
+ : Resource.Values.fromValue({
3525
+ focusResource: $resource,
3526
+ propertyPath: PropertyShape.schema.properties.maxLength.path,
3527
+ value: Maybe.empty(),
3528
+ })),
3529
+ }),
3530
+ minCount: $shaclPropertyFromRdf({
3531
+ graph: _$options.graph,
3532
+ resource: $resource,
3533
+ propertySchema: NodeShape.schema.properties.minCount,
3534
+ typeFromRdf: (resourceValues) => resourceValues
3535
+ .chain((values) => values.chainMap((value) => value.toBigInt()))
3536
+ .map((values) => values.length > 0
3537
+ ? values.map((value) => Maybe.of(value))
3538
+ : Resource.Values.fromValue({
3539
+ focusResource: $resource,
3540
+ propertyPath: PropertyShape.schema.properties.minCount.path,
3541
+ value: Maybe.empty(),
3542
+ })),
3543
+ }),
3544
+ minExclusive: $shaclPropertyFromRdf({
3545
+ graph: _$options.graph,
3546
+ resource: $resource,
3547
+ propertySchema: NodeShape.schema.properties.minExclusive,
3548
+ typeFromRdf: (resourceValues) => resourceValues
3549
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
3550
+ .chain((values) => values.chainMap((value) => value.toLiteral()))
3551
+ .map((values) => values.length > 0
3552
+ ? values.map((value) => Maybe.of(value))
3553
+ : Resource.Values.fromValue({
3554
+ focusResource: $resource,
3555
+ propertyPath: PropertyShape.schema.properties.minExclusive.path,
3556
+ value: Maybe.empty(),
3557
+ })),
3558
+ }),
3559
+ minInclusive: $shaclPropertyFromRdf({
3560
+ graph: _$options.graph,
3561
+ resource: $resource,
3562
+ propertySchema: NodeShape.schema.properties.minInclusive,
3563
+ typeFromRdf: (resourceValues) => resourceValues
3564
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
3565
+ .chain((values) => values.chainMap((value) => value.toLiteral()))
3566
+ .map((values) => values.length > 0
3567
+ ? values.map((value) => Maybe.of(value))
3568
+ : Resource.Values.fromValue({
3569
+ focusResource: $resource,
3570
+ propertyPath: PropertyShape.schema.properties.minInclusive.path,
3571
+ value: Maybe.empty(),
3572
+ })),
3573
+ }),
3574
+ minLength: $shaclPropertyFromRdf({
3575
+ graph: _$options.graph,
3576
+ resource: $resource,
3577
+ propertySchema: NodeShape.schema.properties.minLength,
3578
+ typeFromRdf: (resourceValues) => resourceValues
3579
+ .chain((values) => values.chainMap((value) => value.toBigInt()))
3580
+ .map((values) => values.length > 0
3581
+ ? values.map((value) => Maybe.of(value))
3582
+ : Resource.Values.fromValue({
3583
+ focusResource: $resource,
3584
+ propertyPath: PropertyShape.schema.properties.minLength.path,
3585
+ value: Maybe.empty(),
3586
+ })),
3587
+ }),
3588
+ node: $shaclPropertyFromRdf({
3589
+ graph: _$options.graph,
3590
+ resource: $resource,
3591
+ propertySchema: NodeShape.schema.properties.node,
3592
+ typeFromRdf: (resourceValues) => resourceValues
3593
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
3594
+ .map((values) => values.length > 0
3595
+ ? values.map((value) => Maybe.of(value))
3596
+ : Resource.Values.fromValue({
3597
+ focusResource: $resource,
3598
+ propertyPath: PropertyShape.schema.properties.node.path,
3599
+ value: Maybe.empty(),
3600
+ })),
3601
+ }),
3602
+ nodeKind: $shaclPropertyFromRdf({
3603
+ graph: _$options.graph,
3604
+ resource: $resource,
3605
+ propertySchema: NodeShape.schema.properties.nodeKind,
3606
+ typeFromRdf: (resourceValues) => resourceValues
3607
+ .chain((values) => values.chainMap((value) => value.toIri([
3608
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNode"),
3609
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrIRI"),
3610
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrLiteral"),
3611
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#IRI"),
3612
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#IRIOrLiteral"),
3613
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Literal"),
3614
+ ])))
3615
+ .map((values) => values.length > 0
3616
+ ? values.map((value) => Maybe.of(value))
3617
+ : Resource.Values.fromValue({
3618
+ focusResource: $resource,
3619
+ propertyPath: PropertyShape.schema.properties.nodeKind.path,
3620
+ value: Maybe.empty(),
3621
+ })),
3622
+ }),
3623
+ not: $shaclPropertyFromRdf({
3624
+ graph: _$options.graph,
3625
+ resource: $resource,
3626
+ propertySchema: NodeShape.schema.properties.not,
3627
+ typeFromRdf: (resourceValues) => resourceValues
3628
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
3629
+ .map((values) => values.toArray())
3630
+ .map((valuesArray) => Resource.Values.fromValue({
3651
3631
  focusResource: $resource,
3652
- propertyPath: PropertyShape
3653
- .schema
3654
- .properties
3655
- .minExclusive
3656
- .path,
3657
- value: Maybe.empty(),
3632
+ propertyPath: PropertyShape.schema.properties.not.path,
3633
+ value: valuesArray,
3658
3634
  })),
3659
- }).chain((minExclusive) => $shaclPropertyFromRdf({
3660
- graph: _$options.graph,
3661
- resource: $resource,
3662
- propertySchema: NodeShape.schema.properties
3663
- .minInclusive,
3664
- typeFromRdf: (resourceValues) => resourceValues
3665
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
3666
- .chain((values) => values.chainMap((value) => value.toLiteral()))
3667
- .map((values) => values.length > 0
3668
- ? values.map((value) => Maybe.of(value))
3669
- : Resource.Values.fromValue({
3635
+ }),
3636
+ or: $shaclPropertyFromRdf({
3637
+ graph: _$options.graph,
3638
+ resource: $resource,
3639
+ propertySchema: NodeShape.schema.properties.or,
3640
+ typeFromRdf: (resourceValues) => resourceValues
3641
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
3642
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
3670
3643
  focusResource: $resource,
3671
- propertyPath: PropertyShape
3672
- .schema
3673
- .properties
3674
- .minInclusive
3675
- .path,
3676
- value: Maybe.empty(),
3677
- })),
3678
- }).chain((minInclusive) => $shaclPropertyFromRdf({
3679
- graph: _$options.graph,
3680
- resource: $resource,
3681
- propertySchema: NodeShape.schema.properties
3682
- .minLength,
3683
- typeFromRdf: (resourceValues) => resourceValues
3684
- .chain((values) => values.chainMap((value) => value.toBigInt()))
3685
- .map((values) => values.length > 0
3686
- ? values.map((value) => Maybe.of(value))
3687
- : Resource.Values.fromValue({
3644
+ propertyPath: PropertyShape.schema.properties.or.path,
3645
+ values: valueList.toArray(),
3646
+ })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
3647
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
3648
+ .map((values) => values.length > 0
3649
+ ? values.map((value) => Maybe.of(value))
3650
+ : Resource.Values.fromValue({
3651
+ focusResource: $resource,
3652
+ propertyPath: PropertyShape.schema.properties.or.path,
3653
+ value: Maybe.empty(),
3654
+ })),
3655
+ }),
3656
+ patterns: $shaclPropertyFromRdf({
3657
+ graph: _$options.graph,
3658
+ resource: $resource,
3659
+ propertySchema: NodeShape.schema.properties.patterns,
3660
+ typeFromRdf: (resourceValues) => resourceValues
3661
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
3662
+ .chain((values) => values.chainMap((value) => value.toString()))
3663
+ .map((values) => values.toArray())
3664
+ .map((valuesArray) => Resource.Values.fromValue({
3688
3665
  focusResource: $resource,
3689
- propertyPath: PropertyShape
3690
- .schema
3691
- .properties
3692
- .minLength
3693
- .path,
3694
- value: Maybe.empty(),
3666
+ propertyPath: PropertyShape.schema.properties.patterns.path,
3667
+ value: valuesArray,
3695
3668
  })),
3696
- }).chain((minLength) => $shaclPropertyFromRdf({
3697
- graph: _$options.graph,
3698
- resource: $resource,
3699
- propertySchema: NodeShape.schema.properties.node,
3700
- typeFromRdf: (resourceValues) => resourceValues
3701
- .chain((values) => values.chainMap((value) => value.toIdentifier()))
3702
- .map((values) => values.length > 0
3703
- ? values.map((value) => Maybe.of(value))
3704
- : Resource.Values.fromValue({
3669
+ }),
3670
+ properties: $shaclPropertyFromRdf({
3671
+ graph: _$options.graph,
3672
+ resource: $resource,
3673
+ propertySchema: NodeShape.schema.properties.properties,
3674
+ typeFromRdf: (resourceValues) => resourceValues
3675
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
3676
+ .map((values) => values.toArray())
3677
+ .map((valuesArray) => Resource.Values.fromValue({
3705
3678
  focusResource: $resource,
3706
- propertyPath: PropertyShape
3707
- .schema
3708
- .properties
3709
- .node
3710
- .path,
3711
- value: Maybe.empty(),
3679
+ propertyPath: NodeShape.schema.properties.properties.path,
3680
+ value: valuesArray,
3712
3681
  })),
3713
- }).chain((node) => $shaclPropertyFromRdf({
3714
- graph: _$options.graph,
3715
- resource: $resource,
3716
- propertySchema: NodeShape.schema.properties
3717
- .nodeKind,
3718
- typeFromRdf: (resourceValues) => resourceValues
3719
- .chain((values) => values.chainMap((value) => value.toIri([
3720
- dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNode"),
3721
- dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrIRI"),
3722
- dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrLiteral"),
3723
- dataFactory.namedNode("http://www.w3.org/ns/shacl#IRI"),
3724
- dataFactory.namedNode("http://www.w3.org/ns/shacl#IRIOrLiteral"),
3725
- dataFactory.namedNode("http://www.w3.org/ns/shacl#Literal"),
3726
- ])))
3727
- .map((values) => values.length > 0
3728
- ? values.map((value) => Maybe.of(value))
3729
- : Resource.Values.fromValue({
3682
+ }),
3683
+ subClassOf: $shaclPropertyFromRdf({
3684
+ graph: _$options.graph,
3685
+ resource: $resource,
3686
+ propertySchema: NodeShape.schema.properties.subClassOf,
3687
+ typeFromRdf: (resourceValues) => resourceValues
3688
+ .chain((values) => values.chainMap((value) => value.toIri()))
3689
+ .map((values) => values.toArray())
3690
+ .map((valuesArray) => Resource.Values.fromValue({
3730
3691
  focusResource: $resource,
3731
- propertyPath: PropertyShape
3732
- .schema
3733
- .properties
3734
- .nodeKind
3735
- .path,
3736
- value: Maybe.empty(),
3692
+ propertyPath: NodeShape.schema.properties.subClassOf.path,
3693
+ value: valuesArray,
3737
3694
  })),
3738
- }).chain((nodeKind) => $shaclPropertyFromRdf({
3739
- graph: _$options.graph,
3740
- resource: $resource,
3741
- propertySchema: NodeShape.schema.properties
3742
- .not,
3743
- typeFromRdf: (resourceValues) => resourceValues
3744
- .chain((values) => values.chainMap((value) => value.toIdentifier()))
3745
- .map((values) => values.toArray())
3746
- .map((valuesArray) => Resource.Values.fromValue({
3747
- focusResource: $resource,
3748
- propertyPath: PropertyShape
3749
- .schema
3750
- .properties
3751
- .not
3752
- .path,
3753
- value: valuesArray,
3754
- })),
3755
- }).chain((not) => $shaclPropertyFromRdf({
3756
- graph: _$options.graph,
3757
- resource: $resource,
3758
- propertySchema: NodeShape.schema
3759
- .properties
3760
- .or,
3761
- typeFromRdf: (resourceValues) => resourceValues
3762
- .chain((values) => values.chainMap((value) => value.toList({
3695
+ }),
3696
+ types: $shaclPropertyFromRdf({
3763
3697
  graph: _$options.graph,
3764
- })))
3765
- .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
3766
- focusResource: $resource,
3767
- propertyPath: PropertyShape
3768
- .schema
3769
- .properties
3770
- .or
3771
- .path,
3772
- values: valueList.toArray(),
3773
- })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
3774
- .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
3775
- .map((values) => values.length >
3776
- 0
3777
- ? values.map((value) => Maybe.of(value))
3778
- : Resource.Values.fromValue({
3698
+ resource: $resource,
3699
+ propertySchema: NodeShape.schema.properties.types,
3700
+ typeFromRdf: (resourceValues) => resourceValues
3701
+ .chain((values) => values.chainMap((value) => value.toIri()))
3702
+ .map((values) => values.toArray())
3703
+ .map((valuesArray) => Resource.Values.fromValue({
3779
3704
  focusResource: $resource,
3780
- propertyPath: PropertyShape
3781
- .schema
3782
- .properties
3783
- .or
3784
- .path,
3785
- value: Maybe.empty(),
3705
+ propertyPath: NodeShape.schema.properties.types.path,
3706
+ value: valuesArray,
3786
3707
  })),
3787
- }).chain((or) => $shaclPropertyFromRdf({
3788
- graph: _$options.graph,
3789
- resource: $resource,
3790
- propertySchema: NodeShape.schema
3791
- .properties
3792
- .patterns,
3793
- typeFromRdf: (resourceValues) => resourceValues
3794
- .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
3795
- .chain((values) => values.chainMap((value) => value.toString()))
3796
- .map((values) => values.toArray())
3797
- .map((valuesArray) => Resource.Values.fromValue({
3798
- focusResource: $resource,
3799
- propertyPath: PropertyShape
3800
- .schema
3801
- .properties
3802
- .patterns
3803
- .path,
3804
- value: valuesArray,
3805
- })),
3806
- }).chain((patterns) => $shaclPropertyFromRdf({
3807
- graph: _$options.graph,
3808
- resource: $resource,
3809
- propertySchema: NodeShape.schema
3810
- .properties
3811
- .properties,
3812
- typeFromRdf: (resourceValues) => resourceValues
3813
- .chain((values) => values.chainMap((value) => value.toIdentifier()))
3814
- .map((values) => values.toArray())
3815
- .map((valuesArray) => Resource.Values.fromValue({
3816
- focusResource: $resource,
3817
- propertyPath: NodeShape
3818
- .schema
3819
- .properties
3820
- .properties
3821
- .path,
3822
- value: valuesArray,
3823
- })),
3824
- }).chain((properties) => $shaclPropertyFromRdf({
3825
- graph: _$options.graph,
3826
- resource: $resource,
3827
- propertySchema: NodeShape.schema
3828
- .properties
3829
- .subClassOf,
3830
- typeFromRdf: (resourceValues) => resourceValues
3831
- .chain((values) => values.chainMap((value) => value.toIri()))
3832
- .map((values) => values.toArray())
3833
- .map((valuesArray) => Resource.Values.fromValue({
3834
- focusResource: $resource,
3835
- propertyPath: NodeShape
3836
- .schema
3837
- .properties
3838
- .subClassOf
3839
- .path,
3840
- value: valuesArray,
3841
- })),
3842
- }).chain((subClassOf) => $shaclPropertyFromRdf({
3843
- graph: _$options.graph,
3844
- resource: $resource,
3845
- propertySchema: NodeShape.schema
3846
- .properties
3847
- .types,
3848
- typeFromRdf: (resourceValues) => resourceValues
3849
- .chain((values) => values.chainMap((value) => value.toIri()))
3850
- .map((values) => values.toArray())
3851
- .map((valuesArray) => Resource.Values.fromValue({
3852
- focusResource: $resource,
3853
- propertyPath: NodeShape
3854
- .schema
3855
- .properties
3856
- .types
3857
- .path,
3858
- value: valuesArray,
3859
- })),
3860
- }).chain((types) => $shaclPropertyFromRdf({
3861
- graph: _$options.graph,
3862
- resource: $resource,
3863
- propertySchema: NodeShape.schema
3864
- .properties
3865
- .xone,
3866
- typeFromRdf: (resourceValues) => resourceValues
3867
- .chain((values) => values.chainMap((value) => value.toList({
3708
+ }),
3709
+ xone: $shaclPropertyFromRdf({
3868
3710
  graph: _$options.graph,
3869
- })))
3870
- .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
3871
- focusResource: $resource,
3872
- propertyPath: PropertyShape
3873
- .schema
3874
- .properties
3875
- .xone
3876
- .path,
3877
- values: valueList.toArray(),
3878
- })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
3879
- .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
3880
- .map((values) => values.length >
3881
- 0
3882
- ? values.map((value) => Maybe.of(value))
3883
- : Resource.Values.fromValue({
3711
+ resource: $resource,
3712
+ propertySchema: NodeShape.schema.properties.xone,
3713
+ typeFromRdf: (resourceValues) => resourceValues
3714
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
3715
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
3884
3716
  focusResource: $resource,
3885
- propertyPath: PropertyShape
3886
- .schema
3887
- .properties
3888
- .xone
3889
- .path,
3890
- value: Maybe.empty(),
3891
- })),
3892
- }).map((xone) => create({
3893
- $identifier,
3894
- and,
3895
- classes,
3896
- closed,
3897
- comment,
3898
- datatype,
3899
- deactivated,
3900
- flags,
3901
- hasValues,
3902
- ignoredProperties,
3903
- in_,
3904
- isDefinedBy,
3905
- label,
3906
- languageIn,
3907
- maxCount,
3908
- maxExclusive,
3909
- maxInclusive,
3910
- maxLength,
3911
- minCount,
3912
- minExclusive,
3913
- minInclusive,
3914
- minLength,
3915
- node,
3916
- nodeKind,
3917
- not,
3918
- or,
3919
- patterns,
3920
- properties,
3921
- subClassOf,
3922
- types,
3923
- xone,
3924
- })))))))))))))))))))))))))))))))));
3717
+ propertyPath: PropertyShape.schema.properties.xone.path,
3718
+ values: valueList.toArray(),
3719
+ })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
3720
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
3721
+ .map((values) => values.length > 0
3722
+ ? values.map((value) => Maybe.of(value))
3723
+ : Resource.Values.fromValue({
3724
+ focusResource: $resource,
3725
+ propertyPath: PropertyShape.schema.properties.xone.path,
3726
+ value: Maybe.empty(),
3727
+ })),
3728
+ }),
3729
+ }).map((properties) => create(properties)));
3925
3730
  };
3926
3731
  NodeShape.fromRdfResource = $wrap_FromRdfResourceFunction(NodeShape._fromRdfResource);
3927
3732
  NodeShape.fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value