@shaclmate/compiler 2.0.13 → 2.0.15
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/Compiler.d.ts +15 -0
- package/Compiler.js +20 -0
- package/ShapesGraphToAstTransformer.d.ts +18 -23
- package/ShapesGraphToAstTransformer.js +21 -447
- package/_ShapesGraphToAstTransformer/NodeShapeAstType.d.ts +3 -0
- package/_ShapesGraphToAstTransformer/NodeShapeAstType.js +2 -0
- package/_ShapesGraphToAstTransformer/index.d.ts +10 -0
- package/_ShapesGraphToAstTransformer/index.js +10 -0
- package/_ShapesGraphToAstTransformer/pickLiteral.d.ts +4 -0
- package/_ShapesGraphToAstTransformer/pickLiteral.js +18 -0
- package/_ShapesGraphToAstTransformer/propertyShapeNodeKinds.d.ts +4 -0
- package/_ShapesGraphToAstTransformer/propertyShapeNodeKinds.js +26 -0
- package/_ShapesGraphToAstTransformer/shapeAstName.d.ts +5 -0
- package/_ShapesGraphToAstTransformer/shapeAstName.js +28 -0
- package/_ShapesGraphToAstTransformer/transformNodeShapeToAstType.d.ts +6 -0
- package/_ShapesGraphToAstTransformer/transformNodeShapeToAstType.js +178 -0
- package/_ShapesGraphToAstTransformer/transformPropertyShapeToAstCompositeType.d.ts +13 -0
- package/_ShapesGraphToAstTransformer/transformPropertyShapeToAstCompositeType.js +200 -0
- package/_ShapesGraphToAstTransformer/transformPropertyShapeToAstIdentifierType.d.ts +12 -0
- package/_ShapesGraphToAstTransformer/transformPropertyShapeToAstIdentifierType.js +29 -0
- package/_ShapesGraphToAstTransformer/transformPropertyShapeToAstLiteralType.d.ts +12 -0
- package/_ShapesGraphToAstTransformer/transformPropertyShapeToAstLiteralType.js +43 -0
- package/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.d.ts +6 -0
- package/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +31 -0
- package/_ShapesGraphToAstTransformer/transformPropertyShapeToAstTermType.d.ts +14 -0
- package/_ShapesGraphToAstTransformer/transformPropertyShapeToAstTermType.js +21 -0
- package/_ShapesGraphToAstTransformer/transformPropertyShapeToAstType.d.ts +16 -0
- package/_ShapesGraphToAstTransformer/transformPropertyShapeToAstType.js +58 -0
- package/ast/Ast.d.ts +5 -0
- package/ast/CompositeType.d.ts +13 -0
- package/ast/CompositeType.js +2 -0
- package/ast/IdentifierType.d.ts +3 -6
- package/ast/IntersectionType.d.ts +2 -2
- package/ast/ListType.d.ts +53 -0
- package/ast/ListType.js +2 -0
- package/ast/LiteralType.d.ts +4 -3
- package/ast/Name.d.ts +1 -0
- package/ast/ObjectCompositeType.d.ts +22 -0
- package/ast/ObjectCompositeType.js +2 -0
- package/ast/ObjectIntersectionType.d.ts +8 -0
- package/ast/ObjectIntersectionType.js +2 -0
- package/ast/ObjectType.d.ts +91 -19
- package/ast/ObjectType.js +26 -1
- package/ast/ObjectUnionType.d.ts +19 -0
- package/ast/ObjectUnionType.js +2 -0
- package/ast/PlaceholderType.d.ts +7 -0
- package/ast/PlaceholderType.js +2 -0
- package/ast/SetType.d.ts +1 -1
- package/ast/TermType.d.ts +11 -0
- package/ast/TermType.js +2 -0
- package/ast/Type.d.ts +11 -3
- package/ast/UnionType.d.ts +3 -3
- package/ast/index.d.ts +6 -3
- package/ast/index.js +6 -3
- package/enums/MintingStrategy.d.ts +5 -0
- package/enums/MintingStrategy.js +2 -0
- package/enums/PropertyVisibility.d.ts +2 -0
- package/enums/PropertyVisibility.js +2 -0
- package/enums/TsFeature.d.ts +5 -0
- package/enums/TsFeature.js +16 -0
- package/enums/TsObjectDeclarationType.d.ts +5 -0
- package/enums/TsObjectDeclarationType.js +2 -0
- package/enums/index.d.ts +5 -0
- package/enums/index.js +5 -0
- package/generators/Generator.d.ts +5 -0
- package/generators/Generator.js +2 -0
- package/generators/index.d.ts +2 -2
- package/generators/index.js +2 -2
- package/generators/json/AstJsonGenerator.d.ts +4 -5
- package/generators/json/AstJsonGenerator.js +31 -22
- package/generators/ts/BooleanType.d.ts +7 -3
- package/generators/ts/BooleanType.js +58 -4
- package/generators/ts/DateTimeType.d.ts +19 -0
- package/generators/ts/DateTimeType.js +66 -0
- package/generators/ts/DeclaredType.d.ts +17 -0
- package/generators/ts/DeclaredType.js +10 -0
- package/generators/ts/IdentifierType.d.ts +7 -17
- package/generators/ts/IdentifierType.js +69 -60
- package/generators/ts/Import.d.ts +17 -0
- package/generators/ts/Import.js +54 -0
- package/generators/ts/ListType.d.ts +19 -8
- package/generators/ts/ListType.js +206 -44
- package/generators/ts/LiteralType.d.ts +13 -11
- package/generators/ts/LiteralType.js +36 -51
- package/generators/ts/NumberType.d.ts +7 -3
- package/generators/ts/NumberType.js +55 -4
- package/generators/ts/ObjectType.d.ts +48 -25
- package/generators/ts/ObjectType.js +234 -50
- package/generators/ts/ObjectUnionType.d.ts +58 -0
- package/generators/ts/ObjectUnionType.js +450 -0
- package/generators/ts/OptionType.d.ts +14 -4
- package/generators/ts/OptionType.js +70 -20
- package/generators/ts/PrimitiveType.d.ts +15 -5
- package/generators/ts/PrimitiveType.js +27 -31
- package/generators/ts/SetType.d.ts +14 -4
- package/generators/ts/SetType.js +108 -30
- package/generators/ts/SnippetDeclarations.d.ts +11 -0
- package/generators/ts/SnippetDeclarations.js +215 -0
- package/generators/ts/StringType.d.ts +8 -3
- package/generators/ts/StringType.js +57 -3
- package/generators/ts/TermType.d.ts +54 -0
- package/generators/ts/TermType.js +242 -0
- package/generators/ts/TsGenerator.d.ts +4 -12
- package/generators/ts/TsGenerator.js +57 -99
- package/generators/ts/Type.d.ts +117 -46
- package/generators/ts/Type.js +93 -59
- package/generators/ts/TypeFactory.d.ts +4 -5
- package/generators/ts/TypeFactory.js +224 -91
- package/generators/ts/UnionType.d.ts +20 -6
- package/generators/ts/UnionType.js +230 -120
- package/generators/ts/_ObjectType/IdentifierProperty.d.ts +27 -8
- package/generators/ts/_ObjectType/IdentifierProperty.js +153 -32
- package/generators/ts/_ObjectType/Property.d.ts +139 -9
- package/generators/ts/_ObjectType/Property.js +26 -3
- package/generators/ts/_ObjectType/ShaclProperty.d.ts +24 -5
- package/generators/ts/_ObjectType/ShaclProperty.js +103 -26
- package/generators/ts/_ObjectType/TypeDiscriminatorProperty.d.ts +23 -7
- package/generators/ts/_ObjectType/TypeDiscriminatorProperty.js +83 -14
- package/generators/ts/_ObjectType/classDeclaration.d.ts +2 -1
- package/generators/ts/_ObjectType/classDeclaration.js +79 -111
- package/generators/ts/_ObjectType/createFunctionDeclaration.d.ts +5 -0
- package/generators/ts/_ObjectType/createFunctionDeclaration.js +60 -0
- package/generators/ts/_ObjectType/equalsFunctionDeclaration.d.ts +2 -1
- package/generators/ts/_ObjectType/equalsFunctionDeclaration.js +12 -20
- package/generators/ts/_ObjectType/equalsFunctionOrMethodDeclaration.d.ts +11 -0
- package/generators/ts/_ObjectType/equalsFunctionOrMethodDeclaration.js +70 -0
- package/generators/ts/_ObjectType/fromJsonFunctionDeclarations.d.ts +4 -0
- package/generators/ts/_ObjectType/fromJsonFunctionDeclarations.js +78 -0
- package/generators/ts/_ObjectType/fromRdfFunctionDeclarations.d.ts +4 -0
- package/generators/ts/_ObjectType/fromRdfFunctionDeclarations.js +91 -0
- package/generators/ts/_ObjectType/hashFunctionDeclaration.d.ts +3 -3
- package/generators/ts/_ObjectType/hashFunctionDeclaration.js +11 -55
- package/generators/ts/_ObjectType/hashFunctionOrMethodDeclaration.d.ts +11 -0
- package/generators/ts/_ObjectType/hashFunctionOrMethodDeclaration.js +64 -0
- package/generators/ts/_ObjectType/index.d.ts +8 -2
- package/generators/ts/_ObjectType/index.js +8 -2
- package/generators/ts/_ObjectType/interfaceDeclaration.d.ts +3 -2
- package/generators/ts/_ObjectType/interfaceDeclaration.js +11 -2
- package/generators/ts/_ObjectType/jsonSchemaFunctionDeclaration.d.ts +5 -0
- package/generators/ts/_ObjectType/jsonSchemaFunctionDeclaration.js +19 -0
- package/generators/ts/_ObjectType/jsonUiSchemaFunctionDeclaration.d.ts +5 -0
- package/generators/ts/_ObjectType/jsonUiSchemaFunctionDeclaration.js +31 -0
- package/generators/ts/_ObjectType/jsonZodSchemaFunctionDeclaration.d.ts +5 -0
- package/generators/ts/_ObjectType/jsonZodSchemaFunctionDeclaration.js +37 -0
- package/generators/ts/_ObjectType/rdfjsTermExpression.d.ts +6 -0
- package/generators/ts/{rdfjsTermExpression.js → _ObjectType/rdfjsTermExpression.js} +3 -1
- package/generators/ts/_ObjectType/sparqlConstructQueryFunctionDeclaration.d.ts +5 -0
- package/generators/ts/_ObjectType/sparqlConstructQueryFunctionDeclaration.js +21 -0
- package/generators/ts/_ObjectType/sparqlConstructQueryStringFunctionDeclaration.d.ts +5 -0
- package/generators/ts/_ObjectType/sparqlConstructQueryStringFunctionDeclaration.js +20 -0
- package/generators/ts/_ObjectType/sparqlFunctionDeclarations.d.ts +4 -0
- package/generators/ts/_ObjectType/sparqlFunctionDeclarations.js +78 -0
- package/generators/ts/_ObjectType/toJsonFunctionDeclaration.d.ts +5 -0
- package/generators/ts/_ObjectType/toJsonFunctionDeclaration.js +19 -0
- package/generators/ts/_ObjectType/toJsonFunctionOrMethodDeclaration.d.ts +10 -0
- package/generators/ts/_ObjectType/toJsonFunctionOrMethodDeclaration.js +59 -0
- package/generators/ts/_ObjectType/toJsonReturnType.d.ts +3 -0
- package/generators/ts/_ObjectType/toJsonReturnType.js +19 -0
- package/generators/ts/_ObjectType/toRdfFunctionDeclaration.d.ts +3 -2
- package/generators/ts/_ObjectType/toRdfFunctionDeclaration.js +11 -45
- package/generators/ts/_ObjectType/toRdfFunctionOrMethodDeclaration.d.ts +10 -0
- package/generators/ts/_ObjectType/toRdfFunctionOrMethodDeclaration.js +67 -0
- package/generators/ts/objectInitializer.d.ts +2 -0
- package/generators/ts/objectInitializer.js +14 -0
- package/generators/ts/tsComment.d.ts +5 -0
- package/generators/ts/tsComment.js +11 -0
- package/generators/ts/tsName.d.ts +1 -1
- package/generators/ts/tsName.js +1 -0
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/input/NodeShape.d.ts +46 -0
- package/input/NodeShape.js +165 -0
- package/input/Ontology.d.ts +13 -0
- package/input/Ontology.js +30 -0
- package/input/PropertyShape.d.ts +15 -0
- package/input/PropertyShape.js +34 -0
- package/input/Shape.d.ts +4 -0
- package/input/Shape.js +2 -0
- package/input/ShapesGraph.d.ts +9 -0
- package/input/ShapesGraph.js +50 -0
- package/input/ancestorClassIris.d.ts +4 -0
- package/input/ancestorClassIris.js +21 -0
- package/input/descendantClassIris.d.ts +4 -0
- package/input/descendantClassIris.js +21 -0
- package/input/generated.d.ts +275 -0
- package/input/generated.js +1436 -0
- package/input/index.d.ts +7 -0
- package/input/index.js +7 -0
- package/input/tsFeatures.d.ts +10 -0
- package/input/tsFeatures.js +46 -0
- package/package.json +15 -9
- package/ast/MintingStrategy.d.ts +0 -8
- package/ast/MintingStrategy.js +0 -9
- package/generators/ts/Configuration.d.ts +0 -29
- package/generators/ts/Configuration.js +0 -40
- package/generators/ts/IntersectionType.d.ts +0 -14
- package/generators/ts/IntersectionType.js +0 -26
- package/generators/ts/RdfjsTermType.d.ts +0 -25
- package/generators/ts/RdfjsTermType.js +0 -46
- package/generators/ts/_ObjectType/fromRdfFunctionDeclaration.d.ts +0 -4
- package/generators/ts/_ObjectType/fromRdfFunctionDeclaration.js +0 -72
- package/generators/ts/_ObjectType/sparqlGraphPatternsClassDeclaration.d.ts +0 -4
- package/generators/ts/_ObjectType/sparqlGraphPatternsClassDeclaration.js +0 -46
- package/generators/ts/rdfjsTermExpression.d.ts +0 -5
- package/vocabularies/dashDataset.d.ts +0 -3
- package/vocabularies/dashDataset.js +0 -2370
- package/vocabularies/index.d.ts +0 -2
- package/vocabularies/index.js +0 -2
- package/vocabularies/shaclmate.d.ts +0 -15
- package/vocabularies/shaclmate.js +0 -6
|
@@ -1,26 +1,37 @@
|
|
|
1
1
|
import type { NamedNode } from "@rdfjs/types";
|
|
2
2
|
import { Maybe } from "purify-ts";
|
|
3
|
-
import { MintingStrategy } from "../../
|
|
3
|
+
import type { MintingStrategy, TsFeature } from "../../enums/index.js";
|
|
4
|
+
import { Import } from "./Import.js";
|
|
4
5
|
import { Type } from "./Type.js";
|
|
5
6
|
export declare class ListType extends Type {
|
|
6
7
|
readonly itemType: Type;
|
|
7
8
|
readonly kind = "ListType";
|
|
9
|
+
readonly mutable: boolean;
|
|
8
10
|
private readonly identifierNodeKind;
|
|
9
11
|
private readonly mintingStrategy;
|
|
10
|
-
private readonly
|
|
11
|
-
constructor({ identifierNodeKind, itemType, mintingStrategy,
|
|
12
|
+
private readonly toRdfTypes;
|
|
13
|
+
constructor({ identifierNodeKind, itemType, mintingStrategy, mutable, toRdfTypes, ...superParameters }: {
|
|
12
14
|
identifierNodeKind: ListType["identifierNodeKind"];
|
|
13
15
|
itemType: Type;
|
|
14
16
|
mintingStrategy: Maybe<MintingStrategy>;
|
|
15
|
-
|
|
17
|
+
mutable: boolean;
|
|
18
|
+
toRdfTypes: readonly NamedNode[];
|
|
16
19
|
} & ConstructorParameters<typeof Type>[0]);
|
|
20
|
+
get conversions(): readonly Type.Conversion[];
|
|
17
21
|
get discriminatorProperty(): Maybe<Type.DiscriminatorProperty>;
|
|
18
|
-
get
|
|
22
|
+
get equalsFunction(): string;
|
|
23
|
+
get jsonName(): string;
|
|
19
24
|
get name(): string;
|
|
20
|
-
|
|
21
|
-
equalsFunction(): string;
|
|
25
|
+
fromJsonExpression({ variables, }: Parameters<Type["fromJsonExpression"]>[0]): string;
|
|
22
26
|
fromRdfExpression({ variables, }: Parameters<Type["fromRdfExpression"]>[0]): string;
|
|
23
|
-
hashStatements({ variables, }: Parameters<Type["hashStatements"]>[0]): readonly string[];
|
|
27
|
+
hashStatements({ depth, variables, }: Parameters<Type["hashStatements"]>[0]): readonly string[];
|
|
28
|
+
jsonUiSchemaElement(parameters: Parameters<Type["jsonUiSchemaElement"]>[0]): ReturnType<Type["jsonUiSchemaElement"]>;
|
|
29
|
+
jsonZodSchema(parameters: Parameters<Type["jsonZodSchema"]>[0]): ReturnType<Type["jsonZodSchema"]>;
|
|
30
|
+
snippetDeclarations(features: Set<TsFeature>): readonly string[];
|
|
31
|
+
sparqlConstructTemplateTriples({ variables, context, }: Parameters<Type["sparqlConstructTemplateTriples"]>[0]): readonly string[];
|
|
32
|
+
sparqlWherePatterns({ variables, context, }: Parameters<Type["sparqlWherePatterns"]>[0]): readonly string[];
|
|
33
|
+
toJsonExpression({ variables, }: Parameters<Type["toJsonExpression"]>[0]): string;
|
|
24
34
|
toRdfExpression({ variables, }: Parameters<Type["toRdfExpression"]>[0]): string;
|
|
35
|
+
useImports(features: Set<TsFeature>): readonly Import[];
|
|
25
36
|
}
|
|
26
37
|
//# sourceMappingURL=ListType.d.ts.map
|
|
@@ -1,74 +1,229 @@
|
|
|
1
|
-
import { NodeKind } from "@shaclmate/shacl-ast";
|
|
2
1
|
import { rdf } from "@tpluscode/rdf-ns-builders";
|
|
3
2
|
import { Maybe } from "purify-ts";
|
|
4
|
-
import {
|
|
3
|
+
import { Import } from "./Import.js";
|
|
4
|
+
import { SnippetDeclarations } from "./SnippetDeclarations.js";
|
|
5
5
|
import { Type } from "./Type.js";
|
|
6
|
+
import { objectInitializer } from "./objectInitializer.js";
|
|
6
7
|
export class ListType extends Type {
|
|
7
|
-
constructor({ identifierNodeKind, itemType, mintingStrategy,
|
|
8
|
+
constructor({ identifierNodeKind, itemType, mintingStrategy, mutable, toRdfTypes, ...superParameters }) {
|
|
8
9
|
super(superParameters);
|
|
9
10
|
this.kind = "ListType";
|
|
10
11
|
this.identifierNodeKind = identifierNodeKind;
|
|
11
12
|
this.itemType = itemType;
|
|
12
|
-
this.mintingStrategy = mintingStrategy.orDefault(
|
|
13
|
-
this.
|
|
13
|
+
this.mintingStrategy = mintingStrategy.orDefault("sha256");
|
|
14
|
+
this.mutable = mutable;
|
|
15
|
+
this.toRdfTypes = toRdfTypes;
|
|
16
|
+
}
|
|
17
|
+
get conversions() {
|
|
18
|
+
return [
|
|
19
|
+
{
|
|
20
|
+
conversionExpression: (value) => value,
|
|
21
|
+
sourceTypeCheckExpression: (value) => `Array.isArray(${value})`,
|
|
22
|
+
sourceTypeName: this.name,
|
|
23
|
+
},
|
|
24
|
+
];
|
|
14
25
|
}
|
|
15
26
|
get discriminatorProperty() {
|
|
16
27
|
return Maybe.empty();
|
|
17
28
|
}
|
|
18
|
-
get
|
|
19
|
-
|
|
20
|
-
return ['import { sha256 } from "js-sha256";'];
|
|
21
|
-
}
|
|
22
|
-
return [];
|
|
29
|
+
get equalsFunction() {
|
|
30
|
+
return `((left, right) => arrayEquals(left, right, ${this.itemType.equalsFunction}))`;
|
|
23
31
|
}
|
|
24
|
-
get
|
|
25
|
-
return `readonly ${this.itemType.
|
|
32
|
+
get jsonName() {
|
|
33
|
+
return `readonly (${this.itemType.jsonName})[]`;
|
|
26
34
|
}
|
|
27
|
-
|
|
28
|
-
return
|
|
29
|
-
.chainSparqlGraphPatternExpression({
|
|
30
|
-
variables: {
|
|
31
|
-
subject: "itemVariable",
|
|
32
|
-
},
|
|
33
|
-
})
|
|
34
|
-
.map((itemSparqlGraphPatternsExpression) => `itemGraphPatterns: (itemVariable) => ${itemSparqlGraphPatternsExpression.toSparqlGraphPatternsExpression()}, `)
|
|
35
|
-
.orDefault("")} rdfList: ${variables.subject} })`));
|
|
35
|
+
get name() {
|
|
36
|
+
return `${this.mutable ? "" : "readonly "}${this.itemType.name}[]`;
|
|
36
37
|
}
|
|
37
|
-
|
|
38
|
-
return
|
|
38
|
+
fromJsonExpression({ variables, }) {
|
|
39
|
+
return `${variables.value}.map(_item => (${this.itemType.fromJsonExpression({ variables: { value: "_item" } })}))`;
|
|
39
40
|
}
|
|
40
41
|
fromRdfExpression({ variables, }) {
|
|
41
|
-
|
|
42
|
+
const chain = [variables.resourceValues];
|
|
43
|
+
chain.push("head()");
|
|
44
|
+
chain.push("chain(value => value.toList())");
|
|
45
|
+
chain.push(`map(values => values.flatMap(_value => ${this.itemType.fromRdfExpression({ variables: { ...variables, resourceValues: "_value.toValues()" } })}.toMaybe().toList()))`);
|
|
46
|
+
return chain.join(".");
|
|
42
47
|
}
|
|
43
|
-
hashStatements({ variables, }) {
|
|
48
|
+
hashStatements({ depth, variables, }) {
|
|
44
49
|
return [
|
|
45
|
-
`for (const
|
|
50
|
+
`for (const _element${depth} of ${variables.value}) { ${this.itemType.hashStatements({ depth: depth + 1, variables: { ...variables, value: `_element${depth}` } }).join("\n")} }`,
|
|
46
51
|
];
|
|
47
52
|
}
|
|
53
|
+
jsonUiSchemaElement(parameters) {
|
|
54
|
+
return this.itemType.jsonUiSchemaElement(parameters);
|
|
55
|
+
}
|
|
56
|
+
jsonZodSchema(parameters) {
|
|
57
|
+
return `${this.itemType.jsonZodSchema(parameters)}.array()`;
|
|
58
|
+
}
|
|
59
|
+
snippetDeclarations(features) {
|
|
60
|
+
const snippetDeclarations = [];
|
|
61
|
+
if (features.has("equals")) {
|
|
62
|
+
snippetDeclarations.push(SnippetDeclarations.arrayEquals);
|
|
63
|
+
}
|
|
64
|
+
return snippetDeclarations;
|
|
65
|
+
}
|
|
66
|
+
sparqlConstructTemplateTriples({ variables, context, }) {
|
|
67
|
+
switch (context) {
|
|
68
|
+
case "property":
|
|
69
|
+
return super.sparqlConstructTemplateTriples({ context, variables });
|
|
70
|
+
case "type": {
|
|
71
|
+
const triples = [];
|
|
72
|
+
const listVariable = variables.subject;
|
|
73
|
+
const variable = (suffix) => `${this.dataFactoryVariable}.variable!(\`\${${variables.variablePrefix}}${suffix}\`)`;
|
|
74
|
+
const variablePrefix = (suffix) => `\`\${${variables.variablePrefix}}${suffix}\``;
|
|
75
|
+
{
|
|
76
|
+
// ?list rdf:first ?item0
|
|
77
|
+
const item0Variable = variable("Item0");
|
|
78
|
+
triples.push(objectInitializer({
|
|
79
|
+
subject: listVariable,
|
|
80
|
+
predicate: this.rdfjsTermExpression(rdf.first),
|
|
81
|
+
object: item0Variable,
|
|
82
|
+
}), ...this.itemType.sparqlConstructTemplateTriples({
|
|
83
|
+
context: "type",
|
|
84
|
+
variables: {
|
|
85
|
+
subject: item0Variable,
|
|
86
|
+
variablePrefix: variablePrefix("Item0"),
|
|
87
|
+
},
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
{
|
|
91
|
+
// ?list rdf:rest ?rest0
|
|
92
|
+
const rest0Variable = variable("Rest0");
|
|
93
|
+
triples.push(objectInitializer({
|
|
94
|
+
subject: listVariable,
|
|
95
|
+
predicate: this.rdfjsTermExpression(rdf.rest),
|
|
96
|
+
object: rest0Variable,
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
99
|
+
// Don't do ?list rdf:rest+ ?restN in CONSTRUCT
|
|
100
|
+
const restNVariable = variable("RestN");
|
|
101
|
+
{
|
|
102
|
+
// ?rest rdf:first ?itemN
|
|
103
|
+
const itemNVariable = variable("ItemN");
|
|
104
|
+
triples.push(objectInitializer({
|
|
105
|
+
subject: restNVariable,
|
|
106
|
+
predicate: this.rdfjsTermExpression(rdf.first),
|
|
107
|
+
object: itemNVariable,
|
|
108
|
+
}), ...this.itemType.sparqlConstructTemplateTriples({
|
|
109
|
+
context: "type",
|
|
110
|
+
variables: {
|
|
111
|
+
subject: itemNVariable,
|
|
112
|
+
variablePrefix: variablePrefix("ItemN"),
|
|
113
|
+
},
|
|
114
|
+
}));
|
|
115
|
+
}
|
|
116
|
+
// ?restN rdf:rest ?restNBasic to get the rdf:rest statement in the CONSTRUCT
|
|
117
|
+
triples.push(objectInitializer({
|
|
118
|
+
subject: restNVariable,
|
|
119
|
+
predicate: this.rdfjsTermExpression(rdf.rest),
|
|
120
|
+
object: variable("RestNBasic"),
|
|
121
|
+
}));
|
|
122
|
+
return triples;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
sparqlWherePatterns({ variables, context, }) {
|
|
127
|
+
switch (context) {
|
|
128
|
+
case "property":
|
|
129
|
+
return super.sparqlWherePatterns({ context, variables });
|
|
130
|
+
case "type": {
|
|
131
|
+
const patterns = [];
|
|
132
|
+
const listVariable = variables.subject;
|
|
133
|
+
const variable = (suffix) => `${this.dataFactoryVariable}.variable!(\`\${${variables.variablePrefix}}${suffix}\`)`;
|
|
134
|
+
const variablePrefix = (suffix) => `\`\${${variables.variablePrefix}}${suffix}\``;
|
|
135
|
+
{
|
|
136
|
+
// ?list rdf:first ?item0
|
|
137
|
+
const item0Variable = variable("Item0");
|
|
138
|
+
patterns.push(`{ type: "bgp", triples: [${objectInitializer({
|
|
139
|
+
subject: listVariable,
|
|
140
|
+
predicate: this.rdfjsTermExpression(rdf.first),
|
|
141
|
+
object: item0Variable,
|
|
142
|
+
})}] }`, ...this.itemType.sparqlWherePatterns({
|
|
143
|
+
context: "type",
|
|
144
|
+
variables: {
|
|
145
|
+
subject: item0Variable,
|
|
146
|
+
variablePrefix: variablePrefix("Item0"),
|
|
147
|
+
},
|
|
148
|
+
}));
|
|
149
|
+
}
|
|
150
|
+
{
|
|
151
|
+
// ?list rdf:rest ?rest0
|
|
152
|
+
const rest0Variable = variable("Rest0");
|
|
153
|
+
patterns.push(`{ type: "bgp", triples: [${objectInitializer({
|
|
154
|
+
subject: listVariable,
|
|
155
|
+
predicate: this.rdfjsTermExpression(rdf.rest),
|
|
156
|
+
object: rest0Variable,
|
|
157
|
+
})}] }`);
|
|
158
|
+
}
|
|
159
|
+
const optionalPatterns = [];
|
|
160
|
+
const restNVariable = variable("RestN");
|
|
161
|
+
// ?list rdf:rest+ ?restN
|
|
162
|
+
optionalPatterns.push(`{ type: "bgp", triples: [${objectInitializer({
|
|
163
|
+
subject: listVariable,
|
|
164
|
+
predicate: `{ type: "path", pathType: "*", items: [${this.rdfjsTermExpression(rdf.rest)}] }`,
|
|
165
|
+
object: restNVariable,
|
|
166
|
+
})}] }`);
|
|
167
|
+
{
|
|
168
|
+
// ?rest rdf:first ?itemN
|
|
169
|
+
const itemNVariable = variable("ItemN");
|
|
170
|
+
optionalPatterns.push(`{ type: "bgp", triples: [${objectInitializer({
|
|
171
|
+
subject: restNVariable,
|
|
172
|
+
predicate: this.rdfjsTermExpression(rdf.first),
|
|
173
|
+
object: itemNVariable,
|
|
174
|
+
})}] }`, ...this.itemType.sparqlWherePatterns({
|
|
175
|
+
context: "type",
|
|
176
|
+
variables: {
|
|
177
|
+
subject: itemNVariable,
|
|
178
|
+
variablePrefix: variablePrefix("ItemN"),
|
|
179
|
+
},
|
|
180
|
+
}));
|
|
181
|
+
}
|
|
182
|
+
// ?restN rdf:rest ?restNBasic to get the rdf:rest statement in the CONSTRUCT
|
|
183
|
+
optionalPatterns.push(`{ type: "bgp", triples: [${objectInitializer({
|
|
184
|
+
subject: restNVariable,
|
|
185
|
+
predicate: this.rdfjsTermExpression(rdf.rest),
|
|
186
|
+
object: variable("RestNBasic"),
|
|
187
|
+
})}] }`);
|
|
188
|
+
patterns.push(`{ type: "optional", patterns: [${optionalPatterns.join(", ")}] }`);
|
|
189
|
+
return patterns;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
toJsonExpression({ variables, }) {
|
|
194
|
+
let expression = variables.value;
|
|
195
|
+
const itemFromJsonExpression = this.itemType.fromJsonExpression({
|
|
196
|
+
variables: { value: "_item" },
|
|
197
|
+
});
|
|
198
|
+
if (itemFromJsonExpression !== "_item") {
|
|
199
|
+
expression = `${expression}.map(_item => (${itemFromJsonExpression}))`;
|
|
200
|
+
}
|
|
201
|
+
return `${variables.value}.map(_item => (${this.itemType.toJsonExpression({ variables: { value: "_item" } })}))`;
|
|
202
|
+
}
|
|
48
203
|
toRdfExpression({ variables, }) {
|
|
49
204
|
let listIdentifier;
|
|
50
205
|
let mutableResourceTypeName;
|
|
51
206
|
let resourceSetMethodName;
|
|
52
207
|
let subListIdentifier;
|
|
53
208
|
switch (this.identifierNodeKind) {
|
|
54
|
-
case
|
|
209
|
+
case "BlankNode": {
|
|
55
210
|
listIdentifier = subListIdentifier = "dataFactory.blankNode()";
|
|
56
211
|
mutableResourceTypeName = "rdfjsResource.MutableResource";
|
|
57
212
|
resourceSetMethodName = "mutableResource";
|
|
58
213
|
break;
|
|
59
214
|
}
|
|
60
|
-
case
|
|
215
|
+
case "NamedNode": {
|
|
61
216
|
switch (this.mintingStrategy) {
|
|
62
|
-
case
|
|
217
|
+
case "sha256":
|
|
63
218
|
listIdentifier = `dataFactory.namedNode(\`urn:shaclmate:list:\${${variables.value}.reduce(
|
|
64
|
-
(
|
|
65
|
-
${this.itemType.hashStatements({ variables: { hasher: "
|
|
66
|
-
return
|
|
219
|
+
(_hasher, _item) => {
|
|
220
|
+
${this.itemType.hashStatements({ depth: 0, variables: { hasher: "_hasher", value: "_item" } }).join("\n")}
|
|
221
|
+
return _hasher;
|
|
67
222
|
},
|
|
68
223
|
sha256.create(),
|
|
69
224
|
)}\`)`;
|
|
70
225
|
break;
|
|
71
|
-
case
|
|
226
|
+
case "uuidv4":
|
|
72
227
|
listIdentifier =
|
|
73
228
|
"dataFactory.namedNode(`urn:shaclmate:list:${uuid.v4()}`)";
|
|
74
229
|
break;
|
|
@@ -81,23 +236,23 @@ export class ListType extends Type {
|
|
|
81
236
|
break;
|
|
82
237
|
}
|
|
83
238
|
}
|
|
84
|
-
return `${variables.value}.reduce(({ currentSubListResource, listResource }, item, itemIndex) => {
|
|
239
|
+
return `${variables.value}.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
85
240
|
if (itemIndex === 0) {
|
|
86
241
|
currentSubListResource = listResource;
|
|
87
242
|
} else {
|
|
88
|
-
const newSubListResource = ${variables.resourceSet}.${resourceSetMethodName}({
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
243
|
+
const newSubListResource = ${variables.resourceSet}.${resourceSetMethodName}(${objectInitializer({
|
|
244
|
+
identifier: subListIdentifier,
|
|
245
|
+
mutateGraph: variables.mutateGraph,
|
|
246
|
+
})});
|
|
92
247
|
currentSubListResource!.add(dataFactory.namedNode("${rdf.rest.value}"), newSubListResource.identifier);
|
|
93
248
|
currentSubListResource = newSubListResource;
|
|
94
249
|
}
|
|
95
250
|
|
|
96
|
-
${this.
|
|
251
|
+
${this.toRdfTypes.map((rdfType) => `currentSubListResource.add(dataFactory.namedNode("${rdf.type.value}"), dataFactory.namedNode("${rdfType.value}"))`).join("\n")}
|
|
97
252
|
|
|
98
253
|
currentSubListResource.add(dataFactory.namedNode("${rdf.first.value}"), ${this.itemType.toRdfExpression({ variables: { mutateGraph: variables.mutateGraph, predicate: `dataFactory.namedNode("${rdf.first.value}")`, resource: "currentSubListResource", resourceSet: variables.resourceSet, value: "item" } })});
|
|
99
254
|
|
|
100
|
-
if (itemIndex + 1 ===
|
|
255
|
+
if (itemIndex + 1 === list.length) {
|
|
101
256
|
currentSubListResource.add(dataFactory.namedNode("${rdf.rest.value}"), dataFactory.namedNode("${rdf.nil.value}"));
|
|
102
257
|
}
|
|
103
258
|
|
|
@@ -105,15 +260,22 @@ export class ListType extends Type {
|
|
|
105
260
|
},
|
|
106
261
|
{
|
|
107
262
|
currentSubListResource: null,
|
|
108
|
-
listResource: resourceSet.${resourceSetMethodName}({
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
263
|
+
listResource: resourceSet.${resourceSetMethodName}(${objectInitializer({
|
|
264
|
+
identifier: listIdentifier,
|
|
265
|
+
mutateGraph: variables.mutateGraph,
|
|
266
|
+
})}),
|
|
112
267
|
} as {
|
|
113
268
|
currentSubListResource: ${mutableResourceTypeName} | null;
|
|
114
269
|
listResource: ${mutableResourceTypeName};
|
|
115
270
|
},
|
|
116
271
|
).listResource.identifier`;
|
|
117
272
|
}
|
|
273
|
+
useImports(features) {
|
|
274
|
+
const imports = this.itemType.useImports(features).concat();
|
|
275
|
+
if (features.has("hash") && this.identifierNodeKind === "NamedNode") {
|
|
276
|
+
imports.push(Import.SHA256);
|
|
277
|
+
}
|
|
278
|
+
return imports;
|
|
279
|
+
}
|
|
118
280
|
}
|
|
119
281
|
//# sourceMappingURL=ListType.js.map
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import type { Literal } from "@rdfjs/types";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
get
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
import { TermType } from "./TermType.js";
|
|
3
|
+
export declare class LiteralType extends TermType<Literal> {
|
|
4
|
+
private readonly languageIn;
|
|
5
|
+
constructor({ languageIn, ...superParameters }: {
|
|
6
|
+
languageIn: readonly string[];
|
|
7
|
+
} & Omit<ConstructorParameters<typeof TermType<Literal>>[0], "nodeKinds">);
|
|
8
|
+
get jsonName(): string;
|
|
9
|
+
fromJsonExpression({ variables, }: Parameters<TermType<Literal>["fromJsonExpression"]>[0]): string;
|
|
10
|
+
hashStatements({ depth, variables, }: Parameters<TermType<Literal>["hashStatements"]>[0]): readonly string[];
|
|
11
|
+
jsonZodSchema({ variables, }: Parameters<TermType<Literal>["jsonZodSchema"]>[0]): ReturnType<TermType<Literal>["jsonZodSchema"]>;
|
|
12
|
+
propertyFromRdfResourceValueExpression({ variables, }: Parameters<TermType<Literal>["propertyFromRdfResourceValueExpression"]>[0]): string;
|
|
13
|
+
toJsonExpression({ variables, }: Parameters<TermType<Literal>["toJsonExpression"]>[0]): string;
|
|
14
|
+
protected propertyFilterRdfResourceValuesExpression({ variables, }: Parameters<TermType<Literal>["propertyFilterRdfResourceValuesExpression"]>[0]): string;
|
|
13
15
|
}
|
|
14
16
|
//# sourceMappingURL=LiteralType.d.ts.map
|
|
@@ -1,61 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
get conversions() {
|
|
10
|
-
const conversions = [];
|
|
11
|
-
conversions.push({
|
|
12
|
-
conversionExpression: (value) => `rdfLiteral.toRdf(${value})`,
|
|
13
|
-
sourceTypeName: "boolean",
|
|
1
|
+
import { xsd } from "@tpluscode/rdf-ns-builders";
|
|
2
|
+
import { TermType } from "./TermType.js";
|
|
3
|
+
export class LiteralType extends TermType {
|
|
4
|
+
constructor({ languageIn, ...superParameters }) {
|
|
5
|
+
super({
|
|
6
|
+
...superParameters,
|
|
7
|
+
nodeKinds: new Set(["Literal"]),
|
|
14
8
|
});
|
|
15
|
-
|
|
16
|
-
conversionExpression: (value) => `rdfLiteral.toRdf(${value})`,
|
|
17
|
-
sourceTypeCheckExpression: (value) => `typeof ${value} === "object" && ${value} instanceof Date`,
|
|
18
|
-
sourceTypeName: "Date",
|
|
19
|
-
});
|
|
20
|
-
conversions.push({
|
|
21
|
-
conversionExpression: (value) => `rdfLiteral.toRdf(${value})`,
|
|
22
|
-
sourceTypeName: "number",
|
|
23
|
-
});
|
|
24
|
-
conversions.push({
|
|
25
|
-
conversionExpression: (value) => `${this.configuration.dataFactoryVariable}.literal(${value})`,
|
|
26
|
-
sourceTypeName: "string",
|
|
27
|
-
});
|
|
28
|
-
this.defaultValue.ifJust((defaultValue) => {
|
|
29
|
-
conversions.push({
|
|
30
|
-
conversionExpression: () => rdfjsTermExpression(defaultValue, this.configuration),
|
|
31
|
-
sourceTypeName: "undefined",
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
conversions.push({
|
|
35
|
-
conversionExpression: (value) => value,
|
|
36
|
-
sourceTypeCheckExpression: (value) => `typeof ${value} === "object"`,
|
|
37
|
-
sourceTypeName: this.name,
|
|
38
|
-
});
|
|
39
|
-
return conversions;
|
|
9
|
+
this.languageIn = languageIn;
|
|
40
10
|
}
|
|
41
|
-
get
|
|
42
|
-
return
|
|
43
|
-
name: "termType",
|
|
44
|
-
type: "string",
|
|
45
|
-
values: ["Literal"],
|
|
46
|
-
});
|
|
11
|
+
get jsonName() {
|
|
12
|
+
return '{ readonly "@language": string | undefined, readonly "@type": string | undefined, readonly "@value": string }';
|
|
47
13
|
}
|
|
48
|
-
|
|
49
|
-
return ["
|
|
14
|
+
fromJsonExpression({ variables, }) {
|
|
15
|
+
return `${this.dataFactoryVariable}.literal(${variables.value}["@value"], typeof ${variables.value}["@language"] !== "undefined" ? ${variables.value}["@language"] : (typeof ${variables.value}["@type"] !== "undefined" ? dataFactory.namedNode(${variables.value}["@type"]) : undefined))`;
|
|
50
16
|
}
|
|
51
|
-
|
|
52
|
-
return
|
|
17
|
+
hashStatements({ depth, variables, }) {
|
|
18
|
+
return [
|
|
19
|
+
`${variables.hasher}.update(${variables.value}.datatype.value);`,
|
|
20
|
+
`${variables.hasher}.update(${variables.value}.language);`,
|
|
21
|
+
].concat(super.hashStatements({ depth, variables }));
|
|
53
22
|
}
|
|
54
|
-
|
|
23
|
+
jsonZodSchema({ variables, }) {
|
|
24
|
+
return `${variables.zod}.object({ "@language": ${variables.zod}.string().optional(), "@type": ${variables.zod}.string().optional(), "@value": ${variables.zod}.string() })`;
|
|
25
|
+
}
|
|
26
|
+
propertyFromRdfResourceValueExpression({ variables, }) {
|
|
55
27
|
return `${variables.resourceValue}.toLiteral()`;
|
|
56
28
|
}
|
|
57
|
-
|
|
58
|
-
return
|
|
29
|
+
toJsonExpression({ variables, }) {
|
|
30
|
+
return `{ "@language": ${variables.value}.language.length > 0 ? ${variables.value}.language : undefined, "@type": ${variables.value}.datatype.value !== "${xsd.string.value}" ? ${variables.value}.datatype.value : undefined, "@value": ${variables.value}.value }`;
|
|
31
|
+
}
|
|
32
|
+
propertyFilterRdfResourceValuesExpression({ variables, }) {
|
|
33
|
+
return `${variables.resourceValues}.filter(_value => {
|
|
34
|
+
const _languageInOrDefault = ${variables.languageIn} ?? ${JSON.stringify(this.languageIn)};
|
|
35
|
+
if (_languageInOrDefault.length === 0) {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
const _valueLiteral = _value.toLiteral().toMaybe().extract();
|
|
39
|
+
if (typeof _valueLiteral === "undefined") {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
return _languageInOrDefault.some(_languageIn => _languageIn === _valueLiteral.language);
|
|
43
|
+
})`;
|
|
59
44
|
}
|
|
60
45
|
}
|
|
61
46
|
//# sourceMappingURL=LiteralType.js.map
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { PrimitiveType } from "./PrimitiveType.js";
|
|
2
|
-
|
|
2
|
+
import type { Type } from "./Type.js";
|
|
3
|
+
export declare class NumberType extends PrimitiveType<number> {
|
|
4
|
+
readonly kind = "NumberType";
|
|
5
|
+
get conversions(): readonly Type.Conversion[];
|
|
3
6
|
get name(): string;
|
|
4
|
-
|
|
5
|
-
|
|
7
|
+
jsonZodSchema({ variables, }: Parameters<Type["jsonZodSchema"]>[0]): ReturnType<Type["jsonZodSchema"]>;
|
|
8
|
+
propertyFromRdfResourceValueExpression({ variables, }: Parameters<PrimitiveType<number>["propertyFromRdfResourceValueExpression"]>[0]): string;
|
|
9
|
+
toRdfExpression({ variables, }: Parameters<PrimitiveType<string>["toRdfExpression"]>[0]): string;
|
|
6
10
|
}
|
|
7
11
|
//# sourceMappingURL=NumberType.d.ts.map
|
|
@@ -1,13 +1,64 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { Memoize } from "typescript-memoize";
|
|
1
8
|
import { PrimitiveType } from "./PrimitiveType.js";
|
|
9
|
+
import { objectInitializer } from "./objectInitializer.js";
|
|
2
10
|
export class NumberType extends PrimitiveType {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.kind = "NumberType";
|
|
14
|
+
}
|
|
15
|
+
get conversions() {
|
|
16
|
+
const conversions = [
|
|
17
|
+
{
|
|
18
|
+
conversionExpression: (value) => value,
|
|
19
|
+
sourceTypeCheckExpression: (value) => `typeof ${value} === "number"`,
|
|
20
|
+
sourceTypeName: this.name,
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
this.primitiveDefaultValue.ifJust((defaultValue) => {
|
|
24
|
+
conversions.push({
|
|
25
|
+
conversionExpression: () => defaultValue.toString(),
|
|
26
|
+
sourceTypeCheckExpression: (value) => `typeof ${value} === "undefined"`,
|
|
27
|
+
sourceTypeName: "undefined",
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
return conversions;
|
|
31
|
+
}
|
|
3
32
|
get name() {
|
|
33
|
+
if (this.primitiveIn.length > 0) {
|
|
34
|
+
return this.primitiveIn.map((value) => value.toString()).join(" | ");
|
|
35
|
+
}
|
|
4
36
|
return "number";
|
|
5
37
|
}
|
|
6
|
-
|
|
7
|
-
|
|
38
|
+
jsonZodSchema({ variables, }) {
|
|
39
|
+
switch (this.primitiveIn.length) {
|
|
40
|
+
case 0:
|
|
41
|
+
return `${variables.zod}.number()`;
|
|
42
|
+
case 1:
|
|
43
|
+
return `${variables.zod}.literal(${this.primitiveIn[0]})`;
|
|
44
|
+
default:
|
|
45
|
+
return `${variables.zod}.union([${this.primitiveIn.map((value) => `${variables.zod}.literal(${value})`).join(", ")}])`;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
propertyFromRdfResourceValueExpression({ variables, }) {
|
|
49
|
+
let expression = `${variables.resourceValue}.toNumber()`;
|
|
50
|
+
if (this.primitiveIn.length > 0) {
|
|
51
|
+
expression = `${expression}.chain(value => { switch (value) { ${this.primitiveIn.map((value) => `case ${value}:`).join(" ")} return purify.Either.of(value); default: return purify.Left(new rdfjsResource.Resource.MistypedValueError(${objectInitializer({ actualValue: "rdfLiteral.toRdf(value)", expectedValueType: JSON.stringify(this.name), focusResource: variables.resource, predicate: variables.predicate })})); } })`;
|
|
52
|
+
}
|
|
53
|
+
return expression;
|
|
8
54
|
}
|
|
9
|
-
|
|
10
|
-
return
|
|
55
|
+
toRdfExpression({ variables, }) {
|
|
56
|
+
return this.primitiveDefaultValue
|
|
57
|
+
.map((defaultValue) => `${variables.value} !== ${defaultValue} ? ${variables.value} : undefined`)
|
|
58
|
+
.orDefault(variables.value);
|
|
11
59
|
}
|
|
12
60
|
}
|
|
61
|
+
__decorate([
|
|
62
|
+
Memoize()
|
|
63
|
+
], NumberType.prototype, "name", null);
|
|
13
64
|
//# sourceMappingURL=NumberType.js.map
|