@ng-org/shex-orm 0.1.2-alpha.2 → 0.1.2-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/schema-converter/__tests__/typingTransformer.test.js +72 -2
- package/dist/schema-converter/transformers/ShexJSchemaTransformer.d.ts +1 -1
- package/dist/schema-converter/transformers/ShexJSchemaTransformer.d.ts.map +1 -1
- package/dist/schema-converter/transformers/ShexJSchemaTransformer.js +69 -41
- package/dist/schema-converter/util/annotateReadablePredicates.d.ts.map +1 -1
- package/dist/schema-converter/util/annotateReadablePredicates.js +90 -61
- package/dist/types.d.ts +5 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -10
|
@@ -55,8 +55,69 @@ function buildSchema() {
|
|
|
55
55
|
},
|
|
56
56
|
},
|
|
57
57
|
},
|
|
58
|
+
{
|
|
59
|
+
type: "ShapeDecl",
|
|
60
|
+
id: "http://example.org/CollisionTest",
|
|
61
|
+
shapeExpr: {
|
|
62
|
+
type: "Shape",
|
|
63
|
+
extra: [TYPE_IRI],
|
|
64
|
+
expression: {
|
|
65
|
+
type: "EachOf",
|
|
66
|
+
expressions: [
|
|
67
|
+
{
|
|
68
|
+
type: "TripleConstraint",
|
|
69
|
+
predicate: "http://example.org/collide1/foo",
|
|
70
|
+
valueExpr: {
|
|
71
|
+
type: "NodeConstraint",
|
|
72
|
+
datatype: "http://www.w3.org/2001/XMLSchema#string",
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
type: "TripleConstraint",
|
|
77
|
+
predicate: "http://example.org/collide2/foo",
|
|
78
|
+
valueExpr: {
|
|
79
|
+
type: "NodeConstraint",
|
|
80
|
+
datatype: "http://www.w3.org/2001/XMLSchema#string",
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
type: "TripleConstraint",
|
|
85
|
+
predicate: "http://example.org/collide3/foo",
|
|
86
|
+
valueExpr: {
|
|
87
|
+
type: "NodeConstraint",
|
|
88
|
+
datatype: "http://www.w3.org/2001/XMLSchema#string",
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
type: "TripleConstraint",
|
|
93
|
+
predicate: "http://example.org2/collide3/foo",
|
|
94
|
+
valueExpr: {
|
|
95
|
+
type: "NodeConstraint",
|
|
96
|
+
datatype: "http://www.w3.org/2001/XMLSchema#string",
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
type: "TripleConstraint",
|
|
101
|
+
predicate: "http://example.org:collide4/foo",
|
|
102
|
+
valueExpr: {
|
|
103
|
+
type: "NodeConstraint",
|
|
104
|
+
datatype: "http://www.w3.org/2001/XMLSchema#string",
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
type: "TripleConstraint",
|
|
109
|
+
predicate: "http://example.org/collide4/foo",
|
|
110
|
+
valueExpr: {
|
|
111
|
+
type: "NodeConstraint",
|
|
112
|
+
datatype: "http://www.w3.org/2001/XMLSchema#string",
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
},
|
|
58
119
|
],
|
|
59
|
-
};
|
|
120
|
+
}; // satisfies Schema;
|
|
60
121
|
}
|
|
61
122
|
async function buildTypingsText() {
|
|
62
123
|
const schema = buildSchema();
|
|
@@ -71,6 +132,15 @@ describe("ShexJTypingTransformer", () => {
|
|
|
71
132
|
});
|
|
72
133
|
it("treats EXTRA rdf:type predicates as plural", async () => {
|
|
73
134
|
const typings = await buildTypingsText();
|
|
74
|
-
expect(typings).toMatch(
|
|
135
|
+
expect(typings).toMatch(/\"@type\": Set<\"http:\/\/example\.org\/ExpenseCategory\" | IRI & {}>;/);
|
|
136
|
+
});
|
|
137
|
+
it("handles property name collisions", async () => {
|
|
138
|
+
const typings = await buildTypingsText();
|
|
139
|
+
expect(typings).toMatch(/ collide1_foo: string/);
|
|
140
|
+
expect(typings).toMatch(/ collide2_foo: string/);
|
|
141
|
+
expect(typings).toMatch(/ org_collide3_foo: string/);
|
|
142
|
+
expect(typings).toMatch(/ org2_collide3_foo: string/);
|
|
143
|
+
expect(typings).toMatch(/ "0__http_example_org_collide4_foo"\: string/);
|
|
144
|
+
expect(typings).toMatch(/ "1__http_example_org_collide4_foo"\: string/);
|
|
75
145
|
});
|
|
76
146
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShexJSchemaTransformer.d.ts","sourceRoot":"","sources":["../../../src/schema-converter/transformers/ShexJSchemaTransformer.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"ShexJSchemaTransformer.d.ts","sourceRoot":"","sources":["../../../src/schema-converter/transformers/ShexJSchemaTransformer.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAyDjE,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAE1B;QAAE,MAAM,EAAE,KAAK,EAAE,CAAA;KAAE;eAChB;QAAE,MAAM,EAAE,KAAK,CAAA;KAAE;WACrB;QAAE,MAAM,EAAE,KAAK,CAAA;KAAE;YAChB;QAAE,MAAM,EAAE,KAAK,CAAA;KAAE;sBACP;QAAE,MAAM,EAAE,SAAS,CAAA;KAAE;oBACvB;QAAE,MAAM,EAAE,QAAQ,GAAG,QAAQ,EAAE,CAAA;KAAE;aACxC;QAAE,MAAM,EAAE,QAAQ,EAAE,CAAA;KAAE;cACrB;QAAE,MAAM,EAAE,KAAK,CAAA;KAAE;cACjB;QAAE,MAAM,EAAE,KAAK,CAAA;KAAE;mBACZ;QAAE,MAAM,EAAE,KAAK,CAAA;KAAE;QA+OtC,CAAC"}
|
|
@@ -140,26 +140,17 @@ export const ShexJSchemaTransformerCompact = ShexJTraverser.createTransformer({
|
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
142
|
else if (Array.isArray(transformedChildren.valueExpr)) {
|
|
143
|
+
// DataType[] from ShapeOr or NodeConstraint with mixed types.
|
|
143
144
|
return {
|
|
144
145
|
dataTypes: transformedChildren.valueExpr, // DataType[]
|
|
145
146
|
...commonProperties,
|
|
146
147
|
};
|
|
147
148
|
}
|
|
148
149
|
else {
|
|
149
|
-
//
|
|
150
|
+
// Single DataType from NodeConstraint.
|
|
150
151
|
const nodeConstraint = transformedChildren.valueExpr;
|
|
151
152
|
return {
|
|
152
|
-
dataTypes:
|
|
153
|
-
? [
|
|
154
|
-
{
|
|
155
|
-
valType: nodeConstraint.valType,
|
|
156
|
-
literals: nodeConstraint.literals,
|
|
157
|
-
},
|
|
158
|
-
]
|
|
159
|
-
: nodeConstraint.literals.map((lit) => ({
|
|
160
|
-
valType: nodeConstraint.valType,
|
|
161
|
-
literals: [lit],
|
|
162
|
-
})),
|
|
153
|
+
dataTypes: [nodeConstraint],
|
|
163
154
|
...commonProperties,
|
|
164
155
|
};
|
|
165
156
|
}
|
|
@@ -177,36 +168,70 @@ export const ShexJSchemaTransformerCompact = ShexJTraverser.createTransformer({
|
|
|
177
168
|
return { valType: "iri" };
|
|
178
169
|
}
|
|
179
170
|
if (nodeConstraint.values) {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
//
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
171
|
+
// In ShEx, [val1 val2 val3] means "one of these values" (OR semantics).
|
|
172
|
+
// Each literal value becomes a separate DataType entry.
|
|
173
|
+
const dataTypes = nodeConstraint.values.map((valueRecord) => {
|
|
174
|
+
// If valueRecord is an IRIREF...
|
|
175
|
+
if (typeof valueRecord === "string") {
|
|
176
|
+
return {
|
|
177
|
+
valType: "iri",
|
|
178
|
+
literals: [valueRecord],
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
// Handle ObjectLiteral (has .value property).
|
|
182
|
+
if ("value" in valueRecord) {
|
|
183
|
+
const val = valueRecord.value;
|
|
184
|
+
// Determine type from datatype if available.
|
|
185
|
+
if ("type" in valueRecord && valueRecord.type) {
|
|
186
|
+
return {
|
|
187
|
+
valType: rdfDataTypeToBasic(valueRecord.type),
|
|
188
|
+
literals: [val],
|
|
189
|
+
};
|
|
193
190
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
191
|
+
if (typeof val === "number") {
|
|
192
|
+
return {
|
|
193
|
+
valType: "number",
|
|
194
|
+
literals: [val],
|
|
195
|
+
};
|
|
197
196
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
197
|
+
if (typeof val === "boolean") {
|
|
198
|
+
return {
|
|
199
|
+
valType: "boolean",
|
|
200
|
+
literals: [val],
|
|
201
|
+
};
|
|
201
202
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
203
|
+
return {
|
|
204
|
+
valType: "string",
|
|
205
|
+
literals: [val],
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
// Handle other types with .id property (if any).
|
|
209
|
+
if ("id" in valueRecord) {
|
|
210
|
+
return {
|
|
211
|
+
valType: "iri",
|
|
212
|
+
literals: [valueRecord.id],
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
// Handle language-tagged strings.
|
|
216
|
+
if ("languageTag" in valueRecord) {
|
|
217
|
+
return {
|
|
218
|
+
valType: "string",
|
|
219
|
+
literals: [valueRecord.languageTag],
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
// Handle stem-based types (IriStem, LiteralStem, LanguageStem).
|
|
223
|
+
if ("stem" in valueRecord) {
|
|
224
|
+
return {
|
|
225
|
+
valType: "string",
|
|
226
|
+
literals: [valueRecord.stem],
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
// Fallback - should not happen in well-formed ShEx
|
|
230
|
+
return {
|
|
231
|
+
valType: "string",
|
|
232
|
+
};
|
|
233
|
+
});
|
|
234
|
+
return dataTypes;
|
|
210
235
|
}
|
|
211
236
|
// Maybe we should throw instead...
|
|
212
237
|
throw {
|
|
@@ -219,8 +244,11 @@ export const ShexJSchemaTransformerCompact = ShexJTraverser.createTransformer({
|
|
|
219
244
|
ShapeOr: {
|
|
220
245
|
transformer: async (shapeOr, getTransformedChildren) => {
|
|
221
246
|
const { shapeExprs } = await getTransformedChildren();
|
|
222
|
-
//
|
|
223
|
-
|
|
247
|
+
// Each shapeExpr can be a shape IRI (string), a nested Shape, a DataType,
|
|
248
|
+
// or a DataType[] (from NodeConstraint with multiple types).
|
|
249
|
+
// We need to flatten arrays to get a single DataType[].
|
|
250
|
+
const exprs = Array.isArray(shapeExprs) ? shapeExprs : [shapeExprs];
|
|
251
|
+
return exprs.flatMap((expr) => Array.isArray(expr) ? expr : [expr]);
|
|
224
252
|
},
|
|
225
253
|
},
|
|
226
254
|
// Transformer from ShapeAnd
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotateReadablePredicates.d.ts","sourceRoot":"","sources":["../../../src/schema-converter/util/annotateReadablePredicates.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,MAAM,EAA8C,MAAM,OAAO,CAAC;AAUhF;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"annotateReadablePredicates.d.ts","sourceRoot":"","sources":["../../../src/schema-converter/util/annotateReadablePredicates.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,MAAM,EAA8C,MAAM,OAAO,CAAC;AAUhF;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CA0MvE"}
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
// according to those terms.
|
|
9
9
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
10
10
|
// Split IRI by colon, slash and hash; drop empties
|
|
11
|
-
const splitIriTokens = (iri) => iri.split(/[
|
|
11
|
+
const splitIriTokens = (iri) => iri.split(/[:/#.]+/).filter(Boolean);
|
|
12
12
|
// Keep dots and dashes (so 0.1 stays as 0.1) but sanitize everything else
|
|
13
|
-
const sanitize = (s) => s.replace(/[^\w
|
|
13
|
+
const sanitize = (s) => s.replace(/[^\w.\-@]/g, "_");
|
|
14
14
|
/**
|
|
15
15
|
* Annotate EachOf-level TripleConstraints with a collision-free readablePredicate.
|
|
16
16
|
* Rule: for any group that shares the same local token, rename all members using
|
|
@@ -23,73 +23,102 @@ export default function annotateReadablePredicates(schema) {
|
|
|
23
23
|
eachOf.type !== "EachOf" ||
|
|
24
24
|
!Array.isArray(eachOf.expressions))
|
|
25
25
|
return;
|
|
26
|
-
const
|
|
26
|
+
const tripleConstraints = eachOf.expressions.filter((e) => typeof e === "object" &&
|
|
27
27
|
e !== null &&
|
|
28
28
|
e.type === "TripleConstraint");
|
|
29
|
-
if (
|
|
30
|
-
//
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
//
|
|
34
|
-
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
if (tripleConstraints.length > 0) {
|
|
30
|
+
// Add a triple constraint (tc) to parent tree node.
|
|
31
|
+
// The tree branches on name collisions.
|
|
32
|
+
const addToPreds = (depth, parent, iriElements, tc) => {
|
|
33
|
+
// Get the name of the next IRI part (e.g. the foaf from foaf_name).
|
|
34
|
+
// It can be that we are out of bounds. In that case we use "".
|
|
35
|
+
// That way the final name remains the same, unless we still collisions.
|
|
36
|
+
// In that case, we enumerate.
|
|
37
|
+
const key = iriElements[depth] ?? "";
|
|
38
|
+
// Case no collision: Add triple constraint as leaf.
|
|
39
|
+
if (!parent.children[key]) {
|
|
40
|
+
parent.children[key] = {
|
|
41
|
+
leaf: { tc, iriElements },
|
|
42
|
+
children: {},
|
|
43
|
+
};
|
|
39
44
|
}
|
|
40
|
-
else {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
continue;
|
|
56
|
-
const used = new Set();
|
|
57
|
-
const local = splitIriTokens(groupMembers[0].predicate).slice(-1)[0] ??
|
|
58
|
-
"";
|
|
59
|
-
for (const tc of groupMembers) {
|
|
60
|
-
const tokens = splitIriTokens(tc.predicate);
|
|
61
|
-
let localIdx = tokens.lastIndexOf(local);
|
|
62
|
-
if (localIdx === -1)
|
|
63
|
-
localIdx = Math.max(tokens.length - 1, 0);
|
|
64
|
-
let prefixIdx = localIdx - 1;
|
|
65
|
-
let assigned = false;
|
|
66
|
-
while (prefixIdx >= 0) {
|
|
67
|
-
const cand = `${sanitize(tokens[prefixIdx])}_${sanitize(tokens[localIdx])}`;
|
|
68
|
-
if (!used.has(cand)) {
|
|
69
|
-
tc.readablePredicate = cand;
|
|
70
|
-
used.add(cand);
|
|
71
|
-
assigned = true;
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
|
-
prefixIdx -= 1;
|
|
45
|
+
else if (key === "") {
|
|
46
|
+
// Case out of bounds but not the only one
|
|
47
|
+
// Add a counter prefix
|
|
48
|
+
const node = parent.children[key];
|
|
49
|
+
if (node.leaf) {
|
|
50
|
+
// If this child has a leaf, that means it didn't have children before.
|
|
51
|
+
// Add a __counter prefix__ now.
|
|
52
|
+
node.children = {
|
|
53
|
+
["0"]: {
|
|
54
|
+
leaf: node.leaf,
|
|
55
|
+
children: {},
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
// Remove moved leaf from old node.
|
|
59
|
+
node.leaf = false;
|
|
75
60
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
61
|
+
// Add counter to iriElements -> will be picked up by recursion call.
|
|
62
|
+
iriElements[depth + 1] = Object.keys(node.children).length.toString();
|
|
63
|
+
addToPreds(depth + 1, node, iriElements, tc);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
// Case collision: create a new child
|
|
67
|
+
const node = parent.children[key];
|
|
68
|
+
if (node.leaf) {
|
|
69
|
+
// If this child has a leaf, that means it didn't have children before.
|
|
70
|
+
// Move the leaf to the new children.
|
|
71
|
+
const childKey = node.leaf.iriElements[depth + 1] ?? "";
|
|
72
|
+
node.children = {
|
|
73
|
+
[childKey]: {
|
|
74
|
+
leaf: node.leaf,
|
|
75
|
+
children: {},
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
// Remove moved leaf from old node.
|
|
79
|
+
node.leaf = false;
|
|
88
80
|
}
|
|
81
|
+
addToPreds(depth + 1, node, iriElements, tc);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
// Root structure to keep names for triple constraints.
|
|
85
|
+
// Keys are the readable names of the predicates
|
|
86
|
+
const rootPredTree = {
|
|
87
|
+
leaf: false,
|
|
88
|
+
children: {},
|
|
89
|
+
};
|
|
90
|
+
// Add all triple constraints to root tree.
|
|
91
|
+
for (const tripleConstraint of tripleConstraints) {
|
|
92
|
+
const iri = tripleConstraint.predicate;
|
|
93
|
+
if (iri === "http://www.w3.org/1999/02/22-rdf-syntax-ns#type") {
|
|
94
|
+
// Special case: convert type predicate to @type
|
|
95
|
+
addToPreds(0, rootPredTree, ["@type"], tripleConstraint);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
addToPreds(0, rootPredTree,
|
|
99
|
+
// Divide IRI in sanitized parts, start from end (property name)
|
|
100
|
+
splitIriTokens(iri).map(sanitize).reverse(), tripleConstraint);
|
|
89
101
|
}
|
|
90
102
|
}
|
|
103
|
+
// Traverse tree and annotate
|
|
104
|
+
const annotatePreds = (parentTree, accumulatedName) => {
|
|
105
|
+
// If we reached the leaf, annotate with name
|
|
106
|
+
if (parentTree?.leaf) {
|
|
107
|
+
parentTree.leaf.tc.readablePredicate = accumulatedName;
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
// Recurse for all children.
|
|
111
|
+
for (const key of Object.keys(parentTree.children ?? {})) {
|
|
112
|
+
const name = accumulatedName === ""
|
|
113
|
+
? key // Just use name
|
|
114
|
+
: `${key}_${accumulatedName}`; // Make composite.
|
|
115
|
+
// Annotate children
|
|
116
|
+
annotatePreds(parentTree.children[key], name);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
annotatePreds(rootPredTree, "");
|
|
91
120
|
// Recurse into nested valueExpr shapes of each TC
|
|
92
|
-
for (const tc of
|
|
121
|
+
for (const tc of tripleConstraints) {
|
|
93
122
|
const ve = tc.valueExpr;
|
|
94
123
|
if (ve && typeof ve === "object") {
|
|
95
124
|
const t = ve.type;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TODO: Short documentation on schema generation
|
|
3
|
+
*/
|
|
1
4
|
export interface ShapeType<T extends BaseType> {
|
|
2
5
|
schema: Schema;
|
|
3
6
|
shape: string;
|
|
@@ -13,12 +16,12 @@ export interface Shape {
|
|
|
13
16
|
predicates: Predicate[];
|
|
14
17
|
}
|
|
15
18
|
export type DataType = {
|
|
16
|
-
/** The required literal value(s)
|
|
19
|
+
/** The required literal value(s). Additional values are allowed, if `extra` is true. */
|
|
17
20
|
literals?: number[] | string[] | boolean;
|
|
18
21
|
/** If `valType` is `"shape"`, the nested shape or its reference. Use reference for serialization. */
|
|
19
22
|
shape?: string | Shape;
|
|
20
23
|
/** The type of object value for a triple constraint. */
|
|
21
|
-
valType: "number" | "string" | "boolean" | "iri" | "
|
|
24
|
+
valType: "number" | "string" | "boolean" | "iri" | "shape";
|
|
22
25
|
};
|
|
23
26
|
export interface Predicate {
|
|
24
27
|
/** Allowed type of object. If more than one is present, either of them is allowed. */
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,SAAS,CAAC,CAAC,SAAS,QAAQ;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,QAAS,SAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACjD,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,MAAM,GAAG;IACjB,CAAC,EAAE,EAAE,MAAM,GAAG,KAAK,CAAC;CACvB,CAAC;AAEF,MAAM,WAAW,KAAK;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,SAAS,EAAE,CAAC;CAC3B;AAED,MAAM,MAAM,QAAQ,GAAG;IACnB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAUA;;GAEG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC,SAAS,QAAQ;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,QAAS,SAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACjD,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,MAAM,GAAG;IACjB,CAAC,EAAE,EAAE,MAAM,GAAG,KAAK,CAAC;CACvB,CAAC;AAEF,MAAM,WAAW,KAAK;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,SAAS,EAAE,CAAC;CAC3B;AAED,MAAM,MAAM,QAAQ,GAAG;IACnB,wFAAwF;IACxF,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC;IACzC,qGAAqG;IACrG,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACvB,wDAAwD;IACxD,OAAO,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,KAAK,GAAG,OAAO,CAAC;CAC9D,CAAC;AAEF,MAAM,WAAW,SAAS;IACtB,sFAAsF;IACtF,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,6BAA6B;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,wEAAwE;IACxE,iBAAiB,EAAE,MAAM,CAAC;IAC1B,6DAA6D;IAC7D,cAAc,EAAE,MAAM,CAAC;IACvB,wCAAwC;IACxC,cAAc,EAAE,MAAM,CAAC;IACvB,uEAAuE;IACvE,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ng-org/shex-orm",
|
|
3
|
-
"version": "0.1.2-alpha.
|
|
3
|
+
"version": "0.1.2-alpha.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -17,29 +17,21 @@
|
|
|
17
17
|
"@types/ejs": "^3.1.1",
|
|
18
18
|
"@types/fs-extra": "^9.0.13",
|
|
19
19
|
"@types/jsonld": "^1.5.15",
|
|
20
|
-
"@types/prompts": "^2.4.9",
|
|
21
20
|
"@types/shexj": "^2.1.4",
|
|
22
21
|
"typescript": "^5.9.2",
|
|
23
22
|
"vitest": "^3.2.4"
|
|
24
23
|
},
|
|
25
24
|
"dependencies": {
|
|
26
|
-
"@jeswr/shacl2shex": "^1.1.0",
|
|
27
25
|
"@ldo/traverser-shexj": "1.0.0-alpha.28",
|
|
28
26
|
"@ldo/type-traverser": "1.0.0-alpha.28",
|
|
29
27
|
"@shexjs/parser": "^1.0.0-alpha.24",
|
|
30
|
-
"child-process-promise": "^2.2.1",
|
|
31
28
|
"commander": "^14.0.1",
|
|
32
29
|
"dts-dom": "~3.6.0",
|
|
33
30
|
"ejs": "^3.1.8",
|
|
34
31
|
"fs-extra": "^10.1.0",
|
|
35
32
|
"jsonld2graphobject": "^0.0.5",
|
|
36
33
|
"loading-cli": "^1.1.0",
|
|
37
|
-
"prettier": "^3.0.3"
|
|
38
|
-
"prompts": "^2.4.2",
|
|
39
|
-
"rdf-dereference-store": "^1.4.0",
|
|
40
|
-
"rdf-namespaces": "^1.13.1",
|
|
41
|
-
"ts-morph": "^24.0.0",
|
|
42
|
-
"type-fest": "^2.19.0"
|
|
34
|
+
"prettier": "^3.0.3"
|
|
43
35
|
},
|
|
44
36
|
"files": [
|
|
45
37
|
"dist"
|