@shaclmate/compiler 2.0.14 → 2.0.16
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 +22 -7
- package/_ShapesGraphToAstTransformer/transformPropertyShapeToAstCompositeType.js +5 -3
- package/ast/ListType.d.ts +2 -2
- package/ast/ObjectType.d.ts +18 -12
- package/enums/IdentifierMintingStrategy.d.ts +5 -0
- package/enums/IdentifierMintingStrategy.js +2 -0
- package/enums/index.d.ts +1 -1
- package/enums/index.js +1 -1
- package/generators/json/AstJsonGenerator.js +5 -1
- package/generators/ts/DateTimeType.d.ts +3 -1
- package/generators/ts/DateTimeType.js +9 -1
- package/generators/ts/IdentifierType.d.ts +2 -0
- package/generators/ts/IdentifierType.js +11 -0
- package/generators/ts/Import.d.ts +0 -1
- package/generators/ts/Import.js +0 -5
- package/generators/ts/ListType.d.ts +4 -3
- package/generators/ts/ListType.js +27 -16
- package/generators/ts/ObjectType.d.ts +5 -4
- package/generators/ts/ObjectType.js +21 -9
- package/generators/ts/ObjectUnionType.d.ts +1 -1
- package/generators/ts/ObjectUnionType.js +22 -52
- 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 +18 -8
- package/generators/ts/UnionType.d.ts +2 -1
- package/generators/ts/UnionType.js +3 -3
- package/generators/ts/_ObjectType/IdentifierProperty.d.ts +7 -8
- package/generators/ts/_ObjectType/IdentifierProperty.js +99 -25
- 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/fromRdfTypeVariableStatement.d.ts +5 -0
- package/generators/ts/_ObjectType/fromRdfTypeVariableStatement.js +25 -0
- package/generators/ts/_ObjectType/index.d.ts +1 -0
- package/generators/ts/_ObjectType/index.js +1 -0
- 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/generators/ts/_ObjectType/toRdfFunctionOrMethodDeclaration.js +3 -3
- package/input/NodeShape.d.ts +2 -2
- package/input/generated.d.ts +24 -16
- package/input/generated.js +53 -8
- package/input/tsFeatures.d.ts +1 -1
- package/input/tsFeatures.js +21 -13
- package/package.json +4 -4
- package/enums/MintingStrategy.d.ts +0 -5
- package/enums/MintingStrategy.js +0 -2
|
@@ -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,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import { type VariableStatementStructure } from "ts-morph";
|
|
3
|
+
import type { ObjectType } from "../ObjectType.js";
|
|
4
|
+
export declare function fromRdfTypeVariableDeclaration(this: ObjectType): Maybe<VariableStatementStructure>;
|
|
5
|
+
//# sourceMappingURL=fromRdfTypeVariableStatement.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import { StructureKind } from "ts-morph";
|
|
3
|
+
export function fromRdfTypeVariableDeclaration() {
|
|
4
|
+
if (!this.features.has("fromRdf")) {
|
|
5
|
+
return Maybe.empty();
|
|
6
|
+
}
|
|
7
|
+
if (this.extern) {
|
|
8
|
+
return Maybe.empty();
|
|
9
|
+
}
|
|
10
|
+
if (this.fromRdfType.isNothing()) {
|
|
11
|
+
return Maybe.empty();
|
|
12
|
+
}
|
|
13
|
+
return Maybe.of({
|
|
14
|
+
kind: StructureKind.VariableStatement,
|
|
15
|
+
declarations: [
|
|
16
|
+
{
|
|
17
|
+
name: "fromRdfType",
|
|
18
|
+
initializer: this.rdfjsTermExpression(this.fromRdfType.unsafeCoerce()),
|
|
19
|
+
type: "rdfjs.NamedNode<string>",
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
isExported: true,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=fromRdfTypeVariableStatement.js.map
|
|
@@ -3,6 +3,7 @@ export * from "./createFunctionDeclaration.js";
|
|
|
3
3
|
export * from "./equalsFunctionDeclaration.js";
|
|
4
4
|
export * from "./fromJsonFunctionDeclarations.js";
|
|
5
5
|
export * from "./fromRdfFunctionDeclarations.js";
|
|
6
|
+
export * from "./fromRdfTypeVariableStatement.js";
|
|
6
7
|
export * from "./hashFunctionDeclaration.js";
|
|
7
8
|
export * from "./IdentifierProperty.js";
|
|
8
9
|
export * from "./interfaceDeclaration.js";
|
|
@@ -3,6 +3,7 @@ export * from "./createFunctionDeclaration.js";
|
|
|
3
3
|
export * from "./equalsFunctionDeclaration.js";
|
|
4
4
|
export * from "./fromJsonFunctionDeclarations.js";
|
|
5
5
|
export * from "./fromRdfFunctionDeclarations.js";
|
|
6
|
+
export * from "./fromRdfTypeVariableStatement.js";
|
|
6
7
|
export * from "./hashFunctionDeclaration.js";
|
|
7
8
|
export * from "./IdentifierProperty.js";
|
|
8
9
|
export * from "./interfaceDeclaration.js";
|
|
@@ -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,
|
|
@@ -28,10 +28,10 @@ export function toRdfFunctionOrMethodDeclaration() {
|
|
|
28
28
|
usedIgnoreRdfTypeVariable = !this.parentObjectTypes[0].abstract;
|
|
29
29
|
}
|
|
30
30
|
else if (this.identifierType.isNamedNodeKind) {
|
|
31
|
-
statements.push(`const ${variables.resource} = ${variables.resourceSet}.mutableNamedResource(
|
|
31
|
+
statements.push(`const ${variables.resource} = ${variables.resourceSet}.mutableNamedResource(${this.thisVariable}.${this.identifierProperty.name}, { ${variables.mutateGraph} });`);
|
|
32
32
|
}
|
|
33
33
|
else {
|
|
34
|
-
statements.push(`const ${variables.resource} = ${variables.resourceSet}.mutableResource(
|
|
34
|
+
statements.push(`const ${variables.resource} = ${variables.resourceSet}.mutableResource(${this.thisVariable}.${this.identifierProperty.name}, { ${variables.mutateGraph} });`);
|
|
35
35
|
}
|
|
36
36
|
if (this.toRdfTypes.length > 0) {
|
|
37
37
|
statements.push(`if (!${variables.ignoreRdfType}) { ${this.toRdfTypes.map((toRdfType) => `${variables.resource}.add(${variables.resource}.dataFactory.namedNode("${rdf.type.value}"), ${variables.resource}.dataFactory.namedNode("${toRdfType.value}"));`).join(" ")} }`);
|
|
@@ -55,7 +55,7 @@ export function toRdfFunctionOrMethodDeclaration() {
|
|
|
55
55
|
}
|
|
56
56
|
parameters.push({
|
|
57
57
|
name: `{ ${usedIgnoreRdfTypeVariable ? `${variables.ignoreRdfType}, ` : ""}${variables.mutateGraph}, ${variables.resourceSet} }`,
|
|
58
|
-
type: `{ ${variables.ignoreRdfType}?: boolean; ${variables.mutateGraph}
|
|
58
|
+
type: `{ ${variables.ignoreRdfType}?: boolean; ${variables.mutateGraph}?: rdfjsResource.MutableResource.MutateGraph, ${variables.resourceSet}: rdfjsResource.MutableResourceSet }`,
|
|
59
59
|
});
|
|
60
60
|
return Maybe.of({
|
|
61
61
|
name: "toRdf",
|
package/input/NodeShape.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { NamedNode } from "@rdfjs/types";
|
|
2
2
|
import { NodeShape as ShaclCoreNodeShape } from "@shaclmate/shacl-ast";
|
|
3
3
|
import { Maybe } from "purify-ts";
|
|
4
|
-
import type {
|
|
4
|
+
import type { IdentifierMintingStrategy, TsFeature, TsObjectDeclarationType } from "../enums/index.js";
|
|
5
5
|
import type { Shape } from "./Shape.js";
|
|
6
6
|
import type * as generated from "./generated.js";
|
|
7
7
|
import type { Ontology, PropertyGroup, PropertyShape, ShapesGraph } from "./index.js";
|
|
@@ -30,7 +30,7 @@ export declare class NodeShape extends ShaclCoreNodeShape<any, Ontology, Propert
|
|
|
30
30
|
get export(): Maybe<boolean>;
|
|
31
31
|
get extern(): Maybe<boolean>;
|
|
32
32
|
get fromRdfType(): Maybe<NamedNode>;
|
|
33
|
-
get mintingStrategy(): Maybe<
|
|
33
|
+
get mintingStrategy(): Maybe<IdentifierMintingStrategy>;
|
|
34
34
|
get mutable(): Maybe<boolean>;
|
|
35
35
|
get nodeKinds(): Set<"BlankNode" | "NamedNode">;
|
|
36
36
|
get parentNodeShapes(): readonly NodeShape[];
|
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,8 +94,9 @@ 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
|
+
const fromRdfType: rdfjs.NamedNode<string>;
|
|
99
100
|
}
|
|
100
101
|
export interface ShaclmatePropertyShape extends ShaclCorePropertyShape {
|
|
101
102
|
readonly extern: purify.Maybe<boolean>;
|
|
@@ -118,8 +119,9 @@ export declare namespace ShaclmatePropertyShape {
|
|
|
118
119
|
name: purify.Maybe<string>;
|
|
119
120
|
type: "ShaclmatePropertyShape";
|
|
120
121
|
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
|
-
} &
|
|
122
|
+
} & UnwrapR<ReturnType<typeof ShaclCorePropertyShape.propertiesFromRdf>>>;
|
|
122
123
|
function fromRdf(parameters: Parameters<typeof ShaclmatePropertyShape.propertiesFromRdf>[0]): purify.Either<rdfjsResource.Resource.ValueError, ShaclmatePropertyShape>;
|
|
124
|
+
const fromRdfType: rdfjs.NamedNode<string>;
|
|
123
125
|
}
|
|
124
126
|
export interface OwlOntology {
|
|
125
127
|
readonly identifier: rdfjs.BlankNode | rdfjs.NamedNode;
|
|
@@ -138,12 +140,13 @@ export declare namespace OwlOntology {
|
|
|
138
140
|
type: "OwlOntology" | "ShaclmateOntology";
|
|
139
141
|
}>;
|
|
140
142
|
function fromRdf(parameters: Parameters<typeof OwlOntology.propertiesFromRdf>[0]): purify.Either<rdfjsResource.Resource.ValueError, OwlOntology>;
|
|
143
|
+
const fromRdfType: rdfjs.NamedNode<string>;
|
|
141
144
|
}
|
|
142
145
|
export interface ShaclmateOntology extends OwlOntology {
|
|
143
146
|
readonly identifier: rdfjs.BlankNode | rdfjs.NamedNode;
|
|
144
147
|
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">[];
|
|
148
|
+
readonly tsFeatureExcludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_All" | "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_None" | "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">[];
|
|
149
|
+
readonly tsFeatureIncludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_All" | "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_None" | "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
150
|
readonly tsImports: readonly string[];
|
|
148
151
|
readonly tsObjectDeclarationType: purify.Maybe<rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Class" | "http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Interface">>;
|
|
149
152
|
readonly tsObjectIdentifierPropertyName: purify.Maybe<string>;
|
|
@@ -159,15 +162,16 @@ export declare namespace ShaclmateOntology {
|
|
|
159
162
|
}): purify.Either<rdfjsResource.Resource.ValueError, {
|
|
160
163
|
identifier: rdfjs.BlankNode | rdfjs.NamedNode;
|
|
161
164
|
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">[];
|
|
165
|
+
tsFeatureExcludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_All" | "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_None" | "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">[];
|
|
166
|
+
tsFeatureIncludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_All" | "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_None" | "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
167
|
tsImports: readonly string[];
|
|
165
168
|
tsObjectDeclarationType: purify.Maybe<rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Class" | "http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Interface">>;
|
|
166
169
|
tsObjectIdentifierPropertyName: purify.Maybe<string>;
|
|
167
170
|
tsObjectTypeDiscriminatorPropertyName: purify.Maybe<string>;
|
|
168
171
|
type: "ShaclmateOntology";
|
|
169
|
-
} &
|
|
172
|
+
} & UnwrapR<ReturnType<typeof OwlOntology.propertiesFromRdf>>>;
|
|
170
173
|
function fromRdf(parameters: Parameters<typeof ShaclmateOntology.propertiesFromRdf>[0]): purify.Either<rdfjsResource.Resource.ValueError, ShaclmateOntology>;
|
|
174
|
+
const fromRdfType: rdfjs.NamedNode<string>;
|
|
171
175
|
}
|
|
172
176
|
export interface ShaclCoreNodeShape extends BaseShaclCoreShape {
|
|
173
177
|
readonly closed: purify.Maybe<boolean>;
|
|
@@ -188,8 +192,9 @@ export declare namespace ShaclCoreNodeShape {
|
|
|
188
192
|
ignoredProperties: purify.Maybe<readonly rdfjs.NamedNode[]>;
|
|
189
193
|
properties: readonly (rdfjs.BlankNode | rdfjs.NamedNode)[];
|
|
190
194
|
type: "ShaclCoreNodeShape" | "ShaclmateNodeShape";
|
|
191
|
-
} &
|
|
195
|
+
} & UnwrapR<ReturnType<typeof BaseShaclCoreShape.propertiesFromRdf>>>;
|
|
192
196
|
function fromRdf(parameters: Parameters<typeof ShaclCoreNodeShape.propertiesFromRdf>[0]): purify.Either<rdfjsResource.Resource.ValueError, ShaclCoreNodeShape>;
|
|
197
|
+
const fromRdfType: rdfjs.NamedNode<string>;
|
|
193
198
|
}
|
|
194
199
|
export interface ShaclmateNodeShape extends ShaclCoreNodeShape {
|
|
195
200
|
readonly abstract: purify.Maybe<boolean>;
|
|
@@ -201,8 +206,8 @@ export interface ShaclmateNodeShape extends ShaclCoreNodeShape {
|
|
|
201
206
|
readonly mutable: purify.Maybe<boolean>;
|
|
202
207
|
readonly name: purify.Maybe<string>;
|
|
203
208
|
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">[];
|
|
209
|
+
readonly tsFeatureExcludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_All" | "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_None" | "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">[];
|
|
210
|
+
readonly tsFeatureIncludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_All" | "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_None" | "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
211
|
readonly tsImports: readonly string[];
|
|
207
212
|
readonly tsObjectDeclarationType: purify.Maybe<rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Class" | "http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Interface">>;
|
|
208
213
|
readonly tsObjectIdentifierPropertyName: purify.Maybe<string>;
|
|
@@ -225,15 +230,16 @@ export declare namespace ShaclmateNodeShape {
|
|
|
225
230
|
mutable: purify.Maybe<boolean>;
|
|
226
231
|
name: purify.Maybe<string>;
|
|
227
232
|
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">[];
|
|
233
|
+
tsFeatureExcludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_All" | "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_None" | "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">[];
|
|
234
|
+
tsFeatureIncludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_All" | "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_None" | "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
235
|
tsImports: readonly string[];
|
|
231
236
|
tsObjectDeclarationType: purify.Maybe<rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Class" | "http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Interface">>;
|
|
232
237
|
tsObjectIdentifierPropertyName: purify.Maybe<string>;
|
|
233
238
|
tsObjectTypeDiscriminatorPropertyName: purify.Maybe<string>;
|
|
234
239
|
type: "ShaclmateNodeShape";
|
|
235
|
-
} &
|
|
240
|
+
} & UnwrapR<ReturnType<typeof ShaclCoreNodeShape.propertiesFromRdf>>>;
|
|
236
241
|
function fromRdf(parameters: Parameters<typeof ShaclmateNodeShape.propertiesFromRdf>[0]): purify.Either<rdfjsResource.Resource.ValueError, ShaclmateNodeShape>;
|
|
242
|
+
const fromRdfType: rdfjs.NamedNode<string>;
|
|
237
243
|
}
|
|
238
244
|
export interface ShaclCorePropertyGroup {
|
|
239
245
|
readonly comments: readonly rdfjs.Literal[];
|
|
@@ -254,10 +260,11 @@ export declare namespace ShaclCorePropertyGroup {
|
|
|
254
260
|
type: "ShaclCorePropertyGroup";
|
|
255
261
|
}>;
|
|
256
262
|
function fromRdf(parameters: Parameters<typeof ShaclCorePropertyGroup.propertiesFromRdf>[0]): purify.Either<rdfjsResource.Resource.ValueError, ShaclCorePropertyGroup>;
|
|
263
|
+
const fromRdfType: rdfjs.NamedNode<string>;
|
|
257
264
|
}
|
|
258
265
|
export type ShaclCoreShape = ShaclCoreNodeShape | ShaclCorePropertyShape;
|
|
259
266
|
export declare namespace ShaclCoreShape {
|
|
260
|
-
function fromRdf(
|
|
267
|
+
function fromRdf({ ignoreRdfType, resource, ...context }: {
|
|
261
268
|
[_index: string]: any;
|
|
262
269
|
ignoreRdfType?: boolean;
|
|
263
270
|
resource: rdfjsResource.Resource;
|
|
@@ -265,10 +272,11 @@ export declare namespace ShaclCoreShape {
|
|
|
265
272
|
}
|
|
266
273
|
export type ShaclmateShape = ShaclmateNodeShape | ShaclCorePropertyShape;
|
|
267
274
|
export declare namespace ShaclmateShape {
|
|
268
|
-
function fromRdf(
|
|
275
|
+
function fromRdf({ ignoreRdfType, resource, ...context }: {
|
|
269
276
|
[_index: string]: any;
|
|
270
277
|
ignoreRdfType?: boolean;
|
|
271
278
|
resource: rdfjsResource.Resource;
|
|
272
279
|
}): purify.Either<rdfjsResource.Resource.ValueError, ShaclmateShape>;
|
|
273
280
|
}
|
|
281
|
+
export {};
|
|
274
282
|
//# sourceMappingURL=generated.d.ts.map
|