@shaclmate/compiler 2.0.13 → 2.0.15
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/Compiler.d.ts +15 -0
- package/Compiler.js +20 -0
- package/ShapesGraphToAstTransformer.d.ts +18 -23
- package/ShapesGraphToAstTransformer.js +21 -447
- package/_ShapesGraphToAstTransformer/NodeShapeAstType.d.ts +3 -0
- package/_ShapesGraphToAstTransformer/NodeShapeAstType.js +2 -0
- package/_ShapesGraphToAstTransformer/index.d.ts +10 -0
- package/_ShapesGraphToAstTransformer/index.js +10 -0
- package/_ShapesGraphToAstTransformer/pickLiteral.d.ts +4 -0
- package/_ShapesGraphToAstTransformer/pickLiteral.js +18 -0
- package/_ShapesGraphToAstTransformer/propertyShapeNodeKinds.d.ts +4 -0
- package/_ShapesGraphToAstTransformer/propertyShapeNodeKinds.js +26 -0
- package/_ShapesGraphToAstTransformer/shapeAstName.d.ts +5 -0
- package/_ShapesGraphToAstTransformer/shapeAstName.js +28 -0
- package/_ShapesGraphToAstTransformer/transformNodeShapeToAstType.d.ts +6 -0
- package/_ShapesGraphToAstTransformer/transformNodeShapeToAstType.js +178 -0
- package/_ShapesGraphToAstTransformer/transformPropertyShapeToAstCompositeType.d.ts +13 -0
- package/_ShapesGraphToAstTransformer/transformPropertyShapeToAstCompositeType.js +200 -0
- package/_ShapesGraphToAstTransformer/transformPropertyShapeToAstIdentifierType.d.ts +12 -0
- package/_ShapesGraphToAstTransformer/transformPropertyShapeToAstIdentifierType.js +29 -0
- package/_ShapesGraphToAstTransformer/transformPropertyShapeToAstLiteralType.d.ts +12 -0
- package/_ShapesGraphToAstTransformer/transformPropertyShapeToAstLiteralType.js +43 -0
- package/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.d.ts +6 -0
- package/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +31 -0
- package/_ShapesGraphToAstTransformer/transformPropertyShapeToAstTermType.d.ts +14 -0
- package/_ShapesGraphToAstTransformer/transformPropertyShapeToAstTermType.js +21 -0
- package/_ShapesGraphToAstTransformer/transformPropertyShapeToAstType.d.ts +16 -0
- package/_ShapesGraphToAstTransformer/transformPropertyShapeToAstType.js +58 -0
- package/ast/Ast.d.ts +5 -0
- package/ast/CompositeType.d.ts +13 -0
- package/ast/CompositeType.js +2 -0
- package/ast/IdentifierType.d.ts +3 -6
- package/ast/IntersectionType.d.ts +2 -2
- package/ast/ListType.d.ts +53 -0
- package/ast/ListType.js +2 -0
- package/ast/LiteralType.d.ts +4 -3
- package/ast/Name.d.ts +1 -0
- package/ast/ObjectCompositeType.d.ts +22 -0
- package/ast/ObjectCompositeType.js +2 -0
- package/ast/ObjectIntersectionType.d.ts +8 -0
- package/ast/ObjectIntersectionType.js +2 -0
- package/ast/ObjectType.d.ts +91 -19
- package/ast/ObjectType.js +26 -1
- package/ast/ObjectUnionType.d.ts +19 -0
- package/ast/ObjectUnionType.js +2 -0
- package/ast/PlaceholderType.d.ts +7 -0
- package/ast/PlaceholderType.js +2 -0
- package/ast/SetType.d.ts +1 -1
- package/ast/TermType.d.ts +11 -0
- package/ast/TermType.js +2 -0
- package/ast/Type.d.ts +11 -3
- package/ast/UnionType.d.ts +3 -3
- package/ast/index.d.ts +6 -3
- package/ast/index.js +6 -3
- package/enums/MintingStrategy.d.ts +5 -0
- package/enums/MintingStrategy.js +2 -0
- package/enums/PropertyVisibility.d.ts +2 -0
- package/enums/PropertyVisibility.js +2 -0
- package/enums/TsFeature.d.ts +5 -0
- package/enums/TsFeature.js +16 -0
- package/enums/TsObjectDeclarationType.d.ts +5 -0
- package/enums/TsObjectDeclarationType.js +2 -0
- package/enums/index.d.ts +5 -0
- package/enums/index.js +5 -0
- package/generators/Generator.d.ts +5 -0
- package/generators/Generator.js +2 -0
- package/generators/index.d.ts +2 -2
- package/generators/index.js +2 -2
- package/generators/json/AstJsonGenerator.d.ts +4 -5
- package/generators/json/AstJsonGenerator.js +31 -22
- package/generators/ts/BooleanType.d.ts +7 -3
- package/generators/ts/BooleanType.js +58 -4
- package/generators/ts/DateTimeType.d.ts +19 -0
- package/generators/ts/DateTimeType.js +66 -0
- package/generators/ts/DeclaredType.d.ts +17 -0
- package/generators/ts/DeclaredType.js +10 -0
- package/generators/ts/IdentifierType.d.ts +7 -17
- package/generators/ts/IdentifierType.js +69 -60
- package/generators/ts/Import.d.ts +17 -0
- package/generators/ts/Import.js +54 -0
- package/generators/ts/ListType.d.ts +19 -8
- package/generators/ts/ListType.js +206 -44
- package/generators/ts/LiteralType.d.ts +13 -11
- package/generators/ts/LiteralType.js +36 -51
- package/generators/ts/NumberType.d.ts +7 -3
- package/generators/ts/NumberType.js +55 -4
- package/generators/ts/ObjectType.d.ts +48 -25
- package/generators/ts/ObjectType.js +234 -50
- package/generators/ts/ObjectUnionType.d.ts +58 -0
- package/generators/ts/ObjectUnionType.js +450 -0
- package/generators/ts/OptionType.d.ts +14 -4
- package/generators/ts/OptionType.js +70 -20
- package/generators/ts/PrimitiveType.d.ts +15 -5
- package/generators/ts/PrimitiveType.js +27 -31
- package/generators/ts/SetType.d.ts +14 -4
- package/generators/ts/SetType.js +108 -30
- package/generators/ts/SnippetDeclarations.d.ts +11 -0
- package/generators/ts/SnippetDeclarations.js +215 -0
- package/generators/ts/StringType.d.ts +8 -3
- package/generators/ts/StringType.js +57 -3
- package/generators/ts/TermType.d.ts +54 -0
- package/generators/ts/TermType.js +242 -0
- package/generators/ts/TsGenerator.d.ts +4 -12
- package/generators/ts/TsGenerator.js +57 -99
- package/generators/ts/Type.d.ts +117 -46
- package/generators/ts/Type.js +93 -59
- package/generators/ts/TypeFactory.d.ts +4 -5
- package/generators/ts/TypeFactory.js +224 -91
- package/generators/ts/UnionType.d.ts +20 -6
- package/generators/ts/UnionType.js +230 -120
- package/generators/ts/_ObjectType/IdentifierProperty.d.ts +27 -8
- package/generators/ts/_ObjectType/IdentifierProperty.js +153 -32
- package/generators/ts/_ObjectType/Property.d.ts +139 -9
- package/generators/ts/_ObjectType/Property.js +26 -3
- package/generators/ts/_ObjectType/ShaclProperty.d.ts +24 -5
- package/generators/ts/_ObjectType/ShaclProperty.js +103 -26
- package/generators/ts/_ObjectType/TypeDiscriminatorProperty.d.ts +23 -7
- package/generators/ts/_ObjectType/TypeDiscriminatorProperty.js +83 -14
- package/generators/ts/_ObjectType/classDeclaration.d.ts +2 -1
- package/generators/ts/_ObjectType/classDeclaration.js +79 -111
- package/generators/ts/_ObjectType/createFunctionDeclaration.d.ts +5 -0
- package/generators/ts/_ObjectType/createFunctionDeclaration.js +60 -0
- package/generators/ts/_ObjectType/equalsFunctionDeclaration.d.ts +2 -1
- package/generators/ts/_ObjectType/equalsFunctionDeclaration.js +12 -20
- package/generators/ts/_ObjectType/equalsFunctionOrMethodDeclaration.d.ts +11 -0
- package/generators/ts/_ObjectType/equalsFunctionOrMethodDeclaration.js +70 -0
- package/generators/ts/_ObjectType/fromJsonFunctionDeclarations.d.ts +4 -0
- package/generators/ts/_ObjectType/fromJsonFunctionDeclarations.js +78 -0
- package/generators/ts/_ObjectType/fromRdfFunctionDeclarations.d.ts +4 -0
- package/generators/ts/_ObjectType/fromRdfFunctionDeclarations.js +91 -0
- package/generators/ts/_ObjectType/hashFunctionDeclaration.d.ts +3 -3
- package/generators/ts/_ObjectType/hashFunctionDeclaration.js +11 -55
- package/generators/ts/_ObjectType/hashFunctionOrMethodDeclaration.d.ts +11 -0
- package/generators/ts/_ObjectType/hashFunctionOrMethodDeclaration.js +64 -0
- package/generators/ts/_ObjectType/index.d.ts +8 -2
- package/generators/ts/_ObjectType/index.js +8 -2
- package/generators/ts/_ObjectType/interfaceDeclaration.d.ts +3 -2
- package/generators/ts/_ObjectType/interfaceDeclaration.js +11 -2
- package/generators/ts/_ObjectType/jsonSchemaFunctionDeclaration.d.ts +5 -0
- package/generators/ts/_ObjectType/jsonSchemaFunctionDeclaration.js +19 -0
- package/generators/ts/_ObjectType/jsonUiSchemaFunctionDeclaration.d.ts +5 -0
- package/generators/ts/_ObjectType/jsonUiSchemaFunctionDeclaration.js +31 -0
- package/generators/ts/_ObjectType/jsonZodSchemaFunctionDeclaration.d.ts +5 -0
- package/generators/ts/_ObjectType/jsonZodSchemaFunctionDeclaration.js +37 -0
- package/generators/ts/_ObjectType/rdfjsTermExpression.d.ts +6 -0
- package/generators/ts/{rdfjsTermExpression.js → _ObjectType/rdfjsTermExpression.js} +3 -1
- package/generators/ts/_ObjectType/sparqlConstructQueryFunctionDeclaration.d.ts +5 -0
- package/generators/ts/_ObjectType/sparqlConstructQueryFunctionDeclaration.js +21 -0
- package/generators/ts/_ObjectType/sparqlConstructQueryStringFunctionDeclaration.d.ts +5 -0
- package/generators/ts/_ObjectType/sparqlConstructQueryStringFunctionDeclaration.js +20 -0
- package/generators/ts/_ObjectType/sparqlFunctionDeclarations.d.ts +4 -0
- package/generators/ts/_ObjectType/sparqlFunctionDeclarations.js +78 -0
- package/generators/ts/_ObjectType/toJsonFunctionDeclaration.d.ts +5 -0
- package/generators/ts/_ObjectType/toJsonFunctionDeclaration.js +19 -0
- package/generators/ts/_ObjectType/toJsonFunctionOrMethodDeclaration.d.ts +10 -0
- package/generators/ts/_ObjectType/toJsonFunctionOrMethodDeclaration.js +59 -0
- package/generators/ts/_ObjectType/toJsonReturnType.d.ts +3 -0
- package/generators/ts/_ObjectType/toJsonReturnType.js +19 -0
- package/generators/ts/_ObjectType/toRdfFunctionDeclaration.d.ts +3 -2
- package/generators/ts/_ObjectType/toRdfFunctionDeclaration.js +11 -45
- package/generators/ts/_ObjectType/toRdfFunctionOrMethodDeclaration.d.ts +10 -0
- package/generators/ts/_ObjectType/toRdfFunctionOrMethodDeclaration.js +67 -0
- package/generators/ts/objectInitializer.d.ts +2 -0
- package/generators/ts/objectInitializer.js +14 -0
- package/generators/ts/tsComment.d.ts +5 -0
- package/generators/ts/tsComment.js +11 -0
- package/generators/ts/tsName.d.ts +1 -1
- package/generators/ts/tsName.js +1 -0
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/input/NodeShape.d.ts +46 -0
- package/input/NodeShape.js +165 -0
- package/input/Ontology.d.ts +13 -0
- package/input/Ontology.js +30 -0
- package/input/PropertyShape.d.ts +15 -0
- package/input/PropertyShape.js +34 -0
- package/input/Shape.d.ts +4 -0
- package/input/Shape.js +2 -0
- package/input/ShapesGraph.d.ts +9 -0
- package/input/ShapesGraph.js +50 -0
- package/input/ancestorClassIris.d.ts +4 -0
- package/input/ancestorClassIris.js +21 -0
- package/input/descendantClassIris.d.ts +4 -0
- package/input/descendantClassIris.js +21 -0
- package/input/generated.d.ts +275 -0
- package/input/generated.js +1436 -0
- package/input/index.d.ts +7 -0
- package/input/index.js +7 -0
- package/input/tsFeatures.d.ts +10 -0
- package/input/tsFeatures.js +46 -0
- package/package.json +15 -9
- package/ast/MintingStrategy.d.ts +0 -8
- package/ast/MintingStrategy.js +0 -9
- package/generators/ts/Configuration.d.ts +0 -29
- package/generators/ts/Configuration.js +0 -40
- package/generators/ts/IntersectionType.d.ts +0 -14
- package/generators/ts/IntersectionType.js +0 -26
- package/generators/ts/RdfjsTermType.d.ts +0 -25
- package/generators/ts/RdfjsTermType.js +0 -46
- package/generators/ts/_ObjectType/fromRdfFunctionDeclaration.d.ts +0 -4
- package/generators/ts/_ObjectType/fromRdfFunctionDeclaration.js +0 -72
- package/generators/ts/_ObjectType/sparqlGraphPatternsClassDeclaration.d.ts +0 -4
- package/generators/ts/_ObjectType/sparqlGraphPatternsClassDeclaration.js +0 -46
- package/generators/ts/rdfjsTermExpression.d.ts +0 -5
- package/vocabularies/dashDataset.d.ts +0 -3
- package/vocabularies/dashDataset.js +0 -2370
- package/vocabularies/index.d.ts +0 -2
- package/vocabularies/index.js +0 -2
- package/vocabularies/shaclmate.d.ts +0 -15
- package/vocabularies/shaclmate.js +0 -6
|
@@ -0,0 +1,1436 @@
|
|
|
1
|
+
import { PropertyPath } from "@shaclmate/shacl-ast/PropertyPath.js";
|
|
2
|
+
import { DataFactory as dataFactory } from "n3";
|
|
3
|
+
import * as purify from "purify-ts";
|
|
4
|
+
import * as rdfjsResource from "rdfjs-resource";
|
|
5
|
+
export var BaseShaclCoreShape;
|
|
6
|
+
(function (BaseShaclCoreShape) {
|
|
7
|
+
function propertiesFromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource,
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
..._context }) {
|
|
10
|
+
const _andEither = purify.Either.of([
|
|
11
|
+
..._resource
|
|
12
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#and"), {
|
|
13
|
+
unique: true,
|
|
14
|
+
})
|
|
15
|
+
.flatMap((_item) => _item
|
|
16
|
+
.toValues()
|
|
17
|
+
.head()
|
|
18
|
+
.chain((value) => value.toList())
|
|
19
|
+
.map((values) => values.flatMap((_value) => _value
|
|
20
|
+
.toValues()
|
|
21
|
+
.head()
|
|
22
|
+
.chain((_value) => _value.toIdentifier())
|
|
23
|
+
.toMaybe()
|
|
24
|
+
.toList()))
|
|
25
|
+
.toMaybe()
|
|
26
|
+
.toList()),
|
|
27
|
+
]);
|
|
28
|
+
if (_andEither.isLeft()) {
|
|
29
|
+
return _andEither;
|
|
30
|
+
}
|
|
31
|
+
const and = _andEither.unsafeCoerce();
|
|
32
|
+
const _classesEither = purify.Either.of([
|
|
33
|
+
..._resource
|
|
34
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#class"), {
|
|
35
|
+
unique: true,
|
|
36
|
+
})
|
|
37
|
+
.flatMap((_item) => _item
|
|
38
|
+
.toValues()
|
|
39
|
+
.head()
|
|
40
|
+
.chain((_value) => _value.toIri())
|
|
41
|
+
.toMaybe()
|
|
42
|
+
.toList()),
|
|
43
|
+
]);
|
|
44
|
+
if (_classesEither.isLeft()) {
|
|
45
|
+
return _classesEither;
|
|
46
|
+
}
|
|
47
|
+
const classes = _classesEither.unsafeCoerce();
|
|
48
|
+
const _commentsEither = purify.Either.of([
|
|
49
|
+
..._resource
|
|
50
|
+
.values(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), { unique: true })
|
|
51
|
+
.flatMap((_item) => _item
|
|
52
|
+
.toValues()
|
|
53
|
+
.filter((_value) => {
|
|
54
|
+
const _languageInOrDefault = _languageIn ?? [];
|
|
55
|
+
if (_languageInOrDefault.length === 0) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
const _valueLiteral = _value.toLiteral().toMaybe().extract();
|
|
59
|
+
if (typeof _valueLiteral === "undefined") {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
|
|
63
|
+
})
|
|
64
|
+
.head()
|
|
65
|
+
.chain((_value) => _value.toLiteral())
|
|
66
|
+
.toMaybe()
|
|
67
|
+
.toList()),
|
|
68
|
+
]);
|
|
69
|
+
if (_commentsEither.isLeft()) {
|
|
70
|
+
return _commentsEither;
|
|
71
|
+
}
|
|
72
|
+
const comments = _commentsEither.unsafeCoerce();
|
|
73
|
+
const _datatypeEither = purify.Either.of(_resource
|
|
74
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#datatype"), {
|
|
75
|
+
unique: true,
|
|
76
|
+
})
|
|
77
|
+
.head()
|
|
78
|
+
.chain((_value) => _value.toIri())
|
|
79
|
+
.toMaybe());
|
|
80
|
+
if (_datatypeEither.isLeft()) {
|
|
81
|
+
return _datatypeEither;
|
|
82
|
+
}
|
|
83
|
+
const datatype = _datatypeEither.unsafeCoerce();
|
|
84
|
+
const _deactivatedEither = purify.Either.of(_resource
|
|
85
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"), { unique: true })
|
|
86
|
+
.head()
|
|
87
|
+
.chain((_value) => _value.toBoolean())
|
|
88
|
+
.toMaybe());
|
|
89
|
+
if (_deactivatedEither.isLeft()) {
|
|
90
|
+
return _deactivatedEither;
|
|
91
|
+
}
|
|
92
|
+
const deactivated = _deactivatedEither.unsafeCoerce();
|
|
93
|
+
const _flagsEither = purify.Either.of([
|
|
94
|
+
..._resource
|
|
95
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#flags"), {
|
|
96
|
+
unique: true,
|
|
97
|
+
})
|
|
98
|
+
.flatMap((_item) => _item
|
|
99
|
+
.toValues()
|
|
100
|
+
.head()
|
|
101
|
+
.chain((_value) => _value.toString())
|
|
102
|
+
.toMaybe()
|
|
103
|
+
.toList()),
|
|
104
|
+
]);
|
|
105
|
+
if (_flagsEither.isLeft()) {
|
|
106
|
+
return _flagsEither;
|
|
107
|
+
}
|
|
108
|
+
const flags = _flagsEither.unsafeCoerce();
|
|
109
|
+
const _hasValuesEither = purify.Either.of([
|
|
110
|
+
..._resource
|
|
111
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#hasValue"), {
|
|
112
|
+
unique: true,
|
|
113
|
+
})
|
|
114
|
+
.flatMap((_item) => _item
|
|
115
|
+
.toValues()
|
|
116
|
+
.head()
|
|
117
|
+
.chain((_value) => purify.Either.of(_value.toTerm()))
|
|
118
|
+
.toMaybe()
|
|
119
|
+
.toList()),
|
|
120
|
+
]);
|
|
121
|
+
if (_hasValuesEither.isLeft()) {
|
|
122
|
+
return _hasValuesEither;
|
|
123
|
+
}
|
|
124
|
+
const hasValues = _hasValuesEither.unsafeCoerce();
|
|
125
|
+
const identifier = _resource.identifier;
|
|
126
|
+
const _in_Either = purify.Either.of(_resource
|
|
127
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#in"), {
|
|
128
|
+
unique: true,
|
|
129
|
+
})
|
|
130
|
+
.head()
|
|
131
|
+
.chain((value) => value.toList())
|
|
132
|
+
.map((values) => values.flatMap((_value) => _value
|
|
133
|
+
.toValues()
|
|
134
|
+
.head()
|
|
135
|
+
.chain((_value) => purify.Either.of(_value.toTerm()))
|
|
136
|
+
.toMaybe()
|
|
137
|
+
.toList()))
|
|
138
|
+
.toMaybe());
|
|
139
|
+
if (_in_Either.isLeft()) {
|
|
140
|
+
return _in_Either;
|
|
141
|
+
}
|
|
142
|
+
const in_ = _in_Either.unsafeCoerce();
|
|
143
|
+
const _isDefinedByEither = purify.Either.of(_resource
|
|
144
|
+
.values(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"), { unique: true })
|
|
145
|
+
.head()
|
|
146
|
+
.chain((_value) => _value.toIdentifier())
|
|
147
|
+
.toMaybe());
|
|
148
|
+
if (_isDefinedByEither.isLeft()) {
|
|
149
|
+
return _isDefinedByEither;
|
|
150
|
+
}
|
|
151
|
+
const isDefinedBy = _isDefinedByEither.unsafeCoerce();
|
|
152
|
+
const _labelsEither = purify.Either.of([
|
|
153
|
+
..._resource
|
|
154
|
+
.values(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), { unique: true })
|
|
155
|
+
.flatMap((_item) => _item
|
|
156
|
+
.toValues()
|
|
157
|
+
.filter((_value) => {
|
|
158
|
+
const _languageInOrDefault = _languageIn ?? [];
|
|
159
|
+
if (_languageInOrDefault.length === 0) {
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
const _valueLiteral = _value.toLiteral().toMaybe().extract();
|
|
163
|
+
if (typeof _valueLiteral === "undefined") {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
|
|
167
|
+
})
|
|
168
|
+
.head()
|
|
169
|
+
.chain((_value) => _value.toLiteral())
|
|
170
|
+
.toMaybe()
|
|
171
|
+
.toList()),
|
|
172
|
+
]);
|
|
173
|
+
if (_labelsEither.isLeft()) {
|
|
174
|
+
return _labelsEither;
|
|
175
|
+
}
|
|
176
|
+
const labels = _labelsEither.unsafeCoerce();
|
|
177
|
+
const _languageInEither = purify.Either.of(_resource
|
|
178
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#languageIn"), { unique: true })
|
|
179
|
+
.head()
|
|
180
|
+
.chain((value) => value.toList())
|
|
181
|
+
.map((values) => values.flatMap((_value) => _value
|
|
182
|
+
.toValues()
|
|
183
|
+
.head()
|
|
184
|
+
.chain((_value) => _value.toString())
|
|
185
|
+
.toMaybe()
|
|
186
|
+
.toList()))
|
|
187
|
+
.toMaybe());
|
|
188
|
+
if (_languageInEither.isLeft()) {
|
|
189
|
+
return _languageInEither;
|
|
190
|
+
}
|
|
191
|
+
const languageIn = _languageInEither.unsafeCoerce();
|
|
192
|
+
const _maxCountEither = purify.Either.of(_resource
|
|
193
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxCount"), {
|
|
194
|
+
unique: true,
|
|
195
|
+
})
|
|
196
|
+
.head()
|
|
197
|
+
.chain((_value) => _value.toNumber())
|
|
198
|
+
.toMaybe());
|
|
199
|
+
if (_maxCountEither.isLeft()) {
|
|
200
|
+
return _maxCountEither;
|
|
201
|
+
}
|
|
202
|
+
const maxCount = _maxCountEither.unsafeCoerce();
|
|
203
|
+
const _maxExclusiveEither = purify.Either.of(_resource
|
|
204
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxExclusive"), { unique: true })
|
|
205
|
+
.filter((_value) => {
|
|
206
|
+
const _languageInOrDefault = _languageIn ?? [];
|
|
207
|
+
if (_languageInOrDefault.length === 0) {
|
|
208
|
+
return true;
|
|
209
|
+
}
|
|
210
|
+
const _valueLiteral = _value.toLiteral().toMaybe().extract();
|
|
211
|
+
if (typeof _valueLiteral === "undefined") {
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
|
|
215
|
+
})
|
|
216
|
+
.head()
|
|
217
|
+
.chain((_value) => _value.toLiteral())
|
|
218
|
+
.toMaybe());
|
|
219
|
+
if (_maxExclusiveEither.isLeft()) {
|
|
220
|
+
return _maxExclusiveEither;
|
|
221
|
+
}
|
|
222
|
+
const maxExclusive = _maxExclusiveEither.unsafeCoerce();
|
|
223
|
+
const _maxInclusiveEither = purify.Either.of(_resource
|
|
224
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxInclusive"), { unique: true })
|
|
225
|
+
.filter((_value) => {
|
|
226
|
+
const _languageInOrDefault = _languageIn ?? [];
|
|
227
|
+
if (_languageInOrDefault.length === 0) {
|
|
228
|
+
return true;
|
|
229
|
+
}
|
|
230
|
+
const _valueLiteral = _value.toLiteral().toMaybe().extract();
|
|
231
|
+
if (typeof _valueLiteral === "undefined") {
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
|
|
235
|
+
})
|
|
236
|
+
.head()
|
|
237
|
+
.chain((_value) => _value.toLiteral())
|
|
238
|
+
.toMaybe());
|
|
239
|
+
if (_maxInclusiveEither.isLeft()) {
|
|
240
|
+
return _maxInclusiveEither;
|
|
241
|
+
}
|
|
242
|
+
const maxInclusive = _maxInclusiveEither.unsafeCoerce();
|
|
243
|
+
const _maxLengthEither = purify.Either.of(_resource
|
|
244
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxLength"), {
|
|
245
|
+
unique: true,
|
|
246
|
+
})
|
|
247
|
+
.head()
|
|
248
|
+
.chain((_value) => _value.toNumber())
|
|
249
|
+
.toMaybe());
|
|
250
|
+
if (_maxLengthEither.isLeft()) {
|
|
251
|
+
return _maxLengthEither;
|
|
252
|
+
}
|
|
253
|
+
const maxLength = _maxLengthEither.unsafeCoerce();
|
|
254
|
+
const _minCountEither = purify.Either.of(_resource
|
|
255
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#minCount"), {
|
|
256
|
+
unique: true,
|
|
257
|
+
})
|
|
258
|
+
.head()
|
|
259
|
+
.chain((_value) => _value.toNumber())
|
|
260
|
+
.toMaybe());
|
|
261
|
+
if (_minCountEither.isLeft()) {
|
|
262
|
+
return _minCountEither;
|
|
263
|
+
}
|
|
264
|
+
const minCount = _minCountEither.unsafeCoerce();
|
|
265
|
+
const _minExclusiveEither = purify.Either.of(_resource
|
|
266
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#minExclusive"), { unique: true })
|
|
267
|
+
.filter((_value) => {
|
|
268
|
+
const _languageInOrDefault = _languageIn ?? [];
|
|
269
|
+
if (_languageInOrDefault.length === 0) {
|
|
270
|
+
return true;
|
|
271
|
+
}
|
|
272
|
+
const _valueLiteral = _value.toLiteral().toMaybe().extract();
|
|
273
|
+
if (typeof _valueLiteral === "undefined") {
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
|
|
277
|
+
})
|
|
278
|
+
.head()
|
|
279
|
+
.chain((_value) => _value.toLiteral())
|
|
280
|
+
.toMaybe());
|
|
281
|
+
if (_minExclusiveEither.isLeft()) {
|
|
282
|
+
return _minExclusiveEither;
|
|
283
|
+
}
|
|
284
|
+
const minExclusive = _minExclusiveEither.unsafeCoerce();
|
|
285
|
+
const _minInclusiveEither = purify.Either.of(_resource
|
|
286
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#minInclusive"), { unique: true })
|
|
287
|
+
.filter((_value) => {
|
|
288
|
+
const _languageInOrDefault = _languageIn ?? [];
|
|
289
|
+
if (_languageInOrDefault.length === 0) {
|
|
290
|
+
return true;
|
|
291
|
+
}
|
|
292
|
+
const _valueLiteral = _value.toLiteral().toMaybe().extract();
|
|
293
|
+
if (typeof _valueLiteral === "undefined") {
|
|
294
|
+
return false;
|
|
295
|
+
}
|
|
296
|
+
return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
|
|
297
|
+
})
|
|
298
|
+
.head()
|
|
299
|
+
.chain((_value) => _value.toLiteral())
|
|
300
|
+
.toMaybe());
|
|
301
|
+
if (_minInclusiveEither.isLeft()) {
|
|
302
|
+
return _minInclusiveEither;
|
|
303
|
+
}
|
|
304
|
+
const minInclusive = _minInclusiveEither.unsafeCoerce();
|
|
305
|
+
const _minLengthEither = purify.Either.of(_resource
|
|
306
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#minLength"), {
|
|
307
|
+
unique: true,
|
|
308
|
+
})
|
|
309
|
+
.head()
|
|
310
|
+
.chain((_value) => _value.toNumber())
|
|
311
|
+
.toMaybe());
|
|
312
|
+
if (_minLengthEither.isLeft()) {
|
|
313
|
+
return _minLengthEither;
|
|
314
|
+
}
|
|
315
|
+
const minLength = _minLengthEither.unsafeCoerce();
|
|
316
|
+
const _nodeKindEither = purify.Either.of(_resource
|
|
317
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"), {
|
|
318
|
+
unique: true,
|
|
319
|
+
})
|
|
320
|
+
.head()
|
|
321
|
+
.chain((_value) => _value.toIri().chain((iri) => {
|
|
322
|
+
switch (iri.value) {
|
|
323
|
+
case "http://www.w3.org/ns/shacl#BlankNode":
|
|
324
|
+
return purify.Either.of(iri);
|
|
325
|
+
case "http://www.w3.org/ns/shacl#BlankNodeOrIRI":
|
|
326
|
+
return purify.Either.of(iri);
|
|
327
|
+
case "http://www.w3.org/ns/shacl#BlankNodeOrLiteral":
|
|
328
|
+
return purify.Either.of(iri);
|
|
329
|
+
case "http://www.w3.org/ns/shacl#IRI":
|
|
330
|
+
return purify.Either.of(iri);
|
|
331
|
+
case "http://www.w3.org/ns/shacl#IRIOrLiteral":
|
|
332
|
+
return purify.Either.of(iri);
|
|
333
|
+
case "http://www.w3.org/ns/shacl#Literal":
|
|
334
|
+
return purify.Either.of(iri);
|
|
335
|
+
default:
|
|
336
|
+
return purify.Left(new rdfjsResource.Resource.MistypedValueError({
|
|
337
|
+
actualValue: iri,
|
|
338
|
+
expectedValueType: 'rdfjs.NamedNode<"http://www.w3.org/ns/shacl#BlankNode" | "http://www.w3.org/ns/shacl#BlankNodeOrIRI" | "http://www.w3.org/ns/shacl#BlankNodeOrLiteral" | "http://www.w3.org/ns/shacl#IRI" | "http://www.w3.org/ns/shacl#IRIOrLiteral" | "http://www.w3.org/ns/shacl#Literal">',
|
|
339
|
+
focusResource: _resource,
|
|
340
|
+
predicate: dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"),
|
|
341
|
+
}));
|
|
342
|
+
}
|
|
343
|
+
}))
|
|
344
|
+
.toMaybe());
|
|
345
|
+
if (_nodeKindEither.isLeft()) {
|
|
346
|
+
return _nodeKindEither;
|
|
347
|
+
}
|
|
348
|
+
const nodeKind = _nodeKindEither.unsafeCoerce();
|
|
349
|
+
const _nodesEither = purify.Either.of([
|
|
350
|
+
..._resource
|
|
351
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#node"), {
|
|
352
|
+
unique: true,
|
|
353
|
+
})
|
|
354
|
+
.flatMap((_item) => _item
|
|
355
|
+
.toValues()
|
|
356
|
+
.head()
|
|
357
|
+
.chain((_value) => _value.toIdentifier())
|
|
358
|
+
.toMaybe()
|
|
359
|
+
.toList()),
|
|
360
|
+
]);
|
|
361
|
+
if (_nodesEither.isLeft()) {
|
|
362
|
+
return _nodesEither;
|
|
363
|
+
}
|
|
364
|
+
const nodes = _nodesEither.unsafeCoerce();
|
|
365
|
+
const _notEither = purify.Either.of([
|
|
366
|
+
..._resource
|
|
367
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#not"), {
|
|
368
|
+
unique: true,
|
|
369
|
+
})
|
|
370
|
+
.flatMap((_item) => _item
|
|
371
|
+
.toValues()
|
|
372
|
+
.head()
|
|
373
|
+
.chain((_value) => _value.toIdentifier())
|
|
374
|
+
.toMaybe()
|
|
375
|
+
.toList()),
|
|
376
|
+
]);
|
|
377
|
+
if (_notEither.isLeft()) {
|
|
378
|
+
return _notEither;
|
|
379
|
+
}
|
|
380
|
+
const not = _notEither.unsafeCoerce();
|
|
381
|
+
const _orEither = purify.Either.of([
|
|
382
|
+
..._resource
|
|
383
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#or"), {
|
|
384
|
+
unique: true,
|
|
385
|
+
})
|
|
386
|
+
.flatMap((_item) => _item
|
|
387
|
+
.toValues()
|
|
388
|
+
.head()
|
|
389
|
+
.chain((value) => value.toList())
|
|
390
|
+
.map((values) => values.flatMap((_value) => _value
|
|
391
|
+
.toValues()
|
|
392
|
+
.head()
|
|
393
|
+
.chain((_value) => _value.toIdentifier())
|
|
394
|
+
.toMaybe()
|
|
395
|
+
.toList()))
|
|
396
|
+
.toMaybe()
|
|
397
|
+
.toList()),
|
|
398
|
+
]);
|
|
399
|
+
if (_orEither.isLeft()) {
|
|
400
|
+
return _orEither;
|
|
401
|
+
}
|
|
402
|
+
const or = _orEither.unsafeCoerce();
|
|
403
|
+
const _patternsEither = purify.Either.of([
|
|
404
|
+
..._resource
|
|
405
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#pattern"), {
|
|
406
|
+
unique: true,
|
|
407
|
+
})
|
|
408
|
+
.flatMap((_item) => _item
|
|
409
|
+
.toValues()
|
|
410
|
+
.head()
|
|
411
|
+
.chain((_value) => _value.toString())
|
|
412
|
+
.toMaybe()
|
|
413
|
+
.toList()),
|
|
414
|
+
]);
|
|
415
|
+
if (_patternsEither.isLeft()) {
|
|
416
|
+
return _patternsEither;
|
|
417
|
+
}
|
|
418
|
+
const patterns = _patternsEither.unsafeCoerce();
|
|
419
|
+
const _xoneEither = purify.Either.of([
|
|
420
|
+
..._resource
|
|
421
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#xone"), {
|
|
422
|
+
unique: true,
|
|
423
|
+
})
|
|
424
|
+
.flatMap((_item) => _item
|
|
425
|
+
.toValues()
|
|
426
|
+
.head()
|
|
427
|
+
.chain((value) => value.toList())
|
|
428
|
+
.map((values) => values.flatMap((_value) => _value
|
|
429
|
+
.toValues()
|
|
430
|
+
.head()
|
|
431
|
+
.chain((_value) => _value.toIdentifier())
|
|
432
|
+
.toMaybe()
|
|
433
|
+
.toList()))
|
|
434
|
+
.toMaybe()
|
|
435
|
+
.toList()),
|
|
436
|
+
]);
|
|
437
|
+
if (_xoneEither.isLeft()) {
|
|
438
|
+
return _xoneEither;
|
|
439
|
+
}
|
|
440
|
+
const xone = _xoneEither.unsafeCoerce();
|
|
441
|
+
return purify.Either.of({
|
|
442
|
+
and,
|
|
443
|
+
classes,
|
|
444
|
+
comments,
|
|
445
|
+
datatype,
|
|
446
|
+
deactivated,
|
|
447
|
+
flags,
|
|
448
|
+
hasValues,
|
|
449
|
+
identifier,
|
|
450
|
+
in_,
|
|
451
|
+
isDefinedBy,
|
|
452
|
+
labels,
|
|
453
|
+
languageIn,
|
|
454
|
+
maxCount,
|
|
455
|
+
maxExclusive,
|
|
456
|
+
maxInclusive,
|
|
457
|
+
maxLength,
|
|
458
|
+
minCount,
|
|
459
|
+
minExclusive,
|
|
460
|
+
minInclusive,
|
|
461
|
+
minLength,
|
|
462
|
+
nodeKind,
|
|
463
|
+
nodes,
|
|
464
|
+
not,
|
|
465
|
+
or,
|
|
466
|
+
patterns,
|
|
467
|
+
xone,
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
BaseShaclCoreShape.propertiesFromRdf = propertiesFromRdf;
|
|
471
|
+
})(BaseShaclCoreShape || (BaseShaclCoreShape = {}));
|
|
472
|
+
export var ShaclCorePropertyShape;
|
|
473
|
+
(function (ShaclCorePropertyShape) {
|
|
474
|
+
function propertiesFromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource,
|
|
475
|
+
// @ts-ignore
|
|
476
|
+
..._context }) {
|
|
477
|
+
const _super0Either = BaseShaclCoreShape.propertiesFromRdf({
|
|
478
|
+
..._context,
|
|
479
|
+
ignoreRdfType: true,
|
|
480
|
+
languageIn: _languageIn,
|
|
481
|
+
resource: _resource,
|
|
482
|
+
});
|
|
483
|
+
if (_super0Either.isLeft()) {
|
|
484
|
+
return _super0Either;
|
|
485
|
+
}
|
|
486
|
+
const _super0 = _super0Either.unsafeCoerce();
|
|
487
|
+
if (!_ignoreRdfType &&
|
|
488
|
+
!_resource.isInstanceOf(dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"))) {
|
|
489
|
+
return purify.Left(new rdfjsResource.Resource.ValueError({
|
|
490
|
+
focusResource: _resource,
|
|
491
|
+
message: `${rdfjsResource.Resource.Identifier.toString(_resource.identifier)} has unexpected RDF type`,
|
|
492
|
+
predicate: dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"),
|
|
493
|
+
}));
|
|
494
|
+
}
|
|
495
|
+
const _defaultValueEither = purify.Either.of(_resource
|
|
496
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#defaultValue"), { unique: true })
|
|
497
|
+
.head()
|
|
498
|
+
.chain((_value) => purify.Either.of(_value.toTerm()))
|
|
499
|
+
.toMaybe());
|
|
500
|
+
if (_defaultValueEither.isLeft()) {
|
|
501
|
+
return _defaultValueEither;
|
|
502
|
+
}
|
|
503
|
+
const defaultValue = _defaultValueEither.unsafeCoerce();
|
|
504
|
+
const _descriptionsEither = purify.Either.of([
|
|
505
|
+
..._resource
|
|
506
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#description"), { unique: true })
|
|
507
|
+
.flatMap((_item) => _item
|
|
508
|
+
.toValues()
|
|
509
|
+
.filter((_value) => {
|
|
510
|
+
const _languageInOrDefault = _languageIn ?? [];
|
|
511
|
+
if (_languageInOrDefault.length === 0) {
|
|
512
|
+
return true;
|
|
513
|
+
}
|
|
514
|
+
const _valueLiteral = _value.toLiteral().toMaybe().extract();
|
|
515
|
+
if (typeof _valueLiteral === "undefined") {
|
|
516
|
+
return false;
|
|
517
|
+
}
|
|
518
|
+
return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
|
|
519
|
+
})
|
|
520
|
+
.head()
|
|
521
|
+
.chain((_value) => _value.toLiteral())
|
|
522
|
+
.toMaybe()
|
|
523
|
+
.toList()),
|
|
524
|
+
]);
|
|
525
|
+
if (_descriptionsEither.isLeft()) {
|
|
526
|
+
return _descriptionsEither;
|
|
527
|
+
}
|
|
528
|
+
const descriptions = _descriptionsEither.unsafeCoerce();
|
|
529
|
+
const _groupsEither = purify.Either.of([
|
|
530
|
+
..._resource
|
|
531
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#group"), {
|
|
532
|
+
unique: true,
|
|
533
|
+
})
|
|
534
|
+
.flatMap((_item) => _item
|
|
535
|
+
.toValues()
|
|
536
|
+
.head()
|
|
537
|
+
.chain((_value) => _value.toIdentifier())
|
|
538
|
+
.toMaybe()
|
|
539
|
+
.toList()),
|
|
540
|
+
]);
|
|
541
|
+
if (_groupsEither.isLeft()) {
|
|
542
|
+
return _groupsEither;
|
|
543
|
+
}
|
|
544
|
+
const groups = _groupsEither.unsafeCoerce();
|
|
545
|
+
const identifier = _resource.identifier;
|
|
546
|
+
const _namesEither = purify.Either.of([
|
|
547
|
+
..._resource
|
|
548
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#name"), {
|
|
549
|
+
unique: true,
|
|
550
|
+
})
|
|
551
|
+
.flatMap((_item) => _item
|
|
552
|
+
.toValues()
|
|
553
|
+
.filter((_value) => {
|
|
554
|
+
const _languageInOrDefault = _languageIn ?? [];
|
|
555
|
+
if (_languageInOrDefault.length === 0) {
|
|
556
|
+
return true;
|
|
557
|
+
}
|
|
558
|
+
const _valueLiteral = _value.toLiteral().toMaybe().extract();
|
|
559
|
+
if (typeof _valueLiteral === "undefined") {
|
|
560
|
+
return false;
|
|
561
|
+
}
|
|
562
|
+
return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
|
|
563
|
+
})
|
|
564
|
+
.head()
|
|
565
|
+
.chain((_value) => _value.toLiteral())
|
|
566
|
+
.toMaybe()
|
|
567
|
+
.toList()),
|
|
568
|
+
]);
|
|
569
|
+
if (_namesEither.isLeft()) {
|
|
570
|
+
return _namesEither;
|
|
571
|
+
}
|
|
572
|
+
const names = _namesEither.unsafeCoerce();
|
|
573
|
+
const _orderEither = purify.Either.of(_resource
|
|
574
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#order"), {
|
|
575
|
+
unique: true,
|
|
576
|
+
})
|
|
577
|
+
.head()
|
|
578
|
+
.chain((_value) => _value.toNumber())
|
|
579
|
+
.toMaybe());
|
|
580
|
+
if (_orderEither.isLeft()) {
|
|
581
|
+
return _orderEither;
|
|
582
|
+
}
|
|
583
|
+
const order = _orderEither.unsafeCoerce();
|
|
584
|
+
const _pathEither = _resource
|
|
585
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#path"), {
|
|
586
|
+
unique: true,
|
|
587
|
+
})
|
|
588
|
+
.head()
|
|
589
|
+
.chain((value) => value.toResource())
|
|
590
|
+
.chain((_resource) => PropertyPath.fromRdf({
|
|
591
|
+
..._context,
|
|
592
|
+
ignoreRdfType: true,
|
|
593
|
+
languageIn: _languageIn,
|
|
594
|
+
resource: _resource,
|
|
595
|
+
}));
|
|
596
|
+
if (_pathEither.isLeft()) {
|
|
597
|
+
return _pathEither;
|
|
598
|
+
}
|
|
599
|
+
const path = _pathEither.unsafeCoerce();
|
|
600
|
+
const type = "ShaclCorePropertyShape";
|
|
601
|
+
const _uniqueLangEither = purify.Either.of(_resource
|
|
602
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#uniqueLang"), { unique: true })
|
|
603
|
+
.head()
|
|
604
|
+
.chain((_value) => _value.toBoolean())
|
|
605
|
+
.toMaybe());
|
|
606
|
+
if (_uniqueLangEither.isLeft()) {
|
|
607
|
+
return _uniqueLangEither;
|
|
608
|
+
}
|
|
609
|
+
const uniqueLang = _uniqueLangEither.unsafeCoerce();
|
|
610
|
+
return purify.Either.of({
|
|
611
|
+
..._super0,
|
|
612
|
+
defaultValue,
|
|
613
|
+
descriptions,
|
|
614
|
+
groups,
|
|
615
|
+
identifier,
|
|
616
|
+
names,
|
|
617
|
+
order,
|
|
618
|
+
path,
|
|
619
|
+
type,
|
|
620
|
+
uniqueLang,
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
ShaclCorePropertyShape.propertiesFromRdf = propertiesFromRdf;
|
|
624
|
+
function fromRdf(parameters) {
|
|
625
|
+
return ShaclCorePropertyShape.propertiesFromRdf(parameters);
|
|
626
|
+
}
|
|
627
|
+
ShaclCorePropertyShape.fromRdf = fromRdf;
|
|
628
|
+
})(ShaclCorePropertyShape || (ShaclCorePropertyShape = {}));
|
|
629
|
+
export var ShaclmatePropertyShape;
|
|
630
|
+
(function (ShaclmatePropertyShape) {
|
|
631
|
+
function propertiesFromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource,
|
|
632
|
+
// @ts-ignore
|
|
633
|
+
..._context }) {
|
|
634
|
+
const _super0Either = ShaclCorePropertyShape.propertiesFromRdf({
|
|
635
|
+
..._context,
|
|
636
|
+
ignoreRdfType: true,
|
|
637
|
+
languageIn: _languageIn,
|
|
638
|
+
resource: _resource,
|
|
639
|
+
});
|
|
640
|
+
if (_super0Either.isLeft()) {
|
|
641
|
+
return _super0Either;
|
|
642
|
+
}
|
|
643
|
+
const _super0 = _super0Either.unsafeCoerce();
|
|
644
|
+
if (!_ignoreRdfType &&
|
|
645
|
+
!_resource.isInstanceOf(dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"))) {
|
|
646
|
+
return purify.Left(new rdfjsResource.Resource.ValueError({
|
|
647
|
+
focusResource: _resource,
|
|
648
|
+
message: `${rdfjsResource.Resource.Identifier.toString(_resource.identifier)} has unexpected RDF type`,
|
|
649
|
+
predicate: dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"),
|
|
650
|
+
}));
|
|
651
|
+
}
|
|
652
|
+
const _externEither = purify.Either.of(_resource
|
|
653
|
+
.values(dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#extern"), { unique: true })
|
|
654
|
+
.head()
|
|
655
|
+
.chain((_value) => _value.toBoolean())
|
|
656
|
+
.toMaybe());
|
|
657
|
+
if (_externEither.isLeft()) {
|
|
658
|
+
return _externEither;
|
|
659
|
+
}
|
|
660
|
+
const extern = _externEither.unsafeCoerce();
|
|
661
|
+
const identifier = _resource.identifier;
|
|
662
|
+
const _mutableEither = purify.Either.of(_resource
|
|
663
|
+
.values(dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#mutable"), { unique: true })
|
|
664
|
+
.head()
|
|
665
|
+
.chain((_value) => _value.toBoolean())
|
|
666
|
+
.toMaybe());
|
|
667
|
+
if (_mutableEither.isLeft()) {
|
|
668
|
+
return _mutableEither;
|
|
669
|
+
}
|
|
670
|
+
const mutable = _mutableEither.unsafeCoerce();
|
|
671
|
+
const _nameEither = purify.Either.of(_resource
|
|
672
|
+
.values(dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#name"), { unique: true })
|
|
673
|
+
.head()
|
|
674
|
+
.chain((_value) => _value.toString())
|
|
675
|
+
.toMaybe());
|
|
676
|
+
if (_nameEither.isLeft()) {
|
|
677
|
+
return _nameEither;
|
|
678
|
+
}
|
|
679
|
+
const name = _nameEither.unsafeCoerce();
|
|
680
|
+
const type = "ShaclmatePropertyShape";
|
|
681
|
+
const _visibilityEither = purify.Either.of(_resource
|
|
682
|
+
.values(dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#visibility"), { unique: true })
|
|
683
|
+
.head()
|
|
684
|
+
.chain((_value) => _value.toIri().chain((iri) => {
|
|
685
|
+
switch (iri.value) {
|
|
686
|
+
case "http://minorg.github.io/shaclmate/ns#_Visibility_Private":
|
|
687
|
+
return purify.Either.of(iri);
|
|
688
|
+
case "http://minorg.github.io/shaclmate/ns#_Visibility_Protected":
|
|
689
|
+
return purify.Either.of(iri);
|
|
690
|
+
case "http://minorg.github.io/shaclmate/ns#_Visibility_Public":
|
|
691
|
+
return purify.Either.of(iri);
|
|
692
|
+
default:
|
|
693
|
+
return purify.Left(new rdfjsResource.Resource.MistypedValueError({
|
|
694
|
+
actualValue: iri,
|
|
695
|
+
expectedValueType: 'rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_Visibility_Private" | "http://minorg.github.io/shaclmate/ns#_Visibility_Protected" | "http://minorg.github.io/shaclmate/ns#_Visibility_Public">',
|
|
696
|
+
focusResource: _resource,
|
|
697
|
+
predicate: dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#visibility"),
|
|
698
|
+
}));
|
|
699
|
+
}
|
|
700
|
+
}))
|
|
701
|
+
.toMaybe());
|
|
702
|
+
if (_visibilityEither.isLeft()) {
|
|
703
|
+
return _visibilityEither;
|
|
704
|
+
}
|
|
705
|
+
const visibility = _visibilityEither.unsafeCoerce();
|
|
706
|
+
return purify.Either.of({
|
|
707
|
+
..._super0,
|
|
708
|
+
extern,
|
|
709
|
+
identifier,
|
|
710
|
+
mutable,
|
|
711
|
+
name,
|
|
712
|
+
type,
|
|
713
|
+
visibility,
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
ShaclmatePropertyShape.propertiesFromRdf = propertiesFromRdf;
|
|
717
|
+
function fromRdf(parameters) {
|
|
718
|
+
return ShaclmatePropertyShape.propertiesFromRdf(parameters);
|
|
719
|
+
}
|
|
720
|
+
ShaclmatePropertyShape.fromRdf = fromRdf;
|
|
721
|
+
})(ShaclmatePropertyShape || (ShaclmatePropertyShape = {}));
|
|
722
|
+
export var OwlOntology;
|
|
723
|
+
(function (OwlOntology) {
|
|
724
|
+
function propertiesFromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource,
|
|
725
|
+
// @ts-ignore
|
|
726
|
+
..._context }) {
|
|
727
|
+
if (!_ignoreRdfType &&
|
|
728
|
+
!_resource.isInstanceOf(dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"))) {
|
|
729
|
+
return purify.Left(new rdfjsResource.Resource.ValueError({
|
|
730
|
+
focusResource: _resource,
|
|
731
|
+
message: `${rdfjsResource.Resource.Identifier.toString(_resource.identifier)} has unexpected RDF type`,
|
|
732
|
+
predicate: dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"),
|
|
733
|
+
}));
|
|
734
|
+
}
|
|
735
|
+
const identifier = _resource.identifier;
|
|
736
|
+
const _labelsEither = purify.Either.of([
|
|
737
|
+
..._resource
|
|
738
|
+
.values(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), { unique: true })
|
|
739
|
+
.flatMap((_item) => _item
|
|
740
|
+
.toValues()
|
|
741
|
+
.filter((_value) => {
|
|
742
|
+
const _languageInOrDefault = _languageIn ?? [];
|
|
743
|
+
if (_languageInOrDefault.length === 0) {
|
|
744
|
+
return true;
|
|
745
|
+
}
|
|
746
|
+
const _valueLiteral = _value.toLiteral().toMaybe().extract();
|
|
747
|
+
if (typeof _valueLiteral === "undefined") {
|
|
748
|
+
return false;
|
|
749
|
+
}
|
|
750
|
+
return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
|
|
751
|
+
})
|
|
752
|
+
.head()
|
|
753
|
+
.chain((_value) => _value.toLiteral())
|
|
754
|
+
.toMaybe()
|
|
755
|
+
.toList()),
|
|
756
|
+
]);
|
|
757
|
+
if (_labelsEither.isLeft()) {
|
|
758
|
+
return _labelsEither;
|
|
759
|
+
}
|
|
760
|
+
const labels = _labelsEither.unsafeCoerce();
|
|
761
|
+
const type = "OwlOntology";
|
|
762
|
+
return purify.Either.of({ identifier, labels, type });
|
|
763
|
+
}
|
|
764
|
+
OwlOntology.propertiesFromRdf = propertiesFromRdf;
|
|
765
|
+
function fromRdf(parameters) {
|
|
766
|
+
return OwlOntology.propertiesFromRdf(parameters);
|
|
767
|
+
}
|
|
768
|
+
OwlOntology.fromRdf = fromRdf;
|
|
769
|
+
})(OwlOntology || (OwlOntology = {}));
|
|
770
|
+
export var ShaclmateOntology;
|
|
771
|
+
(function (ShaclmateOntology) {
|
|
772
|
+
function propertiesFromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource,
|
|
773
|
+
// @ts-ignore
|
|
774
|
+
..._context }) {
|
|
775
|
+
const _super0Either = OwlOntology.propertiesFromRdf({
|
|
776
|
+
..._context,
|
|
777
|
+
ignoreRdfType: true,
|
|
778
|
+
languageIn: _languageIn,
|
|
779
|
+
resource: _resource,
|
|
780
|
+
});
|
|
781
|
+
if (_super0Either.isLeft()) {
|
|
782
|
+
return _super0Either;
|
|
783
|
+
}
|
|
784
|
+
const _super0 = _super0Either.unsafeCoerce();
|
|
785
|
+
if (!_ignoreRdfType &&
|
|
786
|
+
!_resource.isInstanceOf(dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"))) {
|
|
787
|
+
return purify.Left(new rdfjsResource.Resource.ValueError({
|
|
788
|
+
focusResource: _resource,
|
|
789
|
+
message: `${rdfjsResource.Resource.Identifier.toString(_resource.identifier)} has unexpected RDF type`,
|
|
790
|
+
predicate: dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"),
|
|
791
|
+
}));
|
|
792
|
+
}
|
|
793
|
+
const identifier = _resource.identifier;
|
|
794
|
+
const _tsDataFactoryVariableEither = purify.Either.of(_resource
|
|
795
|
+
.values(dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#tsDataFactoryVariable"), { unique: true })
|
|
796
|
+
.head()
|
|
797
|
+
.chain((_value) => _value.toString())
|
|
798
|
+
.toMaybe());
|
|
799
|
+
if (_tsDataFactoryVariableEither.isLeft()) {
|
|
800
|
+
return _tsDataFactoryVariableEither;
|
|
801
|
+
}
|
|
802
|
+
const tsDataFactoryVariable = _tsDataFactoryVariableEither.unsafeCoerce();
|
|
803
|
+
const _tsFeatureExcludesEither = purify.Either.of([
|
|
804
|
+
..._resource
|
|
805
|
+
.values(dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#tsFeatureExclude"), { unique: true })
|
|
806
|
+
.flatMap((_item) => _item
|
|
807
|
+
.toValues()
|
|
808
|
+
.head()
|
|
809
|
+
.chain((_value) => _value.toIri().chain((iri) => {
|
|
810
|
+
switch (iri.value) {
|
|
811
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_Create":
|
|
812
|
+
return purify.Either.of(iri);
|
|
813
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals":
|
|
814
|
+
return purify.Either.of(iri);
|
|
815
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson":
|
|
816
|
+
return purify.Either.of(iri);
|
|
817
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf":
|
|
818
|
+
return purify.Either.of(iri);
|
|
819
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash":
|
|
820
|
+
return purify.Either.of(iri);
|
|
821
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_Json":
|
|
822
|
+
return purify.Either.of(iri);
|
|
823
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema":
|
|
824
|
+
return purify.Either.of(iri);
|
|
825
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema":
|
|
826
|
+
return purify.Either.of(iri);
|
|
827
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf":
|
|
828
|
+
return purify.Either.of(iri);
|
|
829
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql":
|
|
830
|
+
return purify.Either.of(iri);
|
|
831
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson":
|
|
832
|
+
return purify.Either.of(iri);
|
|
833
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf":
|
|
834
|
+
return purify.Either.of(iri);
|
|
835
|
+
default:
|
|
836
|
+
return purify.Left(new rdfjsResource.Resource.MistypedValueError({
|
|
837
|
+
actualValue: iri,
|
|
838
|
+
expectedValueType: 'rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">',
|
|
839
|
+
focusResource: _resource,
|
|
840
|
+
predicate: dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#tsFeatureExclude"),
|
|
841
|
+
}));
|
|
842
|
+
}
|
|
843
|
+
}))
|
|
844
|
+
.toMaybe()
|
|
845
|
+
.toList()),
|
|
846
|
+
]);
|
|
847
|
+
if (_tsFeatureExcludesEither.isLeft()) {
|
|
848
|
+
return _tsFeatureExcludesEither;
|
|
849
|
+
}
|
|
850
|
+
const tsFeatureExcludes = _tsFeatureExcludesEither.unsafeCoerce();
|
|
851
|
+
const _tsFeatureIncludesEither = purify.Either.of([
|
|
852
|
+
..._resource
|
|
853
|
+
.values(dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#tsFeatureInclude"), { unique: true })
|
|
854
|
+
.flatMap((_item) => _item
|
|
855
|
+
.toValues()
|
|
856
|
+
.head()
|
|
857
|
+
.chain((_value) => _value.toIri().chain((iri) => {
|
|
858
|
+
switch (iri.value) {
|
|
859
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_Create":
|
|
860
|
+
return purify.Either.of(iri);
|
|
861
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals":
|
|
862
|
+
return purify.Either.of(iri);
|
|
863
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson":
|
|
864
|
+
return purify.Either.of(iri);
|
|
865
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf":
|
|
866
|
+
return purify.Either.of(iri);
|
|
867
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_Json":
|
|
868
|
+
return purify.Either.of(iri);
|
|
869
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash":
|
|
870
|
+
return purify.Either.of(iri);
|
|
871
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema":
|
|
872
|
+
return purify.Either.of(iri);
|
|
873
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema":
|
|
874
|
+
return purify.Either.of(iri);
|
|
875
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf":
|
|
876
|
+
return purify.Either.of(iri);
|
|
877
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql":
|
|
878
|
+
return purify.Either.of(iri);
|
|
879
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson":
|
|
880
|
+
return purify.Either.of(iri);
|
|
881
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf":
|
|
882
|
+
return purify.Either.of(iri);
|
|
883
|
+
default:
|
|
884
|
+
return purify.Left(new rdfjsResource.Resource.MistypedValueError({
|
|
885
|
+
actualValue: iri,
|
|
886
|
+
expectedValueType: 'rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">',
|
|
887
|
+
focusResource: _resource,
|
|
888
|
+
predicate: dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#tsFeatureInclude"),
|
|
889
|
+
}));
|
|
890
|
+
}
|
|
891
|
+
}))
|
|
892
|
+
.toMaybe()
|
|
893
|
+
.toList()),
|
|
894
|
+
]);
|
|
895
|
+
if (_tsFeatureIncludesEither.isLeft()) {
|
|
896
|
+
return _tsFeatureIncludesEither;
|
|
897
|
+
}
|
|
898
|
+
const tsFeatureIncludes = _tsFeatureIncludesEither.unsafeCoerce();
|
|
899
|
+
const _tsImportsEither = purify.Either.of([
|
|
900
|
+
..._resource
|
|
901
|
+
.values(dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#tsImport"), { unique: true })
|
|
902
|
+
.flatMap((_item) => _item
|
|
903
|
+
.toValues()
|
|
904
|
+
.head()
|
|
905
|
+
.chain((_value) => _value.toString())
|
|
906
|
+
.toMaybe()
|
|
907
|
+
.toList()),
|
|
908
|
+
]);
|
|
909
|
+
if (_tsImportsEither.isLeft()) {
|
|
910
|
+
return _tsImportsEither;
|
|
911
|
+
}
|
|
912
|
+
const tsImports = _tsImportsEither.unsafeCoerce();
|
|
913
|
+
const _tsObjectDeclarationTypeEither = purify.Either.of(_resource
|
|
914
|
+
.values(dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#tsObjectDeclarationType"), { unique: true })
|
|
915
|
+
.head()
|
|
916
|
+
.chain((_value) => _value.toIri().chain((iri) => {
|
|
917
|
+
switch (iri.value) {
|
|
918
|
+
case "http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Class":
|
|
919
|
+
return purify.Either.of(iri);
|
|
920
|
+
case "http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Interface":
|
|
921
|
+
return purify.Either.of(iri);
|
|
922
|
+
default:
|
|
923
|
+
return purify.Left(new rdfjsResource.Resource.MistypedValueError({
|
|
924
|
+
actualValue: iri,
|
|
925
|
+
expectedValueType: 'rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Class" | "http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Interface">',
|
|
926
|
+
focusResource: _resource,
|
|
927
|
+
predicate: dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#tsObjectDeclarationType"),
|
|
928
|
+
}));
|
|
929
|
+
}
|
|
930
|
+
}))
|
|
931
|
+
.toMaybe());
|
|
932
|
+
if (_tsObjectDeclarationTypeEither.isLeft()) {
|
|
933
|
+
return _tsObjectDeclarationTypeEither;
|
|
934
|
+
}
|
|
935
|
+
const tsObjectDeclarationType = _tsObjectDeclarationTypeEither.unsafeCoerce();
|
|
936
|
+
const _tsObjectIdentifierPropertyNameEither = purify.Either.of(_resource
|
|
937
|
+
.values(dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#tsObjectIdentifierPropertyName"), { unique: true })
|
|
938
|
+
.head()
|
|
939
|
+
.chain((_value) => _value.toString())
|
|
940
|
+
.toMaybe());
|
|
941
|
+
if (_tsObjectIdentifierPropertyNameEither.isLeft()) {
|
|
942
|
+
return _tsObjectIdentifierPropertyNameEither;
|
|
943
|
+
}
|
|
944
|
+
const tsObjectIdentifierPropertyName = _tsObjectIdentifierPropertyNameEither.unsafeCoerce();
|
|
945
|
+
const _tsObjectTypeDiscriminatorPropertyNameEither = purify.Either.of(_resource
|
|
946
|
+
.values(dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#tsObjectTypeDiscriminatorPropertyName"), { unique: true })
|
|
947
|
+
.head()
|
|
948
|
+
.chain((_value) => _value.toString())
|
|
949
|
+
.toMaybe());
|
|
950
|
+
if (_tsObjectTypeDiscriminatorPropertyNameEither.isLeft()) {
|
|
951
|
+
return _tsObjectTypeDiscriminatorPropertyNameEither;
|
|
952
|
+
}
|
|
953
|
+
const tsObjectTypeDiscriminatorPropertyName = _tsObjectTypeDiscriminatorPropertyNameEither.unsafeCoerce();
|
|
954
|
+
const type = "ShaclmateOntology";
|
|
955
|
+
return purify.Either.of({
|
|
956
|
+
..._super0,
|
|
957
|
+
identifier,
|
|
958
|
+
tsDataFactoryVariable,
|
|
959
|
+
tsFeatureExcludes,
|
|
960
|
+
tsFeatureIncludes,
|
|
961
|
+
tsImports,
|
|
962
|
+
tsObjectDeclarationType,
|
|
963
|
+
tsObjectIdentifierPropertyName,
|
|
964
|
+
tsObjectTypeDiscriminatorPropertyName,
|
|
965
|
+
type,
|
|
966
|
+
});
|
|
967
|
+
}
|
|
968
|
+
ShaclmateOntology.propertiesFromRdf = propertiesFromRdf;
|
|
969
|
+
function fromRdf(parameters) {
|
|
970
|
+
return ShaclmateOntology.propertiesFromRdf(parameters);
|
|
971
|
+
}
|
|
972
|
+
ShaclmateOntology.fromRdf = fromRdf;
|
|
973
|
+
})(ShaclmateOntology || (ShaclmateOntology = {}));
|
|
974
|
+
export var ShaclCoreNodeShape;
|
|
975
|
+
(function (ShaclCoreNodeShape) {
|
|
976
|
+
function propertiesFromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource,
|
|
977
|
+
// @ts-ignore
|
|
978
|
+
..._context }) {
|
|
979
|
+
const _super0Either = BaseShaclCoreShape.propertiesFromRdf({
|
|
980
|
+
..._context,
|
|
981
|
+
ignoreRdfType: true,
|
|
982
|
+
languageIn: _languageIn,
|
|
983
|
+
resource: _resource,
|
|
984
|
+
});
|
|
985
|
+
if (_super0Either.isLeft()) {
|
|
986
|
+
return _super0Either;
|
|
987
|
+
}
|
|
988
|
+
const _super0 = _super0Either.unsafeCoerce();
|
|
989
|
+
if (!_ignoreRdfType &&
|
|
990
|
+
!_resource.isInstanceOf(dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape"))) {
|
|
991
|
+
return purify.Left(new rdfjsResource.Resource.ValueError({
|
|
992
|
+
focusResource: _resource,
|
|
993
|
+
message: `${rdfjsResource.Resource.Identifier.toString(_resource.identifier)} has unexpected RDF type`,
|
|
994
|
+
predicate: dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape"),
|
|
995
|
+
}));
|
|
996
|
+
}
|
|
997
|
+
const _closedEither = purify.Either.of(_resource
|
|
998
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#closed"), {
|
|
999
|
+
unique: true,
|
|
1000
|
+
})
|
|
1001
|
+
.head()
|
|
1002
|
+
.chain((_value) => _value.toBoolean())
|
|
1003
|
+
.toMaybe());
|
|
1004
|
+
if (_closedEither.isLeft()) {
|
|
1005
|
+
return _closedEither;
|
|
1006
|
+
}
|
|
1007
|
+
const closed = _closedEither.unsafeCoerce();
|
|
1008
|
+
const identifier = _resource.identifier;
|
|
1009
|
+
const _ignoredPropertiesEither = purify.Either.of(_resource
|
|
1010
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#ignoredProperties"), { unique: true })
|
|
1011
|
+
.head()
|
|
1012
|
+
.chain((value) => value.toList())
|
|
1013
|
+
.map((values) => values.flatMap((_value) => _value
|
|
1014
|
+
.toValues()
|
|
1015
|
+
.head()
|
|
1016
|
+
.chain((_value) => _value.toIri())
|
|
1017
|
+
.toMaybe()
|
|
1018
|
+
.toList()))
|
|
1019
|
+
.toMaybe());
|
|
1020
|
+
if (_ignoredPropertiesEither.isLeft()) {
|
|
1021
|
+
return _ignoredPropertiesEither;
|
|
1022
|
+
}
|
|
1023
|
+
const ignoredProperties = _ignoredPropertiesEither.unsafeCoerce();
|
|
1024
|
+
const _propertiesEither = purify.Either.of([
|
|
1025
|
+
..._resource
|
|
1026
|
+
.values(dataFactory.namedNode("http://www.w3.org/ns/shacl#property"), {
|
|
1027
|
+
unique: true,
|
|
1028
|
+
})
|
|
1029
|
+
.flatMap((_item) => _item
|
|
1030
|
+
.toValues()
|
|
1031
|
+
.head()
|
|
1032
|
+
.chain((_value) => _value.toIdentifier())
|
|
1033
|
+
.toMaybe()
|
|
1034
|
+
.toList()),
|
|
1035
|
+
]);
|
|
1036
|
+
if (_propertiesEither.isLeft()) {
|
|
1037
|
+
return _propertiesEither;
|
|
1038
|
+
}
|
|
1039
|
+
const properties = _propertiesEither.unsafeCoerce();
|
|
1040
|
+
const type = "ShaclCoreNodeShape";
|
|
1041
|
+
return purify.Either.of({
|
|
1042
|
+
..._super0,
|
|
1043
|
+
closed,
|
|
1044
|
+
identifier,
|
|
1045
|
+
ignoredProperties,
|
|
1046
|
+
properties,
|
|
1047
|
+
type,
|
|
1048
|
+
});
|
|
1049
|
+
}
|
|
1050
|
+
ShaclCoreNodeShape.propertiesFromRdf = propertiesFromRdf;
|
|
1051
|
+
function fromRdf(parameters) {
|
|
1052
|
+
return ShaclCoreNodeShape.propertiesFromRdf(parameters);
|
|
1053
|
+
}
|
|
1054
|
+
ShaclCoreNodeShape.fromRdf = fromRdf;
|
|
1055
|
+
})(ShaclCoreNodeShape || (ShaclCoreNodeShape = {}));
|
|
1056
|
+
export var ShaclmateNodeShape;
|
|
1057
|
+
(function (ShaclmateNodeShape) {
|
|
1058
|
+
function propertiesFromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource,
|
|
1059
|
+
// @ts-ignore
|
|
1060
|
+
..._context }) {
|
|
1061
|
+
const _super0Either = ShaclCoreNodeShape.propertiesFromRdf({
|
|
1062
|
+
..._context,
|
|
1063
|
+
ignoreRdfType: true,
|
|
1064
|
+
languageIn: _languageIn,
|
|
1065
|
+
resource: _resource,
|
|
1066
|
+
});
|
|
1067
|
+
if (_super0Either.isLeft()) {
|
|
1068
|
+
return _super0Either;
|
|
1069
|
+
}
|
|
1070
|
+
const _super0 = _super0Either.unsafeCoerce();
|
|
1071
|
+
if (!_ignoreRdfType &&
|
|
1072
|
+
!_resource.isInstanceOf(dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape"))) {
|
|
1073
|
+
return purify.Left(new rdfjsResource.Resource.ValueError({
|
|
1074
|
+
focusResource: _resource,
|
|
1075
|
+
message: `${rdfjsResource.Resource.Identifier.toString(_resource.identifier)} has unexpected RDF type`,
|
|
1076
|
+
predicate: dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape"),
|
|
1077
|
+
}));
|
|
1078
|
+
}
|
|
1079
|
+
const _abstractEither = purify.Either.of(_resource
|
|
1080
|
+
.values(dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#abstract"), { unique: true })
|
|
1081
|
+
.head()
|
|
1082
|
+
.chain((_value) => _value.toBoolean())
|
|
1083
|
+
.toMaybe());
|
|
1084
|
+
if (_abstractEither.isLeft()) {
|
|
1085
|
+
return _abstractEither;
|
|
1086
|
+
}
|
|
1087
|
+
const abstract = _abstractEither.unsafeCoerce();
|
|
1088
|
+
const _export_Either = purify.Either.of(_resource
|
|
1089
|
+
.values(dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#export"), { unique: true })
|
|
1090
|
+
.head()
|
|
1091
|
+
.chain((_value) => _value.toBoolean())
|
|
1092
|
+
.toMaybe());
|
|
1093
|
+
if (_export_Either.isLeft()) {
|
|
1094
|
+
return _export_Either;
|
|
1095
|
+
}
|
|
1096
|
+
const export_ = _export_Either.unsafeCoerce();
|
|
1097
|
+
const _externEither = purify.Either.of(_resource
|
|
1098
|
+
.values(dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#extern"), { unique: true })
|
|
1099
|
+
.head()
|
|
1100
|
+
.chain((_value) => _value.toBoolean())
|
|
1101
|
+
.toMaybe());
|
|
1102
|
+
if (_externEither.isLeft()) {
|
|
1103
|
+
return _externEither;
|
|
1104
|
+
}
|
|
1105
|
+
const extern = _externEither.unsafeCoerce();
|
|
1106
|
+
const _fromRdfTypeEither = purify.Either.of(_resource
|
|
1107
|
+
.values(dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#fromRdfType"), { unique: true })
|
|
1108
|
+
.head()
|
|
1109
|
+
.chain((_value) => _value.toIri())
|
|
1110
|
+
.toMaybe());
|
|
1111
|
+
if (_fromRdfTypeEither.isLeft()) {
|
|
1112
|
+
return _fromRdfTypeEither;
|
|
1113
|
+
}
|
|
1114
|
+
const fromRdfType = _fromRdfTypeEither.unsafeCoerce();
|
|
1115
|
+
const identifier = _resource.identifier;
|
|
1116
|
+
const _mintingStrategyEither = purify.Either.of(_resource
|
|
1117
|
+
.values(dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#mintingStrategy"), { unique: true })
|
|
1118
|
+
.head()
|
|
1119
|
+
.chain((_value) => _value.toIri().chain((iri) => {
|
|
1120
|
+
switch (iri.value) {
|
|
1121
|
+
case "http://minorg.github.io/shaclmate/ns#_MintingStrategy_SHA256":
|
|
1122
|
+
return purify.Either.of(iri);
|
|
1123
|
+
case "http://minorg.github.io/shaclmate/ns#_MintingStrategy_UUIDv4":
|
|
1124
|
+
return purify.Either.of(iri);
|
|
1125
|
+
default:
|
|
1126
|
+
return purify.Left(new rdfjsResource.Resource.MistypedValueError({
|
|
1127
|
+
actualValue: iri,
|
|
1128
|
+
expectedValueType: 'rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_MintingStrategy_SHA256" | "http://minorg.github.io/shaclmate/ns#_MintingStrategy_UUIDv4">',
|
|
1129
|
+
focusResource: _resource,
|
|
1130
|
+
predicate: dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#mintingStrategy"),
|
|
1131
|
+
}));
|
|
1132
|
+
}
|
|
1133
|
+
}))
|
|
1134
|
+
.toMaybe());
|
|
1135
|
+
if (_mintingStrategyEither.isLeft()) {
|
|
1136
|
+
return _mintingStrategyEither;
|
|
1137
|
+
}
|
|
1138
|
+
const mintingStrategy = _mintingStrategyEither.unsafeCoerce();
|
|
1139
|
+
const _mutableEither = purify.Either.of(_resource
|
|
1140
|
+
.values(dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#mutable"), { unique: true })
|
|
1141
|
+
.head()
|
|
1142
|
+
.chain((_value) => _value.toBoolean())
|
|
1143
|
+
.toMaybe());
|
|
1144
|
+
if (_mutableEither.isLeft()) {
|
|
1145
|
+
return _mutableEither;
|
|
1146
|
+
}
|
|
1147
|
+
const mutable = _mutableEither.unsafeCoerce();
|
|
1148
|
+
const _nameEither = purify.Either.of(_resource
|
|
1149
|
+
.values(dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#name"), { unique: true })
|
|
1150
|
+
.head()
|
|
1151
|
+
.chain((_value) => _value.toString())
|
|
1152
|
+
.toMaybe());
|
|
1153
|
+
if (_nameEither.isLeft()) {
|
|
1154
|
+
return _nameEither;
|
|
1155
|
+
}
|
|
1156
|
+
const name = _nameEither.unsafeCoerce();
|
|
1157
|
+
const _toRdfTypesEither = purify.Either.of([
|
|
1158
|
+
..._resource
|
|
1159
|
+
.values(dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#toRdfType"), { unique: true })
|
|
1160
|
+
.flatMap((_item) => _item
|
|
1161
|
+
.toValues()
|
|
1162
|
+
.head()
|
|
1163
|
+
.chain((_value) => _value.toIri())
|
|
1164
|
+
.toMaybe()
|
|
1165
|
+
.toList()),
|
|
1166
|
+
]);
|
|
1167
|
+
if (_toRdfTypesEither.isLeft()) {
|
|
1168
|
+
return _toRdfTypesEither;
|
|
1169
|
+
}
|
|
1170
|
+
const toRdfTypes = _toRdfTypesEither.unsafeCoerce();
|
|
1171
|
+
const _tsFeatureExcludesEither = purify.Either.of([
|
|
1172
|
+
..._resource
|
|
1173
|
+
.values(dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#tsFeatureExclude"), { unique: true })
|
|
1174
|
+
.flatMap((_item) => _item
|
|
1175
|
+
.toValues()
|
|
1176
|
+
.head()
|
|
1177
|
+
.chain((_value) => _value.toIri().chain((iri) => {
|
|
1178
|
+
switch (iri.value) {
|
|
1179
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_Create":
|
|
1180
|
+
return purify.Either.of(iri);
|
|
1181
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals":
|
|
1182
|
+
return purify.Either.of(iri);
|
|
1183
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson":
|
|
1184
|
+
return purify.Either.of(iri);
|
|
1185
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf":
|
|
1186
|
+
return purify.Either.of(iri);
|
|
1187
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash":
|
|
1188
|
+
return purify.Either.of(iri);
|
|
1189
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_Json":
|
|
1190
|
+
return purify.Either.of(iri);
|
|
1191
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema":
|
|
1192
|
+
return purify.Either.of(iri);
|
|
1193
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema":
|
|
1194
|
+
return purify.Either.of(iri);
|
|
1195
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf":
|
|
1196
|
+
return purify.Either.of(iri);
|
|
1197
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql":
|
|
1198
|
+
return purify.Either.of(iri);
|
|
1199
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson":
|
|
1200
|
+
return purify.Either.of(iri);
|
|
1201
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf":
|
|
1202
|
+
return purify.Either.of(iri);
|
|
1203
|
+
default:
|
|
1204
|
+
return purify.Left(new rdfjsResource.Resource.MistypedValueError({
|
|
1205
|
+
actualValue: iri,
|
|
1206
|
+
expectedValueType: 'rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">',
|
|
1207
|
+
focusResource: _resource,
|
|
1208
|
+
predicate: dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#tsFeatureExclude"),
|
|
1209
|
+
}));
|
|
1210
|
+
}
|
|
1211
|
+
}))
|
|
1212
|
+
.toMaybe()
|
|
1213
|
+
.toList()),
|
|
1214
|
+
]);
|
|
1215
|
+
if (_tsFeatureExcludesEither.isLeft()) {
|
|
1216
|
+
return _tsFeatureExcludesEither;
|
|
1217
|
+
}
|
|
1218
|
+
const tsFeatureExcludes = _tsFeatureExcludesEither.unsafeCoerce();
|
|
1219
|
+
const _tsFeatureIncludesEither = purify.Either.of([
|
|
1220
|
+
..._resource
|
|
1221
|
+
.values(dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#tsFeatureInclude"), { unique: true })
|
|
1222
|
+
.flatMap((_item) => _item
|
|
1223
|
+
.toValues()
|
|
1224
|
+
.head()
|
|
1225
|
+
.chain((_value) => _value.toIri().chain((iri) => {
|
|
1226
|
+
switch (iri.value) {
|
|
1227
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_Create":
|
|
1228
|
+
return purify.Either.of(iri);
|
|
1229
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals":
|
|
1230
|
+
return purify.Either.of(iri);
|
|
1231
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson":
|
|
1232
|
+
return purify.Either.of(iri);
|
|
1233
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf":
|
|
1234
|
+
return purify.Either.of(iri);
|
|
1235
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_Json":
|
|
1236
|
+
return purify.Either.of(iri);
|
|
1237
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash":
|
|
1238
|
+
return purify.Either.of(iri);
|
|
1239
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema":
|
|
1240
|
+
return purify.Either.of(iri);
|
|
1241
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema":
|
|
1242
|
+
return purify.Either.of(iri);
|
|
1243
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf":
|
|
1244
|
+
return purify.Either.of(iri);
|
|
1245
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql":
|
|
1246
|
+
return purify.Either.of(iri);
|
|
1247
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson":
|
|
1248
|
+
return purify.Either.of(iri);
|
|
1249
|
+
case "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf":
|
|
1250
|
+
return purify.Either.of(iri);
|
|
1251
|
+
default:
|
|
1252
|
+
return purify.Left(new rdfjsResource.Resource.MistypedValueError({
|
|
1253
|
+
actualValue: iri,
|
|
1254
|
+
expectedValueType: 'rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">',
|
|
1255
|
+
focusResource: _resource,
|
|
1256
|
+
predicate: dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#tsFeatureInclude"),
|
|
1257
|
+
}));
|
|
1258
|
+
}
|
|
1259
|
+
}))
|
|
1260
|
+
.toMaybe()
|
|
1261
|
+
.toList()),
|
|
1262
|
+
]);
|
|
1263
|
+
if (_tsFeatureIncludesEither.isLeft()) {
|
|
1264
|
+
return _tsFeatureIncludesEither;
|
|
1265
|
+
}
|
|
1266
|
+
const tsFeatureIncludes = _tsFeatureIncludesEither.unsafeCoerce();
|
|
1267
|
+
const _tsImportsEither = purify.Either.of([
|
|
1268
|
+
..._resource
|
|
1269
|
+
.values(dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#tsImport"), { unique: true })
|
|
1270
|
+
.flatMap((_item) => _item
|
|
1271
|
+
.toValues()
|
|
1272
|
+
.head()
|
|
1273
|
+
.chain((_value) => _value.toString())
|
|
1274
|
+
.toMaybe()
|
|
1275
|
+
.toList()),
|
|
1276
|
+
]);
|
|
1277
|
+
if (_tsImportsEither.isLeft()) {
|
|
1278
|
+
return _tsImportsEither;
|
|
1279
|
+
}
|
|
1280
|
+
const tsImports = _tsImportsEither.unsafeCoerce();
|
|
1281
|
+
const _tsObjectDeclarationTypeEither = purify.Either.of(_resource
|
|
1282
|
+
.values(dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#tsObjectDeclarationType"), { unique: true })
|
|
1283
|
+
.head()
|
|
1284
|
+
.chain((_value) => _value.toIri().chain((iri) => {
|
|
1285
|
+
switch (iri.value) {
|
|
1286
|
+
case "http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Class":
|
|
1287
|
+
return purify.Either.of(iri);
|
|
1288
|
+
case "http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Interface":
|
|
1289
|
+
return purify.Either.of(iri);
|
|
1290
|
+
default:
|
|
1291
|
+
return purify.Left(new rdfjsResource.Resource.MistypedValueError({
|
|
1292
|
+
actualValue: iri,
|
|
1293
|
+
expectedValueType: 'rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Class" | "http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Interface">',
|
|
1294
|
+
focusResource: _resource,
|
|
1295
|
+
predicate: dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#tsObjectDeclarationType"),
|
|
1296
|
+
}));
|
|
1297
|
+
}
|
|
1298
|
+
}))
|
|
1299
|
+
.toMaybe());
|
|
1300
|
+
if (_tsObjectDeclarationTypeEither.isLeft()) {
|
|
1301
|
+
return _tsObjectDeclarationTypeEither;
|
|
1302
|
+
}
|
|
1303
|
+
const tsObjectDeclarationType = _tsObjectDeclarationTypeEither.unsafeCoerce();
|
|
1304
|
+
const _tsObjectIdentifierPropertyNameEither = purify.Either.of(_resource
|
|
1305
|
+
.values(dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#tsObjectIdentifierPropertyName"), { unique: true })
|
|
1306
|
+
.head()
|
|
1307
|
+
.chain((_value) => _value.toString())
|
|
1308
|
+
.toMaybe());
|
|
1309
|
+
if (_tsObjectIdentifierPropertyNameEither.isLeft()) {
|
|
1310
|
+
return _tsObjectIdentifierPropertyNameEither;
|
|
1311
|
+
}
|
|
1312
|
+
const tsObjectIdentifierPropertyName = _tsObjectIdentifierPropertyNameEither.unsafeCoerce();
|
|
1313
|
+
const _tsObjectTypeDiscriminatorPropertyNameEither = purify.Either.of(_resource
|
|
1314
|
+
.values(dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#tsObjectTypeDiscriminatorPropertyName"), { unique: true })
|
|
1315
|
+
.head()
|
|
1316
|
+
.chain((_value) => _value.toString())
|
|
1317
|
+
.toMaybe());
|
|
1318
|
+
if (_tsObjectTypeDiscriminatorPropertyNameEither.isLeft()) {
|
|
1319
|
+
return _tsObjectTypeDiscriminatorPropertyNameEither;
|
|
1320
|
+
}
|
|
1321
|
+
const tsObjectTypeDiscriminatorPropertyName = _tsObjectTypeDiscriminatorPropertyNameEither.unsafeCoerce();
|
|
1322
|
+
const type = "ShaclmateNodeShape";
|
|
1323
|
+
return purify.Either.of({
|
|
1324
|
+
..._super0,
|
|
1325
|
+
abstract,
|
|
1326
|
+
export_,
|
|
1327
|
+
extern,
|
|
1328
|
+
fromRdfType,
|
|
1329
|
+
identifier,
|
|
1330
|
+
mintingStrategy,
|
|
1331
|
+
mutable,
|
|
1332
|
+
name,
|
|
1333
|
+
toRdfTypes,
|
|
1334
|
+
tsFeatureExcludes,
|
|
1335
|
+
tsFeatureIncludes,
|
|
1336
|
+
tsImports,
|
|
1337
|
+
tsObjectDeclarationType,
|
|
1338
|
+
tsObjectIdentifierPropertyName,
|
|
1339
|
+
tsObjectTypeDiscriminatorPropertyName,
|
|
1340
|
+
type,
|
|
1341
|
+
});
|
|
1342
|
+
}
|
|
1343
|
+
ShaclmateNodeShape.propertiesFromRdf = propertiesFromRdf;
|
|
1344
|
+
function fromRdf(parameters) {
|
|
1345
|
+
return ShaclmateNodeShape.propertiesFromRdf(parameters);
|
|
1346
|
+
}
|
|
1347
|
+
ShaclmateNodeShape.fromRdf = fromRdf;
|
|
1348
|
+
})(ShaclmateNodeShape || (ShaclmateNodeShape = {}));
|
|
1349
|
+
export var ShaclCorePropertyGroup;
|
|
1350
|
+
(function (ShaclCorePropertyGroup) {
|
|
1351
|
+
function propertiesFromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource,
|
|
1352
|
+
// @ts-ignore
|
|
1353
|
+
..._context }) {
|
|
1354
|
+
if (!_ignoreRdfType &&
|
|
1355
|
+
!_resource.isInstanceOf(dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup"))) {
|
|
1356
|
+
return purify.Left(new rdfjsResource.Resource.ValueError({
|
|
1357
|
+
focusResource: _resource,
|
|
1358
|
+
message: `${rdfjsResource.Resource.Identifier.toString(_resource.identifier)} has unexpected RDF type`,
|
|
1359
|
+
predicate: dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup"),
|
|
1360
|
+
}));
|
|
1361
|
+
}
|
|
1362
|
+
const _commentsEither = purify.Either.of([
|
|
1363
|
+
..._resource
|
|
1364
|
+
.values(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), { unique: true })
|
|
1365
|
+
.flatMap((_item) => _item
|
|
1366
|
+
.toValues()
|
|
1367
|
+
.filter((_value) => {
|
|
1368
|
+
const _languageInOrDefault = _languageIn ?? [];
|
|
1369
|
+
if (_languageInOrDefault.length === 0) {
|
|
1370
|
+
return true;
|
|
1371
|
+
}
|
|
1372
|
+
const _valueLiteral = _value.toLiteral().toMaybe().extract();
|
|
1373
|
+
if (typeof _valueLiteral === "undefined") {
|
|
1374
|
+
return false;
|
|
1375
|
+
}
|
|
1376
|
+
return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
|
|
1377
|
+
})
|
|
1378
|
+
.head()
|
|
1379
|
+
.chain((_value) => _value.toLiteral())
|
|
1380
|
+
.toMaybe()
|
|
1381
|
+
.toList()),
|
|
1382
|
+
]);
|
|
1383
|
+
if (_commentsEither.isLeft()) {
|
|
1384
|
+
return _commentsEither;
|
|
1385
|
+
}
|
|
1386
|
+
const comments = _commentsEither.unsafeCoerce();
|
|
1387
|
+
const identifier = _resource.identifier;
|
|
1388
|
+
const _labelsEither = purify.Either.of([
|
|
1389
|
+
..._resource
|
|
1390
|
+
.values(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), { unique: true })
|
|
1391
|
+
.flatMap((_item) => _item
|
|
1392
|
+
.toValues()
|
|
1393
|
+
.filter((_value) => {
|
|
1394
|
+
const _languageInOrDefault = _languageIn ?? [];
|
|
1395
|
+
if (_languageInOrDefault.length === 0) {
|
|
1396
|
+
return true;
|
|
1397
|
+
}
|
|
1398
|
+
const _valueLiteral = _value.toLiteral().toMaybe().extract();
|
|
1399
|
+
if (typeof _valueLiteral === "undefined") {
|
|
1400
|
+
return false;
|
|
1401
|
+
}
|
|
1402
|
+
return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
|
|
1403
|
+
})
|
|
1404
|
+
.head()
|
|
1405
|
+
.chain((_value) => _value.toLiteral())
|
|
1406
|
+
.toMaybe()
|
|
1407
|
+
.toList()),
|
|
1408
|
+
]);
|
|
1409
|
+
if (_labelsEither.isLeft()) {
|
|
1410
|
+
return _labelsEither;
|
|
1411
|
+
}
|
|
1412
|
+
const labels = _labelsEither.unsafeCoerce();
|
|
1413
|
+
const type = "ShaclCorePropertyGroup";
|
|
1414
|
+
return purify.Either.of({ comments, identifier, labels, type });
|
|
1415
|
+
}
|
|
1416
|
+
ShaclCorePropertyGroup.propertiesFromRdf = propertiesFromRdf;
|
|
1417
|
+
function fromRdf(parameters) {
|
|
1418
|
+
return ShaclCorePropertyGroup.propertiesFromRdf(parameters);
|
|
1419
|
+
}
|
|
1420
|
+
ShaclCorePropertyGroup.fromRdf = fromRdf;
|
|
1421
|
+
})(ShaclCorePropertyGroup || (ShaclCorePropertyGroup = {}));
|
|
1422
|
+
export var ShaclCoreShape;
|
|
1423
|
+
(function (ShaclCoreShape) {
|
|
1424
|
+
function fromRdf(parameters) {
|
|
1425
|
+
return ShaclCoreNodeShape.fromRdf(parameters).altLazy(() => ShaclCorePropertyShape.fromRdf(parameters));
|
|
1426
|
+
}
|
|
1427
|
+
ShaclCoreShape.fromRdf = fromRdf;
|
|
1428
|
+
})(ShaclCoreShape || (ShaclCoreShape = {}));
|
|
1429
|
+
export var ShaclmateShape;
|
|
1430
|
+
(function (ShaclmateShape) {
|
|
1431
|
+
function fromRdf(parameters) {
|
|
1432
|
+
return ShaclmateNodeShape.fromRdf(parameters).altLazy(() => ShaclCorePropertyShape.fromRdf(parameters));
|
|
1433
|
+
}
|
|
1434
|
+
ShaclmateShape.fromRdf = fromRdf;
|
|
1435
|
+
})(ShaclmateShape || (ShaclmateShape = {}));
|
|
1436
|
+
//# sourceMappingURL=generated.js.map
|