@shaclmate/compiler 4.0.22 → 4.0.24
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/ShapesGraphToAstTransformer.js +16 -16
- package/dist/_ShapesGraphToAstTransformer/shapeAstTypeName.js +6 -5
- package/dist/_ShapesGraphToAstTransformer/shapeNodeKinds.js +1 -1
- package/dist/_ShapesGraphToAstTransformer/shapeOntology.js +4 -3
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +12 -11
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.js +3 -3
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.js +6 -9
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.js +11 -12
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.js +1 -1
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.js +3 -3
- package/dist/ast/AbstractLazyObjectType.d.ts +0 -2
- package/dist/ast/ListType.d.ts +1 -8
- package/dist/ast/ListType.js +1 -6
- package/dist/ast/ObjectType.d.ts +7 -9
- package/dist/ast/ObjectType.js +7 -8
- package/dist/generators/ts/AbstractLazyObjectType.d.ts +1 -0
- package/dist/generators/ts/AbstractLazyObjectType.js +7 -0
- package/dist/generators/ts/AbstractNamedUnionType.d.ts +3 -2
- package/dist/generators/ts/AbstractNamedUnionType.js +23 -9
- package/dist/generators/ts/AbstractTermType.d.ts +1 -0
- package/dist/generators/ts/AbstractTermType.js +3 -0
- package/dist/generators/ts/AbstractType.d.ts +12 -4
- package/dist/generators/ts/AbstractUnionType.d.ts +1 -0
- package/dist/generators/ts/AbstractUnionType.js +11 -1
- package/dist/generators/ts/AnonymousUnionType.d.ts +2 -1
- package/dist/generators/ts/AnonymousUnionType.js +6 -3
- package/dist/generators/ts/DefaultValueType.d.ts +2 -1
- package/dist/generators/ts/DefaultValueType.js +6 -3
- package/dist/generators/ts/ListType.d.ts +2 -5
- package/dist/generators/ts/ListType.js +11 -27
- package/dist/generators/ts/NamedObjectType.d.ts +2 -9
- package/dist/generators/ts/NamedObjectType.js +12 -29
- package/dist/generators/ts/NamedObjectUnionType.js +1 -1
- package/dist/generators/ts/OptionType.d.ts +1 -0
- package/dist/generators/ts/OptionType.js +3 -0
- package/dist/generators/ts/SetType.d.ts +1 -0
- package/dist/generators/ts/SetType.js +3 -0
- package/dist/generators/ts/TypeFactory.js +9 -46
- package/dist/generators/ts/_NamedObjectType/AbstractProperty.d.ts +23 -15
- package/dist/generators/ts/_NamedObjectType/AbstractProperty.js +6 -0
- package/dist/generators/ts/_NamedObjectType/DiscriminantProperty.d.ts +3 -4
- package/dist/generators/ts/_NamedObjectType/DiscriminantProperty.js +26 -11
- package/dist/generators/ts/_NamedObjectType/IdentifierProperty.d.ts +5 -14
- package/dist/generators/ts/_NamedObjectType/IdentifierProperty.js +34 -201
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_classDeclaration.js +3 -11
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionOrMethodDeclaration.js +10 -9
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterFunctionDeclaration.js +4 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js +1 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js +5 -10
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionOrMethodDeclarations.js +13 -9
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_interfaceDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.js +11 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.js +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionOrMethodDeclaration.js +8 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionOrMethodDeclaration.js +4 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionOrMethodDeclaration.d.ts +4 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionOrMethodDeclaration.js +66 -0
- package/dist/generators/ts/_NamedObjectType/Property.d.ts +1 -2
- package/dist/generators/ts/_NamedObjectType/ShaclProperty.d.ts +6 -5
- package/dist/generators/ts/_NamedObjectType/ShaclProperty.js +26 -20
- package/dist/generators/ts/_snippets/snippets_LazyObject.js +2 -2
- package/dist/generators/ts/_snippets/snippets_LazyObjectOption.js +2 -2
- package/dist/generators/ts/_snippets/snippets_LazyObjectSet.js +2 -2
- package/dist/generators/ts/_snippets/snippets_PropertyPath.js +5 -3
- package/dist/generators/ts/_snippets/snippets_compactRecord.d.ts +2 -0
- package/dist/generators/ts/_snippets/snippets_compactRecord.js +16 -0
- package/dist/generators/ts/_snippets/{parseIri.d.ts → snippets_parseIri.d.ts} +1 -1
- package/dist/generators/ts/_snippets/{parseIri.js → snippets_parseIri.js} +1 -1
- package/dist/generators/ts/imports.d.ts +1 -3
- package/dist/generators/ts/imports.js +1 -3
- package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.js +2 -2
- package/dist/generators/ts/snippets.d.ts +1 -0
- package/dist/generators/ts/snippets.js +3 -1
- package/dist/generators/ts/sparqlObjectSetClassDeclaration.js +1 -1
- package/dist/input/generated.d.ts +104 -50
- package/dist/input/generated.js +284 -171
- package/package.json +2 -2
- package/dist/_ShapesGraphToAstTransformer/nodeShapeIdentifierMintingStrategy.d.ts +0 -6
- package/dist/_ShapesGraphToAstTransformer/nodeShapeIdentifierMintingStrategy.js +0 -32
- package/dist/enums/IdentifierMintingStrategy.d.ts +0 -9
- package/dist/enums/IdentifierMintingStrategy.js +0 -18
- package/dist/generators/ts/_NamedObjectType/IdentifierPrefixProperty.d.ts +0 -32
- package/dist/generators/ts/_NamedObjectType/IdentifierPrefixProperty.js +0 -89
|
@@ -7,13 +7,13 @@ import { transformShapeToAstType } from "./_ShapesGraphToAstTransformer/transfor
|
|
|
7
7
|
function relatedNodeShapes({ logger, shapesGraph, }) {
|
|
8
8
|
const immediateRelatedNodeShapes = new TermMap();
|
|
9
9
|
for (const childNodeShape of shapesGraph.nodeShapes) {
|
|
10
|
-
let childRelatedNodeShapes = immediateRelatedNodeShapes.get(childNodeShape.$identifier);
|
|
10
|
+
let childRelatedNodeShapes = immediateRelatedNodeShapes.get(childNodeShape.$identifier());
|
|
11
11
|
if (!childRelatedNodeShapes) {
|
|
12
12
|
childRelatedNodeShapes = {
|
|
13
13
|
children: new TermMap(),
|
|
14
14
|
parents: new TermMap(),
|
|
15
15
|
};
|
|
16
|
-
immediateRelatedNodeShapes.set(childNodeShape.$identifier, childRelatedNodeShapes);
|
|
16
|
+
immediateRelatedNodeShapes.set(childNodeShape.$identifier(), childRelatedNodeShapes);
|
|
17
17
|
}
|
|
18
18
|
for (const parentClassIdentifier of childNodeShape.subClassOf) {
|
|
19
19
|
shapesGraph
|
|
@@ -22,29 +22,29 @@ function relatedNodeShapes({ logger, shapesGraph, }) {
|
|
|
22
22
|
logger.error("%s is rdfs:subClassOf %s which is either missing or not a node shape: %s", childNodeShape, parentClassIdentifier, error.message);
|
|
23
23
|
})
|
|
24
24
|
.ifRight((parentNodeShape) => {
|
|
25
|
-
childRelatedNodeShapes.parents.set(parentNodeShape.$identifier, parentNodeShape);
|
|
26
|
-
let parentRelatedNodeShapes = immediateRelatedNodeShapes.get(parentNodeShape.$identifier);
|
|
25
|
+
childRelatedNodeShapes.parents.set(parentNodeShape.$identifier(), parentNodeShape);
|
|
26
|
+
let parentRelatedNodeShapes = immediateRelatedNodeShapes.get(parentNodeShape.$identifier());
|
|
27
27
|
if (!parentRelatedNodeShapes) {
|
|
28
28
|
parentRelatedNodeShapes = {
|
|
29
29
|
children: new TermMap(),
|
|
30
30
|
parents: new TermMap(),
|
|
31
31
|
};
|
|
32
|
-
immediateRelatedNodeShapes.set(parentNodeShape.$identifier, parentRelatedNodeShapes);
|
|
32
|
+
immediateRelatedNodeShapes.set(parentNodeShape.$identifier(), parentRelatedNodeShapes);
|
|
33
33
|
}
|
|
34
|
-
parentRelatedNodeShapes.children.set(childNodeShape.$identifier, childNodeShape);
|
|
34
|
+
parentRelatedNodeShapes.children.set(childNodeShape.$identifier(), childNodeShape);
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
const result = new TermMap();
|
|
39
39
|
for (const nodeShape of shapesGraph.nodeShapes) {
|
|
40
|
-
const { children: childNodeShapes, parents: parentNodeShapes } = immediateRelatedNodeShapes.get(nodeShape.$identifier);
|
|
40
|
+
const { children: childNodeShapes, parents: parentNodeShapes } = immediateRelatedNodeShapes.get(nodeShape.$identifier());
|
|
41
41
|
const ancestorNodeShapes = new TermMap();
|
|
42
42
|
function recurseAncestorNodeShapes(nodeShape) {
|
|
43
43
|
for (const parentNodeShape of immediateRelatedNodeShapes
|
|
44
|
-
.get(nodeShape.$identifier)
|
|
44
|
+
.get(nodeShape.$identifier())
|
|
45
45
|
.parents.values()) {
|
|
46
|
-
if (!ancestorNodeShapes.has(parentNodeShape.$identifier)) {
|
|
47
|
-
ancestorNodeShapes.set(parentNodeShape.$identifier, parentNodeShape);
|
|
46
|
+
if (!ancestorNodeShapes.has(parentNodeShape.$identifier())) {
|
|
47
|
+
ancestorNodeShapes.set(parentNodeShape.$identifier(), parentNodeShape);
|
|
48
48
|
recurseAncestorNodeShapes(parentNodeShape);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -53,16 +53,16 @@ function relatedNodeShapes({ logger, shapesGraph, }) {
|
|
|
53
53
|
const descendantNodeShapes = new TermMap();
|
|
54
54
|
function recurseDescendantNodeShapes(nodeShape) {
|
|
55
55
|
for (const childNodeShape of immediateRelatedNodeShapes
|
|
56
|
-
.get(nodeShape.$identifier)
|
|
56
|
+
.get(nodeShape.$identifier())
|
|
57
57
|
.children.values()) {
|
|
58
|
-
if (!descendantNodeShapes.has(childNodeShape.$identifier)) {
|
|
59
|
-
descendantNodeShapes.set(childNodeShape.$identifier, childNodeShape);
|
|
58
|
+
if (!descendantNodeShapes.has(childNodeShape.$identifier())) {
|
|
59
|
+
descendantNodeShapes.set(childNodeShape.$identifier(), childNodeShape);
|
|
60
60
|
recurseDescendantNodeShapes(childNodeShape);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
recurseDescendantNodeShapes(nodeShape);
|
|
65
|
-
result.set(nodeShape.$identifier, {
|
|
65
|
+
result.set(nodeShape.$identifier(), {
|
|
66
66
|
ancestors: [...ancestorNodeShapes.values()],
|
|
67
67
|
children: [...childNodeShapes.values()],
|
|
68
68
|
descendants: [...descendantNodeShapes.values()],
|
|
@@ -95,10 +95,10 @@ export class ShapesGraphToAstTransformer {
|
|
|
95
95
|
const syntheticAstObjectTypesByName = {};
|
|
96
96
|
const astNamedUnionTypes = [];
|
|
97
97
|
for (const nodeShape of this.shapesGraph.nodeShapes) {
|
|
98
|
-
if (nodeShape.$identifier.termType !== "NamedNode") {
|
|
98
|
+
if (nodeShape.$identifier().termType !== "NamedNode") {
|
|
99
99
|
continue;
|
|
100
100
|
}
|
|
101
|
-
if (nodeShape.$identifier.value.startsWith(dash[""].value)) {
|
|
101
|
+
if (nodeShape.$identifier().value.startsWith(dash[""].value)) {
|
|
102
102
|
continue;
|
|
103
103
|
}
|
|
104
104
|
const nodeShapeAstTypeEither = transformShapeToAstType.call(this, nodeShape, new ShapeStack());
|
|
@@ -4,7 +4,8 @@ export function shapeAstTypeName(shape) {
|
|
|
4
4
|
if (shape.$type !== "NodeShape") {
|
|
5
5
|
return Maybe.empty();
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
const shapeIdentifier = shape.$identifier();
|
|
8
|
+
if (shapeIdentifier.termType !== "NamedNode") {
|
|
8
9
|
return Maybe.empty();
|
|
9
10
|
}
|
|
10
11
|
// Explicit shaclmate:name
|
|
@@ -16,11 +17,11 @@ export function shapeAstTypeName(shape) {
|
|
|
16
17
|
return shape.label;
|
|
17
18
|
}
|
|
18
19
|
// CURIE shape identifier
|
|
19
|
-
if (
|
|
20
|
-
if (
|
|
21
|
-
return Maybe.of(
|
|
20
|
+
if (shapeIdentifier instanceof Curie) {
|
|
21
|
+
if (shapeIdentifier.hasUniqueReference) {
|
|
22
|
+
return Maybe.of(shapeIdentifier.reference);
|
|
22
23
|
}
|
|
23
|
-
return Maybe.of(`${
|
|
24
|
+
return Maybe.of(`${shapeIdentifier.prefix}_${shapeIdentifier.reference}`);
|
|
24
25
|
}
|
|
25
26
|
return Maybe.empty();
|
|
26
27
|
}
|
|
@@ -12,7 +12,7 @@ function nodeShapeNodeKinds(nodeShape) {
|
|
|
12
12
|
.orDefault(new Set());
|
|
13
13
|
// Recurse into parents
|
|
14
14
|
const parentNodeKinds = new Set();
|
|
15
|
-
for (const parentNodeShape of this.relatedNodeShapesByIdentifier.get(nodeShape.$identifier).parents) {
|
|
15
|
+
for (const parentNodeShape of this.relatedNodeShapesByIdentifier.get(nodeShape.$identifier()).parents) {
|
|
16
16
|
nodeShapeNodeKinds
|
|
17
17
|
.call(this, parentNodeShape)
|
|
18
18
|
.ifRight((parentNodeKinds_) => {
|
|
@@ -12,9 +12,10 @@ export function shapeOntology(shape) {
|
|
|
12
12
|
// If there's a single ontology in the shapes graph, consider the shape a part of the ontology
|
|
13
13
|
return Either.of(Maybe.of(ontologies[0]));
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const shapeIdentifier = shape.$identifier();
|
|
16
|
+
if (shapeIdentifier.termType === "NamedNode") {
|
|
17
|
+
const prefixOntologies = ontologies.filter((ontology) => ontology.$identifier().termType === "NamedNode" &&
|
|
18
|
+
shapeIdentifier.value.startsWith(ontology.$identifier().value));
|
|
18
19
|
if (prefixOntologies.length === 1) {
|
|
19
20
|
// If there's a single ontology whose IRI is a prefix of this shape's IRI, consider the shape a part of the ontology
|
|
20
21
|
return Either.of(Maybe.of(prefixOntologies[0]));
|
|
@@ -25,7 +25,6 @@ function synthesizePartialAstObjectType({ identifierType, tsFeatures, }) {
|
|
|
25
25
|
extern: false,
|
|
26
26
|
fromRdfType: Maybe.empty(),
|
|
27
27
|
identifierType,
|
|
28
|
-
identifierMintingStrategy: Maybe.empty(),
|
|
29
28
|
label: Maybe.empty(),
|
|
30
29
|
name: Maybe.of(syntheticName),
|
|
31
30
|
shapeIdentifier: dataFactory.namedNode(`urn:shaclmate:synthetic:${syntheticName}`),
|
|
@@ -49,13 +48,14 @@ function propertyName(objectType, propertyShape) {
|
|
|
49
48
|
}
|
|
50
49
|
// Pick up the common pattern of a property shape identifier being the node shape's identifier -localName,
|
|
51
50
|
// like ex:NodeShape-property
|
|
52
|
-
|
|
51
|
+
const propertyShapeIdentifier = propertyShape.$identifier();
|
|
52
|
+
if (propertyShapeIdentifier.termType === "NamedNode" &&
|
|
53
53
|
objectType.shapeIdentifier.termType === "NamedNode") {
|
|
54
54
|
const propertyShapeIdentifierPrefix = `${objectType.shapeIdentifier.value}-`;
|
|
55
|
-
if (
|
|
56
|
-
|
|
55
|
+
if (propertyShapeIdentifier.value.startsWith(propertyShapeIdentifierPrefix) &&
|
|
56
|
+
propertyShapeIdentifier.value.length >
|
|
57
57
|
propertyShapeIdentifierPrefix.length) {
|
|
58
|
-
return
|
|
58
|
+
return propertyShapeIdentifier.value.substring(propertyShapeIdentifierPrefix.length);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
// sh:path CURIE reference
|
|
@@ -63,12 +63,12 @@ function propertyName(objectType, propertyShape) {
|
|
|
63
63
|
return propertyShape.path.reference;
|
|
64
64
|
}
|
|
65
65
|
// Shape identifier CURIE reference
|
|
66
|
-
if (
|
|
67
|
-
return
|
|
66
|
+
if (propertyShapeIdentifier instanceof Curie) {
|
|
67
|
+
return propertyShapeIdentifier.reference;
|
|
68
68
|
}
|
|
69
69
|
// Shape identifier IRI
|
|
70
|
-
if (
|
|
71
|
-
return
|
|
70
|
+
if (propertyShapeIdentifier.termType === "NamedNode") {
|
|
71
|
+
return propertyShapeIdentifier.value;
|
|
72
72
|
}
|
|
73
73
|
// sh:path IRI
|
|
74
74
|
if (propertyShape.path.termType === "NamedNode") {
|
|
@@ -201,7 +201,7 @@ export function transformPropertyShapeToAstObjectTypeProperty({ objectType, prop
|
|
|
201
201
|
comment: Maybe.empty(),
|
|
202
202
|
label: Maybe.empty(),
|
|
203
203
|
name: Maybe.empty(),
|
|
204
|
-
shapeIdentifier: propertyShape.$identifier,
|
|
204
|
+
shapeIdentifier: propertyShape.$identifier(),
|
|
205
205
|
};
|
|
206
206
|
switch (astType.kind) {
|
|
207
207
|
case "BlankNodeType":
|
|
@@ -252,13 +252,14 @@ export function transformPropertyShapeToAstObjectTypeProperty({ objectType, prop
|
|
|
252
252
|
return Either.of(new ast.ObjectType.Property({
|
|
253
253
|
comment: propertyShape.comment,
|
|
254
254
|
description: propertyShape.description,
|
|
255
|
+
display: propertyShape.display,
|
|
255
256
|
label: propertyShape.label,
|
|
256
257
|
mutable: propertyShape.mutable.orDefault(false),
|
|
257
258
|
name: propertyName.call(this, objectType, propertyShape),
|
|
258
259
|
objectType,
|
|
259
260
|
order: propertyShape.order.orDefault(0),
|
|
260
261
|
path: propertyShape.path,
|
|
261
|
-
shapeIdentifier: propertyShape.$identifier,
|
|
262
|
+
shapeIdentifier: propertyShape.$identifier(),
|
|
262
263
|
type: astType,
|
|
263
264
|
visibility: propertyShape.visibility
|
|
264
265
|
.map(Visibility.fromIri)
|
|
@@ -45,7 +45,7 @@ export function transformShapeToAstCompoundType(shape, shapeStack) {
|
|
|
45
45
|
comment: shape.comment,
|
|
46
46
|
label: shape.label,
|
|
47
47
|
name: shapeAstTypeName(shape),
|
|
48
|
-
shapeIdentifier: shape.$identifier,
|
|
48
|
+
shapeIdentifier: shape.$identifier(),
|
|
49
49
|
tsFeatures,
|
|
50
50
|
});
|
|
51
51
|
if (memberShapes.length === 1) {
|
|
@@ -54,7 +54,7 @@ export function transformShapeToAstCompoundType(shape, shapeStack) {
|
|
|
54
54
|
.map(Maybe.of);
|
|
55
55
|
}
|
|
56
56
|
// Put a placeholder in the cache to deal with cyclic references
|
|
57
|
-
this.cachedAstTypesByShapeIdentifier.set(shape.$identifier, compoundType);
|
|
57
|
+
this.cachedAstTypesByShapeIdentifier.set(shape.$identifier(), compoundType);
|
|
58
58
|
return Either.sequence(memberShapes.map((memberShape) => transformShapeToAstType.call(this, memberShape, shapeStack)))
|
|
59
59
|
.chain((memberShapeTypes) => {
|
|
60
60
|
for (let memberI = 0; memberI < memberShapes.length; memberI++) {
|
|
@@ -88,7 +88,7 @@ export function transformShapeToAstCompoundType(shape, shapeStack) {
|
|
|
88
88
|
return Either.of(Maybe.of(compoundType));
|
|
89
89
|
})
|
|
90
90
|
.ifLeft(() => {
|
|
91
|
-
this.cachedAstTypesByShapeIdentifier.delete(shape.$identifier);
|
|
91
|
+
this.cachedAstTypesByShapeIdentifier.delete(shape.$identifier());
|
|
92
92
|
});
|
|
93
93
|
});
|
|
94
94
|
}
|
|
@@ -4,7 +4,6 @@ import { Either, Left, Maybe } from "purify-ts";
|
|
|
4
4
|
import * as ast from "../ast/index.js";
|
|
5
5
|
import { Eithers } from "../Eithers.js";
|
|
6
6
|
import { defaultNodeShapeNodeKinds } from "./defaultNodeShapeNodeKinds.js";
|
|
7
|
-
import { nodeShapeIdentifierMintingStrategy } from "./nodeShapeIdentifierMintingStrategy.js";
|
|
8
7
|
import { shapeAstTypeName } from "./shapeAstTypeName.js";
|
|
9
8
|
import { shapeNodeKinds } from "./shapeNodeKinds.js";
|
|
10
9
|
import { transformPropertyShapeToAstObjectTypeProperty } from "./transformPropertyShapeToAstObjectTypeProperty.js";
|
|
@@ -13,7 +12,6 @@ const listPropertiesObjectType = new ast.ObjectType({
|
|
|
13
12
|
extern: false,
|
|
14
13
|
comment: Maybe.empty(),
|
|
15
14
|
label: Maybe.empty(),
|
|
16
|
-
identifierMintingStrategy: Maybe.empty(),
|
|
17
15
|
identifierType: new ast.IdentifierType({
|
|
18
16
|
comment: Maybe.empty(),
|
|
19
17
|
label: Maybe.empty(),
|
|
@@ -47,9 +45,9 @@ export function transformShapeToAstListType(shape, shapeStack) {
|
|
|
47
45
|
return empty;
|
|
48
46
|
}
|
|
49
47
|
const nodeShape = shape;
|
|
50
|
-
return Eithers.
|
|
48
|
+
return Eithers.chain2(shapeNodeKinds.call(this, nodeShape, { defaultNodeShapeNodeKinds }), Either.sequence(nodeShape.xone
|
|
51
49
|
.orDefault([])
|
|
52
|
-
.map((shapeIdentifier) => this.shapesGraph.shape(shapeIdentifier)))).chain(([
|
|
50
|
+
.map((shapeIdentifier) => this.shapesGraph.shape(shapeIdentifier)))).chain(([nodeKinds, xone]) => {
|
|
53
51
|
// Put a placeholder in the cache to deal with cyclic references
|
|
54
52
|
// Remove the placeholder if the transformation fails.
|
|
55
53
|
const listType = new ast.ListType({
|
|
@@ -59,11 +57,10 @@ export function transformShapeToAstListType(shape, shapeStack) {
|
|
|
59
57
|
label: nodeShape.label,
|
|
60
58
|
mutable: nodeShape.mutable.orDefault(false),
|
|
61
59
|
name: shapeAstTypeName(nodeShape),
|
|
62
|
-
|
|
63
|
-
shapeIdentifier: nodeShape.$identifier,
|
|
60
|
+
shapeIdentifier: nodeShape.$identifier(),
|
|
64
61
|
toRdfTypes: nodeShape.toRdfTypes,
|
|
65
62
|
});
|
|
66
|
-
this.cachedAstTypesByShapeIdentifier.set(nodeShape.$identifier, listType);
|
|
63
|
+
this.cachedAstTypesByShapeIdentifier.set(nodeShape.$identifier(), listType);
|
|
67
64
|
return (() => {
|
|
68
65
|
let emptyListShape;
|
|
69
66
|
let nonEmptyListShape;
|
|
@@ -127,7 +124,7 @@ export function transformShapeToAstListType(shape, shapeStack) {
|
|
|
127
124
|
})
|
|
128
125
|
.chain((restProperty) => {
|
|
129
126
|
if (restProperty.type.kind !== "ListType" ||
|
|
130
|
-
!restProperty.type.shapeIdentifier.equals(nodeShape.$identifier)) {
|
|
127
|
+
!restProperty.type.shapeIdentifier.equals(nodeShape.$identifier())) {
|
|
131
128
|
return Left(new Error(`${nodeShape} rdf:rest property is not recursive into the node shape`));
|
|
132
129
|
}
|
|
133
130
|
return Either.of(Maybe.of(listType));
|
|
@@ -135,7 +132,7 @@ export function transformShapeToAstListType(shape, shapeStack) {
|
|
|
135
132
|
});
|
|
136
133
|
});
|
|
137
134
|
})().ifLeft(() => {
|
|
138
|
-
this.cachedAstTypesByShapeIdentifier.delete(nodeShape.$identifier);
|
|
135
|
+
this.cachedAstTypesByShapeIdentifier.delete(nodeShape.$identifier());
|
|
139
136
|
});
|
|
140
137
|
});
|
|
141
138
|
}
|
|
@@ -5,7 +5,6 @@ import * as ast from "../ast/index.js";
|
|
|
5
5
|
import { Eithers } from "../Eithers.js";
|
|
6
6
|
import { TsObjectDeclarationType } from "../enums/TsObjectDeclarationType.js";
|
|
7
7
|
import { defaultNodeShapeNodeKinds } from "./defaultNodeShapeNodeKinds.js";
|
|
8
|
-
import { nodeShapeIdentifierMintingStrategy } from "./nodeShapeIdentifierMintingStrategy.js";
|
|
9
8
|
import { nodeShapeTsFeatures } from "./nodeShapeTsFeatures.js";
|
|
10
9
|
import { ShapeStack } from "./ShapeStack.js";
|
|
11
10
|
import { shapeAstTypeName } from "./shapeAstTypeName.js";
|
|
@@ -54,16 +53,17 @@ export function transformShapeToAstObjectType(shape, shapeStack) {
|
|
|
54
53
|
nodeShape.xone.orDefault([]).length > 0) {
|
|
55
54
|
return Either.of(Maybe.empty());
|
|
56
55
|
}
|
|
57
|
-
if (nodeShape.$identifier.termType !== "NamedNode") {
|
|
56
|
+
if (nodeShape.$identifier().termType !== "NamedNode") {
|
|
58
57
|
return Either.of(Maybe.empty());
|
|
59
58
|
}
|
|
60
|
-
return Eithers.
|
|
59
|
+
return Eithers.chain4(shapeNodeKinds.call(this, nodeShape, { defaultNodeShapeNodeKinds }), Either.sequence(nodeShape.properties.map((propertyShapeIdentifier) => this.shapesGraph.propertyShape(propertyShapeIdentifier))), nodeShapeTsFeatures.call(this, nodeShape), nodeShape.tsObjectDeclarationType.isJust()
|
|
61
60
|
? Either.of(nodeShape.tsObjectDeclarationType.map(TsObjectDeclarationType.fromIri))
|
|
62
61
|
: shapeOntology
|
|
63
62
|
.call(this, nodeShape)
|
|
64
|
-
.map((ontology) => ontology.chain((ontology) => ontology.tsObjectDeclarationType.map(TsObjectDeclarationType.fromIri)))).chain(([
|
|
63
|
+
.map((ontology) => ontology.chain((ontology) => ontology.tsObjectDeclarationType.map(TsObjectDeclarationType.fromIri)))).chain(([nodeKinds, propertyShapes, tsFeatures, tsObjectDeclarationType]) => {
|
|
65
64
|
const abstract = nodeShape.abstract.orDefault(false);
|
|
66
|
-
const
|
|
65
|
+
const nodeShapeIdentifier = nodeShape.$identifier();
|
|
66
|
+
const { ancestors: ancestorNodeShapes, descendants: descendantNodeShapes, children: childNodeShapes, parents: parentNodeShapes, } = this.relatedNodeShapesByIdentifier.get(nodeShapeIdentifier);
|
|
67
67
|
const isClass = nodeShape.subClassOf.length > 0 ||
|
|
68
68
|
descendantNodeShapes.length > 0 || // A node shape that is the object of an rdfs:subClassOf is itself an rdfs:Class
|
|
69
69
|
nodeShape.types.some((type) => type.equals(owl.Class) || type.equals(rdfs.Class));
|
|
@@ -71,8 +71,8 @@ export function transformShapeToAstObjectType(shape, shapeStack) {
|
|
|
71
71
|
let toRdfTypes;
|
|
72
72
|
if (!abstract) {
|
|
73
73
|
fromRdfType = nodeShape.fromRdfType.alt(nodeShape.rdfType);
|
|
74
|
-
if (isClass &&
|
|
75
|
-
fromRdfType = fromRdfType.alt(Maybe.of(
|
|
74
|
+
if (isClass && nodeShapeIdentifier.termType === "NamedNode") {
|
|
75
|
+
fromRdfType = fromRdfType.alt(Maybe.of(nodeShapeIdentifier));
|
|
76
76
|
}
|
|
77
77
|
toRdfTypes = nodeShape.toRdfTypes.concat();
|
|
78
78
|
if (toRdfTypes.length === 0) {
|
|
@@ -97,7 +97,7 @@ export function transformShapeToAstObjectType(shape, shapeStack) {
|
|
|
97
97
|
comment: Maybe.empty(),
|
|
98
98
|
label: Maybe.empty(),
|
|
99
99
|
name: Maybe.empty(),
|
|
100
|
-
shapeIdentifier: nodeShape.$identifier,
|
|
100
|
+
shapeIdentifier: nodeShape.$identifier(),
|
|
101
101
|
};
|
|
102
102
|
if (nodeKinds.size === 2) {
|
|
103
103
|
invariant(nodeShape.in_.isNothing());
|
|
@@ -134,16 +134,15 @@ export function transformShapeToAstObjectType(shape, shapeStack) {
|
|
|
134
134
|
fromRdfType,
|
|
135
135
|
label: nodeShape.label,
|
|
136
136
|
identifierType,
|
|
137
|
-
identifierMintingStrategy,
|
|
138
137
|
name: shapeAstTypeName(nodeShape),
|
|
139
|
-
shapeIdentifier: nodeShape.$identifier,
|
|
138
|
+
shapeIdentifier: nodeShape.$identifier(),
|
|
140
139
|
synthetic: false,
|
|
141
140
|
toRdfTypes,
|
|
142
141
|
tsFeatures,
|
|
143
142
|
tsImports: nodeShape.tsImports,
|
|
144
143
|
tsObjectDeclarationType: tsObjectDeclarationType.orDefault("class"),
|
|
145
144
|
});
|
|
146
|
-
this.cachedAstTypesByShapeIdentifier.set(nodeShape.$identifier, objectType);
|
|
145
|
+
this.cachedAstTypesByShapeIdentifier.set(nodeShape.$identifier(), objectType);
|
|
147
146
|
return (() => {
|
|
148
147
|
// Populate ancestor and descendant object types
|
|
149
148
|
const relatedObjectTypes = (relatedNodeShapes) => {
|
|
@@ -180,7 +179,7 @@ export function transformShapeToAstObjectType(shape, shapeStack) {
|
|
|
180
179
|
objectType.sortProperties();
|
|
181
180
|
return Either.of(Maybe.of(objectType));
|
|
182
181
|
})().ifLeft(() => {
|
|
183
|
-
this.cachedAstTypesByShapeIdentifier.delete(nodeShape.$identifier);
|
|
182
|
+
this.cachedAstTypesByShapeIdentifier.delete(nodeShape.$identifier());
|
|
184
183
|
});
|
|
185
184
|
});
|
|
186
185
|
}
|
|
@@ -15,7 +15,7 @@ export function transformShapeToAstTermType(shape, shapeStack) {
|
|
|
15
15
|
comment: Maybe.empty(),
|
|
16
16
|
name: Maybe.empty(),
|
|
17
17
|
label: Maybe.empty(),
|
|
18
|
-
shapeIdentifier: shape.$identifier,
|
|
18
|
+
shapeIdentifier: shape.$identifier(),
|
|
19
19
|
};
|
|
20
20
|
let termType;
|
|
21
21
|
if (nodeKinds.size === 1) {
|
|
@@ -13,7 +13,7 @@ const tryTransformShapeToAstTypeMethods = [
|
|
|
13
13
|
* not the other transformShapeToAst*Type functions directly.
|
|
14
14
|
*/
|
|
15
15
|
export function transformShapeToAstType(shape, shapeStack) {
|
|
16
|
-
const astType = this.cachedAstTypesByShapeIdentifier.get(shape.$identifier);
|
|
16
|
+
const astType = this.cachedAstTypesByShapeIdentifier.get(shape.$identifier());
|
|
17
17
|
if (astType) {
|
|
18
18
|
return Either.of(astType);
|
|
19
19
|
}
|
|
@@ -28,14 +28,14 @@ export function transformShapeToAstType(shape, shapeStack) {
|
|
|
28
28
|
}
|
|
29
29
|
const astType = either.unsafeCoerce().extract();
|
|
30
30
|
if (astType) {
|
|
31
|
-
this.cachedAstTypesByShapeIdentifier.set(shape.$identifier, astType);
|
|
31
|
+
this.cachedAstTypesByShapeIdentifier.set(shape.$identifier(), astType);
|
|
32
32
|
return Either.of(astType);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
return transformShapeToAstTermType
|
|
36
36
|
.call(this, shape, shapeStack)
|
|
37
37
|
.ifRight((astType) => {
|
|
38
|
-
this.cachedAstTypesByShapeIdentifier.set(shape.$identifier, astType);
|
|
38
|
+
this.cachedAstTypesByShapeIdentifier.set(shape.$identifier(), astType);
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
//# sourceMappingURL=transformShapeToAstType.js.map
|
|
@@ -21,7 +21,6 @@ export declare abstract class AbstractLazyObjectType<PartialTypeT extends Abstra
|
|
|
21
21
|
toJSON(): {
|
|
22
22
|
partialType: {
|
|
23
23
|
fromRdfType: import("@rdfjs/types").NamedNode<string> | undefined;
|
|
24
|
-
identifierMintingStrategy: "blankNode" | "sha256" | "uuidv4" | undefined;
|
|
25
24
|
identifierType: {
|
|
26
25
|
hasValues: readonly import("@rdfjs/types").NamedNode<string>[] | undefined;
|
|
27
26
|
in: readonly import("@rdfjs/types").NamedNode<string>[] | undefined;
|
|
@@ -64,7 +63,6 @@ export declare abstract class AbstractLazyObjectType<PartialTypeT extends Abstra
|
|
|
64
63
|
};
|
|
65
64
|
resolveType: {
|
|
66
65
|
fromRdfType: import("@rdfjs/types").NamedNode<string> | undefined;
|
|
67
|
-
identifierMintingStrategy: "blankNode" | "sha256" | "uuidv4" | undefined;
|
|
68
66
|
identifierType: {
|
|
69
67
|
hasValues: readonly import("@rdfjs/types").NamedNode<string>[] | undefined;
|
|
70
68
|
in: readonly import("@rdfjs/types").NamedNode<string>[] | undefined;
|
package/dist/ast/ListType.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { BlankNode, NamedNode } from "@rdfjs/types";
|
|
2
2
|
import type { IdentifierNodeKind } from "@shaclmate/shacl-ast";
|
|
3
|
-
import type { Maybe } from "purify-ts";
|
|
4
|
-
import type { IdentifierMintingStrategy } from "../enums/IdentifierMintingStrategy.js";
|
|
5
3
|
import { AbstractCollectionType } from "./AbstractCollectionType.js";
|
|
6
4
|
import type { BlankNodeType } from "./BlankNodeType.js";
|
|
7
5
|
import type { IdentifierType } from "./IdentifierType.js";
|
|
@@ -25,10 +23,6 @@ export declare class ListType<ItemTypeT extends ListType.ItemType = ListType.Ite
|
|
|
25
23
|
*/
|
|
26
24
|
readonly identifierNodeKind: IdentifierNodeKind;
|
|
27
25
|
readonly kind = "ListType";
|
|
28
|
-
/**
|
|
29
|
-
* Strategy for minting new list and sub-list identifiers.
|
|
30
|
-
*/
|
|
31
|
-
readonly identifierMintingStrategy: Maybe<IdentifierMintingStrategy>;
|
|
32
26
|
/**
|
|
33
27
|
* rdf:type's that will be added to this object when it's serialized toRdf.
|
|
34
28
|
*
|
|
@@ -36,8 +30,7 @@ export declare class ListType<ItemTypeT extends ListType.ItemType = ListType.Ite
|
|
|
36
30
|
* class targets).
|
|
37
31
|
*/
|
|
38
32
|
readonly toRdfTypes: readonly NamedNode[];
|
|
39
|
-
constructor({
|
|
40
|
-
identifierMintingStrategy: Maybe<IdentifierMintingStrategy>;
|
|
33
|
+
constructor({ identifierNodeKind, toRdfTypes, ...superParameters }: {
|
|
41
34
|
identifierNodeKind: IdentifierNodeKind;
|
|
42
35
|
shapeIdentifier: BlankNode | NamedNode;
|
|
43
36
|
toRdfTypes: readonly NamedNode[];
|
package/dist/ast/ListType.js
CHANGED
|
@@ -12,10 +12,6 @@ export class ListType extends AbstractCollectionType {
|
|
|
12
12
|
*/
|
|
13
13
|
identifierNodeKind;
|
|
14
14
|
kind = "ListType";
|
|
15
|
-
/**
|
|
16
|
-
* Strategy for minting new list and sub-list identifiers.
|
|
17
|
-
*/
|
|
18
|
-
identifierMintingStrategy;
|
|
19
15
|
/**
|
|
20
16
|
* rdf:type's that will be added to this object when it's serialized toRdf.
|
|
21
17
|
*
|
|
@@ -23,9 +19,8 @@ export class ListType extends AbstractCollectionType {
|
|
|
23
19
|
* class targets).
|
|
24
20
|
*/
|
|
25
21
|
toRdfTypes;
|
|
26
|
-
constructor({
|
|
22
|
+
constructor({ identifierNodeKind, toRdfTypes, ...superParameters }) {
|
|
27
23
|
super(superParameters);
|
|
28
|
-
this.identifierMintingStrategy = identifierMintingStrategy;
|
|
29
24
|
this.identifierNodeKind = identifierNodeKind;
|
|
30
25
|
this.toRdfTypes = toRdfTypes;
|
|
31
26
|
}
|
package/dist/ast/ObjectType.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import type { BlankNode, NamedNode } from "@rdfjs/types";
|
|
|
2
2
|
import { PropertyPath } from "@rdfx/resource";
|
|
3
3
|
import type { NodeKind } from "@shaclmate/shacl-ast";
|
|
4
4
|
import type { Maybe } from "purify-ts";
|
|
5
|
-
import type { IdentifierMintingStrategy } from "../enums/IdentifierMintingStrategy.js";
|
|
6
5
|
import type { TsFeature } from "../enums/TsFeature.js";
|
|
7
6
|
import type { TsObjectDeclarationType } from "../enums/TsObjectDeclarationType.js";
|
|
8
7
|
import type { Visibility } from "../enums/Visibility.js";
|
|
@@ -32,10 +31,6 @@ export declare class ObjectType extends AbstractType {
|
|
|
32
31
|
* class targets).
|
|
33
32
|
*/
|
|
34
33
|
readonly fromRdfType: Maybe<NamedNode>;
|
|
35
|
-
/**
|
|
36
|
-
* Strategy for minting new object identifiers.
|
|
37
|
-
*/
|
|
38
|
-
readonly identifierMintingStrategy: Maybe<IdentifierMintingStrategy>;
|
|
39
34
|
/**
|
|
40
35
|
* Identifier type.
|
|
41
36
|
*/
|
|
@@ -73,11 +68,10 @@ export declare class ObjectType extends AbstractType {
|
|
|
73
68
|
* Whether to generate a TypeScript class or interface for this type.
|
|
74
69
|
*/
|
|
75
70
|
readonly tsObjectDeclarationType: TsObjectDeclarationType;
|
|
76
|
-
constructor({ abstract, extern, fromRdfType,
|
|
71
|
+
constructor({ abstract, extern, fromRdfType, identifierType, synthetic, toRdfTypes, tsFeatures, tsImports, tsObjectDeclarationType, ...superParameters }: {
|
|
77
72
|
abstract: boolean;
|
|
78
73
|
extern: boolean;
|
|
79
74
|
fromRdfType: Maybe<NamedNode>;
|
|
80
|
-
identifierMintingStrategy: Maybe<IdentifierMintingStrategy>;
|
|
81
75
|
identifierType: BlankNodeType | IdentifierType | IriType;
|
|
82
76
|
synthetic: boolean;
|
|
83
77
|
toRdfTypes: readonly NamedNode[];
|
|
@@ -100,7 +94,6 @@ export declare class ObjectType extends AbstractType {
|
|
|
100
94
|
sortProperties(): void;
|
|
101
95
|
toJSON(): {
|
|
102
96
|
fromRdfType: NamedNode<string> | undefined;
|
|
103
|
-
identifierMintingStrategy: "blankNode" | "sha256" | "uuidv4" | undefined;
|
|
104
97
|
identifierType: {
|
|
105
98
|
hasValues: readonly NamedNode<string>[] | undefined;
|
|
106
99
|
in: readonly NamedNode<string>[] | undefined;
|
|
@@ -133,6 +126,10 @@ export declare namespace ObjectType {
|
|
|
133
126
|
* Description from sh:description.
|
|
134
127
|
*/
|
|
135
128
|
readonly description: Maybe<string>;
|
|
129
|
+
/**
|
|
130
|
+
* Should the property and its value be displayed in a toString()-type representation?
|
|
131
|
+
*/
|
|
132
|
+
readonly display: boolean;
|
|
136
133
|
/**
|
|
137
134
|
* Human-readable label from rdfs:label.
|
|
138
135
|
*/
|
|
@@ -170,9 +167,10 @@ export declare namespace ObjectType {
|
|
|
170
167
|
* Visibility: private, protected, public.
|
|
171
168
|
*/
|
|
172
169
|
readonly visibility: Visibility;
|
|
173
|
-
constructor({ comment, description, label, mutable, name, objectType, order, path, shapeIdentifier, type, visibility, }: {
|
|
170
|
+
constructor({ comment, description, display, label, mutable, name, objectType, order, path, shapeIdentifier, type, visibility, }: {
|
|
174
171
|
comment: Maybe<string>;
|
|
175
172
|
description: Maybe<string>;
|
|
173
|
+
display: boolean;
|
|
176
174
|
label: Maybe<string>;
|
|
177
175
|
mutable: boolean;
|
|
178
176
|
name: string;
|
package/dist/ast/ObjectType.js
CHANGED
|
@@ -62,10 +62,6 @@ export class ObjectType extends AbstractType {
|
|
|
62
62
|
* class targets).
|
|
63
63
|
*/
|
|
64
64
|
fromRdfType;
|
|
65
|
-
/**
|
|
66
|
-
* Strategy for minting new object identifiers.
|
|
67
|
-
*/
|
|
68
|
-
identifierMintingStrategy;
|
|
69
65
|
/**
|
|
70
66
|
* Identifier type.
|
|
71
67
|
*/
|
|
@@ -103,12 +99,11 @@ export class ObjectType extends AbstractType {
|
|
|
103
99
|
* Whether to generate a TypeScript class or interface for this type.
|
|
104
100
|
*/
|
|
105
101
|
tsObjectDeclarationType;
|
|
106
|
-
constructor({ abstract, extern, fromRdfType,
|
|
102
|
+
constructor({ abstract, extern, fromRdfType, identifierType, synthetic, toRdfTypes, tsFeatures, tsImports, tsObjectDeclarationType, ...superParameters }) {
|
|
107
103
|
super(superParameters);
|
|
108
104
|
this.abstract = abstract;
|
|
109
105
|
this.extern = extern;
|
|
110
106
|
this.fromRdfType = fromRdfType;
|
|
111
|
-
this.identifierMintingStrategy = identifierMintingStrategy;
|
|
112
107
|
this.identifierType = identifierType;
|
|
113
108
|
this.synthetic = synthetic;
|
|
114
109
|
this.toRdfTypes = toRdfTypes;
|
|
@@ -171,7 +166,6 @@ export class ObjectType extends AbstractType {
|
|
|
171
166
|
return {
|
|
172
167
|
...super.toJSON(),
|
|
173
168
|
fromRdfType: this.fromRdfType.extract(),
|
|
174
|
-
identifierMintingStrategy: this.identifierMintingStrategy.extract(),
|
|
175
169
|
identifierType: this.identifierType.toJSON(),
|
|
176
170
|
parentObjectTypes: this.parentObjectTypes.length > 0
|
|
177
171
|
? this.parentObjectTypes.map((parentObjectType) => parentObjectType.name.extract() ??
|
|
@@ -193,6 +187,10 @@ const nodeKinds = new Set(["BlankNode", "IRI"]);
|
|
|
193
187
|
* Description from sh:description.
|
|
194
188
|
*/
|
|
195
189
|
description;
|
|
190
|
+
/**
|
|
191
|
+
* Should the property and its value be displayed in a toString()-type representation?
|
|
192
|
+
*/
|
|
193
|
+
display;
|
|
196
194
|
/**
|
|
197
195
|
* Human-readable label from rdfs:label.
|
|
198
196
|
*/
|
|
@@ -230,9 +228,10 @@ const nodeKinds = new Set(["BlankNode", "IRI"]);
|
|
|
230
228
|
* Visibility: private, protected, public.
|
|
231
229
|
*/
|
|
232
230
|
visibility;
|
|
233
|
-
constructor({ comment, description, label, mutable, name, objectType, order, path, shapeIdentifier, type, visibility, }) {
|
|
231
|
+
constructor({ comment, description, display, label, mutable, name, objectType, order, path, shapeIdentifier, type, visibility, }) {
|
|
234
232
|
this.comment = comment;
|
|
235
233
|
this.description = description;
|
|
234
|
+
this.display = display;
|
|
236
235
|
this.label = label;
|
|
237
236
|
this.mutable = mutable;
|
|
238
237
|
this.name = name;
|
|
@@ -45,6 +45,7 @@ export declare abstract class AbstractLazyObjectType<PartialTypeT extends Abstra
|
|
|
45
45
|
jsonUiSchemaElement(parameters: Parameters<AbstractType["jsonUiSchemaElement"]>[0]): Maybe<Code>;
|
|
46
46
|
toJsonExpression({ variables, }: Parameters<AbstractType["toJsonExpression"]>[0]): Code;
|
|
47
47
|
toRdfResourceValuesExpression({ variables, }: Parameters<AbstractType["toRdfResourceValuesExpression"]>[0]): Code;
|
|
48
|
+
toStringExpression({ variables, }: Parameters<AbstractType["toStringExpression"]>[0]): Code;
|
|
48
49
|
protected resolvedNamedObjectUnionTypeToPartialNamedObjectUnionTypeConversion({ resolvedNamedObjectUnionType, partialNamedObjectUnionType, variables, }: {
|
|
49
50
|
resolvedNamedObjectUnionType: NamedObjectUnionType;
|
|
50
51
|
partialNamedObjectUnionType: NamedObjectUnionType;
|
|
@@ -113,6 +113,13 @@ export class AbstractLazyObjectType extends AbstractType {
|
|
|
113
113
|
},
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
|
+
toStringExpression({ variables, }) {
|
|
117
|
+
return this.partialType.toStringExpression({
|
|
118
|
+
variables: {
|
|
119
|
+
value: code `${variables.value}.${this.runtimeClass.partialPropertyName}`,
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
}
|
|
116
123
|
resolvedNamedObjectUnionTypeToPartialNamedObjectUnionTypeConversion({ resolvedNamedObjectUnionType, partialNamedObjectUnionType, variables, }) {
|
|
117
124
|
invariant(resolvedNamedObjectUnionType.members.length ===
|
|
118
125
|
partialNamedObjectUnionType.members.length);
|
|
@@ -15,8 +15,8 @@ export declare abstract class AbstractNamedUnionType<MemberTypeT extends Type> e
|
|
|
15
15
|
get equalsFunction(): Code;
|
|
16
16
|
get filterFunction(): Code;
|
|
17
17
|
get filterType(): Code;
|
|
18
|
-
get jsonTypeAliasDeclaration(): Code;
|
|
19
18
|
get jsonSchemaFunctionDeclaration(): Code;
|
|
19
|
+
get jsonTypeAliasDeclaration(): Code;
|
|
20
20
|
get name(): string;
|
|
21
21
|
get staticModuleName(): string;
|
|
22
22
|
get valueSparqlConstructTriplesFunction(): Code;
|
|
@@ -25,9 +25,10 @@ export declare abstract class AbstractNamedUnionType<MemberTypeT extends Type> e
|
|
|
25
25
|
fromJsonExpression({ variables, }: Parameters<AbstractType["fromJsonExpression"]>[0]): Code;
|
|
26
26
|
fromRdfResourceValuesExpression({ variables, }: Parameters<AbstractType["fromRdfResourceValuesExpression"]>[0]): Code;
|
|
27
27
|
hashStatements({ depth, variables, }: Parameters<AbstractType["hashStatements"]>[0]): readonly Code[];
|
|
28
|
-
jsonType(): AbstractType.JsonType;
|
|
29
28
|
jsonSchema({ context, }: Parameters<AbstractType["jsonSchema"]>[0]): Code;
|
|
29
|
+
jsonType(): AbstractType.JsonType;
|
|
30
30
|
toJsonExpression({ variables, }: Parameters<AbstractType["toJsonExpression"]>[0]): Code;
|
|
31
31
|
toRdfResourceValuesExpression({ variables, }: Parameters<AbstractType["toRdfResourceValuesExpression"]>[0]): Code;
|
|
32
|
+
toStringExpression({ variables, }: Parameters<AbstractType["toStringExpression"]>[0]): Code;
|
|
32
33
|
}
|
|
33
34
|
//# sourceMappingURL=AbstractNamedUnionType.d.ts.map
|