@shaclmate/shacl-ast 4.0.31 → 4.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/generated.js +1079 -1290
  2. package/package.json +1 -1
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
  }
@@ -1031,671 +1042,546 @@ export var PropertyShape;
1031
1042
  }
1032
1043
  return Left(new Error(`${$resource.identifier} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#PropertyShape)`));
1033
1044
  })
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({
1045
+ : Right(true)).chain((_rdfTypeCheck) => $sequenceRecord({
1046
+ $identifier: Right(new Resource.Value({
1047
+ dataFactory: dataFactory,
1166
1048
  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
1049
+ propertyPath: $RdfVocabularies.rdf.subject,
1050
+ term: $resource.identifier,
1051
+ }).toValues())
1175
1052
  .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({
1053
+ .chain((values) => values.head()),
1054
+ and: $shaclPropertyFromRdf({
1217
1055
  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({
1056
+ resource: $resource,
1057
+ propertySchema: PropertyShape.schema.properties.and,
1058
+ typeFromRdf: (resourceValues) => resourceValues
1059
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
1060
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
1273
1061
  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({
1062
+ propertyPath: PropertyShape.schema.properties.and.path,
1063
+ values: valueList.toArray(),
1064
+ })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
1065
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
1066
+ .map((values) => values.length > 0
1067
+ ? values.map((value) => Maybe.of(value))
1068
+ : Resource.Values.fromValue({
1069
+ focusResource: $resource,
1070
+ propertyPath: PropertyShape.schema.properties.and.path,
1071
+ value: Maybe.empty(),
1072
+ })),
1073
+ }),
1074
+ classes: $shaclPropertyFromRdf({
1284
1075
  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({
1076
+ resource: $resource,
1077
+ propertySchema: PropertyShape.schema.properties.classes,
1078
+ typeFromRdf: (resourceValues) => resourceValues
1079
+ .chain((values) => values.chainMap((value) => value.toIri()))
1080
+ .map((values) => values.toArray())
1081
+ .map((valuesArray) => Resource.Values.fromValue({
1394
1082
  focusResource: $resource,
1395
- propertyPath: PropertyShape
1396
- .schema
1397
- .properties
1398
- .minExclusive
1399
- .path,
1400
- value: Maybe.empty(),
1083
+ propertyPath: PropertyShape.schema.properties.classes.path,
1084
+ value: valuesArray,
1401
1085
  })),
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({
1086
+ }),
1087
+ comment: $shaclPropertyFromRdf({
1088
+ graph: _$options.graph,
1089
+ resource: $resource,
1090
+ propertySchema: PropertyShape.schema.properties.comment,
1091
+ typeFromRdf: (resourceValues) => resourceValues
1092
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1093
+ .chain((values) => values.chainMap((value) => value.toString()))
1094
+ .map((values) => values.length > 0
1095
+ ? values.map((value) => Maybe.of(value))
1096
+ : Resource.Values.fromValue({
1097
+ focusResource: $resource,
1098
+ propertyPath: PropertyShape.schema.properties.comment.path,
1099
+ value: Maybe.empty(),
1100
+ })),
1101
+ }),
1102
+ datatype: $shaclPropertyFromRdf({
1103
+ graph: _$options.graph,
1104
+ resource: $resource,
1105
+ propertySchema: PropertyShape.schema.properties.datatype,
1106
+ typeFromRdf: (resourceValues) => resourceValues
1107
+ .chain((values) => values.chainMap((value) => value.toIri()))
1108
+ .map((values) => values.length > 0
1109
+ ? values.map((value) => Maybe.of(value))
1110
+ : Resource.Values.fromValue({
1111
+ focusResource: $resource,
1112
+ propertyPath: PropertyShape.schema.properties.datatype.path,
1113
+ value: Maybe.empty(),
1114
+ })),
1115
+ }),
1116
+ deactivated: $shaclPropertyFromRdf({
1117
+ graph: _$options.graph,
1118
+ resource: $resource,
1119
+ propertySchema: PropertyShape.schema.properties.deactivated,
1120
+ typeFromRdf: (resourceValues) => resourceValues
1121
+ .chain((values) => values.chainMap((value) => value.toBoolean()))
1122
+ .map((values) => values.length > 0
1123
+ ? values.map((value) => Maybe.of(value))
1124
+ : Resource.Values.fromValue({
1125
+ focusResource: $resource,
1126
+ propertyPath: PropertyShape.schema.properties.deactivated.path,
1127
+ value: Maybe.empty(),
1128
+ })),
1129
+ }),
1130
+ defaultValue: $shaclPropertyFromRdf({
1131
+ graph: _$options.graph,
1132
+ resource: $resource,
1133
+ propertySchema: PropertyShape.schema.properties.defaultValue,
1134
+ typeFromRdf: (resourceValues) => resourceValues
1135
+ .chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
1136
+ switch (term.termType) {
1137
+ case "NamedNode":
1138
+ case "Literal":
1139
+ return Either.of(term);
1140
+ default:
1141
+ return Left(new Resource.MistypedTermValueError({
1142
+ actualValue: term,
1143
+ expectedValueType: "(NamedNode | Literal)",
1144
+ focusResource: $resource,
1145
+ propertyPath: PropertyShape.schema.properties.defaultValue.path,
1146
+ }));
1147
+ }
1148
+ })))
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.defaultValue.path,
1154
+ value: Maybe.empty(),
1155
+ })),
1156
+ }),
1157
+ description: $shaclPropertyFromRdf({
1158
+ graph: _$options.graph,
1159
+ resource: $resource,
1160
+ propertySchema: PropertyShape.schema.properties.description,
1161
+ typeFromRdf: (resourceValues) => resourceValues
1162
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1163
+ .chain((values) => values.chainMap((value) => value.toString()))
1164
+ .map((values) => values.length > 0
1165
+ ? values.map((value) => Maybe.of(value))
1166
+ : Resource.Values.fromValue({
1167
+ focusResource: $resource,
1168
+ propertyPath: PropertyShape.schema.properties.description.path,
1169
+ value: Maybe.empty(),
1170
+ })),
1171
+ }),
1172
+ flags: $shaclPropertyFromRdf({
1173
+ graph: _$options.graph,
1174
+ resource: $resource,
1175
+ propertySchema: PropertyShape.schema.properties.flags,
1176
+ typeFromRdf: (resourceValues) => resourceValues
1177
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1178
+ .chain((values) => values.chainMap((value) => value.toString()))
1179
+ .map((values) => values.toArray())
1180
+ .map((valuesArray) => Resource.Values.fromValue({
1413
1181
  focusResource: $resource,
1414
- propertyPath: PropertyShape
1415
- .schema
1416
- .properties
1417
- .minInclusive
1418
- .path,
1419
- value: Maybe.empty(),
1182
+ propertyPath: PropertyShape.schema.properties.flags.path,
1183
+ value: valuesArray,
1420
1184
  })),
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({
1185
+ }),
1186
+ groups: $shaclPropertyFromRdf({
1187
+ graph: _$options.graph,
1188
+ resource: $resource,
1189
+ propertySchema: PropertyShape.schema.properties.groups,
1190
+ typeFromRdf: (resourceValues) => resourceValues
1191
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
1192
+ .map((values) => values.toArray())
1193
+ .map((valuesArray) => Resource.Values.fromValue({
1431
1194
  focusResource: $resource,
1432
- propertyPath: PropertyShape
1433
- .schema
1434
- .properties
1435
- .minLength
1436
- .path,
1437
- value: Maybe.empty(),
1195
+ propertyPath: PropertyShape.schema.properties.groups.path,
1196
+ value: valuesArray,
1438
1197
  })),
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({
1198
+ }),
1199
+ hasValues: $shaclPropertyFromRdf({
1200
+ graph: _$options.graph,
1201
+ resource: $resource,
1202
+ propertySchema: PropertyShape.schema.properties.hasValues,
1203
+ typeFromRdf: (resourceValues) => resourceValues
1204
+ .chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
1205
+ switch (term.termType) {
1206
+ case "NamedNode":
1207
+ case "Literal":
1208
+ return Either.of(term);
1209
+ default:
1210
+ return Left(new Resource.MistypedTermValueError({
1211
+ actualValue: term,
1212
+ expectedValueType: "(NamedNode | Literal)",
1213
+ focusResource: $resource,
1214
+ propertyPath: PropertyShape.schema.properties.hasValues.path,
1215
+ }));
1216
+ }
1217
+ })))
1218
+ .map((values) => values.toArray())
1219
+ .map((valuesArray) => Resource.Values.fromValue({
1450
1220
  focusResource: $resource,
1451
- propertyPath: PropertyShape
1452
- .schema
1453
- .properties
1454
- .name
1455
- .path,
1456
- value: Maybe.empty(),
1221
+ propertyPath: PropertyShape.schema.properties.hasValues.path,
1222
+ value: valuesArray,
1457
1223
  })),
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({
1224
+ }),
1225
+ in_: $shaclPropertyFromRdf({
1226
+ graph: _$options.graph,
1227
+ resource: $resource,
1228
+ propertySchema: PropertyShape.schema.properties.in_,
1229
+ typeFromRdf: (resourceValues) => resourceValues
1230
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
1231
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
1469
1232
  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({
1233
+ propertyPath: PropertyShape.schema.properties.in_.path,
1234
+ values: valueList.toArray(),
1235
+ })).chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
1236
+ switch (term.termType) {
1237
+ case "NamedNode":
1238
+ case "Literal":
1239
+ return Either.of(term);
1240
+ default:
1241
+ return Left(new Resource.MistypedTermValueError({
1242
+ actualValue: term,
1243
+ expectedValueType: "(NamedNode | Literal)",
1244
+ focusResource: $resource,
1245
+ propertyPath: PropertyShape.schema.properties.in_.path,
1246
+ }));
1247
+ }
1248
+ })))))
1249
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
1250
+ .map((values) => values.length > 0
1251
+ ? values.map((value) => Maybe.of(value))
1252
+ : Resource.Values.fromValue({
1253
+ focusResource: $resource,
1254
+ propertyPath: PropertyShape.schema.properties.in_.path,
1255
+ value: Maybe.empty(),
1256
+ })),
1257
+ }),
1258
+ isDefinedBy: $shaclPropertyFromRdf({
1259
+ graph: _$options.graph,
1260
+ resource: $resource,
1261
+ propertySchema: PropertyShape.schema.properties.isDefinedBy,
1262
+ typeFromRdf: (resourceValues) => resourceValues
1263
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
1264
+ .map((values) => values.length > 0
1265
+ ? values.map((value) => Maybe.of(value))
1266
+ : Resource.Values.fromValue({
1267
+ focusResource: $resource,
1268
+ propertyPath: PropertyShape.schema.properties.isDefinedBy.path,
1269
+ value: Maybe.empty(),
1270
+ })),
1271
+ }),
1272
+ label: $shaclPropertyFromRdf({
1273
+ graph: _$options.graph,
1274
+ resource: $resource,
1275
+ propertySchema: PropertyShape.schema.properties.label,
1276
+ typeFromRdf: (resourceValues) => resourceValues
1277
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1278
+ .chain((values) => values.chainMap((value) => value.toString()))
1279
+ .map((values) => values.length > 0
1280
+ ? values.map((value) => Maybe.of(value))
1281
+ : Resource.Values.fromValue({
1282
+ focusResource: $resource,
1283
+ propertyPath: PropertyShape.schema.properties.label.path,
1284
+ value: Maybe.empty(),
1285
+ })),
1286
+ }),
1287
+ languageIn: $shaclPropertyFromRdf({
1288
+ graph: _$options.graph,
1289
+ resource: $resource,
1290
+ propertySchema: PropertyShape.schema.properties.languageIn,
1291
+ typeFromRdf: (resourceValues) => resourceValues
1292
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
1293
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
1496
1294
  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({
1295
+ propertyPath: PropertyShape.schema.properties.languageIn.path,
1296
+ values: valueList.toArray(),
1297
+ }))
1298
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1299
+ .chain((values) => values.chainMap((value) => value.toString()))))
1300
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
1301
+ .map((values) => values.length > 0
1302
+ ? values.map((value) => Maybe.of(value))
1303
+ : Resource.Values.fromValue({
1304
+ focusResource: $resource,
1305
+ propertyPath: PropertyShape.schema.properties.languageIn.path,
1306
+ value: Maybe.empty(),
1307
+ })),
1308
+ }),
1309
+ maxCount: $shaclPropertyFromRdf({
1530
1310
  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({
1311
+ resource: $resource,
1312
+ propertySchema: PropertyShape.schema.properties.maxCount,
1313
+ typeFromRdf: (resourceValues) => resourceValues
1314
+ .chain((values) => values.chainMap((value) => value.toBigInt()))
1315
+ .map((values) => values.length > 0
1316
+ ? values.map((value) => Maybe.of(value))
1317
+ : Resource.Values.fromValue({
1318
+ focusResource: $resource,
1319
+ propertyPath: PropertyShape.schema.properties.maxCount.path,
1320
+ value: Maybe.empty(),
1321
+ })),
1322
+ }),
1323
+ maxExclusive: $shaclPropertyFromRdf({
1324
+ graph: _$options.graph,
1325
+ resource: $resource,
1326
+ propertySchema: PropertyShape.schema.properties.maxExclusive,
1327
+ typeFromRdf: (resourceValues) => resourceValues
1328
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1329
+ .chain((values) => values.chainMap((value) => value.toLiteral()))
1330
+ .map((values) => values.length > 0
1331
+ ? values.map((value) => Maybe.of(value))
1332
+ : Resource.Values.fromValue({
1333
+ focusResource: $resource,
1334
+ propertyPath: PropertyShape.schema.properties.maxExclusive.path,
1335
+ value: Maybe.empty(),
1336
+ })),
1337
+ }),
1338
+ maxInclusive: $shaclPropertyFromRdf({
1339
+ graph: _$options.graph,
1340
+ resource: $resource,
1341
+ propertySchema: PropertyShape.schema.properties.maxInclusive,
1342
+ typeFromRdf: (resourceValues) => resourceValues
1343
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1344
+ .chain((values) => values.chainMap((value) => value.toLiteral()))
1345
+ .map((values) => values.length > 0
1346
+ ? values.map((value) => Maybe.of(value))
1347
+ : Resource.Values.fromValue({
1348
+ focusResource: $resource,
1349
+ propertyPath: PropertyShape.schema.properties.maxInclusive.path,
1350
+ value: Maybe.empty(),
1351
+ })),
1352
+ }),
1353
+ maxLength: $shaclPropertyFromRdf({
1354
+ graph: _$options.graph,
1355
+ resource: $resource,
1356
+ propertySchema: PropertyShape.schema.properties.maxLength,
1357
+ typeFromRdf: (resourceValues) => resourceValues
1358
+ .chain((values) => values.chainMap((value) => value.toBigInt()))
1359
+ .map((values) => values.length > 0
1360
+ ? values.map((value) => Maybe.of(value))
1361
+ : Resource.Values.fromValue({
1362
+ focusResource: $resource,
1363
+ propertyPath: PropertyShape.schema.properties.maxLength.path,
1364
+ value: Maybe.empty(),
1365
+ })),
1366
+ }),
1367
+ minCount: $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.schema.properties.minCount.path,
1378
+ value: Maybe.empty(),
1379
+ })),
1380
+ }),
1381
+ minExclusive: $shaclPropertyFromRdf({
1382
+ graph: _$options.graph,
1383
+ resource: $resource,
1384
+ propertySchema: PropertyShape.schema.properties.minExclusive,
1385
+ typeFromRdf: (resourceValues) => resourceValues
1386
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1387
+ .chain((values) => values.chainMap((value) => value.toLiteral()))
1388
+ .map((values) => values.length > 0
1389
+ ? values.map((value) => Maybe.of(value))
1390
+ : Resource.Values.fromValue({
1391
+ focusResource: $resource,
1392
+ propertyPath: PropertyShape.schema.properties.minExclusive.path,
1393
+ value: Maybe.empty(),
1394
+ })),
1395
+ }),
1396
+ minInclusive: $shaclPropertyFromRdf({
1397
+ graph: _$options.graph,
1398
+ resource: $resource,
1399
+ propertySchema: PropertyShape.schema.properties.minInclusive,
1400
+ typeFromRdf: (resourceValues) => resourceValues
1401
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1402
+ .chain((values) => values.chainMap((value) => value.toLiteral()))
1403
+ .map((values) => values.length > 0
1404
+ ? values.map((value) => Maybe.of(value))
1405
+ : Resource.Values.fromValue({
1406
+ focusResource: $resource,
1407
+ propertyPath: PropertyShape.schema.properties.minInclusive.path,
1408
+ value: Maybe.empty(),
1409
+ })),
1410
+ }),
1411
+ minLength: $shaclPropertyFromRdf({
1412
+ graph: _$options.graph,
1413
+ resource: $resource,
1414
+ propertySchema: PropertyShape.schema.properties.minLength,
1415
+ typeFromRdf: (resourceValues) => resourceValues
1416
+ .chain((values) => values.chainMap((value) => value.toBigInt()))
1417
+ .map((values) => values.length > 0
1418
+ ? values.map((value) => Maybe.of(value))
1419
+ : Resource.Values.fromValue({
1420
+ focusResource: $resource,
1421
+ propertyPath: PropertyShape.schema.properties.minLength.path,
1422
+ value: Maybe.empty(),
1423
+ })),
1424
+ }),
1425
+ name: $shaclPropertyFromRdf({
1426
+ graph: _$options.graph,
1427
+ resource: $resource,
1428
+ propertySchema: PropertyShape.schema.properties.name,
1429
+ typeFromRdf: (resourceValues) => resourceValues
1430
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1431
+ .chain((values) => values.chainMap((value) => value.toString()))
1432
+ .map((values) => values.length > 0
1433
+ ? values.map((value) => Maybe.of(value))
1434
+ : Resource.Values.fromValue({
1435
+ focusResource: $resource,
1436
+ propertyPath: PropertyShape.schema.properties.name.path,
1437
+ value: Maybe.empty(),
1438
+ })),
1439
+ }),
1440
+ node: $shaclPropertyFromRdf({
1441
+ graph: _$options.graph,
1442
+ resource: $resource,
1443
+ propertySchema: PropertyShape.schema.properties.node,
1444
+ typeFromRdf: (resourceValues) => resourceValues
1445
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
1446
+ .map((values) => values.length > 0
1447
+ ? values.map((value) => Maybe.of(value))
1448
+ : Resource.Values.fromValue({
1449
+ focusResource: $resource,
1450
+ propertyPath: PropertyShape.schema.properties.node.path,
1451
+ value: Maybe.empty(),
1452
+ })),
1453
+ }),
1454
+ nodeKind: $shaclPropertyFromRdf({
1455
+ graph: _$options.graph,
1456
+ resource: $resource,
1457
+ propertySchema: PropertyShape.schema.properties.nodeKind,
1458
+ typeFromRdf: (resourceValues) => resourceValues
1459
+ .chain((values) => values.chainMap((value) => value.toIri([
1460
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNode"),
1461
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrIRI"),
1462
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrLiteral"),
1463
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#IRI"),
1464
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#IRIOrLiteral"),
1465
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Literal"),
1466
+ ])))
1467
+ .map((values) => values.length > 0
1468
+ ? values.map((value) => Maybe.of(value))
1469
+ : Resource.Values.fromValue({
1470
+ focusResource: $resource,
1471
+ propertyPath: PropertyShape.schema.properties.nodeKind.path,
1472
+ value: Maybe.empty(),
1473
+ })),
1474
+ }),
1475
+ not: $shaclPropertyFromRdf({
1476
+ graph: _$options.graph,
1477
+ resource: $resource,
1478
+ propertySchema: PropertyShape.schema.properties.not,
1479
+ typeFromRdf: (resourceValues) => resourceValues
1480
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
1481
+ .map((values) => values.toArray())
1482
+ .map((valuesArray) => Resource.Values.fromValue({
1546
1483
  focusResource: $resource,
1547
- propertyPath: PropertyShape
1548
- .schema
1549
- .properties
1550
- .or
1551
- .path,
1552
- value: Maybe.empty(),
1484
+ propertyPath: PropertyShape.schema.properties.not.path,
1485
+ value: valuesArray,
1553
1486
  })),
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({
1487
+ }),
1488
+ or: $shaclPropertyFromRdf({
1489
+ graph: _$options.graph,
1490
+ resource: $resource,
1491
+ propertySchema: PropertyShape.schema.properties.or,
1492
+ typeFromRdf: (resourceValues) => resourceValues
1493
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
1494
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
1566
1495
  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,
1496
+ propertyPath: PropertyShape.schema.properties.or.path,
1497
+ values: valueList.toArray(),
1498
+ })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
1499
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
1500
+ .map((values) => values.length > 0
1501
+ ? values.map((value) => Maybe.of(value))
1502
+ : Resource.Values.fromValue({
1503
+ focusResource: $resource,
1504
+ propertyPath: PropertyShape.schema.properties.or.path,
1505
+ value: Maybe.empty(),
1506
+ })),
1507
+ }),
1508
+ order: $shaclPropertyFromRdf({
1582
1509
  graph: _$options.graph,
1583
- preferredLanguages: _$options.preferredLanguages,
1584
- objectSet: _$options.objectSet,
1585
1510
  resource: $resource,
1586
- ignoreRdfType: true,
1587
- propertyPath: PropertyShape
1588
- .schema
1589
- .properties
1590
- .path
1591
- .path,
1511
+ propertySchema: PropertyShape.schema.properties.order,
1512
+ typeFromRdf: (resourceValues) => resourceValues
1513
+ .chain((values) => values.chainMap((value) => value.toFloat()))
1514
+ .map((values) => values.length > 0
1515
+ ? values.map((value) => Maybe.of(value))
1516
+ : Resource.Values.fromValue({
1517
+ focusResource: $resource,
1518
+ propertyPath: PropertyShape.schema.properties.order.path,
1519
+ value: Maybe.empty(),
1520
+ })),
1592
1521
  }),
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({
1522
+ path: $shaclPropertyFromRdf({
1523
+ graph: _$options.graph,
1524
+ resource: $resource,
1525
+ propertySchema: PropertyShape.schema.properties.path,
1526
+ typeFromRdf: (resourceValues) => $PropertyPath.fromRdfResourceValues(resourceValues, {
1527
+ context: _$options.context,
1528
+ graph: _$options.graph,
1529
+ objectSet: _$options.objectSet,
1530
+ preferredLanguages: _$options.preferredLanguages,
1531
+ resource: $resource,
1532
+ ignoreRdfType: true,
1533
+ propertyPath: PropertyShape.schema.properties.path.path,
1534
+ }),
1535
+ }),
1536
+ patterns: $shaclPropertyFromRdf({
1537
+ graph: _$options.graph,
1538
+ resource: $resource,
1539
+ propertySchema: PropertyShape.schema.properties.patterns,
1540
+ typeFromRdf: (resourceValues) => resourceValues
1541
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1542
+ .chain((values) => values.chainMap((value) => value.toString()))
1543
+ .map((values) => values.toArray())
1544
+ .map((valuesArray) => Resource.Values.fromValue({
1624
1545
  focusResource: $resource,
1625
- propertyPath: PropertyShape
1626
- .schema
1627
- .properties
1628
- .uniqueLang
1629
- .path,
1630
- value: Maybe.empty(),
1546
+ propertyPath: PropertyShape.schema.properties.patterns.path,
1547
+ value: valuesArray,
1631
1548
  })),
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({
1549
+ }),
1550
+ uniqueLang: $shaclPropertyFromRdf({
1640
1551
  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({
1552
+ resource: $resource,
1553
+ propertySchema: PropertyShape.schema.properties.uniqueLang,
1554
+ typeFromRdf: (resourceValues) => resourceValues
1555
+ .chain((values) => values.chainMap((value) => value.toBoolean()))
1556
+ .map((values) => values.length > 0
1557
+ ? values.map((value) => Maybe.of(value))
1558
+ : Resource.Values.fromValue({
1559
+ focusResource: $resource,
1560
+ propertyPath: PropertyShape.schema.properties.uniqueLang.path,
1561
+ value: Maybe.empty(),
1562
+ })),
1563
+ }),
1564
+ xone: $shaclPropertyFromRdf({
1565
+ graph: _$options.graph,
1566
+ resource: $resource,
1567
+ propertySchema: PropertyShape.schema.properties.xone,
1568
+ typeFromRdf: (resourceValues) => resourceValues
1569
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
1570
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
1656
1571
  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
- })))))))))))))))))))))))))))))))))));
1572
+ propertyPath: PropertyShape.schema.properties.xone.path,
1573
+ values: valueList.toArray(),
1574
+ })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
1575
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
1576
+ .map((values) => values.length > 0
1577
+ ? values.map((value) => Maybe.of(value))
1578
+ : Resource.Values.fromValue({
1579
+ focusResource: $resource,
1580
+ propertyPath: PropertyShape.schema.properties.xone.path,
1581
+ value: Maybe.empty(),
1582
+ })),
1583
+ }),
1584
+ }).map((properties) => create(properties)));
1699
1585
  };
1700
1586
  PropertyShape.fromRdfResource = $wrap_FromRdfResourceFunction(PropertyShape._fromRdfResource);
1701
1587
  PropertyShape.fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
@@ -2296,43 +2182,46 @@ export var PropertyGroup;
2296
2182
  }
2297
2183
  return Left(new Error(`${$resource.identifier} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#PropertyGroup)`));
2298
2184
  })
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 })))));
2185
+ : Right(true)).chain((_rdfTypeCheck) => $sequenceRecord({
2186
+ $identifier: Right(new Resource.Value({
2187
+ dataFactory: dataFactory,
2188
+ focusResource: $resource,
2189
+ propertyPath: $RdfVocabularies.rdf.subject,
2190
+ term: $resource.identifier,
2191
+ }).toValues())
2192
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
2193
+ .chain((values) => values.head()),
2194
+ comment: $shaclPropertyFromRdf({
2195
+ graph: _$options.graph,
2196
+ resource: $resource,
2197
+ propertySchema: PropertyGroup.schema.properties.comment,
2198
+ typeFromRdf: (resourceValues) => resourceValues
2199
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2200
+ .chain((values) => values.chainMap((value) => value.toString()))
2201
+ .map((values) => values.length > 0
2202
+ ? values.map((value) => Maybe.of(value))
2203
+ : Resource.Values.fromValue({
2204
+ focusResource: $resource,
2205
+ propertyPath: PropertyShape.schema.properties.comment.path,
2206
+ value: Maybe.empty(),
2207
+ })),
2208
+ }),
2209
+ label: $shaclPropertyFromRdf({
2210
+ graph: _$options.graph,
2211
+ resource: $resource,
2212
+ propertySchema: PropertyGroup.schema.properties.label,
2213
+ typeFromRdf: (resourceValues) => resourceValues
2214
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2215
+ .chain((values) => values.chainMap((value) => value.toString()))
2216
+ .map((values) => values.length > 0
2217
+ ? values.map((value) => Maybe.of(value))
2218
+ : Resource.Values.fromValue({
2219
+ focusResource: $resource,
2220
+ propertyPath: PropertyShape.schema.properties.label.path,
2221
+ value: Maybe.empty(),
2222
+ })),
2223
+ }),
2224
+ }).map((properties) => create(properties)));
2336
2225
  };
2337
2226
  PropertyGroup.fromRdfResource = $wrap_FromRdfResourceFunction(PropertyGroup._fromRdfResource);
2338
2227
  PropertyGroup.fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
@@ -2495,43 +2384,46 @@ export var Ontology;
2495
2384
  }
2496
2385
  return Left(new Error(`${$resource.identifier} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/2002/07/owl#Ontology)`));
2497
2386
  })
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 })))));
2387
+ : Right(true)).chain((_rdfTypeCheck) => $sequenceRecord({
2388
+ $identifier: Right(new Resource.Value({
2389
+ dataFactory: dataFactory,
2390
+ focusResource: $resource,
2391
+ propertyPath: $RdfVocabularies.rdf.subject,
2392
+ term: $resource.identifier,
2393
+ }).toValues())
2394
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
2395
+ .chain((values) => values.head()),
2396
+ comment: $shaclPropertyFromRdf({
2397
+ graph: _$options.graph,
2398
+ resource: $resource,
2399
+ propertySchema: Ontology.schema.properties.comment,
2400
+ typeFromRdf: (resourceValues) => resourceValues
2401
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2402
+ .chain((values) => values.chainMap((value) => value.toString()))
2403
+ .map((values) => values.length > 0
2404
+ ? values.map((value) => Maybe.of(value))
2405
+ : Resource.Values.fromValue({
2406
+ focusResource: $resource,
2407
+ propertyPath: PropertyShape.schema.properties.comment.path,
2408
+ value: Maybe.empty(),
2409
+ })),
2410
+ }),
2411
+ label: $shaclPropertyFromRdf({
2412
+ graph: _$options.graph,
2413
+ resource: $resource,
2414
+ propertySchema: Ontology.schema.properties.label,
2415
+ typeFromRdf: (resourceValues) => resourceValues
2416
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2417
+ .chain((values) => values.chainMap((value) => value.toString()))
2418
+ .map((values) => values.length > 0
2419
+ ? values.map((value) => Maybe.of(value))
2420
+ : Resource.Values.fromValue({
2421
+ focusResource: $resource,
2422
+ propertyPath: PropertyShape.schema.properties.label.path,
2423
+ value: Maybe.empty(),
2424
+ })),
2425
+ }),
2426
+ }).map((properties) => create(properties)));
2535
2427
  };
2536
2428
  Ontology.fromRdfResource = $wrap_FromRdfResourceFunction(Ontology._fromRdfResource);
2537
2429
  Ontology.fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
@@ -3318,610 +3210,507 @@ export var NodeShape;
3318
3210
  }
3319
3211
  return Left(new Error(`${$resource.identifier} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#NodeShape)`));
3320
3212
  })
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({
3213
+ : Right(true)).chain((_rdfTypeCheck) => $sequenceRecord({
3214
+ $identifier: Right(new Resource.Value({
3215
+ dataFactory: dataFactory,
3482
3216
  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
3217
+ propertyPath: $RdfVocabularies.rdf.subject,
3218
+ term: $resource.identifier,
3219
+ }).toValues())
3515
3220
  .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({
3221
+ .chain((values) => values.head()),
3222
+ and: $shaclPropertyFromRdf({
3223
+ graph: _$options.graph,
3224
+ resource: $resource,
3225
+ propertySchema: NodeShape.schema.properties.and,
3226
+ typeFromRdf: (resourceValues) => resourceValues
3227
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
3228
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
3534
3229
  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({
3230
+ propertyPath: PropertyShape.schema.properties.and.path,
3231
+ values: valueList.toArray(),
3232
+ })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
3233
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
3234
+ .map((values) => values.length > 0
3235
+ ? values.map((value) => Maybe.of(value))
3236
+ : Resource.Values.fromValue({
3237
+ focusResource: $resource,
3238
+ propertyPath: PropertyShape.schema.properties.and.path,
3239
+ value: Maybe.empty(),
3240
+ })),
3241
+ }),
3242
+ classes: $shaclPropertyFromRdf({
3545
3243
  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({
3244
+ resource: $resource,
3245
+ propertySchema: NodeShape.schema.properties.classes,
3246
+ typeFromRdf: (resourceValues) => resourceValues
3247
+ .chain((values) => values.chainMap((value) => value.toIri()))
3248
+ .map((values) => values.toArray())
3249
+ .map((valuesArray) => Resource.Values.fromValue({
3559
3250
  focusResource: $resource,
3560
- propertyPath: PropertyShape.schema
3561
- .properties.languageIn.path,
3562
- value: Maybe.empty(),
3251
+ propertyPath: PropertyShape.schema.properties.classes.path,
3252
+ value: valuesArray,
3563
3253
  })),
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({
3254
+ }),
3255
+ closed: $shaclPropertyFromRdf({
3256
+ graph: _$options.graph,
3257
+ resource: $resource,
3258
+ propertySchema: NodeShape.schema.properties.closed,
3259
+ typeFromRdf: (resourceValues) => resourceValues
3260
+ .chain((values) => values.chainMap((value) => value.toBoolean()))
3261
+ .map((values) => values.length > 0
3262
+ ? values.map((value) => Maybe.of(value))
3263
+ : Resource.Values.fromValue({
3264
+ focusResource: $resource,
3265
+ propertyPath: NodeShape.schema.properties.closed.path,
3266
+ value: Maybe.empty(),
3267
+ })),
3268
+ }),
3269
+ comment: $shaclPropertyFromRdf({
3270
+ graph: _$options.graph,
3271
+ resource: $resource,
3272
+ propertySchema: NodeShape.schema.properties.comment,
3273
+ typeFromRdf: (resourceValues) => resourceValues
3274
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
3275
+ .chain((values) => values.chainMap((value) => value.toString()))
3276
+ .map((values) => values.length > 0
3277
+ ? values.map((value) => Maybe.of(value))
3278
+ : Resource.Values.fromValue({
3279
+ focusResource: $resource,
3280
+ propertyPath: PropertyShape.schema.properties.comment.path,
3281
+ value: Maybe.empty(),
3282
+ })),
3283
+ }),
3284
+ datatype: $shaclPropertyFromRdf({
3285
+ graph: _$options.graph,
3286
+ resource: $resource,
3287
+ propertySchema: NodeShape.schema.properties.datatype,
3288
+ typeFromRdf: (resourceValues) => resourceValues
3289
+ .chain((values) => values.chainMap((value) => value.toIri()))
3290
+ .map((values) => values.length > 0
3291
+ ? values.map((value) => Maybe.of(value))
3292
+ : Resource.Values.fromValue({
3293
+ focusResource: $resource,
3294
+ propertyPath: PropertyShape.schema.properties.datatype.path,
3295
+ value: Maybe.empty(),
3296
+ })),
3297
+ }),
3298
+ deactivated: $shaclPropertyFromRdf({
3299
+ graph: _$options.graph,
3300
+ resource: $resource,
3301
+ propertySchema: NodeShape.schema.properties.deactivated,
3302
+ typeFromRdf: (resourceValues) => resourceValues
3303
+ .chain((values) => values.chainMap((value) => value.toBoolean()))
3304
+ .map((values) => values.length > 0
3305
+ ? values.map((value) => Maybe.of(value))
3306
+ : Resource.Values.fromValue({
3307
+ focusResource: $resource,
3308
+ propertyPath: PropertyShape.schema.properties.deactivated.path,
3309
+ value: Maybe.empty(),
3310
+ })),
3311
+ }),
3312
+ flags: $shaclPropertyFromRdf({
3313
+ graph: _$options.graph,
3314
+ resource: $resource,
3315
+ propertySchema: NodeShape.schema.properties.flags,
3316
+ typeFromRdf: (resourceValues) => resourceValues
3317
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
3318
+ .chain((values) => values.chainMap((value) => value.toString()))
3319
+ .map((values) => values.toArray())
3320
+ .map((valuesArray) => Resource.Values.fromValue({
3573
3321
  focusResource: $resource,
3574
- propertyPath: PropertyShape.schema
3575
- .properties.maxCount.path,
3576
- value: Maybe.empty(),
3322
+ propertyPath: PropertyShape.schema.properties.flags.path,
3323
+ value: valuesArray,
3577
3324
  })),
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({
3325
+ }),
3326
+ hasValues: $shaclPropertyFromRdf({
3327
+ graph: _$options.graph,
3328
+ resource: $resource,
3329
+ propertySchema: NodeShape.schema.properties.hasValues,
3330
+ typeFromRdf: (resourceValues) => resourceValues
3331
+ .chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
3332
+ switch (term.termType) {
3333
+ case "NamedNode":
3334
+ case "Literal":
3335
+ return Either.of(term);
3336
+ default:
3337
+ return Left(new Resource.MistypedTermValueError({
3338
+ actualValue: term,
3339
+ expectedValueType: "(NamedNode | Literal)",
3340
+ focusResource: $resource,
3341
+ propertyPath: PropertyShape.schema.properties.hasValues.path,
3342
+ }));
3343
+ }
3344
+ })))
3345
+ .map((values) => values.toArray())
3346
+ .map((valuesArray) => Resource.Values.fromValue({
3588
3347
  focusResource: $resource,
3589
- propertyPath: PropertyShape.schema
3590
- .properties.maxExclusive
3591
- .path,
3592
- value: Maybe.empty(),
3348
+ propertyPath: PropertyShape.schema.properties.hasValues.path,
3349
+ value: valuesArray,
3593
3350
  })),
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({
3351
+ }),
3352
+ ignoredProperties: $shaclPropertyFromRdf({
3353
+ graph: _$options.graph,
3354
+ resource: $resource,
3355
+ propertySchema: NodeShape.schema.properties.ignoredProperties,
3356
+ typeFromRdf: (resourceValues) => resourceValues
3357
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
3358
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
3604
3359
  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({
3360
+ propertyPath: NodeShape.schema.properties.ignoredProperties.path,
3361
+ values: valueList.toArray(),
3362
+ })).chain((values) => values.chainMap((value) => value.toIri()))))
3363
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
3364
+ .map((values) => values.length > 0
3365
+ ? values.map((value) => Maybe.of(value))
3366
+ : Resource.Values.fromValue({
3367
+ focusResource: $resource,
3368
+ propertyPath: NodeShape.schema.properties.ignoredProperties.path,
3369
+ value: Maybe.empty(),
3370
+ })),
3371
+ }),
3372
+ in_: $shaclPropertyFromRdf({
3373
+ graph: _$options.graph,
3374
+ resource: $resource,
3375
+ propertySchema: NodeShape.schema.properties.in_,
3376
+ typeFromRdf: (resourceValues) => resourceValues
3377
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
3378
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
3619
3379
  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({
3380
+ propertyPath: PropertyShape.schema.properties.in_.path,
3381
+ values: valueList.toArray(),
3382
+ })).chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
3383
+ switch (term.termType) {
3384
+ case "NamedNode":
3385
+ case "Literal":
3386
+ return Either.of(term);
3387
+ default:
3388
+ return Left(new Resource.MistypedTermValueError({
3389
+ actualValue: term,
3390
+ expectedValueType: "(NamedNode | Literal)",
3391
+ focusResource: $resource,
3392
+ propertyPath: PropertyShape.schema.properties.in_.path,
3393
+ }));
3394
+ }
3395
+ })))))
3396
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
3397
+ .map((values) => values.length > 0
3398
+ ? values.map((value) => Maybe.of(value))
3399
+ : Resource.Values.fromValue({
3400
+ focusResource: $resource,
3401
+ propertyPath: PropertyShape.schema.properties.in_.path,
3402
+ value: Maybe.empty(),
3403
+ })),
3404
+ }),
3405
+ isDefinedBy: $shaclPropertyFromRdf({
3406
+ graph: _$options.graph,
3407
+ resource: $resource,
3408
+ propertySchema: NodeShape.schema.properties.isDefinedBy,
3409
+ typeFromRdf: (resourceValues) => resourceValues
3410
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
3411
+ .map((values) => values.length > 0
3412
+ ? values.map((value) => Maybe.of(value))
3413
+ : Resource.Values.fromValue({
3414
+ focusResource: $resource,
3415
+ propertyPath: PropertyShape.schema.properties.isDefinedBy.path,
3416
+ value: Maybe.empty(),
3417
+ })),
3418
+ }),
3419
+ label: $shaclPropertyFromRdf({
3420
+ graph: _$options.graph,
3421
+ resource: $resource,
3422
+ propertySchema: NodeShape.schema.properties.label,
3423
+ typeFromRdf: (resourceValues) => resourceValues
3424
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
3425
+ .chain((values) => values.chainMap((value) => value.toString()))
3426
+ .map((values) => values.length > 0
3427
+ ? values.map((value) => Maybe.of(value))
3428
+ : Resource.Values.fromValue({
3429
+ focusResource: $resource,
3430
+ propertyPath: PropertyShape.schema.properties.label.path,
3431
+ value: Maybe.empty(),
3432
+ })),
3433
+ }),
3434
+ languageIn: $shaclPropertyFromRdf({
3435
+ graph: _$options.graph,
3436
+ resource: $resource,
3437
+ propertySchema: NodeShape.schema.properties.languageIn,
3438
+ typeFromRdf: (resourceValues) => resourceValues
3439
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
3440
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
3634
3441
  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({
3442
+ propertyPath: PropertyShape.schema.properties.languageIn.path,
3443
+ values: valueList.toArray(),
3444
+ }))
3445
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
3446
+ .chain((values) => values.chainMap((value) => value.toString()))))
3447
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
3448
+ .map((values) => values.length > 0
3449
+ ? values.map((value) => Maybe.of(value))
3450
+ : Resource.Values.fromValue({
3451
+ focusResource: $resource,
3452
+ propertyPath: PropertyShape.schema.properties.languageIn.path,
3453
+ value: Maybe.empty(),
3454
+ })),
3455
+ }),
3456
+ maxCount: $shaclPropertyFromRdf({
3457
+ graph: _$options.graph,
3458
+ resource: $resource,
3459
+ propertySchema: NodeShape.schema.properties.maxCount,
3460
+ typeFromRdf: (resourceValues) => resourceValues
3461
+ .chain((values) => values.chainMap((value) => value.toBigInt()))
3462
+ .map((values) => values.length > 0
3463
+ ? values.map((value) => Maybe.of(value))
3464
+ : Resource.Values.fromValue({
3465
+ focusResource: $resource,
3466
+ propertyPath: PropertyShape.schema.properties.maxCount.path,
3467
+ value: Maybe.empty(),
3468
+ })),
3469
+ }),
3470
+ maxExclusive: $shaclPropertyFromRdf({
3471
+ graph: _$options.graph,
3472
+ resource: $resource,
3473
+ propertySchema: NodeShape.schema.properties.maxExclusive,
3474
+ typeFromRdf: (resourceValues) => resourceValues
3475
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
3476
+ .chain((values) => values.chainMap((value) => value.toLiteral()))
3477
+ .map((values) => values.length > 0
3478
+ ? values.map((value) => Maybe.of(value))
3479
+ : Resource.Values.fromValue({
3480
+ focusResource: $resource,
3481
+ propertyPath: PropertyShape.schema.properties.maxExclusive.path,
3482
+ value: Maybe.empty(),
3483
+ })),
3484
+ }),
3485
+ maxInclusive: $shaclPropertyFromRdf({
3486
+ graph: _$options.graph,
3487
+ resource: $resource,
3488
+ propertySchema: NodeShape.schema.properties.maxInclusive,
3489
+ typeFromRdf: (resourceValues) => resourceValues
3490
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
3491
+ .chain((values) => values.chainMap((value) => value.toLiteral()))
3492
+ .map((values) => values.length > 0
3493
+ ? values.map((value) => Maybe.of(value))
3494
+ : Resource.Values.fromValue({
3495
+ focusResource: $resource,
3496
+ propertyPath: PropertyShape.schema.properties.maxInclusive.path,
3497
+ value: Maybe.empty(),
3498
+ })),
3499
+ }),
3500
+ maxLength: $shaclPropertyFromRdf({
3501
+ graph: _$options.graph,
3502
+ resource: $resource,
3503
+ propertySchema: NodeShape.schema.properties.maxLength,
3504
+ typeFromRdf: (resourceValues) => resourceValues
3505
+ .chain((values) => values.chainMap((value) => value.toBigInt()))
3506
+ .map((values) => values.length > 0
3507
+ ? values.map((value) => Maybe.of(value))
3508
+ : Resource.Values.fromValue({
3509
+ focusResource: $resource,
3510
+ propertyPath: PropertyShape.schema.properties.maxLength.path,
3511
+ value: Maybe.empty(),
3512
+ })),
3513
+ }),
3514
+ minCount: $shaclPropertyFromRdf({
3515
+ graph: _$options.graph,
3516
+ resource: $resource,
3517
+ propertySchema: NodeShape.schema.properties.minCount,
3518
+ typeFromRdf: (resourceValues) => resourceValues
3519
+ .chain((values) => values.chainMap((value) => value.toBigInt()))
3520
+ .map((values) => values.length > 0
3521
+ ? values.map((value) => Maybe.of(value))
3522
+ : Resource.Values.fromValue({
3523
+ focusResource: $resource,
3524
+ propertyPath: PropertyShape.schema.properties.minCount.path,
3525
+ value: Maybe.empty(),
3526
+ })),
3527
+ }),
3528
+ minExclusive: $shaclPropertyFromRdf({
3529
+ graph: _$options.graph,
3530
+ resource: $resource,
3531
+ propertySchema: NodeShape.schema.properties.minExclusive,
3532
+ typeFromRdf: (resourceValues) => resourceValues
3533
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
3534
+ .chain((values) => values.chainMap((value) => value.toLiteral()))
3535
+ .map((values) => values.length > 0
3536
+ ? values.map((value) => Maybe.of(value))
3537
+ : Resource.Values.fromValue({
3538
+ focusResource: $resource,
3539
+ propertyPath: PropertyShape.schema.properties.minExclusive.path,
3540
+ value: Maybe.empty(),
3541
+ })),
3542
+ }),
3543
+ minInclusive: $shaclPropertyFromRdf({
3544
+ graph: _$options.graph,
3545
+ resource: $resource,
3546
+ propertySchema: NodeShape.schema.properties.minInclusive,
3547
+ typeFromRdf: (resourceValues) => resourceValues
3548
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
3549
+ .chain((values) => values.chainMap((value) => value.toLiteral()))
3550
+ .map((values) => values.length > 0
3551
+ ? values.map((value) => Maybe.of(value))
3552
+ : Resource.Values.fromValue({
3553
+ focusResource: $resource,
3554
+ propertyPath: PropertyShape.schema.properties.minInclusive.path,
3555
+ value: Maybe.empty(),
3556
+ })),
3557
+ }),
3558
+ minLength: $shaclPropertyFromRdf({
3559
+ graph: _$options.graph,
3560
+ resource: $resource,
3561
+ propertySchema: NodeShape.schema.properties.minLength,
3562
+ typeFromRdf: (resourceValues) => resourceValues
3563
+ .chain((values) => values.chainMap((value) => value.toBigInt()))
3564
+ .map((values) => values.length > 0
3565
+ ? values.map((value) => Maybe.of(value))
3566
+ : Resource.Values.fromValue({
3567
+ focusResource: $resource,
3568
+ propertyPath: PropertyShape.schema.properties.minLength.path,
3569
+ value: Maybe.empty(),
3570
+ })),
3571
+ }),
3572
+ node: $shaclPropertyFromRdf({
3573
+ graph: _$options.graph,
3574
+ resource: $resource,
3575
+ propertySchema: NodeShape.schema.properties.node,
3576
+ typeFromRdf: (resourceValues) => resourceValues
3577
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
3578
+ .map((values) => values.length > 0
3579
+ ? values.map((value) => Maybe.of(value))
3580
+ : Resource.Values.fromValue({
3581
+ focusResource: $resource,
3582
+ propertyPath: PropertyShape.schema.properties.node.path,
3583
+ value: Maybe.empty(),
3584
+ })),
3585
+ }),
3586
+ nodeKind: $shaclPropertyFromRdf({
3587
+ graph: _$options.graph,
3588
+ resource: $resource,
3589
+ propertySchema: NodeShape.schema.properties.nodeKind,
3590
+ typeFromRdf: (resourceValues) => resourceValues
3591
+ .chain((values) => values.chainMap((value) => value.toIri([
3592
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNode"),
3593
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrIRI"),
3594
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrLiteral"),
3595
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#IRI"),
3596
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#IRIOrLiteral"),
3597
+ dataFactory.namedNode("http://www.w3.org/ns/shacl#Literal"),
3598
+ ])))
3599
+ .map((values) => values.length > 0
3600
+ ? values.map((value) => Maybe.of(value))
3601
+ : Resource.Values.fromValue({
3602
+ focusResource: $resource,
3603
+ propertyPath: PropertyShape.schema.properties.nodeKind.path,
3604
+ value: Maybe.empty(),
3605
+ })),
3606
+ }),
3607
+ not: $shaclPropertyFromRdf({
3608
+ graph: _$options.graph,
3609
+ resource: $resource,
3610
+ propertySchema: NodeShape.schema.properties.not,
3611
+ typeFromRdf: (resourceValues) => resourceValues
3612
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
3613
+ .map((values) => values.toArray())
3614
+ .map((valuesArray) => Resource.Values.fromValue({
3651
3615
  focusResource: $resource,
3652
- propertyPath: PropertyShape
3653
- .schema
3654
- .properties
3655
- .minExclusive
3656
- .path,
3657
- value: Maybe.empty(),
3616
+ propertyPath: PropertyShape.schema.properties.not.path,
3617
+ value: valuesArray,
3658
3618
  })),
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({
3619
+ }),
3620
+ or: $shaclPropertyFromRdf({
3621
+ graph: _$options.graph,
3622
+ resource: $resource,
3623
+ propertySchema: NodeShape.schema.properties.or,
3624
+ typeFromRdf: (resourceValues) => resourceValues
3625
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
3626
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
3670
3627
  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({
3628
+ propertyPath: PropertyShape.schema.properties.or.path,
3629
+ values: valueList.toArray(),
3630
+ })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
3631
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
3632
+ .map((values) => values.length > 0
3633
+ ? values.map((value) => Maybe.of(value))
3634
+ : Resource.Values.fromValue({
3635
+ focusResource: $resource,
3636
+ propertyPath: PropertyShape.schema.properties.or.path,
3637
+ value: Maybe.empty(),
3638
+ })),
3639
+ }),
3640
+ patterns: $shaclPropertyFromRdf({
3641
+ graph: _$options.graph,
3642
+ resource: $resource,
3643
+ propertySchema: NodeShape.schema.properties.patterns,
3644
+ typeFromRdf: (resourceValues) => resourceValues
3645
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
3646
+ .chain((values) => values.chainMap((value) => value.toString()))
3647
+ .map((values) => values.toArray())
3648
+ .map((valuesArray) => Resource.Values.fromValue({
3688
3649
  focusResource: $resource,
3689
- propertyPath: PropertyShape
3690
- .schema
3691
- .properties
3692
- .minLength
3693
- .path,
3694
- value: Maybe.empty(),
3650
+ propertyPath: PropertyShape.schema.properties.patterns.path,
3651
+ value: valuesArray,
3695
3652
  })),
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({
3653
+ }),
3654
+ properties: $shaclPropertyFromRdf({
3655
+ graph: _$options.graph,
3656
+ resource: $resource,
3657
+ propertySchema: NodeShape.schema.properties.properties,
3658
+ typeFromRdf: (resourceValues) => resourceValues
3659
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
3660
+ .map((values) => values.toArray())
3661
+ .map((valuesArray) => Resource.Values.fromValue({
3705
3662
  focusResource: $resource,
3706
- propertyPath: PropertyShape
3707
- .schema
3708
- .properties
3709
- .node
3710
- .path,
3711
- value: Maybe.empty(),
3663
+ propertyPath: NodeShape.schema.properties.properties.path,
3664
+ value: valuesArray,
3712
3665
  })),
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({
3666
+ }),
3667
+ subClassOf: $shaclPropertyFromRdf({
3668
+ graph: _$options.graph,
3669
+ resource: $resource,
3670
+ propertySchema: NodeShape.schema.properties.subClassOf,
3671
+ typeFromRdf: (resourceValues) => resourceValues
3672
+ .chain((values) => values.chainMap((value) => value.toIri()))
3673
+ .map((values) => values.toArray())
3674
+ .map((valuesArray) => Resource.Values.fromValue({
3730
3675
  focusResource: $resource,
3731
- propertyPath: PropertyShape
3732
- .schema
3733
- .properties
3734
- .nodeKind
3735
- .path,
3736
- value: Maybe.empty(),
3676
+ propertyPath: NodeShape.schema.properties.subClassOf.path,
3677
+ value: valuesArray,
3737
3678
  })),
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({
3679
+ }),
3680
+ types: $shaclPropertyFromRdf({
3763
3681
  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({
3682
+ resource: $resource,
3683
+ propertySchema: NodeShape.schema.properties.types,
3684
+ typeFromRdf: (resourceValues) => resourceValues
3685
+ .chain((values) => values.chainMap((value) => value.toIri()))
3686
+ .map((values) => values.toArray())
3687
+ .map((valuesArray) => Resource.Values.fromValue({
3779
3688
  focusResource: $resource,
3780
- propertyPath: PropertyShape
3781
- .schema
3782
- .properties
3783
- .or
3784
- .path,
3785
- value: Maybe.empty(),
3689
+ propertyPath: NodeShape.schema.properties.types.path,
3690
+ value: valuesArray,
3786
3691
  })),
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({
3692
+ }),
3693
+ xone: $shaclPropertyFromRdf({
3868
3694
  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({
3695
+ resource: $resource,
3696
+ propertySchema: NodeShape.schema.properties.xone,
3697
+ typeFromRdf: (resourceValues) => resourceValues
3698
+ .chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
3699
+ .chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
3884
3700
  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
- })))))))))))))))))))))))))))))))));
3701
+ propertyPath: PropertyShape.schema.properties.xone.path,
3702
+ values: valueList.toArray(),
3703
+ })).chain((values) => values.chainMap((value) => value.toIdentifier()))))
3704
+ .map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
3705
+ .map((values) => values.length > 0
3706
+ ? values.map((value) => Maybe.of(value))
3707
+ : Resource.Values.fromValue({
3708
+ focusResource: $resource,
3709
+ propertyPath: PropertyShape.schema.properties.xone.path,
3710
+ value: Maybe.empty(),
3711
+ })),
3712
+ }),
3713
+ }).map((properties) => create(properties)));
3925
3714
  };
3926
3715
  NodeShape.fromRdfResource = $wrap_FromRdfResourceFunction(NodeShape._fromRdfResource);
3927
3716
  NodeShape.fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value