@shaclmate/shacl-ast 4.0.30 → 4.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generated.d.ts +34 -99
- package/dist/generated.js +350 -403
- package/package.json +1 -1
package/dist/generated.js
CHANGED
|
@@ -244,6 +244,41 @@ var $RdfVocabularies;
|
|
|
244
244
|
function $shaclPropertyFromRdf({ graph, propertySchema, resource, typeFromRdf, }) {
|
|
245
245
|
return typeFromRdf(Right(resource.values(propertySchema.path, { graph, unique: true }))).chain((values) => values.head());
|
|
246
246
|
}
|
|
247
|
+
function $wrap_FromRdfResourceFunction(_fromRdfResourceFunction) {
|
|
248
|
+
return (resource, options) => {
|
|
249
|
+
let { context, graph, ignoreRdfType = false, objectSet, preferredLanguages, } = options ?? {};
|
|
250
|
+
if (!objectSet) {
|
|
251
|
+
objectSet = new $RdfjsDatasetObjectSet(resource.dataset);
|
|
252
|
+
}
|
|
253
|
+
return _fromRdfResourceFunction(resource, {
|
|
254
|
+
context,
|
|
255
|
+
graph,
|
|
256
|
+
ignoreRdfType,
|
|
257
|
+
objectSet,
|
|
258
|
+
preferredLanguages,
|
|
259
|
+
});
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
function $wrap_ToRdfResourceFunction(_toRdfResourceFunction) {
|
|
263
|
+
return (object, options) => {
|
|
264
|
+
let { graph, ignoreRdfType = false, resourceSet } = options ?? {};
|
|
265
|
+
if (!resourceSet) {
|
|
266
|
+
resourceSet = new ResourceSet({
|
|
267
|
+
dataFactory: dataFactory,
|
|
268
|
+
dataset: datasetFactory.dataset(),
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
const resource = resourceSet.resource(object.$identifier());
|
|
272
|
+
_toRdfResourceFunction({
|
|
273
|
+
graph,
|
|
274
|
+
ignoreRdfType,
|
|
275
|
+
object,
|
|
276
|
+
resource,
|
|
277
|
+
resourceSet,
|
|
278
|
+
});
|
|
279
|
+
return resource;
|
|
280
|
+
};
|
|
281
|
+
}
|
|
247
282
|
export var PropertyShape;
|
|
248
283
|
(function (PropertyShape) {
|
|
249
284
|
function create(parameters) {
|
|
@@ -977,33 +1012,7 @@ export var PropertyShape;
|
|
|
977
1012
|
return true;
|
|
978
1013
|
}
|
|
979
1014
|
PropertyShape.filter = filter;
|
|
980
|
-
PropertyShape.
|
|
981
|
-
let { context, graph, ignoreRdfType = false, objectSet, preferredLanguages, } = options ?? {};
|
|
982
|
-
if (!objectSet) {
|
|
983
|
-
objectSet = new $RdfjsDatasetObjectSet(resource.dataset);
|
|
984
|
-
}
|
|
985
|
-
return PropertyShape.propertiesFromRdfResource(resource, {
|
|
986
|
-
context,
|
|
987
|
-
graph,
|
|
988
|
-
ignoreRdfType,
|
|
989
|
-
objectSet,
|
|
990
|
-
preferredLanguages,
|
|
991
|
-
}).map(create);
|
|
992
|
-
};
|
|
993
|
-
PropertyShape.fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
|
|
994
|
-
.toResource()
|
|
995
|
-
.chain((resource) => PropertyShape.fromRdfResource(resource, options))));
|
|
996
|
-
PropertyShape.fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape");
|
|
997
|
-
function isPropertyShape(object) {
|
|
998
|
-
switch (object.$type) {
|
|
999
|
-
case "PropertyShape":
|
|
1000
|
-
return true;
|
|
1001
|
-
default:
|
|
1002
|
-
return false;
|
|
1003
|
-
}
|
|
1004
|
-
}
|
|
1005
|
-
PropertyShape.isPropertyShape = isPropertyShape;
|
|
1006
|
-
PropertyShape.propertiesFromRdfResource = ($resource, _$options) => {
|
|
1015
|
+
PropertyShape._fromRdfResource = ($resource, _$options) => {
|
|
1007
1016
|
return (!_$options.ignoreRdfType
|
|
1008
1017
|
? $resource
|
|
1009
1018
|
.value($RdfVocabularies.rdf.type, { graph: _$options.graph })
|
|
@@ -1030,7 +1039,7 @@ export var PropertyShape;
|
|
|
1030
1039
|
}).toValues())
|
|
1031
1040
|
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
1032
1041
|
.chain((values) => values.head())
|
|
1033
|
-
.chain(($identifier) =>
|
|
1042
|
+
.chain(($identifier) => $shaclPropertyFromRdf({
|
|
1034
1043
|
graph: _$options.graph,
|
|
1035
1044
|
resource: $resource,
|
|
1036
1045
|
propertySchema: PropertyShape.schema.properties.and,
|
|
@@ -1126,8 +1135,8 @@ export var PropertyShape;
|
|
|
1126
1135
|
? values.map((value) => Maybe.of(value))
|
|
1127
1136
|
: Resource.Values.fromValue({
|
|
1128
1137
|
focusResource: $resource,
|
|
1129
|
-
propertyPath: PropertyShape.schema.properties
|
|
1130
|
-
.
|
|
1138
|
+
propertyPath: PropertyShape.schema.properties.defaultValue
|
|
1139
|
+
.path,
|
|
1131
1140
|
value: Maybe.empty(),
|
|
1132
1141
|
})),
|
|
1133
1142
|
}).chain((defaultValue) => $shaclPropertyFromRdf({
|
|
@@ -1155,8 +1164,7 @@ export var PropertyShape;
|
|
|
1155
1164
|
.map((values) => values.toArray())
|
|
1156
1165
|
.map((valuesArray) => Resource.Values.fromValue({
|
|
1157
1166
|
focusResource: $resource,
|
|
1158
|
-
propertyPath: PropertyShape.schema.properties.flags
|
|
1159
|
-
.path,
|
|
1167
|
+
propertyPath: PropertyShape.schema.properties.flags.path,
|
|
1160
1168
|
value: valuesArray,
|
|
1161
1169
|
})),
|
|
1162
1170
|
}).chain((flags) => $shaclPropertyFromRdf({
|
|
@@ -1248,9 +1256,8 @@ export var PropertyShape;
|
|
|
1248
1256
|
? values.map((value) => Maybe.of(value))
|
|
1249
1257
|
: Resource.Values.fromValue({
|
|
1250
1258
|
focusResource: $resource,
|
|
1251
|
-
propertyPath: PropertyShape.schema
|
|
1252
|
-
.
|
|
1253
|
-
.path,
|
|
1259
|
+
propertyPath: PropertyShape.schema.properties
|
|
1260
|
+
.isDefinedBy.path,
|
|
1254
1261
|
value: Maybe.empty(),
|
|
1255
1262
|
})),
|
|
1256
1263
|
}).chain((isDefinedBy) => $shaclPropertyFromRdf({
|
|
@@ -1339,8 +1346,7 @@ export var PropertyShape;
|
|
|
1339
1346
|
focusResource: $resource,
|
|
1340
1347
|
propertyPath: PropertyShape.schema
|
|
1341
1348
|
.properties
|
|
1342
|
-
.maxInclusive
|
|
1343
|
-
.path,
|
|
1349
|
+
.maxInclusive.path,
|
|
1344
1350
|
value: Maybe.empty(),
|
|
1345
1351
|
})),
|
|
1346
1352
|
}).chain((maxInclusive) => $shaclPropertyFromRdf({
|
|
@@ -1353,8 +1359,7 @@ export var PropertyShape;
|
|
|
1353
1359
|
? values.map((value) => Maybe.of(value))
|
|
1354
1360
|
: Resource.Values.fromValue({
|
|
1355
1361
|
focusResource: $resource,
|
|
1356
|
-
propertyPath: PropertyShape
|
|
1357
|
-
.schema
|
|
1362
|
+
propertyPath: PropertyShape.schema
|
|
1358
1363
|
.properties
|
|
1359
1364
|
.maxLength.path,
|
|
1360
1365
|
value: Maybe.empty(),
|
|
@@ -1372,8 +1377,7 @@ export var PropertyShape;
|
|
|
1372
1377
|
propertyPath: PropertyShape
|
|
1373
1378
|
.schema
|
|
1374
1379
|
.properties
|
|
1375
|
-
.minCount
|
|
1376
|
-
.path,
|
|
1380
|
+
.minCount.path,
|
|
1377
1381
|
value: Maybe.empty(),
|
|
1378
1382
|
})),
|
|
1379
1383
|
}).chain((minCount) => $shaclPropertyFromRdf({
|
|
@@ -1440,8 +1444,7 @@ export var PropertyShape;
|
|
|
1440
1444
|
typeFromRdf: (resourceValues) => resourceValues
|
|
1441
1445
|
.chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
|
|
1442
1446
|
.chain((values) => values.chainMap((value) => value.toString()))
|
|
1443
|
-
.map((values) => values.length >
|
|
1444
|
-
0
|
|
1447
|
+
.map((values) => values.length > 0
|
|
1445
1448
|
? values.map((value) => Maybe.of(value))
|
|
1446
1449
|
: Resource.Values.fromValue({
|
|
1447
1450
|
focusResource: $resource,
|
|
@@ -1455,8 +1458,7 @@ export var PropertyShape;
|
|
|
1455
1458
|
}).chain((name) => $shaclPropertyFromRdf({
|
|
1456
1459
|
graph: _$options.graph,
|
|
1457
1460
|
resource: $resource,
|
|
1458
|
-
propertySchema: PropertyShape.schema
|
|
1459
|
-
.properties
|
|
1461
|
+
propertySchema: PropertyShape.schema.properties
|
|
1460
1462
|
.node,
|
|
1461
1463
|
typeFromRdf: (resourceValues) => resourceValues
|
|
1462
1464
|
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
@@ -1659,9 +1661,8 @@ export var PropertyShape;
|
|
|
1659
1661
|
.path,
|
|
1660
1662
|
value: Maybe.empty(),
|
|
1661
1663
|
})),
|
|
1662
|
-
}).map((xone) => ({
|
|
1664
|
+
}).map((xone) => create({
|
|
1663
1665
|
$identifier,
|
|
1664
|
-
$type,
|
|
1665
1666
|
and,
|
|
1666
1667
|
classes,
|
|
1667
1668
|
comment,
|
|
@@ -1694,8 +1695,22 @@ export var PropertyShape;
|
|
|
1694
1695
|
patterns,
|
|
1695
1696
|
uniqueLang,
|
|
1696
1697
|
xone,
|
|
1697
|
-
})))))))))))))))))))))))))))))))))))
|
|
1698
|
+
})))))))))))))))))))))))))))))))))));
|
|
1698
1699
|
};
|
|
1700
|
+
PropertyShape.fromRdfResource = $wrap_FromRdfResourceFunction(PropertyShape._fromRdfResource);
|
|
1701
|
+
PropertyShape.fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
|
|
1702
|
+
.toResource()
|
|
1703
|
+
.chain((resource) => PropertyShape.fromRdfResource(resource, options))));
|
|
1704
|
+
PropertyShape.fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape");
|
|
1705
|
+
function isPropertyShape(object) {
|
|
1706
|
+
switch (object.$type) {
|
|
1707
|
+
case "PropertyShape":
|
|
1708
|
+
return true;
|
|
1709
|
+
default:
|
|
1710
|
+
return false;
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
PropertyShape.isPropertyShape = isPropertyShape;
|
|
1699
1714
|
PropertyShape.schema = {
|
|
1700
1715
|
properties: {
|
|
1701
1716
|
$identifier: {
|
|
@@ -1989,198 +2004,194 @@ export var PropertyShape;
|
|
|
1989
2004
|
},
|
|
1990
2005
|
},
|
|
1991
2006
|
};
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
dataFactory: dataFactory,
|
|
1996
|
-
dataset: datasetFactory.dataset(),
|
|
1997
|
-
});
|
|
1998
|
-
const resource = resourceSet.resource(_propertyShape.$identifier());
|
|
1999
|
-
if (!options?.ignoreRdfType) {
|
|
2000
|
-
resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"), options?.graph);
|
|
2007
|
+
PropertyShape._toRdfResource = (parameters) => {
|
|
2008
|
+
if (!parameters.ignoreRdfType) {
|
|
2009
|
+
parameters.resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"), parameters.graph);
|
|
2001
2010
|
}
|
|
2002
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#and"),
|
|
2011
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#and"), parameters.object.and.toList().flatMap((value) => [
|
|
2003
2012
|
value.length > 0
|
|
2004
2013
|
? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
2005
2014
|
if (itemIndex === 0) {
|
|
2006
2015
|
currentSubListResource = listResource;
|
|
2007
2016
|
}
|
|
2008
2017
|
else {
|
|
2009
|
-
const newSubListResource = resourceSet.resource((() => dataFactory.blankNode())());
|
|
2010
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier,
|
|
2018
|
+
const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
|
|
2019
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
|
|
2011
2020
|
currentSubListResource = newSubListResource;
|
|
2012
2021
|
}
|
|
2013
|
-
currentSubListResource.add($RdfVocabularies.rdf.first, [item],
|
|
2022
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
|
|
2014
2023
|
if (itemIndex + 1 === list.length) {
|
|
2015
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil,
|
|
2024
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
|
|
2016
2025
|
}
|
|
2017
2026
|
return { currentSubListResource, listResource };
|
|
2018
2027
|
}, {
|
|
2019
2028
|
currentSubListResource: null,
|
|
2020
|
-
listResource: resourceSet.resource((() => dataFactory.blankNode())()),
|
|
2029
|
+
listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
|
|
2021
2030
|
}).listResource.identifier
|
|
2022
2031
|
: $RdfVocabularies.rdf.nil,
|
|
2023
|
-
]),
|
|
2024
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#class"),
|
|
2025
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
|
|
2032
|
+
]), parameters.graph);
|
|
2033
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#class"), parameters.object.classes.flatMap((item) => [item]), parameters.graph);
|
|
2034
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), parameters.object.comment
|
|
2026
2035
|
.toList()
|
|
2027
|
-
.flatMap((value) => [$literalFactory.string(value)]),
|
|
2028
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#datatype"),
|
|
2029
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"),
|
|
2036
|
+
.flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
|
|
2037
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#datatype"), parameters.object.datatype.toList(), parameters.graph);
|
|
2038
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"), parameters.object.deactivated
|
|
2030
2039
|
.toList()
|
|
2031
2040
|
.flatMap((value) => [
|
|
2032
2041
|
$literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
|
|
2033
|
-
]),
|
|
2034
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#defaultValue"),
|
|
2035
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#description"),
|
|
2042
|
+
]), parameters.graph);
|
|
2043
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#defaultValue"), parameters.object.defaultValue.toList(), parameters.graph);
|
|
2044
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#description"), parameters.object.description
|
|
2036
2045
|
.toList()
|
|
2037
|
-
.flatMap((value) => [$literalFactory.string(value)]),
|
|
2038
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#flags"),
|
|
2039
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#group"),
|
|
2040
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#hasValue"),
|
|
2041
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#in"),
|
|
2046
|
+
.flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
|
|
2047
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#flags"), parameters.object.flags.flatMap((item) => [$literalFactory.string(item)]), parameters.graph);
|
|
2048
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#group"), parameters.object.groups.flatMap((item) => [item]), parameters.graph);
|
|
2049
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#hasValue"), parameters.object.hasValues.flatMap((item) => [item]), parameters.graph);
|
|
2050
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#in"), parameters.object.in_.toList().flatMap((value) => [
|
|
2042
2051
|
value.length > 0
|
|
2043
2052
|
? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
2044
2053
|
if (itemIndex === 0) {
|
|
2045
2054
|
currentSubListResource = listResource;
|
|
2046
2055
|
}
|
|
2047
2056
|
else {
|
|
2048
|
-
const newSubListResource = resourceSet.resource((() => dataFactory.blankNode())());
|
|
2049
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier,
|
|
2057
|
+
const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
|
|
2058
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
|
|
2050
2059
|
currentSubListResource = newSubListResource;
|
|
2051
2060
|
}
|
|
2052
|
-
currentSubListResource.add($RdfVocabularies.rdf.first, [item],
|
|
2061
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
|
|
2053
2062
|
if (itemIndex + 1 === list.length) {
|
|
2054
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil,
|
|
2063
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
|
|
2055
2064
|
}
|
|
2056
2065
|
return { currentSubListResource, listResource };
|
|
2057
2066
|
}, {
|
|
2058
2067
|
currentSubListResource: null,
|
|
2059
|
-
listResource: resourceSet.resource((() => dataFactory.blankNode())()),
|
|
2068
|
+
listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
|
|
2060
2069
|
}).listResource.identifier
|
|
2061
2070
|
: $RdfVocabularies.rdf.nil,
|
|
2062
|
-
]),
|
|
2063
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"),
|
|
2064
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
|
|
2071
|
+
]), parameters.graph);
|
|
2072
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"), parameters.object.isDefinedBy.toList(), parameters.graph);
|
|
2073
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), parameters.object.label
|
|
2065
2074
|
.toList()
|
|
2066
|
-
.flatMap((value) => [$literalFactory.string(value)]),
|
|
2067
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#languageIn"),
|
|
2075
|
+
.flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
|
|
2076
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#languageIn"), parameters.object.languageIn.toList().flatMap((value) => [
|
|
2068
2077
|
value.length > 0
|
|
2069
2078
|
? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
2070
2079
|
if (itemIndex === 0) {
|
|
2071
2080
|
currentSubListResource = listResource;
|
|
2072
2081
|
}
|
|
2073
2082
|
else {
|
|
2074
|
-
const newSubListResource = resourceSet.resource((() => dataFactory.blankNode())());
|
|
2075
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier,
|
|
2083
|
+
const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
|
|
2084
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
|
|
2076
2085
|
currentSubListResource = newSubListResource;
|
|
2077
2086
|
}
|
|
2078
|
-
currentSubListResource.add($RdfVocabularies.rdf.first, [$literalFactory.string(item)],
|
|
2087
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, [$literalFactory.string(item)], parameters.graph);
|
|
2079
2088
|
if (itemIndex + 1 === list.length) {
|
|
2080
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil,
|
|
2089
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
|
|
2081
2090
|
}
|
|
2082
2091
|
return { currentSubListResource, listResource };
|
|
2083
2092
|
}, {
|
|
2084
2093
|
currentSubListResource: null,
|
|
2085
|
-
listResource: resourceSet.resource((() => dataFactory.blankNode())()),
|
|
2094
|
+
listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
|
|
2086
2095
|
}).listResource.identifier
|
|
2087
2096
|
: $RdfVocabularies.rdf.nil,
|
|
2088
|
-
]),
|
|
2089
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxCount"),
|
|
2097
|
+
]), parameters.graph);
|
|
2098
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxCount"), parameters.object.maxCount
|
|
2090
2099
|
.toList()
|
|
2091
2100
|
.flatMap((value) => [
|
|
2092
2101
|
$literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
|
|
2093
|
-
]),
|
|
2094
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxExclusive"),
|
|
2095
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxInclusive"),
|
|
2096
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxLength"),
|
|
2102
|
+
]), parameters.graph);
|
|
2103
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxExclusive"), parameters.object.maxExclusive.toList(), parameters.graph);
|
|
2104
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxInclusive"), parameters.object.maxInclusive.toList(), parameters.graph);
|
|
2105
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxLength"), parameters.object.maxLength
|
|
2097
2106
|
.toList()
|
|
2098
2107
|
.flatMap((value) => [
|
|
2099
2108
|
$literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
|
|
2100
|
-
]),
|
|
2101
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minCount"),
|
|
2109
|
+
]), parameters.graph);
|
|
2110
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minCount"), parameters.object.minCount
|
|
2102
2111
|
.toList()
|
|
2103
2112
|
.flatMap((value) => [
|
|
2104
2113
|
$literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
|
|
2105
|
-
]),
|
|
2106
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minExclusive"),
|
|
2107
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minInclusive"),
|
|
2108
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minLength"),
|
|
2114
|
+
]), parameters.graph);
|
|
2115
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minExclusive"), parameters.object.minExclusive.toList(), parameters.graph);
|
|
2116
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minInclusive"), parameters.object.minInclusive.toList(), parameters.graph);
|
|
2117
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minLength"), parameters.object.minLength
|
|
2109
2118
|
.toList()
|
|
2110
2119
|
.flatMap((value) => [
|
|
2111
2120
|
$literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
|
|
2112
|
-
]),
|
|
2113
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#name"),
|
|
2121
|
+
]), parameters.graph);
|
|
2122
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#name"), parameters.object.name
|
|
2114
2123
|
.toList()
|
|
2115
|
-
.flatMap((value) => [$literalFactory.string(value)]),
|
|
2116
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#node"),
|
|
2117
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"),
|
|
2118
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#not"),
|
|
2119
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#or"),
|
|
2124
|
+
.flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
|
|
2125
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#node"), parameters.object.node.toList(), parameters.graph);
|
|
2126
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"), parameters.object.nodeKind.toList(), parameters.graph);
|
|
2127
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#not"), parameters.object.not.flatMap((item) => [item]), parameters.graph);
|
|
2128
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#or"), parameters.object.or.toList().flatMap((value) => [
|
|
2120
2129
|
value.length > 0
|
|
2121
2130
|
? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
2122
2131
|
if (itemIndex === 0) {
|
|
2123
2132
|
currentSubListResource = listResource;
|
|
2124
2133
|
}
|
|
2125
2134
|
else {
|
|
2126
|
-
const newSubListResource = resourceSet.resource((() => dataFactory.blankNode())());
|
|
2127
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier,
|
|
2135
|
+
const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
|
|
2136
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
|
|
2128
2137
|
currentSubListResource = newSubListResource;
|
|
2129
2138
|
}
|
|
2130
|
-
currentSubListResource.add($RdfVocabularies.rdf.first, [item],
|
|
2139
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
|
|
2131
2140
|
if (itemIndex + 1 === list.length) {
|
|
2132
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil,
|
|
2141
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
|
|
2133
2142
|
}
|
|
2134
2143
|
return { currentSubListResource, listResource };
|
|
2135
2144
|
}, {
|
|
2136
2145
|
currentSubListResource: null,
|
|
2137
|
-
listResource: resourceSet.resource((() => dataFactory.blankNode())()),
|
|
2146
|
+
listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
|
|
2138
2147
|
}).listResource.identifier
|
|
2139
2148
|
: $RdfVocabularies.rdf.nil,
|
|
2140
|
-
]),
|
|
2141
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#order"),
|
|
2149
|
+
]), parameters.graph);
|
|
2150
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#order"), parameters.object.order
|
|
2142
2151
|
.toList()
|
|
2143
2152
|
.flatMap((value) => [
|
|
2144
2153
|
$literalFactory.number(value, $RdfVocabularies.xsd.double),
|
|
2145
|
-
]),
|
|
2146
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#path"), [
|
|
2147
|
-
$PropertyPath.toRdfResource(
|
|
2148
|
-
graph:
|
|
2149
|
-
resourceSet: resourceSet,
|
|
2154
|
+
]), parameters.graph);
|
|
2155
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#path"), [
|
|
2156
|
+
$PropertyPath.toRdfResource(parameters.object.path, {
|
|
2157
|
+
graph: parameters.graph,
|
|
2158
|
+
resourceSet: parameters.resourceSet,
|
|
2150
2159
|
}).identifier,
|
|
2151
|
-
],
|
|
2152
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#pattern"),
|
|
2153
|
-
|
|
2160
|
+
], parameters.graph);
|
|
2161
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#pattern"), parameters.object.patterns.flatMap((item) => [
|
|
2162
|
+
$literalFactory.string(item),
|
|
2163
|
+
]), parameters.graph);
|
|
2164
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#uniqueLang"), parameters.object.uniqueLang
|
|
2154
2165
|
.toList()
|
|
2155
2166
|
.flatMap((value) => [
|
|
2156
2167
|
$literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
|
|
2157
|
-
]),
|
|
2158
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#xone"),
|
|
2168
|
+
]), parameters.graph);
|
|
2169
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#xone"), parameters.object.xone.toList().flatMap((value) => [
|
|
2159
2170
|
value.length > 0
|
|
2160
2171
|
? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
2161
2172
|
if (itemIndex === 0) {
|
|
2162
2173
|
currentSubListResource = listResource;
|
|
2163
2174
|
}
|
|
2164
2175
|
else {
|
|
2165
|
-
const newSubListResource = resourceSet.resource((() => dataFactory.blankNode())());
|
|
2166
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier,
|
|
2176
|
+
const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
|
|
2177
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
|
|
2167
2178
|
currentSubListResource = newSubListResource;
|
|
2168
2179
|
}
|
|
2169
|
-
currentSubListResource.add($RdfVocabularies.rdf.first, [item],
|
|
2180
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
|
|
2170
2181
|
if (itemIndex + 1 === list.length) {
|
|
2171
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil,
|
|
2182
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
|
|
2172
2183
|
}
|
|
2173
2184
|
return { currentSubListResource, listResource };
|
|
2174
2185
|
}, {
|
|
2175
2186
|
currentSubListResource: null,
|
|
2176
|
-
listResource: resourceSet.resource((() => dataFactory.blankNode())()),
|
|
2187
|
+
listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
|
|
2177
2188
|
}).listResource.identifier
|
|
2178
2189
|
: $RdfVocabularies.rdf.nil,
|
|
2179
|
-
]),
|
|
2180
|
-
return resource;
|
|
2181
|
-
}
|
|
2182
|
-
PropertyShape.toRdfResource =
|
|
2183
|
-
function
|
|
2190
|
+
]), parameters.graph);
|
|
2191
|
+
return parameters.resource;
|
|
2192
|
+
};
|
|
2193
|
+
PropertyShape.toRdfResource = $wrap_ToRdfResourceFunction(PropertyShape._toRdfResource);
|
|
2194
|
+
function _propertiesToStrings(_propertyShape) {
|
|
2184
2195
|
return $compactRecord({
|
|
2185
2196
|
$identifier: _propertyShape.$identifier().toString(),
|
|
2186
2197
|
label: _propertyShape.label.map((item) => item.toString()).extract(),
|
|
@@ -2188,9 +2199,9 @@ export var PropertyShape;
|
|
|
2188
2199
|
path: $PropertyPath.$toString(_propertyShape.path),
|
|
2189
2200
|
});
|
|
2190
2201
|
}
|
|
2191
|
-
PropertyShape.
|
|
2202
|
+
PropertyShape._propertiesToStrings = _propertiesToStrings;
|
|
2192
2203
|
function $toString(_propertyShape) {
|
|
2193
|
-
return `PropertyShape(${JSON.stringify(
|
|
2204
|
+
return `PropertyShape(${JSON.stringify(_propertiesToStrings((_propertyShape ?? this)))})`;
|
|
2194
2205
|
}
|
|
2195
2206
|
PropertyShape.$toString = $toString;
|
|
2196
2207
|
})(PropertyShape || (PropertyShape = {}));
|
|
@@ -2266,33 +2277,7 @@ export var PropertyGroup;
|
|
|
2266
2277
|
return true;
|
|
2267
2278
|
}
|
|
2268
2279
|
PropertyGroup.filter = filter;
|
|
2269
|
-
PropertyGroup.
|
|
2270
|
-
let { context, graph, ignoreRdfType = false, objectSet, preferredLanguages, } = options ?? {};
|
|
2271
|
-
if (!objectSet) {
|
|
2272
|
-
objectSet = new $RdfjsDatasetObjectSet(resource.dataset);
|
|
2273
|
-
}
|
|
2274
|
-
return PropertyGroup.propertiesFromRdfResource(resource, {
|
|
2275
|
-
context,
|
|
2276
|
-
graph,
|
|
2277
|
-
ignoreRdfType,
|
|
2278
|
-
objectSet,
|
|
2279
|
-
preferredLanguages,
|
|
2280
|
-
}).map(create);
|
|
2281
|
-
};
|
|
2282
|
-
PropertyGroup.fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
|
|
2283
|
-
.toResource()
|
|
2284
|
-
.chain((resource) => PropertyGroup.fromRdfResource(resource, options))));
|
|
2285
|
-
PropertyGroup.fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup");
|
|
2286
|
-
function isPropertyGroup(object) {
|
|
2287
|
-
switch (object.$type) {
|
|
2288
|
-
case "PropertyGroup":
|
|
2289
|
-
return true;
|
|
2290
|
-
default:
|
|
2291
|
-
return false;
|
|
2292
|
-
}
|
|
2293
|
-
}
|
|
2294
|
-
PropertyGroup.isPropertyGroup = isPropertyGroup;
|
|
2295
|
-
PropertyGroup.propertiesFromRdfResource = ($resource, _$options) => {
|
|
2280
|
+
PropertyGroup._fromRdfResource = ($resource, _$options) => {
|
|
2296
2281
|
return (!_$options.ignoreRdfType
|
|
2297
2282
|
? $resource
|
|
2298
2283
|
.value($RdfVocabularies.rdf.type, { graph: _$options.graph })
|
|
@@ -2319,7 +2304,7 @@ export var PropertyGroup;
|
|
|
2319
2304
|
}).toValues())
|
|
2320
2305
|
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
2321
2306
|
.chain((values) => values.head())
|
|
2322
|
-
.chain(($identifier) =>
|
|
2307
|
+
.chain(($identifier) => $shaclPropertyFromRdf({
|
|
2323
2308
|
graph: _$options.graph,
|
|
2324
2309
|
resource: $resource,
|
|
2325
2310
|
propertySchema: PropertyGroup.schema.properties.comment,
|
|
@@ -2347,8 +2332,22 @@ export var PropertyGroup;
|
|
|
2347
2332
|
propertyPath: PropertyShape.schema.properties.label.path,
|
|
2348
2333
|
value: Maybe.empty(),
|
|
2349
2334
|
})),
|
|
2350
|
-
}).map((label) => ({ $identifier,
|
|
2335
|
+
}).map((label) => create({ $identifier, comment, label })))));
|
|
2351
2336
|
};
|
|
2337
|
+
PropertyGroup.fromRdfResource = $wrap_FromRdfResourceFunction(PropertyGroup._fromRdfResource);
|
|
2338
|
+
PropertyGroup.fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
|
|
2339
|
+
.toResource()
|
|
2340
|
+
.chain((resource) => PropertyGroup.fromRdfResource(resource, options))));
|
|
2341
|
+
PropertyGroup.fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup");
|
|
2342
|
+
function isPropertyGroup(object) {
|
|
2343
|
+
switch (object.$type) {
|
|
2344
|
+
case "PropertyGroup":
|
|
2345
|
+
return true;
|
|
2346
|
+
default:
|
|
2347
|
+
return false;
|
|
2348
|
+
}
|
|
2349
|
+
}
|
|
2350
|
+
PropertyGroup.isPropertyGroup = isPropertyGroup;
|
|
2352
2351
|
PropertyGroup.schema = {
|
|
2353
2352
|
properties: {
|
|
2354
2353
|
$identifier: {
|
|
@@ -2380,34 +2379,28 @@ export var PropertyGroup;
|
|
|
2380
2379
|
},
|
|
2381
2380
|
},
|
|
2382
2381
|
};
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
dataFactory: dataFactory,
|
|
2387
|
-
dataset: datasetFactory.dataset(),
|
|
2388
|
-
});
|
|
2389
|
-
const resource = resourceSet.resource(_propertyGroup.$identifier());
|
|
2390
|
-
if (!options?.ignoreRdfType) {
|
|
2391
|
-
resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup"), options?.graph);
|
|
2382
|
+
PropertyGroup._toRdfResource = (parameters) => {
|
|
2383
|
+
if (!parameters.ignoreRdfType) {
|
|
2384
|
+
parameters.resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup"), parameters.graph);
|
|
2392
2385
|
}
|
|
2393
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
|
|
2386
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), parameters.object.comment
|
|
2394
2387
|
.toList()
|
|
2395
|
-
.flatMap((value) => [$literalFactory.string(value)]),
|
|
2396
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
|
|
2388
|
+
.flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
|
|
2389
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), parameters.object.label
|
|
2397
2390
|
.toList()
|
|
2398
|
-
.flatMap((value) => [$literalFactory.string(value)]),
|
|
2399
|
-
return resource;
|
|
2400
|
-
}
|
|
2401
|
-
PropertyGroup.toRdfResource =
|
|
2402
|
-
function
|
|
2391
|
+
.flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
|
|
2392
|
+
return parameters.resource;
|
|
2393
|
+
};
|
|
2394
|
+
PropertyGroup.toRdfResource = $wrap_ToRdfResourceFunction(PropertyGroup._toRdfResource);
|
|
2395
|
+
function _propertiesToStrings(_propertyGroup) {
|
|
2403
2396
|
return $compactRecord({
|
|
2404
2397
|
$identifier: _propertyGroup.$identifier().toString(),
|
|
2405
2398
|
label: _propertyGroup.label.map((item) => item.toString()).extract(),
|
|
2406
2399
|
});
|
|
2407
2400
|
}
|
|
2408
|
-
PropertyGroup.
|
|
2401
|
+
PropertyGroup._propertiesToStrings = _propertiesToStrings;
|
|
2409
2402
|
function $toString(_propertyGroup) {
|
|
2410
|
-
return `PropertyGroup(${JSON.stringify(
|
|
2403
|
+
return `PropertyGroup(${JSON.stringify(_propertiesToStrings((_propertyGroup ?? this)))})`;
|
|
2411
2404
|
}
|
|
2412
2405
|
PropertyGroup.$toString = $toString;
|
|
2413
2406
|
})(PropertyGroup || (PropertyGroup = {}));
|
|
@@ -2483,33 +2476,7 @@ export var Ontology;
|
|
|
2483
2476
|
return true;
|
|
2484
2477
|
}
|
|
2485
2478
|
Ontology.filter = filter;
|
|
2486
|
-
Ontology.
|
|
2487
|
-
let { context, graph, ignoreRdfType = false, objectSet, preferredLanguages, } = options ?? {};
|
|
2488
|
-
if (!objectSet) {
|
|
2489
|
-
objectSet = new $RdfjsDatasetObjectSet(resource.dataset);
|
|
2490
|
-
}
|
|
2491
|
-
return Ontology.propertiesFromRdfResource(resource, {
|
|
2492
|
-
context,
|
|
2493
|
-
graph,
|
|
2494
|
-
ignoreRdfType,
|
|
2495
|
-
objectSet,
|
|
2496
|
-
preferredLanguages,
|
|
2497
|
-
}).map(create);
|
|
2498
|
-
};
|
|
2499
|
-
Ontology.fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
|
|
2500
|
-
.toResource()
|
|
2501
|
-
.chain((resource) => Ontology.fromRdfResource(resource, options))));
|
|
2502
|
-
Ontology.fromRdfType = dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology");
|
|
2503
|
-
function isOntology(object) {
|
|
2504
|
-
switch (object.$type) {
|
|
2505
|
-
case "Ontology":
|
|
2506
|
-
return true;
|
|
2507
|
-
default:
|
|
2508
|
-
return false;
|
|
2509
|
-
}
|
|
2510
|
-
}
|
|
2511
|
-
Ontology.isOntology = isOntology;
|
|
2512
|
-
Ontology.propertiesFromRdfResource = ($resource, _$options) => {
|
|
2479
|
+
Ontology._fromRdfResource = ($resource, _$options) => {
|
|
2513
2480
|
return (!_$options.ignoreRdfType
|
|
2514
2481
|
? $resource
|
|
2515
2482
|
.value($RdfVocabularies.rdf.type, { graph: _$options.graph })
|
|
@@ -2536,7 +2503,7 @@ export var Ontology;
|
|
|
2536
2503
|
}).toValues())
|
|
2537
2504
|
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
2538
2505
|
.chain((values) => values.head())
|
|
2539
|
-
.chain(($identifier) =>
|
|
2506
|
+
.chain(($identifier) => $shaclPropertyFromRdf({
|
|
2540
2507
|
graph: _$options.graph,
|
|
2541
2508
|
resource: $resource,
|
|
2542
2509
|
propertySchema: Ontology.schema.properties.comment,
|
|
@@ -2564,8 +2531,22 @@ export var Ontology;
|
|
|
2564
2531
|
propertyPath: PropertyShape.schema.properties.label.path,
|
|
2565
2532
|
value: Maybe.empty(),
|
|
2566
2533
|
})),
|
|
2567
|
-
}).map((label) => ({ $identifier,
|
|
2534
|
+
}).map((label) => create({ $identifier, comment, label })))));
|
|
2568
2535
|
};
|
|
2536
|
+
Ontology.fromRdfResource = $wrap_FromRdfResourceFunction(Ontology._fromRdfResource);
|
|
2537
|
+
Ontology.fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
|
|
2538
|
+
.toResource()
|
|
2539
|
+
.chain((resource) => Ontology.fromRdfResource(resource, options))));
|
|
2540
|
+
Ontology.fromRdfType = dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology");
|
|
2541
|
+
function isOntology(object) {
|
|
2542
|
+
switch (object.$type) {
|
|
2543
|
+
case "Ontology":
|
|
2544
|
+
return true;
|
|
2545
|
+
default:
|
|
2546
|
+
return false;
|
|
2547
|
+
}
|
|
2548
|
+
}
|
|
2549
|
+
Ontology.isOntology = isOntology;
|
|
2569
2550
|
Ontology.schema = {
|
|
2570
2551
|
properties: {
|
|
2571
2552
|
$identifier: {
|
|
@@ -2597,34 +2578,28 @@ export var Ontology;
|
|
|
2597
2578
|
},
|
|
2598
2579
|
},
|
|
2599
2580
|
};
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
dataFactory: dataFactory,
|
|
2604
|
-
dataset: datasetFactory.dataset(),
|
|
2605
|
-
});
|
|
2606
|
-
const resource = resourceSet.resource(_ontology.$identifier());
|
|
2607
|
-
if (!options?.ignoreRdfType) {
|
|
2608
|
-
resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"), options?.graph);
|
|
2581
|
+
Ontology._toRdfResource = (parameters) => {
|
|
2582
|
+
if (!parameters.ignoreRdfType) {
|
|
2583
|
+
parameters.resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"), parameters.graph);
|
|
2609
2584
|
}
|
|
2610
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
|
|
2585
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), parameters.object.comment
|
|
2611
2586
|
.toList()
|
|
2612
|
-
.flatMap((value) => [$literalFactory.string(value)]),
|
|
2613
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
|
|
2587
|
+
.flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
|
|
2588
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), parameters.object.label
|
|
2614
2589
|
.toList()
|
|
2615
|
-
.flatMap((value) => [$literalFactory.string(value)]),
|
|
2616
|
-
return resource;
|
|
2617
|
-
}
|
|
2618
|
-
Ontology.toRdfResource =
|
|
2619
|
-
function
|
|
2590
|
+
.flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
|
|
2591
|
+
return parameters.resource;
|
|
2592
|
+
};
|
|
2593
|
+
Ontology.toRdfResource = $wrap_ToRdfResourceFunction(Ontology._toRdfResource);
|
|
2594
|
+
function _propertiesToStrings(_ontology) {
|
|
2620
2595
|
return $compactRecord({
|
|
2621
2596
|
$identifier: _ontology.$identifier().toString(),
|
|
2622
2597
|
label: _ontology.label.map((item) => item.toString()).extract(),
|
|
2623
2598
|
});
|
|
2624
2599
|
}
|
|
2625
|
-
Ontology.
|
|
2600
|
+
Ontology._propertiesToStrings = _propertiesToStrings;
|
|
2626
2601
|
function $toString(_ontology) {
|
|
2627
|
-
return `Ontology(${JSON.stringify(
|
|
2602
|
+
return `Ontology(${JSON.stringify(_propertiesToStrings((_ontology ?? this)))})`;
|
|
2628
2603
|
}
|
|
2629
2604
|
Ontology.$toString = $toString;
|
|
2630
2605
|
})(Ontology || (Ontology = {}));
|
|
@@ -3324,33 +3299,7 @@ export var NodeShape;
|
|
|
3324
3299
|
return true;
|
|
3325
3300
|
}
|
|
3326
3301
|
NodeShape.filter = filter;
|
|
3327
|
-
NodeShape.
|
|
3328
|
-
let { context, graph, ignoreRdfType = false, objectSet, preferredLanguages, } = options ?? {};
|
|
3329
|
-
if (!objectSet) {
|
|
3330
|
-
objectSet = new $RdfjsDatasetObjectSet(resource.dataset);
|
|
3331
|
-
}
|
|
3332
|
-
return NodeShape.propertiesFromRdfResource(resource, {
|
|
3333
|
-
context,
|
|
3334
|
-
graph,
|
|
3335
|
-
ignoreRdfType,
|
|
3336
|
-
objectSet,
|
|
3337
|
-
preferredLanguages,
|
|
3338
|
-
}).map(create);
|
|
3339
|
-
};
|
|
3340
|
-
NodeShape.fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
|
|
3341
|
-
.toResource()
|
|
3342
|
-
.chain((resource) => NodeShape.fromRdfResource(resource, options))));
|
|
3343
|
-
NodeShape.fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape");
|
|
3344
|
-
function isNodeShape(object) {
|
|
3345
|
-
switch (object.$type) {
|
|
3346
|
-
case "NodeShape":
|
|
3347
|
-
return true;
|
|
3348
|
-
default:
|
|
3349
|
-
return false;
|
|
3350
|
-
}
|
|
3351
|
-
}
|
|
3352
|
-
NodeShape.isNodeShape = isNodeShape;
|
|
3353
|
-
NodeShape.propertiesFromRdfResource = ($resource, _$options) => {
|
|
3302
|
+
NodeShape._fromRdfResource = ($resource, _$options) => {
|
|
3354
3303
|
return (!_$options.ignoreRdfType
|
|
3355
3304
|
? $resource
|
|
3356
3305
|
.value($RdfVocabularies.rdf.type, { graph: _$options.graph })
|
|
@@ -3377,7 +3326,7 @@ export var NodeShape;
|
|
|
3377
3326
|
}).toValues())
|
|
3378
3327
|
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
3379
3328
|
.chain((values) => values.head())
|
|
3380
|
-
.chain(($identifier) =>
|
|
3329
|
+
.chain(($identifier) => $shaclPropertyFromRdf({
|
|
3381
3330
|
graph: _$options.graph,
|
|
3382
3331
|
resource: $resource,
|
|
3383
3332
|
propertySchema: NodeShape.schema.properties.and,
|
|
@@ -3445,8 +3394,7 @@ export var NodeShape;
|
|
|
3445
3394
|
? values.map((value) => Maybe.of(value))
|
|
3446
3395
|
: Resource.Values.fromValue({
|
|
3447
3396
|
focusResource: $resource,
|
|
3448
|
-
propertyPath: PropertyShape.schema.properties.datatype
|
|
3449
|
-
.path,
|
|
3397
|
+
propertyPath: PropertyShape.schema.properties.datatype.path,
|
|
3450
3398
|
value: Maybe.empty(),
|
|
3451
3399
|
})),
|
|
3452
3400
|
}).chain((datatype) => $shaclPropertyFromRdf({
|
|
@@ -3459,8 +3407,8 @@ export var NodeShape;
|
|
|
3459
3407
|
? values.map((value) => Maybe.of(value))
|
|
3460
3408
|
: Resource.Values.fromValue({
|
|
3461
3409
|
focusResource: $resource,
|
|
3462
|
-
propertyPath: PropertyShape.schema.properties
|
|
3463
|
-
.
|
|
3410
|
+
propertyPath: PropertyShape.schema.properties.deactivated
|
|
3411
|
+
.path,
|
|
3464
3412
|
value: Maybe.empty(),
|
|
3465
3413
|
})),
|
|
3466
3414
|
}).chain((deactivated) => $shaclPropertyFromRdf({
|
|
@@ -3491,8 +3439,8 @@ export var NodeShape;
|
|
|
3491
3439
|
actualValue: term,
|
|
3492
3440
|
expectedValueType: "(NamedNode | Literal)",
|
|
3493
3441
|
focusResource: $resource,
|
|
3494
|
-
propertyPath: PropertyShape.schema
|
|
3495
|
-
.
|
|
3442
|
+
propertyPath: PropertyShape.schema.properties
|
|
3443
|
+
.hasValues.path,
|
|
3496
3444
|
}));
|
|
3497
3445
|
}
|
|
3498
3446
|
})))
|
|
@@ -3529,13 +3477,11 @@ export var NodeShape;
|
|
|
3529
3477
|
resource: $resource,
|
|
3530
3478
|
propertySchema: NodeShape.schema.properties.in_,
|
|
3531
3479
|
typeFromRdf: (resourceValues) => resourceValues
|
|
3532
|
-
.chain((values) => values.chainMap((value) => value.toList({
|
|
3533
|
-
graph: _$options.graph,
|
|
3534
|
-
})))
|
|
3480
|
+
.chain((values) => values.chainMap((value) => value.toList({ graph: _$options.graph })))
|
|
3535
3481
|
.chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
|
|
3536
3482
|
focusResource: $resource,
|
|
3537
|
-
propertyPath: PropertyShape.schema.properties
|
|
3538
|
-
.
|
|
3483
|
+
propertyPath: PropertyShape.schema.properties.in_
|
|
3484
|
+
.path,
|
|
3539
3485
|
values: valueList.toArray(),
|
|
3540
3486
|
})).chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
|
|
3541
3487
|
switch (term.termType) {
|
|
@@ -3548,8 +3494,7 @@ export var NodeShape;
|
|
|
3548
3494
|
expectedValueType: "(NamedNode | Literal)",
|
|
3549
3495
|
focusResource: $resource,
|
|
3550
3496
|
propertyPath: PropertyShape.schema
|
|
3551
|
-
.properties.in_
|
|
3552
|
-
.path,
|
|
3497
|
+
.properties.in_.path,
|
|
3553
3498
|
}));
|
|
3554
3499
|
}
|
|
3555
3500
|
})))))
|
|
@@ -3558,8 +3503,8 @@ export var NodeShape;
|
|
|
3558
3503
|
? values.map((value) => Maybe.of(value))
|
|
3559
3504
|
: Resource.Values.fromValue({
|
|
3560
3505
|
focusResource: $resource,
|
|
3561
|
-
propertyPath: PropertyShape.schema.properties
|
|
3562
|
-
.
|
|
3506
|
+
propertyPath: PropertyShape.schema.properties.in_
|
|
3507
|
+
.path,
|
|
3563
3508
|
value: Maybe.empty(),
|
|
3564
3509
|
})),
|
|
3565
3510
|
}).chain((in_) => $shaclPropertyFromRdf({
|
|
@@ -3587,8 +3532,8 @@ export var NodeShape;
|
|
|
3587
3532
|
? values.map((value) => Maybe.of(value))
|
|
3588
3533
|
: Resource.Values.fromValue({
|
|
3589
3534
|
focusResource: $resource,
|
|
3590
|
-
propertyPath: PropertyShape.schema
|
|
3591
|
-
.
|
|
3535
|
+
propertyPath: PropertyShape.schema.properties
|
|
3536
|
+
.label.path,
|
|
3592
3537
|
value: Maybe.empty(),
|
|
3593
3538
|
})),
|
|
3594
3539
|
}).chain((label) => $shaclPropertyFromRdf({
|
|
@@ -3602,8 +3547,7 @@ export var NodeShape;
|
|
|
3602
3547
|
.chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
|
|
3603
3548
|
focusResource: $resource,
|
|
3604
3549
|
propertyPath: PropertyShape.schema
|
|
3605
|
-
.properties.languageIn
|
|
3606
|
-
.path,
|
|
3550
|
+
.properties.languageIn.path,
|
|
3607
3551
|
values: valueList.toArray(),
|
|
3608
3552
|
}))
|
|
3609
3553
|
.chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
|
|
@@ -3614,8 +3558,7 @@ export var NodeShape;
|
|
|
3614
3558
|
: Resource.Values.fromValue({
|
|
3615
3559
|
focusResource: $resource,
|
|
3616
3560
|
propertyPath: PropertyShape.schema
|
|
3617
|
-
.properties.languageIn
|
|
3618
|
-
.path,
|
|
3561
|
+
.properties.languageIn.path,
|
|
3619
3562
|
value: Maybe.empty(),
|
|
3620
3563
|
})),
|
|
3621
3564
|
}).chain((languageIn) => $shaclPropertyFromRdf({
|
|
@@ -3629,8 +3572,7 @@ export var NodeShape;
|
|
|
3629
3572
|
: Resource.Values.fromValue({
|
|
3630
3573
|
focusResource: $resource,
|
|
3631
3574
|
propertyPath: PropertyShape.schema
|
|
3632
|
-
.properties.maxCount
|
|
3633
|
-
.path,
|
|
3575
|
+
.properties.maxCount.path,
|
|
3634
3576
|
value: Maybe.empty(),
|
|
3635
3577
|
})),
|
|
3636
3578
|
}).chain((maxCount) => $shaclPropertyFromRdf({
|
|
@@ -3645,8 +3587,8 @@ export var NodeShape;
|
|
|
3645
3587
|
: Resource.Values.fromValue({
|
|
3646
3588
|
focusResource: $resource,
|
|
3647
3589
|
propertyPath: PropertyShape.schema
|
|
3648
|
-
.properties
|
|
3649
|
-
.
|
|
3590
|
+
.properties.maxExclusive
|
|
3591
|
+
.path,
|
|
3650
3592
|
value: Maybe.empty(),
|
|
3651
3593
|
})),
|
|
3652
3594
|
}).chain((maxExclusive) => $shaclPropertyFromRdf({
|
|
@@ -3690,8 +3632,7 @@ export var NodeShape;
|
|
|
3690
3632
|
? values.map((value) => Maybe.of(value))
|
|
3691
3633
|
: Resource.Values.fromValue({
|
|
3692
3634
|
focusResource: $resource,
|
|
3693
|
-
propertyPath: PropertyShape
|
|
3694
|
-
.schema
|
|
3635
|
+
propertyPath: PropertyShape.schema
|
|
3695
3636
|
.properties
|
|
3696
3637
|
.minCount.path,
|
|
3697
3638
|
value: Maybe.empty(),
|
|
@@ -3755,8 +3696,7 @@ export var NodeShape;
|
|
|
3755
3696
|
}).chain((minLength) => $shaclPropertyFromRdf({
|
|
3756
3697
|
graph: _$options.graph,
|
|
3757
3698
|
resource: $resource,
|
|
3758
|
-
propertySchema: NodeShape.schema.properties
|
|
3759
|
-
.node,
|
|
3699
|
+
propertySchema: NodeShape.schema.properties.node,
|
|
3760
3700
|
typeFromRdf: (resourceValues) => resourceValues
|
|
3761
3701
|
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
3762
3702
|
.map((values) => values.length > 0
|
|
@@ -3784,8 +3724,7 @@ export var NodeShape;
|
|
|
3784
3724
|
dataFactory.namedNode("http://www.w3.org/ns/shacl#IRIOrLiteral"),
|
|
3785
3725
|
dataFactory.namedNode("http://www.w3.org/ns/shacl#Literal"),
|
|
3786
3726
|
])))
|
|
3787
|
-
.map((values) => values.length >
|
|
3788
|
-
0
|
|
3727
|
+
.map((values) => values.length > 0
|
|
3789
3728
|
? values.map((value) => Maybe.of(value))
|
|
3790
3729
|
: Resource.Values.fromValue({
|
|
3791
3730
|
focusResource: $resource,
|
|
@@ -3799,8 +3738,7 @@ export var NodeShape;
|
|
|
3799
3738
|
}).chain((nodeKind) => $shaclPropertyFromRdf({
|
|
3800
3739
|
graph: _$options.graph,
|
|
3801
3740
|
resource: $resource,
|
|
3802
|
-
propertySchema: NodeShape.schema
|
|
3803
|
-
.properties
|
|
3741
|
+
propertySchema: NodeShape.schema.properties
|
|
3804
3742
|
.not,
|
|
3805
3743
|
typeFromRdf: (resourceValues) => resourceValues
|
|
3806
3744
|
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
@@ -3951,9 +3889,8 @@ export var NodeShape;
|
|
|
3951
3889
|
.path,
|
|
3952
3890
|
value: Maybe.empty(),
|
|
3953
3891
|
})),
|
|
3954
|
-
}).map((xone) => ({
|
|
3892
|
+
}).map((xone) => create({
|
|
3955
3893
|
$identifier,
|
|
3956
|
-
$type,
|
|
3957
3894
|
and,
|
|
3958
3895
|
classes,
|
|
3959
3896
|
closed,
|
|
@@ -3984,8 +3921,22 @@ export var NodeShape;
|
|
|
3984
3921
|
subClassOf,
|
|
3985
3922
|
types,
|
|
3986
3923
|
xone,
|
|
3987
|
-
})))))))))))))))))))))))))))))))))
|
|
3924
|
+
})))))))))))))))))))))))))))))))));
|
|
3988
3925
|
};
|
|
3926
|
+
NodeShape.fromRdfResource = $wrap_FromRdfResourceFunction(NodeShape._fromRdfResource);
|
|
3927
|
+
NodeShape.fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
|
|
3928
|
+
.toResource()
|
|
3929
|
+
.chain((resource) => NodeShape.fromRdfResource(resource, options))));
|
|
3930
|
+
NodeShape.fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape");
|
|
3931
|
+
function isNodeShape(object) {
|
|
3932
|
+
switch (object.$type) {
|
|
3933
|
+
case "NodeShape":
|
|
3934
|
+
return true;
|
|
3935
|
+
default:
|
|
3936
|
+
return false;
|
|
3937
|
+
}
|
|
3938
|
+
}
|
|
3939
|
+
NodeShape.isNodeShape = isNodeShape;
|
|
3989
3940
|
NodeShape.schema = {
|
|
3990
3941
|
properties: {
|
|
3991
3942
|
$identifier: {
|
|
@@ -4269,212 +4220,208 @@ export var NodeShape;
|
|
|
4269
4220
|
},
|
|
4270
4221
|
},
|
|
4271
4222
|
};
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
dataFactory: dataFactory,
|
|
4276
|
-
dataset: datasetFactory.dataset(),
|
|
4277
|
-
});
|
|
4278
|
-
const resource = resourceSet.resource(_nodeShape.$identifier());
|
|
4279
|
-
if (!options?.ignoreRdfType) {
|
|
4280
|
-
resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape"), options?.graph);
|
|
4223
|
+
NodeShape._toRdfResource = (parameters) => {
|
|
4224
|
+
if (!parameters.ignoreRdfType) {
|
|
4225
|
+
parameters.resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape"), parameters.graph);
|
|
4281
4226
|
}
|
|
4282
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#and"),
|
|
4227
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#and"), parameters.object.and.toList().flatMap((value) => [
|
|
4283
4228
|
value.length > 0
|
|
4284
4229
|
? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
4285
4230
|
if (itemIndex === 0) {
|
|
4286
4231
|
currentSubListResource = listResource;
|
|
4287
4232
|
}
|
|
4288
4233
|
else {
|
|
4289
|
-
const newSubListResource = resourceSet.resource((() => dataFactory.blankNode())());
|
|
4290
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier,
|
|
4234
|
+
const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
|
|
4235
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
|
|
4291
4236
|
currentSubListResource = newSubListResource;
|
|
4292
4237
|
}
|
|
4293
|
-
currentSubListResource.add($RdfVocabularies.rdf.first, [item],
|
|
4238
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
|
|
4294
4239
|
if (itemIndex + 1 === list.length) {
|
|
4295
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil,
|
|
4240
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
|
|
4296
4241
|
}
|
|
4297
4242
|
return { currentSubListResource, listResource };
|
|
4298
4243
|
}, {
|
|
4299
4244
|
currentSubListResource: null,
|
|
4300
|
-
listResource: resourceSet.resource((() => dataFactory.blankNode())()),
|
|
4245
|
+
listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
|
|
4301
4246
|
}).listResource.identifier
|
|
4302
4247
|
: $RdfVocabularies.rdf.nil,
|
|
4303
|
-
]),
|
|
4304
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#class"),
|
|
4305
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#closed"),
|
|
4248
|
+
]), parameters.graph);
|
|
4249
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#class"), parameters.object.classes.flatMap((item) => [item]), parameters.graph);
|
|
4250
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#closed"), parameters.object.closed
|
|
4306
4251
|
.toList()
|
|
4307
4252
|
.flatMap((value) => [
|
|
4308
4253
|
$literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
|
|
4309
|
-
]),
|
|
4310
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
|
|
4254
|
+
]), parameters.graph);
|
|
4255
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), parameters.object.comment
|
|
4311
4256
|
.toList()
|
|
4312
|
-
.flatMap((value) => [$literalFactory.string(value)]),
|
|
4313
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#datatype"),
|
|
4314
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"),
|
|
4257
|
+
.flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
|
|
4258
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#datatype"), parameters.object.datatype.toList(), parameters.graph);
|
|
4259
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"), parameters.object.deactivated
|
|
4315
4260
|
.toList()
|
|
4316
4261
|
.flatMap((value) => [
|
|
4317
4262
|
$literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
|
|
4318
|
-
]),
|
|
4319
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#flags"),
|
|
4320
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#hasValue"),
|
|
4321
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#ignoredProperties"),
|
|
4263
|
+
]), parameters.graph);
|
|
4264
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#flags"), parameters.object.flags.flatMap((item) => [$literalFactory.string(item)]), parameters.graph);
|
|
4265
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#hasValue"), parameters.object.hasValues.flatMap((item) => [item]), parameters.graph);
|
|
4266
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#ignoredProperties"), parameters.object.ignoredProperties.toList().flatMap((value) => [
|
|
4322
4267
|
value.length > 0
|
|
4323
4268
|
? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
4324
4269
|
if (itemIndex === 0) {
|
|
4325
4270
|
currentSubListResource = listResource;
|
|
4326
4271
|
}
|
|
4327
4272
|
else {
|
|
4328
|
-
const newSubListResource = resourceSet.resource((() => dataFactory.blankNode())());
|
|
4329
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier,
|
|
4273
|
+
const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
|
|
4274
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
|
|
4330
4275
|
currentSubListResource = newSubListResource;
|
|
4331
4276
|
}
|
|
4332
|
-
currentSubListResource.add($RdfVocabularies.rdf.first, [item],
|
|
4277
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
|
|
4333
4278
|
if (itemIndex + 1 === list.length) {
|
|
4334
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil,
|
|
4279
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
|
|
4335
4280
|
}
|
|
4336
4281
|
return { currentSubListResource, listResource };
|
|
4337
4282
|
}, {
|
|
4338
4283
|
currentSubListResource: null,
|
|
4339
|
-
listResource: resourceSet.resource((() => dataFactory.blankNode())()),
|
|
4284
|
+
listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
|
|
4340
4285
|
}).listResource.identifier
|
|
4341
4286
|
: $RdfVocabularies.rdf.nil,
|
|
4342
|
-
]),
|
|
4343
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#in"),
|
|
4287
|
+
]), parameters.graph);
|
|
4288
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#in"), parameters.object.in_.toList().flatMap((value) => [
|
|
4344
4289
|
value.length > 0
|
|
4345
4290
|
? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
4346
4291
|
if (itemIndex === 0) {
|
|
4347
4292
|
currentSubListResource = listResource;
|
|
4348
4293
|
}
|
|
4349
4294
|
else {
|
|
4350
|
-
const newSubListResource = resourceSet.resource((() => dataFactory.blankNode())());
|
|
4351
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier,
|
|
4295
|
+
const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
|
|
4296
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
|
|
4352
4297
|
currentSubListResource = newSubListResource;
|
|
4353
4298
|
}
|
|
4354
|
-
currentSubListResource.add($RdfVocabularies.rdf.first, [item],
|
|
4299
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
|
|
4355
4300
|
if (itemIndex + 1 === list.length) {
|
|
4356
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil,
|
|
4301
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
|
|
4357
4302
|
}
|
|
4358
4303
|
return { currentSubListResource, listResource };
|
|
4359
4304
|
}, {
|
|
4360
4305
|
currentSubListResource: null,
|
|
4361
|
-
listResource: resourceSet.resource((() => dataFactory.blankNode())()),
|
|
4306
|
+
listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
|
|
4362
4307
|
}).listResource.identifier
|
|
4363
4308
|
: $RdfVocabularies.rdf.nil,
|
|
4364
|
-
]),
|
|
4365
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"),
|
|
4366
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
|
|
4309
|
+
]), parameters.graph);
|
|
4310
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"), parameters.object.isDefinedBy.toList(), parameters.graph);
|
|
4311
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), parameters.object.label
|
|
4367
4312
|
.toList()
|
|
4368
|
-
.flatMap((value) => [$literalFactory.string(value)]),
|
|
4369
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#languageIn"),
|
|
4313
|
+
.flatMap((value) => [$literalFactory.string(value)]), parameters.graph);
|
|
4314
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#languageIn"), parameters.object.languageIn.toList().flatMap((value) => [
|
|
4370
4315
|
value.length > 0
|
|
4371
4316
|
? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
4372
4317
|
if (itemIndex === 0) {
|
|
4373
4318
|
currentSubListResource = listResource;
|
|
4374
4319
|
}
|
|
4375
4320
|
else {
|
|
4376
|
-
const newSubListResource = resourceSet.resource((() => dataFactory.blankNode())());
|
|
4377
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier,
|
|
4321
|
+
const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
|
|
4322
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
|
|
4378
4323
|
currentSubListResource = newSubListResource;
|
|
4379
4324
|
}
|
|
4380
|
-
currentSubListResource.add($RdfVocabularies.rdf.first, [$literalFactory.string(item)],
|
|
4325
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, [$literalFactory.string(item)], parameters.graph);
|
|
4381
4326
|
if (itemIndex + 1 === list.length) {
|
|
4382
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil,
|
|
4327
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
|
|
4383
4328
|
}
|
|
4384
4329
|
return { currentSubListResource, listResource };
|
|
4385
4330
|
}, {
|
|
4386
4331
|
currentSubListResource: null,
|
|
4387
|
-
listResource: resourceSet.resource((() => dataFactory.blankNode())()),
|
|
4332
|
+
listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
|
|
4388
4333
|
}).listResource.identifier
|
|
4389
4334
|
: $RdfVocabularies.rdf.nil,
|
|
4390
|
-
]),
|
|
4391
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxCount"),
|
|
4335
|
+
]), parameters.graph);
|
|
4336
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxCount"), parameters.object.maxCount
|
|
4392
4337
|
.toList()
|
|
4393
4338
|
.flatMap((value) => [
|
|
4394
4339
|
$literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
|
|
4395
|
-
]),
|
|
4396
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxExclusive"),
|
|
4397
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxInclusive"),
|
|
4398
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxLength"),
|
|
4340
|
+
]), parameters.graph);
|
|
4341
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxExclusive"), parameters.object.maxExclusive.toList(), parameters.graph);
|
|
4342
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxInclusive"), parameters.object.maxInclusive.toList(), parameters.graph);
|
|
4343
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxLength"), parameters.object.maxLength
|
|
4399
4344
|
.toList()
|
|
4400
4345
|
.flatMap((value) => [
|
|
4401
4346
|
$literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
|
|
4402
|
-
]),
|
|
4403
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minCount"),
|
|
4347
|
+
]), parameters.graph);
|
|
4348
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minCount"), parameters.object.minCount
|
|
4404
4349
|
.toList()
|
|
4405
4350
|
.flatMap((value) => [
|
|
4406
4351
|
$literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
|
|
4407
|
-
]),
|
|
4408
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minExclusive"),
|
|
4409
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minInclusive"),
|
|
4410
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minLength"),
|
|
4352
|
+
]), parameters.graph);
|
|
4353
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minExclusive"), parameters.object.minExclusive.toList(), parameters.graph);
|
|
4354
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minInclusive"), parameters.object.minInclusive.toList(), parameters.graph);
|
|
4355
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minLength"), parameters.object.minLength
|
|
4411
4356
|
.toList()
|
|
4412
4357
|
.flatMap((value) => [
|
|
4413
4358
|
$literalFactory.bigint(value, $RdfVocabularies.xsd.integer),
|
|
4414
|
-
]),
|
|
4415
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#node"),
|
|
4416
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"),
|
|
4417
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#not"),
|
|
4418
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#or"),
|
|
4359
|
+
]), parameters.graph);
|
|
4360
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#node"), parameters.object.node.toList(), parameters.graph);
|
|
4361
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"), parameters.object.nodeKind.toList(), parameters.graph);
|
|
4362
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#not"), parameters.object.not.flatMap((item) => [item]), parameters.graph);
|
|
4363
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#or"), parameters.object.or.toList().flatMap((value) => [
|
|
4419
4364
|
value.length > 0
|
|
4420
4365
|
? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
4421
4366
|
if (itemIndex === 0) {
|
|
4422
4367
|
currentSubListResource = listResource;
|
|
4423
4368
|
}
|
|
4424
4369
|
else {
|
|
4425
|
-
const newSubListResource = resourceSet.resource((() => dataFactory.blankNode())());
|
|
4426
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier,
|
|
4370
|
+
const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
|
|
4371
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
|
|
4427
4372
|
currentSubListResource = newSubListResource;
|
|
4428
4373
|
}
|
|
4429
|
-
currentSubListResource.add($RdfVocabularies.rdf.first, [item],
|
|
4374
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
|
|
4430
4375
|
if (itemIndex + 1 === list.length) {
|
|
4431
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil,
|
|
4376
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
|
|
4432
4377
|
}
|
|
4433
4378
|
return { currentSubListResource, listResource };
|
|
4434
4379
|
}, {
|
|
4435
4380
|
currentSubListResource: null,
|
|
4436
|
-
listResource: resourceSet.resource((() => dataFactory.blankNode())()),
|
|
4381
|
+
listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
|
|
4437
4382
|
}).listResource.identifier
|
|
4438
4383
|
: $RdfVocabularies.rdf.nil,
|
|
4439
|
-
]),
|
|
4440
|
-
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#pattern"),
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
resource.add(
|
|
4444
|
-
resource.add(
|
|
4384
|
+
]), parameters.graph);
|
|
4385
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#pattern"), parameters.object.patterns.flatMap((item) => [
|
|
4386
|
+
$literalFactory.string(item),
|
|
4387
|
+
]), parameters.graph);
|
|
4388
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#property"), parameters.object.properties.flatMap((item) => [item]), parameters.graph);
|
|
4389
|
+
parameters.resource.add($RdfVocabularies.rdfs.subClassOf, parameters.object.subClassOf.flatMap((item) => [item]), parameters.graph);
|
|
4390
|
+
parameters.resource.add($RdfVocabularies.rdf.type, parameters.object.types.flatMap((item) => [item]), parameters.graph);
|
|
4391
|
+
parameters.resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#xone"), parameters.object.xone.toList().flatMap((value) => [
|
|
4445
4392
|
value.length > 0
|
|
4446
4393
|
? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
4447
4394
|
if (itemIndex === 0) {
|
|
4448
4395
|
currentSubListResource = listResource;
|
|
4449
4396
|
}
|
|
4450
4397
|
else {
|
|
4451
|
-
const newSubListResource = resourceSet.resource((() => dataFactory.blankNode())());
|
|
4452
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier,
|
|
4398
|
+
const newSubListResource = parameters.resourceSet.resource((() => dataFactory.blankNode())());
|
|
4399
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, parameters.graph);
|
|
4453
4400
|
currentSubListResource = newSubListResource;
|
|
4454
4401
|
}
|
|
4455
|
-
currentSubListResource.add($RdfVocabularies.rdf.first, [item],
|
|
4402
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, [item], parameters.graph);
|
|
4456
4403
|
if (itemIndex + 1 === list.length) {
|
|
4457
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil,
|
|
4404
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, parameters.graph);
|
|
4458
4405
|
}
|
|
4459
4406
|
return { currentSubListResource, listResource };
|
|
4460
4407
|
}, {
|
|
4461
4408
|
currentSubListResource: null,
|
|
4462
|
-
listResource: resourceSet.resource((() => dataFactory.blankNode())()),
|
|
4409
|
+
listResource: parameters.resourceSet.resource((() => dataFactory.blankNode())()),
|
|
4463
4410
|
}).listResource.identifier
|
|
4464
4411
|
: $RdfVocabularies.rdf.nil,
|
|
4465
|
-
]),
|
|
4466
|
-
return resource;
|
|
4467
|
-
}
|
|
4468
|
-
NodeShape.toRdfResource =
|
|
4469
|
-
function
|
|
4412
|
+
]), parameters.graph);
|
|
4413
|
+
return parameters.resource;
|
|
4414
|
+
};
|
|
4415
|
+
NodeShape.toRdfResource = $wrap_ToRdfResourceFunction(NodeShape._toRdfResource);
|
|
4416
|
+
function _propertiesToStrings(_nodeShape) {
|
|
4470
4417
|
return $compactRecord({
|
|
4471
4418
|
$identifier: _nodeShape.$identifier().toString(),
|
|
4472
4419
|
label: _nodeShape.label.map((item) => item.toString()).extract(),
|
|
4473
4420
|
});
|
|
4474
4421
|
}
|
|
4475
|
-
NodeShape.
|
|
4422
|
+
NodeShape._propertiesToStrings = _propertiesToStrings;
|
|
4476
4423
|
function $toString(_nodeShape) {
|
|
4477
|
-
return `NodeShape(${JSON.stringify(
|
|
4424
|
+
return `NodeShape(${JSON.stringify(_propertiesToStrings((_nodeShape ?? this)))})`;
|
|
4478
4425
|
}
|
|
4479
4426
|
NodeShape.$toString = $toString;
|
|
4480
4427
|
})(NodeShape || (NodeShape = {}));
|
|
@@ -4783,12 +4730,12 @@ export var Shape;
|
|
|
4783
4730
|
},
|
|
4784
4731
|
},
|
|
4785
4732
|
};
|
|
4786
|
-
Shape.toRdfResource = (
|
|
4787
|
-
if (NodeShape.isNodeShape(
|
|
4788
|
-
return NodeShape.toRdfResource(
|
|
4733
|
+
Shape.toRdfResource = (object, options) => {
|
|
4734
|
+
if (NodeShape.isNodeShape(object)) {
|
|
4735
|
+
return NodeShape.toRdfResource(object, options);
|
|
4789
4736
|
}
|
|
4790
|
-
if (PropertyShape.isPropertyShape(
|
|
4791
|
-
return PropertyShape.toRdfResource(
|
|
4737
|
+
if (PropertyShape.isPropertyShape(object)) {
|
|
4738
|
+
return PropertyShape.toRdfResource(object, options);
|
|
4792
4739
|
}
|
|
4793
4740
|
throw new Error("unrecognized type");
|
|
4794
4741
|
};
|
|
@@ -4953,18 +4900,18 @@ export var $Object;
|
|
|
4953
4900
|
},
|
|
4954
4901
|
},
|
|
4955
4902
|
};
|
|
4956
|
-
$Object.toRdfResource = (
|
|
4957
|
-
if (NodeShape.isNodeShape(
|
|
4958
|
-
return NodeShape.toRdfResource(
|
|
4903
|
+
$Object.toRdfResource = (object, options) => {
|
|
4904
|
+
if (NodeShape.isNodeShape(object)) {
|
|
4905
|
+
return NodeShape.toRdfResource(object, options);
|
|
4959
4906
|
}
|
|
4960
|
-
if (Ontology.isOntology(
|
|
4961
|
-
return Ontology.toRdfResource(
|
|
4907
|
+
if (Ontology.isOntology(object)) {
|
|
4908
|
+
return Ontology.toRdfResource(object, options);
|
|
4962
4909
|
}
|
|
4963
|
-
if (PropertyGroup.isPropertyGroup(
|
|
4964
|
-
return PropertyGroup.toRdfResource(
|
|
4910
|
+
if (PropertyGroup.isPropertyGroup(object)) {
|
|
4911
|
+
return PropertyGroup.toRdfResource(object, options);
|
|
4965
4912
|
}
|
|
4966
|
-
if (PropertyShape.isPropertyShape(
|
|
4967
|
-
return PropertyShape.toRdfResource(
|
|
4913
|
+
if (PropertyShape.isPropertyShape(object)) {
|
|
4914
|
+
return PropertyShape.toRdfResource(object, options);
|
|
4968
4915
|
}
|
|
4969
4916
|
throw new Error("unrecognized type");
|
|
4970
4917
|
};
|