@shaclmate/compiler 2.0.22 → 2.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ShapesGraphToAstTransformer.d.ts +1 -0
- package/dist/ShapesGraphToAstTransformer.js +56 -12
- package/dist/_ShapesGraphToAstTransformer/flattenAstObjectCompositeTypeMemberTypes.d.ts +13 -0
- package/dist/_ShapesGraphToAstTransformer/flattenAstObjectCompositeTypeMemberTypes.js +51 -0
- package/dist/_ShapesGraphToAstTransformer/shapeAstName.js +53 -12
- package/dist/_ShapesGraphToAstTransformer/transformNodeShapeToAstType.d.ts +5 -0
- package/dist/_ShapesGraphToAstTransformer/transformNodeShapeToAstType.js +130 -54
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstCompositeType.d.ts +2 -3
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstCompositeType.js +122 -129
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstIdentifierType.d.ts +2 -2
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstLiteralType.d.ts +2 -2
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +127 -5
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstTermType.d.ts +3 -3
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstType.d.ts +2 -3
- package/dist/ast/Ast.d.ts +0 -1
- package/dist/ast/Curie.d.ts +14 -0
- package/dist/ast/Curie.js +21 -0
- package/dist/ast/IdentifierType.d.ts +3 -2
- package/dist/ast/ListType.d.ts +2 -1
- package/dist/ast/LiteralType.d.ts +1 -1
- package/dist/ast/Name.d.ts +40 -5
- package/dist/ast/ObjectCompositeType.d.ts +11 -0
- package/dist/ast/ObjectType.d.ts +18 -13
- package/dist/ast/ObjectUnionType.d.ts +0 -11
- package/dist/ast/OptionType.d.ts +2 -2
- package/dist/ast/SetType.d.ts +2 -2
- package/dist/ast/TermType.d.ts +12 -4
- package/dist/ast/Type.d.ts +1 -1
- package/dist/enums/TsFeature.d.ts +1 -4
- package/dist/enums/TsFeature.js +1 -15
- package/dist/generators/json/AstJsonGenerator.js +19 -3
- package/dist/generators/ts/BooleanType.d.ts +3 -1
- package/dist/generators/ts/BooleanType.js +11 -2
- package/dist/generators/ts/DateTimeType.d.ts +8 -7
- package/dist/generators/ts/DateTimeType.js +31 -7
- package/dist/generators/ts/DateType.d.ts +5 -2
- package/dist/generators/ts/DateType.js +15 -1
- package/dist/generators/ts/DeclaredType.d.ts +2 -2
- package/dist/generators/ts/DeclaredType.js +2 -2
- package/dist/generators/ts/FloatType.d.ts +6 -0
- package/dist/generators/ts/FloatType.js +18 -0
- package/dist/generators/ts/IdentifierType.d.ts +12 -7
- package/dist/generators/ts/IdentifierType.js +94 -6
- package/dist/generators/ts/Import.d.ts +2 -0
- package/dist/generators/ts/Import.js +10 -0
- package/dist/generators/ts/IntType.d.ts +6 -0
- package/dist/generators/ts/IntType.js +18 -0
- package/dist/generators/ts/ListType.d.ts +15 -12
- package/dist/generators/ts/ListType.js +98 -57
- package/dist/generators/ts/LiteralType.d.ts +10 -9
- package/dist/generators/ts/LiteralType.js +13 -2
- package/dist/generators/ts/NumberType.d.ts +2 -1
- package/dist/generators/ts/NumberType.js +7 -2
- package/dist/generators/ts/ObjectType.d.ts +66 -43
- package/dist/generators/ts/ObjectType.js +144 -123
- package/dist/generators/ts/ObjectUnionType.d.ts +49 -8
- package/dist/generators/ts/ObjectUnionType.js +290 -97
- package/dist/generators/ts/OptionType.d.ts +14 -10
- package/dist/generators/ts/OptionType.js +60 -34
- package/dist/generators/ts/PrimitiveType.d.ts +4 -4
- package/dist/generators/ts/PrimitiveType.js +18 -3
- package/dist/generators/ts/SetType.d.ts +16 -12
- package/dist/generators/ts/SetType.js +69 -40
- package/dist/generators/ts/SnippetDeclarations.d.ts +13 -8
- package/dist/generators/ts/SnippetDeclarations.js +215 -101
- package/dist/generators/ts/StringType.d.ts +3 -1
- package/dist/generators/ts/StringType.js +14 -2
- package/dist/generators/ts/TermType.d.ts +22 -14
- package/dist/generators/ts/TermType.js +53 -25
- package/dist/generators/ts/TsGenerator.d.ts +2 -1
- package/dist/generators/ts/TsGenerator.js +23 -12
- package/dist/generators/ts/Type.d.ts +89 -31
- package/dist/generators/ts/Type.js +57 -54
- package/dist/generators/ts/TypeFactory.d.ts +4 -5
- package/dist/generators/ts/TypeFactory.js +290 -226
- package/dist/generators/ts/UnionType.d.ts +14 -10
- package/dist/generators/ts/UnionType.js +319 -142
- package/dist/generators/ts/_ObjectType/EagerShaclProperty.d.ts +12 -0
- package/dist/generators/ts/_ObjectType/EagerShaclProperty.js +30 -0
- package/dist/generators/ts/_ObjectType/IdentifierPrefixProperty.d.ts +13 -12
- package/dist/generators/ts/_ObjectType/IdentifierPrefixProperty.js +46 -47
- package/dist/generators/ts/_ObjectType/IdentifierProperty.d.ts +20 -13
- package/dist/generators/ts/_ObjectType/IdentifierProperty.js +152 -124
- package/dist/generators/ts/_ObjectType/LazyShaclProperty.d.ts +87 -0
- package/dist/generators/ts/_ObjectType/LazyShaclProperty.js +237 -0
- package/dist/generators/ts/_ObjectType/Property.d.ts +39 -44
- package/dist/generators/ts/_ObjectType/Property.js +1 -10
- package/dist/generators/ts/_ObjectType/ShaclProperty.d.ts +25 -30
- package/dist/generators/ts/_ObjectType/ShaclProperty.js +108 -85
- package/dist/generators/ts/_ObjectType/TypeDiscriminatorProperty.d.ts +21 -17
- package/dist/generators/ts/_ObjectType/TypeDiscriminatorProperty.js +61 -53
- package/dist/generators/ts/_ObjectType/classDeclaration.js +6 -5
- package/dist/generators/ts/_ObjectType/createFunctionDeclaration.js +5 -4
- package/dist/generators/ts/_ObjectType/equalsFunctionOrMethodDeclaration.js +5 -4
- package/dist/generators/ts/_ObjectType/fromRdfTypeVariableStatement.d.ts +1 -1
- package/dist/generators/ts/_ObjectType/fromRdfTypeVariableStatement.js +8 -5
- package/dist/generators/ts/_ObjectType/graphqlTypeVariableStatement.d.ts +5 -0
- package/dist/generators/ts/_ObjectType/graphqlTypeVariableStatement.js +37 -0
- package/dist/generators/ts/_ObjectType/hashFunctionOrMethodDeclarations.js +7 -8
- package/dist/generators/ts/_ObjectType/identifierTypeDeclarations.d.ts +7 -0
- package/dist/generators/ts/_ObjectType/identifierTypeDeclarations.js +54 -0
- package/dist/generators/ts/_ObjectType/index.d.ts +9 -7
- package/dist/generators/ts/_ObjectType/index.js +9 -7
- package/dist/generators/ts/_ObjectType/interfaceDeclaration.js +1 -1
- package/dist/generators/ts/_ObjectType/jsonFunctionDeclarations.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/jsonFunctionDeclarations.js +189 -0
- package/dist/generators/ts/_ObjectType/jsonTypeAliasDeclaration.d.ts +5 -0
- package/dist/generators/ts/_ObjectType/jsonTypeAliasDeclaration.js +28 -0
- package/dist/generators/ts/_ObjectType/objectSetMethodNames.d.ts +9 -0
- package/dist/generators/ts/_ObjectType/objectSetMethodNames.js +18 -0
- package/dist/generators/ts/_ObjectType/propertiesVariableStatement.d.ts +5 -0
- package/dist/generators/ts/_ObjectType/propertiesVariableStatement.js +37 -0
- package/dist/generators/ts/_ObjectType/rdfFunctionDeclarations.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/rdfFunctionDeclarations.js +152 -0
- package/dist/generators/ts/_ObjectType/sparqlConstructQueryFunctionDeclaration.d.ts +1 -1
- package/dist/generators/ts/_ObjectType/sparqlConstructQueryFunctionDeclaration.js +4 -3
- package/dist/generators/ts/_ObjectType/sparqlConstructQueryStringFunctionDeclaration.d.ts +1 -1
- package/dist/generators/ts/_ObjectType/sparqlConstructQueryStringFunctionDeclaration.js +3 -2
- package/dist/generators/ts/_ObjectType/sparqlFunctionDeclarations.js +103 -35
- package/dist/generators/ts/_ObjectType/toJsonFunctionOrMethodDeclaration.js +6 -6
- package/dist/generators/ts/_ObjectType/toRdfFunctionOrMethodDeclaration.js +15 -13
- package/dist/generators/ts/graphqlSchemaVariableStatement.d.ts +9 -0
- package/dist/generators/ts/graphqlSchemaVariableStatement.js +86 -0
- package/dist/generators/ts/objectSetDeclarations.d.ts +8 -0
- package/dist/generators/ts/objectSetDeclarations.js +59 -0
- package/dist/generators/ts/objectSetInterfaceDeclaration.d.ts +8 -0
- package/dist/generators/ts/objectSetInterfaceDeclaration.js +46 -0
- package/dist/generators/ts/objectSetMethodSignatures.d.ts +11 -0
- package/dist/generators/ts/objectSetMethodSignatures.js +52 -0
- package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.d.ts +8 -0
- package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.js +393 -0
- package/dist/generators/ts/rdfjsTermExpression.d.ts +3 -0
- package/dist/generators/ts/rdfjsTermExpression.js +57 -0
- package/dist/generators/ts/sparqlObjectSetClassDeclaration.d.ts +8 -0
- package/dist/generators/ts/sparqlObjectSetClassDeclaration.js +415 -0
- package/dist/generators/ts/syntheticNamePrefix.d.ts +2 -0
- package/dist/generators/ts/syntheticNamePrefix.js +2 -0
- package/dist/generators/ts/tsName.js +27 -13
- package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.d.ts +10 -0
- package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.js +19 -0
- package/dist/input/NodeShape.d.ts +6 -8
- package/dist/input/NodeShape.js +20 -44
- package/dist/input/Ontology.d.ts +0 -3
- package/dist/input/Ontology.js +0 -9
- package/dist/input/PropertyPath.d.ts +6 -5
- package/dist/input/PropertyPath.js +14 -22
- package/dist/input/PropertyShape.d.ts +3 -1
- package/dist/input/PropertyShape.js +8 -2
- package/dist/input/ShapesGraph.js +4 -4
- package/dist/input/generated.d.ts +923 -105
- package/dist/input/generated.js +1865 -969
- package/dist/input/tsFeatures.d.ts +3 -2
- package/dist/input/tsFeatures.js +44 -27
- package/package.json +18 -16
- package/dist/generators/ts/_ObjectType/fromJsonFunctionDeclarations.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/fromJsonFunctionDeclarations.js +0 -78
- package/dist/generators/ts/_ObjectType/fromRdfFunctionDeclarations.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/fromRdfFunctionDeclarations.js +0 -91
- package/dist/generators/ts/_ObjectType/jsonSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/jsonSchemaFunctionDeclaration.js +0 -19
- package/dist/generators/ts/_ObjectType/jsonUiSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/jsonUiSchemaFunctionDeclaration.js +0 -31
- package/dist/generators/ts/_ObjectType/jsonZodSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/jsonZodSchemaFunctionDeclaration.js +0 -37
- package/dist/generators/ts/_ObjectType/rdfjsTermExpression.d.ts +0 -6
- package/dist/generators/ts/_ObjectType/rdfjsTermExpression.js +0 -17
- package/dist/generators/ts/_ObjectType/toJsonFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/toJsonFunctionDeclaration.js +0 -19
- package/dist/generators/ts/_ObjectType/toJsonReturnType.d.ts +0 -3
- package/dist/generators/ts/_ObjectType/toJsonReturnType.js +0 -17
- package/dist/generators/ts/_ObjectType/toRdfFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/toRdfFunctionDeclaration.js +0 -19
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type InterfaceDeclarationStructure, type ModuleDeclarationStructure } from "ts-morph";
|
|
2
|
+
import type { ObjectType } from "./ObjectType.js";
|
|
3
|
+
import type { ObjectUnionType } from "./ObjectUnionType.js";
|
|
4
|
+
export declare function objectSetInterfaceDeclaration({ objectTypes, objectUnionTypes, }: {
|
|
5
|
+
objectTypes: readonly ObjectType[];
|
|
6
|
+
objectUnionTypes: readonly ObjectUnionType[];
|
|
7
|
+
}): readonly (InterfaceDeclarationStructure | ModuleDeclarationStructure)[];
|
|
8
|
+
//# sourceMappingURL=objectSetInterfaceDeclaration.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { StructureKind, } from "ts-morph";
|
|
2
|
+
import { objectSetMethodSignatures } from "./objectSetMethodSignatures.js";
|
|
3
|
+
import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
|
|
4
|
+
export function objectSetInterfaceDeclaration({ objectTypes, objectUnionTypes, }) {
|
|
5
|
+
const typeParameters = {
|
|
6
|
+
ObjectIdentifierT: {
|
|
7
|
+
constraint: "rdfjs.BlankNode | rdfjs.NamedNode",
|
|
8
|
+
name: "ObjectIdentifierT",
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
return [
|
|
12
|
+
{
|
|
13
|
+
isExported: true,
|
|
14
|
+
kind: StructureKind.Interface,
|
|
15
|
+
methods: objectTypes
|
|
16
|
+
.flatMap((objectType) => Object.values(objectSetMethodSignatures({ objectType })))
|
|
17
|
+
.concat(objectUnionTypes.flatMap((objectUnionType) => Object.values(objectSetMethodSignatures({ objectType: objectUnionType })))),
|
|
18
|
+
name: `${syntheticNamePrefix}ObjectSet`,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
isExported: true,
|
|
22
|
+
kind: StructureKind.Module,
|
|
23
|
+
name: `${syntheticNamePrefix}ObjectSet`,
|
|
24
|
+
statements: [
|
|
25
|
+
{
|
|
26
|
+
kind: StructureKind.TypeAlias,
|
|
27
|
+
isExported: true,
|
|
28
|
+
name: "Query",
|
|
29
|
+
type: `{ readonly limit?: number; readonly offset?: number; readonly where?: Where<${typeParameters.ObjectIdentifierT.name}> }`,
|
|
30
|
+
typeParameters: [typeParameters.ObjectIdentifierT],
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
kind: StructureKind.TypeAlias,
|
|
34
|
+
isExported: true,
|
|
35
|
+
name: "Where",
|
|
36
|
+
type: [
|
|
37
|
+
`{ readonly identifiers: readonly ${typeParameters.ObjectIdentifierT.name}[]; readonly type: "identifiers" } `,
|
|
38
|
+
`{ readonly predicate: rdfjs.NamedNode; readonly subject: rdfjs.BlankNode | rdfjs.NamedNode; readonly type: "triple-objects" } `,
|
|
39
|
+
].join(" | "),
|
|
40
|
+
typeParameters: [typeParameters.ObjectIdentifierT],
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=objectSetInterfaceDeclaration.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { MethodSignatureStructure, OptionalKind } from "ts-morph";
|
|
2
|
+
import type { ObjectType } from "./ObjectType.js";
|
|
3
|
+
export declare function objectSetMethodSignatures(parameters: {
|
|
4
|
+
objectType: {
|
|
5
|
+
readonly identifierTypeAlias: string;
|
|
6
|
+
readonly objectSetMethodNames: ObjectType.ObjectSetMethodNames;
|
|
7
|
+
readonly name: string;
|
|
8
|
+
};
|
|
9
|
+
queryT?: string;
|
|
10
|
+
}): Record<keyof ObjectType.ObjectSetMethodNames, OptionalKind<MethodSignatureStructure>>;
|
|
11
|
+
//# sourceMappingURL=objectSetMethodSignatures.d.ts.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
|
|
2
|
+
export function objectSetMethodSignatures(parameters) {
|
|
3
|
+
const { objectType } = parameters;
|
|
4
|
+
const queryT = parameters.queryT ?? `${syntheticNamePrefix}ObjectSet.Query`;
|
|
5
|
+
const methodNames = objectType.objectSetMethodNames;
|
|
6
|
+
return {
|
|
7
|
+
object: {
|
|
8
|
+
name: methodNames.object,
|
|
9
|
+
parameters: [
|
|
10
|
+
{
|
|
11
|
+
name: "identifier",
|
|
12
|
+
type: objectType.identifierTypeAlias,
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
returnType: `Promise<purify.Either<Error, ${objectType.name}>>`,
|
|
16
|
+
},
|
|
17
|
+
objectIdentifiers: {
|
|
18
|
+
name: methodNames.objectIdentifiers,
|
|
19
|
+
parameters: [
|
|
20
|
+
{
|
|
21
|
+
hasQuestionToken: true,
|
|
22
|
+
name: "query",
|
|
23
|
+
type: `${queryT}<${objectType.identifierTypeAlias}>`,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
returnType: `Promise<purify.Either<Error, readonly ${objectType.identifierTypeAlias}[]>>`,
|
|
27
|
+
},
|
|
28
|
+
objects: {
|
|
29
|
+
name: methodNames.objects,
|
|
30
|
+
parameters: [
|
|
31
|
+
{
|
|
32
|
+
hasQuestionToken: true,
|
|
33
|
+
name: "query",
|
|
34
|
+
type: `${queryT}<${objectType.identifierTypeAlias}>`,
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
returnType: `Promise<purify.Either<Error, readonly ${objectType.name}[]>>`,
|
|
38
|
+
},
|
|
39
|
+
objectsCount: {
|
|
40
|
+
name: methodNames.objectsCount,
|
|
41
|
+
parameters: [
|
|
42
|
+
{
|
|
43
|
+
hasQuestionToken: true,
|
|
44
|
+
name: "query",
|
|
45
|
+
type: `Pick<${queryT}<${objectType.identifierTypeAlias}>, "where">`,
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
returnType: "Promise<purify.Either<Error, number>>",
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=objectSetMethodSignatures.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ClassDeclarationStructure } from "ts-morph";
|
|
2
|
+
import type { ObjectType } from "./ObjectType.js";
|
|
3
|
+
import type { ObjectUnionType } from "./ObjectUnionType.js";
|
|
4
|
+
export declare function rdfjsDatasetObjectSetClassDeclaration({ objectTypes, objectUnionTypes, }: {
|
|
5
|
+
objectTypes: readonly ObjectType[];
|
|
6
|
+
objectUnionTypes: readonly ObjectUnionType[];
|
|
7
|
+
}): ClassDeclarationStructure;
|
|
8
|
+
//# sourceMappingURL=rdfjsDatasetObjectSetClassDeclaration.d.ts.map
|
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import { Scope, StructureKind, } from "ts-morph";
|
|
2
|
+
import { objectSetMethodSignatures } from "./objectSetMethodSignatures.js";
|
|
3
|
+
import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
|
|
4
|
+
import { unsupportedObjectSetMethodDeclarations } from "./unsupportedObjectSetMethodDeclarations.js";
|
|
5
|
+
export function rdfjsDatasetObjectSetClassDeclaration({ objectTypes, objectUnionTypes, }) {
|
|
6
|
+
const typeParameters = {
|
|
7
|
+
ObjectT: {
|
|
8
|
+
constraint: "{ readonly $identifier: ObjectIdentifierT }",
|
|
9
|
+
name: "ObjectT",
|
|
10
|
+
},
|
|
11
|
+
ObjectIdentifierT: {
|
|
12
|
+
constraint: "rdfjs.BlankNode | rdfjs.NamedNode",
|
|
13
|
+
name: "ObjectIdentifierT",
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
const fromRdfFunctionType = `(parameters: { objectSet: ${syntheticNamePrefix}ObjectSet, resource: rdfjsResource.Resource }) => purify.Either<Error, ${typeParameters.ObjectT.name}>`;
|
|
17
|
+
const reusableMethodDeclarations = [];
|
|
18
|
+
if (objectTypes.length > 0) {
|
|
19
|
+
const parameters = {
|
|
20
|
+
objectType: {
|
|
21
|
+
name: "objectType",
|
|
22
|
+
type: `{ ${syntheticNamePrefix}fromRdf: ${fromRdfFunctionType}; ${syntheticNamePrefix}fromRdfType?: rdfjs.NamedNode }`,
|
|
23
|
+
},
|
|
24
|
+
query: {
|
|
25
|
+
hasQuestionToken: true,
|
|
26
|
+
name: "query",
|
|
27
|
+
type: `${syntheticNamePrefix}ObjectSet.Query<${typeParameters.ObjectIdentifierT.name}>`,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
reusableMethodDeclarations.push({
|
|
31
|
+
kind: StructureKind.Method,
|
|
32
|
+
name: `${syntheticNamePrefix}objectIdentifiersSync`,
|
|
33
|
+
parameters: [parameters.objectType, parameters.query],
|
|
34
|
+
returnType: `purify.Either<Error, readonly ${typeParameters.ObjectIdentifierT.name}[]>`,
|
|
35
|
+
scope: Scope.Protected,
|
|
36
|
+
statements: [
|
|
37
|
+
`\
|
|
38
|
+
return this.${syntheticNamePrefix}objectsSync<${typeParameters.ObjectT.name}, ${typeParameters.ObjectIdentifierT.name}>(${parameters.objectType.name}, ${parameters.query.name}).map(objects => objects.map(object => object.${syntheticNamePrefix}identifier));`,
|
|
39
|
+
],
|
|
40
|
+
typeParameters: [
|
|
41
|
+
typeParameters.ObjectT,
|
|
42
|
+
typeParameters.ObjectIdentifierT,
|
|
43
|
+
],
|
|
44
|
+
}, {
|
|
45
|
+
kind: StructureKind.Method,
|
|
46
|
+
name: `${syntheticNamePrefix}objectsSync`,
|
|
47
|
+
parameters: [parameters.objectType, parameters.query],
|
|
48
|
+
returnType: `purify.Either<Error, readonly ${typeParameters.ObjectT.name}[]>`,
|
|
49
|
+
scope: Scope.Protected,
|
|
50
|
+
statements: [
|
|
51
|
+
`\
|
|
52
|
+
const limit = query?.limit ?? Number.MAX_SAFE_INTEGER;
|
|
53
|
+
if (limit <= 0) { return purify.Either.of([]); }
|
|
54
|
+
|
|
55
|
+
let offset = query?.offset ?? 0;
|
|
56
|
+
if (offset < 0) { offset = 0; }
|
|
57
|
+
|
|
58
|
+
if (query?.where) {
|
|
59
|
+
// Assign identifiers in each case block so the compiler will catch missing cases.
|
|
60
|
+
let identifiers: rdfjsResource.Resource.Identifier[];
|
|
61
|
+
switch (query.where.type) {
|
|
62
|
+
case "identifiers": {
|
|
63
|
+
identifiers = query.where.identifiers.slice(offset, offset + limit);
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
case "triple-objects": {
|
|
67
|
+
let identifierI = 0;
|
|
68
|
+
identifiers = [];
|
|
69
|
+
for (const quad of this.resourceSet.dataset.match(query.where.subject, query.where.predicate, null)) {
|
|
70
|
+
if (quad.object.termType === "BlankNode" || quad.object.termType === "NamedNode") {
|
|
71
|
+
if (++identifierI >= offset) {
|
|
72
|
+
identifiers.push(quad.object);
|
|
73
|
+
if (identifiers.length === limit) {
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
return purify.Left(new Error(\`subject=\${query.where.subject.value} predicate=\${query.where.predicate.value} pattern matches non-identifier (\${quad.object.termType}) triple\`));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const objects: ${typeParameters.ObjectT.name}[] = [];
|
|
86
|
+
for (const identifier of identifiers) {
|
|
87
|
+
const either = objectType.${syntheticNamePrefix}fromRdf({ objectSet: this, resource: this.resourceSet.resource(identifier) });
|
|
88
|
+
if (either.isLeft()) {
|
|
89
|
+
return either;
|
|
90
|
+
}
|
|
91
|
+
objects.push(either.unsafeCoerce());
|
|
92
|
+
}
|
|
93
|
+
return purify.Either.of(objects);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (!objectType.${syntheticNamePrefix}fromRdfType) {
|
|
97
|
+
return purify.Either.of([]);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const resources = [...this.resourceSet.instancesOf(objectType.${syntheticNamePrefix}fromRdfType)];
|
|
101
|
+
// Sort resources by identifier so limit and offset are deterministic
|
|
102
|
+
resources.sort((left, right) => left.identifier.value.localeCompare(right.identifier.value));
|
|
103
|
+
|
|
104
|
+
const objects: ${typeParameters.ObjectT.name}[] = [];
|
|
105
|
+
let objectI = 0;
|
|
106
|
+
for (const resource of resources) {
|
|
107
|
+
const either = objectType.${syntheticNamePrefix}fromRdf({ objectSet: this, resource });
|
|
108
|
+
if (either.isLeft()) {
|
|
109
|
+
return either;
|
|
110
|
+
}
|
|
111
|
+
if (objectI++ >= offset) {
|
|
112
|
+
objects.push(either.unsafeCoerce());
|
|
113
|
+
if (objects.length === limit) {
|
|
114
|
+
return purify.Either.of(objects);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return purify.Either.of(objects);
|
|
119
|
+
`,
|
|
120
|
+
],
|
|
121
|
+
typeParameters: [
|
|
122
|
+
typeParameters.ObjectT,
|
|
123
|
+
typeParameters.ObjectIdentifierT,
|
|
124
|
+
],
|
|
125
|
+
}, {
|
|
126
|
+
kind: StructureKind.Method,
|
|
127
|
+
name: `${syntheticNamePrefix}objectsCountSync`,
|
|
128
|
+
parameters: [parameters.objectType, parameters.query],
|
|
129
|
+
returnType: "purify.Either<Error, number>",
|
|
130
|
+
scope: Scope.Protected,
|
|
131
|
+
statements: [
|
|
132
|
+
`return this.${syntheticNamePrefix}objectsSync<${typeParameters.ObjectT.name}, ${typeParameters.ObjectIdentifierT.name}>(${parameters.objectType.name}, ${parameters.query.name}).map(objects => objects.length);`,
|
|
133
|
+
],
|
|
134
|
+
typeParameters: [
|
|
135
|
+
typeParameters.ObjectT,
|
|
136
|
+
typeParameters.ObjectIdentifierT,
|
|
137
|
+
],
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
if (objectUnionTypes.length > 0) {
|
|
141
|
+
const objectTypeType = `{ ${syntheticNamePrefix}fromRdf: ${fromRdfFunctionType}; ${syntheticNamePrefix}fromRdfType?: rdfjs.NamedNode }`;
|
|
142
|
+
const parameters = {
|
|
143
|
+
objectTypes: {
|
|
144
|
+
name: "objectTypes",
|
|
145
|
+
type: `readonly ${objectTypeType}[]`,
|
|
146
|
+
},
|
|
147
|
+
query: {
|
|
148
|
+
hasQuestionToken: true,
|
|
149
|
+
name: "query",
|
|
150
|
+
type: `${syntheticNamePrefix}ObjectSet.Query<${typeParameters.ObjectIdentifierT.name}>`,
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
reusableMethodDeclarations.push({
|
|
154
|
+
kind: StructureKind.Method,
|
|
155
|
+
name: `${syntheticNamePrefix}objectUnionIdentifiersSync`,
|
|
156
|
+
parameters: [parameters.objectTypes, parameters.query],
|
|
157
|
+
returnType: `purify.Either<Error, readonly ${typeParameters.ObjectIdentifierT.name}[]>`,
|
|
158
|
+
scope: Scope.Protected,
|
|
159
|
+
statements: [
|
|
160
|
+
`return this.${syntheticNamePrefix}objectUnionsSync<${typeParameters.ObjectT.name}, ${typeParameters.ObjectIdentifierT.name}>(${parameters.objectTypes.name}, ${parameters.query.name}).map(objects => objects.map(object => object.${syntheticNamePrefix}identifier));`,
|
|
161
|
+
],
|
|
162
|
+
typeParameters: [
|
|
163
|
+
typeParameters.ObjectT,
|
|
164
|
+
typeParameters.ObjectIdentifierT,
|
|
165
|
+
],
|
|
166
|
+
}, {
|
|
167
|
+
kind: StructureKind.Method,
|
|
168
|
+
name: `${syntheticNamePrefix}objectUnionsSync`,
|
|
169
|
+
parameters: [parameters.objectTypes, parameters.query],
|
|
170
|
+
returnType: `purify.Either<Error, readonly ${typeParameters.ObjectT.name}[]>`,
|
|
171
|
+
scope: Scope.Protected,
|
|
172
|
+
statements: [
|
|
173
|
+
`\
|
|
174
|
+
const limit = query?.limit ?? Number.MAX_SAFE_INTEGER;
|
|
175
|
+
if (limit <= 0) { return purify.Either.of([]); }
|
|
176
|
+
|
|
177
|
+
let offset = query?.offset ?? 0;
|
|
178
|
+
if (offset < 0) { offset = 0; }
|
|
179
|
+
|
|
180
|
+
if (query?.where) {
|
|
181
|
+
// Assign identifiers in each case block so the compiler will catch missing cases.
|
|
182
|
+
let identifiers: rdfjsResource.Resource.Identifier[];
|
|
183
|
+
switch (query.where.type) {
|
|
184
|
+
case "identifiers": {
|
|
185
|
+
identifiers = query.where.identifiers.slice(offset, offset + limit);
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
case "triple-objects": {
|
|
189
|
+
let identifierI = 0;
|
|
190
|
+
identifiers = [];
|
|
191
|
+
for (const quad of this.resourceSet.dataset.match(query.where.subject, query.where.predicate, null)) {
|
|
192
|
+
if (quad.object.termType === "BlankNode" || quad.object.termType === "NamedNode") {
|
|
193
|
+
if (++identifierI >= offset) {
|
|
194
|
+
identifiers.push(quad.object);
|
|
195
|
+
if (identifiers.length === limit) {
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
} else {
|
|
200
|
+
return purify.Left(new Error(\`subject=\${query.where.subject.value} predicate=\${query.where.predicate.value} pattern matches non-identifier (\${quad.object.termType}) triple\`));
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const objects: ${typeParameters.ObjectT.name}[] = [];
|
|
208
|
+
for (const identifier of identifiers) {
|
|
209
|
+
const resource = this.resourceSet.resource(identifier);
|
|
210
|
+
const lefts: purify.Either<Error, ${typeParameters.ObjectT.name}>[] = [];
|
|
211
|
+
for (const objectType of objectTypes) {
|
|
212
|
+
const either = objectType.${syntheticNamePrefix}fromRdf({ objectSet: this, resource });
|
|
213
|
+
if (either.isRight()) {
|
|
214
|
+
objects.push(either.unsafeCoerce());
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
lefts.push(either);
|
|
218
|
+
}
|
|
219
|
+
// Doesn't appear to belong to any of the known object types, just assume the first
|
|
220
|
+
if (lefts.length === objectTypes.length) {
|
|
221
|
+
return lefts[0] as unknown as purify.Either<Error, readonly ${typeParameters.ObjectT.name}[]>;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return purify.Either.of(objects);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const resources: { objectType: ${objectTypeType}, resource: rdfjsResource.Resource }[] = [];
|
|
228
|
+
for (const objectType of objectTypes) {
|
|
229
|
+
if (!objectType.${syntheticNamePrefix}fromRdfType) {
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
for (const resource of this.resourceSet.instancesOf(objectType.${syntheticNamePrefix}fromRdfType)) {
|
|
234
|
+
resources.push({ objectType, resource });
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// Sort resources by identifier so limit and offset are deterministic
|
|
239
|
+
resources.sort((left, right) => left.resource.identifier.value.localeCompare(right.resource.identifier.value));
|
|
240
|
+
|
|
241
|
+
let objectI = 0;
|
|
242
|
+
const objects: ${typeParameters.ObjectT.name}[] = [];
|
|
243
|
+
for (const { objectType, resource } of resources) {
|
|
244
|
+
const either = objectType.${syntheticNamePrefix}fromRdf({ objectSet: this, resource });
|
|
245
|
+
if (either.isLeft()) {
|
|
246
|
+
return either;
|
|
247
|
+
}
|
|
248
|
+
if (objectI++ >= offset) {
|
|
249
|
+
objects.push(either.unsafeCoerce());
|
|
250
|
+
if (objects.length === limit) {
|
|
251
|
+
return purify.Either.of(objects);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return purify.Either.of(objects);
|
|
256
|
+
`,
|
|
257
|
+
],
|
|
258
|
+
typeParameters: [
|
|
259
|
+
typeParameters.ObjectT,
|
|
260
|
+
typeParameters.ObjectIdentifierT,
|
|
261
|
+
],
|
|
262
|
+
}, {
|
|
263
|
+
kind: StructureKind.Method,
|
|
264
|
+
name: `${syntheticNamePrefix}objectUnionsCountSync`,
|
|
265
|
+
parameters: [parameters.objectTypes, parameters.query],
|
|
266
|
+
returnType: "purify.Either<Error, number>",
|
|
267
|
+
statements: [
|
|
268
|
+
`return this.${syntheticNamePrefix}objectUnionIdentifiersSync<${typeParameters.ObjectT.name}, ${typeParameters.ObjectIdentifierT.name}>(${parameters.objectTypes.name}, ${parameters.query.name}).map(objects => objects.length);`,
|
|
269
|
+
],
|
|
270
|
+
typeParameters: [
|
|
271
|
+
typeParameters.ObjectT,
|
|
272
|
+
typeParameters.ObjectIdentifierT,
|
|
273
|
+
],
|
|
274
|
+
scope: Scope.Protected,
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
return {
|
|
278
|
+
ctors: [
|
|
279
|
+
{
|
|
280
|
+
parameters: [
|
|
281
|
+
{
|
|
282
|
+
name: "{ dataset }",
|
|
283
|
+
type: "{ dataset: rdfjs.DatasetCore }",
|
|
284
|
+
},
|
|
285
|
+
],
|
|
286
|
+
statements: [
|
|
287
|
+
"this.resourceSet = new rdfjsResource.ResourceSet({ dataset })",
|
|
288
|
+
],
|
|
289
|
+
},
|
|
290
|
+
],
|
|
291
|
+
implements: [`${syntheticNamePrefix}ObjectSet`],
|
|
292
|
+
isExported: true,
|
|
293
|
+
kind: StructureKind.Class,
|
|
294
|
+
name: `${syntheticNamePrefix}RdfjsDatasetObjectSet`,
|
|
295
|
+
methods: [...objectTypes, ...objectUnionTypes].flatMap((objectType) => {
|
|
296
|
+
if (!objectType.features.has("rdf")) {
|
|
297
|
+
return unsupportedObjectSetMethodDeclarations({
|
|
298
|
+
objectType,
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
const methodSignatures = objectSetMethodSignatures({ objectType });
|
|
302
|
+
let runtimeObjectType;
|
|
303
|
+
switch (objectType.kind) {
|
|
304
|
+
case "ObjectType":
|
|
305
|
+
runtimeObjectType = objectType.fromRdfType.isJust()
|
|
306
|
+
? `${objectType.staticModuleName}`
|
|
307
|
+
: `{ ...${objectType.staticModuleName}, ${syntheticNamePrefix}fromRdfType: undefined }`;
|
|
308
|
+
break;
|
|
309
|
+
case "ObjectUnionType":
|
|
310
|
+
runtimeObjectType = `[${objectType.memberTypes.map((memberType) => memberType.fromRdfType.isJust()
|
|
311
|
+
? `${memberType.staticModuleName}`
|
|
312
|
+
: `{ ...${memberType.staticModuleName}, ${syntheticNamePrefix}fromRdfType: undefined }`)}]`;
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
return [
|
|
316
|
+
{
|
|
317
|
+
...methodSignatures.object,
|
|
318
|
+
isAsync: true,
|
|
319
|
+
kind: StructureKind.Method,
|
|
320
|
+
statements: [
|
|
321
|
+
`return this.${methodSignatures.object.name}Sync(identifier);`,
|
|
322
|
+
],
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
...methodSignatures.object,
|
|
326
|
+
kind: StructureKind.Method,
|
|
327
|
+
name: `${methodSignatures.object.name}Sync`,
|
|
328
|
+
returnType: `purify.Either<Error, ${objectType.name}>`,
|
|
329
|
+
statements: [
|
|
330
|
+
`return this.${methodSignatures.objects.name}Sync({ where: { identifiers: [identifier], type: "identifiers" } }).map(objects => objects[0]);`,
|
|
331
|
+
],
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
...methodSignatures.objectIdentifiers,
|
|
335
|
+
isAsync: true,
|
|
336
|
+
kind: StructureKind.Method,
|
|
337
|
+
statements: [
|
|
338
|
+
`return this.${methodSignatures.objectIdentifiers.name}Sync(query);`,
|
|
339
|
+
],
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
...methodSignatures.objectIdentifiers,
|
|
343
|
+
kind: StructureKind.Method,
|
|
344
|
+
name: `${methodSignatures.objectIdentifiers.name}Sync`,
|
|
345
|
+
returnType: `purify.Either<Error, readonly ${objectType.identifierTypeAlias}[]>`,
|
|
346
|
+
statements: `return this.${syntheticNamePrefix}object${objectType.kind === "ObjectUnionType" ? "Union" : ""}IdentifiersSync<${objectType.name}, ${objectType.identifierTypeAlias}>(${runtimeObjectType}, query);`,
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
...methodSignatures.objects,
|
|
350
|
+
isAsync: true,
|
|
351
|
+
kind: StructureKind.Method,
|
|
352
|
+
statements: [
|
|
353
|
+
`return this.${methodSignatures.objects.name}Sync(query);`,
|
|
354
|
+
],
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
...methodSignatures.objects,
|
|
358
|
+
kind: StructureKind.Method,
|
|
359
|
+
name: `${methodSignatures.objects.name}Sync`,
|
|
360
|
+
returnType: `purify.Either<Error, readonly ${objectType.name}[]>`,
|
|
361
|
+
statements: [
|
|
362
|
+
`return this.${syntheticNamePrefix}object${objectType.kind === "ObjectUnionType" ? "Union" : ""}sSync<${objectType.name}, ${objectType.identifierTypeAlias}>(${runtimeObjectType}, query);`,
|
|
363
|
+
],
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
...methodSignatures.objectsCount,
|
|
367
|
+
isAsync: true,
|
|
368
|
+
kind: StructureKind.Method,
|
|
369
|
+
statements: [
|
|
370
|
+
`return this.${methodSignatures.objectsCount.name}Sync(query);`,
|
|
371
|
+
],
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
...methodSignatures.objectsCount,
|
|
375
|
+
kind: StructureKind.Method,
|
|
376
|
+
name: `${methodSignatures.objectsCount.name}Sync`,
|
|
377
|
+
returnType: "purify.Either<Error, number>",
|
|
378
|
+
statements: [
|
|
379
|
+
`return this.${syntheticNamePrefix}object${objectType.kind === "ObjectUnionType" ? "Union" : ""}sCountSync<${objectType.name}, ${objectType.identifierTypeAlias}>(${runtimeObjectType}, query);`,
|
|
380
|
+
],
|
|
381
|
+
},
|
|
382
|
+
];
|
|
383
|
+
}).concat(reusableMethodDeclarations),
|
|
384
|
+
properties: [
|
|
385
|
+
{
|
|
386
|
+
isReadonly: true,
|
|
387
|
+
name: "resourceSet",
|
|
388
|
+
type: "rdfjsResource.ResourceSet",
|
|
389
|
+
},
|
|
390
|
+
],
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
//# sourceMappingURL=rdfjsDatasetObjectSetClassDeclaration.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { BlankNode, Literal, NamedNode, Variable } from "@rdfjs/types";
|
|
2
|
+
export declare function rdfjsTermExpression(rdfjsTerm: Omit<BlankNode, "equals"> | Omit<Literal, "equals"> | Omit<NamedNode, "equals"> | Omit<Variable, "equals">): string;
|
|
3
|
+
//# sourceMappingURL=rdfjsTermExpression.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { rdf, rdfs, xsd } from "@tpluscode/rdf-ns-builders";
|
|
2
|
+
import { logger } from "../../logger.js";
|
|
3
|
+
import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
|
|
4
|
+
export function rdfjsTermExpression(rdfjsTerm) {
|
|
5
|
+
switch (rdfjsTerm.termType) {
|
|
6
|
+
case "BlankNode":
|
|
7
|
+
return `dataFactory.blankNode("${rdfjsTerm.value}")`;
|
|
8
|
+
case "Literal":
|
|
9
|
+
if (rdfjsTerm.datatype.equals(xsd.string)) {
|
|
10
|
+
if (rdfjsTerm.language.length === 0) {
|
|
11
|
+
return `dataFactory.literal("${rdfjsTerm.value}")`;
|
|
12
|
+
}
|
|
13
|
+
return `dataFactory.literal("${rdfjsTerm.value}", "${rdfjsTerm.language}")`;
|
|
14
|
+
}
|
|
15
|
+
return `dataFactory.literal("${rdfjsTerm.value}", ${rdfjsTermExpression(rdfjsTerm.datatype)})`;
|
|
16
|
+
case "NamedNode": {
|
|
17
|
+
if (rdfjsTerm.value.startsWith(rdf[""].value)) {
|
|
18
|
+
const unqualifiedName = rdfjsTerm.value.substring(rdf[""].value.length);
|
|
19
|
+
switch (unqualifiedName) {
|
|
20
|
+
case "first":
|
|
21
|
+
case "nil":
|
|
22
|
+
case "rest":
|
|
23
|
+
case "subject":
|
|
24
|
+
case "type":
|
|
25
|
+
return `${syntheticNamePrefix}RdfVocabularies.rdf.${unqualifiedName}`;
|
|
26
|
+
default:
|
|
27
|
+
logger.warn("unrecognized rdf IRI: %s", rdfjsTerm.value);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
else if (rdfjsTerm.value.startsWith(rdfs[""].value)) {
|
|
31
|
+
const unqualifiedName = rdfjsTerm.value.substring(rdfs[""].value.length);
|
|
32
|
+
switch (unqualifiedName) {
|
|
33
|
+
case "subClassOf":
|
|
34
|
+
return `${syntheticNamePrefix}RdfVocabularies.rdfs.${unqualifiedName}`;
|
|
35
|
+
default:
|
|
36
|
+
logger.warn("unrecognized rdfs IRI: %s", rdfjsTerm.value);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else if (rdfjsTerm.value.startsWith(xsd[""].value)) {
|
|
40
|
+
const unqualifiedName = rdfjsTerm.value.substring(xsd[""].value.length);
|
|
41
|
+
switch (unqualifiedName) {
|
|
42
|
+
case "boolean":
|
|
43
|
+
case "date":
|
|
44
|
+
case "dateTime":
|
|
45
|
+
case "integer":
|
|
46
|
+
return `${syntheticNamePrefix}RdfVocabularies.xsd.${unqualifiedName}`;
|
|
47
|
+
default:
|
|
48
|
+
logger.warn("unrecognized xsd IRI: %s", rdfjsTerm.value);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return `dataFactory.namedNode("${rdfjsTerm.value}")`;
|
|
52
|
+
}
|
|
53
|
+
case "Variable":
|
|
54
|
+
return `dataFactory.variable!("${rdfjsTerm.value}")`;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=rdfjsTermExpression.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ClassDeclarationStructure, type ModuleDeclarationStructure } from "ts-morph";
|
|
2
|
+
import type { ObjectType } from "./ObjectType.js";
|
|
3
|
+
import type { ObjectUnionType } from "./ObjectUnionType.js";
|
|
4
|
+
export declare function sparqlObjectSetClassDeclaration({ objectTypes, objectUnionTypes, }: {
|
|
5
|
+
objectTypes: readonly ObjectType[];
|
|
6
|
+
objectUnionTypes: readonly ObjectUnionType[];
|
|
7
|
+
}): readonly (ClassDeclarationStructure | ModuleDeclarationStructure)[];
|
|
8
|
+
//# sourceMappingURL=sparqlObjectSetClassDeclaration.d.ts.map
|