@shaclmate/compiler 2.0.23 → 2.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ShapesGraphToAstTransformer.d.ts +5 -5
- package/dist/ShapesGraphToAstTransformer.js +5 -5
- package/dist/_ShapesGraphToAstTransformer/InheritableShapeConstraints.d.ts +2 -0
- package/dist/_ShapesGraphToAstTransformer/InheritableShapeConstraints.js +2 -0
- package/dist/_ShapesGraphToAstTransformer/ShapeStack.d.ts +15 -0
- package/dist/_ShapesGraphToAstTransformer/ShapeStack.js +51 -0
- package/dist/_ShapesGraphToAstTransformer/index.d.ts +5 -5
- package/dist/_ShapesGraphToAstTransformer/index.js +5 -5
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +77 -29
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompositeType.d.ts +10 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompositeType.js +185 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstIdentifierType.d.ts +10 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstIdentifierType.js +32 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstLiteralType.d.ts +10 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstLiteralType.js +46 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.d.ts +12 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.js +24 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.d.ts +13 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.js +14 -0
- package/dist/ast/OptionType.d.ts +0 -2
- package/dist/ast/SetType.d.ts +1 -6
- package/dist/ast/index.d.ts +1 -0
- package/dist/ast/index.js +1 -0
- package/dist/generators/json/AstJsonGenerator.js +7 -1
- package/dist/generators/ts/BooleanType.d.ts +1 -1
- package/dist/generators/ts/BooleanType.js +1 -1
- package/dist/generators/ts/DateTimeType.d.ts +1 -1
- package/dist/generators/ts/DateTimeType.js +1 -1
- package/dist/generators/ts/IdentifierType.d.ts +6 -1
- package/dist/generators/ts/IdentifierType.js +20 -14
- package/dist/generators/ts/ListType.js +16 -5
- package/dist/generators/ts/LiteralType.d.ts +9 -2
- package/dist/generators/ts/LiteralType.js +79 -15
- package/dist/generators/ts/NumberType.d.ts +1 -1
- package/dist/generators/ts/NumberType.js +1 -1
- package/dist/generators/ts/ObjectType.d.ts +1 -2
- package/dist/generators/ts/ObjectType.js +4 -5
- package/dist/generators/ts/ObjectUnionType.d.ts +1 -0
- package/dist/generators/ts/ObjectUnionType.js +18 -9
- package/dist/generators/ts/OptionType.d.ts +1 -1
- package/dist/generators/ts/OptionType.js +6 -4
- package/dist/generators/ts/PrimitiveType.d.ts +19 -1
- package/dist/generators/ts/PrimitiveType.js +16 -3
- package/dist/generators/ts/SetType.d.ts +4 -4
- package/dist/generators/ts/SetType.js +15 -12
- package/dist/generators/ts/SnippetDeclarations.d.ts +1 -1
- package/dist/generators/ts/SnippetDeclarations.js +13 -2
- package/dist/generators/ts/StringType.d.ts +1 -1
- package/dist/generators/ts/StringType.js +8 -8
- package/dist/generators/ts/TermType.d.ts +7 -19
- package/dist/generators/ts/TermType.js +44 -51
- package/dist/generators/ts/TsGenerator.js +4 -1
- package/dist/generators/ts/Type.d.ts +12 -2
- package/dist/generators/ts/Type.js +1 -0
- package/dist/generators/ts/TypeFactory.d.ts +8 -0
- package/dist/generators/ts/TypeFactory.js +112 -22
- package/dist/generators/ts/UnionType.js +1 -1
- package/dist/generators/ts/_ObjectType/EagerShaclProperty.js +3 -2
- package/dist/generators/ts/_ObjectType/IdentifierPrefixProperty.d.ts +1 -1
- package/dist/generators/ts/_ObjectType/IdentifierPrefixProperty.js +15 -1
- package/dist/generators/ts/_ObjectType/IdentifierProperty.d.ts +6 -6
- package/dist/generators/ts/_ObjectType/IdentifierProperty.js +59 -29
- package/dist/generators/ts/_ObjectType/LazyShaclProperty.d.ts +14 -1
- package/dist/generators/ts/_ObjectType/LazyShaclProperty.js +89 -11
- package/dist/generators/ts/_ObjectType/Property.d.ts +9 -3
- package/dist/generators/ts/_ObjectType/ShaclProperty.d.ts +1 -1
- package/dist/generators/ts/_ObjectType/ShaclProperty.js +14 -2
- package/dist/generators/ts/_ObjectType/TypeDiscriminatorProperty.d.ts +1 -1
- package/dist/generators/ts/_ObjectType/TypeDiscriminatorProperty.js +1 -1
- package/dist/generators/ts/_ObjectType/classDeclaration.js +16 -12
- package/dist/generators/ts/_ObjectType/createFunctionDeclaration.js +22 -10
- package/dist/generators/ts/_ObjectType/equalsFunctionOrMethodDeclaration.js +3 -1
- package/dist/generators/ts/_ObjectType/graphqlTypeVariableStatement.js +14 -2
- package/dist/generators/ts/_ObjectType/rdfFunctionDeclarations.js +71 -79
- package/dist/generators/ts/_ObjectType/sparqlConstructQueryFunctionDeclaration.js +3 -3
- package/dist/generators/ts/_ObjectType/sparqlConstructQueryStringFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_ObjectType/sparqlFunctionDeclarations.js +6 -2
- package/dist/generators/ts/_ObjectType/toRdfFunctionOrMethodDeclaration.js +19 -12
- package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.js +5 -5
- package/dist/generators/ts/sparqlObjectSetClassDeclaration.js +6 -6
- package/dist/input/PropertyPath.d.ts +1 -2
- package/dist/input/PropertyPath.js +6 -8
- package/dist/input/ShapesGraph.js +4 -8
- package/dist/input/generated.d.ts +96 -54
- package/dist/input/generated.js +1350 -744
- package/package.json +5 -5
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstCompositeType.d.ts +0 -12
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstCompositeType.js +0 -193
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstIdentifierType.d.ts +0 -12
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstIdentifierType.js +0 -29
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstLiteralType.d.ts +0 -12
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstLiteralType.js +0 -43
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstTermType.d.ts +0 -14
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstTermType.js +0 -21
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstType.d.ts +0 -15
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstType.js +0 -60
package/dist/input/generated.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { DataFactory as dataFactory } from "n3";
|
|
1
|
+
import { StoreFactory as _DatasetFactory, DataFactory as dataFactory, } from "n3";
|
|
2
|
+
const datasetFactory = new _DatasetFactory();
|
|
2
3
|
import * as purify from "purify-ts";
|
|
3
4
|
import * as rdfjsResource from "rdfjs-resource";
|
|
4
5
|
import { PropertyPath } from "./PropertyPath.js";
|
|
@@ -37,95 +38,150 @@ export var BaseShaclCoreShapeStatic;
|
|
|
37
38
|
$Identifier.fromString = fromString;
|
|
38
39
|
$Identifier.toString = rdfjsResource.Resource.Identifier.toString;
|
|
39
40
|
})($Identifier = BaseShaclCoreShapeStatic.$Identifier || (BaseShaclCoreShapeStatic.$Identifier = {}));
|
|
40
|
-
function $
|
|
41
|
+
function $fromRdf(resource, options) {
|
|
42
|
+
let { ignoreRdfType = false, languageIn, objectSet, ...context } = options ?? {};
|
|
43
|
+
if (!objectSet) {
|
|
44
|
+
objectSet = new $RdfjsDatasetObjectSet({ dataset: resource.dataset });
|
|
45
|
+
}
|
|
46
|
+
return ShaclCoreNodeShapeStatic.$fromRdf(resource, {
|
|
47
|
+
...context,
|
|
48
|
+
ignoreRdfType: false,
|
|
49
|
+
objectSet,
|
|
50
|
+
}).altLazy(() => ShaclCorePropertyShapeStatic.$fromRdf(resource, {
|
|
51
|
+
...context,
|
|
52
|
+
ignoreRdfType: false,
|
|
53
|
+
objectSet,
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
BaseShaclCoreShapeStatic.$fromRdf = $fromRdf;
|
|
57
|
+
function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, languageIn: $languageIn, objectSet: $objectSet, resource: $resource,
|
|
41
58
|
// @ts-ignore
|
|
42
59
|
...$context }) {
|
|
43
60
|
const $identifier = $resource.identifier;
|
|
44
|
-
const _andEither = purify.Either.
|
|
45
|
-
.values
|
|
46
|
-
.
|
|
47
|
-
|
|
48
|
-
.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
.
|
|
52
|
-
.
|
|
53
|
-
.
|
|
61
|
+
const _andEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.and["identifier"], { unique: true }))
|
|
62
|
+
.chain((values) => values.chainMap((value) => value.toList()))
|
|
63
|
+
.chain((valueLists) => valueLists.chainMap((valueList) => purify.Either.of(rdfjsResource.Resource.Values.fromArray({
|
|
64
|
+
objects: valueList,
|
|
65
|
+
predicate: BaseShaclCoreShapeStatic.$properties.and["identifier"],
|
|
66
|
+
subject: $resource,
|
|
67
|
+
})).chain((values) => values.chainMap((value) => value.toIdentifier()))))
|
|
68
|
+
.map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
|
|
69
|
+
.map((values) => values.toArray())
|
|
70
|
+
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
71
|
+
object: valuesArray,
|
|
72
|
+
predicate: BaseShaclCoreShapeStatic.$properties.and["identifier"],
|
|
73
|
+
subject: $resource,
|
|
74
|
+
}))
|
|
75
|
+
.chain((values) => values.head());
|
|
54
76
|
if (_andEither.isLeft()) {
|
|
55
77
|
return _andEither;
|
|
56
78
|
}
|
|
57
79
|
const and = _andEither.unsafeCoerce();
|
|
58
|
-
const _classesEither = purify.Either.
|
|
59
|
-
.values
|
|
60
|
-
.map((
|
|
61
|
-
.
|
|
62
|
-
|
|
63
|
-
|
|
80
|
+
const _classesEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.classes["identifier"], { unique: true }))
|
|
81
|
+
.chain((values) => values.chainMap((value) => value.toIri()))
|
|
82
|
+
.map((values) => values.toArray())
|
|
83
|
+
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
84
|
+
object: valuesArray,
|
|
85
|
+
predicate: BaseShaclCoreShapeStatic.$properties.classes["identifier"],
|
|
86
|
+
subject: $resource,
|
|
87
|
+
}))
|
|
88
|
+
.chain((values) => values.head());
|
|
64
89
|
if (_classesEither.isLeft()) {
|
|
65
90
|
return _classesEither;
|
|
66
91
|
}
|
|
67
92
|
const classes = _classesEither.unsafeCoerce();
|
|
68
|
-
const _commentsEither = purify.Either.
|
|
69
|
-
.values
|
|
70
|
-
.
|
|
71
|
-
.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
93
|
+
const _commentsEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.comments["identifier"], { unique: true }))
|
|
94
|
+
.chain((values) => {
|
|
95
|
+
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
96
|
+
if (literalValuesEither.isLeft()) {
|
|
97
|
+
return literalValuesEither;
|
|
98
|
+
}
|
|
99
|
+
const literalValues = literalValuesEither.unsafeCoerce();
|
|
100
|
+
const nonUniqueLanguageIn = $languageIn ?? [];
|
|
101
|
+
if (nonUniqueLanguageIn.length === 0) {
|
|
102
|
+
return purify.Either.of(literalValues);
|
|
103
|
+
}
|
|
104
|
+
let uniqueLanguageIn;
|
|
105
|
+
if (nonUniqueLanguageIn.length === 1) {
|
|
106
|
+
uniqueLanguageIn = [nonUniqueLanguageIn[0]];
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
uniqueLanguageIn = [];
|
|
110
|
+
for (const languageIn of nonUniqueLanguageIn) {
|
|
111
|
+
if (uniqueLanguageIn.indexOf(languageIn) === -1) {
|
|
112
|
+
uniqueLanguageIn.push(languageIn);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
// Return all literals for the first languageIn, then all literals for the second languageIn, etc.
|
|
117
|
+
// Within a languageIn the literals may be in any order.
|
|
118
|
+
let filteredLiteralValues;
|
|
119
|
+
for (const languageIn of uniqueLanguageIn) {
|
|
120
|
+
if (!filteredLiteralValues) {
|
|
121
|
+
filteredLiteralValues = literalValues.filter((value) => value.language === languageIn);
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
125
|
+
.filter((value) => value.language === languageIn)
|
|
126
|
+
.toArray());
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return purify.Either.of(filteredLiteralValues);
|
|
82
130
|
})
|
|
83
|
-
.
|
|
84
|
-
.
|
|
131
|
+
.map((values) => values.toArray())
|
|
132
|
+
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
133
|
+
object: valuesArray,
|
|
134
|
+
predicate: BaseShaclCoreShapeStatic.$properties.comments["identifier"],
|
|
135
|
+
subject: $resource,
|
|
136
|
+
}))
|
|
137
|
+
.chain((values) => values.head());
|
|
85
138
|
if (_commentsEither.isLeft()) {
|
|
86
139
|
return _commentsEither;
|
|
87
140
|
}
|
|
88
141
|
const comments = _commentsEither.unsafeCoerce();
|
|
89
|
-
const _datatypeEither = $resource
|
|
90
|
-
.values
|
|
91
|
-
.
|
|
92
|
-
.
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
142
|
+
const _datatypeEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.datatype["identifier"], { unique: true }))
|
|
143
|
+
.chain((values) => values.chainMap((value) => value.toIri()))
|
|
144
|
+
.map((values) => values.length > 0
|
|
145
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
146
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
147
|
+
object: purify.Maybe.empty(),
|
|
148
|
+
predicate: BaseShaclCoreShapeStatic.$properties.datatype["identifier"],
|
|
149
|
+
subject: $resource,
|
|
150
|
+
}))
|
|
151
|
+
.chain((values) => values.head());
|
|
97
152
|
if (_datatypeEither.isLeft()) {
|
|
98
153
|
return _datatypeEither;
|
|
99
154
|
}
|
|
100
155
|
const datatype = _datatypeEither.unsafeCoerce();
|
|
101
|
-
const _deactivatedEither = $resource
|
|
102
|
-
.values
|
|
103
|
-
.
|
|
104
|
-
.
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
156
|
+
const _deactivatedEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.deactivated["identifier"], { unique: true }))
|
|
157
|
+
.chain((values) => values.chainMap((value) => value.toBoolean()))
|
|
158
|
+
.map((values) => values.length > 0
|
|
159
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
160
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
161
|
+
object: purify.Maybe.empty(),
|
|
162
|
+
predicate: BaseShaclCoreShapeStatic.$properties.deactivated["identifier"],
|
|
163
|
+
subject: $resource,
|
|
164
|
+
}))
|
|
165
|
+
.chain((values) => values.head());
|
|
109
166
|
if (_deactivatedEither.isLeft()) {
|
|
110
167
|
return _deactivatedEither;
|
|
111
168
|
}
|
|
112
169
|
const deactivated = _deactivatedEither.unsafeCoerce();
|
|
113
|
-
const _flagsEither = purify.Either.
|
|
114
|
-
.values
|
|
115
|
-
.map((
|
|
116
|
-
.
|
|
117
|
-
|
|
118
|
-
|
|
170
|
+
const _flagsEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.flags["identifier"], { unique: true }))
|
|
171
|
+
.chain((values) => values.chainMap((value) => value.toString()))
|
|
172
|
+
.map((values) => values.toArray())
|
|
173
|
+
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
174
|
+
object: valuesArray,
|
|
175
|
+
predicate: BaseShaclCoreShapeStatic.$properties.flags["identifier"],
|
|
176
|
+
subject: $resource,
|
|
177
|
+
}))
|
|
178
|
+
.chain((values) => values.head());
|
|
119
179
|
if (_flagsEither.isLeft()) {
|
|
120
180
|
return _flagsEither;
|
|
121
181
|
}
|
|
122
182
|
const flags = _flagsEither.unsafeCoerce();
|
|
123
|
-
const _hasValuesEither = purify.Either.
|
|
124
|
-
.values(
|
|
125
|
-
.map((item) => item
|
|
126
|
-
.toValues()
|
|
127
|
-
.head()
|
|
128
|
-
.chain((value) => purify.Either.of(value.toTerm()).chain((term) => {
|
|
183
|
+
const _hasValuesEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.hasValues["identifier"], { unique: true }))
|
|
184
|
+
.chain((values) => values.chainMap((value) => purify.Either.of(value.toTerm()).chain((term) => {
|
|
129
185
|
switch (term.termType) {
|
|
130
186
|
case "Literal":
|
|
131
187
|
case "NamedNode":
|
|
@@ -138,19 +194,25 @@ export var BaseShaclCoreShapeStatic;
|
|
|
138
194
|
predicate: BaseShaclCoreShapeStatic.$properties.hasValues["identifier"],
|
|
139
195
|
}));
|
|
140
196
|
}
|
|
141
|
-
})))
|
|
197
|
+
})))
|
|
198
|
+
.map((values) => values.toArray())
|
|
199
|
+
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
200
|
+
object: valuesArray,
|
|
201
|
+
predicate: BaseShaclCoreShapeStatic.$properties.hasValues["identifier"],
|
|
202
|
+
subject: $resource,
|
|
203
|
+
}))
|
|
204
|
+
.chain((values) => values.head());
|
|
142
205
|
if (_hasValuesEither.isLeft()) {
|
|
143
206
|
return _hasValuesEither;
|
|
144
207
|
}
|
|
145
208
|
const hasValues = _hasValuesEither.unsafeCoerce();
|
|
146
|
-
const _in_Either = $resource
|
|
147
|
-
.values
|
|
148
|
-
.
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
.chain((value) => purify.Either.of(value.toTerm()).chain((term) => {
|
|
209
|
+
const _in_Either = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.in_["identifier"], { unique: true }))
|
|
210
|
+
.chain((values) => values.chainMap((value) => value.toList()))
|
|
211
|
+
.chain((valueLists) => valueLists.chainMap((valueList) => purify.Either.of(rdfjsResource.Resource.Values.fromArray({
|
|
212
|
+
objects: valueList,
|
|
213
|
+
predicate: BaseShaclCoreShapeStatic.$properties.in_["identifier"],
|
|
214
|
+
subject: $resource,
|
|
215
|
+
})).chain((values) => values.chainMap((value) => purify.Either.of(value.toTerm()).chain((term) => {
|
|
154
216
|
switch (term.termType) {
|
|
155
217
|
case "Literal":
|
|
156
218
|
case "NamedNode":
|
|
@@ -164,207 +226,368 @@ export var BaseShaclCoreShapeStatic;
|
|
|
164
226
|
}));
|
|
165
227
|
}
|
|
166
228
|
})))))
|
|
167
|
-
.map((
|
|
168
|
-
.
|
|
169
|
-
?
|
|
170
|
-
:
|
|
229
|
+
.map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
|
|
230
|
+
.map((values) => values.length > 0
|
|
231
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
232
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
233
|
+
object: purify.Maybe.empty(),
|
|
234
|
+
predicate: BaseShaclCoreShapeStatic.$properties.in_["identifier"],
|
|
235
|
+
subject: $resource,
|
|
236
|
+
}))
|
|
237
|
+
.chain((values) => values.head());
|
|
171
238
|
if (_in_Either.isLeft()) {
|
|
172
239
|
return _in_Either;
|
|
173
240
|
}
|
|
174
241
|
const in_ = _in_Either.unsafeCoerce();
|
|
175
|
-
const _isDefinedByEither = $resource
|
|
176
|
-
.values
|
|
177
|
-
.
|
|
178
|
-
.
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
242
|
+
const _isDefinedByEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.isDefinedBy["identifier"], { unique: true }))
|
|
243
|
+
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
244
|
+
.map((values) => values.length > 0
|
|
245
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
246
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
247
|
+
object: purify.Maybe.empty(),
|
|
248
|
+
predicate: BaseShaclCoreShapeStatic.$properties.isDefinedBy["identifier"],
|
|
249
|
+
subject: $resource,
|
|
250
|
+
}))
|
|
251
|
+
.chain((values) => values.head());
|
|
183
252
|
if (_isDefinedByEither.isLeft()) {
|
|
184
253
|
return _isDefinedByEither;
|
|
185
254
|
}
|
|
186
255
|
const isDefinedBy = _isDefinedByEither.unsafeCoerce();
|
|
187
|
-
const _labelsEither = purify.Either.
|
|
188
|
-
.values
|
|
189
|
-
.
|
|
190
|
-
.
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
256
|
+
const _labelsEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.labels["identifier"], { unique: true }))
|
|
257
|
+
.chain((values) => {
|
|
258
|
+
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
259
|
+
if (literalValuesEither.isLeft()) {
|
|
260
|
+
return literalValuesEither;
|
|
261
|
+
}
|
|
262
|
+
const literalValues = literalValuesEither.unsafeCoerce();
|
|
263
|
+
const nonUniqueLanguageIn = $languageIn ?? [];
|
|
264
|
+
if (nonUniqueLanguageIn.length === 0) {
|
|
265
|
+
return purify.Either.of(literalValues);
|
|
266
|
+
}
|
|
267
|
+
let uniqueLanguageIn;
|
|
268
|
+
if (nonUniqueLanguageIn.length === 1) {
|
|
269
|
+
uniqueLanguageIn = [nonUniqueLanguageIn[0]];
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
uniqueLanguageIn = [];
|
|
273
|
+
for (const languageIn of nonUniqueLanguageIn) {
|
|
274
|
+
if (uniqueLanguageIn.indexOf(languageIn) === -1) {
|
|
275
|
+
uniqueLanguageIn.push(languageIn);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
// Return all literals for the first languageIn, then all literals for the second languageIn, etc.
|
|
280
|
+
// Within a languageIn the literals may be in any order.
|
|
281
|
+
let filteredLiteralValues;
|
|
282
|
+
for (const languageIn of uniqueLanguageIn) {
|
|
283
|
+
if (!filteredLiteralValues) {
|
|
284
|
+
filteredLiteralValues = literalValues.filter((value) => value.language === languageIn);
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
288
|
+
.filter((value) => value.language === languageIn)
|
|
289
|
+
.toArray());
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return purify.Either.of(filteredLiteralValues);
|
|
201
293
|
})
|
|
202
|
-
.
|
|
203
|
-
.
|
|
294
|
+
.map((values) => values.toArray())
|
|
295
|
+
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
296
|
+
object: valuesArray,
|
|
297
|
+
predicate: BaseShaclCoreShapeStatic.$properties.labels["identifier"],
|
|
298
|
+
subject: $resource,
|
|
299
|
+
}))
|
|
300
|
+
.chain((values) => values.head());
|
|
204
301
|
if (_labelsEither.isLeft()) {
|
|
205
302
|
return _labelsEither;
|
|
206
303
|
}
|
|
207
304
|
const labels = _labelsEither.unsafeCoerce();
|
|
208
|
-
const _languageInEither = $resource
|
|
209
|
-
.values
|
|
210
|
-
.
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
.
|
|
216
|
-
.map((
|
|
217
|
-
.
|
|
218
|
-
|
|
219
|
-
|
|
305
|
+
const _languageInEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.languageIn["identifier"], { unique: true }))
|
|
306
|
+
.chain((values) => values.chainMap((value) => value.toList()))
|
|
307
|
+
.chain((valueLists) => valueLists.chainMap((valueList) => purify.Either.of(rdfjsResource.Resource.Values.fromArray({
|
|
308
|
+
objects: valueList,
|
|
309
|
+
predicate: BaseShaclCoreShapeStatic.$properties.languageIn["identifier"],
|
|
310
|
+
subject: $resource,
|
|
311
|
+
})).chain((values) => values.chainMap((value) => value.toString()))))
|
|
312
|
+
.map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
|
|
313
|
+
.map((values) => values.length > 0
|
|
314
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
315
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
316
|
+
object: purify.Maybe.empty(),
|
|
317
|
+
predicate: BaseShaclCoreShapeStatic.$properties.languageIn["identifier"],
|
|
318
|
+
subject: $resource,
|
|
319
|
+
}))
|
|
320
|
+
.chain((values) => values.head());
|
|
220
321
|
if (_languageInEither.isLeft()) {
|
|
221
322
|
return _languageInEither;
|
|
222
323
|
}
|
|
223
324
|
const languageIn = _languageInEither.unsafeCoerce();
|
|
224
|
-
const _maxCountEither = $resource
|
|
225
|
-
.values
|
|
226
|
-
.
|
|
227
|
-
.
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
325
|
+
const _maxCountEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.maxCount["identifier"], { unique: true }))
|
|
326
|
+
.chain((values) => values.chainMap((value) => value.toNumber()))
|
|
327
|
+
.map((values) => values.length > 0
|
|
328
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
329
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
330
|
+
object: purify.Maybe.empty(),
|
|
331
|
+
predicate: BaseShaclCoreShapeStatic.$properties.maxCount["identifier"],
|
|
332
|
+
subject: $resource,
|
|
333
|
+
}))
|
|
334
|
+
.chain((values) => values.head());
|
|
232
335
|
if (_maxCountEither.isLeft()) {
|
|
233
336
|
return _maxCountEither;
|
|
234
337
|
}
|
|
235
338
|
const maxCount = _maxCountEither.unsafeCoerce();
|
|
236
|
-
const _maxExclusiveEither = $resource
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
339
|
+
const _maxExclusiveEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.maxExclusive["identifier"], {
|
|
340
|
+
unique: true,
|
|
341
|
+
}))
|
|
342
|
+
.chain((values) => {
|
|
343
|
+
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
344
|
+
if (literalValuesEither.isLeft()) {
|
|
345
|
+
return literalValuesEither;
|
|
346
|
+
}
|
|
347
|
+
const literalValues = literalValuesEither.unsafeCoerce();
|
|
348
|
+
const nonUniqueLanguageIn = $languageIn ?? [];
|
|
349
|
+
if (nonUniqueLanguageIn.length === 0) {
|
|
350
|
+
return purify.Either.of(literalValues);
|
|
351
|
+
}
|
|
352
|
+
let uniqueLanguageIn;
|
|
353
|
+
if (nonUniqueLanguageIn.length === 1) {
|
|
354
|
+
uniqueLanguageIn = [nonUniqueLanguageIn[0]];
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
uniqueLanguageIn = [];
|
|
358
|
+
for (const languageIn of nonUniqueLanguageIn) {
|
|
359
|
+
if (uniqueLanguageIn.indexOf(languageIn) === -1) {
|
|
360
|
+
uniqueLanguageIn.push(languageIn);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
// Return all literals for the first languageIn, then all literals for the second languageIn, etc.
|
|
365
|
+
// Within a languageIn the literals may be in any order.
|
|
366
|
+
let filteredLiteralValues;
|
|
367
|
+
for (const languageIn of uniqueLanguageIn) {
|
|
368
|
+
if (!filteredLiteralValues) {
|
|
369
|
+
filteredLiteralValues = literalValues.filter((value) => value.language === languageIn);
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
373
|
+
.filter((value) => value.language === languageIn)
|
|
374
|
+
.toArray());
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
return purify.Either.of(filteredLiteralValues);
|
|
248
378
|
})
|
|
249
|
-
.
|
|
250
|
-
.
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
379
|
+
.map((values) => values.length > 0
|
|
380
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
381
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
382
|
+
object: purify.Maybe.empty(),
|
|
383
|
+
predicate: BaseShaclCoreShapeStatic.$properties.maxExclusive["identifier"],
|
|
384
|
+
subject: $resource,
|
|
385
|
+
}))
|
|
386
|
+
.chain((values) => values.head());
|
|
255
387
|
if (_maxExclusiveEither.isLeft()) {
|
|
256
388
|
return _maxExclusiveEither;
|
|
257
389
|
}
|
|
258
390
|
const maxExclusive = _maxExclusiveEither.unsafeCoerce();
|
|
259
|
-
const _maxInclusiveEither = $resource
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
391
|
+
const _maxInclusiveEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.maxInclusive["identifier"], {
|
|
392
|
+
unique: true,
|
|
393
|
+
}))
|
|
394
|
+
.chain((values) => {
|
|
395
|
+
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
396
|
+
if (literalValuesEither.isLeft()) {
|
|
397
|
+
return literalValuesEither;
|
|
398
|
+
}
|
|
399
|
+
const literalValues = literalValuesEither.unsafeCoerce();
|
|
400
|
+
const nonUniqueLanguageIn = $languageIn ?? [];
|
|
401
|
+
if (nonUniqueLanguageIn.length === 0) {
|
|
402
|
+
return purify.Either.of(literalValues);
|
|
403
|
+
}
|
|
404
|
+
let uniqueLanguageIn;
|
|
405
|
+
if (nonUniqueLanguageIn.length === 1) {
|
|
406
|
+
uniqueLanguageIn = [nonUniqueLanguageIn[0]];
|
|
407
|
+
}
|
|
408
|
+
else {
|
|
409
|
+
uniqueLanguageIn = [];
|
|
410
|
+
for (const languageIn of nonUniqueLanguageIn) {
|
|
411
|
+
if (uniqueLanguageIn.indexOf(languageIn) === -1) {
|
|
412
|
+
uniqueLanguageIn.push(languageIn);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
// Return all literals for the first languageIn, then all literals for the second languageIn, etc.
|
|
417
|
+
// Within a languageIn the literals may be in any order.
|
|
418
|
+
let filteredLiteralValues;
|
|
419
|
+
for (const languageIn of uniqueLanguageIn) {
|
|
420
|
+
if (!filteredLiteralValues) {
|
|
421
|
+
filteredLiteralValues = literalValues.filter((value) => value.language === languageIn);
|
|
422
|
+
}
|
|
423
|
+
else {
|
|
424
|
+
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
425
|
+
.filter((value) => value.language === languageIn)
|
|
426
|
+
.toArray());
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
return purify.Either.of(filteredLiteralValues);
|
|
271
430
|
})
|
|
272
|
-
.
|
|
273
|
-
.
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
431
|
+
.map((values) => values.length > 0
|
|
432
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
433
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
434
|
+
object: purify.Maybe.empty(),
|
|
435
|
+
predicate: BaseShaclCoreShapeStatic.$properties.maxInclusive["identifier"],
|
|
436
|
+
subject: $resource,
|
|
437
|
+
}))
|
|
438
|
+
.chain((values) => values.head());
|
|
278
439
|
if (_maxInclusiveEither.isLeft()) {
|
|
279
440
|
return _maxInclusiveEither;
|
|
280
441
|
}
|
|
281
442
|
const maxInclusive = _maxInclusiveEither.unsafeCoerce();
|
|
282
|
-
const _maxLengthEither = $resource
|
|
283
|
-
.values
|
|
284
|
-
.
|
|
285
|
-
.
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
443
|
+
const _maxLengthEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.maxLength["identifier"], { unique: true }))
|
|
444
|
+
.chain((values) => values.chainMap((value) => value.toNumber()))
|
|
445
|
+
.map((values) => values.length > 0
|
|
446
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
447
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
448
|
+
object: purify.Maybe.empty(),
|
|
449
|
+
predicate: BaseShaclCoreShapeStatic.$properties.maxLength["identifier"],
|
|
450
|
+
subject: $resource,
|
|
451
|
+
}))
|
|
452
|
+
.chain((values) => values.head());
|
|
290
453
|
if (_maxLengthEither.isLeft()) {
|
|
291
454
|
return _maxLengthEither;
|
|
292
455
|
}
|
|
293
456
|
const maxLength = _maxLengthEither.unsafeCoerce();
|
|
294
|
-
const _minCountEither = $resource
|
|
295
|
-
.values
|
|
296
|
-
.
|
|
297
|
-
.
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
457
|
+
const _minCountEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.minCount["identifier"], { unique: true }))
|
|
458
|
+
.chain((values) => values.chainMap((value) => value.toNumber()))
|
|
459
|
+
.map((values) => values.length > 0
|
|
460
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
461
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
462
|
+
object: purify.Maybe.empty(),
|
|
463
|
+
predicate: BaseShaclCoreShapeStatic.$properties.minCount["identifier"],
|
|
464
|
+
subject: $resource,
|
|
465
|
+
}))
|
|
466
|
+
.chain((values) => values.head());
|
|
302
467
|
if (_minCountEither.isLeft()) {
|
|
303
468
|
return _minCountEither;
|
|
304
469
|
}
|
|
305
470
|
const minCount = _minCountEither.unsafeCoerce();
|
|
306
|
-
const _minExclusiveEither = $resource
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
471
|
+
const _minExclusiveEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.minExclusive["identifier"], {
|
|
472
|
+
unique: true,
|
|
473
|
+
}))
|
|
474
|
+
.chain((values) => {
|
|
475
|
+
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
476
|
+
if (literalValuesEither.isLeft()) {
|
|
477
|
+
return literalValuesEither;
|
|
478
|
+
}
|
|
479
|
+
const literalValues = literalValuesEither.unsafeCoerce();
|
|
480
|
+
const nonUniqueLanguageIn = $languageIn ?? [];
|
|
481
|
+
if (nonUniqueLanguageIn.length === 0) {
|
|
482
|
+
return purify.Either.of(literalValues);
|
|
483
|
+
}
|
|
484
|
+
let uniqueLanguageIn;
|
|
485
|
+
if (nonUniqueLanguageIn.length === 1) {
|
|
486
|
+
uniqueLanguageIn = [nonUniqueLanguageIn[0]];
|
|
487
|
+
}
|
|
488
|
+
else {
|
|
489
|
+
uniqueLanguageIn = [];
|
|
490
|
+
for (const languageIn of nonUniqueLanguageIn) {
|
|
491
|
+
if (uniqueLanguageIn.indexOf(languageIn) === -1) {
|
|
492
|
+
uniqueLanguageIn.push(languageIn);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
// Return all literals for the first languageIn, then all literals for the second languageIn, etc.
|
|
497
|
+
// Within a languageIn the literals may be in any order.
|
|
498
|
+
let filteredLiteralValues;
|
|
499
|
+
for (const languageIn of uniqueLanguageIn) {
|
|
500
|
+
if (!filteredLiteralValues) {
|
|
501
|
+
filteredLiteralValues = literalValues.filter((value) => value.language === languageIn);
|
|
502
|
+
}
|
|
503
|
+
else {
|
|
504
|
+
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
505
|
+
.filter((value) => value.language === languageIn)
|
|
506
|
+
.toArray());
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
return purify.Either.of(filteredLiteralValues);
|
|
318
510
|
})
|
|
319
|
-
.
|
|
320
|
-
.
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
511
|
+
.map((values) => values.length > 0
|
|
512
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
513
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
514
|
+
object: purify.Maybe.empty(),
|
|
515
|
+
predicate: BaseShaclCoreShapeStatic.$properties.minExclusive["identifier"],
|
|
516
|
+
subject: $resource,
|
|
517
|
+
}))
|
|
518
|
+
.chain((values) => values.head());
|
|
325
519
|
if (_minExclusiveEither.isLeft()) {
|
|
326
520
|
return _minExclusiveEither;
|
|
327
521
|
}
|
|
328
522
|
const minExclusive = _minExclusiveEither.unsafeCoerce();
|
|
329
|
-
const _minInclusiveEither = $resource
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
523
|
+
const _minInclusiveEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.minInclusive["identifier"], {
|
|
524
|
+
unique: true,
|
|
525
|
+
}))
|
|
526
|
+
.chain((values) => {
|
|
527
|
+
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
528
|
+
if (literalValuesEither.isLeft()) {
|
|
529
|
+
return literalValuesEither;
|
|
530
|
+
}
|
|
531
|
+
const literalValues = literalValuesEither.unsafeCoerce();
|
|
532
|
+
const nonUniqueLanguageIn = $languageIn ?? [];
|
|
533
|
+
if (nonUniqueLanguageIn.length === 0) {
|
|
534
|
+
return purify.Either.of(literalValues);
|
|
535
|
+
}
|
|
536
|
+
let uniqueLanguageIn;
|
|
537
|
+
if (nonUniqueLanguageIn.length === 1) {
|
|
538
|
+
uniqueLanguageIn = [nonUniqueLanguageIn[0]];
|
|
539
|
+
}
|
|
540
|
+
else {
|
|
541
|
+
uniqueLanguageIn = [];
|
|
542
|
+
for (const languageIn of nonUniqueLanguageIn) {
|
|
543
|
+
if (uniqueLanguageIn.indexOf(languageIn) === -1) {
|
|
544
|
+
uniqueLanguageIn.push(languageIn);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
// Return all literals for the first languageIn, then all literals for the second languageIn, etc.
|
|
549
|
+
// Within a languageIn the literals may be in any order.
|
|
550
|
+
let filteredLiteralValues;
|
|
551
|
+
for (const languageIn of uniqueLanguageIn) {
|
|
552
|
+
if (!filteredLiteralValues) {
|
|
553
|
+
filteredLiteralValues = literalValues.filter((value) => value.language === languageIn);
|
|
554
|
+
}
|
|
555
|
+
else {
|
|
556
|
+
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
557
|
+
.filter((value) => value.language === languageIn)
|
|
558
|
+
.toArray());
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
return purify.Either.of(filteredLiteralValues);
|
|
341
562
|
})
|
|
342
|
-
.
|
|
343
|
-
.
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
563
|
+
.map((values) => values.length > 0
|
|
564
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
565
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
566
|
+
object: purify.Maybe.empty(),
|
|
567
|
+
predicate: BaseShaclCoreShapeStatic.$properties.minInclusive["identifier"],
|
|
568
|
+
subject: $resource,
|
|
569
|
+
}))
|
|
570
|
+
.chain((values) => values.head());
|
|
348
571
|
if (_minInclusiveEither.isLeft()) {
|
|
349
572
|
return _minInclusiveEither;
|
|
350
573
|
}
|
|
351
574
|
const minInclusive = _minInclusiveEither.unsafeCoerce();
|
|
352
|
-
const _minLengthEither = $resource
|
|
353
|
-
.values
|
|
354
|
-
.
|
|
355
|
-
.
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
575
|
+
const _minLengthEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.minLength["identifier"], { unique: true }))
|
|
576
|
+
.chain((values) => values.chainMap((value) => value.toNumber()))
|
|
577
|
+
.map((values) => values.length > 0
|
|
578
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
579
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
580
|
+
object: purify.Maybe.empty(),
|
|
581
|
+
predicate: BaseShaclCoreShapeStatic.$properties.minLength["identifier"],
|
|
582
|
+
subject: $resource,
|
|
583
|
+
}))
|
|
584
|
+
.chain((values) => values.head());
|
|
360
585
|
if (_minLengthEither.isLeft()) {
|
|
361
586
|
return _minLengthEither;
|
|
362
587
|
}
|
|
363
588
|
const minLength = _minLengthEither.unsafeCoerce();
|
|
364
|
-
const _nodeKindEither = $resource
|
|
365
|
-
.values(
|
|
366
|
-
.head()
|
|
367
|
-
.chain((value) => value.toIri().chain((iri) => {
|
|
589
|
+
const _nodeKindEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.nodeKind["identifier"], { unique: true }))
|
|
590
|
+
.chain((values) => values.chainMap((value) => value.toIri().chain((iri) => {
|
|
368
591
|
switch (iri.value) {
|
|
369
592
|
case "http://www.w3.org/ns/shacl#BlankNode":
|
|
370
593
|
return purify.Either.of(iri);
|
|
@@ -386,69 +609,92 @@ export var BaseShaclCoreShapeStatic;
|
|
|
386
609
|
predicate: BaseShaclCoreShapeStatic.$properties.nodeKind["identifier"],
|
|
387
610
|
}));
|
|
388
611
|
}
|
|
389
|
-
}))
|
|
390
|
-
.map((
|
|
391
|
-
.
|
|
392
|
-
|
|
393
|
-
|
|
612
|
+
})))
|
|
613
|
+
.map((values) => values.length > 0
|
|
614
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
615
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
616
|
+
object: purify.Maybe.empty(),
|
|
617
|
+
predicate: BaseShaclCoreShapeStatic.$properties.nodeKind["identifier"],
|
|
618
|
+
subject: $resource,
|
|
619
|
+
}))
|
|
620
|
+
.chain((values) => values.head());
|
|
394
621
|
if (_nodeKindEither.isLeft()) {
|
|
395
622
|
return _nodeKindEither;
|
|
396
623
|
}
|
|
397
624
|
const nodeKind = _nodeKindEither.unsafeCoerce();
|
|
398
|
-
const _nodesEither = purify.Either.
|
|
399
|
-
.values
|
|
400
|
-
.map((
|
|
401
|
-
.
|
|
402
|
-
|
|
403
|
-
|
|
625
|
+
const _nodesEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.nodes["identifier"], { unique: true }))
|
|
626
|
+
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
627
|
+
.map((values) => values.toArray())
|
|
628
|
+
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
629
|
+
object: valuesArray,
|
|
630
|
+
predicate: BaseShaclCoreShapeStatic.$properties.nodes["identifier"],
|
|
631
|
+
subject: $resource,
|
|
632
|
+
}))
|
|
633
|
+
.chain((values) => values.head());
|
|
404
634
|
if (_nodesEither.isLeft()) {
|
|
405
635
|
return _nodesEither;
|
|
406
636
|
}
|
|
407
637
|
const nodes = _nodesEither.unsafeCoerce();
|
|
408
|
-
const _notEither = purify.Either.
|
|
409
|
-
.values
|
|
410
|
-
.map((
|
|
411
|
-
.
|
|
412
|
-
|
|
413
|
-
|
|
638
|
+
const _notEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.not["identifier"], { unique: true }))
|
|
639
|
+
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
640
|
+
.map((values) => values.toArray())
|
|
641
|
+
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
642
|
+
object: valuesArray,
|
|
643
|
+
predicate: BaseShaclCoreShapeStatic.$properties.not["identifier"],
|
|
644
|
+
subject: $resource,
|
|
645
|
+
}))
|
|
646
|
+
.chain((values) => values.head());
|
|
414
647
|
if (_notEither.isLeft()) {
|
|
415
648
|
return _notEither;
|
|
416
649
|
}
|
|
417
650
|
const not = _notEither.unsafeCoerce();
|
|
418
|
-
const _orEither = purify.Either.
|
|
419
|
-
.values
|
|
420
|
-
.
|
|
421
|
-
|
|
422
|
-
.
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
.
|
|
426
|
-
.
|
|
427
|
-
.
|
|
651
|
+
const _orEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.or["identifier"], { unique: true }))
|
|
652
|
+
.chain((values) => values.chainMap((value) => value.toList()))
|
|
653
|
+
.chain((valueLists) => valueLists.chainMap((valueList) => purify.Either.of(rdfjsResource.Resource.Values.fromArray({
|
|
654
|
+
objects: valueList,
|
|
655
|
+
predicate: BaseShaclCoreShapeStatic.$properties.or["identifier"],
|
|
656
|
+
subject: $resource,
|
|
657
|
+
})).chain((values) => values.chainMap((value) => value.toIdentifier()))))
|
|
658
|
+
.map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
|
|
659
|
+
.map((values) => values.toArray())
|
|
660
|
+
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
661
|
+
object: valuesArray,
|
|
662
|
+
predicate: BaseShaclCoreShapeStatic.$properties.or["identifier"],
|
|
663
|
+
subject: $resource,
|
|
664
|
+
}))
|
|
665
|
+
.chain((values) => values.head());
|
|
428
666
|
if (_orEither.isLeft()) {
|
|
429
667
|
return _orEither;
|
|
430
668
|
}
|
|
431
669
|
const or = _orEither.unsafeCoerce();
|
|
432
|
-
const _patternsEither = purify.Either.
|
|
433
|
-
.values
|
|
434
|
-
.map((
|
|
435
|
-
.
|
|
436
|
-
|
|
437
|
-
|
|
670
|
+
const _patternsEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.patterns["identifier"], { unique: true }))
|
|
671
|
+
.chain((values) => values.chainMap((value) => value.toString()))
|
|
672
|
+
.map((values) => values.toArray())
|
|
673
|
+
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
674
|
+
object: valuesArray,
|
|
675
|
+
predicate: BaseShaclCoreShapeStatic.$properties.patterns["identifier"],
|
|
676
|
+
subject: $resource,
|
|
677
|
+
}))
|
|
678
|
+
.chain((values) => values.head());
|
|
438
679
|
if (_patternsEither.isLeft()) {
|
|
439
680
|
return _patternsEither;
|
|
440
681
|
}
|
|
441
682
|
const patterns = _patternsEither.unsafeCoerce();
|
|
442
|
-
const _xoneEither = purify.Either.
|
|
443
|
-
.values
|
|
444
|
-
.
|
|
445
|
-
|
|
446
|
-
.
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
.
|
|
450
|
-
.
|
|
451
|
-
.
|
|
683
|
+
const _xoneEither = purify.Either.of($resource.values(BaseShaclCoreShapeStatic.$properties.xone["identifier"], { unique: true }))
|
|
684
|
+
.chain((values) => values.chainMap((value) => value.toList()))
|
|
685
|
+
.chain((valueLists) => valueLists.chainMap((valueList) => purify.Either.of(rdfjsResource.Resource.Values.fromArray({
|
|
686
|
+
objects: valueList,
|
|
687
|
+
predicate: BaseShaclCoreShapeStatic.$properties.xone["identifier"],
|
|
688
|
+
subject: $resource,
|
|
689
|
+
})).chain((values) => values.chainMap((value) => value.toIdentifier()))))
|
|
690
|
+
.map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
|
|
691
|
+
.map((values) => values.toArray())
|
|
692
|
+
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
693
|
+
object: valuesArray,
|
|
694
|
+
predicate: BaseShaclCoreShapeStatic.$properties.xone["identifier"],
|
|
695
|
+
subject: $resource,
|
|
696
|
+
}))
|
|
697
|
+
.chain((values) => values.head());
|
|
452
698
|
if (_xoneEither.isLeft()) {
|
|
453
699
|
return _xoneEither;
|
|
454
700
|
}
|
|
@@ -483,14 +729,15 @@ export var BaseShaclCoreShapeStatic;
|
|
|
483
729
|
});
|
|
484
730
|
}
|
|
485
731
|
BaseShaclCoreShapeStatic.$propertiesFromRdf = $propertiesFromRdf;
|
|
486
|
-
function $
|
|
487
|
-
const
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
732
|
+
function $toRdf(_baseShaclCoreShape, options) {
|
|
733
|
+
const mutateGraph = options?.mutateGraph;
|
|
734
|
+
const resourceSet = options?.resourceSet ??
|
|
735
|
+
new rdfjsResource.MutableResourceSet({
|
|
736
|
+
dataFactory,
|
|
737
|
+
dataset: datasetFactory.dataset(),
|
|
738
|
+
});
|
|
739
|
+
const resource = resourceSet.mutableResource(_baseShaclCoreShape.$identifier, { mutateGraph });
|
|
740
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.and["identifier"], _baseShaclCoreShape.and.map((item) => item.length > 0
|
|
494
741
|
? item.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
495
742
|
if (itemIndex === 0) {
|
|
496
743
|
currentSubListResource = listResource;
|
|
@@ -510,13 +757,13 @@ export var BaseShaclCoreShapeStatic;
|
|
|
510
757
|
listResource: resourceSet.mutableResource(dataFactory.blankNode(), { mutateGraph }),
|
|
511
758
|
}).listResource.identifier
|
|
512
759
|
: $RdfVocabularies.rdf.nil));
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
760
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.classes["identifier"], _baseShaclCoreShape.classes.map((item) => item));
|
|
761
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.comments["identifier"], _baseShaclCoreShape.comments.map((item) => item));
|
|
762
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.datatype["identifier"], _baseShaclCoreShape.datatype);
|
|
763
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.deactivated["identifier"], _baseShaclCoreShape.deactivated);
|
|
764
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.flags["identifier"], _baseShaclCoreShape.flags.map((item) => item));
|
|
765
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.hasValues["identifier"], _baseShaclCoreShape.hasValues.map((item) => item));
|
|
766
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.in_["identifier"], _baseShaclCoreShape.in_.map((value) => value.length > 0
|
|
520
767
|
? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
521
768
|
if (itemIndex === 0) {
|
|
522
769
|
currentSubListResource = listResource;
|
|
@@ -536,9 +783,9 @@ export var BaseShaclCoreShapeStatic;
|
|
|
536
783
|
listResource: resourceSet.mutableResource(dataFactory.blankNode(), { mutateGraph }),
|
|
537
784
|
}).listResource.identifier
|
|
538
785
|
: $RdfVocabularies.rdf.nil));
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
786
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.isDefinedBy["identifier"], _baseShaclCoreShape.isDefinedBy);
|
|
787
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.labels["identifier"], _baseShaclCoreShape.labels.map((item) => item));
|
|
788
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.languageIn["identifier"], _baseShaclCoreShape.languageIn.map((value) => value.length > 0
|
|
542
789
|
? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
543
790
|
if (itemIndex === 0) {
|
|
544
791
|
currentSubListResource = listResource;
|
|
@@ -558,18 +805,18 @@ export var BaseShaclCoreShapeStatic;
|
|
|
558
805
|
listResource: resourceSet.mutableResource(dataFactory.blankNode(), { mutateGraph }),
|
|
559
806
|
}).listResource.identifier
|
|
560
807
|
: $RdfVocabularies.rdf.nil));
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
808
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.maxCount["identifier"], _baseShaclCoreShape.maxCount);
|
|
809
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.maxExclusive["identifier"], _baseShaclCoreShape.maxExclusive);
|
|
810
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.maxInclusive["identifier"], _baseShaclCoreShape.maxInclusive);
|
|
811
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.maxLength["identifier"], _baseShaclCoreShape.maxLength);
|
|
812
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.minCount["identifier"], _baseShaclCoreShape.minCount);
|
|
813
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.minExclusive["identifier"], _baseShaclCoreShape.minExclusive);
|
|
814
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.minInclusive["identifier"], _baseShaclCoreShape.minInclusive);
|
|
815
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.minLength["identifier"], _baseShaclCoreShape.minLength);
|
|
816
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.nodeKind["identifier"], _baseShaclCoreShape.nodeKind);
|
|
817
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.nodes["identifier"], _baseShaclCoreShape.nodes.map((item) => item));
|
|
818
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.not["identifier"], _baseShaclCoreShape.not.map((item) => item));
|
|
819
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.or["identifier"], _baseShaclCoreShape.or.map((item) => item.length > 0
|
|
573
820
|
? item.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
574
821
|
if (itemIndex === 0) {
|
|
575
822
|
currentSubListResource = listResource;
|
|
@@ -589,8 +836,8 @@ export var BaseShaclCoreShapeStatic;
|
|
|
589
836
|
listResource: resourceSet.mutableResource(dataFactory.blankNode(), { mutateGraph }),
|
|
590
837
|
}).listResource.identifier
|
|
591
838
|
: $RdfVocabularies.rdf.nil));
|
|
592
|
-
|
|
593
|
-
|
|
839
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.patterns["identifier"], _baseShaclCoreShape.patterns.map((item) => item));
|
|
840
|
+
resource.add(BaseShaclCoreShapeStatic.$properties.xone["identifier"], _baseShaclCoreShape.xone.map((item) => item.length > 0
|
|
594
841
|
? item.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
595
842
|
if (itemIndex === 0) {
|
|
596
843
|
currentSubListResource = listResource;
|
|
@@ -610,7 +857,7 @@ export var BaseShaclCoreShapeStatic;
|
|
|
610
857
|
listResource: resourceSet.mutableResource(dataFactory.blankNode(), { mutateGraph }),
|
|
611
858
|
}).listResource.identifier
|
|
612
859
|
: $RdfVocabularies.rdf.nil));
|
|
613
|
-
return
|
|
860
|
+
return resource;
|
|
614
861
|
}
|
|
615
862
|
BaseShaclCoreShapeStatic.$toRdf = $toRdf;
|
|
616
863
|
BaseShaclCoreShapeStatic.$properties = {
|
|
@@ -691,13 +938,32 @@ export var ShaclCorePropertyShapeStatic;
|
|
|
691
938
|
(function (ShaclCorePropertyShapeStatic) {
|
|
692
939
|
ShaclCorePropertyShapeStatic.$fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape");
|
|
693
940
|
ShaclCorePropertyShapeStatic.$Identifier = BaseShaclCoreShapeStatic.$Identifier;
|
|
694
|
-
function $
|
|
941
|
+
function $fromRdf(resource, options) {
|
|
942
|
+
let { ignoreRdfType = false, languageIn, objectSet, ...context } = options ?? {};
|
|
943
|
+
if (!objectSet) {
|
|
944
|
+
objectSet = new $RdfjsDatasetObjectSet({ dataset: resource.dataset });
|
|
945
|
+
}
|
|
946
|
+
return ShaclmatePropertyShape.$fromRdf(resource, {
|
|
947
|
+
...context,
|
|
948
|
+
ignoreRdfType: false,
|
|
949
|
+
objectSet,
|
|
950
|
+
}).altLazy(() => ShaclCorePropertyShapeStatic.$propertiesFromRdf({
|
|
951
|
+
...context,
|
|
952
|
+
ignoreRdfType,
|
|
953
|
+
languageIn,
|
|
954
|
+
objectSet,
|
|
955
|
+
resource,
|
|
956
|
+
}));
|
|
957
|
+
}
|
|
958
|
+
ShaclCorePropertyShapeStatic.$fromRdf = $fromRdf;
|
|
959
|
+
function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, languageIn: $languageIn, objectSet: $objectSet, resource: $resource,
|
|
695
960
|
// @ts-ignore
|
|
696
961
|
...$context }) {
|
|
697
962
|
const $super0Either = BaseShaclCoreShapeStatic.$propertiesFromRdf({
|
|
698
963
|
...$context,
|
|
699
964
|
ignoreRdfType: true,
|
|
700
965
|
languageIn: $languageIn,
|
|
966
|
+
objectSet: $objectSet,
|
|
701
967
|
resource: $resource,
|
|
702
968
|
});
|
|
703
969
|
if ($super0Either.isLeft()) {
|
|
@@ -712,10 +978,10 @@ export var ShaclCorePropertyShapeStatic;
|
|
|
712
978
|
}
|
|
713
979
|
const $identifier = $resource.identifier;
|
|
714
980
|
const $type = "ShaclCorePropertyShape";
|
|
715
|
-
const _defaultValueEither = $resource
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
.chain((value) => purify.Either.of(value.toTerm()).chain((term) => {
|
|
981
|
+
const _defaultValueEither = purify.Either.of($resource.values(ShaclCorePropertyShapeStatic.$properties.defaultValue["identifier"], {
|
|
982
|
+
unique: true,
|
|
983
|
+
}))
|
|
984
|
+
.chain((values) => values.chainMap((value) => purify.Either.of(value.toTerm()).chain((term) => {
|
|
719
985
|
switch (term.termType) {
|
|
720
986
|
case "Literal":
|
|
721
987
|
case "NamedNode":
|
|
@@ -728,101 +994,168 @@ export var ShaclCorePropertyShapeStatic;
|
|
|
728
994
|
predicate: ShaclCorePropertyShapeStatic.$properties.defaultValue["identifier"],
|
|
729
995
|
}));
|
|
730
996
|
}
|
|
731
|
-
}))
|
|
732
|
-
.map((
|
|
733
|
-
.
|
|
734
|
-
|
|
735
|
-
|
|
997
|
+
})))
|
|
998
|
+
.map((values) => values.length > 0
|
|
999
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
1000
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
1001
|
+
object: purify.Maybe.empty(),
|
|
1002
|
+
predicate: ShaclCorePropertyShapeStatic.$properties.defaultValue["identifier"],
|
|
1003
|
+
subject: $resource,
|
|
1004
|
+
}))
|
|
1005
|
+
.chain((values) => values.head());
|
|
736
1006
|
if (_defaultValueEither.isLeft()) {
|
|
737
1007
|
return _defaultValueEither;
|
|
738
1008
|
}
|
|
739
1009
|
const defaultValue = _defaultValueEither.unsafeCoerce();
|
|
740
|
-
const _descriptionsEither = purify.Either.
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
.
|
|
744
|
-
.
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
const
|
|
750
|
-
if (
|
|
751
|
-
return
|
|
752
|
-
}
|
|
753
|
-
|
|
1010
|
+
const _descriptionsEither = purify.Either.of($resource.values(ShaclCorePropertyShapeStatic.$properties.descriptions["identifier"], {
|
|
1011
|
+
unique: true,
|
|
1012
|
+
}))
|
|
1013
|
+
.chain((values) => {
|
|
1014
|
+
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
1015
|
+
if (literalValuesEither.isLeft()) {
|
|
1016
|
+
return literalValuesEither;
|
|
1017
|
+
}
|
|
1018
|
+
const literalValues = literalValuesEither.unsafeCoerce();
|
|
1019
|
+
const nonUniqueLanguageIn = $languageIn ?? [];
|
|
1020
|
+
if (nonUniqueLanguageIn.length === 0) {
|
|
1021
|
+
return purify.Either.of(literalValues);
|
|
1022
|
+
}
|
|
1023
|
+
let uniqueLanguageIn;
|
|
1024
|
+
if (nonUniqueLanguageIn.length === 1) {
|
|
1025
|
+
uniqueLanguageIn = [nonUniqueLanguageIn[0]];
|
|
1026
|
+
}
|
|
1027
|
+
else {
|
|
1028
|
+
uniqueLanguageIn = [];
|
|
1029
|
+
for (const languageIn of nonUniqueLanguageIn) {
|
|
1030
|
+
if (uniqueLanguageIn.indexOf(languageIn) === -1) {
|
|
1031
|
+
uniqueLanguageIn.push(languageIn);
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
// Return all literals for the first languageIn, then all literals for the second languageIn, etc.
|
|
1036
|
+
// Within a languageIn the literals may be in any order.
|
|
1037
|
+
let filteredLiteralValues;
|
|
1038
|
+
for (const languageIn of uniqueLanguageIn) {
|
|
1039
|
+
if (!filteredLiteralValues) {
|
|
1040
|
+
filteredLiteralValues = literalValues.filter((value) => value.language === languageIn);
|
|
1041
|
+
}
|
|
1042
|
+
else {
|
|
1043
|
+
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
1044
|
+
.filter((value) => value.language === languageIn)
|
|
1045
|
+
.toArray());
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
return purify.Either.of(filteredLiteralValues);
|
|
754
1049
|
})
|
|
755
|
-
.
|
|
756
|
-
.
|
|
1050
|
+
.map((values) => values.toArray())
|
|
1051
|
+
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
1052
|
+
object: valuesArray,
|
|
1053
|
+
predicate: ShaclCorePropertyShapeStatic.$properties.descriptions["identifier"],
|
|
1054
|
+
subject: $resource,
|
|
1055
|
+
}))
|
|
1056
|
+
.chain((values) => values.head());
|
|
757
1057
|
if (_descriptionsEither.isLeft()) {
|
|
758
1058
|
return _descriptionsEither;
|
|
759
1059
|
}
|
|
760
1060
|
const descriptions = _descriptionsEither.unsafeCoerce();
|
|
761
|
-
const _groupsEither = purify.Either.
|
|
762
|
-
.values
|
|
763
|
-
.map((
|
|
764
|
-
.
|
|
765
|
-
|
|
766
|
-
|
|
1061
|
+
const _groupsEither = purify.Either.of($resource.values(ShaclCorePropertyShapeStatic.$properties.groups["identifier"], { unique: true }))
|
|
1062
|
+
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
1063
|
+
.map((values) => values.toArray())
|
|
1064
|
+
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
1065
|
+
object: valuesArray,
|
|
1066
|
+
predicate: ShaclCorePropertyShapeStatic.$properties.groups["identifier"],
|
|
1067
|
+
subject: $resource,
|
|
1068
|
+
}))
|
|
1069
|
+
.chain((values) => values.head());
|
|
767
1070
|
if (_groupsEither.isLeft()) {
|
|
768
1071
|
return _groupsEither;
|
|
769
1072
|
}
|
|
770
1073
|
const groups = _groupsEither.unsafeCoerce();
|
|
771
|
-
const _namesEither = purify.Either.
|
|
772
|
-
.values
|
|
773
|
-
.
|
|
774
|
-
.
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
1074
|
+
const _namesEither = purify.Either.of($resource.values(ShaclCorePropertyShapeStatic.$properties.names["identifier"], { unique: true }))
|
|
1075
|
+
.chain((values) => {
|
|
1076
|
+
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
1077
|
+
if (literalValuesEither.isLeft()) {
|
|
1078
|
+
return literalValuesEither;
|
|
1079
|
+
}
|
|
1080
|
+
const literalValues = literalValuesEither.unsafeCoerce();
|
|
1081
|
+
const nonUniqueLanguageIn = $languageIn ?? [];
|
|
1082
|
+
if (nonUniqueLanguageIn.length === 0) {
|
|
1083
|
+
return purify.Either.of(literalValues);
|
|
1084
|
+
}
|
|
1085
|
+
let uniqueLanguageIn;
|
|
1086
|
+
if (nonUniqueLanguageIn.length === 1) {
|
|
1087
|
+
uniqueLanguageIn = [nonUniqueLanguageIn[0]];
|
|
1088
|
+
}
|
|
1089
|
+
else {
|
|
1090
|
+
uniqueLanguageIn = [];
|
|
1091
|
+
for (const languageIn of nonUniqueLanguageIn) {
|
|
1092
|
+
if (uniqueLanguageIn.indexOf(languageIn) === -1) {
|
|
1093
|
+
uniqueLanguageIn.push(languageIn);
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
// Return all literals for the first languageIn, then all literals for the second languageIn, etc.
|
|
1098
|
+
// Within a languageIn the literals may be in any order.
|
|
1099
|
+
let filteredLiteralValues;
|
|
1100
|
+
for (const languageIn of uniqueLanguageIn) {
|
|
1101
|
+
if (!filteredLiteralValues) {
|
|
1102
|
+
filteredLiteralValues = literalValues.filter((value) => value.language === languageIn);
|
|
1103
|
+
}
|
|
1104
|
+
else {
|
|
1105
|
+
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
1106
|
+
.filter((value) => value.language === languageIn)
|
|
1107
|
+
.toArray());
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
return purify.Either.of(filteredLiteralValues);
|
|
785
1111
|
})
|
|
786
|
-
.
|
|
787
|
-
.
|
|
1112
|
+
.map((values) => values.toArray())
|
|
1113
|
+
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
1114
|
+
object: valuesArray,
|
|
1115
|
+
predicate: ShaclCorePropertyShapeStatic.$properties.names["identifier"],
|
|
1116
|
+
subject: $resource,
|
|
1117
|
+
}))
|
|
1118
|
+
.chain((values) => values.head());
|
|
788
1119
|
if (_namesEither.isLeft()) {
|
|
789
1120
|
return _namesEither;
|
|
790
1121
|
}
|
|
791
1122
|
const names = _namesEither.unsafeCoerce();
|
|
792
|
-
const _orderEither = $resource
|
|
793
|
-
.values
|
|
794
|
-
.
|
|
795
|
-
.
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
1123
|
+
const _orderEither = purify.Either.of($resource.values(ShaclCorePropertyShapeStatic.$properties.order["identifier"], { unique: true }))
|
|
1124
|
+
.chain((values) => values.chainMap((value) => value.toNumber()))
|
|
1125
|
+
.map((values) => values.length > 0
|
|
1126
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
1127
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
1128
|
+
object: purify.Maybe.empty(),
|
|
1129
|
+
predicate: ShaclCorePropertyShapeStatic.$properties.order["identifier"],
|
|
1130
|
+
subject: $resource,
|
|
1131
|
+
}))
|
|
1132
|
+
.chain((values) => values.head());
|
|
800
1133
|
if (_orderEither.isLeft()) {
|
|
801
1134
|
return _orderEither;
|
|
802
1135
|
}
|
|
803
1136
|
const order = _orderEither.unsafeCoerce();
|
|
804
|
-
const _pathEither = $resource
|
|
805
|
-
.values(
|
|
806
|
-
.head()
|
|
807
|
-
.chain((value) => value.toResource())
|
|
808
|
-
.chain((_resource) => PropertyPath.$fromRdf({
|
|
1137
|
+
const _pathEither = purify.Either.of($resource.values(ShaclCorePropertyShapeStatic.$properties.path["identifier"], { unique: true }))
|
|
1138
|
+
.chain((values) => values.chainMap((value) => value.toResource().chain((resource) => PropertyPath.$fromRdf(resource, {
|
|
809
1139
|
...$context,
|
|
810
1140
|
ignoreRdfType: true,
|
|
811
1141
|
languageIn: $languageIn,
|
|
812
|
-
|
|
813
|
-
}))
|
|
1142
|
+
objectSet: $objectSet,
|
|
1143
|
+
}))))
|
|
1144
|
+
.chain((values) => values.head());
|
|
814
1145
|
if (_pathEither.isLeft()) {
|
|
815
1146
|
return _pathEither;
|
|
816
1147
|
}
|
|
817
1148
|
const path = _pathEither.unsafeCoerce();
|
|
818
|
-
const _uniqueLangEither = $resource
|
|
819
|
-
.values
|
|
820
|
-
.
|
|
821
|
-
.
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
1149
|
+
const _uniqueLangEither = purify.Either.of($resource.values(ShaclCorePropertyShapeStatic.$properties.uniqueLang["identifier"], { unique: true }))
|
|
1150
|
+
.chain((values) => values.chainMap((value) => value.toBoolean()))
|
|
1151
|
+
.map((values) => values.length > 0
|
|
1152
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
1153
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
1154
|
+
object: purify.Maybe.empty(),
|
|
1155
|
+
predicate: ShaclCorePropertyShapeStatic.$properties.uniqueLang["identifier"],
|
|
1156
|
+
subject: $resource,
|
|
1157
|
+
}))
|
|
1158
|
+
.chain((values) => values.head());
|
|
826
1159
|
if (_uniqueLangEither.isLeft()) {
|
|
827
1160
|
return _uniqueLangEither;
|
|
828
1161
|
}
|
|
@@ -841,32 +1174,34 @@ export var ShaclCorePropertyShapeStatic;
|
|
|
841
1174
|
});
|
|
842
1175
|
}
|
|
843
1176
|
ShaclCorePropertyShapeStatic.$propertiesFromRdf = $propertiesFromRdf;
|
|
844
|
-
function $
|
|
845
|
-
const
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
1177
|
+
function $toRdf(_shaclCorePropertyShape, options) {
|
|
1178
|
+
const ignoreRdfType = !!options?.ignoreRdfType;
|
|
1179
|
+
const mutateGraph = options?.mutateGraph;
|
|
1180
|
+
const resourceSet = options?.resourceSet ??
|
|
1181
|
+
new rdfjsResource.MutableResourceSet({
|
|
1182
|
+
dataFactory,
|
|
1183
|
+
dataset: datasetFactory.dataset(),
|
|
1184
|
+
});
|
|
1185
|
+
const resource = BaseShaclCoreShapeStatic.$toRdf(_shaclCorePropertyShape, {
|
|
851
1186
|
ignoreRdfType: true,
|
|
852
1187
|
mutateGraph,
|
|
853
1188
|
resourceSet,
|
|
854
1189
|
});
|
|
855
1190
|
if (!ignoreRdfType) {
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
1191
|
+
resource.add($RdfVocabularies.rdf.type, resource.dataFactory.namedNode("http://purl.org/shaclmate/ontology#ShaclCorePropertyShape"));
|
|
1192
|
+
resource.add($RdfVocabularies.rdf.type, resource.dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"));
|
|
1193
|
+
}
|
|
1194
|
+
resource.add(ShaclCorePropertyShapeStatic.$properties.defaultValue["identifier"], _shaclCorePropertyShape.defaultValue);
|
|
1195
|
+
resource.add(ShaclCorePropertyShapeStatic.$properties.descriptions["identifier"], _shaclCorePropertyShape.descriptions.map((item) => item));
|
|
1196
|
+
resource.add(ShaclCorePropertyShapeStatic.$properties.groups["identifier"], _shaclCorePropertyShape.groups.map((item) => item));
|
|
1197
|
+
resource.add(ShaclCorePropertyShapeStatic.$properties.names["identifier"], _shaclCorePropertyShape.names.map((item) => item));
|
|
1198
|
+
resource.add(ShaclCorePropertyShapeStatic.$properties.order["identifier"], _shaclCorePropertyShape.order);
|
|
1199
|
+
resource.add(ShaclCorePropertyShapeStatic.$properties.path["identifier"], PropertyPath.$toRdf(_shaclCorePropertyShape.path, {
|
|
865
1200
|
mutateGraph: mutateGraph,
|
|
866
1201
|
resourceSet: resourceSet,
|
|
867
1202
|
}));
|
|
868
|
-
|
|
869
|
-
return
|
|
1203
|
+
resource.add(ShaclCorePropertyShapeStatic.$properties.uniqueLang["identifier"], _shaclCorePropertyShape.uniqueLang);
|
|
1204
|
+
return resource;
|
|
870
1205
|
}
|
|
871
1206
|
ShaclCorePropertyShapeStatic.$toRdf = $toRdf;
|
|
872
1207
|
ShaclCorePropertyShapeStatic.$properties = {
|
|
@@ -898,13 +1233,28 @@ export var ShaclmatePropertyShape;
|
|
|
898
1233
|
(function (ShaclmatePropertyShape) {
|
|
899
1234
|
ShaclmatePropertyShape.$fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape");
|
|
900
1235
|
ShaclmatePropertyShape.$Identifier = ShaclCorePropertyShapeStatic.$Identifier;
|
|
901
|
-
function $
|
|
1236
|
+
function $fromRdf(resource, options) {
|
|
1237
|
+
let { ignoreRdfType = false, languageIn, objectSet, ...context } = options ?? {};
|
|
1238
|
+
if (!objectSet) {
|
|
1239
|
+
objectSet = new $RdfjsDatasetObjectSet({ dataset: resource.dataset });
|
|
1240
|
+
}
|
|
1241
|
+
return ShaclmatePropertyShape.$propertiesFromRdf({
|
|
1242
|
+
...context,
|
|
1243
|
+
ignoreRdfType,
|
|
1244
|
+
languageIn,
|
|
1245
|
+
objectSet,
|
|
1246
|
+
resource,
|
|
1247
|
+
});
|
|
1248
|
+
}
|
|
1249
|
+
ShaclmatePropertyShape.$fromRdf = $fromRdf;
|
|
1250
|
+
function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, languageIn: $languageIn, objectSet: $objectSet, resource: $resource,
|
|
902
1251
|
// @ts-ignore
|
|
903
1252
|
...$context }) {
|
|
904
1253
|
const $super0Either = ShaclCorePropertyShapeStatic.$propertiesFromRdf({
|
|
905
1254
|
...$context,
|
|
906
1255
|
ignoreRdfType: true,
|
|
907
1256
|
languageIn: $languageIn,
|
|
1257
|
+
objectSet: $objectSet,
|
|
908
1258
|
resource: $resource,
|
|
909
1259
|
});
|
|
910
1260
|
if ($super0Either.isLeft()) {
|
|
@@ -919,58 +1269,64 @@ export var ShaclmatePropertyShape;
|
|
|
919
1269
|
}
|
|
920
1270
|
const $identifier = $resource.identifier;
|
|
921
1271
|
const $type = "ShaclmatePropertyShape";
|
|
922
|
-
const _lazyEither = $resource
|
|
923
|
-
.values
|
|
924
|
-
.
|
|
925
|
-
.
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
1272
|
+
const _lazyEither = purify.Either.of($resource.values(ShaclmatePropertyShape.$properties.lazy["identifier"], { unique: true }))
|
|
1273
|
+
.chain((values) => values.chainMap((value) => value.toBoolean()))
|
|
1274
|
+
.map((values) => values.length > 0
|
|
1275
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
1276
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
1277
|
+
object: purify.Maybe.empty(),
|
|
1278
|
+
predicate: ShaclmatePropertyShape.$properties.lazy["identifier"],
|
|
1279
|
+
subject: $resource,
|
|
1280
|
+
}))
|
|
1281
|
+
.chain((values) => values.head());
|
|
930
1282
|
if (_lazyEither.isLeft()) {
|
|
931
1283
|
return _lazyEither;
|
|
932
1284
|
}
|
|
933
1285
|
const lazy = _lazyEither.unsafeCoerce();
|
|
934
|
-
const _mutableEither = $resource
|
|
935
|
-
.values
|
|
936
|
-
.
|
|
937
|
-
.
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
1286
|
+
const _mutableEither = purify.Either.of($resource.values(ShaclmatePropertyShape.$properties.mutable["identifier"], { unique: true }))
|
|
1287
|
+
.chain((values) => values.chainMap((value) => value.toBoolean()))
|
|
1288
|
+
.map((values) => values.length > 0
|
|
1289
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
1290
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
1291
|
+
object: purify.Maybe.empty(),
|
|
1292
|
+
predicate: ShaclmateNodeShape.$properties.mutable["identifier"],
|
|
1293
|
+
subject: $resource,
|
|
1294
|
+
}))
|
|
1295
|
+
.chain((values) => values.head());
|
|
942
1296
|
if (_mutableEither.isLeft()) {
|
|
943
1297
|
return _mutableEither;
|
|
944
1298
|
}
|
|
945
1299
|
const mutable = _mutableEither.unsafeCoerce();
|
|
946
|
-
const _nameEither = $resource
|
|
947
|
-
.values
|
|
948
|
-
.
|
|
949
|
-
.
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
1300
|
+
const _nameEither = purify.Either.of($resource.values(ShaclmatePropertyShape.$properties.name["identifier"], { unique: true }))
|
|
1301
|
+
.chain((values) => values.chainMap((value) => value.toString()))
|
|
1302
|
+
.map((values) => values.length > 0
|
|
1303
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
1304
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
1305
|
+
object: purify.Maybe.empty(),
|
|
1306
|
+
predicate: ShaclmateNodeShape.$properties.name["identifier"],
|
|
1307
|
+
subject: $resource,
|
|
1308
|
+
}))
|
|
1309
|
+
.chain((values) => values.head());
|
|
954
1310
|
if (_nameEither.isLeft()) {
|
|
955
1311
|
return _nameEither;
|
|
956
1312
|
}
|
|
957
1313
|
const name = _nameEither.unsafeCoerce();
|
|
958
|
-
const _stubEither = $resource
|
|
959
|
-
.values
|
|
960
|
-
.
|
|
961
|
-
.
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
1314
|
+
const _stubEither = purify.Either.of($resource.values(ShaclmatePropertyShape.$properties.stub["identifier"], { unique: true }))
|
|
1315
|
+
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
1316
|
+
.map((values) => values.length > 0
|
|
1317
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
1318
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
1319
|
+
object: purify.Maybe.empty(),
|
|
1320
|
+
predicate: ShaclmatePropertyShape.$properties.stub["identifier"],
|
|
1321
|
+
subject: $resource,
|
|
1322
|
+
}))
|
|
1323
|
+
.chain((values) => values.head());
|
|
966
1324
|
if (_stubEither.isLeft()) {
|
|
967
1325
|
return _stubEither;
|
|
968
1326
|
}
|
|
969
1327
|
const stub = _stubEither.unsafeCoerce();
|
|
970
|
-
const _visibilityEither = $resource
|
|
971
|
-
.values(
|
|
972
|
-
.head()
|
|
973
|
-
.chain((value) => value.toIri().chain((iri) => {
|
|
1328
|
+
const _visibilityEither = purify.Either.of($resource.values(ShaclmatePropertyShape.$properties.visibility["identifier"], { unique: true }))
|
|
1329
|
+
.chain((values) => values.chainMap((value) => value.toIri().chain((iri) => {
|
|
974
1330
|
switch (iri.value) {
|
|
975
1331
|
case "http://purl.org/shaclmate/ontology#_Visibility_Private":
|
|
976
1332
|
return purify.Either.of(iri);
|
|
@@ -986,23 +1342,29 @@ export var ShaclmatePropertyShape;
|
|
|
986
1342
|
predicate: ShaclmatePropertyShape.$properties.visibility["identifier"],
|
|
987
1343
|
}));
|
|
988
1344
|
}
|
|
989
|
-
}))
|
|
990
|
-
.map((
|
|
991
|
-
.
|
|
992
|
-
|
|
993
|
-
|
|
1345
|
+
})))
|
|
1346
|
+
.map((values) => values.length > 0
|
|
1347
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
1348
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
1349
|
+
object: purify.Maybe.empty(),
|
|
1350
|
+
predicate: ShaclmatePropertyShape.$properties.visibility["identifier"],
|
|
1351
|
+
subject: $resource,
|
|
1352
|
+
}))
|
|
1353
|
+
.chain((values) => values.head());
|
|
994
1354
|
if (_visibilityEither.isLeft()) {
|
|
995
1355
|
return _visibilityEither;
|
|
996
1356
|
}
|
|
997
1357
|
const visibility = _visibilityEither.unsafeCoerce();
|
|
998
|
-
const _widenEither = $resource
|
|
999
|
-
.values
|
|
1000
|
-
.
|
|
1001
|
-
.
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1358
|
+
const _widenEither = purify.Either.of($resource.values(ShaclmatePropertyShape.$properties.widen["identifier"], { unique: true }))
|
|
1359
|
+
.chain((values) => values.chainMap((value) => value.toBoolean()))
|
|
1360
|
+
.map((values) => values.length > 0
|
|
1361
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
1362
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
1363
|
+
object: purify.Maybe.empty(),
|
|
1364
|
+
predicate: ShaclmatePropertyShape.$properties.widen["identifier"],
|
|
1365
|
+
subject: $resource,
|
|
1366
|
+
}))
|
|
1367
|
+
.chain((values) => values.head());
|
|
1006
1368
|
if (_widenEither.isLeft()) {
|
|
1007
1369
|
return _widenEither;
|
|
1008
1370
|
}
|
|
@@ -1020,22 +1382,25 @@ export var ShaclmatePropertyShape;
|
|
|
1020
1382
|
});
|
|
1021
1383
|
}
|
|
1022
1384
|
ShaclmatePropertyShape.$propertiesFromRdf = $propertiesFromRdf;
|
|
1023
|
-
function $
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1385
|
+
function $toRdf(_shaclmatePropertyShape, options) {
|
|
1386
|
+
const ignoreRdfType = !!options?.ignoreRdfType;
|
|
1387
|
+
const mutateGraph = options?.mutateGraph;
|
|
1388
|
+
const resourceSet = options?.resourceSet ??
|
|
1389
|
+
new rdfjsResource.MutableResourceSet({
|
|
1390
|
+
dataFactory,
|
|
1391
|
+
dataset: datasetFactory.dataset(),
|
|
1392
|
+
});
|
|
1393
|
+
const resource = ShaclCorePropertyShapeStatic.$toRdf(_shaclmatePropertyShape, { ignoreRdfType: true, mutateGraph, resourceSet });
|
|
1029
1394
|
if (!ignoreRdfType) {
|
|
1030
|
-
|
|
1395
|
+
resource.add($RdfVocabularies.rdf.type, resource.dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"));
|
|
1031
1396
|
}
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
return
|
|
1397
|
+
resource.add(ShaclmatePropertyShape.$properties.lazy["identifier"], _shaclmatePropertyShape.lazy);
|
|
1398
|
+
resource.add(ShaclmateNodeShape.$properties.mutable["identifier"], _shaclmatePropertyShape.mutable);
|
|
1399
|
+
resource.add(ShaclmateNodeShape.$properties.name["identifier"], _shaclmatePropertyShape.name);
|
|
1400
|
+
resource.add(ShaclmatePropertyShape.$properties.stub["identifier"], _shaclmatePropertyShape.stub);
|
|
1401
|
+
resource.add(ShaclmatePropertyShape.$properties.visibility["identifier"], _shaclmatePropertyShape.visibility);
|
|
1402
|
+
resource.add(ShaclmatePropertyShape.$properties.widen["identifier"], _shaclmatePropertyShape.widen);
|
|
1403
|
+
return resource;
|
|
1039
1404
|
}
|
|
1040
1405
|
ShaclmatePropertyShape.$toRdf = $toRdf;
|
|
1041
1406
|
ShaclmatePropertyShape.$properties = {
|
|
@@ -1074,7 +1439,25 @@ export var OwlOntologyStatic;
|
|
|
1074
1439
|
$Identifier.fromString = fromString;
|
|
1075
1440
|
$Identifier.toString = rdfjsResource.Resource.Identifier.toString;
|
|
1076
1441
|
})($Identifier = OwlOntologyStatic.$Identifier || (OwlOntologyStatic.$Identifier = {}));
|
|
1077
|
-
function $
|
|
1442
|
+
function $fromRdf(resource, options) {
|
|
1443
|
+
let { ignoreRdfType = false, languageIn, objectSet, ...context } = options ?? {};
|
|
1444
|
+
if (!objectSet) {
|
|
1445
|
+
objectSet = new $RdfjsDatasetObjectSet({ dataset: resource.dataset });
|
|
1446
|
+
}
|
|
1447
|
+
return ShaclmateOntology.$fromRdf(resource, {
|
|
1448
|
+
...context,
|
|
1449
|
+
ignoreRdfType: false,
|
|
1450
|
+
objectSet,
|
|
1451
|
+
}).altLazy(() => OwlOntologyStatic.$propertiesFromRdf({
|
|
1452
|
+
...context,
|
|
1453
|
+
ignoreRdfType,
|
|
1454
|
+
languageIn,
|
|
1455
|
+
objectSet,
|
|
1456
|
+
resource,
|
|
1457
|
+
}));
|
|
1458
|
+
}
|
|
1459
|
+
OwlOntologyStatic.$fromRdf = $fromRdf;
|
|
1460
|
+
function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, languageIn: $languageIn, objectSet: $objectSet, resource: $resource,
|
|
1078
1461
|
// @ts-ignore
|
|
1079
1462
|
...$context }) {
|
|
1080
1463
|
if (!$ignoreRdfType && !$resource.isInstanceOf(OwlOntologyStatic.$fromRdfType)) {
|
|
@@ -1085,23 +1468,51 @@ export var OwlOntologyStatic;
|
|
|
1085
1468
|
}
|
|
1086
1469
|
const $identifier = $resource.identifier;
|
|
1087
1470
|
const $type = "OwlOntology";
|
|
1088
|
-
const _labelsEither = purify.Either.
|
|
1089
|
-
.values
|
|
1090
|
-
.
|
|
1091
|
-
.
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1471
|
+
const _labelsEither = purify.Either.of($resource.values(OwlOntologyStatic.$properties.labels["identifier"], { unique: true }))
|
|
1472
|
+
.chain((values) => {
|
|
1473
|
+
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
1474
|
+
if (literalValuesEither.isLeft()) {
|
|
1475
|
+
return literalValuesEither;
|
|
1476
|
+
}
|
|
1477
|
+
const literalValues = literalValuesEither.unsafeCoerce();
|
|
1478
|
+
const nonUniqueLanguageIn = $languageIn ?? [];
|
|
1479
|
+
if (nonUniqueLanguageIn.length === 0) {
|
|
1480
|
+
return purify.Either.of(literalValues);
|
|
1481
|
+
}
|
|
1482
|
+
let uniqueLanguageIn;
|
|
1483
|
+
if (nonUniqueLanguageIn.length === 1) {
|
|
1484
|
+
uniqueLanguageIn = [nonUniqueLanguageIn[0]];
|
|
1485
|
+
}
|
|
1486
|
+
else {
|
|
1487
|
+
uniqueLanguageIn = [];
|
|
1488
|
+
for (const languageIn of nonUniqueLanguageIn) {
|
|
1489
|
+
if (uniqueLanguageIn.indexOf(languageIn) === -1) {
|
|
1490
|
+
uniqueLanguageIn.push(languageIn);
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
// Return all literals for the first languageIn, then all literals for the second languageIn, etc.
|
|
1495
|
+
// Within a languageIn the literals may be in any order.
|
|
1496
|
+
let filteredLiteralValues;
|
|
1497
|
+
for (const languageIn of uniqueLanguageIn) {
|
|
1498
|
+
if (!filteredLiteralValues) {
|
|
1499
|
+
filteredLiteralValues = literalValues.filter((value) => value.language === languageIn);
|
|
1500
|
+
}
|
|
1501
|
+
else {
|
|
1502
|
+
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
1503
|
+
.filter((value) => value.language === languageIn)
|
|
1504
|
+
.toArray());
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
return purify.Either.of(filteredLiteralValues);
|
|
1102
1508
|
})
|
|
1103
|
-
.
|
|
1104
|
-
.
|
|
1509
|
+
.map((values) => values.toArray())
|
|
1510
|
+
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
1511
|
+
object: valuesArray,
|
|
1512
|
+
predicate: OwlOntologyStatic.$properties.labels["identifier"],
|
|
1513
|
+
subject: $resource,
|
|
1514
|
+
}))
|
|
1515
|
+
.chain((values) => values.head());
|
|
1105
1516
|
if (_labelsEither.isLeft()) {
|
|
1106
1517
|
return _labelsEither;
|
|
1107
1518
|
}
|
|
@@ -1109,21 +1520,23 @@ export var OwlOntologyStatic;
|
|
|
1109
1520
|
return purify.Either.of({ $identifier, $type, labels });
|
|
1110
1521
|
}
|
|
1111
1522
|
OwlOntologyStatic.$propertiesFromRdf = $propertiesFromRdf;
|
|
1112
|
-
function $
|
|
1113
|
-
const
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1523
|
+
function $toRdf(_owlOntology, options) {
|
|
1524
|
+
const ignoreRdfType = !!options?.ignoreRdfType;
|
|
1525
|
+
const mutateGraph = options?.mutateGraph;
|
|
1526
|
+
const resourceSet = options?.resourceSet ??
|
|
1527
|
+
new rdfjsResource.MutableResourceSet({
|
|
1528
|
+
dataFactory,
|
|
1529
|
+
dataset: datasetFactory.dataset(),
|
|
1530
|
+
});
|
|
1531
|
+
const resource = resourceSet.mutableResource(_owlOntology.$identifier, {
|
|
1119
1532
|
mutateGraph,
|
|
1120
1533
|
});
|
|
1121
1534
|
if (!ignoreRdfType) {
|
|
1122
|
-
|
|
1123
|
-
|
|
1535
|
+
resource.add($RdfVocabularies.rdf.type, resource.dataFactory.namedNode("http://purl.org/shaclmate/ontology#OwlOntology"));
|
|
1536
|
+
resource.add($RdfVocabularies.rdf.type, resource.dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"));
|
|
1124
1537
|
}
|
|
1125
|
-
|
|
1126
|
-
return
|
|
1538
|
+
resource.add(OwlOntologyStatic.$properties.labels["identifier"], _owlOntology.labels.map((item) => item));
|
|
1539
|
+
return resource;
|
|
1127
1540
|
}
|
|
1128
1541
|
OwlOntologyStatic.$toRdf = $toRdf;
|
|
1129
1542
|
OwlOntologyStatic.$properties = {
|
|
@@ -1136,13 +1549,28 @@ export var ShaclmateOntology;
|
|
|
1136
1549
|
(function (ShaclmateOntology) {
|
|
1137
1550
|
ShaclmateOntology.$fromRdfType = dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology");
|
|
1138
1551
|
ShaclmateOntology.$Identifier = OwlOntologyStatic.$Identifier;
|
|
1139
|
-
function $
|
|
1552
|
+
function $fromRdf(resource, options) {
|
|
1553
|
+
let { ignoreRdfType = false, languageIn, objectSet, ...context } = options ?? {};
|
|
1554
|
+
if (!objectSet) {
|
|
1555
|
+
objectSet = new $RdfjsDatasetObjectSet({ dataset: resource.dataset });
|
|
1556
|
+
}
|
|
1557
|
+
return ShaclmateOntology.$propertiesFromRdf({
|
|
1558
|
+
...context,
|
|
1559
|
+
ignoreRdfType,
|
|
1560
|
+
languageIn,
|
|
1561
|
+
objectSet,
|
|
1562
|
+
resource,
|
|
1563
|
+
});
|
|
1564
|
+
}
|
|
1565
|
+
ShaclmateOntology.$fromRdf = $fromRdf;
|
|
1566
|
+
function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, languageIn: $languageIn, objectSet: $objectSet, resource: $resource,
|
|
1140
1567
|
// @ts-ignore
|
|
1141
1568
|
...$context }) {
|
|
1142
1569
|
const $super0Either = OwlOntologyStatic.$propertiesFromRdf({
|
|
1143
1570
|
...$context,
|
|
1144
1571
|
ignoreRdfType: true,
|
|
1145
1572
|
languageIn: $languageIn,
|
|
1573
|
+
objectSet: $objectSet,
|
|
1146
1574
|
resource: $resource,
|
|
1147
1575
|
});
|
|
1148
1576
|
if ($super0Either.isLeft()) {
|
|
@@ -1157,12 +1585,10 @@ export var ShaclmateOntology;
|
|
|
1157
1585
|
}
|
|
1158
1586
|
const $identifier = $resource.identifier;
|
|
1159
1587
|
const $type = "ShaclmateOntology";
|
|
1160
|
-
const _tsFeatureExcludesEither = purify.Either.
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
.
|
|
1164
|
-
.head()
|
|
1165
|
-
.chain((value) => value.toIri().chain((iri) => {
|
|
1588
|
+
const _tsFeatureExcludesEither = purify.Either.of($resource.values(ShaclmateOntology.$properties.tsFeatureExcludes["identifier"], {
|
|
1589
|
+
unique: true,
|
|
1590
|
+
}))
|
|
1591
|
+
.chain((values) => values.chainMap((value) => value.toIri().chain((iri) => {
|
|
1166
1592
|
switch (iri.value) {
|
|
1167
1593
|
case "http://purl.org/shaclmate/ontology#_TsFeatures_All":
|
|
1168
1594
|
return purify.Either.of(iri);
|
|
@@ -1192,17 +1618,22 @@ export var ShaclmateOntology;
|
|
|
1192
1618
|
predicate: ShaclmateNodeShape.$properties.tsFeatureExcludes["identifier"],
|
|
1193
1619
|
}));
|
|
1194
1620
|
}
|
|
1195
|
-
})))
|
|
1621
|
+
})))
|
|
1622
|
+
.map((values) => values.toArray())
|
|
1623
|
+
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
1624
|
+
object: valuesArray,
|
|
1625
|
+
predicate: ShaclmateNodeShape.$properties.tsFeatureExcludes["identifier"],
|
|
1626
|
+
subject: $resource,
|
|
1627
|
+
}))
|
|
1628
|
+
.chain((values) => values.head());
|
|
1196
1629
|
if (_tsFeatureExcludesEither.isLeft()) {
|
|
1197
1630
|
return _tsFeatureExcludesEither;
|
|
1198
1631
|
}
|
|
1199
1632
|
const tsFeatureExcludes = _tsFeatureExcludesEither.unsafeCoerce();
|
|
1200
|
-
const _tsFeatureIncludesEither = purify.Either.
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
.
|
|
1204
|
-
.head()
|
|
1205
|
-
.chain((value) => value.toIri().chain((iri) => {
|
|
1633
|
+
const _tsFeatureIncludesEither = purify.Either.of($resource.values(ShaclmateOntology.$properties.tsFeatureIncludes["identifier"], {
|
|
1634
|
+
unique: true,
|
|
1635
|
+
}))
|
|
1636
|
+
.chain((values) => values.chainMap((value) => value.toIri().chain((iri) => {
|
|
1206
1637
|
switch (iri.value) {
|
|
1207
1638
|
case "http://purl.org/shaclmate/ontology#_TsFeatures_All":
|
|
1208
1639
|
return purify.Either.of(iri);
|
|
@@ -1232,27 +1663,35 @@ export var ShaclmateOntology;
|
|
|
1232
1663
|
predicate: ShaclmateNodeShape.$properties.tsFeatureIncludes["identifier"],
|
|
1233
1664
|
}));
|
|
1234
1665
|
}
|
|
1235
|
-
})))
|
|
1666
|
+
})))
|
|
1667
|
+
.map((values) => values.toArray())
|
|
1668
|
+
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
1669
|
+
object: valuesArray,
|
|
1670
|
+
predicate: ShaclmateNodeShape.$properties.tsFeatureIncludes["identifier"],
|
|
1671
|
+
subject: $resource,
|
|
1672
|
+
}))
|
|
1673
|
+
.chain((values) => values.head());
|
|
1236
1674
|
if (_tsFeatureIncludesEither.isLeft()) {
|
|
1237
1675
|
return _tsFeatureIncludesEither;
|
|
1238
1676
|
}
|
|
1239
1677
|
const tsFeatureIncludes = _tsFeatureIncludesEither.unsafeCoerce();
|
|
1240
|
-
const _tsImportsEither = purify.Either.
|
|
1241
|
-
.values
|
|
1242
|
-
.map((
|
|
1243
|
-
.
|
|
1244
|
-
|
|
1245
|
-
|
|
1678
|
+
const _tsImportsEither = purify.Either.of($resource.values(ShaclmateOntology.$properties.tsImports["identifier"], { unique: true }))
|
|
1679
|
+
.chain((values) => values.chainMap((value) => value.toString()))
|
|
1680
|
+
.map((values) => values.toArray())
|
|
1681
|
+
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
1682
|
+
object: valuesArray,
|
|
1683
|
+
predicate: ShaclmateNodeShape.$properties.tsImports["identifier"],
|
|
1684
|
+
subject: $resource,
|
|
1685
|
+
}))
|
|
1686
|
+
.chain((values) => values.head());
|
|
1246
1687
|
if (_tsImportsEither.isLeft()) {
|
|
1247
1688
|
return _tsImportsEither;
|
|
1248
1689
|
}
|
|
1249
1690
|
const tsImports = _tsImportsEither.unsafeCoerce();
|
|
1250
|
-
const _tsObjectDeclarationTypeEither = $resource
|
|
1251
|
-
.values(ShaclmateOntology.$properties.tsObjectDeclarationType["identifier"], {
|
|
1691
|
+
const _tsObjectDeclarationTypeEither = purify.Either.of($resource.values(ShaclmateOntology.$properties.tsObjectDeclarationType["identifier"], {
|
|
1252
1692
|
unique: true,
|
|
1253
|
-
})
|
|
1254
|
-
.
|
|
1255
|
-
.chain((value) => value.toIri().chain((iri) => {
|
|
1693
|
+
}))
|
|
1694
|
+
.chain((values) => values.chainMap((value) => value.toIri().chain((iri) => {
|
|
1256
1695
|
switch (iri.value) {
|
|
1257
1696
|
case "http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Class":
|
|
1258
1697
|
return purify.Either.of(iri);
|
|
@@ -1266,11 +1705,15 @@ export var ShaclmateOntology;
|
|
|
1266
1705
|
predicate: ShaclmateNodeShape.$properties.tsObjectDeclarationType["identifier"],
|
|
1267
1706
|
}));
|
|
1268
1707
|
}
|
|
1269
|
-
}))
|
|
1270
|
-
.map((
|
|
1271
|
-
.
|
|
1272
|
-
|
|
1273
|
-
|
|
1708
|
+
})))
|
|
1709
|
+
.map((values) => values.length > 0
|
|
1710
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
1711
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
1712
|
+
object: purify.Maybe.empty(),
|
|
1713
|
+
predicate: ShaclmateNodeShape.$properties.tsObjectDeclarationType["identifier"],
|
|
1714
|
+
subject: $resource,
|
|
1715
|
+
}))
|
|
1716
|
+
.chain((values) => values.head());
|
|
1274
1717
|
if (_tsObjectDeclarationTypeEither.isLeft()) {
|
|
1275
1718
|
return _tsObjectDeclarationTypeEither;
|
|
1276
1719
|
}
|
|
@@ -1286,24 +1729,27 @@ export var ShaclmateOntology;
|
|
|
1286
1729
|
});
|
|
1287
1730
|
}
|
|
1288
1731
|
ShaclmateOntology.$propertiesFromRdf = $propertiesFromRdf;
|
|
1289
|
-
function $
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1732
|
+
function $toRdf(_shaclmateOntology, options) {
|
|
1733
|
+
const ignoreRdfType = !!options?.ignoreRdfType;
|
|
1734
|
+
const mutateGraph = options?.mutateGraph;
|
|
1735
|
+
const resourceSet = options?.resourceSet ??
|
|
1736
|
+
new rdfjsResource.MutableResourceSet({
|
|
1737
|
+
dataFactory,
|
|
1738
|
+
dataset: datasetFactory.dataset(),
|
|
1739
|
+
});
|
|
1740
|
+
const resource = OwlOntologyStatic.$toRdf(_shaclmateOntology, {
|
|
1295
1741
|
ignoreRdfType: true,
|
|
1296
1742
|
mutateGraph,
|
|
1297
1743
|
resourceSet,
|
|
1298
1744
|
});
|
|
1299
1745
|
if (!ignoreRdfType) {
|
|
1300
|
-
|
|
1746
|
+
resource.add($RdfVocabularies.rdf.type, resource.dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"));
|
|
1301
1747
|
}
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
return
|
|
1748
|
+
resource.add(ShaclmateNodeShape.$properties.tsFeatureExcludes["identifier"], _shaclmateOntology.tsFeatureExcludes.map((item) => item));
|
|
1749
|
+
resource.add(ShaclmateNodeShape.$properties.tsFeatureIncludes["identifier"], _shaclmateOntology.tsFeatureIncludes.map((item) => item));
|
|
1750
|
+
resource.add(ShaclmateNodeShape.$properties.tsImports["identifier"], _shaclmateOntology.tsImports.map((item) => item));
|
|
1751
|
+
resource.add(ShaclmateNodeShape.$properties.tsObjectDeclarationType["identifier"], _shaclmateOntology.tsObjectDeclarationType);
|
|
1752
|
+
return resource;
|
|
1307
1753
|
}
|
|
1308
1754
|
ShaclmateOntology.$toRdf = $toRdf;
|
|
1309
1755
|
ShaclmateOntology.$properties = {
|
|
@@ -1326,13 +1772,32 @@ export var ShaclCoreNodeShapeStatic;
|
|
|
1326
1772
|
(function (ShaclCoreNodeShapeStatic) {
|
|
1327
1773
|
ShaclCoreNodeShapeStatic.$fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape");
|
|
1328
1774
|
ShaclCoreNodeShapeStatic.$Identifier = BaseShaclCoreShapeStatic.$Identifier;
|
|
1329
|
-
function $
|
|
1775
|
+
function $fromRdf(resource, options) {
|
|
1776
|
+
let { ignoreRdfType = false, languageIn, objectSet, ...context } = options ?? {};
|
|
1777
|
+
if (!objectSet) {
|
|
1778
|
+
objectSet = new $RdfjsDatasetObjectSet({ dataset: resource.dataset });
|
|
1779
|
+
}
|
|
1780
|
+
return ShaclmateNodeShape.$fromRdf(resource, {
|
|
1781
|
+
...context,
|
|
1782
|
+
ignoreRdfType: false,
|
|
1783
|
+
objectSet,
|
|
1784
|
+
}).altLazy(() => ShaclCoreNodeShapeStatic.$propertiesFromRdf({
|
|
1785
|
+
...context,
|
|
1786
|
+
ignoreRdfType,
|
|
1787
|
+
languageIn,
|
|
1788
|
+
objectSet,
|
|
1789
|
+
resource,
|
|
1790
|
+
}));
|
|
1791
|
+
}
|
|
1792
|
+
ShaclCoreNodeShapeStatic.$fromRdf = $fromRdf;
|
|
1793
|
+
function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, languageIn: $languageIn, objectSet: $objectSet, resource: $resource,
|
|
1330
1794
|
// @ts-ignore
|
|
1331
1795
|
...$context }) {
|
|
1332
1796
|
const $super0Either = BaseShaclCoreShapeStatic.$propertiesFromRdf({
|
|
1333
1797
|
...$context,
|
|
1334
1798
|
ignoreRdfType: true,
|
|
1335
1799
|
languageIn: $languageIn,
|
|
1800
|
+
objectSet: $objectSet,
|
|
1336
1801
|
resource: $resource,
|
|
1337
1802
|
});
|
|
1338
1803
|
if ($super0Either.isLeft()) {
|
|
@@ -1347,40 +1812,51 @@ export var ShaclCoreNodeShapeStatic;
|
|
|
1347
1812
|
}
|
|
1348
1813
|
const $identifier = $resource.identifier;
|
|
1349
1814
|
const $type = "ShaclCoreNodeShape";
|
|
1350
|
-
const _closedEither = $resource
|
|
1351
|
-
.values
|
|
1352
|
-
.
|
|
1353
|
-
.
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1815
|
+
const _closedEither = purify.Either.of($resource.values(ShaclCoreNodeShapeStatic.$properties.closed["identifier"], { unique: true }))
|
|
1816
|
+
.chain((values) => values.chainMap((value) => value.toBoolean()))
|
|
1817
|
+
.map((values) => values.length > 0
|
|
1818
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
1819
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
1820
|
+
object: purify.Maybe.empty(),
|
|
1821
|
+
predicate: ShaclCoreNodeShapeStatic.$properties.closed["identifier"],
|
|
1822
|
+
subject: $resource,
|
|
1823
|
+
}))
|
|
1824
|
+
.chain((values) => values.head());
|
|
1358
1825
|
if (_closedEither.isLeft()) {
|
|
1359
1826
|
return _closedEither;
|
|
1360
1827
|
}
|
|
1361
1828
|
const closed = _closedEither.unsafeCoerce();
|
|
1362
|
-
const _ignoredPropertiesEither = $resource
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
.chain((value) => value.toList())
|
|
1366
|
-
.chain((
|
|
1367
|
-
|
|
1368
|
-
.
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
.
|
|
1372
|
-
|
|
1373
|
-
|
|
1829
|
+
const _ignoredPropertiesEither = purify.Either.of($resource.values(ShaclCoreNodeShapeStatic.$properties.ignoredProperties["identifier"], {
|
|
1830
|
+
unique: true,
|
|
1831
|
+
}))
|
|
1832
|
+
.chain((values) => values.chainMap((value) => value.toList()))
|
|
1833
|
+
.chain((valueLists) => valueLists.chainMap((valueList) => purify.Either.of(rdfjsResource.Resource.Values.fromArray({
|
|
1834
|
+
objects: valueList,
|
|
1835
|
+
predicate: ShaclCoreNodeShapeStatic.$properties.ignoredProperties["identifier"],
|
|
1836
|
+
subject: $resource,
|
|
1837
|
+
})).chain((values) => values.chainMap((value) => value.toIri()))))
|
|
1838
|
+
.map((valueLists) => valueLists.map((valueList) => valueList.toArray()))
|
|
1839
|
+
.map((values) => values.length > 0
|
|
1840
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
1841
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
1842
|
+
object: purify.Maybe.empty(),
|
|
1843
|
+
predicate: ShaclCoreNodeShapeStatic.$properties.ignoredProperties["identifier"],
|
|
1844
|
+
subject: $resource,
|
|
1845
|
+
}))
|
|
1846
|
+
.chain((values) => values.head());
|
|
1374
1847
|
if (_ignoredPropertiesEither.isLeft()) {
|
|
1375
1848
|
return _ignoredPropertiesEither;
|
|
1376
1849
|
}
|
|
1377
1850
|
const ignoredProperties = _ignoredPropertiesEither.unsafeCoerce();
|
|
1378
|
-
const _propertiesEither = purify.Either.
|
|
1379
|
-
.values
|
|
1380
|
-
.map((
|
|
1381
|
-
.
|
|
1382
|
-
|
|
1383
|
-
|
|
1851
|
+
const _propertiesEither = purify.Either.of($resource.values(ShaclCoreNodeShapeStatic.$properties.properties["identifier"], { unique: true }))
|
|
1852
|
+
.chain((values) => values.chainMap((value) => value.toIdentifier()))
|
|
1853
|
+
.map((values) => values.toArray())
|
|
1854
|
+
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
1855
|
+
object: valuesArray,
|
|
1856
|
+
predicate: ShaclCoreNodeShapeStatic.$properties.properties["identifier"],
|
|
1857
|
+
subject: $resource,
|
|
1858
|
+
}))
|
|
1859
|
+
.chain((values) => values.head());
|
|
1384
1860
|
if (_propertiesEither.isLeft()) {
|
|
1385
1861
|
return _propertiesEither;
|
|
1386
1862
|
}
|
|
@@ -1395,23 +1871,25 @@ export var ShaclCoreNodeShapeStatic;
|
|
|
1395
1871
|
});
|
|
1396
1872
|
}
|
|
1397
1873
|
ShaclCoreNodeShapeStatic.$propertiesFromRdf = $propertiesFromRdf;
|
|
1398
|
-
function $
|
|
1399
|
-
const
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1874
|
+
function $toRdf(_shaclCoreNodeShape, options) {
|
|
1875
|
+
const ignoreRdfType = !!options?.ignoreRdfType;
|
|
1876
|
+
const mutateGraph = options?.mutateGraph;
|
|
1877
|
+
const resourceSet = options?.resourceSet ??
|
|
1878
|
+
new rdfjsResource.MutableResourceSet({
|
|
1879
|
+
dataFactory,
|
|
1880
|
+
dataset: datasetFactory.dataset(),
|
|
1881
|
+
});
|
|
1882
|
+
const resource = BaseShaclCoreShapeStatic.$toRdf(_shaclCoreNodeShape, {
|
|
1405
1883
|
ignoreRdfType: true,
|
|
1406
1884
|
mutateGraph,
|
|
1407
1885
|
resourceSet,
|
|
1408
1886
|
});
|
|
1409
1887
|
if (!ignoreRdfType) {
|
|
1410
|
-
|
|
1411
|
-
|
|
1888
|
+
resource.add($RdfVocabularies.rdf.type, resource.dataFactory.namedNode("http://purl.org/shaclmate/ontology#ShaclCoreNodeShape"));
|
|
1889
|
+
resource.add($RdfVocabularies.rdf.type, resource.dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape"));
|
|
1412
1890
|
}
|
|
1413
|
-
|
|
1414
|
-
|
|
1891
|
+
resource.add(ShaclCoreNodeShapeStatic.$properties.closed["identifier"], _shaclCoreNodeShape.closed);
|
|
1892
|
+
resource.add(ShaclCoreNodeShapeStatic.$properties.ignoredProperties["identifier"], _shaclCoreNodeShape.ignoredProperties.map((value) => value.length > 0
|
|
1415
1893
|
? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
1416
1894
|
if (itemIndex === 0) {
|
|
1417
1895
|
currentSubListResource = listResource;
|
|
@@ -1431,8 +1909,8 @@ export var ShaclCoreNodeShapeStatic;
|
|
|
1431
1909
|
listResource: resourceSet.mutableResource(dataFactory.blankNode(), { mutateGraph }),
|
|
1432
1910
|
}).listResource.identifier
|
|
1433
1911
|
: $RdfVocabularies.rdf.nil));
|
|
1434
|
-
|
|
1435
|
-
return
|
|
1912
|
+
resource.add(ShaclCoreNodeShapeStatic.$properties.properties["identifier"], _shaclCoreNodeShape.properties.map((item) => item));
|
|
1913
|
+
return resource;
|
|
1436
1914
|
}
|
|
1437
1915
|
ShaclCoreNodeShapeStatic.$toRdf = $toRdf;
|
|
1438
1916
|
ShaclCoreNodeShapeStatic.$properties = {
|
|
@@ -1452,13 +1930,28 @@ export var ShaclmateNodeShape;
|
|
|
1452
1930
|
(function (ShaclmateNodeShape) {
|
|
1453
1931
|
ShaclmateNodeShape.$fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape");
|
|
1454
1932
|
ShaclmateNodeShape.$Identifier = ShaclCoreNodeShapeStatic.$Identifier;
|
|
1455
|
-
function $
|
|
1933
|
+
function $fromRdf(resource, options) {
|
|
1934
|
+
let { ignoreRdfType = false, languageIn, objectSet, ...context } = options ?? {};
|
|
1935
|
+
if (!objectSet) {
|
|
1936
|
+
objectSet = new $RdfjsDatasetObjectSet({ dataset: resource.dataset });
|
|
1937
|
+
}
|
|
1938
|
+
return ShaclmateNodeShape.$propertiesFromRdf({
|
|
1939
|
+
...context,
|
|
1940
|
+
ignoreRdfType,
|
|
1941
|
+
languageIn,
|
|
1942
|
+
objectSet,
|
|
1943
|
+
resource,
|
|
1944
|
+
});
|
|
1945
|
+
}
|
|
1946
|
+
ShaclmateNodeShape.$fromRdf = $fromRdf;
|
|
1947
|
+
function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, languageIn: $languageIn, objectSet: $objectSet, resource: $resource,
|
|
1456
1948
|
// @ts-ignore
|
|
1457
1949
|
...$context }) {
|
|
1458
1950
|
const $super0Either = ShaclCoreNodeShapeStatic.$propertiesFromRdf({
|
|
1459
1951
|
...$context,
|
|
1460
1952
|
ignoreRdfType: true,
|
|
1461
1953
|
languageIn: $languageIn,
|
|
1954
|
+
objectSet: $objectSet,
|
|
1462
1955
|
resource: $resource,
|
|
1463
1956
|
});
|
|
1464
1957
|
if ($super0Either.isLeft()) {
|
|
@@ -1473,60 +1966,66 @@ export var ShaclmateNodeShape;
|
|
|
1473
1966
|
}
|
|
1474
1967
|
const $identifier = $resource.identifier;
|
|
1475
1968
|
const $type = "ShaclmateNodeShape";
|
|
1476
|
-
const _abstractEither = $resource
|
|
1477
|
-
.values
|
|
1478
|
-
.
|
|
1479
|
-
.
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1969
|
+
const _abstractEither = purify.Either.of($resource.values(ShaclmateNodeShape.$properties.abstract["identifier"], { unique: true }))
|
|
1970
|
+
.chain((values) => values.chainMap((value) => value.toBoolean()))
|
|
1971
|
+
.map((values) => values.length > 0
|
|
1972
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
1973
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
1974
|
+
object: purify.Maybe.empty(),
|
|
1975
|
+
predicate: ShaclmateNodeShape.$properties.abstract["identifier"],
|
|
1976
|
+
subject: $resource,
|
|
1977
|
+
}))
|
|
1978
|
+
.chain((values) => values.head());
|
|
1484
1979
|
if (_abstractEither.isLeft()) {
|
|
1485
1980
|
return _abstractEither;
|
|
1486
1981
|
}
|
|
1487
1982
|
const abstract = _abstractEither.unsafeCoerce();
|
|
1488
|
-
const _export_Either = $resource
|
|
1489
|
-
.values
|
|
1490
|
-
.
|
|
1491
|
-
.
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1983
|
+
const _export_Either = purify.Either.of($resource.values(ShaclmateNodeShape.$properties.export_["identifier"], { unique: true }))
|
|
1984
|
+
.chain((values) => values.chainMap((value) => value.toBoolean()))
|
|
1985
|
+
.map((values) => values.length > 0
|
|
1986
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
1987
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
1988
|
+
object: purify.Maybe.empty(),
|
|
1989
|
+
predicate: ShaclmateNodeShape.$properties.export_["identifier"],
|
|
1990
|
+
subject: $resource,
|
|
1991
|
+
}))
|
|
1992
|
+
.chain((values) => values.head());
|
|
1496
1993
|
if (_export_Either.isLeft()) {
|
|
1497
1994
|
return _export_Either;
|
|
1498
1995
|
}
|
|
1499
1996
|
const export_ = _export_Either.unsafeCoerce();
|
|
1500
|
-
const _externEither = $resource
|
|
1501
|
-
.values
|
|
1502
|
-
.
|
|
1503
|
-
.
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1997
|
+
const _externEither = purify.Either.of($resource.values(ShaclmateNodeShape.$properties.extern["identifier"], { unique: true }))
|
|
1998
|
+
.chain((values) => values.chainMap((value) => value.toBoolean()))
|
|
1999
|
+
.map((values) => values.length > 0
|
|
2000
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
2001
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
2002
|
+
object: purify.Maybe.empty(),
|
|
2003
|
+
predicate: ShaclmateNodeShape.$properties.extern["identifier"],
|
|
2004
|
+
subject: $resource,
|
|
2005
|
+
}))
|
|
2006
|
+
.chain((values) => values.head());
|
|
1508
2007
|
if (_externEither.isLeft()) {
|
|
1509
2008
|
return _externEither;
|
|
1510
2009
|
}
|
|
1511
2010
|
const extern = _externEither.unsafeCoerce();
|
|
1512
|
-
const _fromRdfTypeEither = $resource
|
|
1513
|
-
.values
|
|
1514
|
-
.
|
|
1515
|
-
.
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
2011
|
+
const _fromRdfTypeEither = purify.Either.of($resource.values(ShaclmateNodeShape.$properties.fromRdfType["identifier"], { unique: true }))
|
|
2012
|
+
.chain((values) => values.chainMap((value) => value.toIri()))
|
|
2013
|
+
.map((values) => values.length > 0
|
|
2014
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
2015
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
2016
|
+
object: purify.Maybe.empty(),
|
|
2017
|
+
predicate: ShaclmateNodeShape.$properties.fromRdfType["identifier"],
|
|
2018
|
+
subject: $resource,
|
|
2019
|
+
}))
|
|
2020
|
+
.chain((values) => values.head());
|
|
1520
2021
|
if (_fromRdfTypeEither.isLeft()) {
|
|
1521
2022
|
return _fromRdfTypeEither;
|
|
1522
2023
|
}
|
|
1523
2024
|
const fromRdfType = _fromRdfTypeEither.unsafeCoerce();
|
|
1524
|
-
const _identifierMintingStrategyEither = $resource
|
|
1525
|
-
.values(ShaclmateNodeShape.$properties.identifierMintingStrategy["identifier"], {
|
|
2025
|
+
const _identifierMintingStrategyEither = purify.Either.of($resource.values(ShaclmateNodeShape.$properties.identifierMintingStrategy["identifier"], {
|
|
1526
2026
|
unique: true,
|
|
1527
|
-
})
|
|
1528
|
-
.
|
|
1529
|
-
.chain((value) => value.toIri().chain((iri) => {
|
|
2027
|
+
}))
|
|
2028
|
+
.chain((values) => values.chainMap((value) => value.toIri().chain((iri) => {
|
|
1530
2029
|
switch (iri.value) {
|
|
1531
2030
|
case "http://purl.org/shaclmate/ontology#_IdentifierMintingStrategy_BlankNode":
|
|
1532
2031
|
return purify.Either.of(iri);
|
|
@@ -1542,67 +2041,80 @@ export var ShaclmateNodeShape;
|
|
|
1542
2041
|
predicate: ShaclmateNodeShape.$properties.identifierMintingStrategy["identifier"],
|
|
1543
2042
|
}));
|
|
1544
2043
|
}
|
|
1545
|
-
}))
|
|
1546
|
-
.map((
|
|
1547
|
-
.
|
|
1548
|
-
|
|
1549
|
-
|
|
2044
|
+
})))
|
|
2045
|
+
.map((values) => values.length > 0
|
|
2046
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
2047
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
2048
|
+
object: purify.Maybe.empty(),
|
|
2049
|
+
predicate: ShaclmateNodeShape.$properties.identifierMintingStrategy["identifier"],
|
|
2050
|
+
subject: $resource,
|
|
2051
|
+
}))
|
|
2052
|
+
.chain((values) => values.head());
|
|
1550
2053
|
if (_identifierMintingStrategyEither.isLeft()) {
|
|
1551
2054
|
return _identifierMintingStrategyEither;
|
|
1552
2055
|
}
|
|
1553
2056
|
const identifierMintingStrategy = _identifierMintingStrategyEither.unsafeCoerce();
|
|
1554
|
-
const _mutableEither = $resource
|
|
1555
|
-
.values
|
|
1556
|
-
.
|
|
1557
|
-
.
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
2057
|
+
const _mutableEither = purify.Either.of($resource.values(ShaclmateNodeShape.$properties.mutable["identifier"], { unique: true }))
|
|
2058
|
+
.chain((values) => values.chainMap((value) => value.toBoolean()))
|
|
2059
|
+
.map((values) => values.length > 0
|
|
2060
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
2061
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
2062
|
+
object: purify.Maybe.empty(),
|
|
2063
|
+
predicate: ShaclmateNodeShape.$properties.mutable["identifier"],
|
|
2064
|
+
subject: $resource,
|
|
2065
|
+
}))
|
|
2066
|
+
.chain((values) => values.head());
|
|
1562
2067
|
if (_mutableEither.isLeft()) {
|
|
1563
2068
|
return _mutableEither;
|
|
1564
2069
|
}
|
|
1565
2070
|
const mutable = _mutableEither.unsafeCoerce();
|
|
1566
|
-
const _nameEither = $resource
|
|
1567
|
-
.values
|
|
1568
|
-
.
|
|
1569
|
-
.
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
2071
|
+
const _nameEither = purify.Either.of($resource.values(ShaclmateNodeShape.$properties.name["identifier"], { unique: true }))
|
|
2072
|
+
.chain((values) => values.chainMap((value) => value.toString()))
|
|
2073
|
+
.map((values) => values.length > 0
|
|
2074
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
2075
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
2076
|
+
object: purify.Maybe.empty(),
|
|
2077
|
+
predicate: ShaclmateNodeShape.$properties.name["identifier"],
|
|
2078
|
+
subject: $resource,
|
|
2079
|
+
}))
|
|
2080
|
+
.chain((values) => values.head());
|
|
1574
2081
|
if (_nameEither.isLeft()) {
|
|
1575
2082
|
return _nameEither;
|
|
1576
2083
|
}
|
|
1577
2084
|
const name = _nameEither.unsafeCoerce();
|
|
1578
|
-
const _rdfTypeEither = $resource
|
|
1579
|
-
.values
|
|
1580
|
-
.
|
|
1581
|
-
.
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
2085
|
+
const _rdfTypeEither = purify.Either.of($resource.values(ShaclmateNodeShape.$properties.rdfType["identifier"], { unique: true }))
|
|
2086
|
+
.chain((values) => values.chainMap((value) => value.toIri()))
|
|
2087
|
+
.map((values) => values.length > 0
|
|
2088
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
2089
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
2090
|
+
object: purify.Maybe.empty(),
|
|
2091
|
+
predicate: ShaclmateNodeShape.$properties.rdfType["identifier"],
|
|
2092
|
+
subject: $resource,
|
|
2093
|
+
}))
|
|
2094
|
+
.chain((values) => values.head());
|
|
1586
2095
|
if (_rdfTypeEither.isLeft()) {
|
|
1587
2096
|
return _rdfTypeEither;
|
|
1588
2097
|
}
|
|
1589
2098
|
const rdfType = _rdfTypeEither.unsafeCoerce();
|
|
1590
|
-
const _toRdfTypesEither = purify.Either.
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
.
|
|
1594
|
-
.
|
|
1595
|
-
.
|
|
2099
|
+
const _toRdfTypesEither = purify.Either.of($resource.values(ShaclmateNodeShape.$properties.toRdfTypes["identifier"], {
|
|
2100
|
+
unique: true,
|
|
2101
|
+
}))
|
|
2102
|
+
.chain((values) => values.chainMap((value) => value.toIri()))
|
|
2103
|
+
.map((values) => values.toArray())
|
|
2104
|
+
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
2105
|
+
object: valuesArray,
|
|
2106
|
+
predicate: ShaclmateNodeShape.$properties.toRdfTypes["identifier"],
|
|
2107
|
+
subject: $resource,
|
|
2108
|
+
}))
|
|
2109
|
+
.chain((values) => values.head());
|
|
1596
2110
|
if (_toRdfTypesEither.isLeft()) {
|
|
1597
2111
|
return _toRdfTypesEither;
|
|
1598
2112
|
}
|
|
1599
2113
|
const toRdfTypes = _toRdfTypesEither.unsafeCoerce();
|
|
1600
|
-
const _tsFeatureExcludesEither = purify.Either.
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
.
|
|
1604
|
-
.head()
|
|
1605
|
-
.chain((value) => value.toIri().chain((iri) => {
|
|
2114
|
+
const _tsFeatureExcludesEither = purify.Either.of($resource.values(ShaclmateNodeShape.$properties.tsFeatureExcludes["identifier"], {
|
|
2115
|
+
unique: true,
|
|
2116
|
+
}))
|
|
2117
|
+
.chain((values) => values.chainMap((value) => value.toIri().chain((iri) => {
|
|
1606
2118
|
switch (iri.value) {
|
|
1607
2119
|
case "http://purl.org/shaclmate/ontology#_TsFeatures_All":
|
|
1608
2120
|
return purify.Either.of(iri);
|
|
@@ -1632,17 +2144,22 @@ export var ShaclmateNodeShape;
|
|
|
1632
2144
|
predicate: ShaclmateNodeShape.$properties.tsFeatureExcludes["identifier"],
|
|
1633
2145
|
}));
|
|
1634
2146
|
}
|
|
1635
|
-
})))
|
|
2147
|
+
})))
|
|
2148
|
+
.map((values) => values.toArray())
|
|
2149
|
+
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
2150
|
+
object: valuesArray,
|
|
2151
|
+
predicate: ShaclmateNodeShape.$properties.tsFeatureExcludes["identifier"],
|
|
2152
|
+
subject: $resource,
|
|
2153
|
+
}))
|
|
2154
|
+
.chain((values) => values.head());
|
|
1636
2155
|
if (_tsFeatureExcludesEither.isLeft()) {
|
|
1637
2156
|
return _tsFeatureExcludesEither;
|
|
1638
2157
|
}
|
|
1639
2158
|
const tsFeatureExcludes = _tsFeatureExcludesEither.unsafeCoerce();
|
|
1640
|
-
const _tsFeatureIncludesEither = purify.Either.
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
.
|
|
1644
|
-
.head()
|
|
1645
|
-
.chain((value) => value.toIri().chain((iri) => {
|
|
2159
|
+
const _tsFeatureIncludesEither = purify.Either.of($resource.values(ShaclmateNodeShape.$properties.tsFeatureIncludes["identifier"], {
|
|
2160
|
+
unique: true,
|
|
2161
|
+
}))
|
|
2162
|
+
.chain((values) => values.chainMap((value) => value.toIri().chain((iri) => {
|
|
1646
2163
|
switch (iri.value) {
|
|
1647
2164
|
case "http://purl.org/shaclmate/ontology#_TsFeatures_All":
|
|
1648
2165
|
return purify.Either.of(iri);
|
|
@@ -1672,27 +2189,35 @@ export var ShaclmateNodeShape;
|
|
|
1672
2189
|
predicate: ShaclmateNodeShape.$properties.tsFeatureIncludes["identifier"],
|
|
1673
2190
|
}));
|
|
1674
2191
|
}
|
|
1675
|
-
})))
|
|
2192
|
+
})))
|
|
2193
|
+
.map((values) => values.toArray())
|
|
2194
|
+
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
2195
|
+
object: valuesArray,
|
|
2196
|
+
predicate: ShaclmateNodeShape.$properties.tsFeatureIncludes["identifier"],
|
|
2197
|
+
subject: $resource,
|
|
2198
|
+
}))
|
|
2199
|
+
.chain((values) => values.head());
|
|
1676
2200
|
if (_tsFeatureIncludesEither.isLeft()) {
|
|
1677
2201
|
return _tsFeatureIncludesEither;
|
|
1678
2202
|
}
|
|
1679
2203
|
const tsFeatureIncludes = _tsFeatureIncludesEither.unsafeCoerce();
|
|
1680
|
-
const _tsImportsEither = purify.Either.
|
|
1681
|
-
.values
|
|
1682
|
-
.map((
|
|
1683
|
-
.
|
|
1684
|
-
|
|
1685
|
-
|
|
2204
|
+
const _tsImportsEither = purify.Either.of($resource.values(ShaclmateNodeShape.$properties.tsImports["identifier"], { unique: true }))
|
|
2205
|
+
.chain((values) => values.chainMap((value) => value.toString()))
|
|
2206
|
+
.map((values) => values.toArray())
|
|
2207
|
+
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
2208
|
+
object: valuesArray,
|
|
2209
|
+
predicate: ShaclmateNodeShape.$properties.tsImports["identifier"],
|
|
2210
|
+
subject: $resource,
|
|
2211
|
+
}))
|
|
2212
|
+
.chain((values) => values.head());
|
|
1686
2213
|
if (_tsImportsEither.isLeft()) {
|
|
1687
2214
|
return _tsImportsEither;
|
|
1688
2215
|
}
|
|
1689
2216
|
const tsImports = _tsImportsEither.unsafeCoerce();
|
|
1690
|
-
const _tsObjectDeclarationTypeEither = $resource
|
|
1691
|
-
.values(ShaclmateNodeShape.$properties.tsObjectDeclarationType["identifier"], {
|
|
2217
|
+
const _tsObjectDeclarationTypeEither = purify.Either.of($resource.values(ShaclmateNodeShape.$properties.tsObjectDeclarationType["identifier"], {
|
|
1692
2218
|
unique: true,
|
|
1693
|
-
})
|
|
1694
|
-
.
|
|
1695
|
-
.chain((value) => value.toIri().chain((iri) => {
|
|
2219
|
+
}))
|
|
2220
|
+
.chain((values) => values.chainMap((value) => value.toIri().chain((iri) => {
|
|
1696
2221
|
switch (iri.value) {
|
|
1697
2222
|
case "http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Class":
|
|
1698
2223
|
return purify.Either.of(iri);
|
|
@@ -1706,11 +2231,15 @@ export var ShaclmateNodeShape;
|
|
|
1706
2231
|
predicate: ShaclmateNodeShape.$properties.tsObjectDeclarationType["identifier"],
|
|
1707
2232
|
}));
|
|
1708
2233
|
}
|
|
1709
|
-
}))
|
|
1710
|
-
.map((
|
|
1711
|
-
.
|
|
1712
|
-
|
|
1713
|
-
|
|
2234
|
+
})))
|
|
2235
|
+
.map((values) => values.length > 0
|
|
2236
|
+
? values.map((value) => purify.Maybe.of(value))
|
|
2237
|
+
: rdfjsResource.Resource.Values.fromValue({
|
|
2238
|
+
object: purify.Maybe.empty(),
|
|
2239
|
+
predicate: ShaclmateNodeShape.$properties.tsObjectDeclarationType["identifier"],
|
|
2240
|
+
subject: $resource,
|
|
2241
|
+
}))
|
|
2242
|
+
.chain((values) => values.head());
|
|
1714
2243
|
if (_tsObjectDeclarationTypeEither.isLeft()) {
|
|
1715
2244
|
return _tsObjectDeclarationTypeEither;
|
|
1716
2245
|
}
|
|
@@ -1735,33 +2264,36 @@ export var ShaclmateNodeShape;
|
|
|
1735
2264
|
});
|
|
1736
2265
|
}
|
|
1737
2266
|
ShaclmateNodeShape.$propertiesFromRdf = $propertiesFromRdf;
|
|
1738
|
-
function $
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
2267
|
+
function $toRdf(_shaclmateNodeShape, options) {
|
|
2268
|
+
const ignoreRdfType = !!options?.ignoreRdfType;
|
|
2269
|
+
const mutateGraph = options?.mutateGraph;
|
|
2270
|
+
const resourceSet = options?.resourceSet ??
|
|
2271
|
+
new rdfjsResource.MutableResourceSet({
|
|
2272
|
+
dataFactory,
|
|
2273
|
+
dataset: datasetFactory.dataset(),
|
|
2274
|
+
});
|
|
2275
|
+
const resource = ShaclCoreNodeShapeStatic.$toRdf(_shaclmateNodeShape, {
|
|
1744
2276
|
ignoreRdfType: true,
|
|
1745
2277
|
mutateGraph,
|
|
1746
2278
|
resourceSet,
|
|
1747
2279
|
});
|
|
1748
2280
|
if (!ignoreRdfType) {
|
|
1749
|
-
|
|
1750
|
-
}
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
return
|
|
2281
|
+
resource.add($RdfVocabularies.rdf.type, resource.dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape"));
|
|
2282
|
+
}
|
|
2283
|
+
resource.add(ShaclmateNodeShape.$properties.abstract["identifier"], _shaclmateNodeShape.abstract);
|
|
2284
|
+
resource.add(ShaclmateNodeShape.$properties.export_["identifier"], _shaclmateNodeShape.export_);
|
|
2285
|
+
resource.add(ShaclmateNodeShape.$properties.extern["identifier"], _shaclmateNodeShape.extern);
|
|
2286
|
+
resource.add(ShaclmateNodeShape.$properties.fromRdfType["identifier"], _shaclmateNodeShape.fromRdfType);
|
|
2287
|
+
resource.add(ShaclmateNodeShape.$properties.identifierMintingStrategy["identifier"], _shaclmateNodeShape.identifierMintingStrategy);
|
|
2288
|
+
resource.add(ShaclmateNodeShape.$properties.mutable["identifier"], _shaclmateNodeShape.mutable);
|
|
2289
|
+
resource.add(ShaclmateNodeShape.$properties.name["identifier"], _shaclmateNodeShape.name);
|
|
2290
|
+
resource.add(ShaclmateNodeShape.$properties.rdfType["identifier"], _shaclmateNodeShape.rdfType);
|
|
2291
|
+
resource.add(ShaclmateNodeShape.$properties.toRdfTypes["identifier"], _shaclmateNodeShape.toRdfTypes.map((item) => item));
|
|
2292
|
+
resource.add(ShaclmateNodeShape.$properties.tsFeatureExcludes["identifier"], _shaclmateNodeShape.tsFeatureExcludes.map((item) => item));
|
|
2293
|
+
resource.add(ShaclmateNodeShape.$properties.tsFeatureIncludes["identifier"], _shaclmateNodeShape.tsFeatureIncludes.map((item) => item));
|
|
2294
|
+
resource.add(ShaclmateNodeShape.$properties.tsImports["identifier"], _shaclmateNodeShape.tsImports.map((item) => item));
|
|
2295
|
+
resource.add(ShaclmateNodeShape.$properties.tsObjectDeclarationType["identifier"], _shaclmateNodeShape.tsObjectDeclarationType);
|
|
2296
|
+
return resource;
|
|
1765
2297
|
}
|
|
1766
2298
|
ShaclmateNodeShape.$toRdf = $toRdf;
|
|
1767
2299
|
ShaclmateNodeShape.$properties = {
|
|
@@ -1821,7 +2353,21 @@ export var ShaclCorePropertyGroup;
|
|
|
1821
2353
|
$Identifier.fromString = fromString;
|
|
1822
2354
|
$Identifier.toString = rdfjsResource.Resource.Identifier.toString;
|
|
1823
2355
|
})($Identifier = ShaclCorePropertyGroup.$Identifier || (ShaclCorePropertyGroup.$Identifier = {}));
|
|
1824
|
-
function $
|
|
2356
|
+
function $fromRdf(resource, options) {
|
|
2357
|
+
let { ignoreRdfType = false, languageIn, objectSet, ...context } = options ?? {};
|
|
2358
|
+
if (!objectSet) {
|
|
2359
|
+
objectSet = new $RdfjsDatasetObjectSet({ dataset: resource.dataset });
|
|
2360
|
+
}
|
|
2361
|
+
return ShaclCorePropertyGroup.$propertiesFromRdf({
|
|
2362
|
+
...context,
|
|
2363
|
+
ignoreRdfType,
|
|
2364
|
+
languageIn,
|
|
2365
|
+
objectSet,
|
|
2366
|
+
resource,
|
|
2367
|
+
});
|
|
2368
|
+
}
|
|
2369
|
+
ShaclCorePropertyGroup.$fromRdf = $fromRdf;
|
|
2370
|
+
function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, languageIn: $languageIn, objectSet: $objectSet, resource: $resource,
|
|
1825
2371
|
// @ts-ignore
|
|
1826
2372
|
...$context }) {
|
|
1827
2373
|
if (!$ignoreRdfType && !$resource.isInstanceOf(ShaclCorePropertyGroup.$fromRdfType)) {
|
|
@@ -1832,44 +2378,100 @@ export var ShaclCorePropertyGroup;
|
|
|
1832
2378
|
}
|
|
1833
2379
|
const $identifier = $resource.identifier;
|
|
1834
2380
|
const $type = "ShaclCorePropertyGroup";
|
|
1835
|
-
const _commentsEither = purify.Either.
|
|
1836
|
-
.values
|
|
1837
|
-
.
|
|
1838
|
-
.
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
2381
|
+
const _commentsEither = purify.Either.of($resource.values(ShaclCorePropertyGroup.$properties.comments["identifier"], { unique: true }))
|
|
2382
|
+
.chain((values) => {
|
|
2383
|
+
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
2384
|
+
if (literalValuesEither.isLeft()) {
|
|
2385
|
+
return literalValuesEither;
|
|
2386
|
+
}
|
|
2387
|
+
const literalValues = literalValuesEither.unsafeCoerce();
|
|
2388
|
+
const nonUniqueLanguageIn = $languageIn ?? [];
|
|
2389
|
+
if (nonUniqueLanguageIn.length === 0) {
|
|
2390
|
+
return purify.Either.of(literalValues);
|
|
2391
|
+
}
|
|
2392
|
+
let uniqueLanguageIn;
|
|
2393
|
+
if (nonUniqueLanguageIn.length === 1) {
|
|
2394
|
+
uniqueLanguageIn = [nonUniqueLanguageIn[0]];
|
|
2395
|
+
}
|
|
2396
|
+
else {
|
|
2397
|
+
uniqueLanguageIn = [];
|
|
2398
|
+
for (const languageIn of nonUniqueLanguageIn) {
|
|
2399
|
+
if (uniqueLanguageIn.indexOf(languageIn) === -1) {
|
|
2400
|
+
uniqueLanguageIn.push(languageIn);
|
|
2401
|
+
}
|
|
2402
|
+
}
|
|
2403
|
+
}
|
|
2404
|
+
// Return all literals for the first languageIn, then all literals for the second languageIn, etc.
|
|
2405
|
+
// Within a languageIn the literals may be in any order.
|
|
2406
|
+
let filteredLiteralValues;
|
|
2407
|
+
for (const languageIn of uniqueLanguageIn) {
|
|
2408
|
+
if (!filteredLiteralValues) {
|
|
2409
|
+
filteredLiteralValues = literalValues.filter((value) => value.language === languageIn);
|
|
2410
|
+
}
|
|
2411
|
+
else {
|
|
2412
|
+
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
2413
|
+
.filter((value) => value.language === languageIn)
|
|
2414
|
+
.toArray());
|
|
2415
|
+
}
|
|
2416
|
+
}
|
|
2417
|
+
return purify.Either.of(filteredLiteralValues);
|
|
1849
2418
|
})
|
|
1850
|
-
.
|
|
1851
|
-
.
|
|
2419
|
+
.map((values) => values.toArray())
|
|
2420
|
+
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
2421
|
+
object: valuesArray,
|
|
2422
|
+
predicate: ShaclCorePropertyGroup.$properties.comments["identifier"],
|
|
2423
|
+
subject: $resource,
|
|
2424
|
+
}))
|
|
2425
|
+
.chain((values) => values.head());
|
|
1852
2426
|
if (_commentsEither.isLeft()) {
|
|
1853
2427
|
return _commentsEither;
|
|
1854
2428
|
}
|
|
1855
2429
|
const comments = _commentsEither.unsafeCoerce();
|
|
1856
|
-
const _labelsEither = purify.Either.
|
|
1857
|
-
.values
|
|
1858
|
-
.
|
|
1859
|
-
.
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
2430
|
+
const _labelsEither = purify.Either.of($resource.values(ShaclCorePropertyGroup.$properties.labels["identifier"], { unique: true }))
|
|
2431
|
+
.chain((values) => {
|
|
2432
|
+
const literalValuesEither = values.chainMap((value) => value.toLiteral());
|
|
2433
|
+
if (literalValuesEither.isLeft()) {
|
|
2434
|
+
return literalValuesEither;
|
|
2435
|
+
}
|
|
2436
|
+
const literalValues = literalValuesEither.unsafeCoerce();
|
|
2437
|
+
const nonUniqueLanguageIn = $languageIn ?? [];
|
|
2438
|
+
if (nonUniqueLanguageIn.length === 0) {
|
|
2439
|
+
return purify.Either.of(literalValues);
|
|
2440
|
+
}
|
|
2441
|
+
let uniqueLanguageIn;
|
|
2442
|
+
if (nonUniqueLanguageIn.length === 1) {
|
|
2443
|
+
uniqueLanguageIn = [nonUniqueLanguageIn[0]];
|
|
2444
|
+
}
|
|
2445
|
+
else {
|
|
2446
|
+
uniqueLanguageIn = [];
|
|
2447
|
+
for (const languageIn of nonUniqueLanguageIn) {
|
|
2448
|
+
if (uniqueLanguageIn.indexOf(languageIn) === -1) {
|
|
2449
|
+
uniqueLanguageIn.push(languageIn);
|
|
2450
|
+
}
|
|
2451
|
+
}
|
|
2452
|
+
}
|
|
2453
|
+
// Return all literals for the first languageIn, then all literals for the second languageIn, etc.
|
|
2454
|
+
// Within a languageIn the literals may be in any order.
|
|
2455
|
+
let filteredLiteralValues;
|
|
2456
|
+
for (const languageIn of uniqueLanguageIn) {
|
|
2457
|
+
if (!filteredLiteralValues) {
|
|
2458
|
+
filteredLiteralValues = literalValues.filter((value) => value.language === languageIn);
|
|
2459
|
+
}
|
|
2460
|
+
else {
|
|
2461
|
+
filteredLiteralValues = filteredLiteralValues.concat(...literalValues
|
|
2462
|
+
.filter((value) => value.language === languageIn)
|
|
2463
|
+
.toArray());
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
2466
|
+
return purify.Either.of(filteredLiteralValues);
|
|
1870
2467
|
})
|
|
1871
|
-
.
|
|
1872
|
-
.
|
|
2468
|
+
.map((values) => values.toArray())
|
|
2469
|
+
.map((valuesArray) => rdfjsResource.Resource.Values.fromValue({
|
|
2470
|
+
object: valuesArray,
|
|
2471
|
+
predicate: ShaclCorePropertyGroup.$properties.labels["identifier"],
|
|
2472
|
+
subject: $resource,
|
|
2473
|
+
}))
|
|
2474
|
+
.chain((values) => values.head());
|
|
1873
2475
|
if (_labelsEither.isLeft()) {
|
|
1874
2476
|
return _labelsEither;
|
|
1875
2477
|
}
|
|
@@ -1877,18 +2479,21 @@ export var ShaclCorePropertyGroup;
|
|
|
1877
2479
|
return purify.Either.of({ $identifier, $type, comments, labels });
|
|
1878
2480
|
}
|
|
1879
2481
|
ShaclCorePropertyGroup.$propertiesFromRdf = $propertiesFromRdf;
|
|
1880
|
-
function $
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
2482
|
+
function $toRdf(_shaclCorePropertyGroup, options) {
|
|
2483
|
+
const ignoreRdfType = !!options?.ignoreRdfType;
|
|
2484
|
+
const mutateGraph = options?.mutateGraph;
|
|
2485
|
+
const resourceSet = options?.resourceSet ??
|
|
2486
|
+
new rdfjsResource.MutableResourceSet({
|
|
2487
|
+
dataFactory,
|
|
2488
|
+
dataset: datasetFactory.dataset(),
|
|
2489
|
+
});
|
|
2490
|
+
const resource = resourceSet.mutableResource(_shaclCorePropertyGroup.$identifier, { mutateGraph });
|
|
1886
2491
|
if (!ignoreRdfType) {
|
|
1887
|
-
|
|
2492
|
+
resource.add($RdfVocabularies.rdf.type, resource.dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup"));
|
|
1888
2493
|
}
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
return
|
|
2494
|
+
resource.add(ShaclCorePropertyGroup.$properties.comments["identifier"], _shaclCorePropertyGroup.comments.map((item) => item));
|
|
2495
|
+
resource.add(ShaclCorePropertyGroup.$properties.labels["identifier"], _shaclCorePropertyGroup.labels.map((item) => item));
|
|
2496
|
+
return resource;
|
|
1892
2497
|
}
|
|
1893
2498
|
ShaclCorePropertyGroup.$toRdf = $toRdf;
|
|
1894
2499
|
ShaclCorePropertyGroup.$properties = {
|
|
@@ -1902,13 +2507,13 @@ export var ShaclCorePropertyGroup;
|
|
|
1902
2507
|
})(ShaclCorePropertyGroup || (ShaclCorePropertyGroup = {}));
|
|
1903
2508
|
export var ShaclCoreShape;
|
|
1904
2509
|
(function (ShaclCoreShape) {
|
|
1905
|
-
function $fromRdf(
|
|
1906
|
-
return ShaclCoreNodeShapeStatic.$fromRdf({
|
|
1907
|
-
...
|
|
1908
|
-
|
|
1909
|
-
}).altLazy(() => ShaclCorePropertyShapeStatic.$fromRdf({
|
|
1910
|
-
...
|
|
1911
|
-
|
|
2510
|
+
function $fromRdf(resource, options) {
|
|
2511
|
+
return ShaclCoreNodeShapeStatic.$fromRdf(resource, {
|
|
2512
|
+
...options,
|
|
2513
|
+
ignoreRdfType: false,
|
|
2514
|
+
}).altLazy(() => ShaclCorePropertyShapeStatic.$fromRdf(resource, {
|
|
2515
|
+
...options,
|
|
2516
|
+
ignoreRdfType: false,
|
|
1912
2517
|
}));
|
|
1913
2518
|
}
|
|
1914
2519
|
ShaclCoreShape.$fromRdf = $fromRdf;
|
|
@@ -1940,10 +2545,13 @@ export var ShaclCoreShape;
|
|
|
1940
2545
|
})(ShaclCoreShape || (ShaclCoreShape = {}));
|
|
1941
2546
|
export var ShaclmateShape;
|
|
1942
2547
|
(function (ShaclmateShape) {
|
|
1943
|
-
function $fromRdf(
|
|
1944
|
-
return ShaclmateNodeShape.$fromRdf(
|
|
1945
|
-
...
|
|
1946
|
-
|
|
2548
|
+
function $fromRdf(resource, options) {
|
|
2549
|
+
return ShaclmateNodeShape.$fromRdf(resource, {
|
|
2550
|
+
...options,
|
|
2551
|
+
ignoreRdfType: false,
|
|
2552
|
+
}).altLazy(() => ShaclCorePropertyShapeStatic.$fromRdf(resource, {
|
|
2553
|
+
...options,
|
|
2554
|
+
ignoreRdfType: false,
|
|
1947
2555
|
}));
|
|
1948
2556
|
}
|
|
1949
2557
|
ShaclmateShape.$fromRdf = $fromRdf;
|
|
@@ -2253,9 +2861,7 @@ export class $RdfjsDatasetObjectSet {
|
|
|
2253
2861
|
}
|
|
2254
2862
|
const objects = [];
|
|
2255
2863
|
for (const identifier of identifiers) {
|
|
2256
|
-
const either = objectType.$fromRdf({
|
|
2257
|
-
resource: this.resourceSet.resource(identifier),
|
|
2258
|
-
});
|
|
2864
|
+
const either = objectType.$fromRdf(this.resourceSet.resource(identifier), { objectSet: this });
|
|
2259
2865
|
if (either.isLeft()) {
|
|
2260
2866
|
return either;
|
|
2261
2867
|
}
|
|
@@ -2274,7 +2880,7 @@ export class $RdfjsDatasetObjectSet {
|
|
|
2274
2880
|
const objects = [];
|
|
2275
2881
|
let objectI = 0;
|
|
2276
2882
|
for (const resource of resources) {
|
|
2277
|
-
const either = objectType.$fromRdf({
|
|
2883
|
+
const either = objectType.$fromRdf(resource, { objectSet: this });
|
|
2278
2884
|
if (either.isLeft()) {
|
|
2279
2885
|
return either;
|
|
2280
2886
|
}
|
|
@@ -2335,7 +2941,7 @@ export class $RdfjsDatasetObjectSet {
|
|
|
2335
2941
|
const resource = this.resourceSet.resource(identifier);
|
|
2336
2942
|
const lefts = [];
|
|
2337
2943
|
for (const objectType of objectTypes) {
|
|
2338
|
-
const either = objectType.$fromRdf({
|
|
2944
|
+
const either = objectType.$fromRdf(resource, { objectSet: this });
|
|
2339
2945
|
if (either.isRight()) {
|
|
2340
2946
|
objects.push(either.unsafeCoerce());
|
|
2341
2947
|
break;
|
|
@@ -2363,7 +2969,7 @@ export class $RdfjsDatasetObjectSet {
|
|
|
2363
2969
|
let objectI = 0;
|
|
2364
2970
|
const objects = [];
|
|
2365
2971
|
for (const { objectType, resource } of resources) {
|
|
2366
|
-
const either = objectType.$fromRdf({
|
|
2972
|
+
const either = objectType.$fromRdf(resource, { objectSet: this });
|
|
2367
2973
|
if (either.isLeft()) {
|
|
2368
2974
|
return either;
|
|
2369
2975
|
}
|