@shaclmate/compiler 2.0.14 → 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/_ShapesGraphToAstTransformer/transformNodeShapeToAstType.js +17 -4
- package/_ShapesGraphToAstTransformer/transformPropertyShapeToAstCompositeType.js +3 -1
- package/generators/ts/DateTimeType.d.ts +3 -1
- package/generators/ts/DateTimeType.js +9 -1
- package/generators/ts/Import.d.ts +0 -1
- package/generators/ts/Import.js +0 -5
- package/generators/ts/ListType.d.ts +3 -2
- package/generators/ts/ListType.js +17 -9
- package/generators/ts/ObjectType.d.ts +3 -2
- package/generators/ts/ObjectType.js +20 -9
- package/generators/ts/ObjectUnionType.d.ts +1 -1
- package/generators/ts/ObjectUnionType.js +16 -47
- package/generators/ts/OptionType.d.ts +3 -1
- package/generators/ts/OptionType.js +12 -11
- package/generators/ts/PrimitiveType.d.ts +2 -2
- package/generators/ts/PrimitiveType.js +9 -4
- package/generators/ts/SetType.d.ts +3 -1
- package/generators/ts/SetType.js +12 -8
- package/generators/ts/SnippetDeclarations.d.ts +11 -0
- package/generators/ts/SnippetDeclarations.js +215 -0
- package/generators/ts/TermType.d.ts +3 -1
- package/generators/ts/TermType.js +16 -8
- package/generators/ts/TsGenerator.js +15 -1
- package/generators/ts/Type.d.ts +15 -5
- package/generators/ts/Type.js +17 -0
- package/generators/ts/TypeFactory.js +14 -4
- package/generators/ts/UnionType.d.ts +2 -1
- package/generators/ts/UnionType.js +3 -3
- package/generators/ts/_ObjectType/IdentifierProperty.d.ts +4 -5
- package/generators/ts/_ObjectType/IdentifierProperty.js +16 -7
- package/generators/ts/_ObjectType/Property.d.ts +17 -3
- package/generators/ts/_ObjectType/Property.js +2 -1
- package/generators/ts/_ObjectType/ShaclProperty.d.ts +1 -0
- package/generators/ts/_ObjectType/ShaclProperty.js +4 -1
- package/generators/ts/_ObjectType/TypeDiscriminatorProperty.d.ts +3 -5
- package/generators/ts/_ObjectType/TypeDiscriminatorProperty.js +11 -4
- package/generators/ts/_ObjectType/equalsFunctionOrMethodDeclaration.js +1 -1
- package/generators/ts/_ObjectType/fromJsonFunctionDeclarations.js +1 -1
- package/generators/ts/_ObjectType/fromRdfFunctionDeclarations.js +1 -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.js +35 -58
- package/generators/ts/_ObjectType/toJsonFunctionOrMethodDeclaration.js +1 -1
- package/input/generated.d.ts +15 -14
- package/input/generated.js +20 -4
- package/input/tsFeatures.d.ts +1 -1
- package/input/tsFeatures.js +17 -13
- package/package.json +4 -4
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import { invariant } from "ts-invariant";
|
|
3
3
|
import { Import } from "../Import.js";
|
|
4
|
+
import { SnippetDeclarations } from "../SnippetDeclarations.js";
|
|
4
5
|
import { Property } from "./Property.js";
|
|
5
6
|
export class IdentifierProperty extends Property {
|
|
6
|
-
constructor({ abstract, classDeclarationVisibility, lazyObjectTypeMutable, mintingStrategy,
|
|
7
|
+
constructor({ abstract, classDeclarationVisibility, lazyObjectTypeMutable, mintingStrategy, override, ...superParameters }) {
|
|
7
8
|
super(superParameters);
|
|
8
|
-
this.equalsFunction = "
|
|
9
|
+
this.equalsFunction = "booleanEquals";
|
|
9
10
|
this.mutable = false;
|
|
10
11
|
invariant(this.visibility === "public");
|
|
11
12
|
this.abstract = abstract;
|
|
@@ -19,7 +20,6 @@ export class IdentifierProperty extends Property {
|
|
|
19
20
|
else {
|
|
20
21
|
this.mintingStrategy = "none";
|
|
21
22
|
}
|
|
22
|
-
this.objectTypeDeclarationType = objectTypeDeclarationType;
|
|
23
23
|
this.lazyObjectTypeMutable = lazyObjectTypeMutable;
|
|
24
24
|
this.override = override;
|
|
25
25
|
}
|
|
@@ -76,6 +76,7 @@ export class IdentifierProperty extends Property {
|
|
|
76
76
|
case "none":
|
|
77
77
|
// Immutable, public identifier property, no getter
|
|
78
78
|
return Maybe.of({
|
|
79
|
+
isReadonly: true,
|
|
79
80
|
name: this.name,
|
|
80
81
|
type: this.type.name,
|
|
81
82
|
});
|
|
@@ -91,11 +92,11 @@ export class IdentifierProperty extends Property {
|
|
|
91
92
|
}
|
|
92
93
|
}
|
|
93
94
|
get constructorParametersPropertySignature() {
|
|
94
|
-
if (this.
|
|
95
|
+
if (this.objectType.declarationType === "class" && this.abstract) {
|
|
95
96
|
return Maybe.empty();
|
|
96
97
|
}
|
|
97
98
|
return Maybe.of({
|
|
98
|
-
hasQuestionToken: this.
|
|
99
|
+
hasQuestionToken: this.objectType.declarationType === "class" &&
|
|
99
100
|
this.mintingStrategy !== "none",
|
|
100
101
|
isReadonly: true,
|
|
101
102
|
name: this.name,
|
|
@@ -103,8 +104,9 @@ export class IdentifierProperty extends Property {
|
|
|
103
104
|
});
|
|
104
105
|
}
|
|
105
106
|
get declarationImports() {
|
|
106
|
-
const imports = this.type.useImports.concat();
|
|
107
|
-
if (this.
|
|
107
|
+
const imports = this.type.useImports().concat();
|
|
108
|
+
if (this.objectType.features.has("hash") &&
|
|
109
|
+
this.objectType.declarationType === "class") {
|
|
108
110
|
switch (this.mintingStrategy) {
|
|
109
111
|
case "sha256":
|
|
110
112
|
imports.push(Import.SHA256);
|
|
@@ -130,6 +132,13 @@ export class IdentifierProperty extends Property {
|
|
|
130
132
|
type: "string",
|
|
131
133
|
};
|
|
132
134
|
}
|
|
135
|
+
get snippetDeclarations() {
|
|
136
|
+
const snippetDeclarations = [];
|
|
137
|
+
if (this.objectType.features.has("equals")) {
|
|
138
|
+
snippetDeclarations.push(SnippetDeclarations.booleanEquals);
|
|
139
|
+
}
|
|
140
|
+
return snippetDeclarations;
|
|
141
|
+
}
|
|
133
142
|
classConstructorStatements({ variables, }) {
|
|
134
143
|
if (this.abstract) {
|
|
135
144
|
return [];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { BlankNode, Literal, NamedNode, Variable } from "@rdfjs/types";
|
|
2
2
|
import type { Maybe } from "purify-ts";
|
|
3
3
|
import { type GetAccessorDeclarationStructure, type OptionalKind, type PropertyDeclarationStructure, type PropertySignatureStructure, Scope } from "ts-morph";
|
|
4
|
-
import type { PropertyVisibility } from "../../../enums/index.js";
|
|
4
|
+
import type { PropertyVisibility, TsFeature, TsObjectDeclarationType } from "../../../enums/index.js";
|
|
5
5
|
import type { Import } from "../Import.js";
|
|
6
6
|
import type { Type } from "../Type.js";
|
|
7
7
|
export declare abstract class Property<TypeT extends {
|
|
@@ -21,7 +21,7 @@ export declare abstract class Property<TypeT extends {
|
|
|
21
21
|
*/
|
|
22
22
|
abstract readonly constructorParametersPropertySignature: Maybe<OptionalKind<PropertySignatureStructure>>;
|
|
23
23
|
/**
|
|
24
|
-
* Function declaration that takes two values of the property and compares them, returning and
|
|
24
|
+
* Function declaration that takes two values of the property and compares them, returning and EqualsResult.
|
|
25
25
|
*/
|
|
26
26
|
abstract readonly equalsFunction: string;
|
|
27
27
|
/**
|
|
@@ -40,6 +40,15 @@ export declare abstract class Property<TypeT extends {
|
|
|
40
40
|
* TypeScript identifier-safe name of the property.
|
|
41
41
|
*/
|
|
42
42
|
readonly name: string;
|
|
43
|
+
/**
|
|
44
|
+
* Reusable function, type, and other declarations that are not particular to this property but that property-specific code
|
|
45
|
+
* relies on. For example, the equals function/method of ObjectType has a custom return type that's the same across all
|
|
46
|
+
* ObjectType's. Instead of re-declaring the return type anonymously on every equals function, declare a named type
|
|
47
|
+
* as a snippet and reference it.
|
|
48
|
+
*
|
|
49
|
+
* The generator deduplicates snippet declarations across all types before adding them to the source.
|
|
50
|
+
*/
|
|
51
|
+
abstract readonly snippetDeclarations: readonly string[];
|
|
43
52
|
/**
|
|
44
53
|
* Property type
|
|
45
54
|
. */
|
|
@@ -49,9 +58,14 @@ export declare abstract class Property<TypeT extends {
|
|
|
49
58
|
*/
|
|
50
59
|
readonly visibility: PropertyVisibility;
|
|
51
60
|
protected readonly dataFactoryVariable: string;
|
|
52
|
-
|
|
61
|
+
protected readonly objectType: {
|
|
62
|
+
readonly declarationType: TsObjectDeclarationType;
|
|
63
|
+
readonly features: Set<TsFeature>;
|
|
64
|
+
};
|
|
65
|
+
constructor({ dataFactoryVariable, name, objectType, type, visibility, }: {
|
|
53
66
|
dataFactoryVariable: string;
|
|
54
67
|
name: string;
|
|
68
|
+
objectType: Property<TypeT>["objectType"];
|
|
55
69
|
type: TypeT;
|
|
56
70
|
visibility: PropertyVisibility;
|
|
57
71
|
});
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Scope, } from "ts-morph";
|
|
2
2
|
import { rdfjsTermExpression } from "./rdfjsTermExpression.js";
|
|
3
3
|
export class Property {
|
|
4
|
-
constructor({ dataFactoryVariable, name, type, visibility, }) {
|
|
4
|
+
constructor({ dataFactoryVariable, name, objectType, type, visibility, }) {
|
|
5
5
|
this.dataFactoryVariable = dataFactoryVariable;
|
|
6
6
|
this.name = name;
|
|
7
|
+
this.objectType = objectType;
|
|
7
8
|
this.type = type;
|
|
8
9
|
this.visibility = visibility;
|
|
9
10
|
}
|
|
@@ -26,6 +26,7 @@ export declare class ShaclProperty extends Property<Type> {
|
|
|
26
26
|
get equalsFunction(): string;
|
|
27
27
|
get interfacePropertySignature(): OptionalKind<PropertySignatureStructure>;
|
|
28
28
|
get jsonPropertySignature(): OptionalKind<PropertySignatureStructure>;
|
|
29
|
+
get snippetDeclarations(): readonly string[];
|
|
29
30
|
private get declarationComment();
|
|
30
31
|
private get pathExpression();
|
|
31
32
|
classConstructorStatements({ variables, }: Parameters<Property<Type>["classConstructorStatements"]>[0]): readonly string[];
|
|
@@ -50,7 +50,7 @@ export class ShaclProperty extends Property {
|
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
get declarationImports() {
|
|
53
|
-
return this.type.useImports;
|
|
53
|
+
return this.type.useImports(this.objectType.features);
|
|
54
54
|
}
|
|
55
55
|
get equalsFunction() {
|
|
56
56
|
return this.type.equalsFunction;
|
|
@@ -70,6 +70,9 @@ export class ShaclProperty extends Property {
|
|
|
70
70
|
type: this.type.jsonName,
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
|
+
get snippetDeclarations() {
|
|
74
|
+
return this.type.snippetDeclarations(this.objectType.features);
|
|
75
|
+
}
|
|
73
76
|
get declarationComment() {
|
|
74
77
|
return this.comment
|
|
75
78
|
.alt(this.description)
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import type { GetAccessorDeclarationStructure, OptionalKind, PropertyDeclarationStructure, PropertySignatureStructure } from "ts-morph";
|
|
3
|
-
import type { TsObjectDeclarationType } from "../../../enums/index.js";
|
|
4
3
|
import { Property } from "./Property.js";
|
|
5
4
|
export declare class TypeDiscriminatorProperty extends Property<TypeDiscriminatorProperty.Type> {
|
|
6
|
-
readonly equalsFunction = "
|
|
5
|
+
readonly equalsFunction = "strictEquals";
|
|
7
6
|
readonly mutable = false;
|
|
8
7
|
readonly value: string;
|
|
9
8
|
private readonly abstract;
|
|
10
|
-
private readonly objectTypeDeclarationType;
|
|
11
9
|
private readonly override;
|
|
12
|
-
constructor({ abstract,
|
|
10
|
+
constructor({ abstract, override, type, value, ...superParameters }: {
|
|
13
11
|
abstract: boolean;
|
|
14
|
-
objectTypeDeclarationType: TsObjectDeclarationType;
|
|
15
12
|
override: boolean;
|
|
16
13
|
type: TypeDiscriminatorProperty.Type;
|
|
17
14
|
value: string;
|
|
@@ -21,6 +18,7 @@ export declare class TypeDiscriminatorProperty extends Property<TypeDiscriminato
|
|
|
21
18
|
get constructorParametersPropertySignature(): Maybe<OptionalKind<PropertySignatureStructure>>;
|
|
22
19
|
get interfacePropertySignature(): OptionalKind<PropertySignatureStructure>;
|
|
23
20
|
get jsonPropertySignature(): OptionalKind<PropertySignatureStructure>;
|
|
21
|
+
get snippetDeclarations(): readonly string[];
|
|
24
22
|
classConstructorStatements(): readonly string[];
|
|
25
23
|
fromJsonStatements(): readonly string[];
|
|
26
24
|
fromRdfStatements(): readonly string[];
|
|
@@ -7,15 +7,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { Maybe } from "purify-ts";
|
|
8
8
|
import { invariant } from "ts-invariant";
|
|
9
9
|
import { Memoize } from "typescript-memoize";
|
|
10
|
+
import { SnippetDeclarations } from "../SnippetDeclarations.js";
|
|
10
11
|
import { Property } from "./Property.js";
|
|
11
12
|
export class TypeDiscriminatorProperty extends Property {
|
|
12
|
-
constructor({ abstract,
|
|
13
|
+
constructor({ abstract, override, type, value, ...superParameters }) {
|
|
13
14
|
super({ ...superParameters, type });
|
|
14
|
-
this.equalsFunction = "
|
|
15
|
+
this.equalsFunction = "strictEquals";
|
|
15
16
|
this.mutable = false;
|
|
16
17
|
invariant(this.visibility === "public");
|
|
17
18
|
this.abstract = abstract;
|
|
18
|
-
this.objectTypeDeclarationType = objectTypeDeclarationType;
|
|
19
19
|
this.override = override;
|
|
20
20
|
this.value = value;
|
|
21
21
|
}
|
|
@@ -53,6 +53,13 @@ export class TypeDiscriminatorProperty extends Property {
|
|
|
53
53
|
type: this.type.name,
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
+
get snippetDeclarations() {
|
|
57
|
+
const snippetDeclarations = [];
|
|
58
|
+
if (this.objectType.features.has("equals")) {
|
|
59
|
+
snippetDeclarations.push(SnippetDeclarations.strictEquals);
|
|
60
|
+
}
|
|
61
|
+
return snippetDeclarations;
|
|
62
|
+
}
|
|
56
63
|
classConstructorStatements() {
|
|
57
64
|
return [];
|
|
58
65
|
}
|
|
@@ -60,7 +67,7 @@ export class TypeDiscriminatorProperty extends Property {
|
|
|
60
67
|
return this.fromRdfStatements();
|
|
61
68
|
}
|
|
62
69
|
fromRdfStatements() {
|
|
63
|
-
return !this.abstract && this.
|
|
70
|
+
return !this.abstract && this.objectType.declarationType === "interface"
|
|
64
71
|
? [`const ${this.name} = "${this.value}" as const`]
|
|
65
72
|
: [];
|
|
66
73
|
}
|
|
@@ -59,7 +59,7 @@ export function equalsFunctionOrMethodDeclaration() {
|
|
|
59
59
|
type: this.name,
|
|
60
60
|
},
|
|
61
61
|
],
|
|
62
|
-
returnType: "
|
|
62
|
+
returnType: "EqualsResult",
|
|
63
63
|
statements: [
|
|
64
64
|
`return ${chain
|
|
65
65
|
.map((chainPart, chainPartI) => chainPartI === 0 ? chainPart : `chain(() => ${chainPart})`)
|
|
@@ -17,7 +17,7 @@ export function fromJsonFunctionDeclarations() {
|
|
|
17
17
|
this.parentObjectTypes.forEach((parentObjectType, parentObjectTypeI) => {
|
|
18
18
|
propertiesFromJsonFunctionStatements.push(`const _super${parentObjectTypeI}Either = ${parentObjectType.name}.propertiesFromJson(${variables.jsonObject});`, `if (_super${parentObjectTypeI}Either.isLeft()) { return _super${parentObjectTypeI}Either; }`, `const _super${parentObjectTypeI} = _super${parentObjectTypeI}Either.unsafeCoerce()`);
|
|
19
19
|
initializers.push(`..._super${parentObjectTypeI}`);
|
|
20
|
-
propertiesFromJsonFunctionReturnType.push(`
|
|
20
|
+
propertiesFromJsonFunctionReturnType.push(`UnwrapR<ReturnType<typeof ${parentObjectType.name}.propertiesFromJson>>`);
|
|
21
21
|
});
|
|
22
22
|
for (const property of this.properties) {
|
|
23
23
|
const propertyFromJsonStatements = property.fromJsonStatements({
|
|
@@ -20,7 +20,7 @@ export function fromRdfFunctionDeclarations() {
|
|
|
20
20
|
this.parentObjectTypes.forEach((parentObjectType, parentObjectTypeI) => {
|
|
21
21
|
propertiesFromRdfFunctionStatements.push(`const _super${parentObjectTypeI}Either = ${parentObjectType.name}.propertiesFromRdf({ ...${variables.context}, ignoreRdfType: true, languageIn: ${variables.languageIn}, resource: ${variables.resource} });`, `if (_super${parentObjectTypeI}Either.isLeft()) { return _super${parentObjectTypeI}Either; }`, `const _super${parentObjectTypeI} = _super${parentObjectTypeI}Either.unsafeCoerce()`);
|
|
22
22
|
initializers.push(`..._super${parentObjectTypeI}`);
|
|
23
|
-
propertiesFromRdfFunctionReturnType.push(`
|
|
23
|
+
propertiesFromRdfFunctionReturnType.push(`UnwrapR<ReturnType<typeof ${parentObjectType.name}.propertiesFromRdf>>`);
|
|
24
24
|
});
|
|
25
25
|
this.fromRdfType.ifJust((rdfType) => {
|
|
26
26
|
propertiesFromRdfFunctionStatements.push(`if (!${variables.ignoreRdfType} && !${variables.resource}.isInstanceOf(${this.rdfjsTermExpression(rdfType)})) { return purify.Left(new rdfjsResource.Resource.ValueError(${objectInitializer({ focusResource: variables.resource, message: `\`\${rdfjsResource.Resource.Identifier.toString(${variables.resource}.identifier)} has unexpected RDF type\``, predicate: this.rdfjsTermExpression(rdfType) })})); }`);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { StructureKind } from "ts-morph";
|
|
2
|
+
export function sparqlConstructQueryFunctionDeclaration() {
|
|
3
|
+
return {
|
|
4
|
+
isExported: true,
|
|
5
|
+
kind: StructureKind.Function,
|
|
6
|
+
name: "sparqlConstructQuery",
|
|
7
|
+
parameters: [
|
|
8
|
+
{
|
|
9
|
+
hasQuestionToken: true,
|
|
10
|
+
name: "parameters",
|
|
11
|
+
type: '{ ignoreRdfType?: boolean; prefixes?: { [prefix: string]: string }; subject?: sparqljs.Triple["subject"]; } & Omit<sparqljs.ConstructQuery, "prefixes" | "queryType" | "type">',
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
returnType: "sparqljs.ConstructQuery",
|
|
15
|
+
statements: [
|
|
16
|
+
"const { ignoreRdfType, subject, ...queryParameters } = parameters ?? {}",
|
|
17
|
+
`return { ...queryParameters, prefixes: parameters?.prefixes ?? {}, queryType: "CONSTRUCT", template: (queryParameters.template ?? []).concat(${this.name}.sparqlConstructTemplateTriples({ ignoreRdfType, subject })), type: "query", where: (queryParameters.where ?? []).concat(${this.name}.sparqlWherePatterns({ ignoreRdfType, subject })) };`,
|
|
18
|
+
],
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=sparqlConstructQueryFunctionDeclaration.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type FunctionDeclarationStructure } from "ts-morph";
|
|
2
|
+
export declare function sparqlConstructQueryStringFunctionDeclaration(this: {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
}): FunctionDeclarationStructure;
|
|
5
|
+
//# sourceMappingURL=sparqlConstructQueryStringFunctionDeclaration.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { StructureKind } from "ts-morph";
|
|
2
|
+
export function sparqlConstructQueryStringFunctionDeclaration() {
|
|
3
|
+
return {
|
|
4
|
+
isExported: true,
|
|
5
|
+
kind: StructureKind.Function,
|
|
6
|
+
name: "sparqlConstructQueryString",
|
|
7
|
+
parameters: [
|
|
8
|
+
{
|
|
9
|
+
hasQuestionToken: true,
|
|
10
|
+
name: "parameters",
|
|
11
|
+
type: '{ ignoreRdfType?: boolean; subject?: sparqljs.Triple["subject"]; variablePrefix?: string; } & Omit<sparqljs.ConstructQuery, "prefixes" | "queryType" | "type"> & sparqljs.GeneratorOptions',
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
returnType: "string",
|
|
15
|
+
statements: [
|
|
16
|
+
`return new sparqljs.Generator(parameters).stringify(${this.name}.sparqlConstructQuery(parameters));`,
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=sparqlConstructQueryStringFunctionDeclaration.js.map
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { rdf } from "@tpluscode/rdf-ns-builders";
|
|
2
2
|
import { camelCase } from "change-case";
|
|
3
3
|
import { StructureKind } from "ts-morph";
|
|
4
|
+
import { sparqlConstructQueryFunctionDeclaration } from "./sparqlConstructQueryFunctionDeclaration.js";
|
|
5
|
+
import { sparqlConstructQueryStringFunctionDeclaration } from "./sparqlConstructQueryStringFunctionDeclaration.js";
|
|
4
6
|
export function sparqlFunctionDeclarations() {
|
|
5
7
|
if (!this.features.has("sparql")) {
|
|
6
8
|
return [];
|
|
@@ -8,43 +10,34 @@ export function sparqlFunctionDeclarations() {
|
|
|
8
10
|
if (this.extern) {
|
|
9
11
|
return [];
|
|
10
12
|
}
|
|
11
|
-
const subjectDefault = camelCase(this.name);
|
|
12
13
|
const variables = { subject: "subject", variablePrefix: "variablePrefix" };
|
|
13
14
|
const rdfTypeVariable = `${this.dataFactoryVariable}.variable!(\`\${${variables.variablePrefix}}RdfType\`)`;
|
|
15
|
+
const subjectDefault = camelCase(this.name);
|
|
16
|
+
const preambleStatements = [
|
|
17
|
+
`const subject = parameters?.subject ?? ${this.dataFactoryVariable}.variable!("${subjectDefault}");`,
|
|
18
|
+
`const variablePrefix = parameters?.variablePrefix ?? (subject.termType === "Variable" ? subject.value : "${subjectDefault}");`,
|
|
19
|
+
];
|
|
20
|
+
const sparqlConstructTemplateTriples = [
|
|
21
|
+
...this.parentObjectTypes.map((parentObjectType) => `...${parentObjectType.name}.sparqlConstructTemplateTriples({ ignoreRdfType: true, subject, variablePrefix })`),
|
|
22
|
+
...(this.fromRdfType.isJust()
|
|
23
|
+
? [
|
|
24
|
+
`...(parameters?.ignoreRdfType ? [] : [{ subject, predicate: ${this.rdfjsTermExpression(rdf.type)}, object: ${rdfTypeVariable} }])`,
|
|
25
|
+
]
|
|
26
|
+
: []),
|
|
27
|
+
...this.ownProperties.flatMap((property) => property.sparqlConstructTemplateTriples({ variables })),
|
|
28
|
+
];
|
|
29
|
+
const sparqlWherePatterns = [
|
|
30
|
+
...this.parentObjectTypes.map((parentObjectType) => `...${parentObjectType.name}.sparqlWherePatterns({ ignoreRdfType: true, subject, variablePrefix })`),
|
|
31
|
+
...(this.fromRdfType.isJust()
|
|
32
|
+
? [
|
|
33
|
+
`...(parameters?.ignoreRdfType ? [] : [{ triples: [{ subject, predicate: ${this.rdfjsTermExpression(rdf.type)}, object: ${this.rdfjsTermExpression(this.fromRdfType.unsafeCoerce())} }], type: "bgp" as const }, { triples: [{ subject, predicate: ${this.rdfjsTermExpression(rdf.type)}, object: ${rdfTypeVariable} }], type: "bgp" as const }])`,
|
|
34
|
+
]
|
|
35
|
+
: []),
|
|
36
|
+
...this.ownProperties.flatMap((property) => property.sparqlWherePatterns({ variables })),
|
|
37
|
+
];
|
|
14
38
|
return [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
kind: StructureKind.Function,
|
|
18
|
-
name: "sparqlConstructQuery",
|
|
19
|
-
parameters: [
|
|
20
|
-
{
|
|
21
|
-
hasQuestionToken: true,
|
|
22
|
-
name: "parameters",
|
|
23
|
-
type: '{ ignoreRdfType?: boolean; prefixes?: { [prefix: string]: string }; subject?: sparqljs.Triple["subject"]; variablePrefix?: string; } & Omit<sparqljs.ConstructQuery, "prefixes" | "queryType" | "type">',
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
returnType: "sparqljs.ConstructQuery",
|
|
27
|
-
statements: [
|
|
28
|
-
"const { ignoreRdfType, subject, variablePrefix, ...queryParameters } = parameters ?? {}",
|
|
29
|
-
`return { ...queryParameters, prefixes: parameters?.prefixes ?? {}, queryType: "CONSTRUCT", template: (queryParameters.template ?? []).concat(${this.name}.sparqlConstructTemplateTriples({ ignoreRdfType, subject })), type: "query", where: (queryParameters.where ?? []).concat(${this.name}.sparqlWherePatterns({ ignoreRdfType, subject, variablePrefix })) };`,
|
|
30
|
-
],
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
isExported: true,
|
|
34
|
-
kind: StructureKind.Function,
|
|
35
|
-
name: "sparqlConstructQueryString",
|
|
36
|
-
parameters: [
|
|
37
|
-
{
|
|
38
|
-
hasQuestionToken: true,
|
|
39
|
-
name: "parameters",
|
|
40
|
-
type: '{ ignoreRdfType?: boolean; subject?: sparqljs.Triple["subject"]; variablePrefix?: string; } & Omit<sparqljs.ConstructQuery, "prefixes" | "queryType" | "type"> & sparqljs.GeneratorOptions',
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
returnType: "string",
|
|
44
|
-
statements: [
|
|
45
|
-
`return new sparqljs.Generator(parameters).stringify(${this.name}.sparqlConstructQuery(parameters));`,
|
|
46
|
-
],
|
|
47
|
-
},
|
|
39
|
+
sparqlConstructQueryFunctionDeclaration.bind(this)(),
|
|
40
|
+
sparqlConstructQueryStringFunctionDeclaration.bind(this)(),
|
|
48
41
|
{
|
|
49
42
|
isExported: true,
|
|
50
43
|
kind: StructureKind.Function,
|
|
@@ -52,23 +45,16 @@ export function sparqlFunctionDeclarations() {
|
|
|
52
45
|
parameters: [
|
|
53
46
|
{
|
|
54
47
|
hasQuestionToken: true,
|
|
55
|
-
name: "parameters
|
|
48
|
+
name: `${sparqlConstructTemplateTriples.length === 0 ? "_" : ""}parameters`,
|
|
56
49
|
type: '{ ignoreRdfType?: boolean; subject?: sparqljs.Triple["subject"], variablePrefix?: string }',
|
|
57
50
|
},
|
|
58
51
|
],
|
|
59
52
|
returnType: "readonly sparqljs.Triple[]",
|
|
60
53
|
statements: [
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
...(this.fromRdfType.isJust()
|
|
66
|
-
? [
|
|
67
|
-
`...(parameters?.ignoreRdfType ? [] : [{ subject, predicate: ${this.rdfjsTermExpression(rdf.type)}, object: ${rdfTypeVariable} }])`,
|
|
68
|
-
]
|
|
69
|
-
: []),
|
|
70
|
-
this.ownProperties.flatMap((property) => property.sparqlConstructTemplateTriples({ variables })),
|
|
71
|
-
].join(", ")}];`,
|
|
54
|
+
...(sparqlConstructTemplateTriples.length > 0
|
|
55
|
+
? preambleStatements
|
|
56
|
+
: []),
|
|
57
|
+
`return [${sparqlConstructTemplateTriples.join(", ")}];`,
|
|
72
58
|
],
|
|
73
59
|
},
|
|
74
60
|
{
|
|
@@ -77,23 +63,14 @@ export function sparqlFunctionDeclarations() {
|
|
|
77
63
|
name: "sparqlWherePatterns",
|
|
78
64
|
parameters: [
|
|
79
65
|
{
|
|
80
|
-
name: "parameters
|
|
66
|
+
name: `${sparqlWherePatterns.length === 0 ? "_" : ""}parameters`,
|
|
81
67
|
type: '{ ignoreRdfType?: boolean; subject?: sparqljs.Triple["subject"], variablePrefix?: string }',
|
|
82
68
|
},
|
|
83
69
|
],
|
|
84
70
|
returnType: "readonly sparqljs.Pattern[]",
|
|
85
71
|
statements: [
|
|
86
|
-
|
|
87
|
-
`
|
|
88
|
-
`return [${[
|
|
89
|
-
...this.parentObjectTypes.map((parentObjectType) => `...${parentObjectType.name}.sparqlWherePatterns({ ignoreRdfType: true, subject, variablePrefix })`),
|
|
90
|
-
...(this.fromRdfType.isJust()
|
|
91
|
-
? [
|
|
92
|
-
`...(parameters?.ignoreRdfType ? [] : [{ triples: [{ subject, predicate: ${this.rdfjsTermExpression(rdf.type)}, object: ${this.rdfjsTermExpression(this.fromRdfType.unsafeCoerce())} }], type: "bgp" as const }, { triples: [{ subject, predicate: ${this.rdfjsTermExpression(rdf.type)}, object: ${rdfTypeVariable} }], type: "bgp" as const }])`,
|
|
93
|
-
]
|
|
94
|
-
: []),
|
|
95
|
-
this.ownProperties.flatMap((property) => property.sparqlWherePatterns({ variables })),
|
|
96
|
-
].join(", ")}];`,
|
|
72
|
+
...(sparqlWherePatterns.length > 0 ? preambleStatements : []),
|
|
73
|
+
`return [${sparqlWherePatterns.join(", ")}];`,
|
|
97
74
|
],
|
|
98
75
|
},
|
|
99
76
|
];
|
|
@@ -19,7 +19,7 @@ export function toJsonFunctionOrMethodDeclaration() {
|
|
|
19
19
|
break;
|
|
20
20
|
case "interface":
|
|
21
21
|
for (const parentObjectType of this.parentObjectTypes) {
|
|
22
|
-
jsonObjectMembers.push(`...${parentObjectType.name}.toJson(${this.thisVariable})
|
|
22
|
+
jsonObjectMembers.push(`...${parentObjectType.name}.toJson(${this.thisVariable})`);
|
|
23
23
|
}
|
|
24
24
|
parameters.push({
|
|
25
25
|
name: this.thisVariable,
|
package/input/generated.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type * as rdfjs from "@rdfjs/types";
|
|
2
2
|
import { PropertyPath } from "@shaclmate/shacl-ast/PropertyPath.js";
|
|
3
3
|
import * as purify from "purify-ts";
|
|
4
|
-
import type * as purifyHelpers from "purify-ts-helpers";
|
|
5
4
|
import * as rdfjsResource from "rdfjs-resource";
|
|
5
|
+
type UnwrapR<T> = T extends purify.Either<any, infer R> ? R : never;
|
|
6
6
|
export interface BaseShaclCoreShape {
|
|
7
7
|
readonly and: readonly (readonly (rdfjs.BlankNode | rdfjs.NamedNode)[])[];
|
|
8
8
|
readonly classes: readonly rdfjs.NamedNode[];
|
|
@@ -94,7 +94,7 @@ export declare namespace ShaclCorePropertyShape {
|
|
|
94
94
|
path: PropertyPath;
|
|
95
95
|
type: "ShaclCorePropertyShape" | "ShaclmatePropertyShape";
|
|
96
96
|
uniqueLang: purify.Maybe<boolean>;
|
|
97
|
-
} &
|
|
97
|
+
} & UnwrapR<ReturnType<typeof BaseShaclCoreShape.propertiesFromRdf>>>;
|
|
98
98
|
function fromRdf(parameters: Parameters<typeof ShaclCorePropertyShape.propertiesFromRdf>[0]): purify.Either<rdfjsResource.Resource.ValueError, ShaclCorePropertyShape>;
|
|
99
99
|
}
|
|
100
100
|
export interface ShaclmatePropertyShape extends ShaclCorePropertyShape {
|
|
@@ -118,7 +118,7 @@ export declare namespace ShaclmatePropertyShape {
|
|
|
118
118
|
name: purify.Maybe<string>;
|
|
119
119
|
type: "ShaclmatePropertyShape";
|
|
120
120
|
visibility: purify.Maybe<rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_Visibility_Private" | "http://minorg.github.io/shaclmate/ns#_Visibility_Protected" | "http://minorg.github.io/shaclmate/ns#_Visibility_Public">>;
|
|
121
|
-
} &
|
|
121
|
+
} & UnwrapR<ReturnType<typeof ShaclCorePropertyShape.propertiesFromRdf>>>;
|
|
122
122
|
function fromRdf(parameters: Parameters<typeof ShaclmatePropertyShape.propertiesFromRdf>[0]): purify.Either<rdfjsResource.Resource.ValueError, ShaclmatePropertyShape>;
|
|
123
123
|
}
|
|
124
124
|
export interface OwlOntology {
|
|
@@ -142,8 +142,8 @@ export declare namespace OwlOntology {
|
|
|
142
142
|
export interface ShaclmateOntology extends OwlOntology {
|
|
143
143
|
readonly identifier: rdfjs.BlankNode | rdfjs.NamedNode;
|
|
144
144
|
readonly tsDataFactoryVariable: purify.Maybe<string>;
|
|
145
|
-
readonly tsFeatureExcludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
|
|
146
|
-
readonly tsFeatureIncludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
|
|
145
|
+
readonly tsFeatureExcludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
|
|
146
|
+
readonly tsFeatureIncludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
|
|
147
147
|
readonly tsImports: readonly string[];
|
|
148
148
|
readonly tsObjectDeclarationType: purify.Maybe<rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Class" | "http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Interface">>;
|
|
149
149
|
readonly tsObjectIdentifierPropertyName: purify.Maybe<string>;
|
|
@@ -159,14 +159,14 @@ export declare namespace ShaclmateOntology {
|
|
|
159
159
|
}): purify.Either<rdfjsResource.Resource.ValueError, {
|
|
160
160
|
identifier: rdfjs.BlankNode | rdfjs.NamedNode;
|
|
161
161
|
tsDataFactoryVariable: purify.Maybe<string>;
|
|
162
|
-
tsFeatureExcludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
|
|
163
|
-
tsFeatureIncludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
|
|
162
|
+
tsFeatureExcludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
|
|
163
|
+
tsFeatureIncludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
|
|
164
164
|
tsImports: readonly string[];
|
|
165
165
|
tsObjectDeclarationType: purify.Maybe<rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Class" | "http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Interface">>;
|
|
166
166
|
tsObjectIdentifierPropertyName: purify.Maybe<string>;
|
|
167
167
|
tsObjectTypeDiscriminatorPropertyName: purify.Maybe<string>;
|
|
168
168
|
type: "ShaclmateOntology";
|
|
169
|
-
} &
|
|
169
|
+
} & UnwrapR<ReturnType<typeof OwlOntology.propertiesFromRdf>>>;
|
|
170
170
|
function fromRdf(parameters: Parameters<typeof ShaclmateOntology.propertiesFromRdf>[0]): purify.Either<rdfjsResource.Resource.ValueError, ShaclmateOntology>;
|
|
171
171
|
}
|
|
172
172
|
export interface ShaclCoreNodeShape extends BaseShaclCoreShape {
|
|
@@ -188,7 +188,7 @@ export declare namespace ShaclCoreNodeShape {
|
|
|
188
188
|
ignoredProperties: purify.Maybe<readonly rdfjs.NamedNode[]>;
|
|
189
189
|
properties: readonly (rdfjs.BlankNode | rdfjs.NamedNode)[];
|
|
190
190
|
type: "ShaclCoreNodeShape" | "ShaclmateNodeShape";
|
|
191
|
-
} &
|
|
191
|
+
} & UnwrapR<ReturnType<typeof BaseShaclCoreShape.propertiesFromRdf>>>;
|
|
192
192
|
function fromRdf(parameters: Parameters<typeof ShaclCoreNodeShape.propertiesFromRdf>[0]): purify.Either<rdfjsResource.Resource.ValueError, ShaclCoreNodeShape>;
|
|
193
193
|
}
|
|
194
194
|
export interface ShaclmateNodeShape extends ShaclCoreNodeShape {
|
|
@@ -201,8 +201,8 @@ export interface ShaclmateNodeShape extends ShaclCoreNodeShape {
|
|
|
201
201
|
readonly mutable: purify.Maybe<boolean>;
|
|
202
202
|
readonly name: purify.Maybe<string>;
|
|
203
203
|
readonly toRdfTypes: readonly rdfjs.NamedNode[];
|
|
204
|
-
readonly tsFeatureExcludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
|
|
205
|
-
readonly tsFeatureIncludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
|
|
204
|
+
readonly tsFeatureExcludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
|
|
205
|
+
readonly tsFeatureIncludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
|
|
206
206
|
readonly tsImports: readonly string[];
|
|
207
207
|
readonly tsObjectDeclarationType: purify.Maybe<rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Class" | "http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Interface">>;
|
|
208
208
|
readonly tsObjectIdentifierPropertyName: purify.Maybe<string>;
|
|
@@ -225,14 +225,14 @@ export declare namespace ShaclmateNodeShape {
|
|
|
225
225
|
mutable: purify.Maybe<boolean>;
|
|
226
226
|
name: purify.Maybe<string>;
|
|
227
227
|
toRdfTypes: readonly rdfjs.NamedNode[];
|
|
228
|
-
tsFeatureExcludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
|
|
229
|
-
tsFeatureIncludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
|
|
228
|
+
tsFeatureExcludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
|
|
229
|
+
tsFeatureIncludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
|
|
230
230
|
tsImports: readonly string[];
|
|
231
231
|
tsObjectDeclarationType: purify.Maybe<rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Class" | "http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Interface">>;
|
|
232
232
|
tsObjectIdentifierPropertyName: purify.Maybe<string>;
|
|
233
233
|
tsObjectTypeDiscriminatorPropertyName: purify.Maybe<string>;
|
|
234
234
|
type: "ShaclmateNodeShape";
|
|
235
|
-
} &
|
|
235
|
+
} & UnwrapR<ReturnType<typeof ShaclCoreNodeShape.propertiesFromRdf>>>;
|
|
236
236
|
function fromRdf(parameters: Parameters<typeof ShaclmateNodeShape.propertiesFromRdf>[0]): purify.Either<rdfjsResource.Resource.ValueError, ShaclmateNodeShape>;
|
|
237
237
|
}
|
|
238
238
|
export interface ShaclCorePropertyGroup {
|
|
@@ -271,4 +271,5 @@ export declare namespace ShaclmateShape {
|
|
|
271
271
|
resource: rdfjsResource.Resource;
|
|
272
272
|
}): purify.Either<rdfjsResource.Resource.ValueError, ShaclmateShape>;
|
|
273
273
|
}
|
|
274
|
+
export {};
|
|
274
275
|
//# sourceMappingURL=generated.d.ts.map
|