@shaclmate/compiler 4.0.6 → 4.0.8
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/generators/ts/ObjectType.js +17 -4
- package/dist/generators/ts/ObjectUnionType.js +21 -9
- package/dist/generators/ts/ZodGenerator.d.ts +7 -0
- package/dist/generators/ts/ZodGenerator.js +37 -0
- package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclarations.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/{ObjectType_jsonFunctionDeclarations.js → ObjectType_fromJsonFunctionDeclarations.js} +8 -64
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfFunctionDeclaration.js +27 -0
- package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.js +14 -0
- package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.js +18 -0
- package/dist/generators/ts/_ObjectType/ObjectType_jsonZodSchemaFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_ObjectType/ObjectType_jsonZodSchemaFunctionDeclaration.js +30 -0
- package/dist/generators/ts/_ObjectType/ObjectType_propertiesFromRdfFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_ObjectType/{ObjectType_rdfFunctionDeclarations.js → ObjectType_propertiesFromRdfFunctionDeclaration.js} +5 -37
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.d.ts +4 -1
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.js +6 -2
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts +4 -1
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.js +6 -2
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructTriplesFunctionDeclaration.js +57 -0
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlWherePatternsFunctionDeclarations.d.ts +5 -0
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlWherePatternsFunctionDeclarations.js +106 -0
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_fromJsonFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_fromJsonFunctionDeclaration.js +19 -0
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_fromRdfFunctionDeclarations.d.ts +5 -0
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_fromRdfFunctionDeclarations.js +20 -0
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_jsonZodSchemaFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_jsonZodSchemaFunctionDeclaration.js +14 -0
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_sparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_sparqlConstructTriplesFunctionDeclaration.js +15 -0
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_sparqlWherePatternsFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_sparqlWherePatternsFunctionDeclaration.js +35 -0
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_toJsonFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_toJsonFunctionDeclaration.js +26 -0
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_toRdfFunctionDeclarations.d.ts +5 -0
- package/dist/generators/ts/_ObjectUnionType/{ObjectUnionType_rdfFunctionDeclarations.js → ObjectUnionType_toRdfFunctionDeclarations.js} +6 -23
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/input/NodeShape.d.ts +5 -5
- package/dist/input/NodeShape.js +20 -20
- package/dist/input/Ontology.d.ts +4 -4
- package/dist/input/Ontology.js +10 -10
- package/dist/input/PropertyShape.d.ts +4 -4
- package/dist/input/PropertyShape.js +10 -10
- package/dist/input/ShapesGraph.js +5 -5
- package/dist/input/generated.d.ts +708 -2008
- package/dist/input/generated.js +2504 -2156
- package/package.json +2 -2
- package/dist/generators/ts/_ObjectType/ObjectType_jsonFunctionDeclarations.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_rdfFunctionDeclarations.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlFunctionDeclarations.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlFunctionDeclarations.js +0 -140
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_jsonFunctionDeclarations.d.ts +0 -4
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_jsonFunctionDeclarations.js +0 -50
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_rdfFunctionDeclarations.d.ts +0 -4
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_sparqlFunctionDeclarations.d.ts +0 -4
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_sparqlFunctionDeclarations.js +0 -44
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
-
"@shaclmate/shacl-ast": "4.0.
|
|
3
|
+
"@shaclmate/shacl-ast": "4.0.8",
|
|
4
4
|
"@rdfjs/data-model": "~2.1.1",
|
|
5
5
|
"@rdfjs/dataset": "~2.0.2",
|
|
6
6
|
"@rdfjs/prefix-map": "~0.1.2",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
},
|
|
81
81
|
"type": "module",
|
|
82
82
|
"types": "./dist/index.d.ts",
|
|
83
|
-
"version": "4.0.
|
|
83
|
+
"version": "4.0.8"
|
|
84
84
|
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ObjectType } from "../ObjectType.js";
|
|
2
|
-
import { type Code } from "../ts-poet-wrapper.js";
|
|
3
|
-
export declare function ObjectType_sparqlFunctionDeclarations(this: ObjectType): readonly Code[];
|
|
4
|
-
//# sourceMappingURL=ObjectType_sparqlFunctionDeclarations.d.ts.map
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { rdf, rdfs } from "@tpluscode/rdf-ns-builders";
|
|
2
|
-
import { imports } from "../imports.js";
|
|
3
|
-
import { rdfjsTermExpression } from "../rdfjsTermExpression.js";
|
|
4
|
-
import { snippets } from "../snippets.js";
|
|
5
|
-
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
6
|
-
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
7
|
-
import { ObjectType_sparqlConstructQueryFunctionDeclaration } from "./ObjectType_sparqlConstructQueryFunctionDeclaration.js";
|
|
8
|
-
import { ObjectType_sparqlConstructQueryStringFunctionDeclaration } from "./ObjectType_sparqlConstructQueryStringFunctionDeclaration.js";
|
|
9
|
-
export function ObjectType_sparqlFunctionDeclarations() {
|
|
10
|
-
if (!this.features.has("sparql")) {
|
|
11
|
-
return [];
|
|
12
|
-
}
|
|
13
|
-
const variables = {
|
|
14
|
-
filter: code `parameters.filter`,
|
|
15
|
-
preferredLanguages: code `parameters.preferredLanguages`,
|
|
16
|
-
focusIdentifier: code `parameters.focusIdentifier`,
|
|
17
|
-
variablePrefix: code `parameters.variablePrefix`,
|
|
18
|
-
};
|
|
19
|
-
const rdfClassVariable = code `${imports.dataFactory}.variable!(\`\${${variables.variablePrefix}}RdfClass\`)`;
|
|
20
|
-
const rdfTypeVariable = code `${imports.dataFactory}.variable!(\`\${${variables.variablePrefix}}RdfType\`)`;
|
|
21
|
-
let patternsVariableDeclarationKeyword = "const";
|
|
22
|
-
let triplesVariableDeclarationKeyword = "const";
|
|
23
|
-
const sparqlConstructTriplesStatements = [];
|
|
24
|
-
const sparqlWherePatternsStatements = [];
|
|
25
|
-
for (const parentObjectType of this.parentObjectTypes) {
|
|
26
|
-
sparqlConstructTriplesStatements.push(code `triples = triples.concat(${parentObjectType.staticModuleName}.${syntheticNamePrefix}sparqlConstructTriples(${{ filter: variables.filter, focusIdentifier: variables.focusIdentifier, ignoreRdfType: true, variablePrefix: variables.variablePrefix }}));`);
|
|
27
|
-
triplesVariableDeclarationKeyword = "let";
|
|
28
|
-
sparqlWherePatternsStatements.push(code `\
|
|
29
|
-
patterns = patterns.concat(${parentObjectType.staticModuleName}.${syntheticNamePrefix}sparqlWherePatterns(${{ filter: variables.filter, focusIdentifier: variables.focusIdentifier, ignoreRdfType: true, preferredLanguages: variables.preferredLanguages, variablePrefix: variables.variablePrefix }}));`);
|
|
30
|
-
patternsVariableDeclarationKeyword = "let";
|
|
31
|
-
}
|
|
32
|
-
if (this.fromRdfType.isJust()) {
|
|
33
|
-
const fromRdfTypeVariables = this.fromRdfTypeVariable
|
|
34
|
-
.toList()
|
|
35
|
-
.concat(this.descendantFromRdfTypeVariables);
|
|
36
|
-
sparqlConstructTriplesStatements.push(code `\
|
|
37
|
-
if (!parameters?.ignoreRdfType) {
|
|
38
|
-
triples.push(
|
|
39
|
-
{ subject: ${variables.focusIdentifier}, predicate: ${rdfjsTermExpression(rdf.type)}, object: ${rdfTypeVariable} },
|
|
40
|
-
{ subject: ${rdfTypeVariable}, predicate: ${rdfjsTermExpression(rdfs.subClassOf)}, object: ${rdfClassVariable} }
|
|
41
|
-
);
|
|
42
|
-
}`);
|
|
43
|
-
sparqlWherePatternsStatements.push(code `const rdfTypeVariable = ${rdfTypeVariable};`, code `\
|
|
44
|
-
if (!parameters?.ignoreRdfType) {
|
|
45
|
-
patterns.push(
|
|
46
|
-
${fromRdfTypeVariables.length > 1
|
|
47
|
-
? code `\
|
|
48
|
-
{
|
|
49
|
-
type: "values" as const,
|
|
50
|
-
values: [${joinCode(fromRdfTypeVariables, { on: "," })}].map((identifier) => {
|
|
51
|
-
const valuePatternRow: ${imports.sparqljs}.ValuePatternRow = {};
|
|
52
|
-
valuePatternRow[\`?\${${variables.variablePrefix}}FromRdfType\`] = identifier as ${imports.NamedNode};
|
|
53
|
-
return valuePatternRow;
|
|
54
|
-
}),
|
|
55
|
-
},
|
|
56
|
-
${snippets.sparqlInstancesOfPattern}({ rdfType: ${imports.dataFactory}.variable!(\`\${${variables.variablePrefix}}FromRdfType\`), subject: ${variables.focusIdentifier} }),`
|
|
57
|
-
: code `${snippets.sparqlInstancesOfPattern}({ rdfType: ${fromRdfTypeVariables[0]}, subject: ${variables.focusIdentifier} }),`}
|
|
58
|
-
{
|
|
59
|
-
triples: [
|
|
60
|
-
{
|
|
61
|
-
subject: ${variables.focusIdentifier},
|
|
62
|
-
predicate: ${rdfjsTermExpression(rdf.type)},
|
|
63
|
-
object: rdfTypeVariable
|
|
64
|
-
}
|
|
65
|
-
],
|
|
66
|
-
type: "bgp" as const
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
patterns: [
|
|
70
|
-
{
|
|
71
|
-
triples: [
|
|
72
|
-
{
|
|
73
|
-
subject: rdfTypeVariable,
|
|
74
|
-
predicate: {
|
|
75
|
-
items: [${rdfjsTermExpression(rdfs.subClassOf)}],
|
|
76
|
-
pathType: "+" as const,
|
|
77
|
-
type: "path" as const
|
|
78
|
-
},
|
|
79
|
-
object: ${rdfClassVariable}
|
|
80
|
-
}
|
|
81
|
-
],
|
|
82
|
-
type: "bgp" as const
|
|
83
|
-
}
|
|
84
|
-
],
|
|
85
|
-
type: "optional" as const
|
|
86
|
-
}
|
|
87
|
-
);
|
|
88
|
-
}`);
|
|
89
|
-
}
|
|
90
|
-
for (const property of this.ownProperties) {
|
|
91
|
-
if (property.recursive) {
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
property
|
|
95
|
-
.sparqlConstructTriplesExpression({
|
|
96
|
-
variables,
|
|
97
|
-
})
|
|
98
|
-
.ifJust((propertyTriples) => {
|
|
99
|
-
sparqlConstructTriplesStatements.push(code `triples = triples.concat(${propertyTriples});`);
|
|
100
|
-
triplesVariableDeclarationKeyword = "let";
|
|
101
|
-
});
|
|
102
|
-
property
|
|
103
|
-
.sparqlWherePatternsExpression({ variables })
|
|
104
|
-
.ifJust(({ condition, patterns }) => {
|
|
105
|
-
const concatStatement = code `patterns = patterns.concat(${patterns});`;
|
|
106
|
-
if (condition) {
|
|
107
|
-
sparqlWherePatternsStatements.push(code `if (${condition}) { ${concatStatement} }`);
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
sparqlWherePatternsStatements.push(concatStatement);
|
|
111
|
-
}
|
|
112
|
-
patternsVariableDeclarationKeyword = "let";
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
return [
|
|
116
|
-
ObjectType_sparqlConstructQueryFunctionDeclaration.bind(this)(),
|
|
117
|
-
ObjectType_sparqlConstructQueryStringFunctionDeclaration.bind(this)(),
|
|
118
|
-
code `\
|
|
119
|
-
export function ${syntheticNamePrefix}sparqlConstructTriples(${sparqlConstructTriplesStatements.length === 0 ? "_" : ""}parameters: { filter: ${this.filterType} | undefined; focusIdentifier: ${imports.NamedNode} | ${imports.Variable}; ignoreRdfType: boolean; variablePrefix: string }): readonly ${imports.sparqljs}.Triple[] {
|
|
120
|
-
${sparqlConstructTriplesStatements.length > 0
|
|
121
|
-
? joinCode([
|
|
122
|
-
code `${triplesVariableDeclarationKeyword} triples: ${imports.sparqljs}.Triple[] = [];`,
|
|
123
|
-
...sparqlConstructTriplesStatements,
|
|
124
|
-
code `return triples;`,
|
|
125
|
-
])
|
|
126
|
-
: "return [];"}
|
|
127
|
-
}`,
|
|
128
|
-
code `\
|
|
129
|
-
export function ${syntheticNamePrefix}sparqlWherePatterns(${sparqlWherePatternsStatements.length === 0 ? "_" : ""}parameters: { filter: ${this.filterType} | undefined; focusIdentifier: ${imports.NamedNode} | ${imports.Variable}; ignoreRdfType: boolean; preferredLanguages: readonly string[] | undefined; variablePrefix: string }): readonly ${snippets.SparqlPattern}[] {
|
|
130
|
-
${sparqlWherePatternsStatements.length > 0
|
|
131
|
-
? joinCode([
|
|
132
|
-
code `${patternsVariableDeclarationKeyword} patterns: ${snippets.SparqlPattern}[] = [];`,
|
|
133
|
-
...sparqlWherePatternsStatements,
|
|
134
|
-
code `return patterns;`,
|
|
135
|
-
])
|
|
136
|
-
: "return [];"}
|
|
137
|
-
}`,
|
|
138
|
-
];
|
|
139
|
-
}
|
|
140
|
-
//# sourceMappingURL=ObjectType_sparqlFunctionDeclarations.js.map
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { code, joinCode } from "ts-poet";
|
|
2
|
-
import { imports } from "../imports.js";
|
|
3
|
-
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
4
|
-
function ObjectUnionType_fromJsonFunctionDeclaration() {
|
|
5
|
-
return code `\
|
|
6
|
-
export function ${syntheticNamePrefix}fromJson(json: unknown): ${imports.Either}<${imports.z}.ZodError, ${this.name}> {
|
|
7
|
-
return ${this.concreteMemberTypes.reduce((expression, memberType) => {
|
|
8
|
-
const memberTypeExpression = code `(${memberType.staticModuleName}.${syntheticNamePrefix}fromJson(json) as ${imports.Either}<${imports.z}.ZodError, ${this.name}>)`;
|
|
9
|
-
return expression !== null
|
|
10
|
-
? code `${expression}.altLazy(() => ${memberTypeExpression})`
|
|
11
|
-
: memberTypeExpression;
|
|
12
|
-
}, null)};
|
|
13
|
-
}`;
|
|
14
|
-
}
|
|
15
|
-
export function jsonFunctionDeclarations() {
|
|
16
|
-
if (!this.features.has("json")) {
|
|
17
|
-
return [];
|
|
18
|
-
}
|
|
19
|
-
return [
|
|
20
|
-
ObjectUnionType_fromJsonFunctionDeclaration.bind(this)(),
|
|
21
|
-
jsonZodSchemaFunctionDeclaration.bind(this)(),
|
|
22
|
-
toJsonFunctionDeclaration.bind(this)(),
|
|
23
|
-
];
|
|
24
|
-
}
|
|
25
|
-
function jsonZodSchemaFunctionDeclaration() {
|
|
26
|
-
return code `\
|
|
27
|
-
export function ${syntheticNamePrefix}jsonZodSchema() {
|
|
28
|
-
return ${imports.z}.discriminatedUnion("${this._discriminantProperty.name}", [${joinCode(this.concreteMemberTypes.map((memberType) => memberType.jsonZodSchema({ context: "type" })), { on: ", " })}]);
|
|
29
|
-
}`;
|
|
30
|
-
}
|
|
31
|
-
function toJsonFunctionDeclaration() {
|
|
32
|
-
return code `\
|
|
33
|
-
export function ${syntheticNamePrefix}toJson(${this.thisVariable}: ${this.name}): ${this.jsonType().name} {
|
|
34
|
-
${joinCode(this.concreteMemberTypes
|
|
35
|
-
.map((memberType) => {
|
|
36
|
-
let returnExpression;
|
|
37
|
-
switch (memberType.declarationType) {
|
|
38
|
-
case "class":
|
|
39
|
-
returnExpression = code `${this.thisVariable}.${syntheticNamePrefix}toJson()`;
|
|
40
|
-
break;
|
|
41
|
-
case "interface":
|
|
42
|
-
returnExpression = code `${memberType.staticModuleName}.${syntheticNamePrefix}toJson(${this.thisVariable})`;
|
|
43
|
-
break;
|
|
44
|
-
}
|
|
45
|
-
return code `if (${memberType.staticModuleName}.is${memberType.name}(${this.thisVariable})) { return ${returnExpression}; }`;
|
|
46
|
-
})
|
|
47
|
-
.concat(code `throw new Error("unrecognized type");`))}
|
|
48
|
-
}`;
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=ObjectUnionType_jsonFunctionDeclarations.js.map
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ObjectUnionType } from "../ObjectUnionType.js";
|
|
2
|
-
import { type Code } from "../ts-poet-wrapper.js";
|
|
3
|
-
export declare function rdfFunctionDeclarations(this: ObjectUnionType): readonly Code[];
|
|
4
|
-
//# sourceMappingURL=ObjectUnionType_rdfFunctionDeclarations.d.ts.map
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ObjectUnionType } from "../ObjectUnionType.js";
|
|
2
|
-
import { type Code } from "../ts-poet-wrapper.js";
|
|
3
|
-
export declare function ObjectUnionType_sparqlFunctionDeclarations(this: ObjectUnionType): readonly Code[];
|
|
4
|
-
//# sourceMappingURL=ObjectUnionType_sparqlFunctionDeclarations.d.ts.map
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { pascalCase } from "change-case";
|
|
2
|
-
import { ObjectType_sparqlConstructQueryFunctionDeclaration } from "../_ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.js";
|
|
3
|
-
import { ObjectType_sparqlConstructQueryStringFunctionDeclaration } from "../_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.js";
|
|
4
|
-
import { imports } from "../imports.js";
|
|
5
|
-
import { snippets } from "../snippets.js";
|
|
6
|
-
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
7
|
-
import { code, joinCode, literalOf } from "../ts-poet-wrapper.js";
|
|
8
|
-
export function ObjectUnionType_sparqlFunctionDeclarations() {
|
|
9
|
-
if (!this.features.has("sparql")) {
|
|
10
|
-
return [];
|
|
11
|
-
}
|
|
12
|
-
return [
|
|
13
|
-
ObjectType_sparqlConstructQueryFunctionDeclaration.bind(this)(),
|
|
14
|
-
ObjectType_sparqlConstructQueryStringFunctionDeclaration.bind(this)(),
|
|
15
|
-
code `\
|
|
16
|
-
export function ${syntheticNamePrefix}sparqlConstructTriples({ filter, focusIdentifier, variablePrefix }: { filter: ${this.filterType} | undefined; focusIdentifier: ${imports.NamedNode} | ${imports.Variable}; ignoreRdfType: boolean; variablePrefix: string }): readonly ${imports.sparqljs}.Triple[] {
|
|
17
|
-
return [${joinCode(this.concreteMemberTypes.map((memberType) => code `...${memberType.staticModuleName}.${syntheticNamePrefix}sparqlConstructTriples({ filter: filter?.on?.${memberType.name}, focusIdentifier, ignoreRdfType: false, variablePrefix: \`\${variablePrefix}${pascalCase(memberType.name)}\` }).concat()`), { on: ", " })}];
|
|
18
|
-
}`,
|
|
19
|
-
code `\
|
|
20
|
-
export function ${syntheticNamePrefix}sparqlWherePatterns({ filter, focusIdentifier, preferredLanguages, variablePrefix }: { filter: ${this.filterType} | undefined; focusIdentifier: ${imports.NamedNode} | ${imports.Variable}; ignoreRdfType: boolean; preferredLanguages: readonly string[] | undefined; variablePrefix: string }): readonly ${snippets.SparqlPattern}[] {
|
|
21
|
-
${joinCode([
|
|
22
|
-
code `let patterns: ${snippets.SparqlPattern}[] = [];`,
|
|
23
|
-
code `\
|
|
24
|
-
if (focusIdentifier.termType === "Variable") {
|
|
25
|
-
patterns = patterns.concat(${this.identifierType.sparqlWherePatternsFunction}({
|
|
26
|
-
filter: filter?.${syntheticNamePrefix}identifier,
|
|
27
|
-
ignoreRdfType: false,
|
|
28
|
-
preferredLanguages,
|
|
29
|
-
propertyPatterns: [],
|
|
30
|
-
schema: ${this.identifierType.schema},
|
|
31
|
-
valueVariable: focusIdentifier,
|
|
32
|
-
variablePrefix,
|
|
33
|
-
}));
|
|
34
|
-
}`,
|
|
35
|
-
code `patterns.push({ patterns: [${joinCode(this.concreteMemberTypes.map((memberType) => code `${{
|
|
36
|
-
patterns: code `${memberType.staticModuleName}.${syntheticNamePrefix}sparqlWherePatterns({ filter: filter?.on?.${memberType.name}, focusIdentifier, ignoreRdfType: false, preferredLanguages, variablePrefix: \`\${variablePrefix}${pascalCase(memberType.name)}\` }).concat()`,
|
|
37
|
-
type: literalOf("group"),
|
|
38
|
-
}}`), { on: ", " })}], type: "union" });`,
|
|
39
|
-
code `return patterns;`,
|
|
40
|
-
])}
|
|
41
|
-
}`,
|
|
42
|
-
];
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=ObjectUnionType_sparqlFunctionDeclarations.js.map
|