@shaclmate/compiler 2.0.22 → 2.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/dist/ShapesGraphToAstTransformer.d.ts +1 -0
  2. package/dist/ShapesGraphToAstTransformer.js +56 -12
  3. package/dist/_ShapesGraphToAstTransformer/flattenAstObjectCompositeTypeMemberTypes.d.ts +13 -0
  4. package/dist/_ShapesGraphToAstTransformer/flattenAstObjectCompositeTypeMemberTypes.js +51 -0
  5. package/dist/_ShapesGraphToAstTransformer/shapeAstName.js +53 -12
  6. package/dist/_ShapesGraphToAstTransformer/transformNodeShapeToAstType.d.ts +5 -0
  7. package/dist/_ShapesGraphToAstTransformer/transformNodeShapeToAstType.js +130 -54
  8. package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstCompositeType.d.ts +2 -3
  9. package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstCompositeType.js +122 -129
  10. package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstIdentifierType.d.ts +2 -2
  11. package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstLiteralType.d.ts +2 -2
  12. package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +127 -5
  13. package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstTermType.d.ts +3 -3
  14. package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstType.d.ts +2 -3
  15. package/dist/ast/Ast.d.ts +0 -1
  16. package/dist/ast/Curie.d.ts +14 -0
  17. package/dist/ast/Curie.js +21 -0
  18. package/dist/ast/IdentifierType.d.ts +3 -2
  19. package/dist/ast/ListType.d.ts +2 -1
  20. package/dist/ast/LiteralType.d.ts +1 -1
  21. package/dist/ast/Name.d.ts +40 -5
  22. package/dist/ast/ObjectCompositeType.d.ts +11 -0
  23. package/dist/ast/ObjectType.d.ts +18 -13
  24. package/dist/ast/ObjectUnionType.d.ts +0 -11
  25. package/dist/ast/OptionType.d.ts +2 -2
  26. package/dist/ast/SetType.d.ts +2 -2
  27. package/dist/ast/TermType.d.ts +12 -4
  28. package/dist/ast/Type.d.ts +1 -1
  29. package/dist/enums/TsFeature.d.ts +1 -4
  30. package/dist/enums/TsFeature.js +1 -15
  31. package/dist/generators/json/AstJsonGenerator.js +19 -3
  32. package/dist/generators/ts/BooleanType.d.ts +3 -1
  33. package/dist/generators/ts/BooleanType.js +11 -2
  34. package/dist/generators/ts/DateTimeType.d.ts +8 -7
  35. package/dist/generators/ts/DateTimeType.js +31 -7
  36. package/dist/generators/ts/DateType.d.ts +5 -2
  37. package/dist/generators/ts/DateType.js +15 -1
  38. package/dist/generators/ts/DeclaredType.d.ts +2 -2
  39. package/dist/generators/ts/DeclaredType.js +2 -2
  40. package/dist/generators/ts/FloatType.d.ts +6 -0
  41. package/dist/generators/ts/FloatType.js +18 -0
  42. package/dist/generators/ts/IdentifierType.d.ts +12 -7
  43. package/dist/generators/ts/IdentifierType.js +94 -6
  44. package/dist/generators/ts/Import.d.ts +2 -0
  45. package/dist/generators/ts/Import.js +10 -0
  46. package/dist/generators/ts/IntType.d.ts +6 -0
  47. package/dist/generators/ts/IntType.js +18 -0
  48. package/dist/generators/ts/ListType.d.ts +15 -12
  49. package/dist/generators/ts/ListType.js +98 -57
  50. package/dist/generators/ts/LiteralType.d.ts +10 -9
  51. package/dist/generators/ts/LiteralType.js +13 -2
  52. package/dist/generators/ts/NumberType.d.ts +2 -1
  53. package/dist/generators/ts/NumberType.js +7 -2
  54. package/dist/generators/ts/ObjectType.d.ts +66 -43
  55. package/dist/generators/ts/ObjectType.js +144 -123
  56. package/dist/generators/ts/ObjectUnionType.d.ts +49 -8
  57. package/dist/generators/ts/ObjectUnionType.js +290 -97
  58. package/dist/generators/ts/OptionType.d.ts +14 -10
  59. package/dist/generators/ts/OptionType.js +60 -34
  60. package/dist/generators/ts/PrimitiveType.d.ts +4 -4
  61. package/dist/generators/ts/PrimitiveType.js +18 -3
  62. package/dist/generators/ts/SetType.d.ts +16 -12
  63. package/dist/generators/ts/SetType.js +69 -40
  64. package/dist/generators/ts/SnippetDeclarations.d.ts +13 -8
  65. package/dist/generators/ts/SnippetDeclarations.js +215 -101
  66. package/dist/generators/ts/StringType.d.ts +3 -1
  67. package/dist/generators/ts/StringType.js +14 -2
  68. package/dist/generators/ts/TermType.d.ts +22 -14
  69. package/dist/generators/ts/TermType.js +53 -25
  70. package/dist/generators/ts/TsGenerator.d.ts +2 -1
  71. package/dist/generators/ts/TsGenerator.js +23 -12
  72. package/dist/generators/ts/Type.d.ts +89 -31
  73. package/dist/generators/ts/Type.js +57 -54
  74. package/dist/generators/ts/TypeFactory.d.ts +4 -5
  75. package/dist/generators/ts/TypeFactory.js +290 -226
  76. package/dist/generators/ts/UnionType.d.ts +14 -10
  77. package/dist/generators/ts/UnionType.js +319 -142
  78. package/dist/generators/ts/_ObjectType/EagerShaclProperty.d.ts +12 -0
  79. package/dist/generators/ts/_ObjectType/EagerShaclProperty.js +30 -0
  80. package/dist/generators/ts/_ObjectType/IdentifierPrefixProperty.d.ts +13 -12
  81. package/dist/generators/ts/_ObjectType/IdentifierPrefixProperty.js +46 -47
  82. package/dist/generators/ts/_ObjectType/IdentifierProperty.d.ts +20 -13
  83. package/dist/generators/ts/_ObjectType/IdentifierProperty.js +152 -124
  84. package/dist/generators/ts/_ObjectType/LazyShaclProperty.d.ts +87 -0
  85. package/dist/generators/ts/_ObjectType/LazyShaclProperty.js +237 -0
  86. package/dist/generators/ts/_ObjectType/Property.d.ts +39 -44
  87. package/dist/generators/ts/_ObjectType/Property.js +1 -10
  88. package/dist/generators/ts/_ObjectType/ShaclProperty.d.ts +25 -30
  89. package/dist/generators/ts/_ObjectType/ShaclProperty.js +108 -85
  90. package/dist/generators/ts/_ObjectType/TypeDiscriminatorProperty.d.ts +21 -17
  91. package/dist/generators/ts/_ObjectType/TypeDiscriminatorProperty.js +61 -53
  92. package/dist/generators/ts/_ObjectType/classDeclaration.js +6 -5
  93. package/dist/generators/ts/_ObjectType/createFunctionDeclaration.js +5 -4
  94. package/dist/generators/ts/_ObjectType/equalsFunctionOrMethodDeclaration.js +5 -4
  95. package/dist/generators/ts/_ObjectType/fromRdfTypeVariableStatement.d.ts +1 -1
  96. package/dist/generators/ts/_ObjectType/fromRdfTypeVariableStatement.js +8 -5
  97. package/dist/generators/ts/_ObjectType/graphqlTypeVariableStatement.d.ts +5 -0
  98. package/dist/generators/ts/_ObjectType/graphqlTypeVariableStatement.js +37 -0
  99. package/dist/generators/ts/_ObjectType/hashFunctionOrMethodDeclarations.js +7 -8
  100. package/dist/generators/ts/_ObjectType/identifierTypeDeclarations.d.ts +7 -0
  101. package/dist/generators/ts/_ObjectType/identifierTypeDeclarations.js +54 -0
  102. package/dist/generators/ts/_ObjectType/index.d.ts +9 -7
  103. package/dist/generators/ts/_ObjectType/index.js +9 -7
  104. package/dist/generators/ts/_ObjectType/interfaceDeclaration.js +1 -1
  105. package/dist/generators/ts/_ObjectType/jsonFunctionDeclarations.d.ts +4 -0
  106. package/dist/generators/ts/_ObjectType/jsonFunctionDeclarations.js +189 -0
  107. package/dist/generators/ts/_ObjectType/jsonTypeAliasDeclaration.d.ts +5 -0
  108. package/dist/generators/ts/_ObjectType/jsonTypeAliasDeclaration.js +28 -0
  109. package/dist/generators/ts/_ObjectType/objectSetMethodNames.d.ts +9 -0
  110. package/dist/generators/ts/_ObjectType/objectSetMethodNames.js +18 -0
  111. package/dist/generators/ts/_ObjectType/propertiesVariableStatement.d.ts +5 -0
  112. package/dist/generators/ts/_ObjectType/propertiesVariableStatement.js +37 -0
  113. package/dist/generators/ts/_ObjectType/rdfFunctionDeclarations.d.ts +4 -0
  114. package/dist/generators/ts/_ObjectType/rdfFunctionDeclarations.js +152 -0
  115. package/dist/generators/ts/_ObjectType/sparqlConstructQueryFunctionDeclaration.d.ts +1 -1
  116. package/dist/generators/ts/_ObjectType/sparqlConstructQueryFunctionDeclaration.js +4 -3
  117. package/dist/generators/ts/_ObjectType/sparqlConstructQueryStringFunctionDeclaration.d.ts +1 -1
  118. package/dist/generators/ts/_ObjectType/sparqlConstructQueryStringFunctionDeclaration.js +3 -2
  119. package/dist/generators/ts/_ObjectType/sparqlFunctionDeclarations.js +103 -35
  120. package/dist/generators/ts/_ObjectType/toJsonFunctionOrMethodDeclaration.js +6 -6
  121. package/dist/generators/ts/_ObjectType/toRdfFunctionOrMethodDeclaration.js +15 -13
  122. package/dist/generators/ts/graphqlSchemaVariableStatement.d.ts +9 -0
  123. package/dist/generators/ts/graphqlSchemaVariableStatement.js +86 -0
  124. package/dist/generators/ts/objectSetDeclarations.d.ts +8 -0
  125. package/dist/generators/ts/objectSetDeclarations.js +59 -0
  126. package/dist/generators/ts/objectSetInterfaceDeclaration.d.ts +8 -0
  127. package/dist/generators/ts/objectSetInterfaceDeclaration.js +46 -0
  128. package/dist/generators/ts/objectSetMethodSignatures.d.ts +11 -0
  129. package/dist/generators/ts/objectSetMethodSignatures.js +52 -0
  130. package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.d.ts +8 -0
  131. package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.js +393 -0
  132. package/dist/generators/ts/rdfjsTermExpression.d.ts +3 -0
  133. package/dist/generators/ts/rdfjsTermExpression.js +57 -0
  134. package/dist/generators/ts/sparqlObjectSetClassDeclaration.d.ts +8 -0
  135. package/dist/generators/ts/sparqlObjectSetClassDeclaration.js +415 -0
  136. package/dist/generators/ts/syntheticNamePrefix.d.ts +2 -0
  137. package/dist/generators/ts/syntheticNamePrefix.js +2 -0
  138. package/dist/generators/ts/tsName.js +27 -13
  139. package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.d.ts +10 -0
  140. package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.js +19 -0
  141. package/dist/input/NodeShape.d.ts +6 -8
  142. package/dist/input/NodeShape.js +20 -44
  143. package/dist/input/Ontology.d.ts +0 -3
  144. package/dist/input/Ontology.js +0 -9
  145. package/dist/input/PropertyPath.d.ts +6 -5
  146. package/dist/input/PropertyPath.js +14 -22
  147. package/dist/input/PropertyShape.d.ts +3 -1
  148. package/dist/input/PropertyShape.js +8 -2
  149. package/dist/input/ShapesGraph.js +4 -4
  150. package/dist/input/generated.d.ts +923 -105
  151. package/dist/input/generated.js +1865 -969
  152. package/dist/input/tsFeatures.d.ts +3 -2
  153. package/dist/input/tsFeatures.js +44 -27
  154. package/package.json +18 -16
  155. package/dist/generators/ts/_ObjectType/fromJsonFunctionDeclarations.d.ts +0 -4
  156. package/dist/generators/ts/_ObjectType/fromJsonFunctionDeclarations.js +0 -78
  157. package/dist/generators/ts/_ObjectType/fromRdfFunctionDeclarations.d.ts +0 -4
  158. package/dist/generators/ts/_ObjectType/fromRdfFunctionDeclarations.js +0 -91
  159. package/dist/generators/ts/_ObjectType/jsonSchemaFunctionDeclaration.d.ts +0 -5
  160. package/dist/generators/ts/_ObjectType/jsonSchemaFunctionDeclaration.js +0 -19
  161. package/dist/generators/ts/_ObjectType/jsonUiSchemaFunctionDeclaration.d.ts +0 -5
  162. package/dist/generators/ts/_ObjectType/jsonUiSchemaFunctionDeclaration.js +0 -31
  163. package/dist/generators/ts/_ObjectType/jsonZodSchemaFunctionDeclaration.d.ts +0 -5
  164. package/dist/generators/ts/_ObjectType/jsonZodSchemaFunctionDeclaration.js +0 -37
  165. package/dist/generators/ts/_ObjectType/rdfjsTermExpression.d.ts +0 -6
  166. package/dist/generators/ts/_ObjectType/rdfjsTermExpression.js +0 -17
  167. package/dist/generators/ts/_ObjectType/toJsonFunctionDeclaration.d.ts +0 -5
  168. package/dist/generators/ts/_ObjectType/toJsonFunctionDeclaration.js +0 -19
  169. package/dist/generators/ts/_ObjectType/toJsonReturnType.d.ts +0 -3
  170. package/dist/generators/ts/_ObjectType/toJsonReturnType.js +0 -17
  171. package/dist/generators/ts/_ObjectType/toRdfFunctionDeclaration.d.ts +0 -5
  172. package/dist/generators/ts/_ObjectType/toRdfFunctionDeclaration.js +0 -19
@@ -2,208 +2,241 @@ import { DataFactory as dataFactory } from "n3";
2
2
  import * as purify from "purify-ts";
3
3
  import * as rdfjsResource from "rdfjs-resource";
4
4
  import { PropertyPath } from "./PropertyPath.js";
5
- export var BaseShaclCoreShape;
6
- (function (BaseShaclCoreShape) {
7
- function _propertiesFromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource,
5
+ export var $RdfVocabularies;
6
+ (function ($RdfVocabularies) {
7
+ let rdf;
8
+ (function (rdf) {
9
+ rdf.first = dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#first");
10
+ rdf.nil = dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil");
11
+ rdf.rest = dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#rest");
12
+ rdf.subject = dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#subject");
13
+ rdf.type = dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
14
+ })(rdf = $RdfVocabularies.rdf || ($RdfVocabularies.rdf = {}));
15
+ let rdfs;
16
+ (function (rdfs) {
17
+ rdfs.subClassOf = dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf");
18
+ })(rdfs = $RdfVocabularies.rdfs || ($RdfVocabularies.rdfs = {}));
19
+ let xsd;
20
+ (function (xsd) {
21
+ xsd.boolean = dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#boolean");
22
+ xsd.date = dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#date");
23
+ xsd.dateTime = dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#dateTime");
24
+ xsd.integer = dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#integer");
25
+ })(xsd = $RdfVocabularies.xsd || ($RdfVocabularies.xsd = {}));
26
+ })($RdfVocabularies || ($RdfVocabularies = {}));
27
+ export var BaseShaclCoreShapeStatic;
28
+ (function (BaseShaclCoreShapeStatic) {
29
+ let $Identifier;
30
+ (function ($Identifier) {
31
+ function fromString(identifier) {
32
+ return purify.Either.encase(() => rdfjsResource.Resource.Identifier.fromString({
33
+ dataFactory,
34
+ identifier,
35
+ }));
36
+ }
37
+ $Identifier.fromString = fromString;
38
+ $Identifier.toString = rdfjsResource.Resource.Identifier.toString;
39
+ })($Identifier = BaseShaclCoreShapeStatic.$Identifier || (BaseShaclCoreShapeStatic.$Identifier = {}));
40
+ function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, languageIn: $languageIn, objectSet: $objectSetParameter, resource: $resource,
8
41
  // @ts-ignore
9
- ..._context }) {
10
- const identifier = _resource.identifier;
11
- const _andEither = purify.Either.of([
12
- ..._resource
13
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#and"), {
14
- unique: true,
15
- })
16
- .flatMap((_item) => _item
17
- .toValues()
18
- .head()
19
- .chain((value) => value.toList())
20
- .map((values) => values.flatMap((_value) => _value
21
- .toValues()
22
- .head()
23
- .chain((_value) => _value.toIdentifier())
24
- .toMaybe()
25
- .toList()))
26
- .toMaybe()
27
- .toList()),
28
- ]);
42
+ ...$context }) {
43
+ const $identifier = $resource.identifier;
44
+ const _andEither = purify.Either.sequence($resource
45
+ .values(BaseShaclCoreShapeStatic.$properties.and["identifier"], { unique: true })
46
+ .map((item) => item
47
+ .toValues()
48
+ .head()
49
+ .chain((value) => value.toList())
50
+ .chain((values) => purify.Either.sequence(values.map((value) => value
51
+ .toValues()
52
+ .head()
53
+ .chain((value) => value.toIdentifier()))))));
29
54
  if (_andEither.isLeft()) {
30
55
  return _andEither;
31
56
  }
32
57
  const and = _andEither.unsafeCoerce();
33
- const _classesEither = purify.Either.of([
34
- ..._resource
35
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#class"), {
36
- unique: true,
37
- })
38
- .flatMap((_item) => _item
39
- .toValues()
40
- .head()
41
- .chain((_value) => _value.toIri())
42
- .toMaybe()
43
- .toList()),
44
- ]);
58
+ const _classesEither = purify.Either.sequence($resource
59
+ .values(BaseShaclCoreShapeStatic.$properties.classes["identifier"], { unique: true })
60
+ .map((item) => item
61
+ .toValues()
62
+ .head()
63
+ .chain((value) => value.toIri())));
45
64
  if (_classesEither.isLeft()) {
46
65
  return _classesEither;
47
66
  }
48
67
  const classes = _classesEither.unsafeCoerce();
49
- const _commentsEither = purify.Either.of([
50
- ..._resource
51
- .values(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), { unique: true })
52
- .flatMap((_item) => _item
53
- .toValues()
54
- .filter((_value) => {
55
- const _languageInOrDefault = _languageIn ?? [];
56
- if (_languageInOrDefault.length === 0) {
57
- return true;
58
- }
59
- const _valueLiteral = _value.toLiteral().toMaybe().extract();
60
- if (typeof _valueLiteral === "undefined") {
61
- return false;
62
- }
63
- return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
64
- })
65
- .head()
66
- .chain((_value) => _value.toLiteral())
67
- .toMaybe()
68
- .toList()),
69
- ]);
68
+ const _commentsEither = purify.Either.sequence($resource
69
+ .values(BaseShaclCoreShapeStatic.$properties.comments["identifier"], { unique: true })
70
+ .map((item) => item
71
+ .toValues()
72
+ .filter((_value) => {
73
+ const _languageInOrDefault = $languageIn ?? [];
74
+ if (_languageInOrDefault.length === 0) {
75
+ return true;
76
+ }
77
+ const _valueLiteral = _value.toLiteral().toMaybe().extract();
78
+ if (typeof _valueLiteral === "undefined") {
79
+ return false;
80
+ }
81
+ return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
82
+ })
83
+ .head()
84
+ .chain((value) => value.toLiteral())));
70
85
  if (_commentsEither.isLeft()) {
71
86
  return _commentsEither;
72
87
  }
73
88
  const comments = _commentsEither.unsafeCoerce();
74
- const _datatypeEither = purify.Either.of(_resource
75
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#datatype"), {
76
- unique: true,
77
- })
89
+ const _datatypeEither = $resource
90
+ .values(BaseShaclCoreShapeStatic.$properties.datatype["identifier"], { unique: true })
78
91
  .head()
79
- .chain((_value) => _value.toIri())
80
- .toMaybe());
92
+ .chain((value) => value.toIri())
93
+ .map((value) => purify.Maybe.of(value))
94
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
95
+ ? purify.Right(purify.Maybe.empty())
96
+ : purify.Left(error));
81
97
  if (_datatypeEither.isLeft()) {
82
98
  return _datatypeEither;
83
99
  }
84
100
  const datatype = _datatypeEither.unsafeCoerce();
85
- const _deactivatedEither = purify.Either.of(_resource
86
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"), { unique: true })
101
+ const _deactivatedEither = $resource
102
+ .values(BaseShaclCoreShapeStatic.$properties.deactivated["identifier"], { unique: true })
87
103
  .head()
88
- .chain((_value) => _value.toBoolean())
89
- .toMaybe());
104
+ .chain((value) => value.toBoolean())
105
+ .map((value) => purify.Maybe.of(value))
106
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
107
+ ? purify.Right(purify.Maybe.empty())
108
+ : purify.Left(error));
90
109
  if (_deactivatedEither.isLeft()) {
91
110
  return _deactivatedEither;
92
111
  }
93
112
  const deactivated = _deactivatedEither.unsafeCoerce();
94
- const _flagsEither = purify.Either.of([
95
- ..._resource
96
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#flags"), {
97
- unique: true,
98
- })
99
- .flatMap((_item) => _item
100
- .toValues()
101
- .head()
102
- .chain((_value) => _value.toString())
103
- .toMaybe()
104
- .toList()),
105
- ]);
113
+ const _flagsEither = purify.Either.sequence($resource
114
+ .values(BaseShaclCoreShapeStatic.$properties.flags["identifier"], { unique: true })
115
+ .map((item) => item
116
+ .toValues()
117
+ .head()
118
+ .chain((value) => value.toString())));
106
119
  if (_flagsEither.isLeft()) {
107
120
  return _flagsEither;
108
121
  }
109
122
  const flags = _flagsEither.unsafeCoerce();
110
- const _hasValuesEither = purify.Either.of([
111
- ..._resource
112
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#hasValue"), {
113
- unique: true,
114
- })
115
- .flatMap((_item) => _item
116
- .toValues()
117
- .head()
118
- .chain((_value) => purify.Either.of(_value.toTerm()))
119
- .toMaybe()
120
- .toList()),
121
- ]);
123
+ const _hasValuesEither = purify.Either.sequence($resource
124
+ .values(BaseShaclCoreShapeStatic.$properties.hasValues["identifier"], { unique: true })
125
+ .map((item) => item
126
+ .toValues()
127
+ .head()
128
+ .chain((value) => purify.Either.of(value.toTerm()).chain((term) => {
129
+ switch (term.termType) {
130
+ case "Literal":
131
+ case "NamedNode":
132
+ return purify.Either.of(term);
133
+ default:
134
+ return purify.Left(new rdfjsResource.Resource.MistypedValueError({
135
+ actualValue: term,
136
+ expectedValueType: "(rdfjs.Literal | rdfjs.NamedNode)",
137
+ focusResource: $resource,
138
+ predicate: BaseShaclCoreShapeStatic.$properties.hasValues["identifier"],
139
+ }));
140
+ }
141
+ }))));
122
142
  if (_hasValuesEither.isLeft()) {
123
143
  return _hasValuesEither;
124
144
  }
125
145
  const hasValues = _hasValuesEither.unsafeCoerce();
126
- const _in_Either = purify.Either.of(_resource
127
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#in"), {
128
- unique: true,
129
- })
146
+ const _in_Either = $resource
147
+ .values(BaseShaclCoreShapeStatic.$properties.in_["identifier"], { unique: true })
130
148
  .head()
131
149
  .chain((value) => value.toList())
132
- .map((values) => values.flatMap((_value) => _value
150
+ .chain((values) => purify.Either.sequence(values.map((value) => value
133
151
  .toValues()
134
152
  .head()
135
- .chain((_value) => purify.Either.of(_value.toTerm()))
136
- .toMaybe()
137
- .toList()))
138
- .toMaybe());
153
+ .chain((value) => purify.Either.of(value.toTerm()).chain((term) => {
154
+ switch (term.termType) {
155
+ case "Literal":
156
+ case "NamedNode":
157
+ return purify.Either.of(term);
158
+ default:
159
+ return purify.Left(new rdfjsResource.Resource.MistypedValueError({
160
+ actualValue: term,
161
+ expectedValueType: "(rdfjs.Literal | rdfjs.NamedNode)",
162
+ focusResource: $resource,
163
+ predicate: BaseShaclCoreShapeStatic.$properties.in_["identifier"],
164
+ }));
165
+ }
166
+ })))))
167
+ .map((value) => purify.Maybe.of(value))
168
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
169
+ ? purify.Right(purify.Maybe.empty())
170
+ : purify.Left(error));
139
171
  if (_in_Either.isLeft()) {
140
172
  return _in_Either;
141
173
  }
142
174
  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 })
175
+ const _isDefinedByEither = $resource
176
+ .values(BaseShaclCoreShapeStatic.$properties.isDefinedBy["identifier"], { unique: true })
145
177
  .head()
146
- .chain((_value) => _value.toIdentifier())
147
- .toMaybe());
178
+ .chain((value) => value.toIdentifier())
179
+ .map((value) => purify.Maybe.of(value))
180
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
181
+ ? purify.Right(purify.Maybe.empty())
182
+ : purify.Left(error));
148
183
  if (_isDefinedByEither.isLeft()) {
149
184
  return _isDefinedByEither;
150
185
  }
151
186
  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
- ]);
187
+ const _labelsEither = purify.Either.sequence($resource
188
+ .values(BaseShaclCoreShapeStatic.$properties.labels["identifier"], { unique: true })
189
+ .map((item) => item
190
+ .toValues()
191
+ .filter((_value) => {
192
+ const _languageInOrDefault = $languageIn ?? [];
193
+ if (_languageInOrDefault.length === 0) {
194
+ return true;
195
+ }
196
+ const _valueLiteral = _value.toLiteral().toMaybe().extract();
197
+ if (typeof _valueLiteral === "undefined") {
198
+ return false;
199
+ }
200
+ return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
201
+ })
202
+ .head()
203
+ .chain((value) => value.toLiteral())));
173
204
  if (_labelsEither.isLeft()) {
174
205
  return _labelsEither;
175
206
  }
176
207
  const labels = _labelsEither.unsafeCoerce();
177
- const _languageInEither = purify.Either.of(_resource
178
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#languageIn"), { unique: true })
208
+ const _languageInEither = $resource
209
+ .values(BaseShaclCoreShapeStatic.$properties.languageIn["identifier"], { unique: true })
179
210
  .head()
180
211
  .chain((value) => value.toList())
181
- .map((values) => values.flatMap((_value) => _value
212
+ .chain((values) => purify.Either.sequence(values.map((value) => value
182
213
  .toValues()
183
214
  .head()
184
- .chain((_value) => _value.toString())
185
- .toMaybe()
186
- .toList()))
187
- .toMaybe());
215
+ .chain((value) => value.toString()))))
216
+ .map((value) => purify.Maybe.of(value))
217
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
218
+ ? purify.Right(purify.Maybe.empty())
219
+ : purify.Left(error));
188
220
  if (_languageInEither.isLeft()) {
189
221
  return _languageInEither;
190
222
  }
191
223
  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
- })
224
+ const _maxCountEither = $resource
225
+ .values(BaseShaclCoreShapeStatic.$properties.maxCount["identifier"], { unique: true })
196
226
  .head()
197
- .chain((_value) => _value.toNumber())
198
- .toMaybe());
227
+ .chain((value) => value.toNumber())
228
+ .map((value) => purify.Maybe.of(value))
229
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
230
+ ? purify.Right(purify.Maybe.empty())
231
+ : purify.Left(error));
199
232
  if (_maxCountEither.isLeft()) {
200
233
  return _maxCountEither;
201
234
  }
202
235
  const maxCount = _maxCountEither.unsafeCoerce();
203
- const _maxExclusiveEither = purify.Either.of(_resource
204
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxExclusive"), { unique: true })
236
+ const _maxExclusiveEither = $resource
237
+ .values(BaseShaclCoreShapeStatic.$properties.maxExclusive["identifier"], { unique: true })
205
238
  .filter((_value) => {
206
- const _languageInOrDefault = _languageIn ?? [];
239
+ const _languageInOrDefault = $languageIn ?? [];
207
240
  if (_languageInOrDefault.length === 0) {
208
241
  return true;
209
242
  }
@@ -214,16 +247,19 @@ export var BaseShaclCoreShape;
214
247
  return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
215
248
  })
216
249
  .head()
217
- .chain((_value) => _value.toLiteral())
218
- .toMaybe());
250
+ .chain((value) => value.toLiteral())
251
+ .map((value) => purify.Maybe.of(value))
252
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
253
+ ? purify.Right(purify.Maybe.empty())
254
+ : purify.Left(error));
219
255
  if (_maxExclusiveEither.isLeft()) {
220
256
  return _maxExclusiveEither;
221
257
  }
222
258
  const maxExclusive = _maxExclusiveEither.unsafeCoerce();
223
- const _maxInclusiveEither = purify.Either.of(_resource
224
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#maxInclusive"), { unique: true })
259
+ const _maxInclusiveEither = $resource
260
+ .values(BaseShaclCoreShapeStatic.$properties.maxInclusive["identifier"], { unique: true })
225
261
  .filter((_value) => {
226
- const _languageInOrDefault = _languageIn ?? [];
262
+ const _languageInOrDefault = $languageIn ?? [];
227
263
  if (_languageInOrDefault.length === 0) {
228
264
  return true;
229
265
  }
@@ -234,38 +270,43 @@ export var BaseShaclCoreShape;
234
270
  return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
235
271
  })
236
272
  .head()
237
- .chain((_value) => _value.toLiteral())
238
- .toMaybe());
273
+ .chain((value) => value.toLiteral())
274
+ .map((value) => purify.Maybe.of(value))
275
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
276
+ ? purify.Right(purify.Maybe.empty())
277
+ : purify.Left(error));
239
278
  if (_maxInclusiveEither.isLeft()) {
240
279
  return _maxInclusiveEither;
241
280
  }
242
281
  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
- })
282
+ const _maxLengthEither = $resource
283
+ .values(BaseShaclCoreShapeStatic.$properties.maxLength["identifier"], { unique: true })
247
284
  .head()
248
- .chain((_value) => _value.toNumber())
249
- .toMaybe());
285
+ .chain((value) => value.toNumber())
286
+ .map((value) => purify.Maybe.of(value))
287
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
288
+ ? purify.Right(purify.Maybe.empty())
289
+ : purify.Left(error));
250
290
  if (_maxLengthEither.isLeft()) {
251
291
  return _maxLengthEither;
252
292
  }
253
293
  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
- })
294
+ const _minCountEither = $resource
295
+ .values(BaseShaclCoreShapeStatic.$properties.minCount["identifier"], { unique: true })
258
296
  .head()
259
- .chain((_value) => _value.toNumber())
260
- .toMaybe());
297
+ .chain((value) => value.toNumber())
298
+ .map((value) => purify.Maybe.of(value))
299
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
300
+ ? purify.Right(purify.Maybe.empty())
301
+ : purify.Left(error));
261
302
  if (_minCountEither.isLeft()) {
262
303
  return _minCountEither;
263
304
  }
264
305
  const minCount = _minCountEither.unsafeCoerce();
265
- const _minExclusiveEither = purify.Either.of(_resource
266
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#minExclusive"), { unique: true })
306
+ const _minExclusiveEither = $resource
307
+ .values(BaseShaclCoreShapeStatic.$properties.minExclusive["identifier"], { unique: true })
267
308
  .filter((_value) => {
268
- const _languageInOrDefault = _languageIn ?? [];
309
+ const _languageInOrDefault = $languageIn ?? [];
269
310
  if (_languageInOrDefault.length === 0) {
270
311
  return true;
271
312
  }
@@ -276,16 +317,19 @@ export var BaseShaclCoreShape;
276
317
  return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
277
318
  })
278
319
  .head()
279
- .chain((_value) => _value.toLiteral())
280
- .toMaybe());
320
+ .chain((value) => value.toLiteral())
321
+ .map((value) => purify.Maybe.of(value))
322
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
323
+ ? purify.Right(purify.Maybe.empty())
324
+ : purify.Left(error));
281
325
  if (_minExclusiveEither.isLeft()) {
282
326
  return _minExclusiveEither;
283
327
  }
284
328
  const minExclusive = _minExclusiveEither.unsafeCoerce();
285
- const _minInclusiveEither = purify.Either.of(_resource
286
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#minInclusive"), { unique: true })
329
+ const _minInclusiveEither = $resource
330
+ .values(BaseShaclCoreShapeStatic.$properties.minInclusive["identifier"], { unique: true })
287
331
  .filter((_value) => {
288
- const _languageInOrDefault = _languageIn ?? [];
332
+ const _languageInOrDefault = $languageIn ?? [];
289
333
  if (_languageInOrDefault.length === 0) {
290
334
  return true;
291
335
  }
@@ -296,29 +340,31 @@ export var BaseShaclCoreShape;
296
340
  return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
297
341
  })
298
342
  .head()
299
- .chain((_value) => _value.toLiteral())
300
- .toMaybe());
343
+ .chain((value) => value.toLiteral())
344
+ .map((value) => purify.Maybe.of(value))
345
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
346
+ ? purify.Right(purify.Maybe.empty())
347
+ : purify.Left(error));
301
348
  if (_minInclusiveEither.isLeft()) {
302
349
  return _minInclusiveEither;
303
350
  }
304
351
  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
- })
352
+ const _minLengthEither = $resource
353
+ .values(BaseShaclCoreShapeStatic.$properties.minLength["identifier"], { unique: true })
309
354
  .head()
310
- .chain((_value) => _value.toNumber())
311
- .toMaybe());
355
+ .chain((value) => value.toNumber())
356
+ .map((value) => purify.Maybe.of(value))
357
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
358
+ ? purify.Right(purify.Maybe.empty())
359
+ : purify.Left(error));
312
360
  if (_minLengthEither.isLeft()) {
313
361
  return _minLengthEither;
314
362
  }
315
363
  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
- })
364
+ const _nodeKindEither = $resource
365
+ .values(BaseShaclCoreShapeStatic.$properties.nodeKind["identifier"], { unique: true })
320
366
  .head()
321
- .chain((_value) => _value.toIri().chain((iri) => {
367
+ .chain((value) => value.toIri().chain((iri) => {
322
368
  switch (iri.value) {
323
369
  case "http://www.w3.org/ns/shacl#BlankNode":
324
370
  return purify.Either.of(iri);
@@ -336,110 +382,79 @@ export var BaseShaclCoreShape;
336
382
  return purify.Left(new rdfjsResource.Resource.MistypedValueError({
337
383
  actualValue: iri,
338
384
  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"),
385
+ focusResource: $resource,
386
+ predicate: BaseShaclCoreShapeStatic.$properties.nodeKind["identifier"],
341
387
  }));
342
388
  }
343
389
  }))
344
- .toMaybe());
390
+ .map((value) => purify.Maybe.of(value))
391
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
392
+ ? purify.Right(purify.Maybe.empty())
393
+ : purify.Left(error));
345
394
  if (_nodeKindEither.isLeft()) {
346
395
  return _nodeKindEither;
347
396
  }
348
397
  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
- ]);
398
+ const _nodesEither = purify.Either.sequence($resource
399
+ .values(BaseShaclCoreShapeStatic.$properties.nodes["identifier"], { unique: true })
400
+ .map((item) => item
401
+ .toValues()
402
+ .head()
403
+ .chain((value) => value.toIdentifier())));
361
404
  if (_nodesEither.isLeft()) {
362
405
  return _nodesEither;
363
406
  }
364
407
  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
- ]);
408
+ const _notEither = purify.Either.sequence($resource
409
+ .values(BaseShaclCoreShapeStatic.$properties.not["identifier"], { unique: true })
410
+ .map((item) => item
411
+ .toValues()
412
+ .head()
413
+ .chain((value) => value.toIdentifier())));
377
414
  if (_notEither.isLeft()) {
378
415
  return _notEither;
379
416
  }
380
417
  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
- ]);
418
+ const _orEither = purify.Either.sequence($resource
419
+ .values(BaseShaclCoreShapeStatic.$properties.or["identifier"], { unique: true })
420
+ .map((item) => item
421
+ .toValues()
422
+ .head()
423
+ .chain((value) => value.toList())
424
+ .chain((values) => purify.Either.sequence(values.map((value) => value
425
+ .toValues()
426
+ .head()
427
+ .chain((value) => value.toIdentifier()))))));
399
428
  if (_orEither.isLeft()) {
400
429
  return _orEither;
401
430
  }
402
431
  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
- ]);
432
+ const _patternsEither = purify.Either.sequence($resource
433
+ .values(BaseShaclCoreShapeStatic.$properties.patterns["identifier"], { unique: true })
434
+ .map((item) => item
435
+ .toValues()
436
+ .head()
437
+ .chain((value) => value.toString())));
415
438
  if (_patternsEither.isLeft()) {
416
439
  return _patternsEither;
417
440
  }
418
441
  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
- ]);
442
+ const _xoneEither = purify.Either.sequence($resource
443
+ .values(BaseShaclCoreShapeStatic.$properties.xone["identifier"], { unique: true })
444
+ .map((item) => item
445
+ .toValues()
446
+ .head()
447
+ .chain((value) => value.toList())
448
+ .chain((values) => purify.Either.sequence(values.map((value) => value
449
+ .toValues()
450
+ .head()
451
+ .chain((value) => value.toIdentifier()))))));
437
452
  if (_xoneEither.isLeft()) {
438
453
  return _xoneEither;
439
454
  }
440
455
  const xone = _xoneEither.unsafeCoerce();
441
456
  return purify.Either.of({
442
- identifier,
457
+ $identifier,
443
458
  and,
444
459
  classes,
445
460
  comments,
@@ -467,150 +482,355 @@ export var BaseShaclCoreShape;
467
482
  xone,
468
483
  });
469
484
  }
470
- BaseShaclCoreShape._propertiesFromRdf = _propertiesFromRdf;
471
- })(BaseShaclCoreShape || (BaseShaclCoreShape = {}));
472
- export var ShaclCorePropertyShape;
473
- (function (ShaclCorePropertyShape) {
474
- function _propertiesFromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource,
485
+ BaseShaclCoreShapeStatic.$propertiesFromRdf = $propertiesFromRdf;
486
+ function $fromRdf(parameters) {
487
+ const { ignoreRdfType: _, ...otherParameters } = parameters;
488
+ return ShaclCoreNodeShapeStatic.$fromRdf(otherParameters).altLazy(() => ShaclCorePropertyShapeStatic.$fromRdf(otherParameters));
489
+ }
490
+ BaseShaclCoreShapeStatic.$fromRdf = $fromRdf;
491
+ function $toRdf(_baseShaclCoreShape, { mutateGraph, resourceSet, }) {
492
+ const _resource = resourceSet.mutableResource(_baseShaclCoreShape.$identifier, { mutateGraph });
493
+ _resource.add(BaseShaclCoreShapeStatic.$properties.and["identifier"], _baseShaclCoreShape.and.map((item) => item.length > 0
494
+ ? item.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
495
+ if (itemIndex === 0) {
496
+ currentSubListResource = listResource;
497
+ }
498
+ else {
499
+ const newSubListResource = resourceSet.mutableResource(dataFactory.blankNode(), { mutateGraph });
500
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier);
501
+ currentSubListResource = newSubListResource;
502
+ }
503
+ currentSubListResource.add($RdfVocabularies.rdf.first, item);
504
+ if (itemIndex + 1 === list.length) {
505
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil);
506
+ }
507
+ return { currentSubListResource, listResource };
508
+ }, {
509
+ currentSubListResource: null,
510
+ listResource: resourceSet.mutableResource(dataFactory.blankNode(), { mutateGraph }),
511
+ }).listResource.identifier
512
+ : $RdfVocabularies.rdf.nil));
513
+ _resource.add(BaseShaclCoreShapeStatic.$properties.classes["identifier"], _baseShaclCoreShape.classes.map((item) => item));
514
+ _resource.add(BaseShaclCoreShapeStatic.$properties.comments["identifier"], _baseShaclCoreShape.comments.map((item) => item));
515
+ _resource.add(BaseShaclCoreShapeStatic.$properties.datatype["identifier"], _baseShaclCoreShape.datatype);
516
+ _resource.add(BaseShaclCoreShapeStatic.$properties.deactivated["identifier"], _baseShaclCoreShape.deactivated);
517
+ _resource.add(BaseShaclCoreShapeStatic.$properties.flags["identifier"], _baseShaclCoreShape.flags.map((item) => item));
518
+ _resource.add(BaseShaclCoreShapeStatic.$properties.hasValues["identifier"], _baseShaclCoreShape.hasValues.map((item) => item));
519
+ _resource.add(BaseShaclCoreShapeStatic.$properties.in_["identifier"], _baseShaclCoreShape.in_.map((value) => value.length > 0
520
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
521
+ if (itemIndex === 0) {
522
+ currentSubListResource = listResource;
523
+ }
524
+ else {
525
+ const newSubListResource = resourceSet.mutableResource(dataFactory.blankNode(), { mutateGraph });
526
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier);
527
+ currentSubListResource = newSubListResource;
528
+ }
529
+ currentSubListResource.add($RdfVocabularies.rdf.first, item);
530
+ if (itemIndex + 1 === list.length) {
531
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil);
532
+ }
533
+ return { currentSubListResource, listResource };
534
+ }, {
535
+ currentSubListResource: null,
536
+ listResource: resourceSet.mutableResource(dataFactory.blankNode(), { mutateGraph }),
537
+ }).listResource.identifier
538
+ : $RdfVocabularies.rdf.nil));
539
+ _resource.add(BaseShaclCoreShapeStatic.$properties.isDefinedBy["identifier"], _baseShaclCoreShape.isDefinedBy);
540
+ _resource.add(BaseShaclCoreShapeStatic.$properties.labels["identifier"], _baseShaclCoreShape.labels.map((item) => item));
541
+ _resource.add(BaseShaclCoreShapeStatic.$properties.languageIn["identifier"], _baseShaclCoreShape.languageIn.map((value) => value.length > 0
542
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
543
+ if (itemIndex === 0) {
544
+ currentSubListResource = listResource;
545
+ }
546
+ else {
547
+ const newSubListResource = resourceSet.mutableResource(dataFactory.blankNode(), { mutateGraph });
548
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier);
549
+ currentSubListResource = newSubListResource;
550
+ }
551
+ currentSubListResource.add($RdfVocabularies.rdf.first, item);
552
+ if (itemIndex + 1 === list.length) {
553
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil);
554
+ }
555
+ return { currentSubListResource, listResource };
556
+ }, {
557
+ currentSubListResource: null,
558
+ listResource: resourceSet.mutableResource(dataFactory.blankNode(), { mutateGraph }),
559
+ }).listResource.identifier
560
+ : $RdfVocabularies.rdf.nil));
561
+ _resource.add(BaseShaclCoreShapeStatic.$properties.maxCount["identifier"], _baseShaclCoreShape.maxCount);
562
+ _resource.add(BaseShaclCoreShapeStatic.$properties.maxExclusive["identifier"], _baseShaclCoreShape.maxExclusive);
563
+ _resource.add(BaseShaclCoreShapeStatic.$properties.maxInclusive["identifier"], _baseShaclCoreShape.maxInclusive);
564
+ _resource.add(BaseShaclCoreShapeStatic.$properties.maxLength["identifier"], _baseShaclCoreShape.maxLength);
565
+ _resource.add(BaseShaclCoreShapeStatic.$properties.minCount["identifier"], _baseShaclCoreShape.minCount);
566
+ _resource.add(BaseShaclCoreShapeStatic.$properties.minExclusive["identifier"], _baseShaclCoreShape.minExclusive);
567
+ _resource.add(BaseShaclCoreShapeStatic.$properties.minInclusive["identifier"], _baseShaclCoreShape.minInclusive);
568
+ _resource.add(BaseShaclCoreShapeStatic.$properties.minLength["identifier"], _baseShaclCoreShape.minLength);
569
+ _resource.add(BaseShaclCoreShapeStatic.$properties.nodeKind["identifier"], _baseShaclCoreShape.nodeKind);
570
+ _resource.add(BaseShaclCoreShapeStatic.$properties.nodes["identifier"], _baseShaclCoreShape.nodes.map((item) => item));
571
+ _resource.add(BaseShaclCoreShapeStatic.$properties.not["identifier"], _baseShaclCoreShape.not.map((item) => item));
572
+ _resource.add(BaseShaclCoreShapeStatic.$properties.or["identifier"], _baseShaclCoreShape.or.map((item) => item.length > 0
573
+ ? item.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
574
+ if (itemIndex === 0) {
575
+ currentSubListResource = listResource;
576
+ }
577
+ else {
578
+ const newSubListResource = resourceSet.mutableResource(dataFactory.blankNode(), { mutateGraph });
579
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier);
580
+ currentSubListResource = newSubListResource;
581
+ }
582
+ currentSubListResource.add($RdfVocabularies.rdf.first, item);
583
+ if (itemIndex + 1 === list.length) {
584
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil);
585
+ }
586
+ return { currentSubListResource, listResource };
587
+ }, {
588
+ currentSubListResource: null,
589
+ listResource: resourceSet.mutableResource(dataFactory.blankNode(), { mutateGraph }),
590
+ }).listResource.identifier
591
+ : $RdfVocabularies.rdf.nil));
592
+ _resource.add(BaseShaclCoreShapeStatic.$properties.patterns["identifier"], _baseShaclCoreShape.patterns.map((item) => item));
593
+ _resource.add(BaseShaclCoreShapeStatic.$properties.xone["identifier"], _baseShaclCoreShape.xone.map((item) => item.length > 0
594
+ ? item.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
595
+ if (itemIndex === 0) {
596
+ currentSubListResource = listResource;
597
+ }
598
+ else {
599
+ const newSubListResource = resourceSet.mutableResource(dataFactory.blankNode(), { mutateGraph });
600
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier);
601
+ currentSubListResource = newSubListResource;
602
+ }
603
+ currentSubListResource.add($RdfVocabularies.rdf.first, item);
604
+ if (itemIndex + 1 === list.length) {
605
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil);
606
+ }
607
+ return { currentSubListResource, listResource };
608
+ }, {
609
+ currentSubListResource: null,
610
+ listResource: resourceSet.mutableResource(dataFactory.blankNode(), { mutateGraph }),
611
+ }).listResource.identifier
612
+ : $RdfVocabularies.rdf.nil));
613
+ return _resource;
614
+ }
615
+ BaseShaclCoreShapeStatic.$toRdf = $toRdf;
616
+ BaseShaclCoreShapeStatic.$properties = {
617
+ and: {
618
+ identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#and"),
619
+ },
620
+ classes: {
621
+ identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#class"),
622
+ },
623
+ comments: {
624
+ identifier: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
625
+ },
626
+ datatype: {
627
+ identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#datatype"),
628
+ },
629
+ deactivated: {
630
+ identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"),
631
+ },
632
+ flags: {
633
+ identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#flags"),
634
+ },
635
+ hasValues: {
636
+ identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#hasValue"),
637
+ },
638
+ in_: { identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#in") },
639
+ isDefinedBy: {
640
+ identifier: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"),
641
+ },
642
+ labels: {
643
+ identifier: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
644
+ },
645
+ languageIn: {
646
+ identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#languageIn"),
647
+ },
648
+ maxCount: {
649
+ identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxCount"),
650
+ },
651
+ maxExclusive: {
652
+ identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxExclusive"),
653
+ },
654
+ maxInclusive: {
655
+ identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxInclusive"),
656
+ },
657
+ maxLength: {
658
+ identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#maxLength"),
659
+ },
660
+ minCount: {
661
+ identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#minCount"),
662
+ },
663
+ minExclusive: {
664
+ identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#minExclusive"),
665
+ },
666
+ minInclusive: {
667
+ identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#minInclusive"),
668
+ },
669
+ minLength: {
670
+ identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#minLength"),
671
+ },
672
+ nodeKind: {
673
+ identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"),
674
+ },
675
+ nodes: {
676
+ identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#node"),
677
+ },
678
+ not: {
679
+ identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#not"),
680
+ },
681
+ or: { identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#or") },
682
+ patterns: {
683
+ identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#pattern"),
684
+ },
685
+ xone: {
686
+ identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#xone"),
687
+ },
688
+ };
689
+ })(BaseShaclCoreShapeStatic || (BaseShaclCoreShapeStatic = {}));
690
+ export var ShaclCorePropertyShapeStatic;
691
+ (function (ShaclCorePropertyShapeStatic) {
692
+ ShaclCorePropertyShapeStatic.$fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape");
693
+ ShaclCorePropertyShapeStatic.$Identifier = BaseShaclCoreShapeStatic.$Identifier;
694
+ function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, languageIn: $languageIn, objectSet: $objectSetParameter, resource: $resource,
475
695
  // @ts-ignore
476
- ..._context }) {
477
- const _super0Either = BaseShaclCoreShape._propertiesFromRdf({
478
- ..._context,
696
+ ...$context }) {
697
+ const $super0Either = BaseShaclCoreShapeStatic.$propertiesFromRdf({
698
+ ...$context,
479
699
  ignoreRdfType: true,
480
- languageIn: _languageIn,
481
- resource: _resource,
700
+ languageIn: $languageIn,
701
+ resource: $resource,
482
702
  });
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 identifier = _resource.identifier;
496
- const type = "ShaclCorePropertyShape";
497
- const _defaultValueEither = purify.Either.of(_resource
498
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#defaultValue"), { unique: true })
703
+ if ($super0Either.isLeft()) {
704
+ return $super0Either;
705
+ }
706
+ const $super0 = $super0Either.unsafeCoerce();
707
+ if (!$ignoreRdfType && !$resource.isInstanceOf(ShaclCorePropertyShapeStatic.$fromRdfType)) {
708
+ return $resource
709
+ .value($RdfVocabularies.rdf.type)
710
+ .chain((actualRdfType) => actualRdfType.toIri())
711
+ .chain((actualRdfType) => purify.Left(new Error(`${rdfjsResource.Resource.Identifier.toString($resource.identifier)} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#PropertyShape)`)));
712
+ }
713
+ const $identifier = $resource.identifier;
714
+ const $type = "ShaclCorePropertyShape";
715
+ const _defaultValueEither = $resource
716
+ .values(ShaclCorePropertyShapeStatic.$properties.defaultValue["identifier"], { unique: true })
499
717
  .head()
500
- .chain((_value) => purify.Either.of(_value.toTerm()))
501
- .toMaybe());
718
+ .chain((value) => purify.Either.of(value.toTerm()).chain((term) => {
719
+ switch (term.termType) {
720
+ case "Literal":
721
+ case "NamedNode":
722
+ return purify.Either.of(term);
723
+ default:
724
+ return purify.Left(new rdfjsResource.Resource.MistypedValueError({
725
+ actualValue: term,
726
+ expectedValueType: "(rdfjs.Literal | rdfjs.NamedNode)",
727
+ focusResource: $resource,
728
+ predicate: ShaclCorePropertyShapeStatic.$properties.defaultValue["identifier"],
729
+ }));
730
+ }
731
+ }))
732
+ .map((value) => purify.Maybe.of(value))
733
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
734
+ ? purify.Right(purify.Maybe.empty())
735
+ : purify.Left(error));
502
736
  if (_defaultValueEither.isLeft()) {
503
737
  return _defaultValueEither;
504
738
  }
505
739
  const defaultValue = _defaultValueEither.unsafeCoerce();
506
- const _descriptionsEither = purify.Either.of([
507
- ..._resource
508
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#description"), { unique: true })
509
- .flatMap((_item) => _item
510
- .toValues()
511
- .filter((_value) => {
512
- const _languageInOrDefault = _languageIn ?? [];
513
- if (_languageInOrDefault.length === 0) {
514
- return true;
515
- }
516
- const _valueLiteral = _value.toLiteral().toMaybe().extract();
517
- if (typeof _valueLiteral === "undefined") {
518
- return false;
519
- }
520
- return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
521
- })
522
- .head()
523
- .chain((_value) => _value.toLiteral())
524
- .toMaybe()
525
- .toList()),
526
- ]);
740
+ const _descriptionsEither = purify.Either.sequence($resource
741
+ .values(ShaclCorePropertyShapeStatic.$properties.descriptions["identifier"], { unique: true })
742
+ .map((item) => item
743
+ .toValues()
744
+ .filter((_value) => {
745
+ const _languageInOrDefault = $languageIn ?? [];
746
+ if (_languageInOrDefault.length === 0) {
747
+ return true;
748
+ }
749
+ const _valueLiteral = _value.toLiteral().toMaybe().extract();
750
+ if (typeof _valueLiteral === "undefined") {
751
+ return false;
752
+ }
753
+ return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
754
+ })
755
+ .head()
756
+ .chain((value) => value.toLiteral())));
527
757
  if (_descriptionsEither.isLeft()) {
528
758
  return _descriptionsEither;
529
759
  }
530
760
  const descriptions = _descriptionsEither.unsafeCoerce();
531
- const _groupsEither = purify.Either.of([
532
- ..._resource
533
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#group"), {
534
- unique: true,
535
- })
536
- .flatMap((_item) => _item
537
- .toValues()
538
- .head()
539
- .chain((_value) => _value.toIdentifier())
540
- .toMaybe()
541
- .toList()),
542
- ]);
761
+ const _groupsEither = purify.Either.sequence($resource
762
+ .values(ShaclCorePropertyShapeStatic.$properties.groups["identifier"], { unique: true })
763
+ .map((item) => item
764
+ .toValues()
765
+ .head()
766
+ .chain((value) => value.toIdentifier())));
543
767
  if (_groupsEither.isLeft()) {
544
768
  return _groupsEither;
545
769
  }
546
770
  const groups = _groupsEither.unsafeCoerce();
547
- const _namesEither = purify.Either.of([
548
- ..._resource
549
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#name"), {
550
- unique: true,
551
- })
552
- .flatMap((_item) => _item
553
- .toValues()
554
- .filter((_value) => {
555
- const _languageInOrDefault = _languageIn ?? [];
556
- if (_languageInOrDefault.length === 0) {
557
- return true;
558
- }
559
- const _valueLiteral = _value.toLiteral().toMaybe().extract();
560
- if (typeof _valueLiteral === "undefined") {
561
- return false;
562
- }
563
- return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
564
- })
565
- .head()
566
- .chain((_value) => _value.toLiteral())
567
- .toMaybe()
568
- .toList()),
569
- ]);
771
+ const _namesEither = purify.Either.sequence($resource
772
+ .values(ShaclCorePropertyShapeStatic.$properties.names["identifier"], { unique: true })
773
+ .map((item) => item
774
+ .toValues()
775
+ .filter((_value) => {
776
+ const _languageInOrDefault = $languageIn ?? [];
777
+ if (_languageInOrDefault.length === 0) {
778
+ return true;
779
+ }
780
+ const _valueLiteral = _value.toLiteral().toMaybe().extract();
781
+ if (typeof _valueLiteral === "undefined") {
782
+ return false;
783
+ }
784
+ return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
785
+ })
786
+ .head()
787
+ .chain((value) => value.toLiteral())));
570
788
  if (_namesEither.isLeft()) {
571
789
  return _namesEither;
572
790
  }
573
791
  const names = _namesEither.unsafeCoerce();
574
- const _orderEither = purify.Either.of(_resource
575
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#order"), {
576
- unique: true,
577
- })
792
+ const _orderEither = $resource
793
+ .values(ShaclCorePropertyShapeStatic.$properties.order["identifier"], { unique: true })
578
794
  .head()
579
- .chain((_value) => _value.toNumber())
580
- .toMaybe());
795
+ .chain((value) => value.toNumber())
796
+ .map((value) => purify.Maybe.of(value))
797
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
798
+ ? purify.Right(purify.Maybe.empty())
799
+ : purify.Left(error));
581
800
  if (_orderEither.isLeft()) {
582
801
  return _orderEither;
583
802
  }
584
803
  const order = _orderEither.unsafeCoerce();
585
- const _pathEither = _resource
586
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#path"), {
587
- unique: true,
588
- })
804
+ const _pathEither = $resource
805
+ .values(ShaclCorePropertyShapeStatic.$properties.path["identifier"], { unique: true })
589
806
  .head()
590
807
  .chain((value) => value.toResource())
591
- .chain((_resource) => PropertyPath.fromRdf({
592
- ..._context,
808
+ .chain((_resource) => PropertyPath.$fromRdf({
809
+ ...$context,
593
810
  ignoreRdfType: true,
594
- languageIn: _languageIn,
811
+ languageIn: $languageIn,
595
812
  resource: _resource,
596
813
  }));
597
814
  if (_pathEither.isLeft()) {
598
815
  return _pathEither;
599
816
  }
600
817
  const path = _pathEither.unsafeCoerce();
601
- const _uniqueLangEither = purify.Either.of(_resource
602
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#uniqueLang"), { unique: true })
818
+ const _uniqueLangEither = $resource
819
+ .values(ShaclCorePropertyShapeStatic.$properties.uniqueLang["identifier"], { unique: true })
603
820
  .head()
604
- .chain((_value) => _value.toBoolean())
605
- .toMaybe());
821
+ .chain((value) => value.toBoolean())
822
+ .map((value) => purify.Maybe.of(value))
823
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
824
+ ? purify.Right(purify.Maybe.empty())
825
+ : purify.Left(error));
606
826
  if (_uniqueLangEither.isLeft()) {
607
827
  return _uniqueLangEither;
608
828
  }
609
829
  const uniqueLang = _uniqueLangEither.unsafeCoerce();
610
830
  return purify.Either.of({
611
- ..._super0,
612
- identifier,
613
- type,
831
+ ...$super0,
832
+ $identifier,
833
+ $type,
614
834
  defaultValue,
615
835
  descriptions,
616
836
  groups,
@@ -620,69 +840,137 @@ export var ShaclCorePropertyShape;
620
840
  uniqueLang,
621
841
  });
622
842
  }
623
- ShaclCorePropertyShape._propertiesFromRdf = _propertiesFromRdf;
624
- function fromRdf(parameters) {
625
- return ShaclCorePropertyShape._propertiesFromRdf(parameters);
843
+ ShaclCorePropertyShapeStatic.$propertiesFromRdf = $propertiesFromRdf;
844
+ function $fromRdf(parameters) {
845
+ const { ignoreRdfType: _, ...otherParameters } = parameters;
846
+ return ShaclmatePropertyShape.$fromRdf(otherParameters).altLazy(() => ShaclCorePropertyShapeStatic.$propertiesFromRdf(parameters));
626
847
  }
627
- ShaclCorePropertyShape.fromRdf = fromRdf;
628
- ShaclCorePropertyShape.fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape");
629
- })(ShaclCorePropertyShape || (ShaclCorePropertyShape = {}));
848
+ ShaclCorePropertyShapeStatic.$fromRdf = $fromRdf;
849
+ function $toRdf(_shaclCorePropertyShape, { ignoreRdfType, mutateGraph, resourceSet, }) {
850
+ const _resource = BaseShaclCoreShapeStatic.$toRdf(_shaclCorePropertyShape, {
851
+ ignoreRdfType: true,
852
+ mutateGraph,
853
+ resourceSet,
854
+ });
855
+ if (!ignoreRdfType) {
856
+ _resource.add($RdfVocabularies.rdf.type, _resource.dataFactory.namedNode("http://purl.org/shaclmate/ontology#ShaclCorePropertyShape"));
857
+ _resource.add($RdfVocabularies.rdf.type, _resource.dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"));
858
+ }
859
+ _resource.add(ShaclCorePropertyShapeStatic.$properties.defaultValue["identifier"], _shaclCorePropertyShape.defaultValue);
860
+ _resource.add(ShaclCorePropertyShapeStatic.$properties.descriptions["identifier"], _shaclCorePropertyShape.descriptions.map((item) => item));
861
+ _resource.add(ShaclCorePropertyShapeStatic.$properties.groups["identifier"], _shaclCorePropertyShape.groups.map((item) => item));
862
+ _resource.add(ShaclCorePropertyShapeStatic.$properties.names["identifier"], _shaclCorePropertyShape.names.map((item) => item));
863
+ _resource.add(ShaclCorePropertyShapeStatic.$properties.order["identifier"], _shaclCorePropertyShape.order);
864
+ _resource.add(ShaclCorePropertyShapeStatic.$properties.path["identifier"], PropertyPath.$toRdf(_shaclCorePropertyShape.path, {
865
+ mutateGraph: mutateGraph,
866
+ resourceSet: resourceSet,
867
+ }));
868
+ _resource.add(ShaclCorePropertyShapeStatic.$properties.uniqueLang["identifier"], _shaclCorePropertyShape.uniqueLang);
869
+ return _resource;
870
+ }
871
+ ShaclCorePropertyShapeStatic.$toRdf = $toRdf;
872
+ ShaclCorePropertyShapeStatic.$properties = {
873
+ ...BaseShaclCoreShapeStatic.$properties,
874
+ defaultValue: {
875
+ identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#defaultValue"),
876
+ },
877
+ descriptions: {
878
+ identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#description"),
879
+ },
880
+ groups: {
881
+ identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#group"),
882
+ },
883
+ names: {
884
+ identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#name"),
885
+ },
886
+ order: {
887
+ identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#order"),
888
+ },
889
+ path: {
890
+ identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#path"),
891
+ },
892
+ uniqueLang: {
893
+ identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#uniqueLang"),
894
+ },
895
+ };
896
+ })(ShaclCorePropertyShapeStatic || (ShaclCorePropertyShapeStatic = {}));
630
897
  export var ShaclmatePropertyShape;
631
898
  (function (ShaclmatePropertyShape) {
632
- function _propertiesFromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource,
899
+ ShaclmatePropertyShape.$fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape");
900
+ ShaclmatePropertyShape.$Identifier = ShaclCorePropertyShapeStatic.$Identifier;
901
+ function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, languageIn: $languageIn, objectSet: $objectSetParameter, resource: $resource,
633
902
  // @ts-ignore
634
- ..._context }) {
635
- const _super0Either = ShaclCorePropertyShape._propertiesFromRdf({
636
- ..._context,
903
+ ...$context }) {
904
+ const $super0Either = ShaclCorePropertyShapeStatic.$propertiesFromRdf({
905
+ ...$context,
637
906
  ignoreRdfType: true,
638
- languageIn: _languageIn,
639
- resource: _resource,
907
+ languageIn: $languageIn,
908
+ resource: $resource,
640
909
  });
641
- if (_super0Either.isLeft()) {
642
- return _super0Either;
643
- }
644
- const _super0 = _super0Either.unsafeCoerce();
645
- if (!_ignoreRdfType &&
646
- !_resource.isInstanceOf(dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"))) {
647
- return purify.Left(new rdfjsResource.Resource.ValueError({
648
- focusResource: _resource,
649
- message: `${rdfjsResource.Resource.Identifier.toString(_resource.identifier)} has unexpected RDF type`,
650
- predicate: dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"),
651
- }));
652
- }
653
- const identifier = _resource.identifier;
654
- const type = "ShaclmatePropertyShape";
655
- const _externEither = purify.Either.of(_resource
656
- .values(dataFactory.namedNode("http://purl.org/shaclmate/ontology#extern"), { unique: true })
910
+ if ($super0Either.isLeft()) {
911
+ return $super0Either;
912
+ }
913
+ const $super0 = $super0Either.unsafeCoerce();
914
+ if (!$ignoreRdfType && !$resource.isInstanceOf(ShaclmatePropertyShape.$fromRdfType)) {
915
+ return $resource
916
+ .value($RdfVocabularies.rdf.type)
917
+ .chain((actualRdfType) => actualRdfType.toIri())
918
+ .chain((actualRdfType) => purify.Left(new Error(`${rdfjsResource.Resource.Identifier.toString($resource.identifier)} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#PropertyShape)`)));
919
+ }
920
+ const $identifier = $resource.identifier;
921
+ const $type = "ShaclmatePropertyShape";
922
+ const _lazyEither = $resource
923
+ .values(ShaclmatePropertyShape.$properties.lazy["identifier"], { unique: true })
657
924
  .head()
658
- .chain((_value) => _value.toBoolean())
659
- .toMaybe());
660
- if (_externEither.isLeft()) {
661
- return _externEither;
662
- }
663
- const extern = _externEither.unsafeCoerce();
664
- const _mutableEither = purify.Either.of(_resource
665
- .values(dataFactory.namedNode("http://purl.org/shaclmate/ontology#mutable"), { unique: true })
925
+ .chain((value) => value.toBoolean())
926
+ .map((value) => purify.Maybe.of(value))
927
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
928
+ ? purify.Right(purify.Maybe.empty())
929
+ : purify.Left(error));
930
+ if (_lazyEither.isLeft()) {
931
+ return _lazyEither;
932
+ }
933
+ const lazy = _lazyEither.unsafeCoerce();
934
+ const _mutableEither = $resource
935
+ .values(ShaclmatePropertyShape.$properties.mutable["identifier"], { unique: true })
666
936
  .head()
667
- .chain((_value) => _value.toBoolean())
668
- .toMaybe());
937
+ .chain((value) => value.toBoolean())
938
+ .map((value) => purify.Maybe.of(value))
939
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
940
+ ? purify.Right(purify.Maybe.empty())
941
+ : purify.Left(error));
669
942
  if (_mutableEither.isLeft()) {
670
943
  return _mutableEither;
671
944
  }
672
945
  const mutable = _mutableEither.unsafeCoerce();
673
- const _nameEither = purify.Either.of(_resource
674
- .values(dataFactory.namedNode("http://purl.org/shaclmate/ontology#name"), { unique: true })
946
+ const _nameEither = $resource
947
+ .values(ShaclmatePropertyShape.$properties.name["identifier"], { unique: true })
675
948
  .head()
676
- .chain((_value) => _value.toString())
677
- .toMaybe());
949
+ .chain((value) => value.toString())
950
+ .map((value) => purify.Maybe.of(value))
951
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
952
+ ? purify.Right(purify.Maybe.empty())
953
+ : purify.Left(error));
678
954
  if (_nameEither.isLeft()) {
679
955
  return _nameEither;
680
956
  }
681
957
  const name = _nameEither.unsafeCoerce();
682
- const _visibilityEither = purify.Either.of(_resource
683
- .values(dataFactory.namedNode("http://purl.org/shaclmate/ontology#visibility"), { unique: true })
958
+ const _stubEither = $resource
959
+ .values(ShaclmatePropertyShape.$properties.stub["identifier"], { unique: true })
960
+ .head()
961
+ .chain((value) => value.toIdentifier())
962
+ .map((value) => purify.Maybe.of(value))
963
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
964
+ ? purify.Right(purify.Maybe.empty())
965
+ : purify.Left(error));
966
+ if (_stubEither.isLeft()) {
967
+ return _stubEither;
968
+ }
969
+ const stub = _stubEither.unsafeCoerce();
970
+ const _visibilityEither = $resource
971
+ .values(ShaclmatePropertyShape.$properties.visibility["identifier"], { unique: true })
684
972
  .head()
685
- .chain((_value) => _value.toIri().chain((iri) => {
973
+ .chain((value) => value.toIri().chain((iri) => {
686
974
  switch (iri.value) {
687
975
  case "http://purl.org/shaclmate/ontology#_Visibility_Private":
688
976
  return purify.Either.of(iri);
@@ -694,238 +982,277 @@ export var ShaclmatePropertyShape;
694
982
  return purify.Left(new rdfjsResource.Resource.MistypedValueError({
695
983
  actualValue: iri,
696
984
  expectedValueType: 'rdfjs.NamedNode<"http://purl.org/shaclmate/ontology#_Visibility_Private" | "http://purl.org/shaclmate/ontology#_Visibility_Protected" | "http://purl.org/shaclmate/ontology#_Visibility_Public">',
697
- focusResource: _resource,
698
- predicate: dataFactory.namedNode("http://purl.org/shaclmate/ontology#visibility"),
985
+ focusResource: $resource,
986
+ predicate: ShaclmatePropertyShape.$properties.visibility["identifier"],
699
987
  }));
700
988
  }
701
989
  }))
702
- .toMaybe());
990
+ .map((value) => purify.Maybe.of(value))
991
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
992
+ ? purify.Right(purify.Maybe.empty())
993
+ : purify.Left(error));
703
994
  if (_visibilityEither.isLeft()) {
704
995
  return _visibilityEither;
705
996
  }
706
997
  const visibility = _visibilityEither.unsafeCoerce();
998
+ const _widenEither = $resource
999
+ .values(ShaclmatePropertyShape.$properties.widen["identifier"], { unique: true })
1000
+ .head()
1001
+ .chain((value) => value.toBoolean())
1002
+ .map((value) => purify.Maybe.of(value))
1003
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
1004
+ ? purify.Right(purify.Maybe.empty())
1005
+ : purify.Left(error));
1006
+ if (_widenEither.isLeft()) {
1007
+ return _widenEither;
1008
+ }
1009
+ const widen = _widenEither.unsafeCoerce();
707
1010
  return purify.Either.of({
708
- ..._super0,
709
- identifier,
710
- type,
711
- extern,
1011
+ ...$super0,
1012
+ $identifier,
1013
+ $type,
1014
+ lazy,
712
1015
  mutable,
713
1016
  name,
1017
+ stub,
714
1018
  visibility,
1019
+ widen,
715
1020
  });
716
1021
  }
717
- ShaclmatePropertyShape._propertiesFromRdf = _propertiesFromRdf;
718
- function fromRdf(parameters) {
719
- return ShaclmatePropertyShape._propertiesFromRdf(parameters);
1022
+ ShaclmatePropertyShape.$propertiesFromRdf = $propertiesFromRdf;
1023
+ function $fromRdf(parameters) {
1024
+ return ShaclmatePropertyShape.$propertiesFromRdf(parameters);
1025
+ }
1026
+ ShaclmatePropertyShape.$fromRdf = $fromRdf;
1027
+ function $toRdf(_shaclmatePropertyShape, { ignoreRdfType, mutateGraph, resourceSet, }) {
1028
+ const _resource = ShaclCorePropertyShapeStatic.$toRdf(_shaclmatePropertyShape, { ignoreRdfType: true, mutateGraph, resourceSet });
1029
+ if (!ignoreRdfType) {
1030
+ _resource.add($RdfVocabularies.rdf.type, _resource.dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"));
1031
+ }
1032
+ _resource.add(ShaclmatePropertyShape.$properties.lazy["identifier"], _shaclmatePropertyShape.lazy);
1033
+ _resource.add(ShaclmateNodeShape.$properties.mutable["identifier"], _shaclmatePropertyShape.mutable);
1034
+ _resource.add(ShaclmateNodeShape.$properties.name["identifier"], _shaclmatePropertyShape.name);
1035
+ _resource.add(ShaclmatePropertyShape.$properties.stub["identifier"], _shaclmatePropertyShape.stub);
1036
+ _resource.add(ShaclmatePropertyShape.$properties.visibility["identifier"], _shaclmatePropertyShape.visibility);
1037
+ _resource.add(ShaclmatePropertyShape.$properties.widen["identifier"], _shaclmatePropertyShape.widen);
1038
+ return _resource;
720
1039
  }
721
- ShaclmatePropertyShape.fromRdf = fromRdf;
722
- ShaclmatePropertyShape.fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape");
1040
+ ShaclmatePropertyShape.$toRdf = $toRdf;
1041
+ ShaclmatePropertyShape.$properties = {
1042
+ ...ShaclCorePropertyShapeStatic.$properties,
1043
+ lazy: {
1044
+ identifier: dataFactory.namedNode("http://purl.org/shaclmate/ontology#lazy"),
1045
+ },
1046
+ mutable: {
1047
+ identifier: dataFactory.namedNode("http://purl.org/shaclmate/ontology#mutable"),
1048
+ },
1049
+ name: {
1050
+ identifier: dataFactory.namedNode("http://purl.org/shaclmate/ontology#name"),
1051
+ },
1052
+ stub: {
1053
+ identifier: dataFactory.namedNode("http://purl.org/shaclmate/ontology#stub"),
1054
+ },
1055
+ visibility: {
1056
+ identifier: dataFactory.namedNode("http://purl.org/shaclmate/ontology#visibility"),
1057
+ },
1058
+ widen: {
1059
+ identifier: dataFactory.namedNode("http://purl.org/shaclmate/ontology#widen"),
1060
+ },
1061
+ };
723
1062
  })(ShaclmatePropertyShape || (ShaclmatePropertyShape = {}));
724
- export var OwlOntology;
725
- (function (OwlOntology) {
726
- function _propertiesFromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource,
727
- // @ts-ignore
728
- ..._context }) {
729
- if (!_ignoreRdfType &&
730
- !_resource.isInstanceOf(dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"))) {
731
- return purify.Left(new rdfjsResource.Resource.ValueError({
732
- focusResource: _resource,
733
- message: `${rdfjsResource.Resource.Identifier.toString(_resource.identifier)} has unexpected RDF type`,
734
- predicate: dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"),
1063
+ export var OwlOntologyStatic;
1064
+ (function (OwlOntologyStatic) {
1065
+ OwlOntologyStatic.$fromRdfType = dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology");
1066
+ let $Identifier;
1067
+ (function ($Identifier) {
1068
+ function fromString(identifier) {
1069
+ return purify.Either.encase(() => rdfjsResource.Resource.Identifier.fromString({
1070
+ dataFactory,
1071
+ identifier,
735
1072
  }));
736
1073
  }
737
- const identifier = _resource.identifier;
738
- const type = "OwlOntology";
739
- const _labelsEither = purify.Either.of([
740
- ..._resource
741
- .values(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), { unique: true })
742
- .flatMap((_item) => _item
743
- .toValues()
744
- .filter((_value) => {
745
- const _languageInOrDefault = _languageIn ?? [];
746
- if (_languageInOrDefault.length === 0) {
747
- return true;
748
- }
749
- const _valueLiteral = _value.toLiteral().toMaybe().extract();
750
- if (typeof _valueLiteral === "undefined") {
751
- return false;
752
- }
753
- return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
754
- })
755
- .head()
756
- .chain((_value) => _value.toLiteral())
757
- .toMaybe()
758
- .toList()),
759
- ]);
1074
+ $Identifier.fromString = fromString;
1075
+ $Identifier.toString = rdfjsResource.Resource.Identifier.toString;
1076
+ })($Identifier = OwlOntologyStatic.$Identifier || (OwlOntologyStatic.$Identifier = {}));
1077
+ function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, languageIn: $languageIn, objectSet: $objectSetParameter, resource: $resource,
1078
+ // @ts-ignore
1079
+ ...$context }) {
1080
+ if (!$ignoreRdfType && !$resource.isInstanceOf(OwlOntologyStatic.$fromRdfType)) {
1081
+ return $resource
1082
+ .value($RdfVocabularies.rdf.type)
1083
+ .chain((actualRdfType) => actualRdfType.toIri())
1084
+ .chain((actualRdfType) => purify.Left(new Error(`${rdfjsResource.Resource.Identifier.toString($resource.identifier)} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/2002/07/owl#Ontology)`)));
1085
+ }
1086
+ const $identifier = $resource.identifier;
1087
+ const $type = "OwlOntology";
1088
+ const _labelsEither = purify.Either.sequence($resource
1089
+ .values(OwlOntologyStatic.$properties.labels["identifier"], { unique: true })
1090
+ .map((item) => item
1091
+ .toValues()
1092
+ .filter((_value) => {
1093
+ const _languageInOrDefault = $languageIn ?? [];
1094
+ if (_languageInOrDefault.length === 0) {
1095
+ return true;
1096
+ }
1097
+ const _valueLiteral = _value.toLiteral().toMaybe().extract();
1098
+ if (typeof _valueLiteral === "undefined") {
1099
+ return false;
1100
+ }
1101
+ return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
1102
+ })
1103
+ .head()
1104
+ .chain((value) => value.toLiteral())));
760
1105
  if (_labelsEither.isLeft()) {
761
1106
  return _labelsEither;
762
1107
  }
763
1108
  const labels = _labelsEither.unsafeCoerce();
764
- return purify.Either.of({ identifier, type, labels });
1109
+ return purify.Either.of({ $identifier, $type, labels });
765
1110
  }
766
- OwlOntology._propertiesFromRdf = _propertiesFromRdf;
767
- function fromRdf(parameters) {
768
- return OwlOntology._propertiesFromRdf(parameters);
1111
+ OwlOntologyStatic.$propertiesFromRdf = $propertiesFromRdf;
1112
+ function $fromRdf(parameters) {
1113
+ const { ignoreRdfType: _, ...otherParameters } = parameters;
1114
+ return ShaclmateOntology.$fromRdf(otherParameters).altLazy(() => OwlOntologyStatic.$propertiesFromRdf(parameters));
769
1115
  }
770
- OwlOntology.fromRdf = fromRdf;
771
- OwlOntology.fromRdfType = dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology");
772
- })(OwlOntology || (OwlOntology = {}));
1116
+ OwlOntologyStatic.$fromRdf = $fromRdf;
1117
+ function $toRdf(_owlOntology, { ignoreRdfType, mutateGraph, resourceSet, }) {
1118
+ const _resource = resourceSet.mutableResource(_owlOntology.$identifier, {
1119
+ mutateGraph,
1120
+ });
1121
+ if (!ignoreRdfType) {
1122
+ _resource.add($RdfVocabularies.rdf.type, _resource.dataFactory.namedNode("http://purl.org/shaclmate/ontology#OwlOntology"));
1123
+ _resource.add($RdfVocabularies.rdf.type, _resource.dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"));
1124
+ }
1125
+ _resource.add(OwlOntologyStatic.$properties.labels["identifier"], _owlOntology.labels.map((item) => item));
1126
+ return _resource;
1127
+ }
1128
+ OwlOntologyStatic.$toRdf = $toRdf;
1129
+ OwlOntologyStatic.$properties = {
1130
+ labels: {
1131
+ identifier: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
1132
+ },
1133
+ };
1134
+ })(OwlOntologyStatic || (OwlOntologyStatic = {}));
773
1135
  export var ShaclmateOntology;
774
1136
  (function (ShaclmateOntology) {
775
- function _propertiesFromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource,
1137
+ ShaclmateOntology.$fromRdfType = dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology");
1138
+ ShaclmateOntology.$Identifier = OwlOntologyStatic.$Identifier;
1139
+ function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, languageIn: $languageIn, objectSet: $objectSetParameter, resource: $resource,
776
1140
  // @ts-ignore
777
- ..._context }) {
778
- const _super0Either = OwlOntology._propertiesFromRdf({
779
- ..._context,
1141
+ ...$context }) {
1142
+ const $super0Either = OwlOntologyStatic.$propertiesFromRdf({
1143
+ ...$context,
780
1144
  ignoreRdfType: true,
781
- languageIn: _languageIn,
782
- resource: _resource,
1145
+ languageIn: $languageIn,
1146
+ resource: $resource,
783
1147
  });
784
- if (_super0Either.isLeft()) {
785
- return _super0Either;
786
- }
787
- const _super0 = _super0Either.unsafeCoerce();
788
- if (!_ignoreRdfType &&
789
- !_resource.isInstanceOf(dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"))) {
790
- return purify.Left(new rdfjsResource.Resource.ValueError({
791
- focusResource: _resource,
792
- message: `${rdfjsResource.Resource.Identifier.toString(_resource.identifier)} has unexpected RDF type`,
793
- predicate: dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"),
794
- }));
795
- }
796
- const identifier = _resource.identifier;
797
- const type = "ShaclmateOntology";
798
- const _tsDataFactoryVariableEither = purify.Either.of(_resource
799
- .values(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsDataFactoryVariable"), { unique: true })
800
- .head()
801
- .chain((_value) => _value.toString())
802
- .toMaybe());
803
- if (_tsDataFactoryVariableEither.isLeft()) {
804
- return _tsDataFactoryVariableEither;
805
- }
806
- const tsDataFactoryVariable = _tsDataFactoryVariableEither.unsafeCoerce();
807
- const _tsFeatureExcludesEither = purify.Either.of([
808
- ..._resource
809
- .values(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureExclude"), { unique: true })
810
- .flatMap((_item) => _item
811
- .toValues()
812
- .head()
813
- .chain((_value) => _value.toIri().chain((iri) => {
814
- switch (iri.value) {
815
- case "http://purl.org/shaclmate/ontology#_TsFeature_All":
816
- return purify.Either.of(iri);
817
- case "http://purl.org/shaclmate/ontology#_TsFeature_Create":
818
- return purify.Either.of(iri);
819
- case "http://purl.org/shaclmate/ontology#_TsFeature_Equals":
820
- return purify.Either.of(iri);
821
- case "http://purl.org/shaclmate/ontology#_TsFeature_FromJson":
822
- return purify.Either.of(iri);
823
- case "http://purl.org/shaclmate/ontology#_TsFeature_FromRdf":
824
- return purify.Either.of(iri);
825
- case "http://purl.org/shaclmate/ontology#_TsFeature_Hash":
826
- return purify.Either.of(iri);
827
- case "http://purl.org/shaclmate/ontology#_TsFeature_Json":
828
- return purify.Either.of(iri);
829
- case "http://purl.org/shaclmate/ontology#_TsFeature_JsonSchema":
830
- return purify.Either.of(iri);
831
- case "http://purl.org/shaclmate/ontology#_TsFeature_JsonUiSchema":
832
- return purify.Either.of(iri);
833
- case "http://purl.org/shaclmate/ontology#_TsFeature_None":
834
- return purify.Either.of(iri);
835
- case "http://purl.org/shaclmate/ontology#_TsFeature_Rdf":
836
- return purify.Either.of(iri);
837
- case "http://purl.org/shaclmate/ontology#_TsFeature_Sparql":
838
- return purify.Either.of(iri);
839
- case "http://purl.org/shaclmate/ontology#_TsFeature_ToJson":
840
- return purify.Either.of(iri);
841
- case "http://purl.org/shaclmate/ontology#_TsFeature_ToRdf":
842
- return purify.Either.of(iri);
843
- default:
844
- return purify.Left(new rdfjsResource.Resource.MistypedValueError({
845
- actualValue: iri,
846
- expectedValueType: 'rdfjs.NamedNode<"http://purl.org/shaclmate/ontology#_TsFeature_All" | "http://purl.org/shaclmate/ontology#_TsFeature_Create" | "http://purl.org/shaclmate/ontology#_TsFeature_Equals" | "http://purl.org/shaclmate/ontology#_TsFeature_FromJson" | "http://purl.org/shaclmate/ontology#_TsFeature_FromRdf" | "http://purl.org/shaclmate/ontology#_TsFeature_Hash" | "http://purl.org/shaclmate/ontology#_TsFeature_Json" | "http://purl.org/shaclmate/ontology#_TsFeature_JsonSchema" | "http://purl.org/shaclmate/ontology#_TsFeature_JsonUiSchema" | "http://purl.org/shaclmate/ontology#_TsFeature_None" | "http://purl.org/shaclmate/ontology#_TsFeature_Rdf" | "http://purl.org/shaclmate/ontology#_TsFeature_Sparql" | "http://purl.org/shaclmate/ontology#_TsFeature_ToJson" | "http://purl.org/shaclmate/ontology#_TsFeature_ToRdf">',
847
- focusResource: _resource,
848
- predicate: dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureExclude"),
849
- }));
850
- }
851
- }))
852
- .toMaybe()
853
- .toList()),
854
- ]);
1148
+ if ($super0Either.isLeft()) {
1149
+ return $super0Either;
1150
+ }
1151
+ const $super0 = $super0Either.unsafeCoerce();
1152
+ if (!$ignoreRdfType && !$resource.isInstanceOf(ShaclmateOntology.$fromRdfType)) {
1153
+ return $resource
1154
+ .value($RdfVocabularies.rdf.type)
1155
+ .chain((actualRdfType) => actualRdfType.toIri())
1156
+ .chain((actualRdfType) => purify.Left(new Error(`${rdfjsResource.Resource.Identifier.toString($resource.identifier)} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/2002/07/owl#Ontology)`)));
1157
+ }
1158
+ const $identifier = $resource.identifier;
1159
+ const $type = "ShaclmateOntology";
1160
+ const _tsFeatureExcludesEither = purify.Either.sequence($resource
1161
+ .values(ShaclmateOntology.$properties.tsFeatureExcludes["identifier"], { unique: true })
1162
+ .map((item) => item
1163
+ .toValues()
1164
+ .head()
1165
+ .chain((value) => value.toIri().chain((iri) => {
1166
+ switch (iri.value) {
1167
+ case "http://purl.org/shaclmate/ontology#_TsFeatures_All":
1168
+ return purify.Either.of(iri);
1169
+ case "http://purl.org/shaclmate/ontology#_TsFeature_Create":
1170
+ return purify.Either.of(iri);
1171
+ case "http://purl.org/shaclmate/ontology#_TsFeatures_Default":
1172
+ return purify.Either.of(iri);
1173
+ case "http://purl.org/shaclmate/ontology#_TsFeature_Equals":
1174
+ return purify.Either.of(iri);
1175
+ case "http://purl.org/shaclmate/ontology#_TsFeature_Graphql":
1176
+ return purify.Either.of(iri);
1177
+ case "http://purl.org/shaclmate/ontology#_TsFeature_Hash":
1178
+ return purify.Either.of(iri);
1179
+ case "http://purl.org/shaclmate/ontology#_TsFeature_Json":
1180
+ return purify.Either.of(iri);
1181
+ case "http://purl.org/shaclmate/ontology#_TsFeatures_None":
1182
+ return purify.Either.of(iri);
1183
+ case "http://purl.org/shaclmate/ontology#_TsFeature_Rdf":
1184
+ return purify.Either.of(iri);
1185
+ case "http://purl.org/shaclmate/ontology#_TsFeature_Sparql":
1186
+ return purify.Either.of(iri);
1187
+ default:
1188
+ return purify.Left(new rdfjsResource.Resource.MistypedValueError({
1189
+ actualValue: iri,
1190
+ expectedValueType: 'rdfjs.NamedNode<"http://purl.org/shaclmate/ontology#_TsFeatures_All" | "http://purl.org/shaclmate/ontology#_TsFeature_Create" | "http://purl.org/shaclmate/ontology#_TsFeatures_Default" | "http://purl.org/shaclmate/ontology#_TsFeature_Equals" | "http://purl.org/shaclmate/ontology#_TsFeature_Graphql" | "http://purl.org/shaclmate/ontology#_TsFeature_Hash" | "http://purl.org/shaclmate/ontology#_TsFeature_Json" | "http://purl.org/shaclmate/ontology#_TsFeatures_None" | "http://purl.org/shaclmate/ontology#_TsFeature_Rdf" | "http://purl.org/shaclmate/ontology#_TsFeature_Sparql">',
1191
+ focusResource: $resource,
1192
+ predicate: ShaclmateNodeShape.$properties.tsFeatureExcludes["identifier"],
1193
+ }));
1194
+ }
1195
+ }))));
855
1196
  if (_tsFeatureExcludesEither.isLeft()) {
856
1197
  return _tsFeatureExcludesEither;
857
1198
  }
858
1199
  const tsFeatureExcludes = _tsFeatureExcludesEither.unsafeCoerce();
859
- const _tsFeatureIncludesEither = purify.Either.of([
860
- ..._resource
861
- .values(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureInclude"), { unique: true })
862
- .flatMap((_item) => _item
863
- .toValues()
864
- .head()
865
- .chain((_value) => _value.toIri().chain((iri) => {
866
- switch (iri.value) {
867
- case "http://purl.org/shaclmate/ontology#_TsFeature_All":
868
- return purify.Either.of(iri);
869
- case "http://purl.org/shaclmate/ontology#_TsFeature_Create":
870
- return purify.Either.of(iri);
871
- case "http://purl.org/shaclmate/ontology#_TsFeature_Equals":
872
- return purify.Either.of(iri);
873
- case "http://purl.org/shaclmate/ontology#_TsFeature_FromJson":
874
- return purify.Either.of(iri);
875
- case "http://purl.org/shaclmate/ontology#_TsFeature_FromRdf":
876
- return purify.Either.of(iri);
877
- case "http://purl.org/shaclmate/ontology#_TsFeature_Hash":
878
- return purify.Either.of(iri);
879
- case "http://purl.org/shaclmate/ontology#_TsFeature_Json":
880
- return purify.Either.of(iri);
881
- case "http://purl.org/shaclmate/ontology#_TsFeature_JsonSchema":
882
- return purify.Either.of(iri);
883
- case "http://purl.org/shaclmate/ontology#_TsFeature_JsonUiSchema":
884
- return purify.Either.of(iri);
885
- case "http://purl.org/shaclmate/ontology#_TsFeature_None":
886
- return purify.Either.of(iri);
887
- case "http://purl.org/shaclmate/ontology#_TsFeature_Rdf":
888
- return purify.Either.of(iri);
889
- case "http://purl.org/shaclmate/ontology#_TsFeature_Sparql":
890
- return purify.Either.of(iri);
891
- case "http://purl.org/shaclmate/ontology#_TsFeature_ToJson":
892
- return purify.Either.of(iri);
893
- case "http://purl.org/shaclmate/ontology#_TsFeature_ToRdf":
894
- return purify.Either.of(iri);
895
- default:
896
- return purify.Left(new rdfjsResource.Resource.MistypedValueError({
897
- actualValue: iri,
898
- expectedValueType: 'rdfjs.NamedNode<"http://purl.org/shaclmate/ontology#_TsFeature_All" | "http://purl.org/shaclmate/ontology#_TsFeature_Create" | "http://purl.org/shaclmate/ontology#_TsFeature_Equals" | "http://purl.org/shaclmate/ontology#_TsFeature_FromJson" | "http://purl.org/shaclmate/ontology#_TsFeature_FromRdf" | "http://purl.org/shaclmate/ontology#_TsFeature_Hash" | "http://purl.org/shaclmate/ontology#_TsFeature_Json" | "http://purl.org/shaclmate/ontology#_TsFeature_JsonSchema" | "http://purl.org/shaclmate/ontology#_TsFeature_JsonUiSchema" | "http://purl.org/shaclmate/ontology#_TsFeature_None" | "http://purl.org/shaclmate/ontology#_TsFeature_Rdf" | "http://purl.org/shaclmate/ontology#_TsFeature_Sparql" | "http://purl.org/shaclmate/ontology#_TsFeature_ToJson" | "http://purl.org/shaclmate/ontology#_TsFeature_ToRdf">',
899
- focusResource: _resource,
900
- predicate: dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureInclude"),
901
- }));
902
- }
903
- }))
904
- .toMaybe()
905
- .toList()),
906
- ]);
1200
+ const _tsFeatureIncludesEither = purify.Either.sequence($resource
1201
+ .values(ShaclmateOntology.$properties.tsFeatureIncludes["identifier"], { unique: true })
1202
+ .map((item) => item
1203
+ .toValues()
1204
+ .head()
1205
+ .chain((value) => value.toIri().chain((iri) => {
1206
+ switch (iri.value) {
1207
+ case "http://purl.org/shaclmate/ontology#_TsFeatures_All":
1208
+ return purify.Either.of(iri);
1209
+ case "http://purl.org/shaclmate/ontology#_TsFeature_Create":
1210
+ return purify.Either.of(iri);
1211
+ case "http://purl.org/shaclmate/ontology#_TsFeatures_Default":
1212
+ return purify.Either.of(iri);
1213
+ case "http://purl.org/shaclmate/ontology#_TsFeature_Equals":
1214
+ return purify.Either.of(iri);
1215
+ case "http://purl.org/shaclmate/ontology#_TsFeature_Graphql":
1216
+ return purify.Either.of(iri);
1217
+ case "http://purl.org/shaclmate/ontology#_TsFeature_Hash":
1218
+ return purify.Either.of(iri);
1219
+ case "http://purl.org/shaclmate/ontology#_TsFeature_Json":
1220
+ return purify.Either.of(iri);
1221
+ case "http://purl.org/shaclmate/ontology#_TsFeatures_None":
1222
+ return purify.Either.of(iri);
1223
+ case "http://purl.org/shaclmate/ontology#_TsFeature_Rdf":
1224
+ return purify.Either.of(iri);
1225
+ case "http://purl.org/shaclmate/ontology#_TsFeature_Sparql":
1226
+ return purify.Either.of(iri);
1227
+ default:
1228
+ return purify.Left(new rdfjsResource.Resource.MistypedValueError({
1229
+ actualValue: iri,
1230
+ expectedValueType: 'rdfjs.NamedNode<"http://purl.org/shaclmate/ontology#_TsFeatures_All" | "http://purl.org/shaclmate/ontology#_TsFeature_Create" | "http://purl.org/shaclmate/ontology#_TsFeatures_Default" | "http://purl.org/shaclmate/ontology#_TsFeature_Equals" | "http://purl.org/shaclmate/ontology#_TsFeature_Graphql" | "http://purl.org/shaclmate/ontology#_TsFeature_Hash" | "http://purl.org/shaclmate/ontology#_TsFeature_Json" | "http://purl.org/shaclmate/ontology#_TsFeatures_None" | "http://purl.org/shaclmate/ontology#_TsFeature_Rdf" | "http://purl.org/shaclmate/ontology#_TsFeature_Sparql">',
1231
+ focusResource: $resource,
1232
+ predicate: ShaclmateNodeShape.$properties.tsFeatureIncludes["identifier"],
1233
+ }));
1234
+ }
1235
+ }))));
907
1236
  if (_tsFeatureIncludesEither.isLeft()) {
908
1237
  return _tsFeatureIncludesEither;
909
1238
  }
910
1239
  const tsFeatureIncludes = _tsFeatureIncludesEither.unsafeCoerce();
911
- const _tsImportsEither = purify.Either.of([
912
- ..._resource
913
- .values(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsImport"), { unique: true })
914
- .flatMap((_item) => _item
915
- .toValues()
916
- .head()
917
- .chain((_value) => _value.toString())
918
- .toMaybe()
919
- .toList()),
920
- ]);
1240
+ const _tsImportsEither = purify.Either.sequence($resource
1241
+ .values(ShaclmateOntology.$properties.tsImports["identifier"], { unique: true })
1242
+ .map((item) => item
1243
+ .toValues()
1244
+ .head()
1245
+ .chain((value) => value.toString())));
921
1246
  if (_tsImportsEither.isLeft()) {
922
1247
  return _tsImportsEither;
923
1248
  }
924
1249
  const tsImports = _tsImportsEither.unsafeCoerce();
925
- const _tsObjectDeclarationTypeEither = purify.Either.of(_resource
926
- .values(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsObjectDeclarationType"), { unique: true })
1250
+ const _tsObjectDeclarationTypeEither = $resource
1251
+ .values(ShaclmateOntology.$properties.tsObjectDeclarationType["identifier"], {
1252
+ unique: true,
1253
+ })
927
1254
  .head()
928
- .chain((_value) => _value.toIri().chain((iri) => {
1255
+ .chain((value) => value.toIri().chain((iri) => {
929
1256
  switch (iri.value) {
930
1257
  case "http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Class":
931
1258
  return purify.Either.of(iri);
@@ -935,212 +1262,271 @@ export var ShaclmateOntology;
935
1262
  return purify.Left(new rdfjsResource.Resource.MistypedValueError({
936
1263
  actualValue: iri,
937
1264
  expectedValueType: 'rdfjs.NamedNode<"http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Class" | "http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Interface">',
938
- focusResource: _resource,
939
- predicate: dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsObjectDeclarationType"),
1265
+ focusResource: $resource,
1266
+ predicate: ShaclmateNodeShape.$properties.tsObjectDeclarationType["identifier"],
940
1267
  }));
941
1268
  }
942
1269
  }))
943
- .toMaybe());
1270
+ .map((value) => purify.Maybe.of(value))
1271
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
1272
+ ? purify.Right(purify.Maybe.empty())
1273
+ : purify.Left(error));
944
1274
  if (_tsObjectDeclarationTypeEither.isLeft()) {
945
1275
  return _tsObjectDeclarationTypeEither;
946
1276
  }
947
1277
  const tsObjectDeclarationType = _tsObjectDeclarationTypeEither.unsafeCoerce();
948
- const _tsObjectIdentifierPrefixPropertyNameEither = purify.Either.of(_resource
949
- .values(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsObjectIdentifierPrefixPropertyName"), { unique: true })
950
- .head()
951
- .chain((_value) => _value.toString())
952
- .toMaybe());
953
- if (_tsObjectIdentifierPrefixPropertyNameEither.isLeft()) {
954
- return _tsObjectIdentifierPrefixPropertyNameEither;
955
- }
956
- const tsObjectIdentifierPrefixPropertyName = _tsObjectIdentifierPrefixPropertyNameEither.unsafeCoerce();
957
- const _tsObjectIdentifierPropertyNameEither = purify.Either.of(_resource
958
- .values(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsObjectIdentifierPropertyName"), { unique: true })
959
- .head()
960
- .chain((_value) => _value.toString())
961
- .toMaybe());
962
- if (_tsObjectIdentifierPropertyNameEither.isLeft()) {
963
- return _tsObjectIdentifierPropertyNameEither;
964
- }
965
- const tsObjectIdentifierPropertyName = _tsObjectIdentifierPropertyNameEither.unsafeCoerce();
966
- const _tsObjectTypeDiscriminatorPropertyNameEither = purify.Either.of(_resource
967
- .values(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsObjectTypeDiscriminatorPropertyName"), { unique: true })
968
- .head()
969
- .chain((_value) => _value.toString())
970
- .toMaybe());
971
- if (_tsObjectTypeDiscriminatorPropertyNameEither.isLeft()) {
972
- return _tsObjectTypeDiscriminatorPropertyNameEither;
973
- }
974
- const tsObjectTypeDiscriminatorPropertyName = _tsObjectTypeDiscriminatorPropertyNameEither.unsafeCoerce();
975
1278
  return purify.Either.of({
976
- ..._super0,
977
- identifier,
978
- type,
979
- tsDataFactoryVariable,
1279
+ ...$super0,
1280
+ $identifier,
1281
+ $type,
980
1282
  tsFeatureExcludes,
981
1283
  tsFeatureIncludes,
982
1284
  tsImports,
983
1285
  tsObjectDeclarationType,
984
- tsObjectIdentifierPrefixPropertyName,
985
- tsObjectIdentifierPropertyName,
986
- tsObjectTypeDiscriminatorPropertyName,
987
1286
  });
988
1287
  }
989
- ShaclmateOntology._propertiesFromRdf = _propertiesFromRdf;
990
- function fromRdf(parameters) {
991
- return ShaclmateOntology._propertiesFromRdf(parameters);
1288
+ ShaclmateOntology.$propertiesFromRdf = $propertiesFromRdf;
1289
+ function $fromRdf(parameters) {
1290
+ return ShaclmateOntology.$propertiesFromRdf(parameters);
992
1291
  }
993
- ShaclmateOntology.fromRdf = fromRdf;
994
- ShaclmateOntology.fromRdfType = dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology");
1292
+ ShaclmateOntology.$fromRdf = $fromRdf;
1293
+ function $toRdf(_shaclmateOntology, { ignoreRdfType, mutateGraph, resourceSet, }) {
1294
+ const _resource = OwlOntologyStatic.$toRdf(_shaclmateOntology, {
1295
+ ignoreRdfType: true,
1296
+ mutateGraph,
1297
+ resourceSet,
1298
+ });
1299
+ if (!ignoreRdfType) {
1300
+ _resource.add($RdfVocabularies.rdf.type, _resource.dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"));
1301
+ }
1302
+ _resource.add(ShaclmateNodeShape.$properties.tsFeatureExcludes["identifier"], _shaclmateOntology.tsFeatureExcludes.map((item) => item));
1303
+ _resource.add(ShaclmateNodeShape.$properties.tsFeatureIncludes["identifier"], _shaclmateOntology.tsFeatureIncludes.map((item) => item));
1304
+ _resource.add(ShaclmateNodeShape.$properties.tsImports["identifier"], _shaclmateOntology.tsImports.map((item) => item));
1305
+ _resource.add(ShaclmateNodeShape.$properties.tsObjectDeclarationType["identifier"], _shaclmateOntology.tsObjectDeclarationType);
1306
+ return _resource;
1307
+ }
1308
+ ShaclmateOntology.$toRdf = $toRdf;
1309
+ ShaclmateOntology.$properties = {
1310
+ ...OwlOntologyStatic.$properties,
1311
+ tsFeatureExcludes: {
1312
+ identifier: dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureExclude"),
1313
+ },
1314
+ tsFeatureIncludes: {
1315
+ identifier: dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureInclude"),
1316
+ },
1317
+ tsImports: {
1318
+ identifier: dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsImport"),
1319
+ },
1320
+ tsObjectDeclarationType: {
1321
+ identifier: dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsObjectDeclarationType"),
1322
+ },
1323
+ };
995
1324
  })(ShaclmateOntology || (ShaclmateOntology = {}));
996
- export var ShaclCoreNodeShape;
997
- (function (ShaclCoreNodeShape) {
998
- function _propertiesFromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource,
1325
+ export var ShaclCoreNodeShapeStatic;
1326
+ (function (ShaclCoreNodeShapeStatic) {
1327
+ ShaclCoreNodeShapeStatic.$fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape");
1328
+ ShaclCoreNodeShapeStatic.$Identifier = BaseShaclCoreShapeStatic.$Identifier;
1329
+ function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, languageIn: $languageIn, objectSet: $objectSetParameter, resource: $resource,
999
1330
  // @ts-ignore
1000
- ..._context }) {
1001
- const _super0Either = BaseShaclCoreShape._propertiesFromRdf({
1002
- ..._context,
1331
+ ...$context }) {
1332
+ const $super0Either = BaseShaclCoreShapeStatic.$propertiesFromRdf({
1333
+ ...$context,
1003
1334
  ignoreRdfType: true,
1004
- languageIn: _languageIn,
1005
- resource: _resource,
1335
+ languageIn: $languageIn,
1336
+ resource: $resource,
1006
1337
  });
1007
- if (_super0Either.isLeft()) {
1008
- return _super0Either;
1009
- }
1010
- const _super0 = _super0Either.unsafeCoerce();
1011
- if (!_ignoreRdfType &&
1012
- !_resource.isInstanceOf(dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape"))) {
1013
- return purify.Left(new rdfjsResource.Resource.ValueError({
1014
- focusResource: _resource,
1015
- message: `${rdfjsResource.Resource.Identifier.toString(_resource.identifier)} has unexpected RDF type`,
1016
- predicate: dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape"),
1017
- }));
1018
- }
1019
- const identifier = _resource.identifier;
1020
- const type = "ShaclCoreNodeShape";
1021
- const _closedEither = purify.Either.of(_resource
1022
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#closed"), {
1023
- unique: true,
1024
- })
1338
+ if ($super0Either.isLeft()) {
1339
+ return $super0Either;
1340
+ }
1341
+ const $super0 = $super0Either.unsafeCoerce();
1342
+ if (!$ignoreRdfType && !$resource.isInstanceOf(ShaclCoreNodeShapeStatic.$fromRdfType)) {
1343
+ return $resource
1344
+ .value($RdfVocabularies.rdf.type)
1345
+ .chain((actualRdfType) => actualRdfType.toIri())
1346
+ .chain((actualRdfType) => purify.Left(new Error(`${rdfjsResource.Resource.Identifier.toString($resource.identifier)} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#NodeShape)`)));
1347
+ }
1348
+ const $identifier = $resource.identifier;
1349
+ const $type = "ShaclCoreNodeShape";
1350
+ const _closedEither = $resource
1351
+ .values(ShaclCoreNodeShapeStatic.$properties.closed["identifier"], { unique: true })
1025
1352
  .head()
1026
- .chain((_value) => _value.toBoolean())
1027
- .toMaybe());
1353
+ .chain((value) => value.toBoolean())
1354
+ .map((value) => purify.Maybe.of(value))
1355
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
1356
+ ? purify.Right(purify.Maybe.empty())
1357
+ : purify.Left(error));
1028
1358
  if (_closedEither.isLeft()) {
1029
1359
  return _closedEither;
1030
1360
  }
1031
1361
  const closed = _closedEither.unsafeCoerce();
1032
- const _ignoredPropertiesEither = purify.Either.of(_resource
1033
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#ignoredProperties"), { unique: true })
1362
+ const _ignoredPropertiesEither = $resource
1363
+ .values(ShaclCoreNodeShapeStatic.$properties.ignoredProperties["identifier"], { unique: true })
1034
1364
  .head()
1035
1365
  .chain((value) => value.toList())
1036
- .map((values) => values.flatMap((_value) => _value
1366
+ .chain((values) => purify.Either.sequence(values.map((value) => value
1037
1367
  .toValues()
1038
1368
  .head()
1039
- .chain((_value) => _value.toIri())
1040
- .toMaybe()
1041
- .toList()))
1042
- .toMaybe());
1369
+ .chain((value) => value.toIri()))))
1370
+ .map((value) => purify.Maybe.of(value))
1371
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
1372
+ ? purify.Right(purify.Maybe.empty())
1373
+ : purify.Left(error));
1043
1374
  if (_ignoredPropertiesEither.isLeft()) {
1044
1375
  return _ignoredPropertiesEither;
1045
1376
  }
1046
1377
  const ignoredProperties = _ignoredPropertiesEither.unsafeCoerce();
1047
- const _propertiesEither = purify.Either.of([
1048
- ..._resource
1049
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#property"), {
1050
- unique: true,
1051
- })
1052
- .flatMap((_item) => _item
1053
- .toValues()
1054
- .head()
1055
- .chain((_value) => _value.toIdentifier())
1056
- .toMaybe()
1057
- .toList()),
1058
- ]);
1378
+ const _propertiesEither = purify.Either.sequence($resource
1379
+ .values(ShaclCoreNodeShapeStatic.$properties.properties["identifier"], { unique: true })
1380
+ .map((item) => item
1381
+ .toValues()
1382
+ .head()
1383
+ .chain((value) => value.toIdentifier())));
1059
1384
  if (_propertiesEither.isLeft()) {
1060
1385
  return _propertiesEither;
1061
1386
  }
1062
1387
  const properties = _propertiesEither.unsafeCoerce();
1063
1388
  return purify.Either.of({
1064
- ..._super0,
1065
- identifier,
1066
- type,
1389
+ ...$super0,
1390
+ $identifier,
1391
+ $type,
1067
1392
  closed,
1068
1393
  ignoredProperties,
1069
1394
  properties,
1070
1395
  });
1071
1396
  }
1072
- ShaclCoreNodeShape._propertiesFromRdf = _propertiesFromRdf;
1073
- function fromRdf(parameters) {
1074
- return ShaclCoreNodeShape._propertiesFromRdf(parameters);
1397
+ ShaclCoreNodeShapeStatic.$propertiesFromRdf = $propertiesFromRdf;
1398
+ function $fromRdf(parameters) {
1399
+ const { ignoreRdfType: _, ...otherParameters } = parameters;
1400
+ return ShaclmateNodeShape.$fromRdf(otherParameters).altLazy(() => ShaclCoreNodeShapeStatic.$propertiesFromRdf(parameters));
1401
+ }
1402
+ ShaclCoreNodeShapeStatic.$fromRdf = $fromRdf;
1403
+ function $toRdf(_shaclCoreNodeShape, { ignoreRdfType, mutateGraph, resourceSet, }) {
1404
+ const _resource = BaseShaclCoreShapeStatic.$toRdf(_shaclCoreNodeShape, {
1405
+ ignoreRdfType: true,
1406
+ mutateGraph,
1407
+ resourceSet,
1408
+ });
1409
+ if (!ignoreRdfType) {
1410
+ _resource.add($RdfVocabularies.rdf.type, _resource.dataFactory.namedNode("http://purl.org/shaclmate/ontology#ShaclCoreNodeShape"));
1411
+ _resource.add($RdfVocabularies.rdf.type, _resource.dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape"));
1412
+ }
1413
+ _resource.add(ShaclCoreNodeShapeStatic.$properties.closed["identifier"], _shaclCoreNodeShape.closed);
1414
+ _resource.add(ShaclCoreNodeShapeStatic.$properties.ignoredProperties["identifier"], _shaclCoreNodeShape.ignoredProperties.map((value) => value.length > 0
1415
+ ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
1416
+ if (itemIndex === 0) {
1417
+ currentSubListResource = listResource;
1418
+ }
1419
+ else {
1420
+ const newSubListResource = resourceSet.mutableResource(dataFactory.blankNode(), { mutateGraph });
1421
+ currentSubListResource.add($RdfVocabularies.rdf.rest, newSubListResource.identifier);
1422
+ currentSubListResource = newSubListResource;
1423
+ }
1424
+ currentSubListResource.add($RdfVocabularies.rdf.first, item);
1425
+ if (itemIndex + 1 === list.length) {
1426
+ currentSubListResource.add($RdfVocabularies.rdf.rest, $RdfVocabularies.rdf.nil);
1427
+ }
1428
+ return { currentSubListResource, listResource };
1429
+ }, {
1430
+ currentSubListResource: null,
1431
+ listResource: resourceSet.mutableResource(dataFactory.blankNode(), { mutateGraph }),
1432
+ }).listResource.identifier
1433
+ : $RdfVocabularies.rdf.nil));
1434
+ _resource.add(ShaclCoreNodeShapeStatic.$properties.properties["identifier"], _shaclCoreNodeShape.properties.map((item) => item));
1435
+ return _resource;
1075
1436
  }
1076
- ShaclCoreNodeShape.fromRdf = fromRdf;
1077
- ShaclCoreNodeShape.fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape");
1078
- })(ShaclCoreNodeShape || (ShaclCoreNodeShape = {}));
1437
+ ShaclCoreNodeShapeStatic.$toRdf = $toRdf;
1438
+ ShaclCoreNodeShapeStatic.$properties = {
1439
+ ...BaseShaclCoreShapeStatic.$properties,
1440
+ closed: {
1441
+ identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#closed"),
1442
+ },
1443
+ ignoredProperties: {
1444
+ identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#ignoredProperties"),
1445
+ },
1446
+ properties: {
1447
+ identifier: dataFactory.namedNode("http://www.w3.org/ns/shacl#property"),
1448
+ },
1449
+ };
1450
+ })(ShaclCoreNodeShapeStatic || (ShaclCoreNodeShapeStatic = {}));
1079
1451
  export var ShaclmateNodeShape;
1080
1452
  (function (ShaclmateNodeShape) {
1081
- function _propertiesFromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource,
1453
+ ShaclmateNodeShape.$fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape");
1454
+ ShaclmateNodeShape.$Identifier = ShaclCoreNodeShapeStatic.$Identifier;
1455
+ function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, languageIn: $languageIn, objectSet: $objectSetParameter, resource: $resource,
1082
1456
  // @ts-ignore
1083
- ..._context }) {
1084
- const _super0Either = ShaclCoreNodeShape._propertiesFromRdf({
1085
- ..._context,
1457
+ ...$context }) {
1458
+ const $super0Either = ShaclCoreNodeShapeStatic.$propertiesFromRdf({
1459
+ ...$context,
1086
1460
  ignoreRdfType: true,
1087
- languageIn: _languageIn,
1088
- resource: _resource,
1461
+ languageIn: $languageIn,
1462
+ resource: $resource,
1089
1463
  });
1090
- if (_super0Either.isLeft()) {
1091
- return _super0Either;
1092
- }
1093
- const _super0 = _super0Either.unsafeCoerce();
1094
- if (!_ignoreRdfType &&
1095
- !_resource.isInstanceOf(dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape"))) {
1096
- return purify.Left(new rdfjsResource.Resource.ValueError({
1097
- focusResource: _resource,
1098
- message: `${rdfjsResource.Resource.Identifier.toString(_resource.identifier)} has unexpected RDF type`,
1099
- predicate: dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape"),
1100
- }));
1101
- }
1102
- const identifier = _resource.identifier;
1103
- const type = "ShaclmateNodeShape";
1104
- const _abstractEither = purify.Either.of(_resource
1105
- .values(dataFactory.namedNode("http://purl.org/shaclmate/ontology#abstract"), { unique: true })
1464
+ if ($super0Either.isLeft()) {
1465
+ return $super0Either;
1466
+ }
1467
+ const $super0 = $super0Either.unsafeCoerce();
1468
+ if (!$ignoreRdfType && !$resource.isInstanceOf(ShaclmateNodeShape.$fromRdfType)) {
1469
+ return $resource
1470
+ .value($RdfVocabularies.rdf.type)
1471
+ .chain((actualRdfType) => actualRdfType.toIri())
1472
+ .chain((actualRdfType) => purify.Left(new Error(`${rdfjsResource.Resource.Identifier.toString($resource.identifier)} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#NodeShape)`)));
1473
+ }
1474
+ const $identifier = $resource.identifier;
1475
+ const $type = "ShaclmateNodeShape";
1476
+ const _abstractEither = $resource
1477
+ .values(ShaclmateNodeShape.$properties.abstract["identifier"], { unique: true })
1106
1478
  .head()
1107
- .chain((_value) => _value.toBoolean())
1108
- .toMaybe());
1479
+ .chain((value) => value.toBoolean())
1480
+ .map((value) => purify.Maybe.of(value))
1481
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
1482
+ ? purify.Right(purify.Maybe.empty())
1483
+ : purify.Left(error));
1109
1484
  if (_abstractEither.isLeft()) {
1110
1485
  return _abstractEither;
1111
1486
  }
1112
1487
  const abstract = _abstractEither.unsafeCoerce();
1113
- const _export_Either = purify.Either.of(_resource
1114
- .values(dataFactory.namedNode("http://purl.org/shaclmate/ontology#export"), { unique: true })
1488
+ const _export_Either = $resource
1489
+ .values(ShaclmateNodeShape.$properties.export_["identifier"], { unique: true })
1115
1490
  .head()
1116
- .chain((_value) => _value.toBoolean())
1117
- .toMaybe());
1491
+ .chain((value) => value.toBoolean())
1492
+ .map((value) => purify.Maybe.of(value))
1493
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
1494
+ ? purify.Right(purify.Maybe.empty())
1495
+ : purify.Left(error));
1118
1496
  if (_export_Either.isLeft()) {
1119
1497
  return _export_Either;
1120
1498
  }
1121
1499
  const export_ = _export_Either.unsafeCoerce();
1122
- const _externEither = purify.Either.of(_resource
1123
- .values(dataFactory.namedNode("http://purl.org/shaclmate/ontology#extern"), { unique: true })
1500
+ const _externEither = $resource
1501
+ .values(ShaclmateNodeShape.$properties.extern["identifier"], { unique: true })
1124
1502
  .head()
1125
- .chain((_value) => _value.toBoolean())
1126
- .toMaybe());
1503
+ .chain((value) => value.toBoolean())
1504
+ .map((value) => purify.Maybe.of(value))
1505
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
1506
+ ? purify.Right(purify.Maybe.empty())
1507
+ : purify.Left(error));
1127
1508
  if (_externEither.isLeft()) {
1128
1509
  return _externEither;
1129
1510
  }
1130
1511
  const extern = _externEither.unsafeCoerce();
1131
- const _fromRdfTypeEither = purify.Either.of(_resource
1132
- .values(dataFactory.namedNode("http://purl.org/shaclmate/ontology#fromRdfType"), { unique: true })
1512
+ const _fromRdfTypeEither = $resource
1513
+ .values(ShaclmateNodeShape.$properties.fromRdfType["identifier"], { unique: true })
1133
1514
  .head()
1134
- .chain((_value) => _value.toIri())
1135
- .toMaybe());
1515
+ .chain((value) => value.toIri())
1516
+ .map((value) => purify.Maybe.of(value))
1517
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
1518
+ ? purify.Right(purify.Maybe.empty())
1519
+ : purify.Left(error));
1136
1520
  if (_fromRdfTypeEither.isLeft()) {
1137
1521
  return _fromRdfTypeEither;
1138
1522
  }
1139
1523
  const fromRdfType = _fromRdfTypeEither.unsafeCoerce();
1140
- const _identifierMintingStrategyEither = purify.Either.of(_resource
1141
- .values(dataFactory.namedNode("http://purl.org/shaclmate/ontology#identifierMintingStrategy"), { unique: true })
1524
+ const _identifierMintingStrategyEither = $resource
1525
+ .values(ShaclmateNodeShape.$properties.identifierMintingStrategy["identifier"], {
1526
+ unique: true,
1527
+ })
1142
1528
  .head()
1143
- .chain((_value) => _value.toIri().chain((iri) => {
1529
+ .chain((value) => value.toIri().chain((iri) => {
1144
1530
  switch (iri.value) {
1145
1531
  case "http://purl.org/shaclmate/ontology#_IdentifierMintingStrategy_BlankNode":
1146
1532
  return purify.Either.of(iri);
@@ -1152,170 +1538,161 @@ export var ShaclmateNodeShape;
1152
1538
  return purify.Left(new rdfjsResource.Resource.MistypedValueError({
1153
1539
  actualValue: iri,
1154
1540
  expectedValueType: 'rdfjs.NamedNode<"http://purl.org/shaclmate/ontology#_IdentifierMintingStrategy_BlankNode" | "http://purl.org/shaclmate/ontology#_IdentifierMintingStrategy_SHA256" | "http://purl.org/shaclmate/ontology#_IdentifierMintingStrategy_UUIDv4">',
1155
- focusResource: _resource,
1156
- predicate: dataFactory.namedNode("http://purl.org/shaclmate/ontology#identifierMintingStrategy"),
1541
+ focusResource: $resource,
1542
+ predicate: ShaclmateNodeShape.$properties.identifierMintingStrategy["identifier"],
1157
1543
  }));
1158
1544
  }
1159
1545
  }))
1160
- .toMaybe());
1546
+ .map((value) => purify.Maybe.of(value))
1547
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
1548
+ ? purify.Right(purify.Maybe.empty())
1549
+ : purify.Left(error));
1161
1550
  if (_identifierMintingStrategyEither.isLeft()) {
1162
1551
  return _identifierMintingStrategyEither;
1163
1552
  }
1164
1553
  const identifierMintingStrategy = _identifierMintingStrategyEither.unsafeCoerce();
1165
- const _mutableEither = purify.Either.of(_resource
1166
- .values(dataFactory.namedNode("http://purl.org/shaclmate/ontology#mutable"), { unique: true })
1554
+ const _mutableEither = $resource
1555
+ .values(ShaclmateNodeShape.$properties.mutable["identifier"], { unique: true })
1167
1556
  .head()
1168
- .chain((_value) => _value.toBoolean())
1169
- .toMaybe());
1557
+ .chain((value) => value.toBoolean())
1558
+ .map((value) => purify.Maybe.of(value))
1559
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
1560
+ ? purify.Right(purify.Maybe.empty())
1561
+ : purify.Left(error));
1170
1562
  if (_mutableEither.isLeft()) {
1171
1563
  return _mutableEither;
1172
1564
  }
1173
1565
  const mutable = _mutableEither.unsafeCoerce();
1174
- const _nameEither = purify.Either.of(_resource
1175
- .values(dataFactory.namedNode("http://purl.org/shaclmate/ontology#name"), { unique: true })
1566
+ const _nameEither = $resource
1567
+ .values(ShaclmateNodeShape.$properties.name["identifier"], { unique: true })
1176
1568
  .head()
1177
- .chain((_value) => _value.toString())
1178
- .toMaybe());
1569
+ .chain((value) => value.toString())
1570
+ .map((value) => purify.Maybe.of(value))
1571
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
1572
+ ? purify.Right(purify.Maybe.empty())
1573
+ : purify.Left(error));
1179
1574
  if (_nameEither.isLeft()) {
1180
1575
  return _nameEither;
1181
1576
  }
1182
1577
  const name = _nameEither.unsafeCoerce();
1183
- const _toRdfTypesEither = purify.Either.of([
1184
- ..._resource
1185
- .values(dataFactory.namedNode("http://purl.org/shaclmate/ontology#toRdfType"), { unique: true })
1186
- .flatMap((_item) => _item
1187
- .toValues()
1188
- .head()
1189
- .chain((_value) => _value.toIri())
1190
- .toMaybe()
1191
- .toList()),
1192
- ]);
1578
+ const _rdfTypeEither = $resource
1579
+ .values(ShaclmateNodeShape.$properties.rdfType["identifier"], { unique: true })
1580
+ .head()
1581
+ .chain((value) => value.toIri())
1582
+ .map((value) => purify.Maybe.of(value))
1583
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
1584
+ ? purify.Right(purify.Maybe.empty())
1585
+ : purify.Left(error));
1586
+ if (_rdfTypeEither.isLeft()) {
1587
+ return _rdfTypeEither;
1588
+ }
1589
+ const rdfType = _rdfTypeEither.unsafeCoerce();
1590
+ const _toRdfTypesEither = purify.Either.sequence($resource
1591
+ .values(ShaclmateNodeShape.$properties.toRdfTypes["identifier"], { unique: true })
1592
+ .map((item) => item
1593
+ .toValues()
1594
+ .head()
1595
+ .chain((value) => value.toIri())));
1193
1596
  if (_toRdfTypesEither.isLeft()) {
1194
1597
  return _toRdfTypesEither;
1195
1598
  }
1196
1599
  const toRdfTypes = _toRdfTypesEither.unsafeCoerce();
1197
- const _tsFeatureExcludesEither = purify.Either.of([
1198
- ..._resource
1199
- .values(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureExclude"), { unique: true })
1200
- .flatMap((_item) => _item
1201
- .toValues()
1202
- .head()
1203
- .chain((_value) => _value.toIri().chain((iri) => {
1204
- switch (iri.value) {
1205
- case "http://purl.org/shaclmate/ontology#_TsFeature_All":
1206
- return purify.Either.of(iri);
1207
- case "http://purl.org/shaclmate/ontology#_TsFeature_Create":
1208
- return purify.Either.of(iri);
1209
- case "http://purl.org/shaclmate/ontology#_TsFeature_Equals":
1210
- return purify.Either.of(iri);
1211
- case "http://purl.org/shaclmate/ontology#_TsFeature_FromJson":
1212
- return purify.Either.of(iri);
1213
- case "http://purl.org/shaclmate/ontology#_TsFeature_FromRdf":
1214
- return purify.Either.of(iri);
1215
- case "http://purl.org/shaclmate/ontology#_TsFeature_Hash":
1216
- return purify.Either.of(iri);
1217
- case "http://purl.org/shaclmate/ontology#_TsFeature_Json":
1218
- return purify.Either.of(iri);
1219
- case "http://purl.org/shaclmate/ontology#_TsFeature_JsonSchema":
1220
- return purify.Either.of(iri);
1221
- case "http://purl.org/shaclmate/ontology#_TsFeature_JsonUiSchema":
1222
- return purify.Either.of(iri);
1223
- case "http://purl.org/shaclmate/ontology#_TsFeature_None":
1224
- return purify.Either.of(iri);
1225
- case "http://purl.org/shaclmate/ontology#_TsFeature_Rdf":
1226
- return purify.Either.of(iri);
1227
- case "http://purl.org/shaclmate/ontology#_TsFeature_Sparql":
1228
- return purify.Either.of(iri);
1229
- case "http://purl.org/shaclmate/ontology#_TsFeature_ToJson":
1230
- return purify.Either.of(iri);
1231
- case "http://purl.org/shaclmate/ontology#_TsFeature_ToRdf":
1232
- return purify.Either.of(iri);
1233
- default:
1234
- return purify.Left(new rdfjsResource.Resource.MistypedValueError({
1235
- actualValue: iri,
1236
- expectedValueType: 'rdfjs.NamedNode<"http://purl.org/shaclmate/ontology#_TsFeature_All" | "http://purl.org/shaclmate/ontology#_TsFeature_Create" | "http://purl.org/shaclmate/ontology#_TsFeature_Equals" | "http://purl.org/shaclmate/ontology#_TsFeature_FromJson" | "http://purl.org/shaclmate/ontology#_TsFeature_FromRdf" | "http://purl.org/shaclmate/ontology#_TsFeature_Hash" | "http://purl.org/shaclmate/ontology#_TsFeature_Json" | "http://purl.org/shaclmate/ontology#_TsFeature_JsonSchema" | "http://purl.org/shaclmate/ontology#_TsFeature_JsonUiSchema" | "http://purl.org/shaclmate/ontology#_TsFeature_None" | "http://purl.org/shaclmate/ontology#_TsFeature_Rdf" | "http://purl.org/shaclmate/ontology#_TsFeature_Sparql" | "http://purl.org/shaclmate/ontology#_TsFeature_ToJson" | "http://purl.org/shaclmate/ontology#_TsFeature_ToRdf">',
1237
- focusResource: _resource,
1238
- predicate: dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureExclude"),
1239
- }));
1240
- }
1241
- }))
1242
- .toMaybe()
1243
- .toList()),
1244
- ]);
1600
+ const _tsFeatureExcludesEither = purify.Either.sequence($resource
1601
+ .values(ShaclmateNodeShape.$properties.tsFeatureExcludes["identifier"], { unique: true })
1602
+ .map((item) => item
1603
+ .toValues()
1604
+ .head()
1605
+ .chain((value) => value.toIri().chain((iri) => {
1606
+ switch (iri.value) {
1607
+ case "http://purl.org/shaclmate/ontology#_TsFeatures_All":
1608
+ return purify.Either.of(iri);
1609
+ case "http://purl.org/shaclmate/ontology#_TsFeature_Create":
1610
+ return purify.Either.of(iri);
1611
+ case "http://purl.org/shaclmate/ontology#_TsFeatures_Default":
1612
+ return purify.Either.of(iri);
1613
+ case "http://purl.org/shaclmate/ontology#_TsFeature_Equals":
1614
+ return purify.Either.of(iri);
1615
+ case "http://purl.org/shaclmate/ontology#_TsFeature_Graphql":
1616
+ return purify.Either.of(iri);
1617
+ case "http://purl.org/shaclmate/ontology#_TsFeature_Hash":
1618
+ return purify.Either.of(iri);
1619
+ case "http://purl.org/shaclmate/ontology#_TsFeature_Json":
1620
+ return purify.Either.of(iri);
1621
+ case "http://purl.org/shaclmate/ontology#_TsFeatures_None":
1622
+ return purify.Either.of(iri);
1623
+ case "http://purl.org/shaclmate/ontology#_TsFeature_Rdf":
1624
+ return purify.Either.of(iri);
1625
+ case "http://purl.org/shaclmate/ontology#_TsFeature_Sparql":
1626
+ return purify.Either.of(iri);
1627
+ default:
1628
+ return purify.Left(new rdfjsResource.Resource.MistypedValueError({
1629
+ actualValue: iri,
1630
+ expectedValueType: 'rdfjs.NamedNode<"http://purl.org/shaclmate/ontology#_TsFeatures_All" | "http://purl.org/shaclmate/ontology#_TsFeature_Create" | "http://purl.org/shaclmate/ontology#_TsFeatures_Default" | "http://purl.org/shaclmate/ontology#_TsFeature_Equals" | "http://purl.org/shaclmate/ontology#_TsFeature_Graphql" | "http://purl.org/shaclmate/ontology#_TsFeature_Hash" | "http://purl.org/shaclmate/ontology#_TsFeature_Json" | "http://purl.org/shaclmate/ontology#_TsFeatures_None" | "http://purl.org/shaclmate/ontology#_TsFeature_Rdf" | "http://purl.org/shaclmate/ontology#_TsFeature_Sparql">',
1631
+ focusResource: $resource,
1632
+ predicate: ShaclmateNodeShape.$properties.tsFeatureExcludes["identifier"],
1633
+ }));
1634
+ }
1635
+ }))));
1245
1636
  if (_tsFeatureExcludesEither.isLeft()) {
1246
1637
  return _tsFeatureExcludesEither;
1247
1638
  }
1248
1639
  const tsFeatureExcludes = _tsFeatureExcludesEither.unsafeCoerce();
1249
- const _tsFeatureIncludesEither = purify.Either.of([
1250
- ..._resource
1251
- .values(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureInclude"), { unique: true })
1252
- .flatMap((_item) => _item
1253
- .toValues()
1254
- .head()
1255
- .chain((_value) => _value.toIri().chain((iri) => {
1256
- switch (iri.value) {
1257
- case "http://purl.org/shaclmate/ontology#_TsFeature_All":
1258
- return purify.Either.of(iri);
1259
- case "http://purl.org/shaclmate/ontology#_TsFeature_Create":
1260
- return purify.Either.of(iri);
1261
- case "http://purl.org/shaclmate/ontology#_TsFeature_Equals":
1262
- return purify.Either.of(iri);
1263
- case "http://purl.org/shaclmate/ontology#_TsFeature_FromJson":
1264
- return purify.Either.of(iri);
1265
- case "http://purl.org/shaclmate/ontology#_TsFeature_FromRdf":
1266
- return purify.Either.of(iri);
1267
- case "http://purl.org/shaclmate/ontology#_TsFeature_Hash":
1268
- return purify.Either.of(iri);
1269
- case "http://purl.org/shaclmate/ontology#_TsFeature_Json":
1270
- return purify.Either.of(iri);
1271
- case "http://purl.org/shaclmate/ontology#_TsFeature_JsonSchema":
1272
- return purify.Either.of(iri);
1273
- case "http://purl.org/shaclmate/ontology#_TsFeature_JsonUiSchema":
1274
- return purify.Either.of(iri);
1275
- case "http://purl.org/shaclmate/ontology#_TsFeature_None":
1276
- return purify.Either.of(iri);
1277
- case "http://purl.org/shaclmate/ontology#_TsFeature_Rdf":
1278
- return purify.Either.of(iri);
1279
- case "http://purl.org/shaclmate/ontology#_TsFeature_Sparql":
1280
- return purify.Either.of(iri);
1281
- case "http://purl.org/shaclmate/ontology#_TsFeature_ToJson":
1282
- return purify.Either.of(iri);
1283
- case "http://purl.org/shaclmate/ontology#_TsFeature_ToRdf":
1284
- return purify.Either.of(iri);
1285
- default:
1286
- return purify.Left(new rdfjsResource.Resource.MistypedValueError({
1287
- actualValue: iri,
1288
- expectedValueType: 'rdfjs.NamedNode<"http://purl.org/shaclmate/ontology#_TsFeature_All" | "http://purl.org/shaclmate/ontology#_TsFeature_Create" | "http://purl.org/shaclmate/ontology#_TsFeature_Equals" | "http://purl.org/shaclmate/ontology#_TsFeature_FromJson" | "http://purl.org/shaclmate/ontology#_TsFeature_FromRdf" | "http://purl.org/shaclmate/ontology#_TsFeature_Hash" | "http://purl.org/shaclmate/ontology#_TsFeature_Json" | "http://purl.org/shaclmate/ontology#_TsFeature_JsonSchema" | "http://purl.org/shaclmate/ontology#_TsFeature_JsonUiSchema" | "http://purl.org/shaclmate/ontology#_TsFeature_None" | "http://purl.org/shaclmate/ontology#_TsFeature_Rdf" | "http://purl.org/shaclmate/ontology#_TsFeature_Sparql" | "http://purl.org/shaclmate/ontology#_TsFeature_ToJson" | "http://purl.org/shaclmate/ontology#_TsFeature_ToRdf">',
1289
- focusResource: _resource,
1290
- predicate: dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureInclude"),
1291
- }));
1292
- }
1293
- }))
1294
- .toMaybe()
1295
- .toList()),
1296
- ]);
1640
+ const _tsFeatureIncludesEither = purify.Either.sequence($resource
1641
+ .values(ShaclmateNodeShape.$properties.tsFeatureIncludes["identifier"], { unique: true })
1642
+ .map((item) => item
1643
+ .toValues()
1644
+ .head()
1645
+ .chain((value) => value.toIri().chain((iri) => {
1646
+ switch (iri.value) {
1647
+ case "http://purl.org/shaclmate/ontology#_TsFeatures_All":
1648
+ return purify.Either.of(iri);
1649
+ case "http://purl.org/shaclmate/ontology#_TsFeature_Create":
1650
+ return purify.Either.of(iri);
1651
+ case "http://purl.org/shaclmate/ontology#_TsFeatures_Default":
1652
+ return purify.Either.of(iri);
1653
+ case "http://purl.org/shaclmate/ontology#_TsFeature_Equals":
1654
+ return purify.Either.of(iri);
1655
+ case "http://purl.org/shaclmate/ontology#_TsFeature_Graphql":
1656
+ return purify.Either.of(iri);
1657
+ case "http://purl.org/shaclmate/ontology#_TsFeature_Hash":
1658
+ return purify.Either.of(iri);
1659
+ case "http://purl.org/shaclmate/ontology#_TsFeature_Json":
1660
+ return purify.Either.of(iri);
1661
+ case "http://purl.org/shaclmate/ontology#_TsFeatures_None":
1662
+ return purify.Either.of(iri);
1663
+ case "http://purl.org/shaclmate/ontology#_TsFeature_Rdf":
1664
+ return purify.Either.of(iri);
1665
+ case "http://purl.org/shaclmate/ontology#_TsFeature_Sparql":
1666
+ return purify.Either.of(iri);
1667
+ default:
1668
+ return purify.Left(new rdfjsResource.Resource.MistypedValueError({
1669
+ actualValue: iri,
1670
+ expectedValueType: 'rdfjs.NamedNode<"http://purl.org/shaclmate/ontology#_TsFeatures_All" | "http://purl.org/shaclmate/ontology#_TsFeature_Create" | "http://purl.org/shaclmate/ontology#_TsFeatures_Default" | "http://purl.org/shaclmate/ontology#_TsFeature_Equals" | "http://purl.org/shaclmate/ontology#_TsFeature_Graphql" | "http://purl.org/shaclmate/ontology#_TsFeature_Hash" | "http://purl.org/shaclmate/ontology#_TsFeature_Json" | "http://purl.org/shaclmate/ontology#_TsFeatures_None" | "http://purl.org/shaclmate/ontology#_TsFeature_Rdf" | "http://purl.org/shaclmate/ontology#_TsFeature_Sparql">',
1671
+ focusResource: $resource,
1672
+ predicate: ShaclmateNodeShape.$properties.tsFeatureIncludes["identifier"],
1673
+ }));
1674
+ }
1675
+ }))));
1297
1676
  if (_tsFeatureIncludesEither.isLeft()) {
1298
1677
  return _tsFeatureIncludesEither;
1299
1678
  }
1300
1679
  const tsFeatureIncludes = _tsFeatureIncludesEither.unsafeCoerce();
1301
- const _tsImportsEither = purify.Either.of([
1302
- ..._resource
1303
- .values(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsImport"), { unique: true })
1304
- .flatMap((_item) => _item
1305
- .toValues()
1306
- .head()
1307
- .chain((_value) => _value.toString())
1308
- .toMaybe()
1309
- .toList()),
1310
- ]);
1680
+ const _tsImportsEither = purify.Either.sequence($resource
1681
+ .values(ShaclmateNodeShape.$properties.tsImports["identifier"], { unique: true })
1682
+ .map((item) => item
1683
+ .toValues()
1684
+ .head()
1685
+ .chain((value) => value.toString())));
1311
1686
  if (_tsImportsEither.isLeft()) {
1312
1687
  return _tsImportsEither;
1313
1688
  }
1314
1689
  const tsImports = _tsImportsEither.unsafeCoerce();
1315
- const _tsObjectDeclarationTypeEither = purify.Either.of(_resource
1316
- .values(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsObjectDeclarationType"), { unique: true })
1690
+ const _tsObjectDeclarationTypeEither = $resource
1691
+ .values(ShaclmateNodeShape.$properties.tsObjectDeclarationType["identifier"], {
1692
+ unique: true,
1693
+ })
1317
1694
  .head()
1318
- .chain((_value) => _value.toIri().chain((iri) => {
1695
+ .chain((value) => value.toIri().chain((iri) => {
1319
1696
  switch (iri.value) {
1320
1697
  case "http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Class":
1321
1698
  return purify.Either.of(iri);
@@ -1325,47 +1702,23 @@ export var ShaclmateNodeShape;
1325
1702
  return purify.Left(new rdfjsResource.Resource.MistypedValueError({
1326
1703
  actualValue: iri,
1327
1704
  expectedValueType: 'rdfjs.NamedNode<"http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Class" | "http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Interface">',
1328
- focusResource: _resource,
1329
- predicate: dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsObjectDeclarationType"),
1705
+ focusResource: $resource,
1706
+ predicate: ShaclmateNodeShape.$properties.tsObjectDeclarationType["identifier"],
1330
1707
  }));
1331
1708
  }
1332
1709
  }))
1333
- .toMaybe());
1710
+ .map((value) => purify.Maybe.of(value))
1711
+ .chainLeft((error) => error instanceof rdfjsResource.Resource.MissingValueError
1712
+ ? purify.Right(purify.Maybe.empty())
1713
+ : purify.Left(error));
1334
1714
  if (_tsObjectDeclarationTypeEither.isLeft()) {
1335
1715
  return _tsObjectDeclarationTypeEither;
1336
1716
  }
1337
1717
  const tsObjectDeclarationType = _tsObjectDeclarationTypeEither.unsafeCoerce();
1338
- const _tsObjectIdentifierPrefixPropertyNameEither = purify.Either.of(_resource
1339
- .values(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsObjectIdentifierPrefixPropertyName"), { unique: true })
1340
- .head()
1341
- .chain((_value) => _value.toString())
1342
- .toMaybe());
1343
- if (_tsObjectIdentifierPrefixPropertyNameEither.isLeft()) {
1344
- return _tsObjectIdentifierPrefixPropertyNameEither;
1345
- }
1346
- const tsObjectIdentifierPrefixPropertyName = _tsObjectIdentifierPrefixPropertyNameEither.unsafeCoerce();
1347
- const _tsObjectIdentifierPropertyNameEither = purify.Either.of(_resource
1348
- .values(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsObjectIdentifierPropertyName"), { unique: true })
1349
- .head()
1350
- .chain((_value) => _value.toString())
1351
- .toMaybe());
1352
- if (_tsObjectIdentifierPropertyNameEither.isLeft()) {
1353
- return _tsObjectIdentifierPropertyNameEither;
1354
- }
1355
- const tsObjectIdentifierPropertyName = _tsObjectIdentifierPropertyNameEither.unsafeCoerce();
1356
- const _tsObjectTypeDiscriminatorPropertyNameEither = purify.Either.of(_resource
1357
- .values(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsObjectTypeDiscriminatorPropertyName"), { unique: true })
1358
- .head()
1359
- .chain((_value) => _value.toString())
1360
- .toMaybe());
1361
- if (_tsObjectTypeDiscriminatorPropertyNameEither.isLeft()) {
1362
- return _tsObjectTypeDiscriminatorPropertyNameEither;
1363
- }
1364
- const tsObjectTypeDiscriminatorPropertyName = _tsObjectTypeDiscriminatorPropertyNameEither.unsafeCoerce();
1365
1718
  return purify.Either.of({
1366
- ..._super0,
1367
- identifier,
1368
- type,
1719
+ ...$super0,
1720
+ $identifier,
1721
+ $type,
1369
1722
  abstract,
1370
1723
  export_,
1371
1724
  extern,
@@ -1373,115 +1726,658 @@ export var ShaclmateNodeShape;
1373
1726
  identifierMintingStrategy,
1374
1727
  mutable,
1375
1728
  name,
1729
+ rdfType,
1376
1730
  toRdfTypes,
1377
1731
  tsFeatureExcludes,
1378
1732
  tsFeatureIncludes,
1379
1733
  tsImports,
1380
1734
  tsObjectDeclarationType,
1381
- tsObjectIdentifierPrefixPropertyName,
1382
- tsObjectIdentifierPropertyName,
1383
- tsObjectTypeDiscriminatorPropertyName,
1384
1735
  });
1385
1736
  }
1386
- ShaclmateNodeShape._propertiesFromRdf = _propertiesFromRdf;
1387
- function fromRdf(parameters) {
1388
- return ShaclmateNodeShape._propertiesFromRdf(parameters);
1737
+ ShaclmateNodeShape.$propertiesFromRdf = $propertiesFromRdf;
1738
+ function $fromRdf(parameters) {
1739
+ return ShaclmateNodeShape.$propertiesFromRdf(parameters);
1740
+ }
1741
+ ShaclmateNodeShape.$fromRdf = $fromRdf;
1742
+ function $toRdf(_shaclmateNodeShape, { ignoreRdfType, mutateGraph, resourceSet, }) {
1743
+ const _resource = ShaclCoreNodeShapeStatic.$toRdf(_shaclmateNodeShape, {
1744
+ ignoreRdfType: true,
1745
+ mutateGraph,
1746
+ resourceSet,
1747
+ });
1748
+ if (!ignoreRdfType) {
1749
+ _resource.add($RdfVocabularies.rdf.type, _resource.dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape"));
1750
+ }
1751
+ _resource.add(ShaclmateNodeShape.$properties.abstract["identifier"], _shaclmateNodeShape.abstract);
1752
+ _resource.add(ShaclmateNodeShape.$properties.export_["identifier"], _shaclmateNodeShape.export_);
1753
+ _resource.add(ShaclmateNodeShape.$properties.extern["identifier"], _shaclmateNodeShape.extern);
1754
+ _resource.add(ShaclmateNodeShape.$properties.fromRdfType["identifier"], _shaclmateNodeShape.fromRdfType);
1755
+ _resource.add(ShaclmateNodeShape.$properties.identifierMintingStrategy["identifier"], _shaclmateNodeShape.identifierMintingStrategy);
1756
+ _resource.add(ShaclmateNodeShape.$properties.mutable["identifier"], _shaclmateNodeShape.mutable);
1757
+ _resource.add(ShaclmateNodeShape.$properties.name["identifier"], _shaclmateNodeShape.name);
1758
+ _resource.add(ShaclmateNodeShape.$properties.rdfType["identifier"], _shaclmateNodeShape.rdfType);
1759
+ _resource.add(ShaclmateNodeShape.$properties.toRdfTypes["identifier"], _shaclmateNodeShape.toRdfTypes.map((item) => item));
1760
+ _resource.add(ShaclmateNodeShape.$properties.tsFeatureExcludes["identifier"], _shaclmateNodeShape.tsFeatureExcludes.map((item) => item));
1761
+ _resource.add(ShaclmateNodeShape.$properties.tsFeatureIncludes["identifier"], _shaclmateNodeShape.tsFeatureIncludes.map((item) => item));
1762
+ _resource.add(ShaclmateNodeShape.$properties.tsImports["identifier"], _shaclmateNodeShape.tsImports.map((item) => item));
1763
+ _resource.add(ShaclmateNodeShape.$properties.tsObjectDeclarationType["identifier"], _shaclmateNodeShape.tsObjectDeclarationType);
1764
+ return _resource;
1389
1765
  }
1390
- ShaclmateNodeShape.fromRdf = fromRdf;
1391
- ShaclmateNodeShape.fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape");
1766
+ ShaclmateNodeShape.$toRdf = $toRdf;
1767
+ ShaclmateNodeShape.$properties = {
1768
+ ...ShaclCoreNodeShapeStatic.$properties,
1769
+ abstract: {
1770
+ identifier: dataFactory.namedNode("http://purl.org/shaclmate/ontology#abstract"),
1771
+ },
1772
+ export_: {
1773
+ identifier: dataFactory.namedNode("http://purl.org/shaclmate/ontology#export"),
1774
+ },
1775
+ extern: {
1776
+ identifier: dataFactory.namedNode("http://purl.org/shaclmate/ontology#extern"),
1777
+ },
1778
+ fromRdfType: {
1779
+ identifier: dataFactory.namedNode("http://purl.org/shaclmate/ontology#fromRdfType"),
1780
+ },
1781
+ identifierMintingStrategy: {
1782
+ identifier: dataFactory.namedNode("http://purl.org/shaclmate/ontology#identifierMintingStrategy"),
1783
+ },
1784
+ mutable: {
1785
+ identifier: dataFactory.namedNode("http://purl.org/shaclmate/ontology#mutable"),
1786
+ },
1787
+ name: {
1788
+ identifier: dataFactory.namedNode("http://purl.org/shaclmate/ontology#name"),
1789
+ },
1790
+ rdfType: {
1791
+ identifier: dataFactory.namedNode("http://purl.org/shaclmate/ontology#rdfType"),
1792
+ },
1793
+ toRdfTypes: {
1794
+ identifier: dataFactory.namedNode("http://purl.org/shaclmate/ontology#toRdfType"),
1795
+ },
1796
+ tsFeatureExcludes: {
1797
+ identifier: dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureExclude"),
1798
+ },
1799
+ tsFeatureIncludes: {
1800
+ identifier: dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureInclude"),
1801
+ },
1802
+ tsImports: {
1803
+ identifier: dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsImport"),
1804
+ },
1805
+ tsObjectDeclarationType: {
1806
+ identifier: dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsObjectDeclarationType"),
1807
+ },
1808
+ };
1392
1809
  })(ShaclmateNodeShape || (ShaclmateNodeShape = {}));
1393
1810
  export var ShaclCorePropertyGroup;
1394
1811
  (function (ShaclCorePropertyGroup) {
1395
- function _propertiesFromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource,
1396
- // @ts-ignore
1397
- ..._context }) {
1398
- if (!_ignoreRdfType &&
1399
- !_resource.isInstanceOf(dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup"))) {
1400
- return purify.Left(new rdfjsResource.Resource.ValueError({
1401
- focusResource: _resource,
1402
- message: `${rdfjsResource.Resource.Identifier.toString(_resource.identifier)} has unexpected RDF type`,
1403
- predicate: dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup"),
1812
+ ShaclCorePropertyGroup.$fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup");
1813
+ let $Identifier;
1814
+ (function ($Identifier) {
1815
+ function fromString(identifier) {
1816
+ return purify.Either.encase(() => rdfjsResource.Resource.Identifier.fromString({
1817
+ dataFactory,
1818
+ identifier,
1404
1819
  }));
1405
1820
  }
1406
- const identifier = _resource.identifier;
1407
- const type = "ShaclCorePropertyGroup";
1408
- const _commentsEither = purify.Either.of([
1409
- ..._resource
1410
- .values(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), { unique: true })
1411
- .flatMap((_item) => _item
1412
- .toValues()
1413
- .filter((_value) => {
1414
- const _languageInOrDefault = _languageIn ?? [];
1415
- if (_languageInOrDefault.length === 0) {
1416
- return true;
1417
- }
1418
- const _valueLiteral = _value.toLiteral().toMaybe().extract();
1419
- if (typeof _valueLiteral === "undefined") {
1420
- return false;
1421
- }
1422
- return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
1423
- })
1424
- .head()
1425
- .chain((_value) => _value.toLiteral())
1426
- .toMaybe()
1427
- .toList()),
1428
- ]);
1821
+ $Identifier.fromString = fromString;
1822
+ $Identifier.toString = rdfjsResource.Resource.Identifier.toString;
1823
+ })($Identifier = ShaclCorePropertyGroup.$Identifier || (ShaclCorePropertyGroup.$Identifier = {}));
1824
+ function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, languageIn: $languageIn, objectSet: $objectSetParameter, resource: $resource,
1825
+ // @ts-ignore
1826
+ ...$context }) {
1827
+ if (!$ignoreRdfType && !$resource.isInstanceOf(ShaclCorePropertyGroup.$fromRdfType)) {
1828
+ return $resource
1829
+ .value($RdfVocabularies.rdf.type)
1830
+ .chain((actualRdfType) => actualRdfType.toIri())
1831
+ .chain((actualRdfType) => purify.Left(new Error(`${rdfjsResource.Resource.Identifier.toString($resource.identifier)} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#PropertyGroup)`)));
1832
+ }
1833
+ const $identifier = $resource.identifier;
1834
+ const $type = "ShaclCorePropertyGroup";
1835
+ const _commentsEither = purify.Either.sequence($resource
1836
+ .values(ShaclCorePropertyGroup.$properties.comments["identifier"], { unique: true })
1837
+ .map((item) => item
1838
+ .toValues()
1839
+ .filter((_value) => {
1840
+ const _languageInOrDefault = $languageIn ?? [];
1841
+ if (_languageInOrDefault.length === 0) {
1842
+ return true;
1843
+ }
1844
+ const _valueLiteral = _value.toLiteral().toMaybe().extract();
1845
+ if (typeof _valueLiteral === "undefined") {
1846
+ return false;
1847
+ }
1848
+ return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
1849
+ })
1850
+ .head()
1851
+ .chain((value) => value.toLiteral())));
1429
1852
  if (_commentsEither.isLeft()) {
1430
1853
  return _commentsEither;
1431
1854
  }
1432
1855
  const comments = _commentsEither.unsafeCoerce();
1433
- const _labelsEither = purify.Either.of([
1434
- ..._resource
1435
- .values(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), { unique: true })
1436
- .flatMap((_item) => _item
1437
- .toValues()
1438
- .filter((_value) => {
1439
- const _languageInOrDefault = _languageIn ?? [];
1440
- if (_languageInOrDefault.length === 0) {
1441
- return true;
1442
- }
1443
- const _valueLiteral = _value.toLiteral().toMaybe().extract();
1444
- if (typeof _valueLiteral === "undefined") {
1445
- return false;
1446
- }
1447
- return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
1448
- })
1449
- .head()
1450
- .chain((_value) => _value.toLiteral())
1451
- .toMaybe()
1452
- .toList()),
1453
- ]);
1856
+ const _labelsEither = purify.Either.sequence($resource
1857
+ .values(ShaclCorePropertyGroup.$properties.labels["identifier"], { unique: true })
1858
+ .map((item) => item
1859
+ .toValues()
1860
+ .filter((_value) => {
1861
+ const _languageInOrDefault = $languageIn ?? [];
1862
+ if (_languageInOrDefault.length === 0) {
1863
+ return true;
1864
+ }
1865
+ const _valueLiteral = _value.toLiteral().toMaybe().extract();
1866
+ if (typeof _valueLiteral === "undefined") {
1867
+ return false;
1868
+ }
1869
+ return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
1870
+ })
1871
+ .head()
1872
+ .chain((value) => value.toLiteral())));
1454
1873
  if (_labelsEither.isLeft()) {
1455
1874
  return _labelsEither;
1456
1875
  }
1457
1876
  const labels = _labelsEither.unsafeCoerce();
1458
- return purify.Either.of({ identifier, type, comments, labels });
1877
+ return purify.Either.of({ $identifier, $type, comments, labels });
1459
1878
  }
1460
- ShaclCorePropertyGroup._propertiesFromRdf = _propertiesFromRdf;
1461
- function fromRdf(parameters) {
1462
- return ShaclCorePropertyGroup._propertiesFromRdf(parameters);
1879
+ ShaclCorePropertyGroup.$propertiesFromRdf = $propertiesFromRdf;
1880
+ function $fromRdf(parameters) {
1881
+ return ShaclCorePropertyGroup.$propertiesFromRdf(parameters);
1463
1882
  }
1464
- ShaclCorePropertyGroup.fromRdf = fromRdf;
1465
- ShaclCorePropertyGroup.fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup");
1883
+ ShaclCorePropertyGroup.$fromRdf = $fromRdf;
1884
+ function $toRdf(_shaclCorePropertyGroup, { ignoreRdfType, mutateGraph, resourceSet, }) {
1885
+ const _resource = resourceSet.mutableResource(_shaclCorePropertyGroup.$identifier, { mutateGraph });
1886
+ if (!ignoreRdfType) {
1887
+ _resource.add($RdfVocabularies.rdf.type, _resource.dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup"));
1888
+ }
1889
+ _resource.add(ShaclCorePropertyGroup.$properties.comments["identifier"], _shaclCorePropertyGroup.comments.map((item) => item));
1890
+ _resource.add(ShaclCorePropertyGroup.$properties.labels["identifier"], _shaclCorePropertyGroup.labels.map((item) => item));
1891
+ return _resource;
1892
+ }
1893
+ ShaclCorePropertyGroup.$toRdf = $toRdf;
1894
+ ShaclCorePropertyGroup.$properties = {
1895
+ comments: {
1896
+ identifier: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
1897
+ },
1898
+ labels: {
1899
+ identifier: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
1900
+ },
1901
+ };
1466
1902
  })(ShaclCorePropertyGroup || (ShaclCorePropertyGroup = {}));
1467
1903
  export var ShaclCoreShape;
1468
1904
  (function (ShaclCoreShape) {
1469
- function fromRdf({ ignoreRdfType, resource, ...context }) {
1470
- return ShaclCoreNodeShape.fromRdf({ ...context, resource }).altLazy(() => ShaclCorePropertyShape.fromRdf({
1905
+ function $fromRdf({ ignoreRdfType, resource, ...context }) {
1906
+ return ShaclCoreNodeShapeStatic.$fromRdf({
1907
+ ...context,
1908
+ resource,
1909
+ }).altLazy(() => ShaclCorePropertyShapeStatic.$fromRdf({
1471
1910
  ...context,
1472
1911
  resource,
1473
1912
  }));
1474
1913
  }
1475
- ShaclCoreShape.fromRdf = fromRdf;
1914
+ ShaclCoreShape.$fromRdf = $fromRdf;
1915
+ let $Identifier;
1916
+ (function ($Identifier) {
1917
+ function fromString(identifier) {
1918
+ return purify.Either.encase(() => rdfjsResource.Resource.Identifier.fromString({
1919
+ dataFactory,
1920
+ identifier,
1921
+ }));
1922
+ }
1923
+ $Identifier.fromString = fromString;
1924
+ $Identifier.toString = rdfjsResource.Resource.Identifier.toString;
1925
+ })($Identifier = ShaclCoreShape.$Identifier || (ShaclCoreShape.$Identifier = {}));
1926
+ function $toRdf(_shaclCoreShape, _parameters) {
1927
+ switch (_shaclCoreShape.$type) {
1928
+ case "ShaclCoreNodeShape":
1929
+ case "ShaclmateNodeShape":
1930
+ return ShaclCoreNodeShapeStatic.$toRdf(_shaclCoreShape, _parameters);
1931
+ case "ShaclCorePropertyShape":
1932
+ case "ShaclmatePropertyShape":
1933
+ return ShaclCorePropertyShapeStatic.$toRdf(_shaclCoreShape, _parameters);
1934
+ default:
1935
+ _shaclCoreShape;
1936
+ throw new Error("unrecognized type");
1937
+ }
1938
+ }
1939
+ ShaclCoreShape.$toRdf = $toRdf;
1476
1940
  })(ShaclCoreShape || (ShaclCoreShape = {}));
1477
1941
  export var ShaclmateShape;
1478
1942
  (function (ShaclmateShape) {
1479
- function fromRdf({ ignoreRdfType, resource, ...context }) {
1480
- return ShaclmateNodeShape.fromRdf({ ...context, resource }).altLazy(() => ShaclCorePropertyShape.fromRdf({
1943
+ function $fromRdf({ ignoreRdfType, resource, ...context }) {
1944
+ return ShaclmateNodeShape.$fromRdf({ ...context, resource }).altLazy(() => ShaclCorePropertyShapeStatic.$fromRdf({
1481
1945
  ...context,
1482
1946
  resource,
1483
1947
  }));
1484
1948
  }
1485
- ShaclmateShape.fromRdf = fromRdf;
1949
+ ShaclmateShape.$fromRdf = $fromRdf;
1950
+ let $Identifier;
1951
+ (function ($Identifier) {
1952
+ function fromString(identifier) {
1953
+ return purify.Either.encase(() => rdfjsResource.Resource.Identifier.fromString({
1954
+ dataFactory,
1955
+ identifier,
1956
+ }));
1957
+ }
1958
+ $Identifier.fromString = fromString;
1959
+ $Identifier.toString = rdfjsResource.Resource.Identifier.toString;
1960
+ })($Identifier = ShaclmateShape.$Identifier || (ShaclmateShape.$Identifier = {}));
1961
+ function $toRdf(_shaclmateShape, _parameters) {
1962
+ switch (_shaclmateShape.$type) {
1963
+ case "ShaclmateNodeShape":
1964
+ return ShaclmateNodeShape.$toRdf(_shaclmateShape, _parameters);
1965
+ case "ShaclCorePropertyShape":
1966
+ case "ShaclmatePropertyShape":
1967
+ return ShaclCorePropertyShapeStatic.$toRdf(_shaclmateShape, _parameters);
1968
+ default:
1969
+ _shaclmateShape;
1970
+ throw new Error("unrecognized type");
1971
+ }
1972
+ }
1973
+ ShaclmateShape.$toRdf = $toRdf;
1486
1974
  })(ShaclmateShape || (ShaclmateShape = {}));
1975
+ export class $RdfjsDatasetObjectSet {
1976
+ resourceSet;
1977
+ constructor({ dataset }) {
1978
+ this.resourceSet = new rdfjsResource.ResourceSet({ dataset });
1979
+ }
1980
+ async owlOntology(identifier) {
1981
+ return this.owlOntologySync(identifier);
1982
+ }
1983
+ owlOntologySync(identifier) {
1984
+ return this.owlOntologiesSync({
1985
+ where: { identifiers: [identifier], type: "identifiers" },
1986
+ }).map((objects) => objects[0]);
1987
+ }
1988
+ async owlOntologyIdentifiers(query) {
1989
+ return this.owlOntologyIdentifiersSync(query);
1990
+ }
1991
+ owlOntologyIdentifiersSync(query) {
1992
+ return this.$objectIdentifiersSync(OwlOntologyStatic, query);
1993
+ }
1994
+ async owlOntologies(query) {
1995
+ return this.owlOntologiesSync(query);
1996
+ }
1997
+ owlOntologiesSync(query) {
1998
+ return this.$objectsSync(OwlOntologyStatic, query);
1999
+ }
2000
+ async owlOntologiesCount(query) {
2001
+ return this.owlOntologiesCountSync(query);
2002
+ }
2003
+ owlOntologiesCountSync(query) {
2004
+ return this.$objectsCountSync(OwlOntologyStatic, query);
2005
+ }
2006
+ async shaclCoreNodeShape(identifier) {
2007
+ return this.shaclCoreNodeShapeSync(identifier);
2008
+ }
2009
+ shaclCoreNodeShapeSync(identifier) {
2010
+ return this.shaclCoreNodeShapesSync({
2011
+ where: { identifiers: [identifier], type: "identifiers" },
2012
+ }).map((objects) => objects[0]);
2013
+ }
2014
+ async shaclCoreNodeShapeIdentifiers(query) {
2015
+ return this.shaclCoreNodeShapeIdentifiersSync(query);
2016
+ }
2017
+ shaclCoreNodeShapeIdentifiersSync(query) {
2018
+ return this.$objectIdentifiersSync(ShaclCoreNodeShapeStatic, query);
2019
+ }
2020
+ async shaclCoreNodeShapes(query) {
2021
+ return this.shaclCoreNodeShapesSync(query);
2022
+ }
2023
+ shaclCoreNodeShapesSync(query) {
2024
+ return this.$objectsSync(ShaclCoreNodeShapeStatic, query);
2025
+ }
2026
+ async shaclCoreNodeShapesCount(query) {
2027
+ return this.shaclCoreNodeShapesCountSync(query);
2028
+ }
2029
+ shaclCoreNodeShapesCountSync(query) {
2030
+ return this.$objectsCountSync(ShaclCoreNodeShapeStatic, query);
2031
+ }
2032
+ async shaclCorePropertyGroup(identifier) {
2033
+ return this.shaclCorePropertyGroupSync(identifier);
2034
+ }
2035
+ shaclCorePropertyGroupSync(identifier) {
2036
+ return this.shaclCorePropertyGroupsSync({
2037
+ where: { identifiers: [identifier], type: "identifiers" },
2038
+ }).map((objects) => objects[0]);
2039
+ }
2040
+ async shaclCorePropertyGroupIdentifiers(query) {
2041
+ return this.shaclCorePropertyGroupIdentifiersSync(query);
2042
+ }
2043
+ shaclCorePropertyGroupIdentifiersSync(query) {
2044
+ return this.$objectIdentifiersSync(ShaclCorePropertyGroup, query);
2045
+ }
2046
+ async shaclCorePropertyGroups(query) {
2047
+ return this.shaclCorePropertyGroupsSync(query);
2048
+ }
2049
+ shaclCorePropertyGroupsSync(query) {
2050
+ return this.$objectsSync(ShaclCorePropertyGroup, query);
2051
+ }
2052
+ async shaclCorePropertyGroupsCount(query) {
2053
+ return this.shaclCorePropertyGroupsCountSync(query);
2054
+ }
2055
+ shaclCorePropertyGroupsCountSync(query) {
2056
+ return this.$objectsCountSync(ShaclCorePropertyGroup, query);
2057
+ }
2058
+ async shaclCorePropertyShape(identifier) {
2059
+ return this.shaclCorePropertyShapeSync(identifier);
2060
+ }
2061
+ shaclCorePropertyShapeSync(identifier) {
2062
+ return this.shaclCorePropertyShapesSync({
2063
+ where: { identifiers: [identifier], type: "identifiers" },
2064
+ }).map((objects) => objects[0]);
2065
+ }
2066
+ async shaclCorePropertyShapeIdentifiers(query) {
2067
+ return this.shaclCorePropertyShapeIdentifiersSync(query);
2068
+ }
2069
+ shaclCorePropertyShapeIdentifiersSync(query) {
2070
+ return this.$objectIdentifiersSync(ShaclCorePropertyShapeStatic, query);
2071
+ }
2072
+ async shaclCorePropertyShapes(query) {
2073
+ return this.shaclCorePropertyShapesSync(query);
2074
+ }
2075
+ shaclCorePropertyShapesSync(query) {
2076
+ return this.$objectsSync(ShaclCorePropertyShapeStatic, query);
2077
+ }
2078
+ async shaclCorePropertyShapesCount(query) {
2079
+ return this.shaclCorePropertyShapesCountSync(query);
2080
+ }
2081
+ shaclCorePropertyShapesCountSync(query) {
2082
+ return this.$objectsCountSync(ShaclCorePropertyShapeStatic, query);
2083
+ }
2084
+ async shaclmateNodeShape(identifier) {
2085
+ return this.shaclmateNodeShapeSync(identifier);
2086
+ }
2087
+ shaclmateNodeShapeSync(identifier) {
2088
+ return this.shaclmateNodeShapesSync({
2089
+ where: { identifiers: [identifier], type: "identifiers" },
2090
+ }).map((objects) => objects[0]);
2091
+ }
2092
+ async shaclmateNodeShapeIdentifiers(query) {
2093
+ return this.shaclmateNodeShapeIdentifiersSync(query);
2094
+ }
2095
+ shaclmateNodeShapeIdentifiersSync(query) {
2096
+ return this.$objectIdentifiersSync(ShaclmateNodeShape, query);
2097
+ }
2098
+ async shaclmateNodeShapes(query) {
2099
+ return this.shaclmateNodeShapesSync(query);
2100
+ }
2101
+ shaclmateNodeShapesSync(query) {
2102
+ return this.$objectsSync(ShaclmateNodeShape, query);
2103
+ }
2104
+ async shaclmateNodeShapesCount(query) {
2105
+ return this.shaclmateNodeShapesCountSync(query);
2106
+ }
2107
+ shaclmateNodeShapesCountSync(query) {
2108
+ return this.$objectsCountSync(ShaclmateNodeShape, query);
2109
+ }
2110
+ async shaclmateOntology(identifier) {
2111
+ return this.shaclmateOntologySync(identifier);
2112
+ }
2113
+ shaclmateOntologySync(identifier) {
2114
+ return this.shaclmateOntologiesSync({
2115
+ where: { identifiers: [identifier], type: "identifiers" },
2116
+ }).map((objects) => objects[0]);
2117
+ }
2118
+ async shaclmateOntologyIdentifiers(query) {
2119
+ return this.shaclmateOntologyIdentifiersSync(query);
2120
+ }
2121
+ shaclmateOntologyIdentifiersSync(query) {
2122
+ return this.$objectIdentifiersSync(ShaclmateOntology, query);
2123
+ }
2124
+ async shaclmateOntologies(query) {
2125
+ return this.shaclmateOntologiesSync(query);
2126
+ }
2127
+ shaclmateOntologiesSync(query) {
2128
+ return this.$objectsSync(ShaclmateOntology, query);
2129
+ }
2130
+ async shaclmateOntologiesCount(query) {
2131
+ return this.shaclmateOntologiesCountSync(query);
2132
+ }
2133
+ shaclmateOntologiesCountSync(query) {
2134
+ return this.$objectsCountSync(ShaclmateOntology, query);
2135
+ }
2136
+ async shaclmatePropertyShape(identifier) {
2137
+ return this.shaclmatePropertyShapeSync(identifier);
2138
+ }
2139
+ shaclmatePropertyShapeSync(identifier) {
2140
+ return this.shaclmatePropertyShapesSync({
2141
+ where: { identifiers: [identifier], type: "identifiers" },
2142
+ }).map((objects) => objects[0]);
2143
+ }
2144
+ async shaclmatePropertyShapeIdentifiers(query) {
2145
+ return this.shaclmatePropertyShapeIdentifiersSync(query);
2146
+ }
2147
+ shaclmatePropertyShapeIdentifiersSync(query) {
2148
+ return this.$objectIdentifiersSync(ShaclmatePropertyShape, query);
2149
+ }
2150
+ async shaclmatePropertyShapes(query) {
2151
+ return this.shaclmatePropertyShapesSync(query);
2152
+ }
2153
+ shaclmatePropertyShapesSync(query) {
2154
+ return this.$objectsSync(ShaclmatePropertyShape, query);
2155
+ }
2156
+ async shaclmatePropertyShapesCount(query) {
2157
+ return this.shaclmatePropertyShapesCountSync(query);
2158
+ }
2159
+ shaclmatePropertyShapesCountSync(query) {
2160
+ return this.$objectsCountSync(ShaclmatePropertyShape, query);
2161
+ }
2162
+ async shaclCoreShape(identifier) {
2163
+ return this.shaclCoreShapeSync(identifier);
2164
+ }
2165
+ shaclCoreShapeSync(identifier) {
2166
+ return this.shaclCoreShapesSync({
2167
+ where: { identifiers: [identifier], type: "identifiers" },
2168
+ }).map((objects) => objects[0]);
2169
+ }
2170
+ async shaclCoreShapeIdentifiers(query) {
2171
+ return this.shaclCoreShapeIdentifiersSync(query);
2172
+ }
2173
+ shaclCoreShapeIdentifiersSync(query) {
2174
+ return this.$objectUnionIdentifiersSync([ShaclCoreNodeShapeStatic, ShaclCorePropertyShapeStatic], query);
2175
+ }
2176
+ async shaclCoreShapes(query) {
2177
+ return this.shaclCoreShapesSync(query);
2178
+ }
2179
+ shaclCoreShapesSync(query) {
2180
+ return this.$objectUnionsSync([ShaclCoreNodeShapeStatic, ShaclCorePropertyShapeStatic], query);
2181
+ }
2182
+ async shaclCoreShapesCount(query) {
2183
+ return this.shaclCoreShapesCountSync(query);
2184
+ }
2185
+ shaclCoreShapesCountSync(query) {
2186
+ return this.$objectUnionsCountSync([ShaclCoreNodeShapeStatic, ShaclCorePropertyShapeStatic], query);
2187
+ }
2188
+ async shaclmateShape(identifier) {
2189
+ return this.shaclmateShapeSync(identifier);
2190
+ }
2191
+ shaclmateShapeSync(identifier) {
2192
+ return this.shaclmateShapesSync({
2193
+ where: { identifiers: [identifier], type: "identifiers" },
2194
+ }).map((objects) => objects[0]);
2195
+ }
2196
+ async shaclmateShapeIdentifiers(query) {
2197
+ return this.shaclmateShapeIdentifiersSync(query);
2198
+ }
2199
+ shaclmateShapeIdentifiersSync(query) {
2200
+ return this.$objectUnionIdentifiersSync([ShaclmateNodeShape, ShaclCorePropertyShapeStatic], query);
2201
+ }
2202
+ async shaclmateShapes(query) {
2203
+ return this.shaclmateShapesSync(query);
2204
+ }
2205
+ shaclmateShapesSync(query) {
2206
+ return this.$objectUnionsSync([ShaclmateNodeShape, ShaclCorePropertyShapeStatic], query);
2207
+ }
2208
+ async shaclmateShapesCount(query) {
2209
+ return this.shaclmateShapesCountSync(query);
2210
+ }
2211
+ shaclmateShapesCountSync(query) {
2212
+ return this.$objectUnionsCountSync([ShaclmateNodeShape, ShaclCorePropertyShapeStatic], query);
2213
+ }
2214
+ $objectIdentifiersSync(objectType, query) {
2215
+ return this.$objectsSync(objectType, query).map((objects) => objects.map((object) => object.$identifier));
2216
+ }
2217
+ $objectsSync(objectType, query) {
2218
+ const limit = query?.limit ?? Number.MAX_SAFE_INTEGER;
2219
+ if (limit <= 0) {
2220
+ return purify.Either.of([]);
2221
+ }
2222
+ let offset = query?.offset ?? 0;
2223
+ if (offset < 0) {
2224
+ offset = 0;
2225
+ }
2226
+ if (query?.where) {
2227
+ // Assign identifiers in each case block so the compiler will catch missing cases.
2228
+ let identifiers;
2229
+ switch (query.where.type) {
2230
+ case "identifiers": {
2231
+ identifiers = query.where.identifiers.slice(offset, offset + limit);
2232
+ break;
2233
+ }
2234
+ case "triple-objects": {
2235
+ let identifierI = 0;
2236
+ identifiers = [];
2237
+ for (const quad of this.resourceSet.dataset.match(query.where.subject, query.where.predicate, null)) {
2238
+ if (quad.object.termType === "BlankNode" ||
2239
+ quad.object.termType === "NamedNode") {
2240
+ if (++identifierI >= offset) {
2241
+ identifiers.push(quad.object);
2242
+ if (identifiers.length === limit) {
2243
+ break;
2244
+ }
2245
+ }
2246
+ }
2247
+ else {
2248
+ return purify.Left(new Error(`subject=${query.where.subject.value} predicate=${query.where.predicate.value} pattern matches non-identifier (${quad.object.termType}) triple`));
2249
+ }
2250
+ }
2251
+ break;
2252
+ }
2253
+ }
2254
+ const objects = [];
2255
+ for (const identifier of identifiers) {
2256
+ const either = objectType.$fromRdf({
2257
+ resource: this.resourceSet.resource(identifier),
2258
+ });
2259
+ if (either.isLeft()) {
2260
+ return either;
2261
+ }
2262
+ objects.push(either.unsafeCoerce());
2263
+ }
2264
+ return purify.Either.of(objects);
2265
+ }
2266
+ if (!objectType.$fromRdfType) {
2267
+ return purify.Either.of([]);
2268
+ }
2269
+ const resources = [
2270
+ ...this.resourceSet.instancesOf(objectType.$fromRdfType),
2271
+ ];
2272
+ // Sort resources by identifier so limit and offset are deterministic
2273
+ resources.sort((left, right) => left.identifier.value.localeCompare(right.identifier.value));
2274
+ const objects = [];
2275
+ let objectI = 0;
2276
+ for (const resource of resources) {
2277
+ const either = objectType.$fromRdf({ resource });
2278
+ if (either.isLeft()) {
2279
+ return either;
2280
+ }
2281
+ if (objectI++ >= offset) {
2282
+ objects.push(either.unsafeCoerce());
2283
+ if (objects.length === limit) {
2284
+ return purify.Either.of(objects);
2285
+ }
2286
+ }
2287
+ }
2288
+ return purify.Either.of(objects);
2289
+ }
2290
+ $objectsCountSync(objectType, query) {
2291
+ return this.$objectsSync(objectType, query).map((objects) => objects.length);
2292
+ }
2293
+ $objectUnionIdentifiersSync(objectTypes, query) {
2294
+ return this.$objectUnionsSync(objectTypes, query).map((objects) => objects.map((object) => object.$identifier));
2295
+ }
2296
+ $objectUnionsSync(objectTypes, query) {
2297
+ const limit = query?.limit ?? Number.MAX_SAFE_INTEGER;
2298
+ if (limit <= 0) {
2299
+ return purify.Either.of([]);
2300
+ }
2301
+ let offset = query?.offset ?? 0;
2302
+ if (offset < 0) {
2303
+ offset = 0;
2304
+ }
2305
+ if (query?.where) {
2306
+ // Assign identifiers in each case block so the compiler will catch missing cases.
2307
+ let identifiers;
2308
+ switch (query.where.type) {
2309
+ case "identifiers": {
2310
+ identifiers = query.where.identifiers.slice(offset, offset + limit);
2311
+ break;
2312
+ }
2313
+ case "triple-objects": {
2314
+ let identifierI = 0;
2315
+ identifiers = [];
2316
+ for (const quad of this.resourceSet.dataset.match(query.where.subject, query.where.predicate, null)) {
2317
+ if (quad.object.termType === "BlankNode" ||
2318
+ quad.object.termType === "NamedNode") {
2319
+ if (++identifierI >= offset) {
2320
+ identifiers.push(quad.object);
2321
+ if (identifiers.length === limit) {
2322
+ break;
2323
+ }
2324
+ }
2325
+ }
2326
+ else {
2327
+ return purify.Left(new Error(`subject=${query.where.subject.value} predicate=${query.where.predicate.value} pattern matches non-identifier (${quad.object.termType}) triple`));
2328
+ }
2329
+ }
2330
+ break;
2331
+ }
2332
+ }
2333
+ const objects = [];
2334
+ for (const identifier of identifiers) {
2335
+ const resource = this.resourceSet.resource(identifier);
2336
+ const lefts = [];
2337
+ for (const objectType of objectTypes) {
2338
+ const either = objectType.$fromRdf({ resource });
2339
+ if (either.isRight()) {
2340
+ objects.push(either.unsafeCoerce());
2341
+ break;
2342
+ }
2343
+ lefts.push(either);
2344
+ }
2345
+ // Doesn't appear to belong to any of the known object types, just assume the first
2346
+ if (lefts.length === objectTypes.length) {
2347
+ return lefts[0];
2348
+ }
2349
+ }
2350
+ return purify.Either.of(objects);
2351
+ }
2352
+ const resources = [];
2353
+ for (const objectType of objectTypes) {
2354
+ if (!objectType.$fromRdfType) {
2355
+ continue;
2356
+ }
2357
+ for (const resource of this.resourceSet.instancesOf(objectType.$fromRdfType)) {
2358
+ resources.push({ objectType, resource });
2359
+ }
2360
+ }
2361
+ // Sort resources by identifier so limit and offset are deterministic
2362
+ resources.sort((left, right) => left.resource.identifier.value.localeCompare(right.resource.identifier.value));
2363
+ let objectI = 0;
2364
+ const objects = [];
2365
+ for (const { objectType, resource } of resources) {
2366
+ const either = objectType.$fromRdf({ resource });
2367
+ if (either.isLeft()) {
2368
+ return either;
2369
+ }
2370
+ if (objectI++ >= offset) {
2371
+ objects.push(either.unsafeCoerce());
2372
+ if (objects.length === limit) {
2373
+ return purify.Either.of(objects);
2374
+ }
2375
+ }
2376
+ }
2377
+ return purify.Either.of(objects);
2378
+ }
2379
+ $objectUnionsCountSync(objectTypes, query) {
2380
+ return this.$objectUnionIdentifiersSync(objectTypes, query).map((objects) => objects.length);
2381
+ }
2382
+ }
1487
2383
  //# sourceMappingURL=generated.js.map