@shaclmate/shacl-ast 4.0.65 → 4.0.66

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.
@@ -700,6 +700,7 @@ export var NodeShape;
700
700
  kind: "Identifier",
701
701
  type: { kind: "Identifier" },
702
702
  },
703
+ $type: { kind: "Discriminant", value: "NodeShape" },
703
704
  and: {
704
705
  kind: "Shacl",
705
706
  path: dataFactory.namedNode("http://www.w3.org/ns/shacl#and"),
@@ -1251,6 +1252,7 @@ export var Ontology;
1251
1252
  kind: "Identifier",
1252
1253
  type: { kind: "Identifier" },
1253
1254
  },
1255
+ $type: { kind: "Discriminant", value: "Ontology" },
1254
1256
  comment: {
1255
1257
  kind: "Shacl",
1256
1258
  path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
@@ -1347,6 +1349,7 @@ export var PropertyGroup;
1347
1349
  kind: "Identifier",
1348
1350
  type: { kind: "Identifier" },
1349
1351
  },
1352
+ $type: { kind: "Discriminant", value: "PropertyGroup" },
1350
1353
  comment: {
1351
1354
  kind: "Shacl",
1352
1355
  path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
@@ -1795,6 +1798,7 @@ export var PropertyShape;
1795
1798
  kind: "Identifier",
1796
1799
  type: { kind: "Identifier" },
1797
1800
  },
1801
+ $type: { kind: "Discriminant", value: "PropertyShape" },
1798
1802
  and: {
1799
1803
  kind: "Shacl",
1800
1804
  path: dataFactory.namedNode("http://www.w3.org/ns/shacl#and"),
@@ -2466,6 +2470,7 @@ export var ValidationReport;
2466
2470
  kind: "Identifier",
2467
2471
  type: { kind: "Identifier" },
2468
2472
  },
2473
+ $type: { kind: "Discriminant", value: "ValidationReport" },
2469
2474
  conforms: {
2470
2475
  kind: "Shacl",
2471
2476
  path: dataFactory.namedNode("http://www.w3.org/ns/shacl#conforms"),
@@ -2625,6 +2630,7 @@ export var ValidationResult;
2625
2630
  kind: "Identifier",
2626
2631
  type: { kind: "Identifier" },
2627
2632
  },
2633
+ $type: { kind: "Discriminant", value: "ValidationResult" },
2628
2634
  details: {
2629
2635
  kind: "Shacl",
2630
2636
  path: dataFactory.namedNode("http://www.w3.org/ns/shacl#detail"),
@@ -3070,179 +3076,44 @@ export var Shape;
3070
3076
  })(Shape || (Shape = {}));
3071
3077
  export var $Object;
3072
3078
  (function ($Object) {
3073
- $Object.$toString = (value) => {
3074
- if (NodeShape.isNodeShape(value)) {
3075
- return NodeShape.$toString(value);
3076
- }
3077
- if (Ontology.isOntology(value)) {
3078
- return Ontology.$toString(value);
3079
- }
3080
- if (PropertyGroup.isPropertyGroup(value)) {
3081
- return PropertyGroup.$toString(value);
3082
- }
3083
- if (PropertyShape.isPropertyShape(value)) {
3084
- return PropertyShape.$toString(value);
3085
- }
3086
- if (ValidationReport.isValidationReport(value)) {
3087
- return ValidationReport.$toString(value);
3088
- }
3089
- if (ValidationResult.isValidationResult(value)) {
3090
- return ValidationResult.$toString(value);
3091
- }
3092
- throw new Error("unable to serialize to string");
3093
- };
3094
- $Object.fromRdfResource = (resource, options) => NodeShape.fromRdfResource(resource, {
3095
- ...options,
3096
- ignoreRdfType: false,
3097
- })
3098
- .altLazy(() => Ontology.fromRdfResource(resource, {
3099
- ...options,
3100
- ignoreRdfType: false,
3101
- }))
3102
- .altLazy(() => PropertyGroup.fromRdfResource(resource, {
3103
- ...options,
3104
- ignoreRdfType: false,
3105
- }))
3106
- .altLazy(() => PropertyShape.fromRdfResource(resource, {
3107
- ...options,
3108
- ignoreRdfType: false,
3109
- }))
3110
- .altLazy(() => ValidationReport.fromRdfResource(resource, {
3111
- ...options,
3112
- ignoreRdfType: false,
3113
- }))
3114
- .altLazy(() => ValidationResult.fromRdfResource(resource, {
3115
- ...options,
3116
- ignoreRdfType: false,
3117
- }));
3118
- $Object.fromRdfResourceValues = ((values, options) => values.chainMap((value) => {
3119
- const valueAsValues = value.toValues();
3120
- return NodeShape.fromRdfResourceValues(valueAsValues, {
3121
- ...options,
3122
- schema: options.schema.members["NodeShape"].type,
3123
- })
3124
- .altLazy(() => Ontology.fromRdfResourceValues(valueAsValues, {
3125
- ...options,
3126
- schema: options.schema.members["Ontology"].type,
3127
- }))
3128
- .altLazy(() => PropertyGroup.fromRdfResourceValues(valueAsValues, {
3129
- ...options,
3130
- schema: options.schema.members["PropertyGroup"].type,
3131
- }))
3132
- .altLazy(() => PropertyShape.fromRdfResourceValues(valueAsValues, {
3133
- ...options,
3134
- schema: options.schema.members["PropertyShape"].type,
3135
- }))
3136
- .altLazy(() => ValidationReport.fromRdfResourceValues(valueAsValues, {
3137
- ...options,
3138
- schema: options.schema.members["ValidationReport"].type,
3139
- }))
3140
- .altLazy(() => ValidationResult.fromRdfResourceValues(valueAsValues, {
3141
- ...options,
3142
- schema: options.schema.members["ValidationResult"].type,
3143
- }))
3144
- .chain((values) => values.head());
3145
- }));
3146
- let Identifier;
3147
- (function (Identifier) {
3148
- Identifier.parse = $parseIdentifier;
3149
- Identifier.stringify = NTriplesTerm.stringify;
3150
- })(Identifier = $Object.Identifier || ($Object.Identifier = {}));
3151
- $Object.schema = {
3152
- kind: "ObjectDiscriminatedUnion",
3153
- members: {
3154
- NodeShape: { discriminantValues: ["NodeShape"], type: NodeShape.schema },
3155
- Ontology: { discriminantValues: ["Ontology"], type: Ontology.schema },
3156
- PropertyGroup: {
3157
- discriminantValues: ["PropertyGroup"],
3158
- type: PropertyGroup.schema,
3159
- },
3160
- PropertyShape: {
3161
- discriminantValues: ["PropertyShape"],
3162
- type: PropertyShape.schema,
3163
- },
3164
- ValidationReport: {
3165
- discriminantValues: ["ValidationReport"],
3166
- type: ValidationReport.schema,
3167
- },
3168
- ValidationResult: {
3169
- discriminantValues: ["ValidationResult"],
3170
- type: ValidationResult.schema,
3171
- },
3172
- },
3173
- properties: {},
3174
- };
3175
3079
  $Object.toRdfResource = (object, options) => {
3176
- if (NodeShape.isNodeShape(object)) {
3177
- return NodeShape.toRdfResource(object, options);
3178
- }
3179
- if (Ontology.isOntology(object)) {
3180
- return Ontology.toRdfResource(object, options);
3181
- }
3182
- if (PropertyGroup.isPropertyGroup(object)) {
3183
- return PropertyGroup.toRdfResource(object, options);
3184
- }
3185
- if (PropertyShape.isPropertyShape(object)) {
3186
- return PropertyShape.toRdfResource(object, options);
3187
- }
3188
- if (ValidationReport.isValidationReport(object)) {
3189
- return ValidationReport.toRdfResource(object, options);
3190
- }
3191
- if (ValidationResult.isValidationResult(object)) {
3192
- return ValidationResult.toRdfResource(object, options);
3080
+ switch (object.$type) {
3081
+ case "NodeShape":
3082
+ return NodeShape.toRdfResource(object, options);
3083
+ case "Ontology":
3084
+ return Ontology.toRdfResource(object, options);
3085
+ case "PropertyGroup":
3086
+ return PropertyGroup.toRdfResource(object, options);
3087
+ case "PropertyShape":
3088
+ return PropertyShape.toRdfResource(object, options);
3089
+ case "ValidationReport":
3090
+ return ValidationReport.toRdfResource(object, options);
3091
+ case "ValidationResult":
3092
+ return ValidationResult.toRdfResource(object, options);
3093
+ default:
3094
+ object;
3095
+ throw new Error("should never reach this point");
3193
3096
  }
3194
- throw new Error("unrecognized type");
3195
3097
  };
3196
- $Object.toRdfResourceValues = ((value, _options) => {
3197
- if (NodeShape.isNodeShape(value)) {
3198
- return [
3199
- NodeShape.toRdfResource(value, {
3200
- graph: _options.graph,
3201
- resourceSet: _options.resourceSet,
3202
- }).identifier,
3203
- ];
3204
- }
3205
- if (Ontology.isOntology(value)) {
3206
- return [
3207
- Ontology.toRdfResource(value, {
3208
- graph: _options.graph,
3209
- resourceSet: _options.resourceSet,
3210
- }).identifier,
3211
- ];
3098
+ function $toString(object) {
3099
+ switch (object.$type) {
3100
+ case "NodeShape":
3101
+ return NodeShape.$toString(object);
3102
+ case "Ontology":
3103
+ return Ontology.$toString(object);
3104
+ case "PropertyGroup":
3105
+ return PropertyGroup.$toString(object);
3106
+ case "PropertyShape":
3107
+ return PropertyShape.$toString(object);
3108
+ case "ValidationReport":
3109
+ return ValidationReport.$toString(object);
3110
+ case "ValidationResult":
3111
+ return ValidationResult.$toString(object);
3112
+ default:
3113
+ object;
3114
+ throw new Error("should never reach this point");
3212
3115
  }
3213
- if (PropertyGroup.isPropertyGroup(value)) {
3214
- return [
3215
- PropertyGroup.toRdfResource(value, {
3216
- graph: _options.graph,
3217
- resourceSet: _options.resourceSet,
3218
- }).identifier,
3219
- ];
3220
- }
3221
- if (PropertyShape.isPropertyShape(value)) {
3222
- return [
3223
- PropertyShape.toRdfResource(value, {
3224
- graph: _options.graph,
3225
- resourceSet: _options.resourceSet,
3226
- }).identifier,
3227
- ];
3228
- }
3229
- if (ValidationReport.isValidationReport(value)) {
3230
- return [
3231
- ValidationReport.toRdfResource(value, {
3232
- graph: _options.graph,
3233
- resourceSet: _options.resourceSet,
3234
- }).identifier,
3235
- ];
3236
- }
3237
- if (ValidationResult.isValidationResult(value)) {
3238
- return [
3239
- ValidationResult.toRdfResource(value, {
3240
- graph: _options.graph,
3241
- resourceSet: _options.resourceSet,
3242
- }).identifier,
3243
- ];
3244
- }
3245
- throw new Error("unable to serialize to RDF");
3246
- });
3116
+ }
3117
+ $Object.$toString = $toString;
3247
3118
  })($Object || ($Object = {}));
3248
3119
  //# sourceMappingURL=shacl-ast.shaclmate.js.map
package/package.json CHANGED
@@ -4,9 +4,9 @@
4
4
  "@rdfjs/term-map": "~2.0.2",
5
5
  "@rdfjs/term-set": "~2.0.3",
6
6
  "@rdfjs/types": "~2.0.1",
7
- "@rdfx/data-factory": "0.0.30",
8
- "@rdfx/resource": "0.0.30",
9
- "@rdfx/string": "0.0.30",
7
+ "@rdfx/data-factory": "0.0.32",
8
+ "@rdfx/resource": "0.0.32",
9
+ "@rdfx/string": "0.0.32",
10
10
  "@tpluscode/rdf-ns-builders": "~4.3.0",
11
11
  "@types/rdfjs__dataset": "~2.0.7",
12
12
  "@types/rdfjs__term-map": "~2.0.10",
@@ -15,7 +15,7 @@
15
15
  "typescript-memoize": "~1.1.1"
16
16
  },
17
17
  "devDependencies": {
18
- "@rdfx/literal": "0.0.30",
18
+ "@rdfx/literal": "0.0.32",
19
19
  "ts-invariant": "~0.10.3"
20
20
  },
21
21
  "files": [
@@ -58,5 +58,5 @@
58
58
  },
59
59
  "type": "module",
60
60
  "types": "./dist/index.d.ts",
61
- "version": "4.0.65"
61
+ "version": "4.0.66"
62
62
  }