@shaclmate/shacl-ast 3.0.4 → 4.0.1
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/README.md +1 -1
- package/dist/IdentifierNodeKind.d.ts +2 -2
- package/dist/NodeKind.d.ts +5 -2
- package/dist/NodeKind.js +11 -1
- package/dist/NodeShape.d.ts +3 -3
- package/dist/NodeShape.js +17 -2
- package/dist/Ontology.d.ts +1 -1
- package/dist/Ontology.js +12 -1
- package/dist/PropertyGroup.d.ts +4 -3
- package/dist/PropertyGroup.js +14 -0
- package/dist/PropertyShape.d.ts +6 -6
- package/dist/PropertyShape.js +20 -7
- package/dist/Shape.d.ts +11 -11
- package/dist/Shape.js +46 -14
- package/dist/ShapesGraph.d.ts +81 -9
- package/dist/ShapesGraph.js +311 -1
- package/dist/generated.d.ts +1667 -613
- package/dist/generated.js +2290 -1687
- package/dist/index.d.ts +2 -4
- package/dist/index.js +2 -4
- package/package.json +28 -31
- package/dist/Factory.d.ts +0 -23
- package/dist/Factory.js +0 -2
- package/dist/PropertyPath.d.ts +0 -41
- package/dist/PropertyPath.js +0 -95
- package/dist/RdfjsShapesGraph.d.ts +0 -31
- package/dist/RdfjsShapesGraph.js +0 -250
- package/dist/defaultFactory.d.ts +0 -12
- package/dist/defaultFactory.js +0 -28
package/dist/generated.js
CHANGED
|
@@ -1,10 +1,169 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import dataFactory from "@rdfjs/data-model";
|
|
2
|
+
import datasetFactory from "@rdfjs/dataset";
|
|
3
|
+
import { Either, Left, Maybe, Right } from "purify-ts";
|
|
4
|
+
import { LiteralFactory, PropertyPath, Resource, ResourceSet, } from "rdfjs-resource";
|
|
5
|
+
function $filterArray(filterItem) {
|
|
6
|
+
return (filter, values) => {
|
|
7
|
+
for (const value of values) {
|
|
8
|
+
if (!filterItem(filter, value)) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
if (filter.$maxCount !== undefined && values.length > filter.$maxCount) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
if (filter.$minCount !== undefined && values.length < filter.$minCount) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
return true;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function $filterBoolean(filter, value) {
|
|
22
|
+
if (filter.value !== undefined && value !== filter.value) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
function $filterIdentifier(filter, value) {
|
|
28
|
+
if (filter.in !== undefined &&
|
|
29
|
+
!filter.in.some((inValue) => inValue.equals(value))) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
if (filter.type !== undefined && value.termType !== filter.type) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
function $filterIri(filter, value) {
|
|
38
|
+
if (filter.in !== undefined &&
|
|
39
|
+
!filter.in.some((inValue) => inValue.equals(value))) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
function $filterLiteral(filter, value) {
|
|
45
|
+
return $filterTerm(filter, value);
|
|
46
|
+
}
|
|
47
|
+
function $filterMaybe(filterItem) {
|
|
48
|
+
return (filter, value) => {
|
|
49
|
+
if (filter !== null) {
|
|
50
|
+
if (value.isNothing()) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
if (!filterItem(filter, value.extract())) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
if (value.isJust()) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return true;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function $filterNumeric(filter, value) {
|
|
66
|
+
if (filter.in !== undefined &&
|
|
67
|
+
!filter.in.some((inValue) => inValue === value)) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
if (filter.maxExclusive !== undefined && value >= filter.maxExclusive) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
if (filter.maxInclusive !== undefined && value > filter.maxInclusive) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
if (filter.minExclusive !== undefined && value <= filter.minExclusive) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
if (filter.minInclusive !== undefined && value < filter.minInclusive) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
function $filterString(filter, value) {
|
|
85
|
+
if (filter.in !== undefined &&
|
|
86
|
+
!filter.in.some((inValue) => inValue === value)) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
if (filter.maxLength !== undefined && value.length > filter.maxLength) {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
if (filter.minLength !== undefined && value.length < filter.minLength) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
function $filterTerm(filter, value) {
|
|
98
|
+
if (filter.datatypeIn !== undefined &&
|
|
99
|
+
(value.termType !== "Literal" ||
|
|
100
|
+
!filter.datatypeIn.some((inDatatype) => inDatatype.equals(value.datatype)))) {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
if (filter.in !== undefined &&
|
|
104
|
+
!filter.in.some((inTerm) => inTerm.equals(value))) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
if (filter.languageIn !== undefined &&
|
|
108
|
+
(value.termType !== "Literal" ||
|
|
109
|
+
!filter.languageIn.some((inLanguage) => inLanguage === value.language))) {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
if (filter.typeIn !== undefined &&
|
|
113
|
+
!filter.typeIn.some((inType) => inType === value.termType)) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
function $fromRdfPreferredLanguages(values, preferredLanguages) {
|
|
119
|
+
if (!preferredLanguages || preferredLanguages.length === 0) {
|
|
120
|
+
return Right(values);
|
|
121
|
+
}
|
|
122
|
+
// Return all literals for the first preferredLanguage, then all literals for the second preferredLanguage, etc.
|
|
123
|
+
// Within a preferredLanguage the literals may be in any order.
|
|
124
|
+
const filteredValues = [];
|
|
125
|
+
for (const preferredLanguage of preferredLanguages) {
|
|
126
|
+
for (const value of values) {
|
|
127
|
+
value.toLiteral().ifRight((literal) => {
|
|
128
|
+
if (literal.language === preferredLanguage) {
|
|
129
|
+
filteredValues.push(value);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return Right(Resource.Values.fromArray({
|
|
135
|
+
focusResource: values.focusResource,
|
|
136
|
+
propertyPath: values.propertyPath,
|
|
137
|
+
values: filteredValues,
|
|
138
|
+
}));
|
|
139
|
+
}
|
|
140
|
+
function $identifierFromString(identifier) {
|
|
141
|
+
return Either.encase(() => Resource.Identifier.fromString({ dataFactory, identifier }));
|
|
142
|
+
}
|
|
143
|
+
class $IdentifierSet {
|
|
144
|
+
blankNodeValues = new Set();
|
|
145
|
+
namedNodeValues = new Set();
|
|
146
|
+
add(identifier) {
|
|
147
|
+
switch (identifier.termType) {
|
|
148
|
+
case "BlankNode":
|
|
149
|
+
this.blankNodeValues.add(identifier.value);
|
|
150
|
+
return this;
|
|
151
|
+
case "NamedNode":
|
|
152
|
+
this.namedNodeValues.add(identifier.value);
|
|
153
|
+
return this;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
has(identifier) {
|
|
157
|
+
switch (identifier.termType) {
|
|
158
|
+
case "BlankNode":
|
|
159
|
+
return this.blankNodeValues.has(identifier.value);
|
|
160
|
+
case "NamedNode":
|
|
161
|
+
return this.namedNodeValues.has(identifier.value);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
const $literalFactory = new LiteralFactory({ dataFactory: dataFactory });
|
|
166
|
+
var $RdfVocabularies;
|
|
8
167
|
(function ($RdfVocabularies) {
|
|
9
168
|
let rdf;
|
|
10
169
|
(function (rdf) {
|
|
@@ -21,723 +180,617 @@ export var $RdfVocabularies;
|
|
|
21
180
|
let xsd;
|
|
22
181
|
(function (xsd) {
|
|
23
182
|
xsd.boolean = dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#boolean");
|
|
183
|
+
xsd.byte = dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#byte");
|
|
24
184
|
xsd.date = dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#date");
|
|
25
185
|
xsd.dateTime = dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#dateTime");
|
|
186
|
+
xsd.decimal = dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#decimal");
|
|
187
|
+
xsd.double = dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#double");
|
|
188
|
+
xsd.float = dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#float");
|
|
189
|
+
xsd.int = dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#int");
|
|
26
190
|
xsd.integer = dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#integer");
|
|
191
|
+
xsd.long = dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#long");
|
|
192
|
+
xsd.negativeInteger = dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#negativeInteger");
|
|
193
|
+
xsd.nonNegativeInteger = dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#nonNegativeInteger");
|
|
194
|
+
xsd.nonPositiveInteger = dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#nonPositiveInteger");
|
|
195
|
+
xsd.positiveInteger = dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#positiveInteger");
|
|
196
|
+
xsd.short = dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#short");
|
|
197
|
+
xsd.string = dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#string");
|
|
198
|
+
xsd.unsignedByte = dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#unsignedByte");
|
|
199
|
+
xsd.unsignedInt = dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#unsignedInt");
|
|
200
|
+
xsd.unsignedLong = dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#unsignedLong");
|
|
201
|
+
xsd.unsignedShort = dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#unsignedShort");
|
|
27
202
|
})(xsd = $RdfVocabularies.xsd || ($RdfVocabularies.xsd = {}));
|
|
28
203
|
})($RdfVocabularies || ($RdfVocabularies = {}));
|
|
204
|
+
function $shaclPropertyFromRdf({ graph, propertySchema, resource, typeFromRdf, }) {
|
|
205
|
+
return typeFromRdf(Right(resource.values(propertySchema.path, { graph, unique: true }))).chain((values) => values.head());
|
|
206
|
+
}
|
|
29
207
|
export var BaseShaclCoreShapeStatic;
|
|
30
208
|
(function (BaseShaclCoreShapeStatic) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return
|
|
35
|
-
dataFactory,
|
|
36
|
-
identifier,
|
|
37
|
-
}));
|
|
209
|
+
function $filter(filter, value) {
|
|
210
|
+
if (filter.$identifier !== undefined &&
|
|
211
|
+
!$filterIdentifier(filter.$identifier, value.$identifier)) {
|
|
212
|
+
return false;
|
|
38
213
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
function $fromRdf(resource, options) {
|
|
43
|
-
let { ignoreRdfType = false, objectSet, preferredLanguages, ...context } = options ?? {};
|
|
44
|
-
if (!objectSet) {
|
|
45
|
-
objectSet = new $RdfjsDatasetObjectSet({ dataset: resource.dataset });
|
|
214
|
+
if (filter.and !== undefined &&
|
|
215
|
+
!$filterArray($filterArray($filterIdentifier))(filter.and, value.and)) {
|
|
216
|
+
return false;
|
|
46
217
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
objectSet,
|
|
51
|
-
}).altLazy(() => ShaclCorePropertyShape.$fromRdf(resource, {
|
|
52
|
-
...context,
|
|
53
|
-
ignoreRdfType: false,
|
|
54
|
-
objectSet,
|
|
55
|
-
}));
|
|
56
|
-
}
|
|
57
|
-
BaseShaclCoreShapeStatic.$fromRdf = $fromRdf;
|
|
58
|
-
function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, objectSet: $objectSet, preferredLanguages: $preferredLanguages, resource: $resource,
|
|
59
|
-
// @ts-ignore
|
|
60
|
-
...$context }) {
|
|
61
|
-
const $identifier = $resource.identifier;
|
|
62
|
-
const _andEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.and["identifier"], { unique: true }))
|
|
63
|
-
.chain((values) => values.chainMap((value) => value.toList()))
|
|
64
|
-
.chain((valueLists) => valueLists.chainMap((valueList) => purify.Either.of(rdfjsResource.Resource.Values.fromArray({
|
|
65
|
-
objects: valueList,
|
|
66
|
-
predicate: BaseShaclCoreShapeStatic.$properties.and["identifier"],
|
|
67
|
-
subject: $resource,
|
|
68
|
-
})).chain((values) => values.chainMap((value) => value.toIdentifier()))))
|
|
69
|
-
.map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
|
|
70
|
-
.map((values) => values.toArray())
|
|
71
|
-
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
72
|
-
object: valuesArray,
|
|
73
|
-
predicate: BaseShaclCoreShapeStatic.$properties.and["identifier"],
|
|
74
|
-
subject: $resource,
|
|
75
|
-
}))
|
|
76
|
-
.chain((values) => values.head());
|
|
77
|
-
if (_andEither.isLeft()) {
|
|
78
|
-
return _andEither;
|
|
79
|
-
}
|
|
80
|
-
const and = _andEither.unsafeCoerce();
|
|
81
|
-
const _classesEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.classes["identifier"], { unique: true }))
|
|
82
|
-
.chain((values) => values.chainMap((value) => value.toIri()))
|
|
83
|
-
.map((values) => values.toArray())
|
|
84
|
-
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
85
|
-
object: valuesArray,
|
|
86
|
-
predicate: BaseShaclCoreShapeStatic.$properties.classes["identifier"],
|
|
87
|
-
subject: $resource,
|
|
88
|
-
}))
|
|
89
|
-
.chain((values) => values.head());
|
|
90
|
-
if (_classesEither.isLeft()) {
|
|
91
|
-
return _classesEither;
|
|
92
|
-
}
|
|
93
|
-
const classes = _classesEither.unsafeCoerce();
|
|
94
|
-
const _commentsEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.comments["identifier"], { unique: true }))
|
|
95
|
-
.chain((values) => {
|
|
96
|
-
if (!$preferredLanguages || $preferredLanguages.length === 0) {
|
|
97
|
-
return purify.Either.of(values);
|
|
98
|
-
}
|
|
99
|
-
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
100
|
-
if (literalValuesEither.isLeft()) {
|
|
101
|
-
return literalValuesEither;
|
|
102
|
-
}
|
|
103
|
-
const literalValues = literalValuesEither.unsafeCoerce();
|
|
104
|
-
// Return all literals for the first preferredLanguage, then all literals for the second preferredLanguage, etc.
|
|
105
|
-
// Within a preferredLanguage the literals may be in any order.
|
|
106
|
-
let filteredLiteralValues;
|
|
107
|
-
for (const preferredLanguage of $preferredLanguages) {
|
|
108
|
-
if (!filteredLiteralValues) {
|
|
109
|
-
filteredLiteralValues = literalValues.filter((value) => value.language === preferredLanguage);
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
113
|
-
.filter((value) => value.language === preferredLanguage)
|
|
114
|
-
.toArray());
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return purify.Either.of(filteredLiteralValues.map((literalValue) => new rdfjsResource.Resource.Value({
|
|
118
|
-
object: literalValue,
|
|
119
|
-
predicate: BaseShaclCoreShapeStatic.$properties.comments["identifier"],
|
|
120
|
-
subject: $resource,
|
|
121
|
-
})));
|
|
122
|
-
})
|
|
123
|
-
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
124
|
-
.map((values) => values.toArray())
|
|
125
|
-
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
126
|
-
object: valuesArray,
|
|
127
|
-
predicate: BaseShaclCoreShapeStatic.$properties.comments["identifier"],
|
|
128
|
-
subject: $resource,
|
|
129
|
-
}))
|
|
130
|
-
.chain((values) => values.head());
|
|
131
|
-
if (_commentsEither.isLeft()) {
|
|
132
|
-
return _commentsEither;
|
|
133
|
-
}
|
|
134
|
-
const comments = _commentsEither.unsafeCoerce();
|
|
135
|
-
const _datatypeEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.datatype["identifier"], { unique: true }))
|
|
136
|
-
.chain((values) => values.chainMap((value) => value.toIri()))
|
|
137
|
-
.map((values) => values.length > 0
|
|
138
|
-
? values.map((value) => purify.Maybe.of(value))
|
|
139
|
-
: rdfjsResource.Resource.Values.fromValue({
|
|
140
|
-
object: purify.Maybe.empty(),
|
|
141
|
-
predicate: BaseShaclCoreShapeStatic.$properties.datatype["identifier"],
|
|
142
|
-
subject: $resource,
|
|
143
|
-
}))
|
|
144
|
-
.chain((values) => values.head());
|
|
145
|
-
if (_datatypeEither.isLeft()) {
|
|
146
|
-
return _datatypeEither;
|
|
147
|
-
}
|
|
148
|
-
const datatype = _datatypeEither.unsafeCoerce();
|
|
149
|
-
const _deactivatedEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.deactivated["identifier"], { unique: true }))
|
|
150
|
-
.chain((values) => values.chainMap((value) => value.toBoolean()))
|
|
151
|
-
.map((values) => values.length > 0
|
|
152
|
-
? values.map((value) => purify.Maybe.of(value))
|
|
153
|
-
: rdfjsResource.Resource.Values.fromValue({
|
|
154
|
-
object: purify.Maybe.empty(),
|
|
155
|
-
predicate: BaseShaclCoreShapeStatic.$properties.deactivated["identifier"],
|
|
156
|
-
subject: $resource,
|
|
157
|
-
}))
|
|
158
|
-
.chain((values) => values.head());
|
|
159
|
-
if (_deactivatedEither.isLeft()) {
|
|
160
|
-
return _deactivatedEither;
|
|
161
|
-
}
|
|
162
|
-
const deactivated = _deactivatedEither.unsafeCoerce();
|
|
163
|
-
const _flagsEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.flags["identifier"], { unique: true }))
|
|
164
|
-
.chain((values) => {
|
|
165
|
-
if (!$preferredLanguages || $preferredLanguages.length === 0) {
|
|
166
|
-
return purify.Either.of(values);
|
|
167
|
-
}
|
|
168
|
-
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
169
|
-
if (literalValuesEither.isLeft()) {
|
|
170
|
-
return literalValuesEither;
|
|
171
|
-
}
|
|
172
|
-
const literalValues = literalValuesEither.unsafeCoerce();
|
|
173
|
-
// Return all literals for the first preferredLanguage, then all literals for the second preferredLanguage, etc.
|
|
174
|
-
// Within a preferredLanguage the literals may be in any order.
|
|
175
|
-
let filteredLiteralValues;
|
|
176
|
-
for (const preferredLanguage of $preferredLanguages) {
|
|
177
|
-
if (!filteredLiteralValues) {
|
|
178
|
-
filteredLiteralValues = literalValues.filter((value) => value.language === preferredLanguage);
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
182
|
-
.filter((value) => value.language === preferredLanguage)
|
|
183
|
-
.toArray());
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
return purify.Either.of(filteredLiteralValues.map((literalValue) => new rdfjsResource.Resource.Value({
|
|
187
|
-
object: literalValue,
|
|
188
|
-
predicate: BaseShaclCoreShapeStatic.$properties.flags["identifier"],
|
|
189
|
-
subject: $resource,
|
|
190
|
-
})));
|
|
191
|
-
})
|
|
192
|
-
.chain((values) => values.chainMap((value) => value.toString()))
|
|
193
|
-
.map((values) => values.toArray())
|
|
194
|
-
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
195
|
-
object: valuesArray,
|
|
196
|
-
predicate: BaseShaclCoreShapeStatic.$properties.flags["identifier"],
|
|
197
|
-
subject: $resource,
|
|
198
|
-
}))
|
|
199
|
-
.chain((values) => values.head());
|
|
200
|
-
if (_flagsEither.isLeft()) {
|
|
201
|
-
return _flagsEither;
|
|
202
|
-
}
|
|
203
|
-
const flags = _flagsEither.unsafeCoerce();
|
|
204
|
-
const _hasValuesEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.hasValues["identifier"], { unique: true }))
|
|
205
|
-
.chain((values) => values.chainMap((value) => purify.Either.of(value.toTerm()).chain((term) => {
|
|
206
|
-
switch (term.termType) {
|
|
207
|
-
case "Literal":
|
|
208
|
-
case "NamedNode":
|
|
209
|
-
return purify.Either.of(term);
|
|
210
|
-
default:
|
|
211
|
-
return purify.Left(new rdfjsResource.Resource.MistypedValueError({
|
|
212
|
-
actualValue: term,
|
|
213
|
-
expectedValueType: "(rdfjs.Literal | rdfjs.NamedNode)",
|
|
214
|
-
focusResource: $resource,
|
|
215
|
-
predicate: BaseShaclCoreShapeStatic.$properties.hasValues["identifier"],
|
|
216
|
-
}));
|
|
217
|
-
}
|
|
218
|
-
})))
|
|
219
|
-
.map((values) => values.toArray())
|
|
220
|
-
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
221
|
-
object: valuesArray,
|
|
222
|
-
predicate: BaseShaclCoreShapeStatic.$properties.hasValues["identifier"],
|
|
223
|
-
subject: $resource,
|
|
224
|
-
}))
|
|
225
|
-
.chain((values) => values.head());
|
|
226
|
-
if (_hasValuesEither.isLeft()) {
|
|
227
|
-
return _hasValuesEither;
|
|
228
|
-
}
|
|
229
|
-
const hasValues = _hasValuesEither.unsafeCoerce();
|
|
230
|
-
const _in_Either = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.in_["identifier"], { unique: true }))
|
|
231
|
-
.chain((values) => values.chainMap((value) => value.toList()))
|
|
232
|
-
.chain((valueLists) => valueLists.chainMap((valueList) => purify.Either.of(rdfjsResource.Resource.Values.fromArray({
|
|
233
|
-
objects: valueList,
|
|
234
|
-
predicate: BaseShaclCoreShapeStatic.$properties.in_["identifier"],
|
|
235
|
-
subject: $resource,
|
|
236
|
-
})).chain((values) => values.chainMap((value) => purify.Either.of(value.toTerm()).chain((term) => {
|
|
237
|
-
switch (term.termType) {
|
|
238
|
-
case "Literal":
|
|
239
|
-
case "NamedNode":
|
|
240
|
-
return purify.Either.of(term);
|
|
241
|
-
default:
|
|
242
|
-
return purify.Left(new rdfjsResource.Resource.MistypedValueError({
|
|
243
|
-
actualValue: term,
|
|
244
|
-
expectedValueType: "(rdfjs.Literal | rdfjs.NamedNode)",
|
|
245
|
-
focusResource: $resource,
|
|
246
|
-
predicate: BaseShaclCoreShapeStatic.$properties.in_["identifier"],
|
|
247
|
-
}));
|
|
248
|
-
}
|
|
249
|
-
})))))
|
|
250
|
-
.map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
|
|
251
|
-
.map((values) => values.length > 0
|
|
252
|
-
? values.map((value) => purify.Maybe.of(value))
|
|
253
|
-
: rdfjsResource.Resource.Values.fromValue({
|
|
254
|
-
object: purify.Maybe.empty(),
|
|
255
|
-
predicate: BaseShaclCoreShapeStatic.$properties.in_["identifier"],
|
|
256
|
-
subject: $resource,
|
|
257
|
-
}))
|
|
258
|
-
.chain((values) => values.head());
|
|
259
|
-
if (_in_Either.isLeft()) {
|
|
260
|
-
return _in_Either;
|
|
218
|
+
if (filter.classes !== undefined &&
|
|
219
|
+
!$filterArray($filterIri)(filter.classes, value.classes)) {
|
|
220
|
+
return false;
|
|
261
221
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
.map((values) => values.length > 0
|
|
266
|
-
? values.map((value) => purify.Maybe.of(value))
|
|
267
|
-
: rdfjsResource.Resource.Values.fromValue({
|
|
268
|
-
object: purify.Maybe.empty(),
|
|
269
|
-
predicate: BaseShaclCoreShapeStatic.$properties.isDefinedBy["identifier"],
|
|
270
|
-
subject: $resource,
|
|
271
|
-
}))
|
|
272
|
-
.chain((values) => values.head());
|
|
273
|
-
if (_isDefinedByEither.isLeft()) {
|
|
274
|
-
return _isDefinedByEither;
|
|
275
|
-
}
|
|
276
|
-
const isDefinedBy = _isDefinedByEither.unsafeCoerce();
|
|
277
|
-
const _labelsEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.labels["identifier"], { unique: true }))
|
|
278
|
-
.chain((values) => {
|
|
279
|
-
if (!$preferredLanguages || $preferredLanguages.length === 0) {
|
|
280
|
-
return purify.Either.of(values);
|
|
281
|
-
}
|
|
282
|
-
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
283
|
-
if (literalValuesEither.isLeft()) {
|
|
284
|
-
return literalValuesEither;
|
|
285
|
-
}
|
|
286
|
-
const literalValues = literalValuesEither.unsafeCoerce();
|
|
287
|
-
// Return all literals for the first preferredLanguage, then all literals for the second preferredLanguage, etc.
|
|
288
|
-
// Within a preferredLanguage the literals may be in any order.
|
|
289
|
-
let filteredLiteralValues;
|
|
290
|
-
for (const preferredLanguage of $preferredLanguages) {
|
|
291
|
-
if (!filteredLiteralValues) {
|
|
292
|
-
filteredLiteralValues = literalValues.filter((value) => value.language === preferredLanguage);
|
|
293
|
-
}
|
|
294
|
-
else {
|
|
295
|
-
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
296
|
-
.filter((value) => value.language === preferredLanguage)
|
|
297
|
-
.toArray());
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
return purify.Either.of(filteredLiteralValues.map((literalValue) => new rdfjsResource.Resource.Value({
|
|
301
|
-
object: literalValue,
|
|
302
|
-
predicate: BaseShaclCoreShapeStatic.$properties.labels["identifier"],
|
|
303
|
-
subject: $resource,
|
|
304
|
-
})));
|
|
305
|
-
})
|
|
306
|
-
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
307
|
-
.map((values) => values.toArray())
|
|
308
|
-
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
309
|
-
object: valuesArray,
|
|
310
|
-
predicate: BaseShaclCoreShapeStatic.$properties.labels["identifier"],
|
|
311
|
-
subject: $resource,
|
|
312
|
-
}))
|
|
313
|
-
.chain((values) => values.head());
|
|
314
|
-
if (_labelsEither.isLeft()) {
|
|
315
|
-
return _labelsEither;
|
|
316
|
-
}
|
|
317
|
-
const labels = _labelsEither.unsafeCoerce();
|
|
318
|
-
const _languageInEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.languageIn["identifier"], { unique: true }))
|
|
319
|
-
.chain((values) => values.chainMap((value) => value.toList()))
|
|
320
|
-
.chain((valueLists) => valueLists.chainMap((valueList) => purify.Either.of(rdfjsResource.Resource.Values.fromArray({
|
|
321
|
-
objects: valueList,
|
|
322
|
-
predicate: BaseShaclCoreShapeStatic.$properties.languageIn["identifier"],
|
|
323
|
-
subject: $resource,
|
|
324
|
-
}))
|
|
325
|
-
.chain((values) => {
|
|
326
|
-
if (!$preferredLanguages || $preferredLanguages.length === 0) {
|
|
327
|
-
return purify.Either.of(values);
|
|
328
|
-
}
|
|
329
|
-
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
330
|
-
if (literalValuesEither.isLeft()) {
|
|
331
|
-
return literalValuesEither;
|
|
332
|
-
}
|
|
333
|
-
const literalValues = literalValuesEither.unsafeCoerce();
|
|
334
|
-
// Return all literals for the first preferredLanguage, then all literals for the second preferredLanguage, etc.
|
|
335
|
-
// Within a preferredLanguage the literals may be in any order.
|
|
336
|
-
let filteredLiteralValues;
|
|
337
|
-
for (const preferredLanguage of $preferredLanguages) {
|
|
338
|
-
if (!filteredLiteralValues) {
|
|
339
|
-
filteredLiteralValues = literalValues.filter((value) => value.language === preferredLanguage);
|
|
340
|
-
}
|
|
341
|
-
else {
|
|
342
|
-
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
343
|
-
.filter((value) => value.language === preferredLanguage)
|
|
344
|
-
.toArray());
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
return purify.Either.of(filteredLiteralValues.map((literalValue) => new rdfjsResource.Resource.Value({
|
|
348
|
-
object: literalValue,
|
|
349
|
-
predicate: BaseShaclCoreShapeStatic.$properties.languageIn["identifier"],
|
|
350
|
-
subject: $resource,
|
|
351
|
-
})));
|
|
352
|
-
})
|
|
353
|
-
.chain((values) => values.chainMap((value) => value.toString()))))
|
|
354
|
-
.map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
|
|
355
|
-
.map((values) => values.length > 0
|
|
356
|
-
? values.map((value) => purify.Maybe.of(value))
|
|
357
|
-
: rdfjsResource.Resource.Values.fromValue({
|
|
358
|
-
object: purify.Maybe.empty(),
|
|
359
|
-
predicate: BaseShaclCoreShapeStatic.$properties.languageIn["identifier"],
|
|
360
|
-
subject: $resource,
|
|
361
|
-
}))
|
|
362
|
-
.chain((values) => values.head());
|
|
363
|
-
if (_languageInEither.isLeft()) {
|
|
364
|
-
return _languageInEither;
|
|
365
|
-
}
|
|
366
|
-
const languageIn = _languageInEither.unsafeCoerce();
|
|
367
|
-
const _maxCountEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.maxCount["identifier"], { unique: true }))
|
|
368
|
-
.chain((values) => values.chainMap((value) => value.toNumber()))
|
|
369
|
-
.map((values) => values.length > 0
|
|
370
|
-
? values.map((value) => purify.Maybe.of(value))
|
|
371
|
-
: rdfjsResource.Resource.Values.fromValue({
|
|
372
|
-
object: purify.Maybe.empty(),
|
|
373
|
-
predicate: BaseShaclCoreShapeStatic.$properties.maxCount["identifier"],
|
|
374
|
-
subject: $resource,
|
|
375
|
-
}))
|
|
376
|
-
.chain((values) => values.head());
|
|
377
|
-
if (_maxCountEither.isLeft()) {
|
|
378
|
-
return _maxCountEither;
|
|
222
|
+
if (filter.comments !== undefined &&
|
|
223
|
+
!$filterArray($filterString)(filter.comments, value.comments)) {
|
|
224
|
+
return false;
|
|
379
225
|
}
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
}))
|
|
384
|
-
.chain((values) => {
|
|
385
|
-
if (!$preferredLanguages || $preferredLanguages.length === 0) {
|
|
386
|
-
return purify.Either.of(values);
|
|
387
|
-
}
|
|
388
|
-
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
389
|
-
if (literalValuesEither.isLeft()) {
|
|
390
|
-
return literalValuesEither;
|
|
391
|
-
}
|
|
392
|
-
const literalValues = literalValuesEither.unsafeCoerce();
|
|
393
|
-
// Return all literals for the first preferredLanguage, then all literals for the second preferredLanguage, etc.
|
|
394
|
-
// Within a preferredLanguage the literals may be in any order.
|
|
395
|
-
let filteredLiteralValues;
|
|
396
|
-
for (const preferredLanguage of $preferredLanguages) {
|
|
397
|
-
if (!filteredLiteralValues) {
|
|
398
|
-
filteredLiteralValues = literalValues.filter((value) => value.language === preferredLanguage);
|
|
399
|
-
}
|
|
400
|
-
else {
|
|
401
|
-
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
402
|
-
.filter((value) => value.language === preferredLanguage)
|
|
403
|
-
.toArray());
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
return purify.Either.of(filteredLiteralValues.map((literalValue) => new rdfjsResource.Resource.Value({
|
|
407
|
-
object: literalValue,
|
|
408
|
-
predicate: BaseShaclCoreShapeStatic.$properties.maxExclusive["identifier"],
|
|
409
|
-
subject: $resource,
|
|
410
|
-
})));
|
|
411
|
-
})
|
|
412
|
-
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
413
|
-
.map((values) => values.length > 0
|
|
414
|
-
? values.map((value) => purify.Maybe.of(value))
|
|
415
|
-
: rdfjsResource.Resource.Values.fromValue({
|
|
416
|
-
object: purify.Maybe.empty(),
|
|
417
|
-
predicate: BaseShaclCoreShapeStatic.$properties.maxExclusive["identifier"],
|
|
418
|
-
subject: $resource,
|
|
419
|
-
}))
|
|
420
|
-
.chain((values) => values.head());
|
|
421
|
-
if (_maxExclusiveEither.isLeft()) {
|
|
422
|
-
return _maxExclusiveEither;
|
|
226
|
+
if (filter.datatype !== undefined &&
|
|
227
|
+
!$filterMaybe($filterIri)(filter.datatype, value.datatype)) {
|
|
228
|
+
return false;
|
|
423
229
|
}
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
}))
|
|
428
|
-
.chain((values) => {
|
|
429
|
-
if (!$preferredLanguages || $preferredLanguages.length === 0) {
|
|
430
|
-
return purify.Either.of(values);
|
|
431
|
-
}
|
|
432
|
-
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
433
|
-
if (literalValuesEither.isLeft()) {
|
|
434
|
-
return literalValuesEither;
|
|
435
|
-
}
|
|
436
|
-
const literalValues = literalValuesEither.unsafeCoerce();
|
|
437
|
-
// Return all literals for the first preferredLanguage, then all literals for the second preferredLanguage, etc.
|
|
438
|
-
// Within a preferredLanguage the literals may be in any order.
|
|
439
|
-
let filteredLiteralValues;
|
|
440
|
-
for (const preferredLanguage of $preferredLanguages) {
|
|
441
|
-
if (!filteredLiteralValues) {
|
|
442
|
-
filteredLiteralValues = literalValues.filter((value) => value.language === preferredLanguage);
|
|
443
|
-
}
|
|
444
|
-
else {
|
|
445
|
-
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
446
|
-
.filter((value) => value.language === preferredLanguage)
|
|
447
|
-
.toArray());
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
return purify.Either.of(filteredLiteralValues.map((literalValue) => new rdfjsResource.Resource.Value({
|
|
451
|
-
object: literalValue,
|
|
452
|
-
predicate: BaseShaclCoreShapeStatic.$properties.maxInclusive["identifier"],
|
|
453
|
-
subject: $resource,
|
|
454
|
-
})));
|
|
455
|
-
})
|
|
456
|
-
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
457
|
-
.map((values) => values.length > 0
|
|
458
|
-
? values.map((value) => purify.Maybe.of(value))
|
|
459
|
-
: rdfjsResource.Resource.Values.fromValue({
|
|
460
|
-
object: purify.Maybe.empty(),
|
|
461
|
-
predicate: BaseShaclCoreShapeStatic.$properties.maxInclusive["identifier"],
|
|
462
|
-
subject: $resource,
|
|
463
|
-
}))
|
|
464
|
-
.chain((values) => values.head());
|
|
465
|
-
if (_maxInclusiveEither.isLeft()) {
|
|
466
|
-
return _maxInclusiveEither;
|
|
467
|
-
}
|
|
468
|
-
const maxInclusive = _maxInclusiveEither.unsafeCoerce();
|
|
469
|
-
const _maxLengthEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.maxLength["identifier"], { unique: true }))
|
|
470
|
-
.chain((values) => values.chainMap((value) => value.toNumber()))
|
|
471
|
-
.map((values) => values.length > 0
|
|
472
|
-
? values.map((value) => purify.Maybe.of(value))
|
|
473
|
-
: rdfjsResource.Resource.Values.fromValue({
|
|
474
|
-
object: purify.Maybe.empty(),
|
|
475
|
-
predicate: BaseShaclCoreShapeStatic.$properties.maxLength["identifier"],
|
|
476
|
-
subject: $resource,
|
|
477
|
-
}))
|
|
478
|
-
.chain((values) => values.head());
|
|
479
|
-
if (_maxLengthEither.isLeft()) {
|
|
480
|
-
return _maxLengthEither;
|
|
481
|
-
}
|
|
482
|
-
const maxLength = _maxLengthEither.unsafeCoerce();
|
|
483
|
-
const _minCountEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.minCount["identifier"], { unique: true }))
|
|
484
|
-
.chain((values) => values.chainMap((value) => value.toNumber()))
|
|
485
|
-
.map((values) => values.length > 0
|
|
486
|
-
? values.map((value) => purify.Maybe.of(value))
|
|
487
|
-
: rdfjsResource.Resource.Values.fromValue({
|
|
488
|
-
object: purify.Maybe.empty(),
|
|
489
|
-
predicate: BaseShaclCoreShapeStatic.$properties.minCount["identifier"],
|
|
490
|
-
subject: $resource,
|
|
491
|
-
}))
|
|
492
|
-
.chain((values) => values.head());
|
|
493
|
-
if (_minCountEither.isLeft()) {
|
|
494
|
-
return _minCountEither;
|
|
230
|
+
if (filter.deactivated !== undefined &&
|
|
231
|
+
!$filterMaybe($filterBoolean)(filter.deactivated, value.deactivated)) {
|
|
232
|
+
return false;
|
|
495
233
|
}
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
}))
|
|
500
|
-
.chain((values) => {
|
|
501
|
-
if (!$preferredLanguages || $preferredLanguages.length === 0) {
|
|
502
|
-
return purify.Either.of(values);
|
|
503
|
-
}
|
|
504
|
-
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
505
|
-
if (literalValuesEither.isLeft()) {
|
|
506
|
-
return literalValuesEither;
|
|
507
|
-
}
|
|
508
|
-
const literalValues = literalValuesEither.unsafeCoerce();
|
|
509
|
-
// Return all literals for the first preferredLanguage, then all literals for the second preferredLanguage, etc.
|
|
510
|
-
// Within a preferredLanguage the literals may be in any order.
|
|
511
|
-
let filteredLiteralValues;
|
|
512
|
-
for (const preferredLanguage of $preferredLanguages) {
|
|
513
|
-
if (!filteredLiteralValues) {
|
|
514
|
-
filteredLiteralValues = literalValues.filter((value) => value.language === preferredLanguage);
|
|
515
|
-
}
|
|
516
|
-
else {
|
|
517
|
-
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
518
|
-
.filter((value) => value.language === preferredLanguage)
|
|
519
|
-
.toArray());
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
return purify.Either.of(filteredLiteralValues.map((literalValue) => new rdfjsResource.Resource.Value({
|
|
523
|
-
object: literalValue,
|
|
524
|
-
predicate: BaseShaclCoreShapeStatic.$properties.minExclusive["identifier"],
|
|
525
|
-
subject: $resource,
|
|
526
|
-
})));
|
|
527
|
-
})
|
|
528
|
-
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
529
|
-
.map((values) => values.length > 0
|
|
530
|
-
? values.map((value) => purify.Maybe.of(value))
|
|
531
|
-
: rdfjsResource.Resource.Values.fromValue({
|
|
532
|
-
object: purify.Maybe.empty(),
|
|
533
|
-
predicate: BaseShaclCoreShapeStatic.$properties.minExclusive["identifier"],
|
|
534
|
-
subject: $resource,
|
|
535
|
-
}))
|
|
536
|
-
.chain((values) => values.head());
|
|
537
|
-
if (_minExclusiveEither.isLeft()) {
|
|
538
|
-
return _minExclusiveEither;
|
|
234
|
+
if (filter.flags !== undefined &&
|
|
235
|
+
!$filterArray($filterString)(filter.flags, value.flags)) {
|
|
236
|
+
return false;
|
|
539
237
|
}
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
}))
|
|
544
|
-
.chain((values) => {
|
|
545
|
-
if (!$preferredLanguages || $preferredLanguages.length === 0) {
|
|
546
|
-
return purify.Either.of(values);
|
|
547
|
-
}
|
|
548
|
-
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
549
|
-
if (literalValuesEither.isLeft()) {
|
|
550
|
-
return literalValuesEither;
|
|
551
|
-
}
|
|
552
|
-
const literalValues = literalValuesEither.unsafeCoerce();
|
|
553
|
-
// Return all literals for the first preferredLanguage, then all literals for the second preferredLanguage, etc.
|
|
554
|
-
// Within a preferredLanguage the literals may be in any order.
|
|
555
|
-
let filteredLiteralValues;
|
|
556
|
-
for (const preferredLanguage of $preferredLanguages) {
|
|
557
|
-
if (!filteredLiteralValues) {
|
|
558
|
-
filteredLiteralValues = literalValues.filter((value) => value.language === preferredLanguage);
|
|
559
|
-
}
|
|
560
|
-
else {
|
|
561
|
-
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
562
|
-
.filter((value) => value.language === preferredLanguage)
|
|
563
|
-
.toArray());
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
return purify.Either.of(filteredLiteralValues.map((literalValue) => new rdfjsResource.Resource.Value({
|
|
567
|
-
object: literalValue,
|
|
568
|
-
predicate: BaseShaclCoreShapeStatic.$properties.minInclusive["identifier"],
|
|
569
|
-
subject: $resource,
|
|
570
|
-
})));
|
|
571
|
-
})
|
|
572
|
-
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
573
|
-
.map((values) => values.length > 0
|
|
574
|
-
? values.map((value) => purify.Maybe.of(value))
|
|
575
|
-
: rdfjsResource.Resource.Values.fromValue({
|
|
576
|
-
object: purify.Maybe.empty(),
|
|
577
|
-
predicate: BaseShaclCoreShapeStatic.$properties.minInclusive["identifier"],
|
|
578
|
-
subject: $resource,
|
|
579
|
-
}))
|
|
580
|
-
.chain((values) => values.head());
|
|
581
|
-
if (_minInclusiveEither.isLeft()) {
|
|
582
|
-
return _minInclusiveEither;
|
|
583
|
-
}
|
|
584
|
-
const minInclusive = _minInclusiveEither.unsafeCoerce();
|
|
585
|
-
const _minLengthEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.minLength["identifier"], { unique: true }))
|
|
586
|
-
.chain((values) => values.chainMap((value) => value.toNumber()))
|
|
587
|
-
.map((values) => values.length > 0
|
|
588
|
-
? values.map((value) => purify.Maybe.of(value))
|
|
589
|
-
: rdfjsResource.Resource.Values.fromValue({
|
|
590
|
-
object: purify.Maybe.empty(),
|
|
591
|
-
predicate: BaseShaclCoreShapeStatic.$properties.minLength["identifier"],
|
|
592
|
-
subject: $resource,
|
|
593
|
-
}))
|
|
594
|
-
.chain((values) => values.head());
|
|
595
|
-
if (_minLengthEither.isLeft()) {
|
|
596
|
-
return _minLengthEither;
|
|
597
|
-
}
|
|
598
|
-
const minLength = _minLengthEither.unsafeCoerce();
|
|
599
|
-
const _nodeKindEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.nodeKind["identifier"], { unique: true }))
|
|
600
|
-
.chain((values) => values.chainMap((value) => value.toIri().chain((iri) => {
|
|
601
|
-
switch (iri.value) {
|
|
602
|
-
case "http://www.w3.org/ns/shacl#BlankNode":
|
|
603
|
-
return purify.Either.of(iri);
|
|
604
|
-
case "http://www.w3.org/ns/shacl#BlankNodeOrIRI":
|
|
605
|
-
return purify.Either.of(iri);
|
|
606
|
-
case "http://www.w3.org/ns/shacl#BlankNodeOrLiteral":
|
|
607
|
-
return purify.Either.of(iri);
|
|
608
|
-
case "http://www.w3.org/ns/shacl#IRI":
|
|
609
|
-
return purify.Either.of(iri);
|
|
610
|
-
case "http://www.w3.org/ns/shacl#IRIOrLiteral":
|
|
611
|
-
return purify.Either.of(iri);
|
|
612
|
-
case "http://www.w3.org/ns/shacl#Literal":
|
|
613
|
-
return purify.Either.of(iri);
|
|
614
|
-
default:
|
|
615
|
-
return purify.Left(new rdfjsResource.Resource.MistypedValueError({
|
|
616
|
-
actualValue: iri,
|
|
617
|
-
expectedValueType: 'rdfjs.NamedNode<"http://www.w3.org/ns/shacl#BlankNode" | "http://www.w3.org/ns/shacl#BlankNodeOrIRI" | "http://www.w3.org/ns/shacl#BlankNodeOrLiteral" | "http://www.w3.org/ns/shacl#IRI" | "http://www.w3.org/ns/shacl#IRIOrLiteral" | "http://www.w3.org/ns/shacl#Literal">',
|
|
618
|
-
focusResource: $resource,
|
|
619
|
-
predicate: BaseShaclCoreShapeStatic.$properties.nodeKind["identifier"],
|
|
620
|
-
}));
|
|
621
|
-
}
|
|
622
|
-
})))
|
|
623
|
-
.map((values) => values.length > 0
|
|
624
|
-
? values.map((value) => purify.Maybe.of(value))
|
|
625
|
-
: rdfjsResource.Resource.Values.fromValue({
|
|
626
|
-
object: purify.Maybe.empty(),
|
|
627
|
-
predicate: BaseShaclCoreShapeStatic.$properties.nodeKind["identifier"],
|
|
628
|
-
subject: $resource,
|
|
629
|
-
}))
|
|
630
|
-
.chain((values) => values.head());
|
|
631
|
-
if (_nodeKindEither.isLeft()) {
|
|
632
|
-
return _nodeKindEither;
|
|
238
|
+
if (filter.hasValues !== undefined &&
|
|
239
|
+
!$filterArray($filterTerm)(filter.hasValues, value.hasValues)) {
|
|
240
|
+
return false;
|
|
633
241
|
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
242
|
+
if (filter.in_ !== undefined &&
|
|
243
|
+
!$filterMaybe($filterArray($filterTerm))(filter.in_, value.in_)) {
|
|
244
|
+
return false;
|
|
245
|
+
}
|
|
246
|
+
if (filter.isDefinedBy !== undefined &&
|
|
247
|
+
!$filterMaybe($filterIdentifier)(filter.isDefinedBy, value.isDefinedBy)) {
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
if (filter.labels !== undefined &&
|
|
251
|
+
!$filterArray($filterString)(filter.labels, value.labels)) {
|
|
252
|
+
return false;
|
|
253
|
+
}
|
|
254
|
+
if (filter.languageIn !== undefined &&
|
|
255
|
+
!$filterMaybe($filterArray($filterString))(filter.languageIn, value.languageIn)) {
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
if (filter.maxCount !== undefined &&
|
|
259
|
+
!$filterMaybe(($filterNumeric))(filter.maxCount, value.maxCount)) {
|
|
260
|
+
return false;
|
|
261
|
+
}
|
|
262
|
+
if (filter.maxExclusive !== undefined &&
|
|
263
|
+
!$filterMaybe($filterLiteral)(filter.maxExclusive, value.maxExclusive)) {
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
if (filter.maxInclusive !== undefined &&
|
|
267
|
+
!$filterMaybe($filterLiteral)(filter.maxInclusive, value.maxInclusive)) {
|
|
268
|
+
return false;
|
|
269
|
+
}
|
|
270
|
+
if (filter.maxLength !== undefined &&
|
|
271
|
+
!$filterMaybe(($filterNumeric))(filter.maxLength, value.maxLength)) {
|
|
272
|
+
return false;
|
|
273
|
+
}
|
|
274
|
+
if (filter.minCount !== undefined &&
|
|
275
|
+
!$filterMaybe(($filterNumeric))(filter.minCount, value.minCount)) {
|
|
276
|
+
return false;
|
|
277
|
+
}
|
|
278
|
+
if (filter.minExclusive !== undefined &&
|
|
279
|
+
!$filterMaybe($filterLiteral)(filter.minExclusive, value.minExclusive)) {
|
|
280
|
+
return false;
|
|
281
|
+
}
|
|
282
|
+
if (filter.minInclusive !== undefined &&
|
|
283
|
+
!$filterMaybe($filterLiteral)(filter.minInclusive, value.minInclusive)) {
|
|
284
|
+
return false;
|
|
285
|
+
}
|
|
286
|
+
if (filter.minLength !== undefined &&
|
|
287
|
+
!$filterMaybe(($filterNumeric))(filter.minLength, value.minLength)) {
|
|
288
|
+
return false;
|
|
289
|
+
}
|
|
290
|
+
if (filter.nodeKind !== undefined &&
|
|
291
|
+
!$filterMaybe($filterIri)(filter.nodeKind, value.nodeKind)) {
|
|
292
|
+
return false;
|
|
293
|
+
}
|
|
294
|
+
if (filter.nodes !== undefined &&
|
|
295
|
+
!$filterArray($filterIdentifier)(filter.nodes, value.nodes)) {
|
|
296
|
+
return false;
|
|
297
|
+
}
|
|
298
|
+
if (filter.not !== undefined &&
|
|
299
|
+
!$filterArray($filterIdentifier)(filter.not, value.not)) {
|
|
300
|
+
return false;
|
|
301
|
+
}
|
|
302
|
+
if (filter.or !== undefined &&
|
|
303
|
+
!$filterArray($filterArray($filterIdentifier))(filter.or, value.or)) {
|
|
304
|
+
return false;
|
|
305
|
+
}
|
|
306
|
+
if (filter.patterns !== undefined &&
|
|
307
|
+
!$filterArray($filterString)(filter.patterns, value.patterns)) {
|
|
308
|
+
return false;
|
|
309
|
+
}
|
|
310
|
+
if (filter.xone !== undefined &&
|
|
311
|
+
!$filterArray($filterArray($filterIdentifier))(filter.xone, value.xone)) {
|
|
312
|
+
return false;
|
|
313
|
+
}
|
|
314
|
+
return true;
|
|
315
|
+
}
|
|
316
|
+
BaseShaclCoreShapeStatic.$filter = $filter;
|
|
317
|
+
let $Identifier;
|
|
318
|
+
(function ($Identifier) {
|
|
319
|
+
$Identifier.fromString = $identifierFromString; // biome-ignore lint/suspicious/noShadowRestrictedNames: allow toString
|
|
320
|
+
$Identifier.toString = Resource.Identifier.toString;
|
|
321
|
+
})($Identifier = BaseShaclCoreShapeStatic.$Identifier || (BaseShaclCoreShapeStatic.$Identifier = {}));
|
|
322
|
+
function isBaseShaclCoreShape(object) {
|
|
323
|
+
switch (object.$type) {
|
|
324
|
+
case "ShaclCoreNodeShape":
|
|
325
|
+
case "ShaclCorePropertyShape":
|
|
326
|
+
return true;
|
|
327
|
+
default:
|
|
328
|
+
return false;
|
|
646
329
|
}
|
|
647
|
-
|
|
648
|
-
|
|
330
|
+
}
|
|
331
|
+
BaseShaclCoreShapeStatic.isBaseShaclCoreShape = isBaseShaclCoreShape;
|
|
332
|
+
function $propertiesFromRdf($parameters) {
|
|
333
|
+
return Right(new Resource.Value({
|
|
334
|
+
dataFactory: dataFactory,
|
|
335
|
+
focusResource: $parameters.resource,
|
|
336
|
+
propertyPath: $RdfVocabularies.rdf.subject,
|
|
337
|
+
term: $parameters.resource.identifier,
|
|
338
|
+
}).toValues())
|
|
649
339
|
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
650
|
-
.
|
|
651
|
-
.
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
340
|
+
.chain((values) => values.head())
|
|
341
|
+
.chain(($identifier) => $shaclPropertyFromRdf({
|
|
342
|
+
graph: $parameters.graph,
|
|
343
|
+
resource: $parameters.resource,
|
|
344
|
+
propertySchema: BaseShaclCoreShapeStatic.$schema.properties.and,
|
|
345
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
346
|
+
.chain((values) => values.chainMap((value) => value.toList({ graph: $parameters.graph })))
|
|
347
|
+
.chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
|
|
348
|
+
focusResource: $parameters.resource,
|
|
349
|
+
propertyPath: BaseShaclCoreShapeStatic.$schema.properties.and.path,
|
|
350
|
+
values: valueList.toArray(),
|
|
351
|
+
})).chain((values) => values.chainMap((value) => value.toIdentifier()))))
|
|
352
|
+
.map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
|
|
353
|
+
.map((values) => values.toArray())
|
|
354
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
355
|
+
focusResource: $parameters.resource,
|
|
356
|
+
propertyPath: BaseShaclCoreShapeStatic.$schema.properties.and.path,
|
|
357
|
+
value: valuesArray,
|
|
358
|
+
})),
|
|
359
|
+
}).chain((and) => $shaclPropertyFromRdf({
|
|
360
|
+
graph: $parameters.graph,
|
|
361
|
+
resource: $parameters.resource,
|
|
362
|
+
propertySchema: BaseShaclCoreShapeStatic.$schema.properties.classes,
|
|
363
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
364
|
+
.chain((values) => values.chainMap((value) => value.toIri()))
|
|
365
|
+
.map((values) => values.toArray())
|
|
366
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
367
|
+
focusResource: $parameters.resource,
|
|
368
|
+
propertyPath: BaseShaclCoreShapeStatic.$schema.properties.classes.path,
|
|
369
|
+
value: valuesArray,
|
|
370
|
+
})),
|
|
371
|
+
}).chain((classes) => $shaclPropertyFromRdf({
|
|
372
|
+
graph: $parameters.graph,
|
|
373
|
+
resource: $parameters.resource,
|
|
374
|
+
propertySchema: BaseShaclCoreShapeStatic.$schema.properties.comments,
|
|
375
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
376
|
+
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
377
|
+
.chain((values) => values.chainMap((value) => value.toString()))
|
|
378
|
+
.map((values) => values.toArray())
|
|
379
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
380
|
+
focusResource: $parameters.resource,
|
|
381
|
+
propertyPath: BaseShaclCoreShapeStatic.$schema.properties.comments
|
|
382
|
+
.path,
|
|
383
|
+
value: valuesArray,
|
|
384
|
+
})),
|
|
385
|
+
}).chain((comments) => $shaclPropertyFromRdf({
|
|
386
|
+
graph: $parameters.graph,
|
|
387
|
+
resource: $parameters.resource,
|
|
388
|
+
propertySchema: BaseShaclCoreShapeStatic.$schema.properties.datatype,
|
|
389
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
390
|
+
.chain((values) => values.chainMap((value) => value.toIri()))
|
|
391
|
+
.map((values) => values.length > 0
|
|
392
|
+
? values.map((value) => Maybe.of(value))
|
|
393
|
+
: Resource.Values.fromValue({
|
|
394
|
+
focusResource: $parameters.resource,
|
|
395
|
+
propertyPath: BaseShaclCoreShapeStatic.$schema.properties
|
|
396
|
+
.datatype.path,
|
|
397
|
+
value: Maybe.empty(),
|
|
398
|
+
})),
|
|
399
|
+
}).chain((datatype) => $shaclPropertyFromRdf({
|
|
400
|
+
graph: $parameters.graph,
|
|
401
|
+
resource: $parameters.resource,
|
|
402
|
+
propertySchema: BaseShaclCoreShapeStatic.$schema.properties.deactivated,
|
|
403
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
404
|
+
.chain((values) => values.chainMap((value) => value.toBoolean()))
|
|
405
|
+
.map((values) => values.length > 0
|
|
406
|
+
? values.map((value) => Maybe.of(value))
|
|
407
|
+
: Resource.Values.fromValue({
|
|
408
|
+
focusResource: $parameters.resource,
|
|
409
|
+
propertyPath: BaseShaclCoreShapeStatic.$schema.properties
|
|
410
|
+
.deactivated.path,
|
|
411
|
+
value: Maybe.empty(),
|
|
412
|
+
})),
|
|
413
|
+
}).chain((deactivated) => $shaclPropertyFromRdf({
|
|
414
|
+
graph: $parameters.graph,
|
|
415
|
+
resource: $parameters.resource,
|
|
416
|
+
propertySchema: BaseShaclCoreShapeStatic.$schema.properties.flags,
|
|
417
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
418
|
+
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
419
|
+
.chain((values) => values.chainMap((value) => value.toString()))
|
|
420
|
+
.map((values) => values.toArray())
|
|
421
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
422
|
+
focusResource: $parameters.resource,
|
|
423
|
+
propertyPath: BaseShaclCoreShapeStatic.$schema.properties.flags
|
|
424
|
+
.path,
|
|
425
|
+
value: valuesArray,
|
|
426
|
+
})),
|
|
427
|
+
}).chain((flags) => $shaclPropertyFromRdf({
|
|
428
|
+
graph: $parameters.graph,
|
|
429
|
+
resource: $parameters.resource,
|
|
430
|
+
propertySchema: BaseShaclCoreShapeStatic.$schema.properties.hasValues,
|
|
431
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
432
|
+
.chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
|
|
433
|
+
switch (term.termType) {
|
|
434
|
+
case "NamedNode":
|
|
435
|
+
case "Literal":
|
|
436
|
+
return Either.of(term);
|
|
437
|
+
default:
|
|
438
|
+
return Left(new Resource.MistypedTermValueError({
|
|
439
|
+
actualValue: term,
|
|
440
|
+
expectedValueType: "(NamedNode | Literal)",
|
|
441
|
+
focusResource: $parameters.resource,
|
|
442
|
+
propertyPath: BaseShaclCoreShapeStatic.$schema
|
|
443
|
+
.properties.hasValues.path,
|
|
444
|
+
}));
|
|
696
445
|
}
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
446
|
+
})))
|
|
447
|
+
.map((values) => values.toArray())
|
|
448
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
449
|
+
focusResource: $parameters.resource,
|
|
450
|
+
propertyPath: BaseShaclCoreShapeStatic.$schema.properties
|
|
451
|
+
.hasValues.path,
|
|
452
|
+
value: valuesArray,
|
|
453
|
+
})),
|
|
454
|
+
}).chain((hasValues) => $shaclPropertyFromRdf({
|
|
455
|
+
graph: $parameters.graph,
|
|
456
|
+
resource: $parameters.resource,
|
|
457
|
+
propertySchema: BaseShaclCoreShapeStatic.$schema.properties.in_,
|
|
458
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
459
|
+
.chain((values) => values.chainMap((value) => value.toList({ graph: $parameters.graph })))
|
|
460
|
+
.chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
|
|
461
|
+
focusResource: $parameters.resource,
|
|
462
|
+
propertyPath: BaseShaclCoreShapeStatic.$schema
|
|
463
|
+
.properties.in_.path,
|
|
464
|
+
values: valueList.toArray(),
|
|
465
|
+
})).chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
|
|
466
|
+
switch (term.termType) {
|
|
467
|
+
case "NamedNode":
|
|
468
|
+
case "Literal":
|
|
469
|
+
return Either.of(term);
|
|
470
|
+
default:
|
|
471
|
+
return Left(new Resource.MistypedTermValueError({
|
|
472
|
+
actualValue: term,
|
|
473
|
+
expectedValueType: "(NamedNode | Literal)",
|
|
474
|
+
focusResource: $parameters.resource,
|
|
475
|
+
propertyPath: BaseShaclCoreShapeStatic
|
|
476
|
+
.$schema.properties.in_
|
|
477
|
+
.path,
|
|
478
|
+
}));
|
|
701
479
|
}
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
480
|
+
})))))
|
|
481
|
+
.map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
|
|
482
|
+
.map((values) => values.length > 0
|
|
483
|
+
? values.map((value) => Maybe.of(value))
|
|
484
|
+
: Resource.Values.fromValue({
|
|
485
|
+
focusResource: $parameters.resource,
|
|
486
|
+
propertyPath: BaseShaclCoreShapeStatic.$schema
|
|
487
|
+
.properties.in_.path,
|
|
488
|
+
value: Maybe.empty(),
|
|
489
|
+
})),
|
|
490
|
+
}).chain((in_) => $shaclPropertyFromRdf({
|
|
491
|
+
graph: $parameters.graph,
|
|
492
|
+
resource: $parameters.resource,
|
|
493
|
+
propertySchema: BaseShaclCoreShapeStatic.$schema.properties.isDefinedBy,
|
|
494
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
495
|
+
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
496
|
+
.map((values) => values.length > 0
|
|
497
|
+
? values.map((value) => Maybe.of(value))
|
|
498
|
+
: Resource.Values.fromValue({
|
|
499
|
+
focusResource: $parameters.resource,
|
|
500
|
+
propertyPath: BaseShaclCoreShapeStatic.$schema
|
|
501
|
+
.properties.isDefinedBy.path,
|
|
502
|
+
value: Maybe.empty(),
|
|
503
|
+
})),
|
|
504
|
+
}).chain((isDefinedBy) => $shaclPropertyFromRdf({
|
|
505
|
+
graph: $parameters.graph,
|
|
506
|
+
resource: $parameters.resource,
|
|
507
|
+
propertySchema: BaseShaclCoreShapeStatic.$schema.properties.labels,
|
|
508
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
509
|
+
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
510
|
+
.chain((values) => values.chainMap((value) => value.toString()))
|
|
511
|
+
.map((values) => values.toArray())
|
|
512
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
513
|
+
focusResource: $parameters.resource,
|
|
514
|
+
propertyPath: BaseShaclCoreShapeStatic.$schema
|
|
515
|
+
.properties.labels.path,
|
|
516
|
+
value: valuesArray,
|
|
517
|
+
})),
|
|
518
|
+
}).chain((labels) => $shaclPropertyFromRdf({
|
|
519
|
+
graph: $parameters.graph,
|
|
520
|
+
resource: $parameters.resource,
|
|
521
|
+
propertySchema: BaseShaclCoreShapeStatic.$schema.properties.languageIn,
|
|
522
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
523
|
+
.chain((values) => values.chainMap((value) => value.toList({
|
|
524
|
+
graph: $parameters.graph,
|
|
525
|
+
})))
|
|
526
|
+
.chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
|
|
527
|
+
focusResource: $parameters.resource,
|
|
528
|
+
propertyPath: BaseShaclCoreShapeStatic.$schema
|
|
529
|
+
.properties.languageIn.path,
|
|
530
|
+
values: valueList.toArray(),
|
|
531
|
+
}))
|
|
532
|
+
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
533
|
+
.chain((values) => values.chainMap((value) => value.toString()))))
|
|
534
|
+
.map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
|
|
535
|
+
.map((values) => values.length > 0
|
|
536
|
+
? values.map((value) => Maybe.of(value))
|
|
537
|
+
: Resource.Values.fromValue({
|
|
538
|
+
focusResource: $parameters.resource,
|
|
539
|
+
propertyPath: BaseShaclCoreShapeStatic.$schema
|
|
540
|
+
.properties.languageIn.path,
|
|
541
|
+
value: Maybe.empty(),
|
|
542
|
+
})),
|
|
543
|
+
}).chain((languageIn) => $shaclPropertyFromRdf({
|
|
544
|
+
graph: $parameters.graph,
|
|
545
|
+
resource: $parameters.resource,
|
|
546
|
+
propertySchema: BaseShaclCoreShapeStatic.$schema.properties.maxCount,
|
|
547
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
548
|
+
.chain((values) => values.chainMap((value) => value.toInt()))
|
|
549
|
+
.map((values) => values.length > 0
|
|
550
|
+
? values.map((value) => Maybe.of(value))
|
|
551
|
+
: Resource.Values.fromValue({
|
|
552
|
+
focusResource: $parameters.resource,
|
|
553
|
+
propertyPath: BaseShaclCoreShapeStatic.$schema
|
|
554
|
+
.properties.maxCount.path,
|
|
555
|
+
value: Maybe.empty(),
|
|
556
|
+
})),
|
|
557
|
+
}).chain((maxCount) => $shaclPropertyFromRdf({
|
|
558
|
+
graph: $parameters.graph,
|
|
559
|
+
resource: $parameters.resource,
|
|
560
|
+
propertySchema: BaseShaclCoreShapeStatic.$schema.properties.maxExclusive,
|
|
561
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
562
|
+
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
563
|
+
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
564
|
+
.map((values) => values.length > 0
|
|
565
|
+
? values.map((value) => Maybe.of(value))
|
|
566
|
+
: Resource.Values.fromValue({
|
|
567
|
+
focusResource: $parameters.resource,
|
|
568
|
+
propertyPath: BaseShaclCoreShapeStatic.$schema
|
|
569
|
+
.properties.maxExclusive.path,
|
|
570
|
+
value: Maybe.empty(),
|
|
571
|
+
})),
|
|
572
|
+
}).chain((maxExclusive) => $shaclPropertyFromRdf({
|
|
573
|
+
graph: $parameters.graph,
|
|
574
|
+
resource: $parameters.resource,
|
|
575
|
+
propertySchema: BaseShaclCoreShapeStatic.$schema.properties.maxInclusive,
|
|
576
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
577
|
+
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
578
|
+
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
579
|
+
.map((values) => values.length > 0
|
|
580
|
+
? values.map((value) => Maybe.of(value))
|
|
581
|
+
: Resource.Values.fromValue({
|
|
582
|
+
focusResource: $parameters.resource,
|
|
583
|
+
propertyPath: BaseShaclCoreShapeStatic
|
|
584
|
+
.$schema.properties
|
|
585
|
+
.maxInclusive.path,
|
|
586
|
+
value: Maybe.empty(),
|
|
587
|
+
})),
|
|
588
|
+
}).chain((maxInclusive) => $shaclPropertyFromRdf({
|
|
589
|
+
graph: $parameters.graph,
|
|
590
|
+
resource: $parameters.resource,
|
|
591
|
+
propertySchema: BaseShaclCoreShapeStatic.$schema.properties.maxLength,
|
|
592
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
593
|
+
.chain((values) => values.chainMap((value) => value.toInt()))
|
|
594
|
+
.map((values) => values.length > 0
|
|
595
|
+
? values.map((value) => Maybe.of(value))
|
|
596
|
+
: Resource.Values.fromValue({
|
|
597
|
+
focusResource: $parameters.resource,
|
|
598
|
+
propertyPath: BaseShaclCoreShapeStatic
|
|
599
|
+
.$schema.properties
|
|
600
|
+
.maxLength.path,
|
|
601
|
+
value: Maybe.empty(),
|
|
602
|
+
})),
|
|
603
|
+
}).chain((maxLength) => $shaclPropertyFromRdf({
|
|
604
|
+
graph: $parameters.graph,
|
|
605
|
+
resource: $parameters.resource,
|
|
606
|
+
propertySchema: BaseShaclCoreShapeStatic.$schema.properties.minCount,
|
|
607
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
608
|
+
.chain((values) => values.chainMap((value) => value.toInt()))
|
|
609
|
+
.map((values) => values.length > 0
|
|
610
|
+
? values.map((value) => Maybe.of(value))
|
|
611
|
+
: Resource.Values.fromValue({
|
|
612
|
+
focusResource: $parameters.resource,
|
|
613
|
+
propertyPath: BaseShaclCoreShapeStatic
|
|
614
|
+
.$schema.properties
|
|
615
|
+
.minCount.path,
|
|
616
|
+
value: Maybe.empty(),
|
|
617
|
+
})),
|
|
618
|
+
}).chain((minCount) => $shaclPropertyFromRdf({
|
|
619
|
+
graph: $parameters.graph,
|
|
620
|
+
resource: $parameters.resource,
|
|
621
|
+
propertySchema: BaseShaclCoreShapeStatic.$schema.properties.minExclusive,
|
|
622
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
623
|
+
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
624
|
+
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
625
|
+
.map((values) => values.length > 0
|
|
626
|
+
? values.map((value) => Maybe.of(value))
|
|
627
|
+
: Resource.Values.fromValue({
|
|
628
|
+
focusResource: $parameters.resource,
|
|
629
|
+
propertyPath: BaseShaclCoreShapeStatic
|
|
630
|
+
.$schema.properties
|
|
631
|
+
.minExclusive.path,
|
|
632
|
+
value: Maybe.empty(),
|
|
633
|
+
})),
|
|
634
|
+
}).chain((minExclusive) => $shaclPropertyFromRdf({
|
|
635
|
+
graph: $parameters.graph,
|
|
636
|
+
resource: $parameters.resource,
|
|
637
|
+
propertySchema: BaseShaclCoreShapeStatic.$schema.properties.minInclusive,
|
|
638
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
639
|
+
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
640
|
+
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
641
|
+
.map((values) => values.length > 0
|
|
642
|
+
? values.map((value) => Maybe.of(value))
|
|
643
|
+
: Resource.Values.fromValue({
|
|
644
|
+
focusResource: $parameters.resource,
|
|
645
|
+
propertyPath: BaseShaclCoreShapeStatic
|
|
646
|
+
.$schema.properties
|
|
647
|
+
.minInclusive.path,
|
|
648
|
+
value: Maybe.empty(),
|
|
649
|
+
})),
|
|
650
|
+
}).chain((minInclusive) => $shaclPropertyFromRdf({
|
|
651
|
+
graph: $parameters.graph,
|
|
652
|
+
resource: $parameters.resource,
|
|
653
|
+
propertySchema: BaseShaclCoreShapeStatic.$schema.properties.minLength,
|
|
654
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
655
|
+
.chain((values) => values.chainMap((value) => value.toInt()))
|
|
656
|
+
.map((values) => values.length > 0
|
|
657
|
+
? values.map((value) => Maybe.of(value))
|
|
658
|
+
: Resource.Values.fromValue({
|
|
659
|
+
focusResource: $parameters.resource,
|
|
660
|
+
propertyPath: BaseShaclCoreShapeStatic
|
|
661
|
+
.$schema
|
|
662
|
+
.properties
|
|
663
|
+
.minLength.path,
|
|
664
|
+
value: Maybe.empty(),
|
|
665
|
+
})),
|
|
666
|
+
}).chain((minLength) => $shaclPropertyFromRdf({
|
|
667
|
+
graph: $parameters.graph,
|
|
668
|
+
resource: $parameters.resource,
|
|
669
|
+
propertySchema: BaseShaclCoreShapeStatic.$schema.properties.nodeKind,
|
|
670
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
671
|
+
.chain((values) => values.chainMap((value) => value.toIri([
|
|
672
|
+
dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNode"),
|
|
673
|
+
dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrIRI"),
|
|
674
|
+
dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrLiteral"),
|
|
675
|
+
dataFactory.namedNode("http://www.w3.org/ns/shacl#IRI"),
|
|
676
|
+
dataFactory.namedNode("http://www.w3.org/ns/shacl#IRIOrLiteral"),
|
|
677
|
+
dataFactory.namedNode("http://www.w3.org/ns/shacl#Literal"),
|
|
678
|
+
])))
|
|
679
|
+
.map((values) => values.length > 0
|
|
680
|
+
? values.map((value) => Maybe.of(value))
|
|
681
|
+
: Resource.Values.fromValue({
|
|
682
|
+
focusResource: $parameters.resource,
|
|
683
|
+
propertyPath: BaseShaclCoreShapeStatic
|
|
684
|
+
.$schema
|
|
685
|
+
.properties
|
|
686
|
+
.nodeKind.path,
|
|
687
|
+
value: Maybe.empty(),
|
|
688
|
+
})),
|
|
689
|
+
}).chain((nodeKind) => $shaclPropertyFromRdf({
|
|
690
|
+
graph: $parameters.graph,
|
|
691
|
+
resource: $parameters.resource,
|
|
692
|
+
propertySchema: BaseShaclCoreShapeStatic.$schema.properties.nodes,
|
|
693
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
694
|
+
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
695
|
+
.map((values) => values.toArray())
|
|
696
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
697
|
+
focusResource: $parameters.resource,
|
|
698
|
+
propertyPath: BaseShaclCoreShapeStatic
|
|
699
|
+
.$schema
|
|
700
|
+
.properties
|
|
701
|
+
.nodes.path,
|
|
702
|
+
value: valuesArray,
|
|
703
|
+
})),
|
|
704
|
+
}).chain((nodes) => $shaclPropertyFromRdf({
|
|
705
|
+
graph: $parameters.graph,
|
|
706
|
+
resource: $parameters.resource,
|
|
707
|
+
propertySchema: BaseShaclCoreShapeStatic.$schema.properties.not,
|
|
708
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
709
|
+
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
710
|
+
.map((values) => values.toArray())
|
|
711
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
712
|
+
focusResource: $parameters.resource,
|
|
713
|
+
propertyPath: BaseShaclCoreShapeStatic
|
|
714
|
+
.$schema
|
|
715
|
+
.properties
|
|
716
|
+
.not.path,
|
|
717
|
+
value: valuesArray,
|
|
718
|
+
})),
|
|
719
|
+
}).chain((not) => $shaclPropertyFromRdf({
|
|
720
|
+
graph: $parameters.graph,
|
|
721
|
+
resource: $parameters.resource,
|
|
722
|
+
propertySchema: BaseShaclCoreShapeStatic.$schema.properties.or,
|
|
723
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
724
|
+
.chain((values) => values.chainMap((value) => value.toList({
|
|
725
|
+
graph: $parameters.graph,
|
|
726
|
+
})))
|
|
727
|
+
.chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
|
|
728
|
+
focusResource: $parameters.resource,
|
|
729
|
+
propertyPath: BaseShaclCoreShapeStatic
|
|
730
|
+
.$schema
|
|
731
|
+
.properties
|
|
732
|
+
.or
|
|
733
|
+
.path,
|
|
734
|
+
values: valueList.toArray(),
|
|
735
|
+
})).chain((values) => values.chainMap((value) => value.toIdentifier()))))
|
|
736
|
+
.map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
|
|
737
|
+
.map((values) => values.toArray())
|
|
738
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
739
|
+
focusResource: $parameters.resource,
|
|
740
|
+
propertyPath: BaseShaclCoreShapeStatic
|
|
741
|
+
.$schema
|
|
742
|
+
.properties
|
|
743
|
+
.or.path,
|
|
744
|
+
value: valuesArray,
|
|
745
|
+
})),
|
|
746
|
+
}).chain((or) => $shaclPropertyFromRdf({
|
|
747
|
+
graph: $parameters.graph,
|
|
748
|
+
resource: $parameters.resource,
|
|
749
|
+
propertySchema: BaseShaclCoreShapeStatic.$schema.properties
|
|
750
|
+
.patterns,
|
|
751
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
752
|
+
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
753
|
+
.chain((values) => values.chainMap((value) => value.toString()))
|
|
754
|
+
.map((values) => values.toArray())
|
|
755
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
756
|
+
focusResource: $parameters.resource,
|
|
757
|
+
propertyPath: BaseShaclCoreShapeStatic
|
|
758
|
+
.$schema
|
|
759
|
+
.properties
|
|
760
|
+
.patterns
|
|
761
|
+
.path,
|
|
762
|
+
value: valuesArray,
|
|
763
|
+
})),
|
|
764
|
+
}).chain((patterns) => $shaclPropertyFromRdf({
|
|
765
|
+
graph: $parameters.graph,
|
|
766
|
+
resource: $parameters.resource,
|
|
767
|
+
propertySchema: BaseShaclCoreShapeStatic.$schema.properties
|
|
768
|
+
.xone,
|
|
769
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
770
|
+
.chain((values) => values.chainMap((value) => value.toList({
|
|
771
|
+
graph: $parameters.graph,
|
|
772
|
+
})))
|
|
773
|
+
.chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
|
|
774
|
+
focusResource: $parameters.resource,
|
|
775
|
+
propertyPath: BaseShaclCoreShapeStatic
|
|
776
|
+
.$schema
|
|
777
|
+
.properties
|
|
778
|
+
.xone
|
|
779
|
+
.path,
|
|
780
|
+
values: valueList.toArray(),
|
|
781
|
+
})).chain((values) => values.chainMap((value) => value.toIdentifier()))))
|
|
782
|
+
.map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
|
|
783
|
+
.map((values) => values.toArray())
|
|
784
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
785
|
+
focusResource: $parameters.resource,
|
|
786
|
+
propertyPath: BaseShaclCoreShapeStatic
|
|
787
|
+
.$schema
|
|
788
|
+
.properties
|
|
789
|
+
.xone
|
|
790
|
+
.path,
|
|
791
|
+
value: valuesArray,
|
|
792
|
+
})),
|
|
793
|
+
}).map((xone) => ({
|
|
741
794
|
$identifier,
|
|
742
795
|
and,
|
|
743
796
|
classes,
|
|
@@ -764,235 +817,474 @@ export var BaseShaclCoreShapeStatic;
|
|
|
764
817
|
or,
|
|
765
818
|
patterns,
|
|
766
819
|
xone,
|
|
767
|
-
});
|
|
820
|
+
})))))))))))))))))))))))))));
|
|
768
821
|
}
|
|
769
822
|
BaseShaclCoreShapeStatic.$propertiesFromRdf = $propertiesFromRdf;
|
|
770
823
|
function $toRdf(_baseShaclCoreShape, options) {
|
|
771
|
-
const mutateGraph = options?.mutateGraph;
|
|
772
824
|
const resourceSet = options?.resourceSet ??
|
|
773
|
-
new
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
});
|
|
777
|
-
const resource = resourceSet.mutableResource(_baseShaclCoreShape.$identifier, { mutateGraph });
|
|
778
|
-
resource.add(BaseShaclCoreShapeStatic.$properties.and["identifier"], ..._baseShaclCoreShape.and.flatMap((item) => [
|
|
825
|
+
new ResourceSet(datasetFactory.dataset(), { dataFactory: dataFactory });
|
|
826
|
+
const resource = resourceSet.resource(_baseShaclCoreShape.$identifier);
|
|
827
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#and"), _baseShaclCoreShape.and.flatMap((item) => [
|
|
779
828
|
item.length > 0
|
|
780
829
|
? item.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
781
830
|
if (itemIndex === 0) {
|
|
782
831
|
currentSubListResource = listResource;
|
|
783
832
|
}
|
|
784
833
|
else {
|
|
785
|
-
const newSubListResource = resourceSet.
|
|
786
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier);
|
|
834
|
+
const newSubListResource = resourceSet.resource(dataFactory.blankNode());
|
|
835
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
|
|
787
836
|
currentSubListResource = newSubListResource;
|
|
788
837
|
}
|
|
789
|
-
currentSubListResource.add($RdfVocabularies.rdf.first,
|
|
838
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, [item], options?.graph);
|
|
790
839
|
if (itemIndex + 1 === list.length) {
|
|
791
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil);
|
|
840
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
|
|
792
841
|
}
|
|
793
842
|
return { currentSubListResource, listResource };
|
|
794
843
|
}, {
|
|
795
844
|
currentSubListResource: null,
|
|
796
|
-
listResource: resourceSet.
|
|
845
|
+
listResource: resourceSet.resource(dataFactory.blankNode()),
|
|
797
846
|
}).listResource.identifier
|
|
798
847
|
: $RdfVocabularies.rdf.nil,
|
|
799
|
-
]));
|
|
800
|
-
resource.add(
|
|
801
|
-
resource.add(
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
resource.add(
|
|
805
|
-
resource.add(
|
|
806
|
-
|
|
848
|
+
]), options?.graph);
|
|
849
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#class"), _baseShaclCoreShape.classes.flatMap((item) => [item]), options?.graph);
|
|
850
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), _baseShaclCoreShape.comments.flatMap((item) => [
|
|
851
|
+
$literalFactory.string(item),
|
|
852
|
+
]), options?.graph);
|
|
853
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#datatype"), _baseShaclCoreShape.datatype.toList(), options?.graph);
|
|
854
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"), _baseShaclCoreShape.deactivated
|
|
855
|
+
.toList()
|
|
856
|
+
.flatMap((value) => [
|
|
857
|
+
$literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
|
|
858
|
+
]), options?.graph);
|
|
859
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#flags"), _baseShaclCoreShape.flags.flatMap((item) => [
|
|
860
|
+
$literalFactory.string(item),
|
|
861
|
+
]), options?.graph);
|
|
862
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#hasValue"), _baseShaclCoreShape.hasValues.flatMap((item) => [item]), options?.graph);
|
|
863
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#in"), _baseShaclCoreShape.in_.toList().flatMap((value) => [
|
|
807
864
|
value.length > 0
|
|
808
865
|
? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
809
866
|
if (itemIndex === 0) {
|
|
810
867
|
currentSubListResource = listResource;
|
|
811
868
|
}
|
|
812
869
|
else {
|
|
813
|
-
const newSubListResource = resourceSet.
|
|
814
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier);
|
|
870
|
+
const newSubListResource = resourceSet.resource(dataFactory.blankNode());
|
|
871
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
|
|
815
872
|
currentSubListResource = newSubListResource;
|
|
816
873
|
}
|
|
817
|
-
currentSubListResource.add($RdfVocabularies.rdf.first,
|
|
874
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, [item], options?.graph);
|
|
818
875
|
if (itemIndex + 1 === list.length) {
|
|
819
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil);
|
|
876
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
|
|
820
877
|
}
|
|
821
878
|
return { currentSubListResource, listResource };
|
|
822
879
|
}, {
|
|
823
880
|
currentSubListResource: null,
|
|
824
|
-
listResource: resourceSet.
|
|
881
|
+
listResource: resourceSet.resource(dataFactory.blankNode()),
|
|
825
882
|
}).listResource.identifier
|
|
826
883
|
: $RdfVocabularies.rdf.nil,
|
|
827
|
-
]));
|
|
828
|
-
resource.add(
|
|
829
|
-
resource.add(
|
|
830
|
-
|
|
884
|
+
]), options?.graph);
|
|
885
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"), _baseShaclCoreShape.isDefinedBy.toList(), options?.graph);
|
|
886
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), _baseShaclCoreShape.labels.flatMap((item) => [
|
|
887
|
+
$literalFactory.string(item),
|
|
888
|
+
]), options?.graph);
|
|
889
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#languageIn"), _baseShaclCoreShape.languageIn.toList().flatMap((value) => [
|
|
831
890
|
value.length > 0
|
|
832
891
|
? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
833
892
|
if (itemIndex === 0) {
|
|
834
893
|
currentSubListResource = listResource;
|
|
835
894
|
}
|
|
836
895
|
else {
|
|
837
|
-
const newSubListResource = resourceSet.
|
|
838
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier);
|
|
896
|
+
const newSubListResource = resourceSet.resource(dataFactory.blankNode());
|
|
897
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
|
|
839
898
|
currentSubListResource = newSubListResource;
|
|
840
899
|
}
|
|
841
|
-
currentSubListResource.add($RdfVocabularies.rdf.first,
|
|
900
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, [$literalFactory.string(item)], options?.graph);
|
|
842
901
|
if (itemIndex + 1 === list.length) {
|
|
843
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil);
|
|
902
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
|
|
844
903
|
}
|
|
845
904
|
return { currentSubListResource, listResource };
|
|
846
905
|
}, {
|
|
847
906
|
currentSubListResource: null,
|
|
848
|
-
listResource: resourceSet.
|
|
907
|
+
listResource: resourceSet.resource(dataFactory.blankNode()),
|
|
849
908
|
}).listResource.identifier
|
|
850
909
|
: $RdfVocabularies.rdf.nil,
|
|
851
|
-
]));
|
|
852
|
-
resource.add(
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
resource.add(
|
|
858
|
-
resource.add(
|
|
859
|
-
resource.add(
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
910
|
+
]), options?.graph);
|
|
911
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxCount"), _baseShaclCoreShape.maxCount
|
|
912
|
+
.toList()
|
|
913
|
+
.flatMap((value) => [
|
|
914
|
+
$literalFactory.number(value, $RdfVocabularies.xsd.unsignedInt),
|
|
915
|
+
]), options?.graph);
|
|
916
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxExclusive"), _baseShaclCoreShape.maxExclusive.toList(), options?.graph);
|
|
917
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxInclusive"), _baseShaclCoreShape.maxInclusive.toList(), options?.graph);
|
|
918
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxLength"), _baseShaclCoreShape.maxLength
|
|
919
|
+
.toList()
|
|
920
|
+
.flatMap((value) => [
|
|
921
|
+
$literalFactory.number(value, $RdfVocabularies.xsd.unsignedInt),
|
|
922
|
+
]), options?.graph);
|
|
923
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minCount"), _baseShaclCoreShape.minCount
|
|
924
|
+
.toList()
|
|
925
|
+
.flatMap((value) => [
|
|
926
|
+
$literalFactory.number(value, $RdfVocabularies.xsd.unsignedInt),
|
|
927
|
+
]), options?.graph);
|
|
928
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minExclusive"), _baseShaclCoreShape.minExclusive.toList(), options?.graph);
|
|
929
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minInclusive"), _baseShaclCoreShape.minInclusive.toList(), options?.graph);
|
|
930
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#minLength"), _baseShaclCoreShape.minLength
|
|
931
|
+
.toList()
|
|
932
|
+
.flatMap((value) => [
|
|
933
|
+
$literalFactory.number(value, $RdfVocabularies.xsd.unsignedInt),
|
|
934
|
+
]), options?.graph);
|
|
935
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"), _baseShaclCoreShape.nodeKind.toList(), options?.graph);
|
|
936
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#node"), _baseShaclCoreShape.nodes.flatMap((item) => [item]), options?.graph);
|
|
937
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#not"), _baseShaclCoreShape.not.flatMap((item) => [item]), options?.graph);
|
|
938
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#or"), _baseShaclCoreShape.or.flatMap((item) => [
|
|
864
939
|
item.length > 0
|
|
865
940
|
? item.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
866
941
|
if (itemIndex === 0) {
|
|
867
942
|
currentSubListResource = listResource;
|
|
868
943
|
}
|
|
869
944
|
else {
|
|
870
|
-
const newSubListResource = resourceSet.
|
|
871
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier);
|
|
945
|
+
const newSubListResource = resourceSet.resource(dataFactory.blankNode());
|
|
946
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
|
|
872
947
|
currentSubListResource = newSubListResource;
|
|
873
948
|
}
|
|
874
|
-
currentSubListResource.add($RdfVocabularies.rdf.first,
|
|
949
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, [item], options?.graph);
|
|
875
950
|
if (itemIndex + 1 === list.length) {
|
|
876
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil);
|
|
951
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
|
|
877
952
|
}
|
|
878
953
|
return { currentSubListResource, listResource };
|
|
879
954
|
}, {
|
|
880
955
|
currentSubListResource: null,
|
|
881
|
-
listResource: resourceSet.
|
|
956
|
+
listResource: resourceSet.resource(dataFactory.blankNode()),
|
|
882
957
|
}).listResource.identifier
|
|
883
958
|
: $RdfVocabularies.rdf.nil,
|
|
884
|
-
]));
|
|
885
|
-
resource.add(
|
|
886
|
-
|
|
959
|
+
]), options?.graph);
|
|
960
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#pattern"), _baseShaclCoreShape.patterns.flatMap((item) => [
|
|
961
|
+
$literalFactory.string(item),
|
|
962
|
+
]), options?.graph);
|
|
963
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#xone"), _baseShaclCoreShape.xone.flatMap((item) => [
|
|
887
964
|
item.length > 0
|
|
888
965
|
? item.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
889
966
|
if (itemIndex === 0) {
|
|
890
967
|
currentSubListResource = listResource;
|
|
891
968
|
}
|
|
892
969
|
else {
|
|
893
|
-
const newSubListResource = resourceSet.
|
|
894
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier);
|
|
970
|
+
const newSubListResource = resourceSet.resource(dataFactory.blankNode());
|
|
971
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
|
|
895
972
|
currentSubListResource = newSubListResource;
|
|
896
973
|
}
|
|
897
|
-
currentSubListResource.add($RdfVocabularies.rdf.first,
|
|
974
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, [item], options?.graph);
|
|
898
975
|
if (itemIndex + 1 === list.length) {
|
|
899
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil);
|
|
976
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
|
|
900
977
|
}
|
|
901
978
|
return { currentSubListResource, listResource };
|
|
902
979
|
}, {
|
|
903
980
|
currentSubListResource: null,
|
|
904
|
-
listResource: resourceSet.
|
|
981
|
+
listResource: resourceSet.resource(dataFactory.blankNode()),
|
|
905
982
|
}).listResource.identifier
|
|
906
983
|
: $RdfVocabularies.rdf.nil,
|
|
907
|
-
]));
|
|
984
|
+
]), options?.graph);
|
|
908
985
|
return resource;
|
|
909
986
|
}
|
|
910
987
|
BaseShaclCoreShapeStatic.$toRdf = $toRdf;
|
|
911
|
-
BaseShaclCoreShapeStatic.$
|
|
912
|
-
|
|
913
|
-
identifier:
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
988
|
+
BaseShaclCoreShapeStatic.$schema = {
|
|
989
|
+
properties: {
|
|
990
|
+
$identifier: {
|
|
991
|
+
kind: "Identifier",
|
|
992
|
+
type: () => ({ kind: "Identifier" }),
|
|
993
|
+
},
|
|
994
|
+
$type: {
|
|
995
|
+
kind: "TypeDiscriminant",
|
|
996
|
+
type: () => ({
|
|
997
|
+
descendantValues: ["ShaclCoreNodeShape", "ShaclCorePropertyShape"],
|
|
998
|
+
kind: "TypeDiscriminant",
|
|
999
|
+
}),
|
|
1000
|
+
},
|
|
1001
|
+
and: {
|
|
1002
|
+
kind: "Shacl",
|
|
1003
|
+
type: () => ({
|
|
1004
|
+
kind: "Set",
|
|
1005
|
+
item: () => ({
|
|
1006
|
+
kind: "List",
|
|
1007
|
+
item: () => ({ kind: "Identifier" }),
|
|
1008
|
+
}),
|
|
1009
|
+
}),
|
|
1010
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#and"),
|
|
1011
|
+
},
|
|
1012
|
+
classes: {
|
|
1013
|
+
kind: "Shacl",
|
|
1014
|
+
type: () => ({
|
|
1015
|
+
kind: "Set",
|
|
1016
|
+
item: () => ({ kind: "Iri" }),
|
|
1017
|
+
}),
|
|
1018
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#class"),
|
|
1019
|
+
},
|
|
1020
|
+
comments: {
|
|
1021
|
+
kind: "Shacl",
|
|
1022
|
+
type: () => ({
|
|
1023
|
+
kind: "Set",
|
|
1024
|
+
item: () => ({ kind: "String" }),
|
|
1025
|
+
}),
|
|
1026
|
+
path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
|
|
1027
|
+
},
|
|
1028
|
+
datatype: {
|
|
1029
|
+
kind: "Shacl",
|
|
1030
|
+
type: () => ({
|
|
1031
|
+
kind: "Maybe",
|
|
1032
|
+
item: () => ({ kind: "Iri" }),
|
|
1033
|
+
}),
|
|
1034
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#datatype"),
|
|
1035
|
+
},
|
|
1036
|
+
deactivated: {
|
|
1037
|
+
kind: "Shacl",
|
|
1038
|
+
type: () => ({
|
|
1039
|
+
kind: "Maybe",
|
|
1040
|
+
item: () => ({ kind: "Boolean" }),
|
|
1041
|
+
}),
|
|
1042
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"),
|
|
1043
|
+
},
|
|
1044
|
+
flags: {
|
|
1045
|
+
kind: "Shacl",
|
|
1046
|
+
type: () => ({
|
|
1047
|
+
kind: "Set",
|
|
1048
|
+
item: () => ({ kind: "String" }),
|
|
1049
|
+
}),
|
|
1050
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#flags"),
|
|
1051
|
+
},
|
|
1052
|
+
hasValues: {
|
|
1053
|
+
kind: "Shacl",
|
|
1054
|
+
type: () => ({
|
|
1055
|
+
kind: "Set",
|
|
1056
|
+
item: () => ({ kind: "Term" }),
|
|
1057
|
+
}),
|
|
1058
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#hasValue"),
|
|
1059
|
+
},
|
|
1060
|
+
in_: {
|
|
1061
|
+
kind: "Shacl",
|
|
1062
|
+
type: () => ({
|
|
1063
|
+
kind: "Maybe",
|
|
1064
|
+
item: () => ({
|
|
1065
|
+
kind: "List",
|
|
1066
|
+
item: () => ({ kind: "Term" }),
|
|
1067
|
+
}),
|
|
1068
|
+
}),
|
|
1069
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#in"),
|
|
1070
|
+
},
|
|
1071
|
+
isDefinedBy: {
|
|
1072
|
+
kind: "Shacl",
|
|
1073
|
+
type: () => ({
|
|
1074
|
+
kind: "Maybe",
|
|
1075
|
+
item: () => ({ kind: "Identifier" }),
|
|
1076
|
+
}),
|
|
1077
|
+
path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"),
|
|
1078
|
+
},
|
|
1079
|
+
labels: {
|
|
1080
|
+
kind: "Shacl",
|
|
1081
|
+
type: () => ({
|
|
1082
|
+
kind: "Set",
|
|
1083
|
+
item: () => ({ kind: "String" }),
|
|
1084
|
+
}),
|
|
1085
|
+
path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
|
|
1086
|
+
},
|
|
1087
|
+
languageIn: {
|
|
1088
|
+
kind: "Shacl",
|
|
1089
|
+
type: () => ({
|
|
1090
|
+
kind: "Maybe",
|
|
1091
|
+
item: () => ({
|
|
1092
|
+
kind: "List",
|
|
1093
|
+
item: () => ({ kind: "String" }),
|
|
1094
|
+
}),
|
|
1095
|
+
}),
|
|
1096
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#languageIn"),
|
|
1097
|
+
},
|
|
1098
|
+
maxCount: {
|
|
1099
|
+
kind: "Shacl",
|
|
1100
|
+
type: () => ({
|
|
1101
|
+
kind: "Maybe",
|
|
1102
|
+
item: () => ({ kind: "Int" }),
|
|
1103
|
+
}),
|
|
1104
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxCount"),
|
|
1105
|
+
},
|
|
1106
|
+
maxExclusive: {
|
|
1107
|
+
kind: "Shacl",
|
|
1108
|
+
type: () => ({
|
|
1109
|
+
kind: "Maybe",
|
|
1110
|
+
item: () => ({ kind: "Literal" }),
|
|
1111
|
+
}),
|
|
1112
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxExclusive"),
|
|
1113
|
+
},
|
|
1114
|
+
maxInclusive: {
|
|
1115
|
+
kind: "Shacl",
|
|
1116
|
+
type: () => ({
|
|
1117
|
+
kind: "Maybe",
|
|
1118
|
+
item: () => ({ kind: "Literal" }),
|
|
1119
|
+
}),
|
|
1120
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxInclusive"),
|
|
1121
|
+
},
|
|
1122
|
+
maxLength: {
|
|
1123
|
+
kind: "Shacl",
|
|
1124
|
+
type: () => ({
|
|
1125
|
+
kind: "Maybe",
|
|
1126
|
+
item: () => ({ kind: "Int" }),
|
|
1127
|
+
}),
|
|
1128
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxLength"),
|
|
1129
|
+
},
|
|
1130
|
+
minCount: {
|
|
1131
|
+
kind: "Shacl",
|
|
1132
|
+
type: () => ({
|
|
1133
|
+
kind: "Maybe",
|
|
1134
|
+
item: () => ({ kind: "Int" }),
|
|
1135
|
+
}),
|
|
1136
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minCount"),
|
|
1137
|
+
},
|
|
1138
|
+
minExclusive: {
|
|
1139
|
+
kind: "Shacl",
|
|
1140
|
+
type: () => ({
|
|
1141
|
+
kind: "Maybe",
|
|
1142
|
+
item: () => ({ kind: "Literal" }),
|
|
1143
|
+
}),
|
|
1144
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minExclusive"),
|
|
1145
|
+
},
|
|
1146
|
+
minInclusive: {
|
|
1147
|
+
kind: "Shacl",
|
|
1148
|
+
type: () => ({
|
|
1149
|
+
kind: "Maybe",
|
|
1150
|
+
item: () => ({ kind: "Literal" }),
|
|
1151
|
+
}),
|
|
1152
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minInclusive"),
|
|
1153
|
+
},
|
|
1154
|
+
minLength: {
|
|
1155
|
+
kind: "Shacl",
|
|
1156
|
+
type: () => ({
|
|
1157
|
+
kind: "Maybe",
|
|
1158
|
+
item: () => ({ kind: "Int" }),
|
|
1159
|
+
}),
|
|
1160
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minLength"),
|
|
1161
|
+
},
|
|
1162
|
+
nodeKind: {
|
|
1163
|
+
kind: "Shacl",
|
|
1164
|
+
type: () => ({
|
|
1165
|
+
kind: "Maybe",
|
|
1166
|
+
item: () => ({
|
|
1167
|
+
kind: "Iri",
|
|
1168
|
+
in: [
|
|
1169
|
+
dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNode"),
|
|
1170
|
+
dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrIRI"),
|
|
1171
|
+
dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrLiteral"),
|
|
1172
|
+
dataFactory.namedNode("http://www.w3.org/ns/shacl#IRI"),
|
|
1173
|
+
dataFactory.namedNode("http://www.w3.org/ns/shacl#IRIOrLiteral"),
|
|
1174
|
+
dataFactory.namedNode("http://www.w3.org/ns/shacl#Literal"),
|
|
1175
|
+
],
|
|
1176
|
+
}),
|
|
1177
|
+
}),
|
|
1178
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"),
|
|
1179
|
+
},
|
|
1180
|
+
nodes: {
|
|
1181
|
+
kind: "Shacl",
|
|
1182
|
+
type: () => ({
|
|
1183
|
+
kind: "Set",
|
|
1184
|
+
item: () => ({ kind: "Identifier" }),
|
|
1185
|
+
}),
|
|
1186
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#node"),
|
|
1187
|
+
},
|
|
1188
|
+
not: {
|
|
1189
|
+
kind: "Shacl",
|
|
1190
|
+
type: () => ({
|
|
1191
|
+
kind: "Set",
|
|
1192
|
+
item: () => ({ kind: "Identifier" }),
|
|
1193
|
+
}),
|
|
1194
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#not"),
|
|
1195
|
+
},
|
|
1196
|
+
or: {
|
|
1197
|
+
kind: "Shacl",
|
|
1198
|
+
type: () => ({
|
|
1199
|
+
kind: "Set",
|
|
1200
|
+
item: () => ({
|
|
1201
|
+
kind: "List",
|
|
1202
|
+
item: () => ({ kind: "Identifier" }),
|
|
1203
|
+
}),
|
|
1204
|
+
}),
|
|
1205
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#or"),
|
|
1206
|
+
},
|
|
1207
|
+
patterns: {
|
|
1208
|
+
kind: "Shacl",
|
|
1209
|
+
type: () => ({
|
|
1210
|
+
kind: "Set",
|
|
1211
|
+
item: () => ({ kind: "String" }),
|
|
1212
|
+
}),
|
|
1213
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#pattern"),
|
|
1214
|
+
},
|
|
1215
|
+
xone: {
|
|
1216
|
+
kind: "Shacl",
|
|
1217
|
+
type: () => ({
|
|
1218
|
+
kind: "Set",
|
|
1219
|
+
item: () => ({
|
|
1220
|
+
kind: "List",
|
|
1221
|
+
item: () => ({ kind: "Identifier" }),
|
|
1222
|
+
}),
|
|
1223
|
+
}),
|
|
1224
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#xone"),
|
|
1225
|
+
},
|
|
982
1226
|
},
|
|
983
1227
|
};
|
|
984
1228
|
})(BaseShaclCoreShapeStatic || (BaseShaclCoreShapeStatic = {}));
|
|
985
1229
|
export var ShaclCorePropertyShape;
|
|
986
1230
|
(function (ShaclCorePropertyShape) {
|
|
1231
|
+
function $filter(filter, value) {
|
|
1232
|
+
if (!BaseShaclCoreShapeStatic.$filter(filter, value)) {
|
|
1233
|
+
return false;
|
|
1234
|
+
}
|
|
1235
|
+
if (filter.defaultValue !== undefined &&
|
|
1236
|
+
!$filterMaybe($filterTerm)(filter.defaultValue, value.defaultValue)) {
|
|
1237
|
+
return false;
|
|
1238
|
+
}
|
|
1239
|
+
if (filter.descriptions !== undefined &&
|
|
1240
|
+
!$filterArray($filterString)(filter.descriptions, value.descriptions)) {
|
|
1241
|
+
return false;
|
|
1242
|
+
}
|
|
1243
|
+
if (filter.groups !== undefined &&
|
|
1244
|
+
!$filterArray($filterIdentifier)(filter.groups, value.groups)) {
|
|
1245
|
+
return false;
|
|
1246
|
+
}
|
|
1247
|
+
if (filter.names !== undefined &&
|
|
1248
|
+
!$filterArray($filterString)(filter.names, value.names)) {
|
|
1249
|
+
return false;
|
|
1250
|
+
}
|
|
1251
|
+
if (filter.order !== undefined &&
|
|
1252
|
+
!$filterMaybe(($filterNumeric))(filter.order, value.order)) {
|
|
1253
|
+
return false;
|
|
1254
|
+
}
|
|
1255
|
+
if (filter.path !== undefined &&
|
|
1256
|
+
!PropertyPath.$filter(filter.path, value.path)) {
|
|
1257
|
+
return false;
|
|
1258
|
+
}
|
|
1259
|
+
if (filter.uniqueLang !== undefined &&
|
|
1260
|
+
!$filterMaybe($filterBoolean)(filter.uniqueLang, value.uniqueLang)) {
|
|
1261
|
+
return false;
|
|
1262
|
+
}
|
|
1263
|
+
return true;
|
|
1264
|
+
}
|
|
1265
|
+
ShaclCorePropertyShape.$filter = $filter;
|
|
987
1266
|
ShaclCorePropertyShape.$fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape");
|
|
988
|
-
|
|
1267
|
+
let $Identifier;
|
|
1268
|
+
(function ($Identifier) {
|
|
1269
|
+
$Identifier.fromString = $identifierFromString; // biome-ignore lint/suspicious/noShadowRestrictedNames: allow toString
|
|
1270
|
+
$Identifier.toString = Resource.Identifier.toString;
|
|
1271
|
+
})($Identifier = ShaclCorePropertyShape.$Identifier || (ShaclCorePropertyShape.$Identifier = {}));
|
|
1272
|
+
function isShaclCorePropertyShape(object) {
|
|
1273
|
+
switch (object.$type) {
|
|
1274
|
+
case "ShaclCorePropertyShape":
|
|
1275
|
+
return true;
|
|
1276
|
+
default:
|
|
1277
|
+
return false;
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
ShaclCorePropertyShape.isShaclCorePropertyShape = isShaclCorePropertyShape;
|
|
989
1281
|
function $fromRdf(resource, options) {
|
|
990
|
-
let { ignoreRdfType = false, objectSet, preferredLanguages,
|
|
1282
|
+
let { context, ignoreRdfType = false, objectSet, preferredLanguages, } = options ?? {};
|
|
991
1283
|
if (!objectSet) {
|
|
992
|
-
objectSet = new $RdfjsDatasetObjectSet(
|
|
1284
|
+
objectSet = new $RdfjsDatasetObjectSet(resource.dataset);
|
|
993
1285
|
}
|
|
994
1286
|
return ShaclCorePropertyShape.$propertiesFromRdf({
|
|
995
|
-
|
|
1287
|
+
context,
|
|
996
1288
|
ignoreRdfType,
|
|
997
1289
|
objectSet,
|
|
998
1290
|
preferredLanguages,
|
|
@@ -1000,209 +1292,142 @@ export var ShaclCorePropertyShape;
|
|
|
1000
1292
|
});
|
|
1001
1293
|
}
|
|
1002
1294
|
ShaclCorePropertyShape.$fromRdf = $fromRdf;
|
|
1003
|
-
function $propertiesFromRdf(
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
const $super0Either = BaseShaclCoreShapeStatic.$propertiesFromRdf({
|
|
1007
|
-
...$context,
|
|
1295
|
+
function $propertiesFromRdf($parameters) {
|
|
1296
|
+
return BaseShaclCoreShapeStatic.$propertiesFromRdf({
|
|
1297
|
+
...$parameters,
|
|
1008
1298
|
ignoreRdfType: true,
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
});
|
|
1013
|
-
if ($super0Either.isLeft()) {
|
|
1014
|
-
return $super0Either;
|
|
1015
|
-
}
|
|
1016
|
-
const $super0 = $super0Either.unsafeCoerce();
|
|
1017
|
-
if (!$ignoreRdfType) {
|
|
1018
|
-
const $rdfTypeCheck = $resource
|
|
1019
|
-
.value($RdfVocabularies.rdf.type)
|
|
1299
|
+
}).chain(($super0) => (!$parameters.ignoreRdfType
|
|
1300
|
+
? $parameters.resource
|
|
1301
|
+
.value($RdfVocabularies.rdf.type, { graph: $parameters.graph })
|
|
1020
1302
|
.chain((actualRdfType) => actualRdfType.toIri())
|
|
1021
1303
|
.chain((actualRdfType) => {
|
|
1022
1304
|
// Check the expected type and its known subtypes
|
|
1023
1305
|
switch (actualRdfType.value) {
|
|
1024
1306
|
case "http://www.w3.org/ns/shacl#PropertyShape":
|
|
1025
|
-
return
|
|
1307
|
+
return Right(true);
|
|
1026
1308
|
}
|
|
1027
1309
|
// Check arbitrary rdfs:subClassOf's of the expected type
|
|
1028
|
-
if ($resource.isInstanceOf(ShaclCorePropertyShape.$fromRdfType)) {
|
|
1029
|
-
return
|
|
1310
|
+
if ($parameters.resource.isInstanceOf(ShaclCorePropertyShape.$fromRdfType, { graph: $parameters.graph })) {
|
|
1311
|
+
return Right(true);
|
|
1030
1312
|
}
|
|
1031
|
-
return
|
|
1032
|
-
})
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
const _defaultValueEither = purify.Either.of($resource.values(ShaclCorePropertyShape.$properties.defaultValue["identifier"], {
|
|
1040
|
-
unique: true,
|
|
1041
|
-
}))
|
|
1042
|
-
.chain((values) => values.chainMap((value) => purify.Either.of(value.toTerm()).chain((term) => {
|
|
1043
|
-
switch (term.termType) {
|
|
1044
|
-
case "Literal":
|
|
1045
|
-
case "NamedNode":
|
|
1046
|
-
return purify.Either.of(term);
|
|
1047
|
-
default:
|
|
1048
|
-
return purify.Left(new rdfjsResource.Resource.MistypedValueError({
|
|
1049
|
-
actualValue: term,
|
|
1050
|
-
expectedValueType: "(rdfjs.Literal | rdfjs.NamedNode)",
|
|
1051
|
-
focusResource: $resource,
|
|
1052
|
-
predicate: ShaclCorePropertyShape.$properties.defaultValue["identifier"],
|
|
1053
|
-
}));
|
|
1054
|
-
}
|
|
1055
|
-
})))
|
|
1056
|
-
.map((values) => values.length > 0
|
|
1057
|
-
? values.map((value) => purify.Maybe.of(value))
|
|
1058
|
-
: rdfjsResource.Resource.Values.fromValue({
|
|
1059
|
-
object: purify.Maybe.empty(),
|
|
1060
|
-
predicate: ShaclCorePropertyShape.$properties.defaultValue["identifier"],
|
|
1061
|
-
subject: $resource,
|
|
1062
|
-
}))
|
|
1063
|
-
.chain((values) => values.head());
|
|
1064
|
-
if (_defaultValueEither.isLeft()) {
|
|
1065
|
-
return _defaultValueEither;
|
|
1066
|
-
}
|
|
1067
|
-
const defaultValue = _defaultValueEither.unsafeCoerce();
|
|
1068
|
-
const _descriptionsEither = purify.Either.of($resource.values(ShaclCorePropertyShape.$properties.descriptions["identifier"], {
|
|
1069
|
-
unique: true,
|
|
1070
|
-
}))
|
|
1071
|
-
.chain((values) => {
|
|
1072
|
-
if (!$preferredLanguages || $preferredLanguages.length === 0) {
|
|
1073
|
-
return purify.Either.of(values);
|
|
1074
|
-
}
|
|
1075
|
-
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
1076
|
-
if (literalValuesEither.isLeft()) {
|
|
1077
|
-
return literalValuesEither;
|
|
1078
|
-
}
|
|
1079
|
-
const literalValues = literalValuesEither.unsafeCoerce();
|
|
1080
|
-
// Return all literals for the first preferredLanguage, then all literals for the second preferredLanguage, etc.
|
|
1081
|
-
// Within a preferredLanguage the literals may be in any order.
|
|
1082
|
-
let filteredLiteralValues;
|
|
1083
|
-
for (const preferredLanguage of $preferredLanguages) {
|
|
1084
|
-
if (!filteredLiteralValues) {
|
|
1085
|
-
filteredLiteralValues = literalValues.filter((value) => value.language === preferredLanguage);
|
|
1086
|
-
}
|
|
1087
|
-
else {
|
|
1088
|
-
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
1089
|
-
.filter((value) => value.language === preferredLanguage)
|
|
1090
|
-
.toArray());
|
|
1091
|
-
}
|
|
1092
|
-
}
|
|
1093
|
-
return purify.Either.of(filteredLiteralValues.map((literalValue) => new rdfjsResource.Resource.Value({
|
|
1094
|
-
object: literalValue,
|
|
1095
|
-
predicate: ShaclCorePropertyShape.$properties.descriptions["identifier"],
|
|
1096
|
-
subject: $resource,
|
|
1097
|
-
})));
|
|
1098
|
-
})
|
|
1099
|
-
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
1100
|
-
.map((values) => values.toArray())
|
|
1101
|
-
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
1102
|
-
object: valuesArray,
|
|
1103
|
-
predicate: ShaclCorePropertyShape.$properties.descriptions["identifier"],
|
|
1104
|
-
subject: $resource,
|
|
1105
|
-
}))
|
|
1106
|
-
.chain((values) => values.head());
|
|
1107
|
-
if (_descriptionsEither.isLeft()) {
|
|
1108
|
-
return _descriptionsEither;
|
|
1109
|
-
}
|
|
1110
|
-
const descriptions = _descriptionsEither.unsafeCoerce();
|
|
1111
|
-
const _groupsEither = purify.Either.of($resource.values(ShaclCorePropertyShape.$properties.groups["identifier"], { unique: true }))
|
|
1313
|
+
return Left(new Error(`${Resource.Identifier.toString($parameters.resource.identifier)} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#PropertyShape)`));
|
|
1314
|
+
})
|
|
1315
|
+
: Right(true)).chain((_rdfTypeCheck) => Right(new Resource.Value({
|
|
1316
|
+
dataFactory: dataFactory,
|
|
1317
|
+
focusResource: $parameters.resource,
|
|
1318
|
+
propertyPath: $RdfVocabularies.rdf.subject,
|
|
1319
|
+
term: $parameters.resource.identifier,
|
|
1320
|
+
}).toValues())
|
|
1112
1321
|
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
1113
|
-
.
|
|
1114
|
-
.
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
}
|
|
1133
|
-
const literalValues = literalValuesEither.unsafeCoerce();
|
|
1134
|
-
// Return all literals for the first preferredLanguage, then all literals for the second preferredLanguage, etc.
|
|
1135
|
-
// Within a preferredLanguage the literals may be in any order.
|
|
1136
|
-
let filteredLiteralValues;
|
|
1137
|
-
for (const preferredLanguage of $preferredLanguages) {
|
|
1138
|
-
if (!filteredLiteralValues) {
|
|
1139
|
-
filteredLiteralValues = literalValues.filter((value) => value.language === preferredLanguage);
|
|
1322
|
+
.chain((values) => values.head())
|
|
1323
|
+
.chain(($identifier) => Right("ShaclCorePropertyShape").chain(($type) => $shaclPropertyFromRdf({
|
|
1324
|
+
graph: $parameters.graph,
|
|
1325
|
+
resource: $parameters.resource,
|
|
1326
|
+
propertySchema: ShaclCorePropertyShape.$schema.properties.defaultValue,
|
|
1327
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
1328
|
+
.chain((values) => values.chainMap((value) => value.toTerm().chain((term) => {
|
|
1329
|
+
switch (term.termType) {
|
|
1330
|
+
case "NamedNode":
|
|
1331
|
+
case "Literal":
|
|
1332
|
+
return Either.of(term);
|
|
1333
|
+
default:
|
|
1334
|
+
return Left(new Resource.MistypedTermValueError({
|
|
1335
|
+
actualValue: term,
|
|
1336
|
+
expectedValueType: "(NamedNode | Literal)",
|
|
1337
|
+
focusResource: $parameters.resource,
|
|
1338
|
+
propertyPath: ShaclCorePropertyShape.$schema.properties
|
|
1339
|
+
.defaultValue.path,
|
|
1340
|
+
}));
|
|
1140
1341
|
}
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
}
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
:
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1342
|
+
})))
|
|
1343
|
+
.map((values) => values.length > 0
|
|
1344
|
+
? values.map((value) => Maybe.of(value))
|
|
1345
|
+
: Resource.Values.fromValue({
|
|
1346
|
+
focusResource: $parameters.resource,
|
|
1347
|
+
propertyPath: ShaclCorePropertyShape.$schema.properties
|
|
1348
|
+
.defaultValue.path,
|
|
1349
|
+
value: Maybe.empty(),
|
|
1350
|
+
})),
|
|
1351
|
+
}).chain((defaultValue) => $shaclPropertyFromRdf({
|
|
1352
|
+
graph: $parameters.graph,
|
|
1353
|
+
resource: $parameters.resource,
|
|
1354
|
+
propertySchema: ShaclCorePropertyShape.$schema.properties.descriptions,
|
|
1355
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
1356
|
+
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
1357
|
+
.chain((values) => values.chainMap((value) => value.toString()))
|
|
1358
|
+
.map((values) => values.toArray())
|
|
1359
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
1360
|
+
focusResource: $parameters.resource,
|
|
1361
|
+
propertyPath: ShaclCorePropertyShape.$schema.properties
|
|
1362
|
+
.descriptions.path,
|
|
1363
|
+
value: valuesArray,
|
|
1364
|
+
})),
|
|
1365
|
+
}).chain((descriptions) => $shaclPropertyFromRdf({
|
|
1366
|
+
graph: $parameters.graph,
|
|
1367
|
+
resource: $parameters.resource,
|
|
1368
|
+
propertySchema: ShaclCorePropertyShape.$schema.properties.groups,
|
|
1369
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
1370
|
+
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
1371
|
+
.map((values) => values.toArray())
|
|
1372
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
1373
|
+
focusResource: $parameters.resource,
|
|
1374
|
+
propertyPath: ShaclCorePropertyShape.$schema.properties.groups
|
|
1375
|
+
.path,
|
|
1376
|
+
value: valuesArray,
|
|
1377
|
+
})),
|
|
1378
|
+
}).chain((groups) => $shaclPropertyFromRdf({
|
|
1379
|
+
graph: $parameters.graph,
|
|
1380
|
+
resource: $parameters.resource,
|
|
1381
|
+
propertySchema: ShaclCorePropertyShape.$schema.properties.names,
|
|
1382
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
1383
|
+
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
1384
|
+
.chain((values) => values.chainMap((value) => value.toString()))
|
|
1385
|
+
.map((values) => values.toArray())
|
|
1386
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
1387
|
+
focusResource: $parameters.resource,
|
|
1388
|
+
propertyPath: ShaclCorePropertyShape.$schema.properties.names
|
|
1389
|
+
.path,
|
|
1390
|
+
value: valuesArray,
|
|
1391
|
+
})),
|
|
1392
|
+
}).chain((names) => $shaclPropertyFromRdf({
|
|
1393
|
+
graph: $parameters.graph,
|
|
1394
|
+
resource: $parameters.resource,
|
|
1395
|
+
propertySchema: ShaclCorePropertyShape.$schema.properties.order,
|
|
1396
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
1397
|
+
.chain((values) => values.chainMap((value) => value.toFloat()))
|
|
1398
|
+
.map((values) => values.length > 0
|
|
1399
|
+
? values.map((value) => Maybe.of(value))
|
|
1400
|
+
: Resource.Values.fromValue({
|
|
1401
|
+
focusResource: $parameters.resource,
|
|
1402
|
+
propertyPath: ShaclCorePropertyShape.$schema.properties
|
|
1403
|
+
.order.path,
|
|
1404
|
+
value: Maybe.empty(),
|
|
1405
|
+
})),
|
|
1406
|
+
}).chain((order) => $shaclPropertyFromRdf({
|
|
1407
|
+
graph: $parameters.graph,
|
|
1408
|
+
resource: $parameters.resource,
|
|
1409
|
+
propertySchema: ShaclCorePropertyShape.$schema.properties.path,
|
|
1410
|
+
typeFromRdf: (resourceValues) => resourceValues.chain((values) => values.chainMap((value) => value.toResource().chain((resource) => PropertyPath.$fromRdf(resource, {
|
|
1411
|
+
context: $parameters.context,
|
|
1412
|
+
ignoreRdfType: true,
|
|
1413
|
+
objectSet: $parameters.objectSet,
|
|
1414
|
+
preferredLanguages: $parameters.preferredLanguages,
|
|
1415
|
+
})))),
|
|
1416
|
+
}).chain((path) => $shaclPropertyFromRdf({
|
|
1417
|
+
graph: $parameters.graph,
|
|
1418
|
+
resource: $parameters.resource,
|
|
1419
|
+
propertySchema: ShaclCorePropertyShape.$schema.properties.uniqueLang,
|
|
1420
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
1421
|
+
.chain((values) => values.chainMap((value) => value.toBoolean()))
|
|
1422
|
+
.map((values) => values.length > 0
|
|
1423
|
+
? values.map((value) => Maybe.of(value))
|
|
1424
|
+
: Resource.Values.fromValue({
|
|
1425
|
+
focusResource: $parameters.resource,
|
|
1426
|
+
propertyPath: ShaclCorePropertyShape.$schema
|
|
1427
|
+
.properties.uniqueLang.path,
|
|
1428
|
+
value: Maybe.empty(),
|
|
1429
|
+
})),
|
|
1430
|
+
}).map((uniqueLang) => ({
|
|
1206
1431
|
...$super0,
|
|
1207
1432
|
$identifier,
|
|
1208
1433
|
$type,
|
|
@@ -1213,87 +1438,146 @@ export var ShaclCorePropertyShape;
|
|
|
1213
1438
|
order,
|
|
1214
1439
|
path,
|
|
1215
1440
|
uniqueLang,
|
|
1216
|
-
});
|
|
1441
|
+
}))))))))))));
|
|
1217
1442
|
}
|
|
1218
1443
|
ShaclCorePropertyShape.$propertiesFromRdf = $propertiesFromRdf;
|
|
1219
1444
|
function $toRdf(_shaclCorePropertyShape, options) {
|
|
1220
|
-
const ignoreRdfType = !!options?.ignoreRdfType;
|
|
1221
|
-
const mutateGraph = options?.mutateGraph;
|
|
1222
1445
|
const resourceSet = options?.resourceSet ??
|
|
1223
|
-
new
|
|
1224
|
-
dataFactory,
|
|
1225
|
-
dataset: datasetFactory.dataset(),
|
|
1226
|
-
});
|
|
1446
|
+
new ResourceSet(datasetFactory.dataset(), { dataFactory: dataFactory });
|
|
1227
1447
|
const resource = BaseShaclCoreShapeStatic.$toRdf(_shaclCorePropertyShape, {
|
|
1228
1448
|
ignoreRdfType: true,
|
|
1229
|
-
|
|
1449
|
+
graph: options?.graph,
|
|
1230
1450
|
resourceSet,
|
|
1231
1451
|
});
|
|
1232
|
-
if (!ignoreRdfType) {
|
|
1233
|
-
resource.add($RdfVocabularies.rdf.type,
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
resource.add(
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
resource.add(
|
|
1240
|
-
resource.add(
|
|
1241
|
-
|
|
1452
|
+
if (!options?.ignoreRdfType) {
|
|
1453
|
+
resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"), options?.graph);
|
|
1454
|
+
}
|
|
1455
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#defaultValue"), _shaclCorePropertyShape.defaultValue.toList(), options?.graph);
|
|
1456
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#description"), _shaclCorePropertyShape.descriptions.flatMap((item) => [
|
|
1457
|
+
$literalFactory.string(item),
|
|
1458
|
+
]), options?.graph);
|
|
1459
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#group"), _shaclCorePropertyShape.groups.flatMap((item) => [item]), options?.graph);
|
|
1460
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#name"), _shaclCorePropertyShape.names.flatMap((item) => [
|
|
1461
|
+
$literalFactory.string(item),
|
|
1462
|
+
]), options?.graph);
|
|
1463
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#order"), _shaclCorePropertyShape.order
|
|
1464
|
+
.toList()
|
|
1465
|
+
.flatMap((value) => [
|
|
1466
|
+
$literalFactory.number(value, $RdfVocabularies.xsd.double),
|
|
1467
|
+
]), options?.graph);
|
|
1468
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#path"), [
|
|
1242
1469
|
PropertyPath.$toRdf(_shaclCorePropertyShape.path, {
|
|
1243
|
-
|
|
1470
|
+
graph: options?.graph,
|
|
1244
1471
|
resourceSet: resourceSet,
|
|
1245
1472
|
}).identifier,
|
|
1246
|
-
]);
|
|
1247
|
-
resource.add(
|
|
1473
|
+
], options?.graph);
|
|
1474
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#uniqueLang"), _shaclCorePropertyShape.uniqueLang
|
|
1475
|
+
.toList()
|
|
1476
|
+
.flatMap((value) => [
|
|
1477
|
+
$literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
|
|
1478
|
+
]), options?.graph);
|
|
1248
1479
|
return resource;
|
|
1249
1480
|
}
|
|
1250
1481
|
ShaclCorePropertyShape.$toRdf = $toRdf;
|
|
1251
|
-
ShaclCorePropertyShape.$
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1482
|
+
ShaclCorePropertyShape.$schema = {
|
|
1483
|
+
properties: {
|
|
1484
|
+
...BaseShaclCoreShapeStatic.$schema.properties,
|
|
1485
|
+
defaultValue: {
|
|
1486
|
+
kind: "Shacl",
|
|
1487
|
+
type: () => ({
|
|
1488
|
+
kind: "Maybe",
|
|
1489
|
+
item: () => ({ kind: "Term" }),
|
|
1490
|
+
}),
|
|
1491
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#defaultValue"),
|
|
1492
|
+
},
|
|
1493
|
+
descriptions: {
|
|
1494
|
+
kind: "Shacl",
|
|
1495
|
+
type: () => ({
|
|
1496
|
+
kind: "Set",
|
|
1497
|
+
item: () => ({ kind: "String" }),
|
|
1498
|
+
}),
|
|
1499
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#description"),
|
|
1500
|
+
},
|
|
1501
|
+
groups: {
|
|
1502
|
+
kind: "Shacl",
|
|
1503
|
+
type: () => ({
|
|
1504
|
+
kind: "Set",
|
|
1505
|
+
item: () => ({ kind: "Identifier" }),
|
|
1506
|
+
}),
|
|
1507
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#group"),
|
|
1508
|
+
},
|
|
1509
|
+
names: {
|
|
1510
|
+
kind: "Shacl",
|
|
1511
|
+
type: () => ({
|
|
1512
|
+
kind: "Set",
|
|
1513
|
+
item: () => ({ kind: "String" }),
|
|
1514
|
+
}),
|
|
1515
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#name"),
|
|
1516
|
+
},
|
|
1517
|
+
order: {
|
|
1518
|
+
kind: "Shacl",
|
|
1519
|
+
type: () => ({
|
|
1520
|
+
kind: "Maybe",
|
|
1521
|
+
item: () => ({ kind: "Float" }),
|
|
1522
|
+
}),
|
|
1523
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#order"),
|
|
1524
|
+
},
|
|
1525
|
+
path: {
|
|
1526
|
+
kind: "Shacl",
|
|
1527
|
+
type: () => PropertyPath.$schema,
|
|
1528
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#path"),
|
|
1529
|
+
},
|
|
1530
|
+
uniqueLang: {
|
|
1531
|
+
kind: "Shacl",
|
|
1532
|
+
type: () => ({
|
|
1533
|
+
kind: "Maybe",
|
|
1534
|
+
item: () => ({ kind: "Boolean" }),
|
|
1535
|
+
}),
|
|
1536
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#uniqueLang"),
|
|
1537
|
+
},
|
|
1273
1538
|
},
|
|
1274
1539
|
};
|
|
1275
1540
|
})(ShaclCorePropertyShape || (ShaclCorePropertyShape = {}));
|
|
1276
1541
|
export var ShaclCorePropertyGroup;
|
|
1277
1542
|
(function (ShaclCorePropertyGroup) {
|
|
1543
|
+
function $filter(filter, value) {
|
|
1544
|
+
if (filter.$identifier !== undefined &&
|
|
1545
|
+
!$filterIdentifier(filter.$identifier, value.$identifier)) {
|
|
1546
|
+
return false;
|
|
1547
|
+
}
|
|
1548
|
+
if (filter.comments !== undefined &&
|
|
1549
|
+
!$filterArray($filterString)(filter.comments, value.comments)) {
|
|
1550
|
+
return false;
|
|
1551
|
+
}
|
|
1552
|
+
if (filter.labels !== undefined &&
|
|
1553
|
+
!$filterArray($filterString)(filter.labels, value.labels)) {
|
|
1554
|
+
return false;
|
|
1555
|
+
}
|
|
1556
|
+
return true;
|
|
1557
|
+
}
|
|
1558
|
+
ShaclCorePropertyGroup.$filter = $filter;
|
|
1278
1559
|
ShaclCorePropertyGroup.$fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup");
|
|
1279
1560
|
let $Identifier;
|
|
1280
1561
|
(function ($Identifier) {
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
dataFactory,
|
|
1284
|
-
identifier,
|
|
1285
|
-
}));
|
|
1286
|
-
}
|
|
1287
|
-
$Identifier.fromString = fromString;
|
|
1288
|
-
$Identifier.toString = rdfjsResource.Resource.Identifier.toString;
|
|
1562
|
+
$Identifier.fromString = $identifierFromString; // biome-ignore lint/suspicious/noShadowRestrictedNames: allow toString
|
|
1563
|
+
$Identifier.toString = Resource.Identifier.toString;
|
|
1289
1564
|
})($Identifier = ShaclCorePropertyGroup.$Identifier || (ShaclCorePropertyGroup.$Identifier = {}));
|
|
1565
|
+
function isShaclCorePropertyGroup(object) {
|
|
1566
|
+
switch (object.$type) {
|
|
1567
|
+
case "ShaclCorePropertyGroup":
|
|
1568
|
+
return true;
|
|
1569
|
+
default:
|
|
1570
|
+
return false;
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
ShaclCorePropertyGroup.isShaclCorePropertyGroup = isShaclCorePropertyGroup;
|
|
1290
1574
|
function $fromRdf(resource, options) {
|
|
1291
|
-
let { ignoreRdfType = false, objectSet, preferredLanguages,
|
|
1575
|
+
let { context, ignoreRdfType = false, objectSet, preferredLanguages, } = options ?? {};
|
|
1292
1576
|
if (!objectSet) {
|
|
1293
|
-
objectSet = new $RdfjsDatasetObjectSet(
|
|
1577
|
+
objectSet = new $RdfjsDatasetObjectSet(resource.dataset);
|
|
1294
1578
|
}
|
|
1295
1579
|
return ShaclCorePropertyGroup.$propertiesFromRdf({
|
|
1296
|
-
|
|
1580
|
+
context,
|
|
1297
1581
|
ignoreRdfType,
|
|
1298
1582
|
objectSet,
|
|
1299
1583
|
preferredLanguages,
|
|
@@ -1301,153 +1585,151 @@ export var ShaclCorePropertyGroup;
|
|
|
1301
1585
|
});
|
|
1302
1586
|
}
|
|
1303
1587
|
ShaclCorePropertyGroup.$fromRdf = $fromRdf;
|
|
1304
|
-
function $propertiesFromRdf(
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
const $rdfTypeCheck = $resource
|
|
1309
|
-
.value($RdfVocabularies.rdf.type)
|
|
1588
|
+
function $propertiesFromRdf($parameters) {
|
|
1589
|
+
return (!$parameters.ignoreRdfType
|
|
1590
|
+
? $parameters.resource
|
|
1591
|
+
.value($RdfVocabularies.rdf.type, { graph: $parameters.graph })
|
|
1310
1592
|
.chain((actualRdfType) => actualRdfType.toIri())
|
|
1311
1593
|
.chain((actualRdfType) => {
|
|
1312
1594
|
// Check the expected type and its known subtypes
|
|
1313
1595
|
switch (actualRdfType.value) {
|
|
1314
1596
|
case "http://www.w3.org/ns/shacl#PropertyGroup":
|
|
1315
|
-
return
|
|
1597
|
+
return Right(true);
|
|
1316
1598
|
}
|
|
1317
1599
|
// Check arbitrary rdfs:subClassOf's of the expected type
|
|
1318
|
-
if ($resource.isInstanceOf(ShaclCorePropertyGroup.$fromRdfType)) {
|
|
1319
|
-
return
|
|
1600
|
+
if ($parameters.resource.isInstanceOf(ShaclCorePropertyGroup.$fromRdfType, { graph: $parameters.graph })) {
|
|
1601
|
+
return Right(true);
|
|
1320
1602
|
}
|
|
1321
|
-
return
|
|
1322
|
-
})
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
.chain((values) =>
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
}))
|
|
1357
|
-
})
|
|
1358
|
-
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
1359
|
-
.map((values) => values.toArray())
|
|
1360
|
-
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
1361
|
-
object: valuesArray,
|
|
1362
|
-
predicate: ShaclCorePropertyGroup.$properties.comments["identifier"],
|
|
1363
|
-
subject: $resource,
|
|
1364
|
-
}))
|
|
1365
|
-
.chain((values) => values.head());
|
|
1366
|
-
if (_commentsEither.isLeft()) {
|
|
1367
|
-
return _commentsEither;
|
|
1368
|
-
}
|
|
1369
|
-
const comments = _commentsEither.unsafeCoerce();
|
|
1370
|
-
const _labelsEither = purify.Either.of($resource.values(ShaclCorePropertyGroup.$properties.labels["identifier"], { unique: true }))
|
|
1371
|
-
.chain((values) => {
|
|
1372
|
-
if (!$preferredLanguages || $preferredLanguages.length === 0) {
|
|
1373
|
-
return purify.Either.of(values);
|
|
1374
|
-
}
|
|
1375
|
-
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
1376
|
-
if (literalValuesEither.isLeft()) {
|
|
1377
|
-
return literalValuesEither;
|
|
1378
|
-
}
|
|
1379
|
-
const literalValues = literalValuesEither.unsafeCoerce();
|
|
1380
|
-
// Return all literals for the first preferredLanguage, then all literals for the second preferredLanguage, etc.
|
|
1381
|
-
// Within a preferredLanguage the literals may be in any order.
|
|
1382
|
-
let filteredLiteralValues;
|
|
1383
|
-
for (const preferredLanguage of $preferredLanguages) {
|
|
1384
|
-
if (!filteredLiteralValues) {
|
|
1385
|
-
filteredLiteralValues = literalValues.filter((value) => value.language === preferredLanguage);
|
|
1386
|
-
}
|
|
1387
|
-
else {
|
|
1388
|
-
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
1389
|
-
.filter((value) => value.language === preferredLanguage)
|
|
1390
|
-
.toArray());
|
|
1391
|
-
}
|
|
1392
|
-
}
|
|
1393
|
-
return purify.Either.of(filteredLiteralValues.map((literalValue) => new rdfjsResource.Resource.Value({
|
|
1394
|
-
object: literalValue,
|
|
1395
|
-
predicate: ShaclCorePropertyGroup.$properties.labels["identifier"],
|
|
1396
|
-
subject: $resource,
|
|
1397
|
-
})));
|
|
1398
|
-
})
|
|
1399
|
-
.chain((values) => values.chainMap((value) => value.toLiteral()))
|
|
1400
|
-
.map((values) => values.toArray())
|
|
1401
|
-
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
1402
|
-
object: valuesArray,
|
|
1403
|
-
predicate: ShaclCorePropertyGroup.$properties.labels["identifier"],
|
|
1404
|
-
subject: $resource,
|
|
1405
|
-
}))
|
|
1406
|
-
.chain((values) => values.head());
|
|
1407
|
-
if (_labelsEither.isLeft()) {
|
|
1408
|
-
return _labelsEither;
|
|
1409
|
-
}
|
|
1410
|
-
const labels = _labelsEither.unsafeCoerce();
|
|
1411
|
-
return purify.Either.of({ $identifier, $type, comments, labels });
|
|
1603
|
+
return Left(new Error(`${Resource.Identifier.toString($parameters.resource.identifier)} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#PropertyGroup)`));
|
|
1604
|
+
})
|
|
1605
|
+
: Right(true)).chain((_rdfTypeCheck) => Right(new Resource.Value({
|
|
1606
|
+
dataFactory: dataFactory,
|
|
1607
|
+
focusResource: $parameters.resource,
|
|
1608
|
+
propertyPath: $RdfVocabularies.rdf.subject,
|
|
1609
|
+
term: $parameters.resource.identifier,
|
|
1610
|
+
}).toValues())
|
|
1611
|
+
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
1612
|
+
.chain((values) => values.head())
|
|
1613
|
+
.chain(($identifier) => Right("ShaclCorePropertyGroup").chain(($type) => $shaclPropertyFromRdf({
|
|
1614
|
+
graph: $parameters.graph,
|
|
1615
|
+
resource: $parameters.resource,
|
|
1616
|
+
propertySchema: ShaclCorePropertyGroup.$schema.properties.comments,
|
|
1617
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
1618
|
+
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
1619
|
+
.chain((values) => values.chainMap((value) => value.toString()))
|
|
1620
|
+
.map((values) => values.toArray())
|
|
1621
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
1622
|
+
focusResource: $parameters.resource,
|
|
1623
|
+
propertyPath: ShaclCorePropertyGroup.$schema.properties.comments.path,
|
|
1624
|
+
value: valuesArray,
|
|
1625
|
+
})),
|
|
1626
|
+
}).chain((comments) => $shaclPropertyFromRdf({
|
|
1627
|
+
graph: $parameters.graph,
|
|
1628
|
+
resource: $parameters.resource,
|
|
1629
|
+
propertySchema: ShaclCorePropertyGroup.$schema.properties.labels,
|
|
1630
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
1631
|
+
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
1632
|
+
.chain((values) => values.chainMap((value) => value.toString()))
|
|
1633
|
+
.map((values) => values.toArray())
|
|
1634
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
1635
|
+
focusResource: $parameters.resource,
|
|
1636
|
+
propertyPath: ShaclCorePropertyGroup.$schema.properties.labels.path,
|
|
1637
|
+
value: valuesArray,
|
|
1638
|
+
})),
|
|
1639
|
+
}).map((labels) => ({ $identifier, $type, comments, labels }))))));
|
|
1412
1640
|
}
|
|
1413
1641
|
ShaclCorePropertyGroup.$propertiesFromRdf = $propertiesFromRdf;
|
|
1414
1642
|
function $toRdf(_shaclCorePropertyGroup, options) {
|
|
1415
|
-
const ignoreRdfType = !!options?.ignoreRdfType;
|
|
1416
|
-
const mutateGraph = options?.mutateGraph;
|
|
1417
1643
|
const resourceSet = options?.resourceSet ??
|
|
1418
|
-
new
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
resource.add(
|
|
1427
|
-
|
|
1644
|
+
new ResourceSet(datasetFactory.dataset(), { dataFactory: dataFactory });
|
|
1645
|
+
const resource = resourceSet.resource(_shaclCorePropertyGroup.$identifier);
|
|
1646
|
+
if (!options?.ignoreRdfType) {
|
|
1647
|
+
resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup"), options?.graph);
|
|
1648
|
+
}
|
|
1649
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), _shaclCorePropertyGroup.comments.flatMap((item) => [
|
|
1650
|
+
$literalFactory.string(item),
|
|
1651
|
+
]), options?.graph);
|
|
1652
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), _shaclCorePropertyGroup.labels.flatMap((item) => [
|
|
1653
|
+
$literalFactory.string(item),
|
|
1654
|
+
]), options?.graph);
|
|
1428
1655
|
return resource;
|
|
1429
1656
|
}
|
|
1430
1657
|
ShaclCorePropertyGroup.$toRdf = $toRdf;
|
|
1431
|
-
ShaclCorePropertyGroup.$
|
|
1432
|
-
|
|
1433
|
-
identifier:
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1658
|
+
ShaclCorePropertyGroup.$schema = {
|
|
1659
|
+
properties: {
|
|
1660
|
+
$identifier: {
|
|
1661
|
+
kind: "Identifier",
|
|
1662
|
+
type: () => ({ kind: "Identifier" }),
|
|
1663
|
+
},
|
|
1664
|
+
$type: {
|
|
1665
|
+
kind: "TypeDiscriminant",
|
|
1666
|
+
type: () => ({
|
|
1667
|
+
kind: "TypeDiscriminant",
|
|
1668
|
+
ownValues: ["ShaclCorePropertyGroup"],
|
|
1669
|
+
}),
|
|
1670
|
+
},
|
|
1671
|
+
comments: {
|
|
1672
|
+
kind: "Shacl",
|
|
1673
|
+
type: () => ({
|
|
1674
|
+
kind: "Set",
|
|
1675
|
+
item: () => ({ kind: "String" }),
|
|
1676
|
+
}),
|
|
1677
|
+
path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
|
|
1678
|
+
},
|
|
1679
|
+
labels: {
|
|
1680
|
+
kind: "Shacl",
|
|
1681
|
+
type: () => ({
|
|
1682
|
+
kind: "Set",
|
|
1683
|
+
item: () => ({ kind: "String" }),
|
|
1684
|
+
}),
|
|
1685
|
+
path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
|
|
1686
|
+
},
|
|
1437
1687
|
},
|
|
1438
1688
|
};
|
|
1439
1689
|
})(ShaclCorePropertyGroup || (ShaclCorePropertyGroup = {}));
|
|
1440
1690
|
export var ShaclCoreNodeShape;
|
|
1441
1691
|
(function (ShaclCoreNodeShape) {
|
|
1692
|
+
function $filter(filter, value) {
|
|
1693
|
+
if (!BaseShaclCoreShapeStatic.$filter(filter, value)) {
|
|
1694
|
+
return false;
|
|
1695
|
+
}
|
|
1696
|
+
if (filter.closed !== undefined &&
|
|
1697
|
+
!$filterMaybe($filterBoolean)(filter.closed, value.closed)) {
|
|
1698
|
+
return false;
|
|
1699
|
+
}
|
|
1700
|
+
if (filter.ignoredProperties !== undefined &&
|
|
1701
|
+
!$filterMaybe($filterArray($filterIri))(filter.ignoredProperties, value.ignoredProperties)) {
|
|
1702
|
+
return false;
|
|
1703
|
+
}
|
|
1704
|
+
if (filter.properties !== undefined &&
|
|
1705
|
+
!$filterArray($filterIdentifier)(filter.properties, value.properties)) {
|
|
1706
|
+
return false;
|
|
1707
|
+
}
|
|
1708
|
+
return true;
|
|
1709
|
+
}
|
|
1710
|
+
ShaclCoreNodeShape.$filter = $filter;
|
|
1442
1711
|
ShaclCoreNodeShape.$fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape");
|
|
1443
|
-
|
|
1712
|
+
let $Identifier;
|
|
1713
|
+
(function ($Identifier) {
|
|
1714
|
+
$Identifier.fromString = $identifierFromString; // biome-ignore lint/suspicious/noShadowRestrictedNames: allow toString
|
|
1715
|
+
$Identifier.toString = Resource.Identifier.toString;
|
|
1716
|
+
})($Identifier = ShaclCoreNodeShape.$Identifier || (ShaclCoreNodeShape.$Identifier = {}));
|
|
1717
|
+
function isShaclCoreNodeShape(object) {
|
|
1718
|
+
switch (object.$type) {
|
|
1719
|
+
case "ShaclCoreNodeShape":
|
|
1720
|
+
return true;
|
|
1721
|
+
default:
|
|
1722
|
+
return false;
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
ShaclCoreNodeShape.isShaclCoreNodeShape = isShaclCoreNodeShape;
|
|
1444
1726
|
function $fromRdf(resource, options) {
|
|
1445
|
-
let { ignoreRdfType = false, objectSet, preferredLanguages,
|
|
1727
|
+
let { context, ignoreRdfType = false, objectSet, preferredLanguages, } = options ?? {};
|
|
1446
1728
|
if (!objectSet) {
|
|
1447
|
-
objectSet = new $RdfjsDatasetObjectSet(
|
|
1729
|
+
objectSet = new $RdfjsDatasetObjectSet(resource.dataset);
|
|
1448
1730
|
}
|
|
1449
1731
|
return ShaclCoreNodeShape.$propertiesFromRdf({
|
|
1450
|
-
|
|
1732
|
+
context,
|
|
1451
1733
|
ignoreRdfType,
|
|
1452
1734
|
objectSet,
|
|
1453
1735
|
preferredLanguages,
|
|
@@ -1455,179 +1737,203 @@ export var ShaclCoreNodeShape;
|
|
|
1455
1737
|
});
|
|
1456
1738
|
}
|
|
1457
1739
|
ShaclCoreNodeShape.$fromRdf = $fromRdf;
|
|
1458
|
-
function $propertiesFromRdf(
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
const $super0Either = BaseShaclCoreShapeStatic.$propertiesFromRdf({
|
|
1462
|
-
...$context,
|
|
1740
|
+
function $propertiesFromRdf($parameters) {
|
|
1741
|
+
return BaseShaclCoreShapeStatic.$propertiesFromRdf({
|
|
1742
|
+
...$parameters,
|
|
1463
1743
|
ignoreRdfType: true,
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
});
|
|
1468
|
-
if ($super0Either.isLeft()) {
|
|
1469
|
-
return $super0Either;
|
|
1470
|
-
}
|
|
1471
|
-
const $super0 = $super0Either.unsafeCoerce();
|
|
1472
|
-
if (!$ignoreRdfType) {
|
|
1473
|
-
const $rdfTypeCheck = $resource
|
|
1474
|
-
.value($RdfVocabularies.rdf.type)
|
|
1744
|
+
}).chain(($super0) => (!$parameters.ignoreRdfType
|
|
1745
|
+
? $parameters.resource
|
|
1746
|
+
.value($RdfVocabularies.rdf.type, { graph: $parameters.graph })
|
|
1475
1747
|
.chain((actualRdfType) => actualRdfType.toIri())
|
|
1476
1748
|
.chain((actualRdfType) => {
|
|
1477
1749
|
// Check the expected type and its known subtypes
|
|
1478
1750
|
switch (actualRdfType.value) {
|
|
1479
1751
|
case "http://www.w3.org/ns/shacl#NodeShape":
|
|
1480
|
-
return
|
|
1752
|
+
return Right(true);
|
|
1481
1753
|
}
|
|
1482
1754
|
// Check arbitrary rdfs:subClassOf's of the expected type
|
|
1483
|
-
if ($resource.isInstanceOf(ShaclCoreNodeShape.$fromRdfType)) {
|
|
1484
|
-
return
|
|
1755
|
+
if ($parameters.resource.isInstanceOf(ShaclCoreNodeShape.$fromRdfType, { graph: $parameters.graph })) {
|
|
1756
|
+
return Right(true);
|
|
1485
1757
|
}
|
|
1486
|
-
return
|
|
1487
|
-
})
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
const _closedEither = purify.Either.of($resource.values(ShaclCoreNodeShape.$properties.closed["identifier"], { unique: true }))
|
|
1495
|
-
.chain((values) => values.chainMap((value) => value.toBoolean()))
|
|
1496
|
-
.map((values) => values.length > 0
|
|
1497
|
-
? values.map((value) => purify.Maybe.of(value))
|
|
1498
|
-
: rdfjsResource.Resource.Values.fromValue({
|
|
1499
|
-
object: purify.Maybe.empty(),
|
|
1500
|
-
predicate: ShaclCoreNodeShape.$properties.closed["identifier"],
|
|
1501
|
-
subject: $resource,
|
|
1502
|
-
}))
|
|
1503
|
-
.chain((values) => values.head());
|
|
1504
|
-
if (_closedEither.isLeft()) {
|
|
1505
|
-
return _closedEither;
|
|
1506
|
-
}
|
|
1507
|
-
const closed = _closedEither.unsafeCoerce();
|
|
1508
|
-
const _ignoredPropertiesEither = purify.Either.of($resource.values(ShaclCoreNodeShape.$properties.ignoredProperties["identifier"], {
|
|
1509
|
-
unique: true,
|
|
1510
|
-
}))
|
|
1511
|
-
.chain((values) => values.chainMap((value) => value.toList()))
|
|
1512
|
-
.chain((valueLists) => valueLists.chainMap((valueList) => purify.Either.of(rdfjsResource.Resource.Values.fromArray({
|
|
1513
|
-
objects: valueList,
|
|
1514
|
-
predicate: ShaclCoreNodeShape.$properties.ignoredProperties["identifier"],
|
|
1515
|
-
subject: $resource,
|
|
1516
|
-
})).chain((values) => values.chainMap((value) => value.toIri()))))
|
|
1517
|
-
.map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
|
|
1518
|
-
.map((values) => values.length > 0
|
|
1519
|
-
? values.map((value) => purify.Maybe.of(value))
|
|
1520
|
-
: rdfjsResource.Resource.Values.fromValue({
|
|
1521
|
-
object: purify.Maybe.empty(),
|
|
1522
|
-
predicate: ShaclCoreNodeShape.$properties.ignoredProperties["identifier"],
|
|
1523
|
-
subject: $resource,
|
|
1524
|
-
}))
|
|
1525
|
-
.chain((values) => values.head());
|
|
1526
|
-
if (_ignoredPropertiesEither.isLeft()) {
|
|
1527
|
-
return _ignoredPropertiesEither;
|
|
1528
|
-
}
|
|
1529
|
-
const ignoredProperties = _ignoredPropertiesEither.unsafeCoerce();
|
|
1530
|
-
const _propertiesEither = purify.Either.of($resource.values(ShaclCoreNodeShape.$properties.properties["identifier"], { unique: true }))
|
|
1758
|
+
return Left(new Error(`${Resource.Identifier.toString($parameters.resource.identifier)} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#NodeShape)`));
|
|
1759
|
+
})
|
|
1760
|
+
: Right(true)).chain((_rdfTypeCheck) => Right(new Resource.Value({
|
|
1761
|
+
dataFactory: dataFactory,
|
|
1762
|
+
focusResource: $parameters.resource,
|
|
1763
|
+
propertyPath: $RdfVocabularies.rdf.subject,
|
|
1764
|
+
term: $parameters.resource.identifier,
|
|
1765
|
+
}).toValues())
|
|
1531
1766
|
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
1532
|
-
.
|
|
1533
|
-
.
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1767
|
+
.chain((values) => values.head())
|
|
1768
|
+
.chain(($identifier) => Right("ShaclCoreNodeShape").chain(($type) => $shaclPropertyFromRdf({
|
|
1769
|
+
graph: $parameters.graph,
|
|
1770
|
+
resource: $parameters.resource,
|
|
1771
|
+
propertySchema: ShaclCoreNodeShape.$schema.properties.closed,
|
|
1772
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
1773
|
+
.chain((values) => values.chainMap((value) => value.toBoolean()))
|
|
1774
|
+
.map((values) => values.length > 0
|
|
1775
|
+
? values.map((value) => Maybe.of(value))
|
|
1776
|
+
: Resource.Values.fromValue({
|
|
1777
|
+
focusResource: $parameters.resource,
|
|
1778
|
+
propertyPath: ShaclCoreNodeShape.$schema.properties.closed
|
|
1779
|
+
.path,
|
|
1780
|
+
value: Maybe.empty(),
|
|
1781
|
+
})),
|
|
1782
|
+
}).chain((closed) => $shaclPropertyFromRdf({
|
|
1783
|
+
graph: $parameters.graph,
|
|
1784
|
+
resource: $parameters.resource,
|
|
1785
|
+
propertySchema: ShaclCoreNodeShape.$schema.properties.ignoredProperties,
|
|
1786
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
1787
|
+
.chain((values) => values.chainMap((value) => value.toList({ graph: $parameters.graph })))
|
|
1788
|
+
.chain((valueLists) => valueLists.chainMap((valueList) => Right(Resource.Values.fromArray({
|
|
1789
|
+
focusResource: $parameters.resource,
|
|
1790
|
+
propertyPath: ShaclCoreNodeShape.$schema.properties
|
|
1791
|
+
.ignoredProperties.path,
|
|
1792
|
+
values: valueList.toArray(),
|
|
1793
|
+
})).chain((values) => values.chainMap((value) => value.toIri()))))
|
|
1794
|
+
.map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
|
|
1795
|
+
.map((values) => values.length > 0
|
|
1796
|
+
? values.map((value) => Maybe.of(value))
|
|
1797
|
+
: Resource.Values.fromValue({
|
|
1798
|
+
focusResource: $parameters.resource,
|
|
1799
|
+
propertyPath: ShaclCoreNodeShape.$schema.properties
|
|
1800
|
+
.ignoredProperties.path,
|
|
1801
|
+
value: Maybe.empty(),
|
|
1802
|
+
})),
|
|
1803
|
+
}).chain((ignoredProperties) => $shaclPropertyFromRdf({
|
|
1804
|
+
graph: $parameters.graph,
|
|
1805
|
+
resource: $parameters.resource,
|
|
1806
|
+
propertySchema: ShaclCoreNodeShape.$schema.properties.properties,
|
|
1807
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
1808
|
+
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
1809
|
+
.map((values) => values.toArray())
|
|
1810
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
1811
|
+
focusResource: $parameters.resource,
|
|
1812
|
+
propertyPath: ShaclCoreNodeShape.$schema.properties.properties
|
|
1813
|
+
.path,
|
|
1814
|
+
value: valuesArray,
|
|
1815
|
+
})),
|
|
1816
|
+
}).map((properties) => ({
|
|
1544
1817
|
...$super0,
|
|
1545
1818
|
$identifier,
|
|
1546
1819
|
$type,
|
|
1547
1820
|
closed,
|
|
1548
1821
|
ignoredProperties,
|
|
1549
1822
|
properties,
|
|
1550
|
-
});
|
|
1823
|
+
}))))))));
|
|
1551
1824
|
}
|
|
1552
1825
|
ShaclCoreNodeShape.$propertiesFromRdf = $propertiesFromRdf;
|
|
1553
1826
|
function $toRdf(_shaclCoreNodeShape, options) {
|
|
1554
|
-
const ignoreRdfType = !!options?.ignoreRdfType;
|
|
1555
|
-
const mutateGraph = options?.mutateGraph;
|
|
1556
1827
|
const resourceSet = options?.resourceSet ??
|
|
1557
|
-
new
|
|
1558
|
-
dataFactory,
|
|
1559
|
-
dataset: datasetFactory.dataset(),
|
|
1560
|
-
});
|
|
1828
|
+
new ResourceSet(datasetFactory.dataset(), { dataFactory: dataFactory });
|
|
1561
1829
|
const resource = BaseShaclCoreShapeStatic.$toRdf(_shaclCoreNodeShape, {
|
|
1562
1830
|
ignoreRdfType: true,
|
|
1563
|
-
|
|
1831
|
+
graph: options?.graph,
|
|
1564
1832
|
resourceSet,
|
|
1565
1833
|
});
|
|
1566
|
-
if (!ignoreRdfType) {
|
|
1567
|
-
resource.add($RdfVocabularies.rdf.type,
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1834
|
+
if (!options?.ignoreRdfType) {
|
|
1835
|
+
resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape"), options?.graph);
|
|
1836
|
+
}
|
|
1837
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#closed"), _shaclCoreNodeShape.closed
|
|
1838
|
+
.toList()
|
|
1839
|
+
.flatMap((value) => [
|
|
1840
|
+
$literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
|
|
1841
|
+
]), options?.graph);
|
|
1842
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#ignoredProperties"), _shaclCoreNodeShape.ignoredProperties.toList().flatMap((value) => [
|
|
1572
1843
|
value.length > 0
|
|
1573
1844
|
? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
1574
1845
|
if (itemIndex === 0) {
|
|
1575
1846
|
currentSubListResource = listResource;
|
|
1576
1847
|
}
|
|
1577
1848
|
else {
|
|
1578
|
-
const newSubListResource = resourceSet.
|
|
1579
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier);
|
|
1849
|
+
const newSubListResource = resourceSet.resource(dataFactory.blankNode());
|
|
1850
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier, options?.graph);
|
|
1580
1851
|
currentSubListResource = newSubListResource;
|
|
1581
1852
|
}
|
|
1582
|
-
currentSubListResource.add($RdfVocabularies.rdf.first,
|
|
1853
|
+
currentSubListResource.add($RdfVocabularies.rdf.first, [item], options?.graph);
|
|
1583
1854
|
if (itemIndex + 1 === list.length) {
|
|
1584
|
-
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil);
|
|
1855
|
+
currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil, options?.graph);
|
|
1585
1856
|
}
|
|
1586
1857
|
return { currentSubListResource, listResource };
|
|
1587
1858
|
}, {
|
|
1588
1859
|
currentSubListResource: null,
|
|
1589
|
-
listResource: resourceSet.
|
|
1860
|
+
listResource: resourceSet.resource(dataFactory.blankNode()),
|
|
1590
1861
|
}).listResource.identifier
|
|
1591
1862
|
: $RdfVocabularies.rdf.nil,
|
|
1592
|
-
]));
|
|
1593
|
-
resource.add(
|
|
1863
|
+
]), options?.graph);
|
|
1864
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#property"), _shaclCoreNodeShape.properties.flatMap((item) => [item]), options?.graph);
|
|
1594
1865
|
return resource;
|
|
1595
1866
|
}
|
|
1596
1867
|
ShaclCoreNodeShape.$toRdf = $toRdf;
|
|
1597
|
-
ShaclCoreNodeShape.$
|
|
1598
|
-
...BaseShaclCoreShapeStatic.$properties,
|
|
1599
|
-
closed: {
|
|
1600
|
-
identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#closed"),
|
|
1601
|
-
},
|
|
1602
|
-
ignoredProperties: {
|
|
1603
|
-
identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#ignoredProperties"),
|
|
1604
|
-
},
|
|
1868
|
+
ShaclCoreNodeShape.$schema = {
|
|
1605
1869
|
properties: {
|
|
1606
|
-
|
|
1870
|
+
...BaseShaclCoreShapeStatic.$schema.properties,
|
|
1871
|
+
closed: {
|
|
1872
|
+
kind: "Shacl",
|
|
1873
|
+
type: () => ({
|
|
1874
|
+
kind: "Maybe",
|
|
1875
|
+
item: () => ({ kind: "Boolean" }),
|
|
1876
|
+
}),
|
|
1877
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#closed"),
|
|
1878
|
+
},
|
|
1879
|
+
ignoredProperties: {
|
|
1880
|
+
kind: "Shacl",
|
|
1881
|
+
type: () => ({
|
|
1882
|
+
kind: "Maybe",
|
|
1883
|
+
item: () => ({
|
|
1884
|
+
kind: "List",
|
|
1885
|
+
item: () => ({ kind: "Iri" }),
|
|
1886
|
+
}),
|
|
1887
|
+
}),
|
|
1888
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#ignoredProperties"),
|
|
1889
|
+
},
|
|
1890
|
+
properties: {
|
|
1891
|
+
kind: "Shacl",
|
|
1892
|
+
type: () => ({
|
|
1893
|
+
kind: "Set",
|
|
1894
|
+
item: () => ({ kind: "Identifier" }),
|
|
1895
|
+
}),
|
|
1896
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#property"),
|
|
1897
|
+
},
|
|
1607
1898
|
},
|
|
1608
1899
|
};
|
|
1609
1900
|
})(ShaclCoreNodeShape || (ShaclCoreNodeShape = {}));
|
|
1610
1901
|
export var OwlOntology;
|
|
1611
1902
|
(function (OwlOntology) {
|
|
1903
|
+
function $filter(filter, value) {
|
|
1904
|
+
if (filter.$identifier !== undefined &&
|
|
1905
|
+
!$filterIdentifier(filter.$identifier, value.$identifier)) {
|
|
1906
|
+
return false;
|
|
1907
|
+
}
|
|
1908
|
+
if (filter.labels !== undefined &&
|
|
1909
|
+
!$filterArray($filterString)(filter.labels, value.labels)) {
|
|
1910
|
+
return false;
|
|
1911
|
+
}
|
|
1912
|
+
return true;
|
|
1913
|
+
}
|
|
1914
|
+
OwlOntology.$filter = $filter;
|
|
1612
1915
|
OwlOntology.$fromRdfType = dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology");
|
|
1613
1916
|
let $Identifier;
|
|
1614
1917
|
(function ($Identifier) {
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
dataFactory,
|
|
1618
|
-
identifier,
|
|
1619
|
-
}));
|
|
1620
|
-
}
|
|
1621
|
-
$Identifier.fromString = fromString;
|
|
1622
|
-
$Identifier.toString = rdfjsResource.Resource.Identifier.toString;
|
|
1918
|
+
$Identifier.fromString = $identifierFromString; // biome-ignore lint/suspicious/noShadowRestrictedNames: allow toString
|
|
1919
|
+
$Identifier.toString = Resource.Identifier.toString;
|
|
1623
1920
|
})($Identifier = OwlOntology.$Identifier || (OwlOntology.$Identifier = {}));
|
|
1921
|
+
function isOwlOntology(object) {
|
|
1922
|
+
switch (object.$type) {
|
|
1923
|
+
case "OwlOntology":
|
|
1924
|
+
return true;
|
|
1925
|
+
default:
|
|
1926
|
+
return false;
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
OwlOntology.isOwlOntology = isOwlOntology;
|
|
1624
1930
|
function $fromRdf(resource, options) {
|
|
1625
|
-
let { ignoreRdfType = false, objectSet, preferredLanguages,
|
|
1931
|
+
let { context, ignoreRdfType = false, objectSet, preferredLanguages, } = options ?? {};
|
|
1626
1932
|
if (!objectSet) {
|
|
1627
|
-
objectSet = new $RdfjsDatasetObjectSet(
|
|
1933
|
+
objectSet = new $RdfjsDatasetObjectSet(resource.dataset);
|
|
1628
1934
|
}
|
|
1629
1935
|
return OwlOntology.$propertiesFromRdf({
|
|
1630
|
-
|
|
1936
|
+
context,
|
|
1631
1937
|
ignoreRdfType,
|
|
1632
1938
|
objectSet,
|
|
1633
1939
|
preferredLanguages,
|
|
@@ -1635,102 +1941,343 @@ export var OwlOntology;
|
|
|
1635
1941
|
});
|
|
1636
1942
|
}
|
|
1637
1943
|
OwlOntology.$fromRdf = $fromRdf;
|
|
1638
|
-
function $propertiesFromRdf(
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
const $rdfTypeCheck = $resource
|
|
1643
|
-
.value($RdfVocabularies.rdf.type)
|
|
1944
|
+
function $propertiesFromRdf($parameters) {
|
|
1945
|
+
return (!$parameters.ignoreRdfType
|
|
1946
|
+
? $parameters.resource
|
|
1947
|
+
.value($RdfVocabularies.rdf.type, { graph: $parameters.graph })
|
|
1644
1948
|
.chain((actualRdfType) => actualRdfType.toIri())
|
|
1645
1949
|
.chain((actualRdfType) => {
|
|
1646
1950
|
// Check the expected type and its known subtypes
|
|
1647
1951
|
switch (actualRdfType.value) {
|
|
1648
1952
|
case "http://www.w3.org/2002/07/owl#Ontology":
|
|
1649
|
-
return
|
|
1953
|
+
return Right(true);
|
|
1650
1954
|
}
|
|
1651
1955
|
// Check arbitrary rdfs:subClassOf's of the expected type
|
|
1652
|
-
if ($resource.isInstanceOf(OwlOntology.$fromRdfType
|
|
1653
|
-
|
|
1654
|
-
}
|
|
1655
|
-
|
|
1656
|
-
});
|
|
1657
|
-
if ($rdfTypeCheck.isLeft()) {
|
|
1658
|
-
return $rdfTypeCheck;
|
|
1659
|
-
}
|
|
1660
|
-
}
|
|
1661
|
-
const $identifier = $resource.identifier;
|
|
1662
|
-
const $type = "OwlOntology";
|
|
1663
|
-
const _labelsEither = purify.Either.of($resource.values(OwlOntology.$properties.labels["identifier"], { unique: true }))
|
|
1664
|
-
.chain((values) => {
|
|
1665
|
-
if (!$preferredLanguages || $preferredLanguages.length === 0) {
|
|
1666
|
-
return purify.Either.of(values);
|
|
1667
|
-
}
|
|
1668
|
-
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
1669
|
-
if (literalValuesEither.isLeft()) {
|
|
1670
|
-
return literalValuesEither;
|
|
1671
|
-
}
|
|
1672
|
-
const literalValues = literalValuesEither.unsafeCoerce();
|
|
1673
|
-
// Return all literals for the first preferredLanguage, then all literals for the second preferredLanguage, etc.
|
|
1674
|
-
// Within a preferredLanguage the literals may be in any order.
|
|
1675
|
-
let filteredLiteralValues;
|
|
1676
|
-
for (const preferredLanguage of $preferredLanguages) {
|
|
1677
|
-
if (!filteredLiteralValues) {
|
|
1678
|
-
filteredLiteralValues = literalValues.filter((value) => value.language === preferredLanguage);
|
|
1679
|
-
}
|
|
1680
|
-
else {
|
|
1681
|
-
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
1682
|
-
.filter((value) => value.language === preferredLanguage)
|
|
1683
|
-
.toArray());
|
|
1956
|
+
if ($parameters.resource.isInstanceOf(OwlOntology.$fromRdfType, {
|
|
1957
|
+
graph: $parameters.graph,
|
|
1958
|
+
})) {
|
|
1959
|
+
return Right(true);
|
|
1684
1960
|
}
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
.
|
|
1694
|
-
.
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1961
|
+
return Left(new Error(`${Resource.Identifier.toString($parameters.resource.identifier)} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/2002/07/owl#Ontology)`));
|
|
1962
|
+
})
|
|
1963
|
+
: Right(true)).chain((_rdfTypeCheck) => Right(new Resource.Value({
|
|
1964
|
+
dataFactory: dataFactory,
|
|
1965
|
+
focusResource: $parameters.resource,
|
|
1966
|
+
propertyPath: $RdfVocabularies.rdf.subject,
|
|
1967
|
+
term: $parameters.resource.identifier,
|
|
1968
|
+
}).toValues())
|
|
1969
|
+
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
1970
|
+
.chain((values) => values.head())
|
|
1971
|
+
.chain(($identifier) => Right("OwlOntology").chain(($type) => $shaclPropertyFromRdf({
|
|
1972
|
+
graph: $parameters.graph,
|
|
1973
|
+
resource: $parameters.resource,
|
|
1974
|
+
propertySchema: OwlOntology.$schema.properties.labels,
|
|
1975
|
+
typeFromRdf: (resourceValues) => resourceValues
|
|
1976
|
+
.chain((values) => $fromRdfPreferredLanguages(values, $parameters.preferredLanguages))
|
|
1977
|
+
.chain((values) => values.chainMap((value) => value.toString()))
|
|
1978
|
+
.map((values) => values.toArray())
|
|
1979
|
+
.map((valuesArray) => Resource.Values.fromValue({
|
|
1980
|
+
focusResource: $parameters.resource,
|
|
1981
|
+
propertyPath: OwlOntology.$schema.properties.labels.path,
|
|
1982
|
+
value: valuesArray,
|
|
1983
|
+
})),
|
|
1984
|
+
}).map((labels) => ({ $identifier, $type, labels })))));
|
|
1705
1985
|
}
|
|
1706
1986
|
OwlOntology.$propertiesFromRdf = $propertiesFromRdf;
|
|
1707
1987
|
function $toRdf(_owlOntology, options) {
|
|
1708
|
-
const ignoreRdfType = !!options?.ignoreRdfType;
|
|
1709
|
-
const mutateGraph = options?.mutateGraph;
|
|
1710
1988
|
const resourceSet = options?.resourceSet ??
|
|
1711
|
-
new
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
const resource = resourceSet.mutableResource(_owlOntology.$identifier, {
|
|
1716
|
-
mutateGraph,
|
|
1717
|
-
});
|
|
1718
|
-
if (!ignoreRdfType) {
|
|
1719
|
-
resource.add($RdfVocabularies.rdf.type, resource.dataFactory.namedNode("http://purl.org/shaclmate/ontology#OwlOntology"));
|
|
1720
|
-
resource.add($RdfVocabularies.rdf.type, resource.dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"));
|
|
1989
|
+
new ResourceSet(datasetFactory.dataset(), { dataFactory: dataFactory });
|
|
1990
|
+
const resource = resourceSet.resource(_owlOntology.$identifier);
|
|
1991
|
+
if (!options?.ignoreRdfType) {
|
|
1992
|
+
resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"), options?.graph);
|
|
1721
1993
|
}
|
|
1722
|
-
resource.add(
|
|
1994
|
+
resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), _owlOntology.labels.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
|
|
1723
1995
|
return resource;
|
|
1724
1996
|
}
|
|
1725
1997
|
OwlOntology.$toRdf = $toRdf;
|
|
1726
|
-
OwlOntology.$
|
|
1727
|
-
|
|
1728
|
-
identifier:
|
|
1998
|
+
OwlOntology.$schema = {
|
|
1999
|
+
properties: {
|
|
2000
|
+
$identifier: {
|
|
2001
|
+
kind: "Identifier",
|
|
2002
|
+
type: () => ({ kind: "Identifier" }),
|
|
2003
|
+
},
|
|
2004
|
+
$type: {
|
|
2005
|
+
kind: "TypeDiscriminant",
|
|
2006
|
+
type: () => ({
|
|
2007
|
+
kind: "TypeDiscriminant",
|
|
2008
|
+
ownValues: ["OwlOntology"],
|
|
2009
|
+
}),
|
|
2010
|
+
},
|
|
2011
|
+
labels: {
|
|
2012
|
+
kind: "Shacl",
|
|
2013
|
+
type: () => ({
|
|
2014
|
+
kind: "Set",
|
|
2015
|
+
item: () => ({ kind: "String" }),
|
|
2016
|
+
}),
|
|
2017
|
+
path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
|
|
2018
|
+
},
|
|
1729
2019
|
},
|
|
1730
2020
|
};
|
|
1731
2021
|
})(OwlOntology || (OwlOntology = {}));
|
|
1732
2022
|
export var ShaclCoreShape;
|
|
1733
2023
|
(function (ShaclCoreShape) {
|
|
2024
|
+
function $filter(filter, value) {
|
|
2025
|
+
if (filter.$identifier !== undefined &&
|
|
2026
|
+
!$filterIdentifier(filter.$identifier, value.$identifier)) {
|
|
2027
|
+
return false;
|
|
2028
|
+
}
|
|
2029
|
+
if (ShaclCoreNodeShape.isShaclCoreNodeShape(value) &&
|
|
2030
|
+
filter.on?.ShaclCoreNodeShape &&
|
|
2031
|
+
!ShaclCoreNodeShape.$filter(filter.on.ShaclCoreNodeShape, value)) {
|
|
2032
|
+
return false;
|
|
2033
|
+
}
|
|
2034
|
+
if (ShaclCorePropertyShape.isShaclCorePropertyShape(value) &&
|
|
2035
|
+
filter.on?.ShaclCorePropertyShape &&
|
|
2036
|
+
!ShaclCorePropertyShape.$filter(filter.on.ShaclCorePropertyShape, value)) {
|
|
2037
|
+
return false;
|
|
2038
|
+
}
|
|
2039
|
+
return true;
|
|
2040
|
+
}
|
|
2041
|
+
ShaclCoreShape.$filter = $filter;
|
|
2042
|
+
let $Identifier;
|
|
2043
|
+
(function ($Identifier) {
|
|
2044
|
+
$Identifier.fromString = $identifierFromString; // biome-ignore lint/suspicious/noShadowRestrictedNames: allow toString
|
|
2045
|
+
$Identifier.toString = Resource.Identifier.toString;
|
|
2046
|
+
})($Identifier = ShaclCoreShape.$Identifier || (ShaclCoreShape.$Identifier = {}));
|
|
2047
|
+
function isShaclCoreShape(object) {
|
|
2048
|
+
return (ShaclCoreNodeShape.isShaclCoreNodeShape(object) ||
|
|
2049
|
+
ShaclCorePropertyShape.isShaclCorePropertyShape(object));
|
|
2050
|
+
}
|
|
2051
|
+
ShaclCoreShape.isShaclCoreShape = isShaclCoreShape;
|
|
2052
|
+
ShaclCoreShape.$schema = {
|
|
2053
|
+
properties: {
|
|
2054
|
+
and: {
|
|
2055
|
+
kind: "Shacl",
|
|
2056
|
+
type: () => ({
|
|
2057
|
+
kind: "Set",
|
|
2058
|
+
item: () => ({
|
|
2059
|
+
kind: "List",
|
|
2060
|
+
item: () => ({ kind: "Identifier" }),
|
|
2061
|
+
}),
|
|
2062
|
+
}),
|
|
2063
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#and"),
|
|
2064
|
+
},
|
|
2065
|
+
classes: {
|
|
2066
|
+
kind: "Shacl",
|
|
2067
|
+
type: () => ({
|
|
2068
|
+
kind: "Set",
|
|
2069
|
+
item: () => ({ kind: "Iri" }),
|
|
2070
|
+
}),
|
|
2071
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#class"),
|
|
2072
|
+
},
|
|
2073
|
+
comments: {
|
|
2074
|
+
kind: "Shacl",
|
|
2075
|
+
type: () => ({
|
|
2076
|
+
kind: "Set",
|
|
2077
|
+
item: () => ({ kind: "String" }),
|
|
2078
|
+
}),
|
|
2079
|
+
path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
|
|
2080
|
+
},
|
|
2081
|
+
datatype: {
|
|
2082
|
+
kind: "Shacl",
|
|
2083
|
+
type: () => ({
|
|
2084
|
+
kind: "Maybe",
|
|
2085
|
+
item: () => ({ kind: "Iri" }),
|
|
2086
|
+
}),
|
|
2087
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#datatype"),
|
|
2088
|
+
},
|
|
2089
|
+
deactivated: {
|
|
2090
|
+
kind: "Shacl",
|
|
2091
|
+
type: () => ({
|
|
2092
|
+
kind: "Maybe",
|
|
2093
|
+
item: () => ({ kind: "Boolean" }),
|
|
2094
|
+
}),
|
|
2095
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"),
|
|
2096
|
+
},
|
|
2097
|
+
flags: {
|
|
2098
|
+
kind: "Shacl",
|
|
2099
|
+
type: () => ({
|
|
2100
|
+
kind: "Set",
|
|
2101
|
+
item: () => ({ kind: "String" }),
|
|
2102
|
+
}),
|
|
2103
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#flags"),
|
|
2104
|
+
},
|
|
2105
|
+
hasValues: {
|
|
2106
|
+
kind: "Shacl",
|
|
2107
|
+
type: () => ({
|
|
2108
|
+
kind: "Set",
|
|
2109
|
+
item: () => ({ kind: "Term" }),
|
|
2110
|
+
}),
|
|
2111
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#hasValue"),
|
|
2112
|
+
},
|
|
2113
|
+
in_: {
|
|
2114
|
+
kind: "Shacl",
|
|
2115
|
+
type: () => ({
|
|
2116
|
+
kind: "Maybe",
|
|
2117
|
+
item: () => ({
|
|
2118
|
+
kind: "List",
|
|
2119
|
+
item: () => ({ kind: "Term" }),
|
|
2120
|
+
}),
|
|
2121
|
+
}),
|
|
2122
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#in"),
|
|
2123
|
+
},
|
|
2124
|
+
isDefinedBy: {
|
|
2125
|
+
kind: "Shacl",
|
|
2126
|
+
type: () => ({
|
|
2127
|
+
kind: "Maybe",
|
|
2128
|
+
item: () => ({ kind: "Identifier" }),
|
|
2129
|
+
}),
|
|
2130
|
+
path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"),
|
|
2131
|
+
},
|
|
2132
|
+
labels: {
|
|
2133
|
+
kind: "Shacl",
|
|
2134
|
+
type: () => ({
|
|
2135
|
+
kind: "Set",
|
|
2136
|
+
item: () => ({ kind: "String" }),
|
|
2137
|
+
}),
|
|
2138
|
+
path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
|
|
2139
|
+
},
|
|
2140
|
+
languageIn: {
|
|
2141
|
+
kind: "Shacl",
|
|
2142
|
+
type: () => ({
|
|
2143
|
+
kind: "Maybe",
|
|
2144
|
+
item: () => ({
|
|
2145
|
+
kind: "List",
|
|
2146
|
+
item: () => ({ kind: "String" }),
|
|
2147
|
+
}),
|
|
2148
|
+
}),
|
|
2149
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#languageIn"),
|
|
2150
|
+
},
|
|
2151
|
+
maxCount: {
|
|
2152
|
+
kind: "Shacl",
|
|
2153
|
+
type: () => ({
|
|
2154
|
+
kind: "Maybe",
|
|
2155
|
+
item: () => ({ kind: "Int" }),
|
|
2156
|
+
}),
|
|
2157
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxCount"),
|
|
2158
|
+
},
|
|
2159
|
+
maxExclusive: {
|
|
2160
|
+
kind: "Shacl",
|
|
2161
|
+
type: () => ({
|
|
2162
|
+
kind: "Maybe",
|
|
2163
|
+
item: () => ({ kind: "Literal" }),
|
|
2164
|
+
}),
|
|
2165
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxExclusive"),
|
|
2166
|
+
},
|
|
2167
|
+
maxInclusive: {
|
|
2168
|
+
kind: "Shacl",
|
|
2169
|
+
type: () => ({
|
|
2170
|
+
kind: "Maybe",
|
|
2171
|
+
item: () => ({ kind: "Literal" }),
|
|
2172
|
+
}),
|
|
2173
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxInclusive"),
|
|
2174
|
+
},
|
|
2175
|
+
maxLength: {
|
|
2176
|
+
kind: "Shacl",
|
|
2177
|
+
type: () => ({
|
|
2178
|
+
kind: "Maybe",
|
|
2179
|
+
item: () => ({ kind: "Int" }),
|
|
2180
|
+
}),
|
|
2181
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxLength"),
|
|
2182
|
+
},
|
|
2183
|
+
minCount: {
|
|
2184
|
+
kind: "Shacl",
|
|
2185
|
+
type: () => ({
|
|
2186
|
+
kind: "Maybe",
|
|
2187
|
+
item: () => ({ kind: "Int" }),
|
|
2188
|
+
}),
|
|
2189
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minCount"),
|
|
2190
|
+
},
|
|
2191
|
+
minExclusive: {
|
|
2192
|
+
kind: "Shacl",
|
|
2193
|
+
type: () => ({
|
|
2194
|
+
kind: "Maybe",
|
|
2195
|
+
item: () => ({ kind: "Literal" }),
|
|
2196
|
+
}),
|
|
2197
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minExclusive"),
|
|
2198
|
+
},
|
|
2199
|
+
minInclusive: {
|
|
2200
|
+
kind: "Shacl",
|
|
2201
|
+
type: () => ({
|
|
2202
|
+
kind: "Maybe",
|
|
2203
|
+
item: () => ({ kind: "Literal" }),
|
|
2204
|
+
}),
|
|
2205
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minInclusive"),
|
|
2206
|
+
},
|
|
2207
|
+
minLength: {
|
|
2208
|
+
kind: "Shacl",
|
|
2209
|
+
type: () => ({
|
|
2210
|
+
kind: "Maybe",
|
|
2211
|
+
item: () => ({ kind: "Int" }),
|
|
2212
|
+
}),
|
|
2213
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minLength"),
|
|
2214
|
+
},
|
|
2215
|
+
nodeKind: {
|
|
2216
|
+
kind: "Shacl",
|
|
2217
|
+
type: () => ({
|
|
2218
|
+
kind: "Maybe",
|
|
2219
|
+
item: () => ({
|
|
2220
|
+
kind: "Iri",
|
|
2221
|
+
in: [
|
|
2222
|
+
dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNode"),
|
|
2223
|
+
dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrIRI"),
|
|
2224
|
+
dataFactory.namedNode("http://www.w3.org/ns/shacl#BlankNodeOrLiteral"),
|
|
2225
|
+
dataFactory.namedNode("http://www.w3.org/ns/shacl#IRI"),
|
|
2226
|
+
dataFactory.namedNode("http://www.w3.org/ns/shacl#IRIOrLiteral"),
|
|
2227
|
+
dataFactory.namedNode("http://www.w3.org/ns/shacl#Literal"),
|
|
2228
|
+
],
|
|
2229
|
+
}),
|
|
2230
|
+
}),
|
|
2231
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"),
|
|
2232
|
+
},
|
|
2233
|
+
nodes: {
|
|
2234
|
+
kind: "Shacl",
|
|
2235
|
+
type: () => ({
|
|
2236
|
+
kind: "Set",
|
|
2237
|
+
item: () => ({ kind: "Identifier" }),
|
|
2238
|
+
}),
|
|
2239
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#node"),
|
|
2240
|
+
},
|
|
2241
|
+
not: {
|
|
2242
|
+
kind: "Shacl",
|
|
2243
|
+
type: () => ({
|
|
2244
|
+
kind: "Set",
|
|
2245
|
+
item: () => ({ kind: "Identifier" }),
|
|
2246
|
+
}),
|
|
2247
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#not"),
|
|
2248
|
+
},
|
|
2249
|
+
or: {
|
|
2250
|
+
kind: "Shacl",
|
|
2251
|
+
type: () => ({
|
|
2252
|
+
kind: "Set",
|
|
2253
|
+
item: () => ({
|
|
2254
|
+
kind: "List",
|
|
2255
|
+
item: () => ({ kind: "Identifier" }),
|
|
2256
|
+
}),
|
|
2257
|
+
}),
|
|
2258
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#or"),
|
|
2259
|
+
},
|
|
2260
|
+
patterns: {
|
|
2261
|
+
kind: "Shacl",
|
|
2262
|
+
type: () => ({
|
|
2263
|
+
kind: "Set",
|
|
2264
|
+
item: () => ({ kind: "String" }),
|
|
2265
|
+
}),
|
|
2266
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#pattern"),
|
|
2267
|
+
},
|
|
2268
|
+
xone: {
|
|
2269
|
+
kind: "Shacl",
|
|
2270
|
+
type: () => ({
|
|
2271
|
+
kind: "Set",
|
|
2272
|
+
item: () => ({
|
|
2273
|
+
kind: "List",
|
|
2274
|
+
item: () => ({ kind: "Identifier" }),
|
|
2275
|
+
}),
|
|
2276
|
+
}),
|
|
2277
|
+
path: dataFactory.namedNode("http://www.w3.org/ns/shacl#xone"),
|
|
2278
|
+
},
|
|
2279
|
+
},
|
|
2280
|
+
};
|
|
1734
2281
|
function $fromRdf(resource, options) {
|
|
1735
2282
|
return ShaclCoreNodeShape.$fromRdf(resource, {
|
|
1736
2283
|
...options,
|
|
@@ -1741,128 +2288,145 @@ export var ShaclCoreShape;
|
|
|
1741
2288
|
}));
|
|
1742
2289
|
}
|
|
1743
2290
|
ShaclCoreShape.$fromRdf = $fromRdf;
|
|
1744
|
-
let $Identifier;
|
|
1745
|
-
(function ($Identifier) {
|
|
1746
|
-
function fromString(identifier) {
|
|
1747
|
-
return purify.Either.encase(() => rdfjsResource.Resource.Identifier.fromString({
|
|
1748
|
-
dataFactory,
|
|
1749
|
-
identifier,
|
|
1750
|
-
}));
|
|
1751
|
-
}
|
|
1752
|
-
$Identifier.fromString = fromString;
|
|
1753
|
-
$Identifier.toString = rdfjsResource.Resource.Identifier.toString;
|
|
1754
|
-
})($Identifier = ShaclCoreShape.$Identifier || (ShaclCoreShape.$Identifier = {}));
|
|
1755
2291
|
function $toRdf(_shaclCoreShape, _parameters) {
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
return ShaclCoreNodeShape.$toRdf(_shaclCoreShape, _parameters);
|
|
1759
|
-
case "ShaclCorePropertyShape":
|
|
1760
|
-
return ShaclCorePropertyShape.$toRdf(_shaclCoreShape, _parameters);
|
|
1761
|
-
default:
|
|
1762
|
-
_shaclCoreShape;
|
|
1763
|
-
throw new Error("unrecognized type");
|
|
2292
|
+
if (ShaclCoreNodeShape.isShaclCoreNodeShape(_shaclCoreShape)) {
|
|
2293
|
+
return ShaclCoreNodeShape.$toRdf(_shaclCoreShape, _parameters);
|
|
1764
2294
|
}
|
|
2295
|
+
if (ShaclCorePropertyShape.isShaclCorePropertyShape(_shaclCoreShape)) {
|
|
2296
|
+
return ShaclCorePropertyShape.$toRdf(_shaclCoreShape, _parameters);
|
|
2297
|
+
}
|
|
2298
|
+
throw new Error("unrecognized type");
|
|
1765
2299
|
}
|
|
1766
2300
|
ShaclCoreShape.$toRdf = $toRdf;
|
|
1767
2301
|
})(ShaclCoreShape || (ShaclCoreShape = {}));
|
|
1768
|
-
export
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
return
|
|
1801
|
-
}
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
}
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
2302
|
+
export var $Object;
|
|
2303
|
+
(function ($Object) {
|
|
2304
|
+
function $filter(filter, value) {
|
|
2305
|
+
if (filter.$identifier !== undefined &&
|
|
2306
|
+
!$filterIdentifier(filter.$identifier, value.$identifier)) {
|
|
2307
|
+
return false;
|
|
2308
|
+
}
|
|
2309
|
+
if (OwlOntology.isOwlOntology(value) &&
|
|
2310
|
+
filter.on?.OwlOntology &&
|
|
2311
|
+
!OwlOntology.$filter(filter.on.OwlOntology, value)) {
|
|
2312
|
+
return false;
|
|
2313
|
+
}
|
|
2314
|
+
if (ShaclCoreNodeShape.isShaclCoreNodeShape(value) &&
|
|
2315
|
+
filter.on?.ShaclCoreNodeShape &&
|
|
2316
|
+
!ShaclCoreNodeShape.$filter(filter.on.ShaclCoreNodeShape, value)) {
|
|
2317
|
+
return false;
|
|
2318
|
+
}
|
|
2319
|
+
if (ShaclCorePropertyGroup.isShaclCorePropertyGroup(value) &&
|
|
2320
|
+
filter.on?.ShaclCorePropertyGroup &&
|
|
2321
|
+
!ShaclCorePropertyGroup.$filter(filter.on.ShaclCorePropertyGroup, value)) {
|
|
2322
|
+
return false;
|
|
2323
|
+
}
|
|
2324
|
+
if (ShaclCorePropertyShape.isShaclCorePropertyShape(value) &&
|
|
2325
|
+
filter.on?.ShaclCorePropertyShape &&
|
|
2326
|
+
!ShaclCorePropertyShape.$filter(filter.on.ShaclCorePropertyShape, value)) {
|
|
2327
|
+
return false;
|
|
2328
|
+
}
|
|
2329
|
+
if (BaseShaclCoreShapeStatic.isBaseShaclCoreShape(value) &&
|
|
2330
|
+
filter.on?.BaseShaclCoreShape &&
|
|
2331
|
+
!BaseShaclCoreShapeStatic.$filter(filter.on.BaseShaclCoreShape, value)) {
|
|
2332
|
+
return false;
|
|
2333
|
+
}
|
|
2334
|
+
return true;
|
|
2335
|
+
}
|
|
2336
|
+
$Object.$filter = $filter;
|
|
2337
|
+
let $Identifier;
|
|
2338
|
+
(function ($Identifier) {
|
|
2339
|
+
$Identifier.fromString = $identifierFromString; // biome-ignore lint/suspicious/noShadowRestrictedNames: allow toString
|
|
2340
|
+
$Identifier.toString = Resource.Identifier.toString;
|
|
2341
|
+
})($Identifier = $Object.$Identifier || ($Object.$Identifier = {}));
|
|
2342
|
+
$Object.$schema = {
|
|
2343
|
+
properties: {
|
|
2344
|
+
labels: {
|
|
2345
|
+
kind: "Shacl",
|
|
2346
|
+
type: () => ({
|
|
2347
|
+
kind: "Set",
|
|
2348
|
+
item: () => ({ kind: "String" }),
|
|
2349
|
+
}),
|
|
2350
|
+
path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
|
|
2351
|
+
},
|
|
2352
|
+
},
|
|
2353
|
+
};
|
|
2354
|
+
function $fromRdf(resource, options) {
|
|
2355
|
+
return OwlOntology.$fromRdf(resource, {
|
|
2356
|
+
...options,
|
|
2357
|
+
ignoreRdfType: false,
|
|
2358
|
+
})
|
|
2359
|
+
.altLazy(() => ShaclCoreNodeShape.$fromRdf(resource, {
|
|
2360
|
+
...options,
|
|
2361
|
+
ignoreRdfType: false,
|
|
2362
|
+
}))
|
|
2363
|
+
.altLazy(() => ShaclCorePropertyGroup.$fromRdf(resource, {
|
|
2364
|
+
...options,
|
|
2365
|
+
ignoreRdfType: false,
|
|
2366
|
+
}))
|
|
2367
|
+
.altLazy(() => ShaclCorePropertyShape.$fromRdf(resource, {
|
|
2368
|
+
...options,
|
|
2369
|
+
ignoreRdfType: false,
|
|
2370
|
+
}));
|
|
1819
2371
|
}
|
|
1820
|
-
|
|
1821
|
-
|
|
2372
|
+
$Object.$fromRdf = $fromRdf;
|
|
2373
|
+
function $toRdf(_object, _parameters) {
|
|
2374
|
+
if (OwlOntology.isOwlOntology(_object)) {
|
|
2375
|
+
return OwlOntology.$toRdf(_object, _parameters);
|
|
2376
|
+
}
|
|
2377
|
+
if (ShaclCoreNodeShape.isShaclCoreNodeShape(_object)) {
|
|
2378
|
+
return ShaclCoreNodeShape.$toRdf(_object, _parameters);
|
|
2379
|
+
}
|
|
2380
|
+
if (ShaclCorePropertyGroup.isShaclCorePropertyGroup(_object)) {
|
|
2381
|
+
return ShaclCorePropertyGroup.$toRdf(_object, _parameters);
|
|
2382
|
+
}
|
|
2383
|
+
if (ShaclCorePropertyShape.isShaclCorePropertyShape(_object)) {
|
|
2384
|
+
return ShaclCorePropertyShape.$toRdf(_object, _parameters);
|
|
2385
|
+
}
|
|
2386
|
+
throw new Error("unrecognized type");
|
|
1822
2387
|
}
|
|
1823
|
-
|
|
1824
|
-
|
|
2388
|
+
$Object.$toRdf = $toRdf;
|
|
2389
|
+
})($Object || ($Object = {}));
|
|
2390
|
+
export class $RdfjsDatasetObjectSet {
|
|
2391
|
+
$graph;
|
|
2392
|
+
#dataset;
|
|
2393
|
+
constructor(dataset, options) {
|
|
2394
|
+
this.#dataset = dataset;
|
|
2395
|
+
this.$graph = options?.graph;
|
|
1825
2396
|
}
|
|
1826
|
-
|
|
1827
|
-
|
|
2397
|
+
$dataset() {
|
|
2398
|
+
if (typeof this.#dataset === "object") {
|
|
2399
|
+
return this.#dataset;
|
|
2400
|
+
}
|
|
2401
|
+
return this.#dataset();
|
|
1828
2402
|
}
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
resourceSet;
|
|
1832
|
-
constructor({ dataset }) {
|
|
1833
|
-
this.resourceSet = new rdfjsResource.ResourceSet({ dataset });
|
|
2403
|
+
$resourceSet() {
|
|
2404
|
+
return new ResourceSet(this.$dataset(), { dataFactory: dataFactory });
|
|
1834
2405
|
}
|
|
1835
2406
|
async owlOntology(identifier) {
|
|
1836
2407
|
return this.owlOntologySync(identifier);
|
|
1837
2408
|
}
|
|
1838
2409
|
owlOntologySync(identifier) {
|
|
1839
|
-
return this.owlOntologiesSync({
|
|
1840
|
-
|
|
1841
|
-
|
|
2410
|
+
return this.owlOntologiesSync({ identifiers: [identifier] }).map((objects) => objects[0]);
|
|
2411
|
+
}
|
|
2412
|
+
async owlOntologyCount(query) {
|
|
2413
|
+
return this.owlOntologyCountSync(query);
|
|
2414
|
+
}
|
|
2415
|
+
owlOntologyCountSync(query) {
|
|
2416
|
+
return this.owlOntologiesSync(query).map((objects) => objects.length);
|
|
1842
2417
|
}
|
|
1843
2418
|
async owlOntologyIdentifiers(query) {
|
|
1844
2419
|
return this.owlOntologyIdentifiersSync(query);
|
|
1845
2420
|
}
|
|
1846
2421
|
owlOntologyIdentifiersSync(query) {
|
|
1847
|
-
return this.$
|
|
1848
|
-
$fromRdf: OwlOntology.$fromRdf,
|
|
1849
|
-
$fromRdfTypes: [OwlOntology.$fromRdfType],
|
|
1850
|
-
}, query);
|
|
2422
|
+
return this.owlOntologiesSync(query).map((objects) => objects.map((object) => object.$identifier));
|
|
1851
2423
|
}
|
|
1852
2424
|
async owlOntologies(query) {
|
|
1853
2425
|
return this.owlOntologiesSync(query);
|
|
1854
2426
|
}
|
|
1855
2427
|
owlOntologiesSync(query) {
|
|
1856
2428
|
return this.$objectsSync({
|
|
1857
|
-
$
|
|
1858
|
-
$fromRdfTypes: [OwlOntology.$fromRdfType],
|
|
1859
|
-
}, query);
|
|
1860
|
-
}
|
|
1861
|
-
async owlOntologiesCount(query) {
|
|
1862
|
-
return this.owlOntologiesCountSync(query);
|
|
1863
|
-
}
|
|
1864
|
-
owlOntologiesCountSync(query) {
|
|
1865
|
-
return this.$objectsCountSync({
|
|
2429
|
+
$filter: OwlOntology.$filter,
|
|
1866
2430
|
$fromRdf: OwlOntology.$fromRdf,
|
|
1867
2431
|
$fromRdfTypes: [OwlOntology.$fromRdfType],
|
|
1868
2432
|
}, query);
|
|
@@ -1871,33 +2435,26 @@ export class $RdfjsDatasetObjectSet {
|
|
|
1871
2435
|
return this.shaclCoreNodeShapeSync(identifier);
|
|
1872
2436
|
}
|
|
1873
2437
|
shaclCoreNodeShapeSync(identifier) {
|
|
1874
|
-
return this.shaclCoreNodeShapesSync({
|
|
1875
|
-
|
|
1876
|
-
|
|
2438
|
+
return this.shaclCoreNodeShapesSync({ identifiers: [identifier] }).map((objects) => objects[0]);
|
|
2439
|
+
}
|
|
2440
|
+
async shaclCoreNodeShapeCount(query) {
|
|
2441
|
+
return this.shaclCoreNodeShapeCountSync(query);
|
|
2442
|
+
}
|
|
2443
|
+
shaclCoreNodeShapeCountSync(query) {
|
|
2444
|
+
return this.shaclCoreNodeShapesSync(query).map((objects) => objects.length);
|
|
1877
2445
|
}
|
|
1878
2446
|
async shaclCoreNodeShapeIdentifiers(query) {
|
|
1879
2447
|
return this.shaclCoreNodeShapeIdentifiersSync(query);
|
|
1880
2448
|
}
|
|
1881
2449
|
shaclCoreNodeShapeIdentifiersSync(query) {
|
|
1882
|
-
return this.$
|
|
1883
|
-
$fromRdf: ShaclCoreNodeShape.$fromRdf,
|
|
1884
|
-
$fromRdfTypes: [ShaclCoreNodeShape.$fromRdfType],
|
|
1885
|
-
}, query);
|
|
2450
|
+
return this.shaclCoreNodeShapesSync(query).map((objects) => objects.map((object) => object.$identifier));
|
|
1886
2451
|
}
|
|
1887
2452
|
async shaclCoreNodeShapes(query) {
|
|
1888
2453
|
return this.shaclCoreNodeShapesSync(query);
|
|
1889
2454
|
}
|
|
1890
2455
|
shaclCoreNodeShapesSync(query) {
|
|
1891
2456
|
return this.$objectsSync({
|
|
1892
|
-
$
|
|
1893
|
-
$fromRdfTypes: [ShaclCoreNodeShape.$fromRdfType],
|
|
1894
|
-
}, query);
|
|
1895
|
-
}
|
|
1896
|
-
async shaclCoreNodeShapesCount(query) {
|
|
1897
|
-
return this.shaclCoreNodeShapesCountSync(query);
|
|
1898
|
-
}
|
|
1899
|
-
shaclCoreNodeShapesCountSync(query) {
|
|
1900
|
-
return this.$objectsCountSync({
|
|
2457
|
+
$filter: ShaclCoreNodeShape.$filter,
|
|
1901
2458
|
$fromRdf: ShaclCoreNodeShape.$fromRdf,
|
|
1902
2459
|
$fromRdfTypes: [ShaclCoreNodeShape.$fromRdfType],
|
|
1903
2460
|
}, query);
|
|
@@ -1906,33 +2463,26 @@ export class $RdfjsDatasetObjectSet {
|
|
|
1906
2463
|
return this.shaclCorePropertyGroupSync(identifier);
|
|
1907
2464
|
}
|
|
1908
2465
|
shaclCorePropertyGroupSync(identifier) {
|
|
1909
|
-
return this.shaclCorePropertyGroupsSync({
|
|
1910
|
-
|
|
1911
|
-
|
|
2466
|
+
return this.shaclCorePropertyGroupsSync({ identifiers: [identifier] }).map((objects) => objects[0]);
|
|
2467
|
+
}
|
|
2468
|
+
async shaclCorePropertyGroupCount(query) {
|
|
2469
|
+
return this.shaclCorePropertyGroupCountSync(query);
|
|
2470
|
+
}
|
|
2471
|
+
shaclCorePropertyGroupCountSync(query) {
|
|
2472
|
+
return this.shaclCorePropertyGroupsSync(query).map((objects) => objects.length);
|
|
1912
2473
|
}
|
|
1913
2474
|
async shaclCorePropertyGroupIdentifiers(query) {
|
|
1914
2475
|
return this.shaclCorePropertyGroupIdentifiersSync(query);
|
|
1915
2476
|
}
|
|
1916
2477
|
shaclCorePropertyGroupIdentifiersSync(query) {
|
|
1917
|
-
return this.$
|
|
1918
|
-
$fromRdf: ShaclCorePropertyGroup.$fromRdf,
|
|
1919
|
-
$fromRdfTypes: [ShaclCorePropertyGroup.$fromRdfType],
|
|
1920
|
-
}, query);
|
|
2478
|
+
return this.shaclCorePropertyGroupsSync(query).map((objects) => objects.map((object) => object.$identifier));
|
|
1921
2479
|
}
|
|
1922
2480
|
async shaclCorePropertyGroups(query) {
|
|
1923
2481
|
return this.shaclCorePropertyGroupsSync(query);
|
|
1924
2482
|
}
|
|
1925
2483
|
shaclCorePropertyGroupsSync(query) {
|
|
1926
2484
|
return this.$objectsSync({
|
|
1927
|
-
$
|
|
1928
|
-
$fromRdfTypes: [ShaclCorePropertyGroup.$fromRdfType],
|
|
1929
|
-
}, query);
|
|
1930
|
-
}
|
|
1931
|
-
async shaclCorePropertyGroupsCount(query) {
|
|
1932
|
-
return this.shaclCorePropertyGroupsCountSync(query);
|
|
1933
|
-
}
|
|
1934
|
-
shaclCorePropertyGroupsCountSync(query) {
|
|
1935
|
-
return this.$objectsCountSync({
|
|
2485
|
+
$filter: ShaclCorePropertyGroup.$filter,
|
|
1936
2486
|
$fromRdf: ShaclCorePropertyGroup.$fromRdf,
|
|
1937
2487
|
$fromRdfTypes: [ShaclCorePropertyGroup.$fromRdfType],
|
|
1938
2488
|
}, query);
|
|
@@ -1941,33 +2491,26 @@ export class $RdfjsDatasetObjectSet {
|
|
|
1941
2491
|
return this.shaclCorePropertyShapeSync(identifier);
|
|
1942
2492
|
}
|
|
1943
2493
|
shaclCorePropertyShapeSync(identifier) {
|
|
1944
|
-
return this.shaclCorePropertyShapesSync({
|
|
1945
|
-
|
|
1946
|
-
|
|
2494
|
+
return this.shaclCorePropertyShapesSync({ identifiers: [identifier] }).map((objects) => objects[0]);
|
|
2495
|
+
}
|
|
2496
|
+
async shaclCorePropertyShapeCount(query) {
|
|
2497
|
+
return this.shaclCorePropertyShapeCountSync(query);
|
|
2498
|
+
}
|
|
2499
|
+
shaclCorePropertyShapeCountSync(query) {
|
|
2500
|
+
return this.shaclCorePropertyShapesSync(query).map((objects) => objects.length);
|
|
1947
2501
|
}
|
|
1948
2502
|
async shaclCorePropertyShapeIdentifiers(query) {
|
|
1949
2503
|
return this.shaclCorePropertyShapeIdentifiersSync(query);
|
|
1950
2504
|
}
|
|
1951
2505
|
shaclCorePropertyShapeIdentifiersSync(query) {
|
|
1952
|
-
return this.$
|
|
1953
|
-
$fromRdf: ShaclCorePropertyShape.$fromRdf,
|
|
1954
|
-
$fromRdfTypes: [ShaclCorePropertyShape.$fromRdfType],
|
|
1955
|
-
}, query);
|
|
2506
|
+
return this.shaclCorePropertyShapesSync(query).map((objects) => objects.map((object) => object.$identifier));
|
|
1956
2507
|
}
|
|
1957
2508
|
async shaclCorePropertyShapes(query) {
|
|
1958
2509
|
return this.shaclCorePropertyShapesSync(query);
|
|
1959
2510
|
}
|
|
1960
2511
|
shaclCorePropertyShapesSync(query) {
|
|
1961
2512
|
return this.$objectsSync({
|
|
1962
|
-
$
|
|
1963
|
-
$fromRdfTypes: [ShaclCorePropertyShape.$fromRdfType],
|
|
1964
|
-
}, query);
|
|
1965
|
-
}
|
|
1966
|
-
async shaclCorePropertyShapesCount(query) {
|
|
1967
|
-
return this.shaclCorePropertyShapesCountSync(query);
|
|
1968
|
-
}
|
|
1969
|
-
shaclCorePropertyShapesCountSync(query) {
|
|
1970
|
-
return this.$objectsCountSync({
|
|
2513
|
+
$filter: ShaclCorePropertyShape.$filter,
|
|
1971
2514
|
$fromRdf: ShaclCorePropertyShape.$fromRdf,
|
|
1972
2515
|
$fromRdfTypes: [ShaclCorePropertyShape.$fromRdfType],
|
|
1973
2516
|
}, query);
|
|
@@ -1976,24 +2519,19 @@ export class $RdfjsDatasetObjectSet {
|
|
|
1976
2519
|
return this.shaclCoreShapeSync(identifier);
|
|
1977
2520
|
}
|
|
1978
2521
|
shaclCoreShapeSync(identifier) {
|
|
1979
|
-
return this.shaclCoreShapesSync({
|
|
1980
|
-
|
|
1981
|
-
|
|
2522
|
+
return this.shaclCoreShapesSync({ identifiers: [identifier] }).map((objects) => objects[0]);
|
|
2523
|
+
}
|
|
2524
|
+
async shaclCoreShapeCount(query) {
|
|
2525
|
+
return this.shaclCoreShapeCountSync(query);
|
|
2526
|
+
}
|
|
2527
|
+
shaclCoreShapeCountSync(query) {
|
|
2528
|
+
return this.shaclCoreShapesSync(query).map((objects) => objects.length);
|
|
1982
2529
|
}
|
|
1983
2530
|
async shaclCoreShapeIdentifiers(query) {
|
|
1984
2531
|
return this.shaclCoreShapeIdentifiersSync(query);
|
|
1985
2532
|
}
|
|
1986
2533
|
shaclCoreShapeIdentifiersSync(query) {
|
|
1987
|
-
return this.$
|
|
1988
|
-
{
|
|
1989
|
-
$fromRdf: ShaclCoreNodeShape.$fromRdf,
|
|
1990
|
-
$fromRdfTypes: [ShaclCoreNodeShape.$fromRdfType],
|
|
1991
|
-
},
|
|
1992
|
-
{
|
|
1993
|
-
$fromRdf: ShaclCorePropertyShape.$fromRdf,
|
|
1994
|
-
$fromRdfTypes: [ShaclCorePropertyShape.$fromRdfType],
|
|
1995
|
-
},
|
|
1996
|
-
], query);
|
|
2534
|
+
return this.shaclCoreShapesSync(query).map((objects) => objects.map((object) => object.$identifier));
|
|
1997
2535
|
}
|
|
1998
2536
|
async shaclCoreShapes(query) {
|
|
1999
2537
|
return this.shaclCoreShapesSync(query);
|
|
@@ -2001,204 +2539,269 @@ export class $RdfjsDatasetObjectSet {
|
|
|
2001
2539
|
shaclCoreShapesSync(query) {
|
|
2002
2540
|
return this.$objectUnionsSync([
|
|
2003
2541
|
{
|
|
2542
|
+
$filter: ShaclCoreShape.$filter,
|
|
2004
2543
|
$fromRdf: ShaclCoreNodeShape.$fromRdf,
|
|
2005
2544
|
$fromRdfTypes: [ShaclCoreNodeShape.$fromRdfType],
|
|
2006
2545
|
},
|
|
2007
2546
|
{
|
|
2547
|
+
$filter: ShaclCoreShape.$filter,
|
|
2008
2548
|
$fromRdf: ShaclCorePropertyShape.$fromRdf,
|
|
2009
2549
|
$fromRdfTypes: [ShaclCorePropertyShape.$fromRdfType],
|
|
2010
2550
|
},
|
|
2011
2551
|
], query);
|
|
2012
2552
|
}
|
|
2013
|
-
async
|
|
2014
|
-
return this.
|
|
2553
|
+
async object(identifier) {
|
|
2554
|
+
return this.objectSync(identifier);
|
|
2555
|
+
}
|
|
2556
|
+
objectSync(identifier) {
|
|
2557
|
+
return this.objectsSync({ identifiers: [identifier] }).map((objects) => objects[0]);
|
|
2558
|
+
}
|
|
2559
|
+
async objectCount(query) {
|
|
2560
|
+
return this.objectCountSync(query);
|
|
2561
|
+
}
|
|
2562
|
+
objectCountSync(query) {
|
|
2563
|
+
return this.objectsSync(query).map((objects) => objects.length);
|
|
2015
2564
|
}
|
|
2016
|
-
|
|
2017
|
-
return this
|
|
2565
|
+
async objectIdentifiers(query) {
|
|
2566
|
+
return this.objectIdentifiersSync(query);
|
|
2567
|
+
}
|
|
2568
|
+
objectIdentifiersSync(query) {
|
|
2569
|
+
return this.objectsSync(query).map((objects) => objects.map((object) => object.$identifier));
|
|
2570
|
+
}
|
|
2571
|
+
async objects(query) {
|
|
2572
|
+
return this.objectsSync(query);
|
|
2573
|
+
}
|
|
2574
|
+
objectsSync(query) {
|
|
2575
|
+
return this.$objectUnionsSync([
|
|
2018
2576
|
{
|
|
2577
|
+
$filter: $Object.$filter,
|
|
2578
|
+
$fromRdf: OwlOntology.$fromRdf,
|
|
2579
|
+
$fromRdfTypes: [OwlOntology.$fromRdfType],
|
|
2580
|
+
},
|
|
2581
|
+
{
|
|
2582
|
+
$filter: $Object.$filter,
|
|
2019
2583
|
$fromRdf: ShaclCoreNodeShape.$fromRdf,
|
|
2020
2584
|
$fromRdfTypes: [ShaclCoreNodeShape.$fromRdfType],
|
|
2021
2585
|
},
|
|
2022
2586
|
{
|
|
2587
|
+
$filter: $Object.$filter,
|
|
2588
|
+
$fromRdf: ShaclCorePropertyGroup.$fromRdf,
|
|
2589
|
+
$fromRdfTypes: [ShaclCorePropertyGroup.$fromRdfType],
|
|
2590
|
+
},
|
|
2591
|
+
{
|
|
2592
|
+
$filter: $Object.$filter,
|
|
2023
2593
|
$fromRdf: ShaclCorePropertyShape.$fromRdf,
|
|
2024
2594
|
$fromRdfTypes: [ShaclCorePropertyShape.$fromRdfType],
|
|
2025
2595
|
},
|
|
2026
2596
|
], query);
|
|
2027
2597
|
}
|
|
2028
|
-
$objectIdentifiersSync(objectType, query) {
|
|
2029
|
-
return this.$objectsSync(objectType, query).map((objects) => objects.map((object) => object.$identifier));
|
|
2030
|
-
}
|
|
2031
2598
|
$objectsSync(objectType, query) {
|
|
2599
|
+
const graph = query?.graph ?? this.$graph;
|
|
2032
2600
|
const limit = query?.limit ?? Number.MAX_SAFE_INTEGER;
|
|
2033
2601
|
if (limit <= 0) {
|
|
2034
|
-
return
|
|
2602
|
+
return Right([]);
|
|
2035
2603
|
}
|
|
2036
2604
|
let offset = query?.offset ?? 0;
|
|
2037
2605
|
if (offset < 0) {
|
|
2038
2606
|
offset = 0;
|
|
2039
2607
|
}
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
}
|
|
2061
|
-
else {
|
|
2062
|
-
return purify.Left(new Error(`subject=${query.where.subject.value} predicate=${query.where.predicate.value} pattern matches non-identifier (${quad.object.termType}) triple`));
|
|
2063
|
-
}
|
|
2608
|
+
let resources;
|
|
2609
|
+
const resourceSet = this.$resourceSet(); // Access once, in case it's instantiated lazily
|
|
2610
|
+
let sortResources;
|
|
2611
|
+
if (query?.identifiers) {
|
|
2612
|
+
resources = query.identifiers.map((identifier) => ({
|
|
2613
|
+
resource: resourceSet.resource(identifier),
|
|
2614
|
+
}));
|
|
2615
|
+
sortResources = false;
|
|
2616
|
+
}
|
|
2617
|
+
else if (objectType.$fromRdfTypes.length > 0) {
|
|
2618
|
+
const identifierSet = new $IdentifierSet();
|
|
2619
|
+
resources = [];
|
|
2620
|
+
sortResources = true;
|
|
2621
|
+
for (const fromRdfType of objectType.$fromRdfTypes) {
|
|
2622
|
+
for (const resource of resourceSet.instancesOf(fromRdfType, {
|
|
2623
|
+
graph,
|
|
2624
|
+
})) {
|
|
2625
|
+
if (!identifierSet.has(resource.identifier)) {
|
|
2626
|
+
identifierSet.add(resource.identifier);
|
|
2627
|
+
resources.push({ resource });
|
|
2064
2628
|
}
|
|
2065
|
-
break;
|
|
2066
2629
|
}
|
|
2067
2630
|
}
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2631
|
+
}
|
|
2632
|
+
else {
|
|
2633
|
+
const identifierSet = new $IdentifierSet();
|
|
2634
|
+
resources = [];
|
|
2635
|
+
sortResources = true;
|
|
2636
|
+
for (const quad of resourceSet.dataset) {
|
|
2637
|
+
if (graph && !quad.graph.equals(graph)) {
|
|
2638
|
+
continue;
|
|
2073
2639
|
}
|
|
2074
|
-
|
|
2640
|
+
switch (quad.subject.termType) {
|
|
2641
|
+
case "BlankNode":
|
|
2642
|
+
case "NamedNode":
|
|
2643
|
+
break;
|
|
2644
|
+
default:
|
|
2645
|
+
continue;
|
|
2646
|
+
}
|
|
2647
|
+
if (identifierSet.has(quad.subject)) {
|
|
2648
|
+
continue;
|
|
2649
|
+
}
|
|
2650
|
+
identifierSet.add(quad.subject);
|
|
2651
|
+
const resource = resourceSet.resource(quad.subject);
|
|
2652
|
+
// Eagerly eliminate the majority of resources that won't match the object type
|
|
2653
|
+
objectType
|
|
2654
|
+
.$fromRdf(resource, { graph, objectSet: this })
|
|
2655
|
+
.ifRight((object) => {
|
|
2656
|
+
resources.push({ object, resource });
|
|
2657
|
+
});
|
|
2075
2658
|
}
|
|
2076
|
-
return purify.Either.of(objects);
|
|
2077
2659
|
}
|
|
2078
|
-
if (
|
|
2079
|
-
|
|
2660
|
+
if (sortResources) {
|
|
2661
|
+
// Sort resources by identifier so limit and offset are deterministic
|
|
2662
|
+
resources.sort((left, right) => left.resource.identifier.value.localeCompare(right.resource.identifier.value));
|
|
2080
2663
|
}
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2664
|
+
let objectI = 0;
|
|
2665
|
+
const objects = [];
|
|
2666
|
+
for (let { object, resource } of resources) {
|
|
2667
|
+
if (!object) {
|
|
2668
|
+
const objectEither = objectType.$fromRdf(resource, {
|
|
2669
|
+
graph,
|
|
2670
|
+
objectSet: this,
|
|
2671
|
+
});
|
|
2672
|
+
if (objectEither.isLeft()) {
|
|
2673
|
+
return objectEither;
|
|
2086
2674
|
}
|
|
2675
|
+
object = objectEither.unsafeCoerce();
|
|
2087
2676
|
}
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
resources.sort((left, right) => left.identifier.value.localeCompare(right.identifier.value));
|
|
2091
|
-
const objects = [];
|
|
2092
|
-
let objectI = 0;
|
|
2093
|
-
for (const resource of resources) {
|
|
2094
|
-
const either = objectType.$fromRdf(resource, { objectSet: this });
|
|
2095
|
-
if (either.isLeft()) {
|
|
2096
|
-
return either;
|
|
2677
|
+
if (query?.filter && !objectType.$filter(query.filter, object)) {
|
|
2678
|
+
continue;
|
|
2097
2679
|
}
|
|
2098
2680
|
if (objectI++ >= offset) {
|
|
2099
|
-
objects.push(
|
|
2681
|
+
objects.push(object);
|
|
2100
2682
|
if (objects.length === limit) {
|
|
2101
|
-
return
|
|
2683
|
+
return Right(objects);
|
|
2102
2684
|
}
|
|
2103
2685
|
}
|
|
2104
2686
|
}
|
|
2105
|
-
return
|
|
2106
|
-
}
|
|
2107
|
-
$objectsCountSync(objectType, query) {
|
|
2108
|
-
return this.$objectsSync(objectType, query).map((objects) => objects.length);
|
|
2109
|
-
}
|
|
2110
|
-
$objectUnionIdentifiersSync(objectTypes, query) {
|
|
2111
|
-
return this.$objectUnionsSync(objectTypes, query).map((objects) => objects.map((object) => object.$identifier));
|
|
2687
|
+
return Right(objects);
|
|
2112
2688
|
}
|
|
2113
2689
|
$objectUnionsSync(objectTypes, query) {
|
|
2690
|
+
const graph = query?.graph ?? this.$graph;
|
|
2114
2691
|
const limit = query?.limit ?? Number.MAX_SAFE_INTEGER;
|
|
2115
2692
|
if (limit <= 0) {
|
|
2116
|
-
return
|
|
2693
|
+
return Right([]);
|
|
2117
2694
|
}
|
|
2118
2695
|
let offset = query?.offset ?? 0;
|
|
2119
2696
|
if (offset < 0) {
|
|
2120
2697
|
offset = 0;
|
|
2121
2698
|
}
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
else {
|
|
2144
|
-
return purify.Left(new Error(`subject=${query.where.subject.value} predicate=${query.where.predicate.value} pattern matches non-identifier (${quad.object.termType}) triple`));
|
|
2699
|
+
let resources;
|
|
2700
|
+
const resourceSet = this.$resourceSet(); // Access once, in case it's instantiated lazily
|
|
2701
|
+
let sortResources;
|
|
2702
|
+
if (query?.identifiers) {
|
|
2703
|
+
resources = query.identifiers.map((identifier) => ({
|
|
2704
|
+
resource: resourceSet.resource(identifier),
|
|
2705
|
+
}));
|
|
2706
|
+
sortResources = false;
|
|
2707
|
+
}
|
|
2708
|
+
else if (objectTypes.every((objectType) => objectType.$fromRdfTypes.length > 0)) {
|
|
2709
|
+
const identifierSet = new $IdentifierSet();
|
|
2710
|
+
resources = [];
|
|
2711
|
+
sortResources = true;
|
|
2712
|
+
for (const objectType of objectTypes) {
|
|
2713
|
+
for (const fromRdfType of objectType.$fromRdfTypes) {
|
|
2714
|
+
for (const resource of resourceSet.instancesOf(fromRdfType, {
|
|
2715
|
+
graph,
|
|
2716
|
+
})) {
|
|
2717
|
+
if (!identifierSet.has(resource.identifier)) {
|
|
2718
|
+
identifierSet.add(resource.identifier);
|
|
2719
|
+
resources.push({ objectType, resource });
|
|
2145
2720
|
}
|
|
2146
2721
|
}
|
|
2147
|
-
break;
|
|
2148
2722
|
}
|
|
2149
2723
|
}
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2724
|
+
}
|
|
2725
|
+
else {
|
|
2726
|
+
const identifierSet = new $IdentifierSet();
|
|
2727
|
+
resources = [];
|
|
2728
|
+
sortResources = true;
|
|
2729
|
+
for (const quad of resourceSet.dataset) {
|
|
2730
|
+
if (graph && !quad.graph.equals(graph)) {
|
|
2731
|
+
continue;
|
|
2732
|
+
}
|
|
2733
|
+
switch (quad.subject.termType) {
|
|
2734
|
+
case "BlankNode":
|
|
2735
|
+
case "NamedNode":
|
|
2158
2736
|
break;
|
|
2159
|
-
|
|
2160
|
-
|
|
2737
|
+
default:
|
|
2738
|
+
continue;
|
|
2161
2739
|
}
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
return lefts[0];
|
|
2740
|
+
if (identifierSet.has(quad.subject)) {
|
|
2741
|
+
continue;
|
|
2165
2742
|
}
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
resources.push({ objectType, resource });
|
|
2743
|
+
identifierSet.add(quad.subject);
|
|
2744
|
+
// Eagerly eliminate the majority of resources that won't match the object types
|
|
2745
|
+
const resource = resourceSet.resource(quad.subject);
|
|
2746
|
+
for (const objectType of objectTypes) {
|
|
2747
|
+
if (objectType
|
|
2748
|
+
.$fromRdf(resource, { graph, objectSet: this })
|
|
2749
|
+
.ifRight((object) => {
|
|
2750
|
+
resources.push({ object, objectType, resource });
|
|
2751
|
+
})
|
|
2752
|
+
.isRight()) {
|
|
2753
|
+
break;
|
|
2178
2754
|
}
|
|
2179
2755
|
}
|
|
2180
2756
|
}
|
|
2181
2757
|
}
|
|
2182
|
-
|
|
2183
|
-
|
|
2758
|
+
if (sortResources) {
|
|
2759
|
+
// Sort resources by identifier so limit and offset are deterministic
|
|
2760
|
+
resources.sort((left, right) => left.resource.identifier.value.localeCompare(right.resource.identifier.value));
|
|
2761
|
+
}
|
|
2184
2762
|
let objectI = 0;
|
|
2185
2763
|
const objects = [];
|
|
2186
|
-
for (
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2764
|
+
for (let { object, objectType, resource } of resources) {
|
|
2765
|
+
if (!object) {
|
|
2766
|
+
let objectEither;
|
|
2767
|
+
if (objectType) {
|
|
2768
|
+
objectEither = objectType.$fromRdf(resource, {
|
|
2769
|
+
graph,
|
|
2770
|
+
objectSet: this,
|
|
2771
|
+
});
|
|
2772
|
+
}
|
|
2773
|
+
else {
|
|
2774
|
+
objectEither = Left(new Error("no object types"));
|
|
2775
|
+
for (const tryObjectType of objectTypes) {
|
|
2776
|
+
objectEither = tryObjectType.$fromRdf(resource, {
|
|
2777
|
+
graph,
|
|
2778
|
+
objectSet: this,
|
|
2779
|
+
});
|
|
2780
|
+
if (objectEither.isRight()) {
|
|
2781
|
+
objectType = tryObjectType;
|
|
2782
|
+
break;
|
|
2783
|
+
}
|
|
2784
|
+
}
|
|
2785
|
+
}
|
|
2786
|
+
if (objectEither.isLeft()) {
|
|
2787
|
+
return objectEither;
|
|
2788
|
+
}
|
|
2789
|
+
object = objectEither.unsafeCoerce();
|
|
2790
|
+
}
|
|
2791
|
+
if (!objectType) {
|
|
2792
|
+
throw new Error("objectType should be set here");
|
|
2793
|
+
}
|
|
2794
|
+
if (query?.filter && !objectType.$filter(query.filter, object)) {
|
|
2795
|
+
continue;
|
|
2190
2796
|
}
|
|
2191
2797
|
if (objectI++ >= offset) {
|
|
2192
|
-
objects.push(
|
|
2798
|
+
objects.push(object);
|
|
2193
2799
|
if (objects.length === limit) {
|
|
2194
|
-
return
|
|
2800
|
+
return Right(objects);
|
|
2195
2801
|
}
|
|
2196
2802
|
}
|
|
2197
2803
|
}
|
|
2198
|
-
return
|
|
2199
|
-
}
|
|
2200
|
-
$objectUnionsCountSync(objectTypes, query) {
|
|
2201
|
-
return this.$objectUnionIdentifiersSync(objectTypes, query).map((objects) => objects.length);
|
|
2804
|
+
return Right(objects);
|
|
2202
2805
|
}
|
|
2203
2806
|
}
|
|
2204
2807
|
//# sourceMappingURL=generated.js.map
|