@ng-org/shex-orm 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +240 -0
- package/dist/ShexJTypes.d.ts +542 -0
- package/dist/ShexJTypes.d.ts.map +1 -0
- package/dist/ShexJTypes.js +10 -0
- package/dist/build.d.ts +8 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/build.js +72 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +15 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/schema-converter/__tests__/typingTransformer.test.d.ts +2 -0
- package/dist/schema-converter/__tests__/typingTransformer.test.d.ts.map +1 -0
- package/dist/schema-converter/__tests__/typingTransformer.test.js +76 -0
- package/dist/schema-converter/converter.d.ts +12 -0
- package/dist/schema-converter/converter.d.ts.map +1 -0
- package/dist/schema-converter/converter.js +79 -0
- package/dist/schema-converter/templates/schema.ejs +8 -0
- package/dist/schema-converter/templates/shapeTypes.ejs +14 -0
- package/dist/schema-converter/templates/typings.ejs +14 -0
- package/dist/schema-converter/transformers/ShexJSchemaTransformer.d.ts +348 -0
- package/dist/schema-converter/transformers/ShexJSchemaTransformer.d.ts.map +1 -0
- package/dist/schema-converter/transformers/ShexJSchemaTransformer.js +239 -0
- package/dist/schema-converter/transformers/ShexJTypingTransformer.d.ts +366 -0
- package/dist/schema-converter/transformers/ShexJTypingTransformer.d.ts.map +1 -0
- package/dist/schema-converter/transformers/ShexJTypingTransformer.js +623 -0
- package/dist/schema-converter/util/ShapeInterfaceDeclaration.d.ts +5 -0
- package/dist/schema-converter/util/ShapeInterfaceDeclaration.d.ts.map +1 -0
- package/dist/schema-converter/util/ShapeInterfaceDeclaration.js +1 -0
- package/dist/schema-converter/util/annotateReadablePredicates.d.ts +8 -0
- package/dist/schema-converter/util/annotateReadablePredicates.d.ts.map +1 -0
- package/dist/schema-converter/util/annotateReadablePredicates.js +148 -0
- package/dist/schema-converter/util/dedupeObjectTypeMembers.d.ts +3 -0
- package/dist/schema-converter/util/dedupeObjectTypeMembers.d.ts.map +1 -0
- package/dist/schema-converter/util/dedupeObjectTypeMembers.js +47 -0
- package/dist/schema-converter/util/getRdfTypesForTripleConstraint.d.ts +4 -0
- package/dist/schema-converter/util/getRdfTypesForTripleConstraint.d.ts.map +1 -0
- package/dist/schema-converter/util/getRdfTypesForTripleConstraint.js +98 -0
- package/dist/types.d.ts +37 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +10 -0
- package/dist/util/forAllShapes.d.ts +2 -0
- package/dist/util/forAllShapes.d.ts.map +1 -0
- package/dist/util/forAllShapes.js +25 -0
- package/package.json +67 -0
- package/src/ShexJTypes.ts +616 -0
- package/src/build.ts +106 -0
- package/src/cli.ts +23 -0
- package/src/index.ts +1 -0
- package/src/schema-converter/__tests__/typingTransformer.test.ts +85 -0
- package/src/schema-converter/converter.ts +128 -0
- package/src/schema-converter/templates/schema.ejs +8 -0
- package/src/schema-converter/templates/shapeTypes.ejs +14 -0
- package/src/schema-converter/templates/typings.ejs +14 -0
- package/src/schema-converter/transformers/ShexJSchemaTransformer.ts +284 -0
- package/src/schema-converter/transformers/ShexJTypingTransformer.ts +807 -0
- package/src/schema-converter/util/ShapeInterfaceDeclaration.ts +5 -0
- package/src/schema-converter/util/annotateReadablePredicates.ts +173 -0
- package/src/schema-converter/util/dedupeObjectTypeMembers.ts +61 -0
- package/src/schema-converter/util/getRdfTypesForTripleConstraint.ts +153 -0
- package/src/types.ts +51 -0
- package/src/util/forAllShapes.ts +39 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
// Copyright (c) 2025 Laurin Weger, Par le Peuple, NextGraph.org developers
|
|
2
|
+
// All rights reserved.
|
|
3
|
+
// Licensed under the Apache License, Version 2.0
|
|
4
|
+
// <LICENSE-APACHE2 or http://www.apache.org/licenses/LICENSE-2.0>
|
|
5
|
+
// or the MIT license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
|
|
6
|
+
// at your option. All files in the project carrying such
|
|
7
|
+
// notice may not be copied, modified, or distributed except
|
|
8
|
+
// according to those terms.
|
|
9
|
+
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
10
|
+
import ShexJTraverser from "@ldo/traverser-shexj";
|
|
11
|
+
const rdfDataTypeToBasic = (dataType) => {
|
|
12
|
+
switch (dataType) {
|
|
13
|
+
case "http://www.w3.org/2001/XMLSchema#string":
|
|
14
|
+
case "http://www.w3.org/2001/XMLSchema#ENTITIES":
|
|
15
|
+
case "http://www.w3.org/2001/XMLSchema#ENTITY":
|
|
16
|
+
case "http://www.w3.org/2001/XMLSchema#ID":
|
|
17
|
+
case "http://www.w3.org/2001/XMLSchema#IDREF":
|
|
18
|
+
case "http://www.w3.org/2001/XMLSchema#IDREFS":
|
|
19
|
+
case "http://www.w3.org/2001/XMLSchema#language":
|
|
20
|
+
case "http://www.w3.org/2001/XMLSchema#Name":
|
|
21
|
+
case "http://www.w3.org/2001/XMLSchema#NCName":
|
|
22
|
+
case "http://www.w3.org/2001/XMLSchema#NMTOKEN":
|
|
23
|
+
case "http://www.w3.org/2001/XMLSchema#NMTOKENS":
|
|
24
|
+
case "http://www.w3.org/2001/XMLSchema#normalizedString":
|
|
25
|
+
case "http://www.w3.org/2001/XMLSchema#QName":
|
|
26
|
+
case "http://www.w3.org/2001/XMLSchema#token":
|
|
27
|
+
return "string";
|
|
28
|
+
case "http://www.w3.org/2001/XMLSchema#date":
|
|
29
|
+
case "http://www.w3.org/2001/XMLSchema#dateTime":
|
|
30
|
+
case "http://www.w3.org/2001/XMLSchema#duration":
|
|
31
|
+
case "http://www.w3.org/2001/XMLSchema#gDay":
|
|
32
|
+
case "http://www.w3.org/2001/XMLSchema#gMonth":
|
|
33
|
+
case "http://www.w3.org/2001/XMLSchema#gMonthDay":
|
|
34
|
+
case "http://www.w3.org/2001/XMLSchema#gYear":
|
|
35
|
+
case "http://www.w3.org/2001/XMLSchema#gYearMonth":
|
|
36
|
+
case "http://www.w3.org/2001/XMLSchema#time":
|
|
37
|
+
return "string";
|
|
38
|
+
case "http://www.w3.org/2001/XMLSchema#byte":
|
|
39
|
+
case "http://www.w3.org/2001/XMLSchema#decimal":
|
|
40
|
+
case "http://www.w3.org/2001/XMLSchema#double":
|
|
41
|
+
case "http://www.w3.org/2001/XMLSchema#float":
|
|
42
|
+
case "http://www.w3.org/2001/XMLSchema#int":
|
|
43
|
+
case "http://www.w3.org/2001/XMLSchema#integer":
|
|
44
|
+
case "http://www.w3.org/2001/XMLSchema#long":
|
|
45
|
+
case "http://www.w3.org/2001/XMLSchema#negativeInteger":
|
|
46
|
+
case "http://www.w3.org/2001/XMLSchema#nonNegativeInteger":
|
|
47
|
+
case "http://www.w3.org/2001/XMLSchema#nonPositiveInteger":
|
|
48
|
+
case "http://www.w3.org/2001/XMLSchema#positiveInteger":
|
|
49
|
+
case "http://www.w3.org/2001/XMLSchema#short":
|
|
50
|
+
case "http://www.w3.org/2001/XMLSchema#unsignedLong":
|
|
51
|
+
case "http://www.w3.org/2001/XMLSchema#unsignedInt":
|
|
52
|
+
case "http://www.w3.org/2001/XMLSchema#unsignedShort":
|
|
53
|
+
case "http://www.w3.org/2001/XMLSchema#unsignedByte":
|
|
54
|
+
return "number";
|
|
55
|
+
case "http://www.w3.org/2001/XMLSchema#boolean":
|
|
56
|
+
return "boolean";
|
|
57
|
+
case "http://www.w3.org/2001/XMLSchema#hexBinary":
|
|
58
|
+
return "string";
|
|
59
|
+
case "http://www.w3.org/2001/XMLSchema#anyURI":
|
|
60
|
+
return "iri";
|
|
61
|
+
default:
|
|
62
|
+
return "string";
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
export const ShexJSchemaTransformerCompact = ShexJTraverser.createTransformer({
|
|
66
|
+
Schema: {
|
|
67
|
+
transformer: async (_schema, getTransformedChildren) => {
|
|
68
|
+
const transformedChildren = await getTransformedChildren();
|
|
69
|
+
return transformedChildren.shapes || [];
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
ShapeDecl: {
|
|
73
|
+
transformer: async (shapeDecl, getTransformedChildren) => {
|
|
74
|
+
const schema = await getTransformedChildren();
|
|
75
|
+
const shape = schema.shapeExpr;
|
|
76
|
+
return { ...shape, iri: shapeDecl.id };
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
Shape: {
|
|
80
|
+
transformer: async (_shape, getTransformedChildren) => {
|
|
81
|
+
// TODO: We don't handles those
|
|
82
|
+
_shape.closed;
|
|
83
|
+
const transformedChildren = await getTransformedChildren();
|
|
84
|
+
const compactShape = transformedChildren.expression;
|
|
85
|
+
for (const extra of _shape.extra || []) {
|
|
86
|
+
const extraPredicate = compactShape.predicates.find((p) => p.iri === extra);
|
|
87
|
+
if (extraPredicate)
|
|
88
|
+
extraPredicate.extra = true;
|
|
89
|
+
}
|
|
90
|
+
return compactShape;
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
// EachOf contains the `expressions` array of properties (TripleConstraint)
|
|
94
|
+
EachOf: {
|
|
95
|
+
transformer: async (eachOf, getTransformedChildren) => {
|
|
96
|
+
const transformedChildren = await getTransformedChildren();
|
|
97
|
+
return {
|
|
98
|
+
iri: "",
|
|
99
|
+
predicates: transformedChildren.expressions.map(
|
|
100
|
+
// We disregard cases where properties are referenced (strings)
|
|
101
|
+
// or where they consist of Unions or Intersections (not supported).
|
|
102
|
+
(expr) => expr),
|
|
103
|
+
};
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
TripleConstraint: {
|
|
107
|
+
transformer: async (tripleConstraint, getTransformedChildren, _setReturnPointer) => {
|
|
108
|
+
const transformedChildren = await getTransformedChildren();
|
|
109
|
+
const commonProperties = {
|
|
110
|
+
maxCardinality: tripleConstraint.max ?? 1,
|
|
111
|
+
minCardinality: tripleConstraint.min ?? 1,
|
|
112
|
+
iri: tripleConstraint.predicate,
|
|
113
|
+
// @ts-expect-error The ldo library does not have our modded readablePredicate property.
|
|
114
|
+
readablePredicate: tripleConstraint.readablePredicate,
|
|
115
|
+
};
|
|
116
|
+
// Make property based on object type which is either a parsed schema, literal or type.
|
|
117
|
+
if (typeof transformedChildren.valueExpr === "string") {
|
|
118
|
+
// Reference to nested object
|
|
119
|
+
return {
|
|
120
|
+
dataTypes: [
|
|
121
|
+
{
|
|
122
|
+
valType: "shape",
|
|
123
|
+
shape: transformedChildren.valueExpr,
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
...commonProperties,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
else if (transformedChildren.valueExpr &&
|
|
130
|
+
transformedChildren.valueExpr.predicates) {
|
|
131
|
+
// Nested object
|
|
132
|
+
return {
|
|
133
|
+
dataTypes: [
|
|
134
|
+
{
|
|
135
|
+
valType: "shape",
|
|
136
|
+
shape: transformedChildren.valueExpr,
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
...commonProperties,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
else if (Array.isArray(transformedChildren.valueExpr)) {
|
|
143
|
+
return {
|
|
144
|
+
dataTypes: transformedChildren.valueExpr, // DataType[]
|
|
145
|
+
...commonProperties,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
// type or literal
|
|
150
|
+
const nodeConstraint = transformedChildren.valueExpr;
|
|
151
|
+
return {
|
|
152
|
+
dataTypes: [
|
|
153
|
+
{
|
|
154
|
+
valType: nodeConstraint.valType,
|
|
155
|
+
literals: nodeConstraint.literals,
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
...commonProperties,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
NodeConstraint: {
|
|
164
|
+
transformer: async (nodeConstraint) => {
|
|
165
|
+
if (nodeConstraint.datatype) {
|
|
166
|
+
return {
|
|
167
|
+
valType: rdfDataTypeToBasic(nodeConstraint.datatype),
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
if (nodeConstraint.nodeKind) {
|
|
171
|
+
// Something reference-like.
|
|
172
|
+
return { valType: "iri" };
|
|
173
|
+
}
|
|
174
|
+
if (nodeConstraint.values) {
|
|
175
|
+
return {
|
|
176
|
+
valType: "literal",
|
|
177
|
+
literals: nodeConstraint.values.map(
|
|
178
|
+
// TODO: We do not convert them to number or boolean or lang tag.
|
|
179
|
+
// And we don't have an annotation of the literal's type.
|
|
180
|
+
(valueRecord) => {
|
|
181
|
+
// If valueRecord is a string (IRIREF), return it directly
|
|
182
|
+
if (typeof valueRecord === "string") {
|
|
183
|
+
return valueRecord;
|
|
184
|
+
}
|
|
185
|
+
// Handle ObjectLiteral (has .value property)
|
|
186
|
+
if ("value" in valueRecord) {
|
|
187
|
+
return valueRecord.value;
|
|
188
|
+
}
|
|
189
|
+
// Handle other types with .id property (if any)
|
|
190
|
+
if ("id" in valueRecord) {
|
|
191
|
+
return valueRecord.id;
|
|
192
|
+
}
|
|
193
|
+
// Handle Language type (has .languageTag)
|
|
194
|
+
if ("languageTag" in valueRecord) {
|
|
195
|
+
return valueRecord.languageTag;
|
|
196
|
+
}
|
|
197
|
+
// Handle stem-based types (IriStem, LiteralStem, LanguageStem)
|
|
198
|
+
if ("stem" in valueRecord) {
|
|
199
|
+
return valueRecord.stem;
|
|
200
|
+
}
|
|
201
|
+
// Fallback - should not happen in well-formed ShEx
|
|
202
|
+
return undefined;
|
|
203
|
+
}),
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
// Maybe we should throw instead...
|
|
207
|
+
throw {
|
|
208
|
+
error: new Error("Could not parse Node Constraint"),
|
|
209
|
+
nodeConstraint,
|
|
210
|
+
};
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
// Transformer from ShapeOr
|
|
214
|
+
ShapeOr: {
|
|
215
|
+
transformer: async (shapeOr, getTransformedChildren) => {
|
|
216
|
+
const { shapeExprs } = await getTransformedChildren();
|
|
217
|
+
// Either a shape IRI, a nested shape or a node CompactSchemaValue (node constraint).
|
|
218
|
+
return (Array.isArray(shapeExprs) ? shapeExprs : [shapeExprs]);
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
// Transformer from ShapeAnd
|
|
222
|
+
ShapeAnd: {
|
|
223
|
+
transformer: async () => {
|
|
224
|
+
throw new Error("ShapeAnd not supported (compact)");
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
// Transformer from ShapeNot - not supported.
|
|
228
|
+
ShapeNot: {
|
|
229
|
+
transformer: async () => {
|
|
230
|
+
throw new Error("ShapeNot not supported (compact)");
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
// Transformer from ShapeExternal - not supported.
|
|
234
|
+
ShapeExternal: {
|
|
235
|
+
transformer: async () => {
|
|
236
|
+
throw new Error("ShapeExternal not supported (compact)");
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
});
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
import type { Annotation } from "shexj";
|
|
2
|
+
import * as dom from "dts-dom";
|
|
3
|
+
import type { InterfaceDeclaration } from "dts-dom";
|
|
4
|
+
export interface ShapeInterfaceDeclaration extends InterfaceDeclaration {
|
|
5
|
+
shapeId?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const additionalCompactEnumAliases: Set<string>;
|
|
8
|
+
export interface CompactTransformerContext {
|
|
9
|
+
getNameFromIri: (iri: string, rdfType?: string) => string;
|
|
10
|
+
}
|
|
11
|
+
export declare function toCamelCase(text: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Name functions
|
|
14
|
+
*/
|
|
15
|
+
export declare function iriToName(iri: string): string;
|
|
16
|
+
export declare function nameFromAnnotationOrId(obj: {
|
|
17
|
+
id?: string;
|
|
18
|
+
annotations?: Annotation[];
|
|
19
|
+
}): string | undefined;
|
|
20
|
+
export declare const ShexJTypingTransformerCompact: import("@ldo/type-traverser").Transformer<{
|
|
21
|
+
Schema: {
|
|
22
|
+
kind: "interface";
|
|
23
|
+
type: import("@ldo/traverser-shexj").Schema;
|
|
24
|
+
properties: {
|
|
25
|
+
startActs: "SemAct";
|
|
26
|
+
start: "shapeExprOrRef";
|
|
27
|
+
imports: "IRIREF";
|
|
28
|
+
shapes: "ShapeDecl";
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
ShapeDecl: {
|
|
32
|
+
kind: "interface";
|
|
33
|
+
type: import("@ldo/traverser-shexj").ShapeDecl;
|
|
34
|
+
properties: {
|
|
35
|
+
id: "shapeDeclLabel";
|
|
36
|
+
abstract: "BOOL";
|
|
37
|
+
restricts: "shapeExprOrRef";
|
|
38
|
+
shapeExpr: "shapeExpr";
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
shapeExpr: {
|
|
42
|
+
kind: "union";
|
|
43
|
+
type: import("@ldo/traverser-shexj").shapeExpr;
|
|
44
|
+
typeNames: "ShapeOr" | "ShapeAnd" | "ShapeNot" | "NodeConstraint" | "Shape" | "ShapeExternal";
|
|
45
|
+
};
|
|
46
|
+
shapeExprOrRef: {
|
|
47
|
+
kind: "union";
|
|
48
|
+
type: import("@ldo/traverser-shexj").shapeExprOrRef;
|
|
49
|
+
typeNames: "shapeExpr" | "shapeDeclRef";
|
|
50
|
+
};
|
|
51
|
+
ShapeOr: {
|
|
52
|
+
kind: "interface";
|
|
53
|
+
type: import("@ldo/traverser-shexj").ShapeOr;
|
|
54
|
+
properties: {
|
|
55
|
+
shapeExprs: "shapeExprOrRef";
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
ShapeAnd: {
|
|
59
|
+
kind: "interface";
|
|
60
|
+
type: import("@ldo/traverser-shexj").ShapeAnd;
|
|
61
|
+
properties: {
|
|
62
|
+
shapeExprs: "shapeExprOrRef";
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
ShapeNot: {
|
|
66
|
+
kind: "interface";
|
|
67
|
+
type: import("@ldo/traverser-shexj").ShapeNot;
|
|
68
|
+
properties: {
|
|
69
|
+
shapeExpr: "shapeExprOrRef";
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
ShapeExternal: {
|
|
73
|
+
kind: "interface";
|
|
74
|
+
type: import("@ldo/traverser-shexj").ShapeExternal;
|
|
75
|
+
properties: Record<string, never>;
|
|
76
|
+
};
|
|
77
|
+
shapeDeclRef: {
|
|
78
|
+
kind: "union";
|
|
79
|
+
type: import("@ldo/traverser-shexj").shapeDeclRef;
|
|
80
|
+
typeNames: "shapeDeclLabel" | "ShapeDecl";
|
|
81
|
+
};
|
|
82
|
+
shapeDeclLabel: {
|
|
83
|
+
kind: "union";
|
|
84
|
+
type: import("@ldo/traverser-shexj").shapeDeclLabel;
|
|
85
|
+
typeNames: "IRIREF" | "BNODE";
|
|
86
|
+
};
|
|
87
|
+
NodeConstraint: {
|
|
88
|
+
kind: "interface";
|
|
89
|
+
type: import("@ldo/traverser-shexj").NodeConstraint;
|
|
90
|
+
properties: {
|
|
91
|
+
datatype: "IRIREF";
|
|
92
|
+
values: "valueSetValue";
|
|
93
|
+
length: "INTEGER";
|
|
94
|
+
minlength: "INTEGER";
|
|
95
|
+
maxlength: "INTEGER";
|
|
96
|
+
pattern: "STRING";
|
|
97
|
+
flags: "STRING";
|
|
98
|
+
mininclusive: "numericLiteral";
|
|
99
|
+
minexclusive: "numericLiteral";
|
|
100
|
+
totaldigits: "INTEGER";
|
|
101
|
+
fractiondigits: "INTEGER";
|
|
102
|
+
semActs: "SemAct";
|
|
103
|
+
annotations: "Annotation";
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
numericLiteral: {
|
|
107
|
+
kind: "union";
|
|
108
|
+
type: import("@ldo/traverser-shexj").numericLiteral;
|
|
109
|
+
typeNames: "INTEGER" | "DECIMAL" | "DOUBLE";
|
|
110
|
+
};
|
|
111
|
+
valueSetValue: {
|
|
112
|
+
kind: "union";
|
|
113
|
+
type: import("@ldo/traverser-shexj").valueSetValue;
|
|
114
|
+
typeNames: "objectValue" | "IriStem" | "IriStemRange" | "LiteralStem" | "LiteralStemRange" | "Language" | "LanguageStem" | "LanguageStemRange";
|
|
115
|
+
};
|
|
116
|
+
objectValue: {
|
|
117
|
+
kind: "union";
|
|
118
|
+
type: import("@ldo/traverser-shexj").objectValue;
|
|
119
|
+
typeNames: "IRIREF" | "ObjectLiteral";
|
|
120
|
+
};
|
|
121
|
+
ObjectLiteral: {
|
|
122
|
+
kind: "interface";
|
|
123
|
+
type: import("@ldo/traverser-shexj").ObjectLiteral;
|
|
124
|
+
properties: {
|
|
125
|
+
value: "STRING";
|
|
126
|
+
language: "STRING";
|
|
127
|
+
type: "STRING";
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
IriStem: {
|
|
131
|
+
kind: "interface";
|
|
132
|
+
type: import("@ldo/traverser-shexj").IriStem;
|
|
133
|
+
properties: {
|
|
134
|
+
stem: "IRIREF";
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
IriStemRange: {
|
|
138
|
+
kind: "interface";
|
|
139
|
+
type: import("@ldo/traverser-shexj").IriStemRange;
|
|
140
|
+
properties: {
|
|
141
|
+
stem: "IRIREF";
|
|
142
|
+
exclusions: "IriStemRangeExclusions";
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
IriStemRangeExclusions: {
|
|
146
|
+
kind: "union";
|
|
147
|
+
type: import("@ldo/traverser-shexj").IRIREF | import("@ldo/traverser-shexj").IriStem;
|
|
148
|
+
typeNames: "IRIREF" | "IriStem";
|
|
149
|
+
};
|
|
150
|
+
LiteralStem: {
|
|
151
|
+
kind: "interface";
|
|
152
|
+
type: import("@ldo/traverser-shexj").LiteralStem;
|
|
153
|
+
properties: {
|
|
154
|
+
stem: "STRING";
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
LiteralStemRange: {
|
|
158
|
+
kind: "interface";
|
|
159
|
+
type: import("@ldo/traverser-shexj").LiteralStemRange;
|
|
160
|
+
properties: {
|
|
161
|
+
stem: "LiteralStemRangeStem";
|
|
162
|
+
exclusions: "LiteralStemRangeExclusions";
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
LiteralStemRangeStem: {
|
|
166
|
+
kind: "union";
|
|
167
|
+
type: import("@ldo/traverser-shexj").STRING | import("@ldo/traverser-shexj").Wildcard;
|
|
168
|
+
typeNames: "STRING" | "Wildcard";
|
|
169
|
+
};
|
|
170
|
+
LiteralStemRangeExclusions: {
|
|
171
|
+
kind: "union";
|
|
172
|
+
type: import("@ldo/traverser-shexj").STRING | import("@ldo/traverser-shexj").LiteralStem;
|
|
173
|
+
typeNames: "STRING" | "LiteralStem";
|
|
174
|
+
};
|
|
175
|
+
Language: {
|
|
176
|
+
kind: "interface";
|
|
177
|
+
type: import("@ldo/traverser-shexj").Language;
|
|
178
|
+
properties: {
|
|
179
|
+
languageTag: "LANGTAG";
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
LanguageStem: {
|
|
183
|
+
kind: "interface";
|
|
184
|
+
type: import("@ldo/traverser-shexj").LanguageStem;
|
|
185
|
+
properties: {
|
|
186
|
+
stem: "LANGTAG";
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
LanguageStemRange: {
|
|
190
|
+
kind: "interface";
|
|
191
|
+
type: import("@ldo/traverser-shexj").LanguageStemRange;
|
|
192
|
+
properties: {
|
|
193
|
+
stem: "LanguageStemRangeStem";
|
|
194
|
+
exclusions: "LanguageStemRangeExclusions";
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
LanguageStemRangeStem: {
|
|
198
|
+
kind: "union";
|
|
199
|
+
type: import("@ldo/traverser-shexj").LANGTAG | import("@ldo/traverser-shexj").Wildcard;
|
|
200
|
+
typeNames: "LANGTAG" | "Wildcard";
|
|
201
|
+
};
|
|
202
|
+
LanguageStemRangeExclusions: {
|
|
203
|
+
kind: "union";
|
|
204
|
+
type: import("@ldo/traverser-shexj").LANGTAG | import("@ldo/traverser-shexj").LanguageStem;
|
|
205
|
+
typeNames: "LANGTAG" | "LanguageStem";
|
|
206
|
+
};
|
|
207
|
+
Wildcard: {
|
|
208
|
+
kind: "interface";
|
|
209
|
+
type: import("@ldo/traverser-shexj").Wildcard;
|
|
210
|
+
properties: Record<string, never>;
|
|
211
|
+
};
|
|
212
|
+
Shape: {
|
|
213
|
+
kind: "interface";
|
|
214
|
+
type: import("@ldo/traverser-shexj").Shape;
|
|
215
|
+
properties: {
|
|
216
|
+
closed: "BOOL";
|
|
217
|
+
extra: "IRIREF";
|
|
218
|
+
extends: "shapeExprOrRef";
|
|
219
|
+
expression: "tripleExprOrRef";
|
|
220
|
+
semActs: "SemAct";
|
|
221
|
+
annotations: "Annotation";
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
tripleExpr: {
|
|
225
|
+
kind: "union";
|
|
226
|
+
type: import("@ldo/traverser-shexj").tripleExpr;
|
|
227
|
+
typeNames: "EachOf" | "OneOf" | "TripleConstraint";
|
|
228
|
+
};
|
|
229
|
+
tripleExprOrRef: {
|
|
230
|
+
kind: "union";
|
|
231
|
+
type: import("@ldo/traverser-shexj").tripleExprOrRef;
|
|
232
|
+
typeNames: "tripleExpr" | "tripleExprRef";
|
|
233
|
+
};
|
|
234
|
+
EachOf: {
|
|
235
|
+
kind: "interface";
|
|
236
|
+
type: import("@ldo/traverser-shexj").EachOf;
|
|
237
|
+
properties: {
|
|
238
|
+
id: "tripleExprLabel";
|
|
239
|
+
min: "INTEGER";
|
|
240
|
+
max: "INTEGER";
|
|
241
|
+
expressions: "tripleExprOrRef";
|
|
242
|
+
semActs: "SemAct";
|
|
243
|
+
annotations: "Annotation";
|
|
244
|
+
};
|
|
245
|
+
};
|
|
246
|
+
OneOf: {
|
|
247
|
+
kind: "interface";
|
|
248
|
+
type: import("@ldo/traverser-shexj").OneOf;
|
|
249
|
+
properties: {
|
|
250
|
+
id: "tripleExprLabel";
|
|
251
|
+
min: "INTEGER";
|
|
252
|
+
max: "INTEGER";
|
|
253
|
+
expressions: "tripleExprOrRef";
|
|
254
|
+
semActs: "SemAct";
|
|
255
|
+
annotations: "Annotation";
|
|
256
|
+
};
|
|
257
|
+
};
|
|
258
|
+
TripleConstraint: {
|
|
259
|
+
kind: "interface";
|
|
260
|
+
type: import("@ldo/traverser-shexj").TripleConstraint;
|
|
261
|
+
properties: {
|
|
262
|
+
id: "tripleExprLabel";
|
|
263
|
+
min: "INTEGER";
|
|
264
|
+
max: "INTEGER";
|
|
265
|
+
inverse: "BOOL";
|
|
266
|
+
predicate: "IRIREF";
|
|
267
|
+
valueExpr: "shapeExprOrRef";
|
|
268
|
+
semActs: "SemAct";
|
|
269
|
+
annotations: "Annotation";
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
tripleExprRef: {
|
|
273
|
+
kind: "union";
|
|
274
|
+
type: import("@ldo/traverser-shexj").tripleExprRef;
|
|
275
|
+
typeNames: "tripleExprLabel";
|
|
276
|
+
};
|
|
277
|
+
tripleExprLabel: {
|
|
278
|
+
kind: "union";
|
|
279
|
+
type: import("@ldo/traverser-shexj").tripleExprLabel;
|
|
280
|
+
typeNames: "IRIREF" | "BNODE";
|
|
281
|
+
};
|
|
282
|
+
SemAct: {
|
|
283
|
+
kind: "interface";
|
|
284
|
+
type: import("@ldo/traverser-shexj").SemAct;
|
|
285
|
+
properties: {
|
|
286
|
+
name: "IRIREF";
|
|
287
|
+
code: "STRING";
|
|
288
|
+
};
|
|
289
|
+
};
|
|
290
|
+
Annotation: {
|
|
291
|
+
kind: "interface";
|
|
292
|
+
type: import("@ldo/traverser-shexj").Annotation;
|
|
293
|
+
properties: {
|
|
294
|
+
predicate: "IRI";
|
|
295
|
+
object: "objectValue";
|
|
296
|
+
};
|
|
297
|
+
};
|
|
298
|
+
IRIREF: {
|
|
299
|
+
kind: "primitive";
|
|
300
|
+
type: import("@ldo/traverser-shexj").IRIREF;
|
|
301
|
+
};
|
|
302
|
+
BNODE: {
|
|
303
|
+
kind: "primitive";
|
|
304
|
+
type: import("@ldo/traverser-shexj").BNODE;
|
|
305
|
+
};
|
|
306
|
+
INTEGER: {
|
|
307
|
+
kind: "primitive";
|
|
308
|
+
type: import("@ldo/traverser-shexj").INTEGER;
|
|
309
|
+
};
|
|
310
|
+
STRING: {
|
|
311
|
+
kind: "primitive";
|
|
312
|
+
type: import("@ldo/traverser-shexj").STRING;
|
|
313
|
+
};
|
|
314
|
+
DECIMAL: {
|
|
315
|
+
kind: "primitive";
|
|
316
|
+
type: import("@ldo/traverser-shexj").DECIMAL;
|
|
317
|
+
};
|
|
318
|
+
DOUBLE: {
|
|
319
|
+
kind: "primitive";
|
|
320
|
+
type: import("@ldo/traverser-shexj").DOUBLE;
|
|
321
|
+
};
|
|
322
|
+
LANGTAG: {
|
|
323
|
+
kind: "primitive";
|
|
324
|
+
type: import("@ldo/traverser-shexj").LANGTAG;
|
|
325
|
+
};
|
|
326
|
+
BOOL: {
|
|
327
|
+
kind: "primitive";
|
|
328
|
+
type: import("@ldo/traverser-shexj").BOOL;
|
|
329
|
+
};
|
|
330
|
+
IRI: {
|
|
331
|
+
kind: "primitive";
|
|
332
|
+
type: import("@ldo/traverser-shexj").IRI;
|
|
333
|
+
};
|
|
334
|
+
}, {
|
|
335
|
+
Schema: {
|
|
336
|
+
return: dom.TopLevelDeclaration[];
|
|
337
|
+
};
|
|
338
|
+
ShapeDecl: {
|
|
339
|
+
return: dom.InterfaceDeclaration;
|
|
340
|
+
};
|
|
341
|
+
Shape: {
|
|
342
|
+
return: dom.InterfaceDeclaration;
|
|
343
|
+
};
|
|
344
|
+
EachOf: {
|
|
345
|
+
return: dom.ObjectType | dom.InterfaceDeclaration;
|
|
346
|
+
};
|
|
347
|
+
TripleConstraint: {
|
|
348
|
+
return: dom.PropertyDeclaration;
|
|
349
|
+
};
|
|
350
|
+
NodeConstraint: {
|
|
351
|
+
return: dom.Type;
|
|
352
|
+
};
|
|
353
|
+
ShapeOr: {
|
|
354
|
+
return: dom.UnionType;
|
|
355
|
+
};
|
|
356
|
+
ShapeAnd: {
|
|
357
|
+
return: dom.IntersectionType;
|
|
358
|
+
};
|
|
359
|
+
ShapeNot: {
|
|
360
|
+
return: never;
|
|
361
|
+
};
|
|
362
|
+
ShapeExternal: {
|
|
363
|
+
return: never;
|
|
364
|
+
};
|
|
365
|
+
}, null>;
|
|
366
|
+
//# sourceMappingURL=ShexJTypingTransformer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShexJTypingTransformer.d.ts","sourceRoot":"","sources":["../../../src/schema-converter/transformers/ShexJTypingTransformer.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,KAAK,GAAG,MAAM,SAAS,CAAC;AAC/B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,MAAM,WAAW,yBAA0B,SAAQ,oBAAoB;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAGD,eAAO,MAAM,4BAA4B,aAAoB,CAAC;AAE9D,MAAM,WAAW,yBAAyB;IACtC,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;CAC7D;AAeD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,UAOvC;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAc7C;AAED,wBAAgB,sBAAsB,CAAC,GAAG,EAAE;IACxC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;CAC9B,GAAG,MAAM,GAAG,SAAS,CAgBrB;AAyPD,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAE1B;QAAE,MAAM,EAAE,GAAG,CAAC,mBAAmB,EAAE,CAAA;KAAE;eAClC;QAAE,MAAM,EAAE,GAAG,CAAC,oBAAoB,CAAA;KAAE;WACxC;QAAE,MAAM,EAAE,GAAG,CAAC,oBAAoB,CAAA;KAAE;YACnC;QAAE,MAAM,EAAE,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC,oBAAoB,CAAA;KAAE;sBAC3C;QAAE,MAAM,EAAE,GAAG,CAAC,mBAAmB,CAAA;KAAE;oBACrC;QAAE,MAAM,EAAE,GAAG,CAAC,IAAI,CAAA;KAAE;aAC3B;QAAE,MAAM,EAAE,GAAG,CAAC,SAAS,CAAA;KAAE;cACxB;QAAE,MAAM,EAAE,GAAG,CAAC,gBAAgB,CAAA;KAAE;cAChC;QAAE,MAAM,EAAE,KAAK,CAAA;KAAE;mBACZ;QAAE,MAAM,EAAE,KAAK,CAAA;KAAE;QAyctC,CAAC"}
|