@shaclmate/compiler 2.0.23 → 2.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.d.ts +5 -5
- package/dist/ShapesGraphToAstTransformer.js +5 -5
- package/dist/_ShapesGraphToAstTransformer/InheritableShapeConstraints.d.ts +2 -0
- package/dist/_ShapesGraphToAstTransformer/InheritableShapeConstraints.js +2 -0
- package/dist/_ShapesGraphToAstTransformer/ShapeStack.d.ts +15 -0
- package/dist/_ShapesGraphToAstTransformer/ShapeStack.js +51 -0
- package/dist/_ShapesGraphToAstTransformer/index.d.ts +5 -5
- package/dist/_ShapesGraphToAstTransformer/index.js +5 -5
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +77 -29
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompositeType.d.ts +10 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompositeType.js +185 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstIdentifierType.d.ts +10 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstIdentifierType.js +32 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstLiteralType.d.ts +10 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstLiteralType.js +46 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.d.ts +12 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.js +24 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.d.ts +13 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.js +14 -0
- package/dist/ast/OptionType.d.ts +0 -2
- package/dist/ast/SetType.d.ts +1 -6
- package/dist/ast/index.d.ts +1 -0
- package/dist/ast/index.js +1 -0
- package/dist/generators/json/AstJsonGenerator.js +7 -1
- package/dist/generators/ts/BooleanType.d.ts +1 -1
- package/dist/generators/ts/BooleanType.js +1 -1
- package/dist/generators/ts/DateTimeType.d.ts +1 -1
- package/dist/generators/ts/DateTimeType.js +1 -1
- package/dist/generators/ts/IdentifierType.d.ts +6 -1
- package/dist/generators/ts/IdentifierType.js +20 -14
- package/dist/generators/ts/ListType.js +16 -5
- package/dist/generators/ts/LiteralType.d.ts +9 -2
- package/dist/generators/ts/LiteralType.js +79 -15
- package/dist/generators/ts/NumberType.d.ts +1 -1
- package/dist/generators/ts/NumberType.js +1 -1
- package/dist/generators/ts/ObjectType.d.ts +1 -2
- package/dist/generators/ts/ObjectType.js +4 -5
- package/dist/generators/ts/ObjectUnionType.d.ts +1 -0
- package/dist/generators/ts/ObjectUnionType.js +18 -9
- package/dist/generators/ts/OptionType.d.ts +1 -1
- package/dist/generators/ts/OptionType.js +6 -4
- package/dist/generators/ts/PrimitiveType.d.ts +19 -1
- package/dist/generators/ts/PrimitiveType.js +16 -3
- package/dist/generators/ts/SetType.d.ts +4 -4
- package/dist/generators/ts/SetType.js +15 -12
- package/dist/generators/ts/SnippetDeclarations.d.ts +1 -1
- package/dist/generators/ts/SnippetDeclarations.js +13 -2
- package/dist/generators/ts/StringType.d.ts +1 -1
- package/dist/generators/ts/StringType.js +8 -8
- package/dist/generators/ts/TermType.d.ts +7 -19
- package/dist/generators/ts/TermType.js +44 -51
- package/dist/generators/ts/TsGenerator.js +4 -1
- package/dist/generators/ts/Type.d.ts +12 -2
- package/dist/generators/ts/Type.js +1 -0
- package/dist/generators/ts/TypeFactory.d.ts +8 -0
- package/dist/generators/ts/TypeFactory.js +112 -22
- package/dist/generators/ts/UnionType.js +1 -1
- package/dist/generators/ts/_ObjectType/EagerShaclProperty.js +3 -2
- package/dist/generators/ts/_ObjectType/IdentifierPrefixProperty.d.ts +1 -1
- package/dist/generators/ts/_ObjectType/IdentifierPrefixProperty.js +15 -1
- package/dist/generators/ts/_ObjectType/IdentifierProperty.d.ts +6 -6
- package/dist/generators/ts/_ObjectType/IdentifierProperty.js +59 -29
- package/dist/generators/ts/_ObjectType/LazyShaclProperty.d.ts +14 -1
- package/dist/generators/ts/_ObjectType/LazyShaclProperty.js +89 -11
- package/dist/generators/ts/_ObjectType/Property.d.ts +9 -3
- package/dist/generators/ts/_ObjectType/ShaclProperty.d.ts +1 -1
- package/dist/generators/ts/_ObjectType/ShaclProperty.js +14 -2
- package/dist/generators/ts/_ObjectType/TypeDiscriminatorProperty.d.ts +1 -1
- package/dist/generators/ts/_ObjectType/TypeDiscriminatorProperty.js +1 -1
- package/dist/generators/ts/_ObjectType/classDeclaration.js +16 -12
- package/dist/generators/ts/_ObjectType/createFunctionDeclaration.js +22 -10
- package/dist/generators/ts/_ObjectType/equalsFunctionOrMethodDeclaration.js +3 -1
- package/dist/generators/ts/_ObjectType/graphqlTypeVariableStatement.js +14 -2
- package/dist/generators/ts/_ObjectType/rdfFunctionDeclarations.js +71 -79
- package/dist/generators/ts/_ObjectType/sparqlConstructQueryFunctionDeclaration.js +3 -3
- package/dist/generators/ts/_ObjectType/sparqlConstructQueryStringFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_ObjectType/sparqlFunctionDeclarations.js +6 -2
- package/dist/generators/ts/_ObjectType/toRdfFunctionOrMethodDeclaration.js +19 -12
- package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.js +5 -5
- package/dist/generators/ts/sparqlObjectSetClassDeclaration.js +6 -6
- package/dist/input/PropertyPath.d.ts +1 -2
- package/dist/input/PropertyPath.js +6 -8
- package/dist/input/ShapesGraph.js +4 -8
- package/dist/input/generated.d.ts +96 -54
- package/dist/input/generated.js +1350 -744
- package/package.json +5 -5
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstCompositeType.d.ts +0 -12
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstCompositeType.js +0 -193
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstIdentifierType.d.ts +0 -12
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstIdentifierType.js +0 -29
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstLiteralType.d.ts +0 -12
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstLiteralType.js +0 -43
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstTermType.d.ts +0 -14
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstTermType.js +0 -21
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstType.d.ts +0 -15
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstType.js +0 -60
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Try to convert a shape to a type using some heuristics.
|
|
3
|
+
*
|
|
4
|
+
* We don't try to handle exotic cases allowed by the SHACL spec, such as combinations of sh:in and sh:node. Instead we assume
|
|
5
|
+
* a shape has one type.
|
|
6
|
+
*/
|
|
7
|
+
export function transformShapeToAstType(shape, shapeStack) {
|
|
8
|
+
// Try to transform the property shape into an AST type without cardinality constraints
|
|
9
|
+
return this.transformShapeToAstCompositeType(shape, shapeStack)
|
|
10
|
+
.altLazy(() => this.transformShapeToAstIdentifierType(shape, shapeStack))
|
|
11
|
+
.altLazy(() => this.transformShapeToAstLiteralType(shape, shapeStack))
|
|
12
|
+
.altLazy(() => this.transformShapeToAstTermType(shape, shapeStack));
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=transformShapeToAstType.js.map
|
package/dist/ast/OptionType.d.ts
CHANGED
package/dist/ast/SetType.d.ts
CHANGED
|
@@ -2,15 +2,10 @@ import type { Maybe } from "purify-ts";
|
|
|
2
2
|
import type { Type } from "./Type.js";
|
|
3
3
|
/**
|
|
4
4
|
* An unordered set of items of a specific type.
|
|
5
|
-
*
|
|
6
|
-
* This is a property with sh:maxCount != 1.
|
|
7
5
|
*/
|
|
8
6
|
export interface SetType<ItemTypeT extends Type = Type> {
|
|
9
|
-
/**
|
|
10
|
-
* Set item type.
|
|
11
|
-
*/
|
|
12
|
-
readonly itemType: ItemTypeT;
|
|
13
7
|
readonly kind: "SetType";
|
|
8
|
+
readonly itemType: ItemTypeT;
|
|
14
9
|
/**
|
|
15
10
|
* Minimum number of items in the set.
|
|
16
11
|
*/
|
package/dist/ast/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from "./Name.js";
|
|
|
7
7
|
export * from "./ObjectIntersectionType.js";
|
|
8
8
|
export * from "./ObjectType.js";
|
|
9
9
|
export * from "./ObjectUnionType.js";
|
|
10
|
+
export * from "./SetType.js";
|
|
10
11
|
export * from "./UnionType.js";
|
|
11
12
|
export * from "./TermType.js";
|
|
12
13
|
export * from "./Type.js";
|
package/dist/ast/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export * from "./Name.js";
|
|
|
7
7
|
export * from "./ObjectIntersectionType.js";
|
|
8
8
|
export * from "./ObjectType.js";
|
|
9
9
|
export * from "./ObjectUnionType.js";
|
|
10
|
+
export * from "./SetType.js";
|
|
10
11
|
export * from "./UnionType.js";
|
|
11
12
|
export * from "./TermType.js";
|
|
12
13
|
export * from "./Type.js";
|
|
@@ -119,11 +119,17 @@ export class AstJsonGenerator {
|
|
|
119
119
|
kind: objectType.kind,
|
|
120
120
|
name: nameToJson(objectType.name),
|
|
121
121
|
properties: objectType.properties.map((property) => ({
|
|
122
|
-
|
|
122
|
+
comment: property.comment.extract(),
|
|
123
|
+
description: property.description.extract(),
|
|
124
|
+
label: property.label.extract(),
|
|
123
125
|
mutable: property.mutable.extract(),
|
|
126
|
+
name: nameToJson(property.name),
|
|
127
|
+
order: property.order,
|
|
124
128
|
path: property.path.iri.value,
|
|
125
129
|
recursive: property.recursive ? true : undefined,
|
|
130
|
+
stubType: property.stubType.map(typeToJson).extract(),
|
|
126
131
|
type: typeToJson(property.type),
|
|
132
|
+
visibility: property.visibility,
|
|
127
133
|
})),
|
|
128
134
|
})),
|
|
129
135
|
}, undefined, 2);
|
|
@@ -7,7 +7,7 @@ export declare class BooleanType extends PrimitiveType<boolean> {
|
|
|
7
7
|
get graphqlName(): Type.GraphqlName;
|
|
8
8
|
get name(): string;
|
|
9
9
|
jsonZodSchema({ variables, }: Parameters<Type["jsonZodSchema"]>[0]): ReturnType<Type["jsonZodSchema"]>;
|
|
10
|
-
|
|
10
|
+
fromRdfResourceValueExpression({ variables, }: Parameters<PrimitiveType<boolean>["fromRdfResourceValueExpression"]>[0]): string;
|
|
11
11
|
toRdfExpression({ variables, }: Parameters<PrimitiveType<string>["toRdfExpression"]>[0]): string;
|
|
12
12
|
}
|
|
13
13
|
//# sourceMappingURL=BooleanType.d.ts.map
|
|
@@ -43,7 +43,7 @@ export class BooleanType extends PrimitiveType {
|
|
|
43
43
|
}
|
|
44
44
|
return `${variables.zod}.boolean()`;
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
fromRdfResourceValueExpression({ variables, }) {
|
|
47
47
|
let expression = `${variables.resourceValue}.toBoolean()`;
|
|
48
48
|
if (this.primitiveIn.length === 1) {
|
|
49
49
|
const eitherTypeParameters = `<Error, ${this.name}>`;
|
|
@@ -15,7 +15,7 @@ export declare class DateTimeType extends PrimitiveType<Date> {
|
|
|
15
15
|
fromJsonExpression({ variables, }: Parameters<Type["fromJsonExpression"]>[0]): string;
|
|
16
16
|
hashStatements({ variables, }: Parameters<Type["hashStatements"]>[0]): readonly string[];
|
|
17
17
|
jsonZodSchema({ variables, }: Parameters<Type["jsonZodSchema"]>[0]): ReturnType<Type["jsonZodSchema"]>;
|
|
18
|
-
|
|
18
|
+
fromRdfResourceValueExpression({ variables, }: Parameters<PrimitiveType<number>["fromRdfResourceValueExpression"]>[0]): string;
|
|
19
19
|
snippetDeclarations({ features, }: Parameters<PrimitiveType<Date>["snippetDeclarations"]>[0]): readonly string[];
|
|
20
20
|
toJsonExpression({ variables, }: Parameters<PrimitiveType<Date>["toJsonExpression"]>[0]): string;
|
|
21
21
|
toRdfExpression({ variables, }: Parameters<PrimitiveType<Date>["toRdfExpression"]>[0]): string;
|
|
@@ -54,7 +54,7 @@ export class DateTimeType extends PrimitiveType {
|
|
|
54
54
|
jsonZodSchema({ variables, }) {
|
|
55
55
|
return `${variables.zod}.string().${this.zodDatatype}()`;
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
fromRdfResourceValueExpression({ variables, }) {
|
|
58
58
|
let expression = `${variables.resourceValue}.toDate()`;
|
|
59
59
|
if (this.primitiveIn.length > 0) {
|
|
60
60
|
const eitherTypeParameters = `<Error, ${this.name}>`;
|
|
@@ -12,9 +12,14 @@ export declare class IdentifierType extends TermType<NamedNode, BlankNode | Name
|
|
|
12
12
|
get name(): string;
|
|
13
13
|
get toStringFunctionDeclaration(): VariableStatementStructure;
|
|
14
14
|
fromJsonExpression({ variables, }: Parameters<TermType<NamedNode, BlankNode | NamedNode>["fromJsonExpression"]>[0]): string;
|
|
15
|
+
protected fromRdfExpressionChain({ variables, }: Parameters<Type["fromRdfExpression"]>[0]): {
|
|
16
|
+
defaultValue?: string;
|
|
17
|
+
hasValues?: string;
|
|
18
|
+
languageIn?: string;
|
|
19
|
+
valueTo?: string;
|
|
20
|
+
};
|
|
15
21
|
graphqlResolveExpression({ variables: { value }, }: Parameters<Type["graphqlResolveExpression"]>[0]): string;
|
|
16
22
|
jsonZodSchema({ variables, }: Parameters<TermType<NamedNode, BlankNode | NamedNode>["jsonZodSchema"]>[0]): ReturnType<TermType<NamedNode, BlankNode | NamedNode>["jsonZodSchema"]>;
|
|
17
23
|
toJsonExpression({ variables, }: Parameters<TermType<NamedNode, BlankNode | NamedNode>["toJsonExpression"]>[0]): string;
|
|
18
|
-
protected propertyFromRdfResourceValueExpression({ variables, }: Parameters<TermType<NamedNode, BlankNode | NamedNode>["propertyFromRdfResourceValueExpression"]>[0]): string;
|
|
19
24
|
}
|
|
20
25
|
//# sourceMappingURL=IdentifierType.d.ts.map
|
|
@@ -121,6 +121,26 @@ export class IdentifierType extends TermType {
|
|
|
121
121
|
return valueToNamedNode;
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
+
fromRdfExpressionChain({ variables, }) {
|
|
125
|
+
let valueToExpression;
|
|
126
|
+
if (this.nodeKinds.size === 2) {
|
|
127
|
+
valueToExpression = "value.toIdentifier()";
|
|
128
|
+
}
|
|
129
|
+
else if (this.isNamedNodeKind) {
|
|
130
|
+
valueToExpression = "value.toIri()";
|
|
131
|
+
if (this.in_.length > 0) {
|
|
132
|
+
const eitherTypeParameters = `<Error, ${this.name}>`;
|
|
133
|
+
valueToExpression = `${valueToExpression}.chain(iri => { switch (iri.value) { ${this.in_.map((iri) => `case "${iri.value}": return purify.Either.of${eitherTypeParameters}(iri as rdfjs.NamedNode<"${iri.value}">);`).join(" ")} default: return purify.Left${eitherTypeParameters}(new rdfjsResource.Resource.MistypedValueError({ actualValue: iri, expectedValueType: ${JSON.stringify(this.name)}, focusResource: ${variables.resource}, predicate: ${variables.predicate} })); } } )`;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
throw new Error("not implemented");
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
...super.fromRdfExpressionChain,
|
|
141
|
+
valueTo: `chain(values => values.chainMap(value => ${valueToExpression}))`,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
124
144
|
graphqlResolveExpression({ variables: { value }, }) {
|
|
125
145
|
return `rdfjsResource.Resource.Identifier.toString(${value})`;
|
|
126
146
|
}
|
|
@@ -149,20 +169,6 @@ export class IdentifierType extends TermType {
|
|
|
149
169
|
return valueToNamedNode;
|
|
150
170
|
}
|
|
151
171
|
}
|
|
152
|
-
propertyFromRdfResourceValueExpression({ variables, }) {
|
|
153
|
-
if (this.nodeKinds.size === 2) {
|
|
154
|
-
return `${variables.resourceValue}.toIdentifier()`;
|
|
155
|
-
}
|
|
156
|
-
if (this.isNamedNodeKind) {
|
|
157
|
-
let expression = `${variables.resourceValue}.toIri()`;
|
|
158
|
-
if (this.in_.length > 0) {
|
|
159
|
-
const eitherTypeParameters = `<Error, ${this.name}>`;
|
|
160
|
-
expression = `${expression}.chain(iri => { switch (iri.value) { ${this.in_.map((iri) => `case "${iri.value}": return purify.Either.of${eitherTypeParameters}(iri as rdfjs.NamedNode<"${iri.value}">);`).join(" ")} default: return purify.Left${eitherTypeParameters}(new rdfjsResource.Resource.MistypedValueError({ actualValue: iri, expectedValueType: ${JSON.stringify(this.name)}, focusResource: ${variables.resource}, predicate: ${variables.predicate} })); } } )`;
|
|
161
|
-
}
|
|
162
|
-
return expression;
|
|
163
|
-
}
|
|
164
|
-
throw new Error(`not implemented: ${this.name}`);
|
|
165
|
-
}
|
|
166
172
|
}
|
|
167
173
|
__decorate([
|
|
168
174
|
Memoize()
|
|
@@ -63,11 +63,20 @@ export class ListType extends Type {
|
|
|
63
63
|
return `${variables.value}.map(item => (${this.itemType.fromJsonExpression({ variables: { value: "item" } })}))`;
|
|
64
64
|
}
|
|
65
65
|
fromRdfExpression({ variables, }) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
return [
|
|
67
|
+
variables.resourceValues,
|
|
68
|
+
"chain(values => values.chainMap(value => value.toList()))", // Resource.Values<Resource.Value> to Resource.Values<Resource.Value[]>
|
|
69
|
+
`chain(valueLists =>
|
|
70
|
+
valueLists.chainMap(
|
|
71
|
+
valueList => ${this.itemType.fromRdfExpression({
|
|
72
|
+
variables: {
|
|
73
|
+
...variables,
|
|
74
|
+
resourceValues: `purify.Either.of<Error, rdfjsResource.Resource.Values<rdfjsResource.Resource.Value>>(rdfjsResource.Resource.Values.fromArray({ objects: valueList, predicate: ${variables.predicate}, subject: ${variables.resource} }))`,
|
|
75
|
+
},
|
|
76
|
+
})}
|
|
77
|
+
))`, // Resource.Values<Resource.Value[]> to Resource.Values<item type arrays>
|
|
78
|
+
`map(valueLists => valueLists.map(valueList => valueList.toArray()${this.mutable ? ".concat()" : ""}))`, // Convert inner Resource.Values to arrays
|
|
79
|
+
].join(".");
|
|
71
80
|
}
|
|
72
81
|
graphqlResolveExpression({ variables, }) {
|
|
73
82
|
return variables.value;
|
|
@@ -180,6 +189,7 @@ export class ListType extends Type {
|
|
|
180
189
|
allowIgnoreRdfType: true,
|
|
181
190
|
context: "subject",
|
|
182
191
|
variables: {
|
|
192
|
+
languageIn: parameters.variables.languageIn,
|
|
183
193
|
subject: item0Variable,
|
|
184
194
|
variablePrefix: variablePrefix("Item0"),
|
|
185
195
|
},
|
|
@@ -213,6 +223,7 @@ export class ListType extends Type {
|
|
|
213
223
|
allowIgnoreRdfType: true,
|
|
214
224
|
context: "subject",
|
|
215
225
|
variables: {
|
|
226
|
+
languageIn: parameters.variables.languageIn,
|
|
216
227
|
subject: itemNVariable,
|
|
217
228
|
variablePrefix: variablePrefix("ItemN"),
|
|
218
229
|
},
|
|
@@ -8,10 +8,17 @@ export declare class LiteralType extends TermType<Literal, Literal> {
|
|
|
8
8
|
} & Omit<ConstructorParameters<typeof TermType<Literal, Literal>>[0], "nodeKinds">);
|
|
9
9
|
get jsonName(): Type.JsonName;
|
|
10
10
|
fromJsonExpression({ variables, }: Parameters<TermType<Literal, Literal>["fromJsonExpression"]>[0]): string;
|
|
11
|
+
protected fromRdfExpressionChain({ variables, }: Parameters<Type["fromRdfExpression"]>[0]): {
|
|
12
|
+
defaultValue?: string;
|
|
13
|
+
hasValues?: string;
|
|
14
|
+
languageIn?: string;
|
|
15
|
+
valueTo?: string;
|
|
16
|
+
};
|
|
11
17
|
hashStatements({ depth, variables, }: Parameters<TermType<Literal, Literal>["hashStatements"]>[0]): readonly string[];
|
|
12
18
|
jsonZodSchema({ variables, }: Parameters<TermType<Literal, Literal>["jsonZodSchema"]>[0]): ReturnType<TermType<Literal, Literal>["jsonZodSchema"]>;
|
|
13
|
-
|
|
19
|
+
sparqlWherePatterns(parameters: Parameters<Type["sparqlWherePatterns"]>[0] & {
|
|
20
|
+
ignoreLanguageIn?: boolean;
|
|
21
|
+
}): readonly string[];
|
|
14
22
|
toJsonExpression({ variables, }: Parameters<TermType<Literal, Literal>["toJsonExpression"]>[0]): string;
|
|
15
|
-
protected propertyFilterRdfResourceValuesExpression({ variables, }: Parameters<TermType<Literal, Literal>["propertyFilterRdfResourceValuesExpression"]>[0]): string;
|
|
16
23
|
}
|
|
17
24
|
//# sourceMappingURL=LiteralType.d.ts.map
|
|
@@ -5,6 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { xsd } from "@tpluscode/rdf-ns-builders";
|
|
8
|
+
import { invariant } from "ts-invariant";
|
|
8
9
|
import { Memoize } from "typescript-memoize";
|
|
9
10
|
import { TermType } from "./TermType.js";
|
|
10
11
|
import { Type } from "./Type.js";
|
|
@@ -23,6 +24,49 @@ export class LiteralType extends TermType {
|
|
|
23
24
|
fromJsonExpression({ variables, }) {
|
|
24
25
|
return `dataFactory.literal(${variables.value}["@value"], typeof ${variables.value}["@language"] !== "undefined" ? ${variables.value}["@language"] : (typeof ${variables.value}["@type"] !== "undefined" ? dataFactory.namedNode(${variables.value}["@type"]) : undefined))`;
|
|
25
26
|
}
|
|
27
|
+
fromRdfExpressionChain({ variables, }) {
|
|
28
|
+
return {
|
|
29
|
+
...super.fromRdfExpressionChain({ variables }),
|
|
30
|
+
languageIn: `chain(values => {
|
|
31
|
+
const literalValuesEither = values.chainMap(value => value.toLiteral());
|
|
32
|
+
if (literalValuesEither.isLeft()) {
|
|
33
|
+
return literalValuesEither;
|
|
34
|
+
}
|
|
35
|
+
const literalValues = literalValuesEither.unsafeCoerce();
|
|
36
|
+
|
|
37
|
+
const nonUniqueLanguageIn = ${variables.languageIn} ?? ${JSON.stringify(this.languageIn)};
|
|
38
|
+
if (nonUniqueLanguageIn.length === 0) {
|
|
39
|
+
return purify.Either.of<Error, rdfjsResource.Resource.Values<rdfjs.Literal>>(literalValues);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
let uniqueLanguageIn: string[];
|
|
43
|
+
if (nonUniqueLanguageIn.length === 1) {
|
|
44
|
+
uniqueLanguageIn = [nonUniqueLanguageIn[0]];
|
|
45
|
+
} else {
|
|
46
|
+
uniqueLanguageIn = [];
|
|
47
|
+
for (const languageIn of nonUniqueLanguageIn) {
|
|
48
|
+
if (uniqueLanguageIn.indexOf(languageIn) === -1) {
|
|
49
|
+
uniqueLanguageIn.push(languageIn);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Return all literals for the first languageIn, then all literals for the second languageIn, etc.
|
|
55
|
+
// Within a languageIn the literals may be in any order.
|
|
56
|
+
let filteredLiteralValues: rdfjsResource.Resource.Values<rdfjs.Literal> | undefined;
|
|
57
|
+
for (const languageIn of uniqueLanguageIn) {
|
|
58
|
+
if (!filteredLiteralValues) {
|
|
59
|
+
filteredLiteralValues = literalValues.filter(value => value.language === languageIn);
|
|
60
|
+
} else {
|
|
61
|
+
filteredLiteralValues = filteredLiteralValues.concat(...literalValues.filter(value => value.language === languageIn).toArray());
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return purify.Either.of<Error, rdfjsResource.Resource.Values<rdfjs.Literal>>(filteredLiteralValues!);
|
|
66
|
+
})`,
|
|
67
|
+
valueTo: undefined,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
26
70
|
hashStatements({ depth, variables, }) {
|
|
27
71
|
return [
|
|
28
72
|
`${variables.hasher}.update(${variables.value}.datatype.value);`,
|
|
@@ -32,25 +76,45 @@ export class LiteralType extends TermType {
|
|
|
32
76
|
jsonZodSchema({ variables, }) {
|
|
33
77
|
return `${variables.zod}.object({ "@language": ${variables.zod}.string().optional(), "@type": ${variables.zod}.string().optional(), "@value": ${variables.zod}.string() })`;
|
|
34
78
|
}
|
|
35
|
-
|
|
36
|
-
|
|
79
|
+
sparqlWherePatterns(parameters) {
|
|
80
|
+
const { context, ignoreLanguageIn, variables } = parameters;
|
|
81
|
+
const superPatterns = super.sparqlWherePatterns(parameters);
|
|
82
|
+
if (ignoreLanguageIn || context === "subject") {
|
|
83
|
+
return superPatterns;
|
|
84
|
+
}
|
|
85
|
+
invariant(this.name.indexOf("rdfjs.Literal") !== -1, this.name);
|
|
86
|
+
return superPatterns.concat(`...[(${variables.languageIn} && ${variables.languageIn}.length > 0) ? ${variables.languageIn} : ${JSON.stringify(this.languageIn)}]
|
|
87
|
+
.filter(languagesIn => languagesIn.length > 0)
|
|
88
|
+
.map(languagesIn =>
|
|
89
|
+
languagesIn.map(languageIn =>
|
|
90
|
+
({
|
|
91
|
+
type: "operation" as const,
|
|
92
|
+
operator: "=",
|
|
93
|
+
args: [
|
|
94
|
+
{ type: "operation" as const, operator: "lang", args: [${variables.object}] },
|
|
95
|
+
dataFactory.literal(languageIn)
|
|
96
|
+
]
|
|
97
|
+
})
|
|
98
|
+
)
|
|
99
|
+
)
|
|
100
|
+
.map(langEqualsExpressions =>
|
|
101
|
+
({
|
|
102
|
+
type: "filter" as const,
|
|
103
|
+
expression:
|
|
104
|
+
langEqualsExpressions.length === 1
|
|
105
|
+
? langEqualsExpressions[0]
|
|
106
|
+
:
|
|
107
|
+
{
|
|
108
|
+
type: "operation" as const,
|
|
109
|
+
operator: "||",
|
|
110
|
+
args: langEqualsExpressions
|
|
111
|
+
},
|
|
112
|
+
})
|
|
113
|
+
)`);
|
|
37
114
|
}
|
|
38
115
|
toJsonExpression({ variables, }) {
|
|
39
116
|
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 }`;
|
|
40
117
|
}
|
|
41
|
-
propertyFilterRdfResourceValuesExpression({ variables, }) {
|
|
42
|
-
return `${variables.resourceValues}.filter(_value => {
|
|
43
|
-
const _languageInOrDefault = ${variables.languageIn} ?? ${JSON.stringify(this.languageIn)};
|
|
44
|
-
if (_languageInOrDefault.length === 0) {
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
const _valueLiteral = _value.toLiteral().toMaybe().extract();
|
|
48
|
-
if (typeof _valueLiteral === "undefined") {
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
return _languageInOrDefault.some(_languageIn => _languageIn === _valueLiteral.language);
|
|
52
|
-
})`;
|
|
53
|
-
}
|
|
54
118
|
}
|
|
55
119
|
__decorate([
|
|
56
120
|
Memoize()
|
|
@@ -6,7 +6,7 @@ export declare abstract class NumberType extends PrimitiveType<number> {
|
|
|
6
6
|
get conversions(): readonly Type.Conversion[];
|
|
7
7
|
get name(): string;
|
|
8
8
|
jsonZodSchema({ variables, }: Parameters<Type["jsonZodSchema"]>[0]): ReturnType<Type["jsonZodSchema"]>;
|
|
9
|
-
|
|
9
|
+
protected fromRdfResourceValueExpression({ variables, }: Parameters<PrimitiveType<number>["fromRdfResourceValueExpression"]>[0]): string;
|
|
10
10
|
toRdfExpression({ variables, }: Parameters<PrimitiveType<string>["toRdfExpression"]>[0]): string;
|
|
11
11
|
}
|
|
12
12
|
//# sourceMappingURL=NumberType.d.ts.map
|
|
@@ -43,7 +43,7 @@ export class NumberType extends PrimitiveType {
|
|
|
43
43
|
return `${variables.zod}.union([${this.primitiveIn.map((value) => `${variables.zod}.literal(${value})`).join(", ")}])`;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
fromRdfResourceValueExpression({ variables, }) {
|
|
47
47
|
let expression = `${variables.resourceValue}.toNumber()`;
|
|
48
48
|
if (this.primitiveIn.length > 0) {
|
|
49
49
|
const eitherTypeParameters = `<Error, ${this.name}>`;
|
|
@@ -10,7 +10,6 @@ import { Type } from "./Type.js";
|
|
|
10
10
|
export declare class ObjectType extends DeclaredType {
|
|
11
11
|
private readonly imports;
|
|
12
12
|
protected readonly comment: Maybe<string>;
|
|
13
|
-
protected readonly identifierMintingStrategy: Maybe<IdentifierMintingStrategy>;
|
|
14
13
|
protected readonly label: Maybe<string>;
|
|
15
14
|
protected readonly toRdfTypes: readonly NamedNode[];
|
|
16
15
|
readonly abstract: boolean;
|
|
@@ -21,7 +20,7 @@ export declare class ObjectType extends DeclaredType {
|
|
|
21
20
|
readonly staticModuleName: string;
|
|
22
21
|
readonly synthetic: boolean;
|
|
23
22
|
readonly typeof = "object";
|
|
24
|
-
constructor({ abstract, comment, declarationType, extern, fromRdfType, imports,
|
|
23
|
+
constructor({ abstract, comment, declarationType, extern, fromRdfType, imports, label, lazyAncestorObjectTypes, lazyChildObjectTypes, lazyDescendantObjectTypes, lazyParentObjectTypes, lazyProperties, staticModuleName, synthetic, toRdfTypes, ...superParameters }: {
|
|
25
24
|
abstract: boolean;
|
|
26
25
|
comment: Maybe<string>;
|
|
27
26
|
declarationType: TsObjectDeclarationType;
|
|
@@ -19,7 +19,6 @@ import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
|
|
|
19
19
|
export class ObjectType extends DeclaredType {
|
|
20
20
|
imports;
|
|
21
21
|
comment;
|
|
22
|
-
identifierMintingStrategy;
|
|
23
22
|
label;
|
|
24
23
|
toRdfTypes;
|
|
25
24
|
abstract;
|
|
@@ -30,14 +29,13 @@ export class ObjectType extends DeclaredType {
|
|
|
30
29
|
staticModuleName;
|
|
31
30
|
synthetic;
|
|
32
31
|
typeof = "object";
|
|
33
|
-
constructor({ abstract, comment, declarationType, extern, fromRdfType, imports,
|
|
32
|
+
constructor({ abstract, comment, declarationType, extern, fromRdfType, imports, label, lazyAncestorObjectTypes, lazyChildObjectTypes, lazyDescendantObjectTypes, lazyParentObjectTypes, lazyProperties, staticModuleName, synthetic, toRdfTypes, ...superParameters }) {
|
|
34
33
|
super(superParameters);
|
|
35
34
|
this.abstract = abstract;
|
|
36
35
|
this.comment = comment;
|
|
37
36
|
this.declarationType = declarationType;
|
|
38
37
|
this.extern = extern;
|
|
39
38
|
this.fromRdfType = fromRdfType;
|
|
40
|
-
this.identifierMintingStrategy = identifierMintingStrategy;
|
|
41
39
|
this.imports = imports;
|
|
42
40
|
this.label = label;
|
|
43
41
|
// Lazily initialize some members in getters to avoid recursive construction
|
|
@@ -171,7 +169,7 @@ export class ObjectType extends DeclaredType {
|
|
|
171
169
|
case "class":
|
|
172
170
|
return `new ${this.name}(${parameters})`;
|
|
173
171
|
case "interface":
|
|
174
|
-
return `${this.staticModuleName}
|
|
172
|
+
return `${this.staticModuleName}.${syntheticNamePrefix}create(${parameters})`;
|
|
175
173
|
}
|
|
176
174
|
}
|
|
177
175
|
get objectSetMethodNames() {
|
|
@@ -223,7 +221,7 @@ export class ObjectType extends DeclaredType {
|
|
|
223
221
|
return `${this.staticModuleName}.${syntheticNamePrefix}fromJson(${variables.value}).unsafeCoerce()`;
|
|
224
222
|
}
|
|
225
223
|
fromRdfExpression({ variables, }) {
|
|
226
|
-
return `${variables.resourceValues}.
|
|
224
|
+
return `${variables.resourceValues}.chain(values => values.chainMap(value => value.toResource().chain(resource => ${this.staticModuleName}.${syntheticNamePrefix}fromRdf(resource, { ...${variables.context}, ${variables.ignoreRdfType ? "ignoreRdfType: true, " : ""}languageIn: ${variables.languageIn}, objectSet: ${variables.objectSet} }))))`;
|
|
227
225
|
}
|
|
228
226
|
graphqlResolveExpression({ variables, }) {
|
|
229
227
|
return variables.value;
|
|
@@ -301,6 +299,7 @@ export class ObjectType extends DeclaredType {
|
|
|
301
299
|
return [
|
|
302
300
|
`...${this.staticModuleName}.${syntheticNamePrefix}sparqlWherePatterns(${objectInitializer({
|
|
303
301
|
ignoreRdfType: parameters.allowIgnoreRdfType ? true : undefined, // Can ignore the rdf:type when the object is nested
|
|
302
|
+
languageIn: parameters.variables.languageIn,
|
|
304
303
|
subject: parameters.variables.subject,
|
|
305
304
|
variablePrefix: parameters.variables.variablePrefix,
|
|
306
305
|
})})`,
|
|
@@ -25,6 +25,7 @@ declare class MemberType {
|
|
|
25
25
|
get staticModuleName(): string;
|
|
26
26
|
get toRdfjsResourceType(): string;
|
|
27
27
|
jsonZodSchema(parameters: Parameters<DeclaredType["jsonZodSchema"]>[0]): string;
|
|
28
|
+
newExpression(parameters: Parameters<ObjectType["newExpression"]>[0]): string;
|
|
28
29
|
snippetDeclarations(parameters: Parameters<DeclaredType["snippetDeclarations"]>[0]): readonly string[];
|
|
29
30
|
useImports(): readonly Import[];
|
|
30
31
|
}
|
|
@@ -81,6 +81,9 @@ class MemberType {
|
|
|
81
81
|
jsonZodSchema(parameters) {
|
|
82
82
|
return this.delegate.jsonZodSchema(parameters);
|
|
83
83
|
}
|
|
84
|
+
newExpression(parameters) {
|
|
85
|
+
return this.delegate.newExpression(parameters);
|
|
86
|
+
}
|
|
84
87
|
snippetDeclarations(parameters) {
|
|
85
88
|
return this.delegate.snippetDeclarations(parameters);
|
|
86
89
|
}
|
|
@@ -270,14 +273,19 @@ return ${syntheticNamePrefix}strictEquals(left.${syntheticNamePrefix}type, right
|
|
|
270
273
|
name: `${syntheticNamePrefix}fromRdf`,
|
|
271
274
|
parameters: [
|
|
272
275
|
{
|
|
273
|
-
name: "
|
|
274
|
-
type:
|
|
276
|
+
name: "resource",
|
|
277
|
+
type: "rdfjsResource.Resource",
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
hasQuestionToken: true,
|
|
281
|
+
name: "options",
|
|
282
|
+
type: `{ [_index: string]: any; ignoreRdfType?: boolean; languageIn?: readonly string[]; objectSet?: ${syntheticNamePrefix}ObjectSet }`,
|
|
275
283
|
},
|
|
276
284
|
],
|
|
277
285
|
returnType: `purify.Either<Error, ${this.name}>`,
|
|
278
286
|
statements: [
|
|
279
287
|
`return ${this.memberTypes.reduce((expression, memberType) => {
|
|
280
|
-
const memberTypeExpression = `(${memberType.staticModuleName}.${syntheticNamePrefix}fromRdf({ ...
|
|
288
|
+
const memberTypeExpression = `(${memberType.staticModuleName}.${syntheticNamePrefix}fromRdf(resource, { ...options, ignoreRdfType: false }) as purify.Either<Error, ${this.name}>)`;
|
|
281
289
|
return expression.length > 0
|
|
282
290
|
? `${expression}.altLazy(() => ${memberTypeExpression})`
|
|
283
291
|
: memberTypeExpression;
|
|
@@ -298,7 +306,7 @@ return ${syntheticNamePrefix}strictEquals(left.${syntheticNamePrefix}type, right
|
|
|
298
306
|
initializer: `new graphql.GraphQLUnionType(${objectInitializer({
|
|
299
307
|
description: this.comment.map(JSON.stringify).extract(),
|
|
300
308
|
name: `"${this.name}"`,
|
|
301
|
-
resolveType: `
|
|
309
|
+
resolveType: `(value: ${this.name}) => value.${syntheticNamePrefix}type`,
|
|
302
310
|
types: `[${this.memberTypes.map((memberType) => memberType.graphqlName.nullableName).join(", ")}]`,
|
|
303
311
|
})})`,
|
|
304
312
|
},
|
|
@@ -427,7 +435,7 @@ return ${syntheticNamePrefix}strictEquals(left.${syntheticNamePrefix}type, right
|
|
|
427
435
|
{
|
|
428
436
|
hasQuestionToken: true,
|
|
429
437
|
name: "parameters",
|
|
430
|
-
type: '{ ignoreRdfType?: boolean; subject?: sparqljs.Triple["subject"], variablePrefix?: string }',
|
|
438
|
+
type: '{ ignoreRdfType?: boolean; languageIn?: readonly string[]; subject?: sparqljs.Triple["subject"], variablePrefix?: string }',
|
|
431
439
|
},
|
|
432
440
|
],
|
|
433
441
|
returnType: "readonly sparqljs.Pattern[]",
|
|
@@ -501,8 +509,9 @@ return ${syntheticNamePrefix}strictEquals(left.${syntheticNamePrefix}type, right
|
|
|
501
509
|
type: this.name,
|
|
502
510
|
},
|
|
503
511
|
{
|
|
512
|
+
hasQuestionToken: true,
|
|
504
513
|
name: parametersVariable,
|
|
505
|
-
type: "{ mutateGraph
|
|
514
|
+
type: "{ mutateGraph?: rdfjsResource.MutableResource.MutateGraph, resourceSet?: rdfjsResource.MutableResourceSet }",
|
|
506
515
|
},
|
|
507
516
|
],
|
|
508
517
|
returnType: (() => {
|
|
@@ -537,7 +546,7 @@ return ${syntheticNamePrefix}strictEquals(left.${syntheticNamePrefix}type, right
|
|
|
537
546
|
}
|
|
538
547
|
fromRdfExpression({ variables, }) {
|
|
539
548
|
// Don't ignoreRdfType, we may need it to distinguish the union members
|
|
540
|
-
return `${variables.resourceValues}.
|
|
549
|
+
return `${variables.resourceValues}.chain(values => values.chainMap(value => value.toResource().chain(resource => ${this.staticModuleName}.${syntheticNamePrefix}fromRdf(resource, { ...${variables.context}, ignoreRdfType: false, languageIn: ${variables.languageIn}, objectSet: ${variables.objectSet} }))))`;
|
|
541
550
|
}
|
|
542
551
|
graphqlResolveExpression({ variables, }) {
|
|
543
552
|
return variables.value;
|
|
@@ -590,6 +599,7 @@ return ${syntheticNamePrefix}strictEquals(left.${syntheticNamePrefix}type, right
|
|
|
590
599
|
case "subject":
|
|
591
600
|
return [
|
|
592
601
|
`...${this.staticModuleName}.${syntheticNamePrefix}sparqlWherePatterns(${objectInitializer({
|
|
602
|
+
languageIn: parameters.variables.languageIn,
|
|
593
603
|
subject: parameters.variables.subject,
|
|
594
604
|
variablePrefix: parameters.variables.variablePrefix,
|
|
595
605
|
})})`,
|
|
@@ -601,8 +611,7 @@ return ${syntheticNamePrefix}strictEquals(left.${syntheticNamePrefix}type, right
|
|
|
601
611
|
case "class":
|
|
602
612
|
return `${variables.value}.${syntheticNamePrefix}toJson()`;
|
|
603
613
|
case "interface":
|
|
604
|
-
|
|
605
|
-
// return `${this.name}.toJson(${variables.value})`;
|
|
614
|
+
return `${this.staticModuleName}.${syntheticNamePrefix}toJson(${variables.value})`;
|
|
606
615
|
}
|
|
607
616
|
}
|
|
608
617
|
toRdfExpression({ variables, }) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import { Import } from "./Import.js";
|
|
3
3
|
import { Type } from "./Type.js";
|
|
4
|
-
export declare class OptionType<ItemTypeT extends Type
|
|
4
|
+
export declare class OptionType<ItemTypeT extends Type> extends Type {
|
|
5
5
|
readonly discriminatorProperty: Maybe<Type.DiscriminatorProperty>;
|
|
6
6
|
readonly itemType: ItemTypeT;
|
|
7
7
|
readonly kind = "OptionType";
|
|
@@ -4,8 +4,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
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
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { Maybe } from "purify-ts";
|
|
8
7
|
import { Memoize } from "typescript-memoize";
|
|
8
|
+
import { Maybe } from "purify-ts";
|
|
9
9
|
import { invariant } from "ts-invariant";
|
|
10
10
|
import { Import } from "./Import.js";
|
|
11
11
|
import { SnippetDeclarations } from "./SnippetDeclarations.js";
|
|
@@ -73,7 +73,8 @@ export class OptionType extends Type {
|
|
|
73
73
|
: `${expression}.map(item => (${itemFromJsonExpression}))`;
|
|
74
74
|
}
|
|
75
75
|
fromRdfExpression(parameters) {
|
|
76
|
-
|
|
76
|
+
const { variables } = parameters;
|
|
77
|
+
return `${this.itemType.fromRdfExpression(parameters)}.map(values => values.length > 0 ? values.map(value => purify.Maybe.of(value)) : rdfjsResource.Resource.Values.fromValue<purify.Maybe<${this.itemType.name}>>({ object: purify.Maybe.empty(), predicate: ${variables.predicate}, subject: ${variables.resource} }))`;
|
|
77
78
|
}
|
|
78
79
|
graphqlResolveExpression(parameters) {
|
|
79
80
|
return `${this.itemType.graphqlResolveExpression(parameters)}.extractNullable()`;
|
|
@@ -117,14 +118,15 @@ export class OptionType extends Type {
|
|
|
117
118
|
sparqlWherePatterns(parameters) {
|
|
118
119
|
switch (parameters.context) {
|
|
119
120
|
case "object": {
|
|
120
|
-
const patterns =
|
|
121
|
+
const patterns = this.itemType.sparqlWherePatterns(parameters);
|
|
121
122
|
if (patterns.length === 0) {
|
|
122
123
|
return [];
|
|
123
124
|
}
|
|
124
125
|
return [`{ patterns: [${patterns.join(", ")}], type: "optional" }`];
|
|
125
126
|
}
|
|
126
127
|
case "subject": {
|
|
127
|
-
|
|
128
|
+
throw new Error("should never be called");
|
|
129
|
+
// return this.itemType.sparqlWherePatterns(parameters);
|
|
128
130
|
}
|
|
129
131
|
}
|
|
130
132
|
}
|
|
@@ -12,10 +12,28 @@ export declare abstract class PrimitiveType<ValueT extends boolean | Date | stri
|
|
|
12
12
|
get discriminatorProperty(): Maybe<Type.DiscriminatorProperty>;
|
|
13
13
|
get jsonName(): Type.JsonName;
|
|
14
14
|
fromJsonExpression({ variables, }: Parameters<Type["fromJsonExpression"]>[0]): string;
|
|
15
|
+
protected fromRdfExpressionChain({ variables, }: Parameters<Type["fromRdfExpression"]>[0]): {
|
|
16
|
+
defaultValue?: string;
|
|
17
|
+
hasValues?: string;
|
|
18
|
+
languageIn?: string;
|
|
19
|
+
valueTo?: string;
|
|
20
|
+
};
|
|
15
21
|
graphqlResolveExpression({ variables, }: Parameters<Type["graphqlResolveExpression"]>[0]): string;
|
|
16
22
|
hashStatements({ variables, }: Parameters<Type["hashStatements"]>[0]): readonly string[];
|
|
17
23
|
snippetDeclarations({ features, }: Parameters<Type["snippetDeclarations"]>[0]): readonly string[];
|
|
24
|
+
sparqlWherePatterns(parameters: Parameters<Type["sparqlWherePatterns"]>[0]): readonly string[];
|
|
18
25
|
toJsonExpression({ variables, }: Parameters<Type["toJsonExpression"]>[0]): string;
|
|
19
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Convert an rdfjsResource.Resource.Value to a value of this type.
|
|
28
|
+
* @param variables
|
|
29
|
+
* @protected
|
|
30
|
+
*/
|
|
31
|
+
protected abstract fromRdfResourceValueExpression({ variables, }: {
|
|
32
|
+
variables: {
|
|
33
|
+
predicate: string;
|
|
34
|
+
resource: string;
|
|
35
|
+
resourceValue: string;
|
|
36
|
+
};
|
|
37
|
+
}): string;
|
|
20
38
|
}
|
|
21
39
|
//# sourceMappingURL=PrimitiveType.d.ts.map
|