@shaclmate/compiler 4.0.23 → 4.0.25
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/Compiler.d.ts +1 -1
- package/dist/ShapesGraphToAstTransformer.d.ts +1 -1
- package/dist/ShapesGraphToAstTransformer.js +16 -16
- package/dist/_ShapesGraphToAstTransformer/nodeShapeTsFeatures.d.ts +1 -1
- package/dist/_ShapesGraphToAstTransformer/nodeShapeTsFeatures.js +5 -2
- 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 +11 -17
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.js +3 -3
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.js +6 -11
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.js +21 -40
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.js +1 -1
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.js +3 -3
- package/dist/ast/AbstractCompoundType.d.ts +1 -1
- 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 +3 -30
- package/dist/ast/ObjectType.js +2 -26
- package/dist/generators/ts/AbstractContainerType.d.ts +0 -1
- package/dist/generators/ts/AbstractContainerType.js +0 -1
- package/dist/generators/ts/AbstractLazyObjectType.d.ts +0 -1
- package/dist/generators/ts/AbstractLazyObjectType.js +2 -2
- package/dist/generators/ts/AbstractNamedUnionType.d.ts +1 -2
- package/dist/generators/ts/AbstractNamedUnionType.js +16 -19
- package/dist/generators/ts/AbstractTermType.d.ts +0 -1
- package/dist/generators/ts/AbstractTermType.js +0 -1
- package/dist/generators/ts/AbstractType.d.ts +0 -4
- package/dist/generators/ts/AbstractUnionType.d.ts +1 -10
- package/dist/generators/ts/AbstractUnionType.js +27 -40
- package/dist/generators/ts/LazyObjectOptionType.js +3 -2
- package/dist/generators/ts/LazyObjectSetType.js +2 -1
- package/dist/generators/ts/LazyObjectType.js +2 -1
- package/dist/generators/ts/ListType.d.ts +1 -5
- package/dist/generators/ts/ListType.js +8 -27
- package/dist/generators/ts/NamedObjectType.d.ts +2 -21
- package/dist/generators/ts/NamedObjectType.js +33 -132
- package/dist/generators/ts/NamedObjectUnionType.js +14 -25
- package/dist/generators/ts/TypeFactory.js +11 -67
- package/dist/generators/ts/ZodGenerator.js +2 -2
- package/dist/generators/ts/_NamedObjectType/AbstractProperty.d.ts +11 -17
- package/dist/generators/ts/_NamedObjectType/AbstractProperty.js +7 -6
- package/dist/generators/ts/_NamedObjectType/DiscriminantProperty.d.ts +1 -4
- package/dist/generators/ts/_NamedObjectType/DiscriminantProperty.js +19 -34
- package/dist/generators/ts/_NamedObjectType/IdentifierProperty.d.ts +5 -15
- package/dist/generators/ts/_NamedObjectType/IdentifierProperty.js +31 -212
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_createFunctionDeclaration.js +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.js +25 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterFunctionDeclaration.js +4 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterTypeDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js +1 -8
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js +5 -13
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.js +1 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionDeclarations.d.ts +4 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionDeclarations.js +49 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_interfaceDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.js +0 -3
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.js +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromJsonFunctionDeclaration.js +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromRdfResourceFunctionDeclaration.js +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.js +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.d.ts +1 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.js +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.js +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.js +41 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_NamedObjectType/{NamedObjectType_toRdfResourceFunctionOrMethodDeclaration.js → NamedObjectType_toRdfResourceFunctionDeclaration.js} +8 -27
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.d.ts +4 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.js +40 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/Property.d.ts +1 -2
- package/dist/generators/ts/_NamedObjectType/ShaclProperty.d.ts +1 -3
- package/dist/generators/ts/_NamedObjectType/ShaclProperty.js +8 -39
- 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/imports.d.ts +0 -2
- package/dist/generators/ts/imports.js +0 -2
- package/dist/generators/ts/objectSetDeclarations.js +1 -3
- package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.js +4 -6
- package/dist/generators/ts/sparqlObjectSetClassDeclaration.js +2 -2
- package/dist/input/ShapesGraph.d.ts +1 -1
- package/dist/input/generated.d.ts +10 -181
- package/dist/input/generated.js +116 -392
- package/package.json +2 -4
- 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/enums/TsObjectDeclarationType.d.ts +0 -9
- package/dist/enums/TsObjectDeclarationType.js +0 -16
- package/dist/enums/Visibility.d.ts +0 -6
- package/dist/enums/Visibility.js +0 -18
- package/dist/generators/ts/_NamedObjectType/IdentifierPrefixProperty.d.ts +0 -33
- package/dist/generators/ts/_NamedObjectType/IdentifierPrefixProperty.js +0 -92
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_classDeclaration.d.ts +0 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_classDeclaration.js +0 -62
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionOrMethodDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionOrMethodDeclaration.js +0 -51
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionOrMethodDeclarations.d.ts +0 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionOrMethodDeclarations.js +0 -73
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionOrMethodDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionOrMethodDeclaration.js +0 -59
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionOrMethodDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionOrMethodDeclaration.d.ts +0 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionOrMethodDeclaration.js +0 -62
- /package/dist/{enums → generators/ts}/TsFeature.d.ts +0 -0
- /package/dist/{enums → generators/ts}/TsFeature.js +0 -0
package/dist/Compiler.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Either } from "purify-ts";
|
|
2
2
|
import type { Logger } from "ts-log";
|
|
3
|
-
import type { TsFeature } from "./enums/TsFeature.js";
|
|
4
3
|
import type { Generator } from "./generators/Generator.js";
|
|
4
|
+
import type { TsFeature } from "./generators/ts/TsFeature.js";
|
|
5
5
|
import type { ShapesGraph } from "./input/ShapesGraph.js";
|
|
6
6
|
export declare class Compiler {
|
|
7
7
|
private readonly generator;
|
|
@@ -3,7 +3,7 @@ import type { BlankNode, NamedNode } from "@rdfjs/types";
|
|
|
3
3
|
import { Either } from "purify-ts";
|
|
4
4
|
import type { Logger } from "ts-log";
|
|
5
5
|
import type * as ast from "./ast/index.js";
|
|
6
|
-
import type { TsFeature } from "./
|
|
6
|
+
import type { TsFeature } from "./generators/ts/TsFeature.js";
|
|
7
7
|
import type * as input from "./input/index.js";
|
|
8
8
|
interface RelatedNodeShapes {
|
|
9
9
|
readonly ancestors: input.NodeShape[];
|
|
@@ -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());
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Either } from "purify-ts";
|
|
2
|
-
import { type TsFeature } from "../
|
|
2
|
+
import { type TsFeature } from "../generators/ts/TsFeature.js";
|
|
3
3
|
import type * as input from "../input/index.js";
|
|
4
4
|
import type { ShapesGraphToAstTransformer } from "../ShapesGraphToAstTransformer.js";
|
|
5
5
|
export declare function nodeShapeTsFeatures(this: ShapesGraphToAstTransformer, nodeShape: input.NodeShape): Either<Error, ReadonlySet<TsFeature>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Either } from "purify-ts";
|
|
2
|
-
import { TS_FEATURES } from "../
|
|
2
|
+
import { TS_FEATURES } from "../generators/ts/TsFeature.js";
|
|
3
3
|
import { shapeOntology } from "./shapeOntology.js";
|
|
4
4
|
export function nodeShapeTsFeatures(nodeShape) {
|
|
5
5
|
const tsFeaturesDefault = this.tsFeaturesDefault;
|
|
@@ -55,9 +55,12 @@ export function nodeShapeTsFeatures(nodeShape) {
|
|
|
55
55
|
tsFeatures.add(tsFeature);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
if (tsFeatures.has("graphql")) {
|
|
58
|
+
if (tsFeatures.has("graphql") || tsFeatures.has("sparql")) {
|
|
59
59
|
tsFeatures.add("rdf");
|
|
60
60
|
}
|
|
61
|
+
if (tsFeatures.has("json") || tsFeatures.has("rdf")) {
|
|
62
|
+
tsFeatures.add("create");
|
|
63
|
+
}
|
|
61
64
|
return Either.of(tsFeatures);
|
|
62
65
|
});
|
|
63
66
|
}
|
|
@@ -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]));
|
|
@@ -4,7 +4,6 @@ import { Either, Left, Maybe } from "purify-ts";
|
|
|
4
4
|
import { invariant } from "ts-invariant";
|
|
5
5
|
import * as ast from "../ast/index.js";
|
|
6
6
|
import { Eithers } from "../Eithers.js";
|
|
7
|
-
import { Visibility } from "../enums/Visibility.js";
|
|
8
7
|
import { ShapeStack } from "./ShapeStack.js";
|
|
9
8
|
import { transformShapeToAstType } from "./transformShapeToAstType.js";
|
|
10
9
|
function synthesizePartialAstObjectType({ identifierType, tsFeatures, }) {
|
|
@@ -20,12 +19,10 @@ function synthesizePartialAstObjectType({ identifierType, tsFeatures, }) {
|
|
|
20
19
|
break;
|
|
21
20
|
}
|
|
22
21
|
return new ast.ObjectType({
|
|
23
|
-
abstract: false,
|
|
24
22
|
comment: Maybe.empty(),
|
|
25
23
|
extern: false,
|
|
26
24
|
fromRdfType: Maybe.empty(),
|
|
27
25
|
identifierType,
|
|
28
|
-
identifierMintingStrategy: Maybe.empty(),
|
|
29
26
|
label: Maybe.empty(),
|
|
30
27
|
name: Maybe.of(syntheticName),
|
|
31
28
|
shapeIdentifier: dataFactory.namedNode(`urn:shaclmate:synthetic:${syntheticName}`),
|
|
@@ -33,7 +30,6 @@ function synthesizePartialAstObjectType({ identifierType, tsFeatures, }) {
|
|
|
33
30
|
toRdfTypes: [],
|
|
34
31
|
tsFeatures,
|
|
35
32
|
tsImports: [],
|
|
36
|
-
tsObjectDeclarationType: "class",
|
|
37
33
|
});
|
|
38
34
|
}
|
|
39
35
|
function propertyName(objectType, propertyShape) {
|
|
@@ -49,13 +45,14 @@ function propertyName(objectType, propertyShape) {
|
|
|
49
45
|
}
|
|
50
46
|
// Pick up the common pattern of a property shape identifier being the node shape's identifier -localName,
|
|
51
47
|
// like ex:NodeShape-property
|
|
52
|
-
|
|
48
|
+
const propertyShapeIdentifier = propertyShape.$identifier();
|
|
49
|
+
if (propertyShapeIdentifier.termType === "NamedNode" &&
|
|
53
50
|
objectType.shapeIdentifier.termType === "NamedNode") {
|
|
54
51
|
const propertyShapeIdentifierPrefix = `${objectType.shapeIdentifier.value}-`;
|
|
55
|
-
if (
|
|
56
|
-
|
|
52
|
+
if (propertyShapeIdentifier.value.startsWith(propertyShapeIdentifierPrefix) &&
|
|
53
|
+
propertyShapeIdentifier.value.length >
|
|
57
54
|
propertyShapeIdentifierPrefix.length) {
|
|
58
|
-
return
|
|
55
|
+
return propertyShapeIdentifier.value.substring(propertyShapeIdentifierPrefix.length);
|
|
59
56
|
}
|
|
60
57
|
}
|
|
61
58
|
// sh:path CURIE reference
|
|
@@ -63,12 +60,12 @@ function propertyName(objectType, propertyShape) {
|
|
|
63
60
|
return propertyShape.path.reference;
|
|
64
61
|
}
|
|
65
62
|
// Shape identifier CURIE reference
|
|
66
|
-
if (
|
|
67
|
-
return
|
|
63
|
+
if (propertyShapeIdentifier instanceof Curie) {
|
|
64
|
+
return propertyShapeIdentifier.reference;
|
|
68
65
|
}
|
|
69
66
|
// Shape identifier IRI
|
|
70
|
-
if (
|
|
71
|
-
return
|
|
67
|
+
if (propertyShapeIdentifier.termType === "NamedNode") {
|
|
68
|
+
return propertyShapeIdentifier.value;
|
|
72
69
|
}
|
|
73
70
|
// sh:path IRI
|
|
74
71
|
if (propertyShape.path.termType === "NamedNode") {
|
|
@@ -201,7 +198,7 @@ export function transformPropertyShapeToAstObjectTypeProperty({ objectType, prop
|
|
|
201
198
|
comment: Maybe.empty(),
|
|
202
199
|
label: Maybe.empty(),
|
|
203
200
|
name: Maybe.empty(),
|
|
204
|
-
shapeIdentifier: propertyShape.$identifier,
|
|
201
|
+
shapeIdentifier: propertyShape.$identifier(),
|
|
205
202
|
};
|
|
206
203
|
switch (astType.kind) {
|
|
207
204
|
case "BlankNodeType":
|
|
@@ -259,11 +256,8 @@ export function transformPropertyShapeToAstObjectTypeProperty({ objectType, prop
|
|
|
259
256
|
objectType,
|
|
260
257
|
order: propertyShape.order.orDefault(0),
|
|
261
258
|
path: propertyShape.path,
|
|
262
|
-
shapeIdentifier: propertyShape.$identifier,
|
|
259
|
+
shapeIdentifier: propertyShape.$identifier(),
|
|
263
260
|
type: astType,
|
|
264
|
-
visibility: propertyShape.visibility
|
|
265
|
-
.map(Visibility.fromIri)
|
|
266
|
-
.orDefault("public"),
|
|
267
261
|
}));
|
|
268
262
|
});
|
|
269
263
|
}
|
|
@@ -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,16 +4,13 @@ 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";
|
|
11
10
|
const listPropertiesObjectType = new ast.ObjectType({
|
|
12
|
-
abstract: false,
|
|
13
11
|
extern: false,
|
|
14
12
|
comment: Maybe.empty(),
|
|
15
13
|
label: Maybe.empty(),
|
|
16
|
-
identifierMintingStrategy: Maybe.empty(),
|
|
17
14
|
identifierType: new ast.IdentifierType({
|
|
18
15
|
comment: Maybe.empty(),
|
|
19
16
|
label: Maybe.empty(),
|
|
@@ -24,7 +21,6 @@ const listPropertiesObjectType = new ast.ObjectType({
|
|
|
24
21
|
name: Maybe.empty(),
|
|
25
22
|
toRdfTypes: [],
|
|
26
23
|
tsFeatures: new Set([]),
|
|
27
|
-
tsObjectDeclarationType: "class",
|
|
28
24
|
shapeIdentifier: dataFactory.blankNode(),
|
|
29
25
|
synthetic: true,
|
|
30
26
|
tsImports: [],
|
|
@@ -47,9 +43,9 @@ export function transformShapeToAstListType(shape, shapeStack) {
|
|
|
47
43
|
return empty;
|
|
48
44
|
}
|
|
49
45
|
const nodeShape = shape;
|
|
50
|
-
return Eithers.
|
|
46
|
+
return Eithers.chain2(shapeNodeKinds.call(this, nodeShape, { defaultNodeShapeNodeKinds }), Either.sequence(nodeShape.xone
|
|
51
47
|
.orDefault([])
|
|
52
|
-
.map((shapeIdentifier) => this.shapesGraph.shape(shapeIdentifier)))).chain(([
|
|
48
|
+
.map((shapeIdentifier) => this.shapesGraph.shape(shapeIdentifier)))).chain(([nodeKinds, xone]) => {
|
|
53
49
|
// Put a placeholder in the cache to deal with cyclic references
|
|
54
50
|
// Remove the placeholder if the transformation fails.
|
|
55
51
|
const listType = new ast.ListType({
|
|
@@ -59,11 +55,10 @@ export function transformShapeToAstListType(shape, shapeStack) {
|
|
|
59
55
|
label: nodeShape.label,
|
|
60
56
|
mutable: nodeShape.mutable.orDefault(false),
|
|
61
57
|
name: shapeAstTypeName(nodeShape),
|
|
62
|
-
|
|
63
|
-
shapeIdentifier: nodeShape.$identifier,
|
|
58
|
+
shapeIdentifier: nodeShape.$identifier(),
|
|
64
59
|
toRdfTypes: nodeShape.toRdfTypes,
|
|
65
60
|
});
|
|
66
|
-
this.cachedAstTypesByShapeIdentifier.set(nodeShape.$identifier, listType);
|
|
61
|
+
this.cachedAstTypesByShapeIdentifier.set(nodeShape.$identifier(), listType);
|
|
67
62
|
return (() => {
|
|
68
63
|
let emptyListShape;
|
|
69
64
|
let nonEmptyListShape;
|
|
@@ -127,7 +122,7 @@ export function transformShapeToAstListType(shape, shapeStack) {
|
|
|
127
122
|
})
|
|
128
123
|
.chain((restProperty) => {
|
|
129
124
|
if (restProperty.type.kind !== "ListType" ||
|
|
130
|
-
!restProperty.type.shapeIdentifier.equals(nodeShape.$identifier)) {
|
|
125
|
+
!restProperty.type.shapeIdentifier.equals(nodeShape.$identifier())) {
|
|
131
126
|
return Left(new Error(`${nodeShape} rdf:rest property is not recursive into the node shape`));
|
|
132
127
|
}
|
|
133
128
|
return Either.of(Maybe.of(listType));
|
|
@@ -135,7 +130,7 @@ export function transformShapeToAstListType(shape, shapeStack) {
|
|
|
135
130
|
});
|
|
136
131
|
});
|
|
137
132
|
})().ifLeft(() => {
|
|
138
|
-
this.cachedAstTypesByShapeIdentifier.delete(nodeShape.$identifier);
|
|
133
|
+
this.cachedAstTypesByShapeIdentifier.delete(nodeShape.$identifier());
|
|
139
134
|
});
|
|
140
135
|
});
|
|
141
136
|
}
|
|
@@ -3,14 +3,11 @@ import { Either, Left, Maybe } from "purify-ts";
|
|
|
3
3
|
import { invariant } from "ts-invariant";
|
|
4
4
|
import * as ast from "../ast/index.js";
|
|
5
5
|
import { Eithers } from "../Eithers.js";
|
|
6
|
-
import { TsObjectDeclarationType } from "../enums/TsObjectDeclarationType.js";
|
|
7
6
|
import { defaultNodeShapeNodeKinds } from "./defaultNodeShapeNodeKinds.js";
|
|
8
|
-
import { nodeShapeIdentifierMintingStrategy } from "./nodeShapeIdentifierMintingStrategy.js";
|
|
9
7
|
import { nodeShapeTsFeatures } from "./nodeShapeTsFeatures.js";
|
|
10
8
|
import { ShapeStack } from "./ShapeStack.js";
|
|
11
9
|
import { shapeAstTypeName } from "./shapeAstTypeName.js";
|
|
12
10
|
import { shapeNodeKinds } from "./shapeNodeKinds.js";
|
|
13
|
-
import { shapeOntology } from "./shapeOntology.js";
|
|
14
11
|
import { transformPropertyShapeToAstObjectTypeProperty } from "./transformPropertyShapeToAstObjectTypeProperty.js";
|
|
15
12
|
import { transformShapeToAstType } from "./transformShapeToAstType.js";
|
|
16
13
|
function isObjectTypePropertyRequired(property) {
|
|
@@ -54,41 +51,29 @@ export function transformShapeToAstObjectType(shape, shapeStack) {
|
|
|
54
51
|
nodeShape.xone.orDefault([]).length > 0) {
|
|
55
52
|
return Either.of(Maybe.empty());
|
|
56
53
|
}
|
|
57
|
-
if (nodeShape.$identifier.termType !== "NamedNode") {
|
|
54
|
+
if (nodeShape.$identifier().termType !== "NamedNode") {
|
|
58
55
|
return Either.of(Maybe.empty());
|
|
59
56
|
}
|
|
60
|
-
return Eithers.
|
|
61
|
-
|
|
62
|
-
:
|
|
63
|
-
.call(this, nodeShape)
|
|
64
|
-
.map((ontology) => ontology.chain((ontology) => ontology.tsObjectDeclarationType.map(TsObjectDeclarationType.fromIri)))).chain(([identifierMintingStrategy, nodeKinds, propertyShapes, tsFeatures, tsObjectDeclarationType,]) => {
|
|
65
|
-
const abstract = nodeShape.abstract.orDefault(false);
|
|
66
|
-
const { ancestors: ancestorNodeShapes, descendants: descendantNodeShapes, children: childNodeShapes, parents: parentNodeShapes, } = this.relatedNodeShapesByIdentifier.get(nodeShape.$identifier);
|
|
57
|
+
return Eithers.chain3(shapeNodeKinds.call(this, nodeShape, { defaultNodeShapeNodeKinds }), Either.sequence(nodeShape.properties.map((propertyShapeIdentifier) => this.shapesGraph.propertyShape(propertyShapeIdentifier))), nodeShapeTsFeatures.call(this, nodeShape)).chain(([nodeKinds, propertyShapes, tsFeatures]) => {
|
|
58
|
+
const nodeShapeIdentifier = nodeShape.$identifier();
|
|
59
|
+
const { ancestors: ancestorNodeShapes, descendants: descendantNodeShapes, children: childNodeShapes, parents: parentNodeShapes, } = this.relatedNodeShapesByIdentifier.get(nodeShapeIdentifier);
|
|
67
60
|
const isClass = nodeShape.subClassOf.length > 0 ||
|
|
68
61
|
descendantNodeShapes.length > 0 || // A node shape that is the object of an rdfs:subClassOf is itself an rdfs:Class
|
|
69
62
|
nodeShape.types.some((type) => type.equals(owl.Class) || type.equals(rdfs.Class));
|
|
70
|
-
let fromRdfType;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
fromRdfType = nodeShape.fromRdfType.alt(nodeShape.rdfType);
|
|
74
|
-
if (isClass && nodeShape.$identifier.termType === "NamedNode") {
|
|
75
|
-
fromRdfType = fromRdfType.alt(Maybe.of(nodeShape.$identifier));
|
|
76
|
-
}
|
|
77
|
-
toRdfTypes = nodeShape.toRdfTypes.concat();
|
|
78
|
-
if (toRdfTypes.length === 0) {
|
|
79
|
-
toRdfTypes.push(...nodeShape.rdfType.toList());
|
|
80
|
-
}
|
|
81
|
-
// Ensure toRdfTypes has fromRdfType
|
|
82
|
-
fromRdfType.ifJust((fromRdfType) => {
|
|
83
|
-
if (!toRdfTypes.some((toRdfType) => toRdfType.equals(fromRdfType))) {
|
|
84
|
-
toRdfTypes.push(fromRdfType);
|
|
85
|
-
}
|
|
86
|
-
});
|
|
63
|
+
let fromRdfType = nodeShape.fromRdfType.alt(nodeShape.rdfType);
|
|
64
|
+
if (isClass && nodeShapeIdentifier.termType === "NamedNode") {
|
|
65
|
+
fromRdfType = fromRdfType.alt(Maybe.of(nodeShapeIdentifier));
|
|
87
66
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
toRdfTypes
|
|
67
|
+
const toRdfTypes = nodeShape.toRdfTypes.concat();
|
|
68
|
+
if (toRdfTypes.length === 0) {
|
|
69
|
+
toRdfTypes.push(...nodeShape.rdfType.toList());
|
|
91
70
|
}
|
|
71
|
+
// Ensure toRdfTypes has fromRdfType
|
|
72
|
+
fromRdfType.ifJust((fromRdfType) => {
|
|
73
|
+
if (!toRdfTypes.some((toRdfType) => toRdfType.equals(fromRdfType))) {
|
|
74
|
+
toRdfTypes.push(fromRdfType);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
92
77
|
if (nodeKinds.has("Literal")) {
|
|
93
78
|
return Left(new Error(`${nodeShape} should not have a nodeKind "Literal"`));
|
|
94
79
|
}
|
|
@@ -97,7 +82,7 @@ export function transformShapeToAstObjectType(shape, shapeStack) {
|
|
|
97
82
|
comment: Maybe.empty(),
|
|
98
83
|
label: Maybe.empty(),
|
|
99
84
|
name: Maybe.empty(),
|
|
100
|
-
shapeIdentifier: nodeShape.$identifier,
|
|
85
|
+
shapeIdentifier: nodeShape.$identifier(),
|
|
101
86
|
};
|
|
102
87
|
if (nodeKinds.size === 2) {
|
|
103
88
|
invariant(nodeShape.in_.isNothing());
|
|
@@ -128,22 +113,19 @@ export function transformShapeToAstObjectType(shape, shapeStack) {
|
|
|
128
113
|
// If this node shape's properties (directly or indirectly) refer to the node shape itself,
|
|
129
114
|
// we'll return this placeholder.
|
|
130
115
|
const objectType = new ast.ObjectType({
|
|
131
|
-
abstract,
|
|
132
116
|
comment: nodeShape.comment,
|
|
133
117
|
extern: nodeShape.extern.orDefault(false),
|
|
134
118
|
fromRdfType,
|
|
135
119
|
label: nodeShape.label,
|
|
136
120
|
identifierType,
|
|
137
|
-
identifierMintingStrategy,
|
|
138
121
|
name: shapeAstTypeName(nodeShape),
|
|
139
|
-
shapeIdentifier: nodeShape.$identifier,
|
|
122
|
+
shapeIdentifier: nodeShape.$identifier(),
|
|
140
123
|
synthetic: false,
|
|
141
124
|
toRdfTypes,
|
|
142
125
|
tsFeatures,
|
|
143
126
|
tsImports: nodeShape.tsImports,
|
|
144
|
-
tsObjectDeclarationType: tsObjectDeclarationType.orDefault("class"),
|
|
145
127
|
});
|
|
146
|
-
this.cachedAstTypesByShapeIdentifier.set(nodeShape.$identifier, objectType);
|
|
128
|
+
this.cachedAstTypesByShapeIdentifier.set(nodeShape.$identifier(), objectType);
|
|
147
129
|
return (() => {
|
|
148
130
|
// Populate ancestor and descendant object types
|
|
149
131
|
const relatedObjectTypes = (relatedNodeShapes) => {
|
|
@@ -171,8 +153,7 @@ export function transformShapeToAstObjectType(shape, shapeStack) {
|
|
|
171
153
|
objectType.addProperties(property);
|
|
172
154
|
});
|
|
173
155
|
}
|
|
174
|
-
if (!objectType.
|
|
175
|
-
!objectType.extern &&
|
|
156
|
+
if (!objectType.extern &&
|
|
176
157
|
objectType.fromRdfType.isNothing() &&
|
|
177
158
|
!objectType.properties.some(isObjectTypePropertyRequired)) {
|
|
178
159
|
return Left(new Error(`${nodeShape} has no required properties and no implicitly required rdf:type`));
|
|
@@ -180,7 +161,7 @@ export function transformShapeToAstObjectType(shape, shapeStack) {
|
|
|
180
161
|
objectType.sortProperties();
|
|
181
162
|
return Either.of(Maybe.of(objectType));
|
|
182
163
|
})().ifLeft(() => {
|
|
183
|
-
this.cachedAstTypesByShapeIdentifier.delete(nodeShape.$identifier);
|
|
164
|
+
this.cachedAstTypesByShapeIdentifier.delete(nodeShape.$identifier());
|
|
184
165
|
});
|
|
185
166
|
});
|
|
186
167
|
}
|
|
@@ -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
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { NodeKind } from "@shaclmate/shacl-ast";
|
|
2
|
-
import type { TsFeature } from "../
|
|
2
|
+
import type { TsFeature } from "../generators/ts/TsFeature.js";
|
|
3
3
|
import { AbstractType } from "./AbstractType.js";
|
|
4
4
|
import type { BlankNodeType } from "./BlankNodeType.js";
|
|
5
5
|
import type { IdentifierType } from "./IdentifierType.js";
|
|
@@ -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
|
}
|