@shaclmate/compiler 2.0.22 → 2.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ShapesGraphToAstTransformer.d.ts +6 -5
- package/dist/ShapesGraphToAstTransformer.js +61 -17
- package/dist/_ShapesGraphToAstTransformer/InheritableShapeConstraints.d.ts +2 -0
- package/dist/_ShapesGraphToAstTransformer/InheritableShapeConstraints.js +2 -0
- package/dist/_ShapesGraphToAstTransformer/ShapeStack.d.ts +15 -0
- package/dist/_ShapesGraphToAstTransformer/ShapeStack.js +51 -0
- package/dist/_ShapesGraphToAstTransformer/flattenAstObjectCompositeTypeMemberTypes.d.ts +13 -0
- package/dist/_ShapesGraphToAstTransformer/flattenAstObjectCompositeTypeMemberTypes.js +51 -0
- package/dist/_ShapesGraphToAstTransformer/index.d.ts +5 -5
- package/dist/_ShapesGraphToAstTransformer/index.js +5 -5
- 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/transformPropertyShapeToAstObjectTypeProperty.js +175 -5
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompositeType.d.ts +10 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompositeType.js +185 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstIdentifierType.d.ts +10 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstIdentifierType.js +32 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstLiteralType.d.ts +10 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstLiteralType.js +46 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.d.ts +12 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.js +24 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.d.ts +13 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.js +14 -0
- package/dist/ast/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 -4
- package/dist/ast/SetType.d.ts +2 -7
- package/dist/ast/TermType.d.ts +12 -4
- package/dist/ast/Type.d.ts +1 -1
- package/dist/ast/index.d.ts +1 -0
- package/dist/ast/index.js +1 -0
- package/dist/enums/TsFeature.d.ts +1 -4
- package/dist/enums/TsFeature.js +1 -15
- package/dist/generators/json/AstJsonGenerator.js +26 -4
- package/dist/generators/ts/BooleanType.d.ts +4 -2
- package/dist/generators/ts/BooleanType.js +12 -3
- package/dist/generators/ts/DateTimeType.d.ts +9 -8
- package/dist/generators/ts/DateTimeType.js +32 -8
- 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 +17 -7
- package/dist/generators/ts/IdentifierType.js +112 -18
- 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 +113 -61
- package/dist/generators/ts/LiteralType.d.ts +17 -9
- package/dist/generators/ts/LiteralType.js +92 -17
- package/dist/generators/ts/NumberType.d.ts +3 -2
- package/dist/generators/ts/NumberType.js +8 -3
- package/dist/generators/ts/ObjectType.d.ts +65 -43
- package/dist/generators/ts/ObjectType.js +143 -123
- package/dist/generators/ts/ObjectUnionType.d.ts +50 -8
- package/dist/generators/ts/ObjectUnionType.js +303 -101
- package/dist/generators/ts/OptionType.d.ts +14 -10
- package/dist/generators/ts/OptionType.js +62 -34
- package/dist/generators/ts/PrimitiveType.d.ts +23 -5
- package/dist/generators/ts/PrimitiveType.js +34 -6
- package/dist/generators/ts/SetType.d.ts +17 -13
- package/dist/generators/ts/SetType.js +76 -44
- package/dist/generators/ts/SnippetDeclarations.d.ts +13 -8
- package/dist/generators/ts/SnippetDeclarations.js +226 -101
- package/dist/generators/ts/StringType.d.ts +4 -2
- package/dist/generators/ts/StringType.js +20 -8
- package/dist/generators/ts/TermType.d.ts +29 -33
- package/dist/generators/ts/TermType.js +89 -68
- package/dist/generators/ts/TsGenerator.d.ts +2 -1
- package/dist/generators/ts/TsGenerator.js +26 -12
- package/dist/generators/ts/Type.d.ts +100 -32
- package/dist/generators/ts/Type.js +58 -54
- package/dist/generators/ts/TypeFactory.d.ts +12 -5
- package/dist/generators/ts/TypeFactory.js +380 -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 +31 -0
- package/dist/generators/ts/_ObjectType/IdentifierPrefixProperty.d.ts +13 -12
- package/dist/generators/ts/_ObjectType/IdentifierPrefixProperty.js +59 -46
- package/dist/generators/ts/_ObjectType/IdentifierProperty.d.ts +20 -13
- package/dist/generators/ts/_ObjectType/IdentifierProperty.js +198 -140
- package/dist/generators/ts/_ObjectType/LazyShaclProperty.d.ts +100 -0
- package/dist/generators/ts/_ObjectType/LazyShaclProperty.js +315 -0
- package/dist/generators/ts/_ObjectType/Property.d.ts +47 -46
- 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 +120 -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 +22 -17
- package/dist/generators/ts/_ObjectType/createFunctionDeclaration.js +26 -13
- package/dist/generators/ts/_ObjectType/equalsFunctionOrMethodDeclaration.js +8 -5
- 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 +49 -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 +144 -0
- package/dist/generators/ts/_ObjectType/sparqlConstructQueryFunctionDeclaration.d.ts +1 -1
- package/dist/generators/ts/_ObjectType/sparqlConstructQueryFunctionDeclaration.js +6 -5
- package/dist/generators/ts/_ObjectType/sparqlConstructQueryStringFunctionDeclaration.d.ts +1 -1
- package/dist/generators/ts/_ObjectType/sparqlConstructQueryStringFunctionDeclaration.js +4 -3
- package/dist/generators/ts/_ObjectType/sparqlFunctionDeclarations.js +109 -37
- package/dist/generators/ts/_ObjectType/toJsonFunctionOrMethodDeclaration.js +6 -6
- package/dist/generators/ts/_ObjectType/toRdfFunctionOrMethodDeclaration.js +33 -24
- 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 +5 -5
- package/dist/input/PropertyPath.js +14 -24
- package/dist/input/PropertyShape.d.ts +3 -1
- package/dist/input/PropertyShape.js +8 -2
- package/dist/input/ShapesGraph.js +4 -8
- package/dist/input/generated.d.ts +967 -107
- package/dist/input/generated.js +2548 -1046
- package/dist/input/tsFeatures.d.ts +3 -2
- package/dist/input/tsFeatures.js +44 -27
- package/package.json +18 -16
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstCompositeType.d.ts +0 -13
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstCompositeType.js +0 -200
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstIdentifierType.d.ts +0 -12
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstIdentifierType.js +0 -29
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstLiteralType.d.ts +0 -12
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstLiteralType.js +0 -43
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstTermType.d.ts +0 -14
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstTermType.js +0 -21
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstType.d.ts +0 -16
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstType.js +0 -60
- 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
package/dist/input/NodeShape.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { NodeShape as ShaclCoreNodeShape } from "@shaclmate/shacl-ast";
|
|
1
|
+
import { NodeShape as ShaclCoreNodeShape, } from "@shaclmate/shacl-ast";
|
|
2
2
|
import { Maybe } from "purify-ts";
|
|
3
3
|
import { tsFeatures } from "./tsFeatures.js";
|
|
4
4
|
export class NodeShape extends ShaclCoreNodeShape {
|
|
5
|
-
isClass;
|
|
6
|
-
isList;
|
|
7
5
|
ancestorClassIris;
|
|
8
6
|
childClassIris;
|
|
9
7
|
descendantClassIris;
|
|
10
8
|
generatedShaclmateNodeShape;
|
|
11
9
|
parentClassIris;
|
|
10
|
+
isClass;
|
|
11
|
+
isList;
|
|
12
12
|
constructor({ ancestorClassIris, childClassIris, descendantClassIris, generatedShaclmateNodeShape, isClass, isList, parentClassIris, shapesGraph, }) {
|
|
13
13
|
super(generatedShaclmateNodeShape, shapesGraph);
|
|
14
14
|
this.ancestorClassIris = ancestorClassIris;
|
|
@@ -44,19 +44,7 @@ export class NodeShape extends ShaclCoreNodeShape {
|
|
|
44
44
|
return this.generatedShaclmateNodeShape.extern;
|
|
45
45
|
}
|
|
46
46
|
get fromRdfType() {
|
|
47
|
-
|
|
48
|
-
const fromRdfType = this.generatedShaclmateNodeShape.fromRdfType;
|
|
49
|
-
if (fromRdfType.isJust()) {
|
|
50
|
-
return fromRdfType;
|
|
51
|
-
}
|
|
52
|
-
// No explicit shaclmate:fromRdfType
|
|
53
|
-
// If the shape is a class, not abstract, and identified by an IRI then use the shape IRI as the fromRdfType.
|
|
54
|
-
if (!this.abstract.orDefault(false) &&
|
|
55
|
-
this.isClass &&
|
|
56
|
-
this.identifier.termType === "NamedNode") {
|
|
57
|
-
return Maybe.of(this.identifier);
|
|
58
|
-
}
|
|
59
|
-
return Maybe.empty();
|
|
47
|
+
return this.generatedShaclmateNodeShape.fromRdfType;
|
|
60
48
|
}
|
|
61
49
|
get identifierMintingStrategy() {
|
|
62
50
|
const thisMintingStrategy = this._mintingStrategy;
|
|
@@ -106,28 +94,26 @@ export class NodeShape extends ShaclCoreNodeShape {
|
|
|
106
94
|
? this.parentClassIris.flatMap((classIri) => this.shapesGraph.nodeShapeByIdentifier(classIri).toList())
|
|
107
95
|
: [];
|
|
108
96
|
}
|
|
97
|
+
get rdfType() {
|
|
98
|
+
// Check for an explicit shaclmate:rdfType
|
|
99
|
+
const rdfType = this.generatedShaclmateNodeShape.rdfType;
|
|
100
|
+
if (rdfType.isJust()) {
|
|
101
|
+
return rdfType;
|
|
102
|
+
}
|
|
103
|
+
// No explicit shaclmate:rdfType
|
|
104
|
+
// If the shape is a class, not abstract, and identified by an IRI then use the shape IRI as the fromRdfType.
|
|
105
|
+
if (!this.abstract.orDefault(false) &&
|
|
106
|
+
this.isClass &&
|
|
107
|
+
this.identifier.termType === "NamedNode") {
|
|
108
|
+
return Maybe.of(this.identifier);
|
|
109
|
+
}
|
|
110
|
+
return Maybe.empty();
|
|
111
|
+
}
|
|
109
112
|
get shaclmateName() {
|
|
110
113
|
return this.generatedShaclmateNodeShape.name;
|
|
111
114
|
}
|
|
112
115
|
get toRdfTypes() {
|
|
113
|
-
|
|
114
|
-
const toRdfTypes = this.generatedShaclmateNodeShape.toRdfTypes.concat();
|
|
115
|
-
// Ensure the toRdfTypes includes the fromRdfType if there is one
|
|
116
|
-
this.fromRdfType.ifJust((fromRdfType) => {
|
|
117
|
-
if (!toRdfTypes.some((toRdfType) => toRdfType.equals(fromRdfType))) {
|
|
118
|
-
toRdfTypes.push(fromRdfType);
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
if (toRdfTypes.length === 0) {
|
|
122
|
-
// No explicit shaclmate:toRdfType's
|
|
123
|
-
// If the shape is a class, not abstract, and identified by an IRI then use the shape IRI as the fromRdfType.
|
|
124
|
-
if (!this.abstract.orDefault(false) &&
|
|
125
|
-
this.isClass &&
|
|
126
|
-
this.identifier.termType === "NamedNode") {
|
|
127
|
-
toRdfTypes.push(this.identifier);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return toRdfTypes;
|
|
116
|
+
return this.generatedShaclmateNodeShape.toRdfTypes;
|
|
131
117
|
}
|
|
132
118
|
get tsFeatures() {
|
|
133
119
|
return tsFeatures(this.generatedShaclmateNodeShape).altLazy(() => this.isDefinedBy.chain((ontology) => ontology.tsFeatures));
|
|
@@ -149,16 +135,6 @@ export class NodeShape extends ShaclCoreNodeShape {
|
|
|
149
135
|
})
|
|
150
136
|
.altLazy(() => this.isDefinedBy.chain((ontology) => ontology.tsObjectDeclarationType));
|
|
151
137
|
}
|
|
152
|
-
get tsObjectIdentifierPrefixPropertyName() {
|
|
153
|
-
return this.generatedShaclmateNodeShape.tsObjectIdentifierPrefixPropertyName.altLazy(() => this.isDefinedBy.chain((ontology) => ontology.tsObjectIdentifierPrefixPropertyName));
|
|
154
|
-
}
|
|
155
|
-
get tsObjectIdentifierPropertyName() {
|
|
156
|
-
return this.generatedShaclmateNodeShape.tsObjectIdentifierPrefixPropertyName.altLazy(() => this.isDefinedBy.chain((ontology) => ontology.tsObjectIdentifierPropertyName));
|
|
157
|
-
}
|
|
158
|
-
get tsObjectTypeDiscriminatorPropertyName() {
|
|
159
|
-
return this.generatedShaclmateNodeShape
|
|
160
|
-
.tsObjectTypeDiscriminatorPropertyName;
|
|
161
|
-
}
|
|
162
138
|
get _mintingStrategy() {
|
|
163
139
|
return this.generatedShaclmateNodeShape.identifierMintingStrategy.map((iri) => {
|
|
164
140
|
switch (iri.value) {
|
package/dist/input/Ontology.d.ts
CHANGED
|
@@ -5,11 +5,8 @@ import type * as generated from "./generated.js";
|
|
|
5
5
|
export declare class Ontology extends OwlOntology {
|
|
6
6
|
private readonly generatedShaclmateOntology;
|
|
7
7
|
constructor(generatedShaclmateOntology: generated.ShaclmateOntology);
|
|
8
|
-
get tsDataFactoryVariable(): Maybe<string>;
|
|
9
8
|
get tsFeatures(): Maybe<Set<TsFeature>>;
|
|
10
9
|
get tsImports(): readonly string[];
|
|
11
10
|
get tsObjectDeclarationType(): Maybe<TsObjectDeclarationType>;
|
|
12
|
-
get tsObjectIdentifierPrefixPropertyName(): Maybe<string>;
|
|
13
|
-
get tsObjectIdentifierPropertyName(): Maybe<string>;
|
|
14
11
|
}
|
|
15
12
|
//# sourceMappingURL=Ontology.d.ts.map
|
package/dist/input/Ontology.js
CHANGED
|
@@ -6,9 +6,6 @@ export class Ontology extends OwlOntology {
|
|
|
6
6
|
super(generatedShaclmateOntology);
|
|
7
7
|
this.generatedShaclmateOntology = generatedShaclmateOntology;
|
|
8
8
|
}
|
|
9
|
-
get tsDataFactoryVariable() {
|
|
10
|
-
return this.generatedShaclmateOntology.tsDataFactoryVariable;
|
|
11
|
-
}
|
|
12
9
|
get tsFeatures() {
|
|
13
10
|
return tsFeatures(this.generatedShaclmateOntology);
|
|
14
11
|
}
|
|
@@ -27,11 +24,5 @@ export class Ontology extends OwlOntology {
|
|
|
27
24
|
}
|
|
28
25
|
});
|
|
29
26
|
}
|
|
30
|
-
get tsObjectIdentifierPrefixPropertyName() {
|
|
31
|
-
return this.generatedShaclmateOntology.tsObjectIdentifierPrefixPropertyName;
|
|
32
|
-
}
|
|
33
|
-
get tsObjectIdentifierPropertyName() {
|
|
34
|
-
return this.generatedShaclmateOntology.tsObjectIdentifierPropertyName;
|
|
35
|
-
}
|
|
36
27
|
}
|
|
37
28
|
//# sourceMappingURL=Ontology.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { NamedNode } from "@rdfjs/types";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import { Either } from "purify-ts";
|
|
3
|
+
import { Resource } from "rdfjs-resource";
|
|
4
4
|
export interface AlternativePath {
|
|
5
5
|
readonly kind: "AlternativePath";
|
|
6
6
|
readonly members: readonly PropertyPath[];
|
|
@@ -31,11 +31,11 @@ export interface ZeroOrOnePath {
|
|
|
31
31
|
}
|
|
32
32
|
export type PropertyPath = AlternativePath | InversePath | OneOrMorePath | PredicatePath | SequencePath | ZeroOrMorePath | ZeroOrOnePath;
|
|
33
33
|
export declare namespace PropertyPath {
|
|
34
|
-
function fromRdf(
|
|
34
|
+
function $fromRdf(resource: Resource, _?: {
|
|
35
35
|
[_index: string]: any;
|
|
36
36
|
ignoreRdfType?: boolean;
|
|
37
37
|
languageIn?: readonly string[];
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
}): Either<Error, PropertyPath>;
|
|
39
|
+
function $toRdf(_propertyPath: PropertyPath, _options?: any): Resource;
|
|
40
40
|
}
|
|
41
41
|
//# sourceMappingURL=PropertyPath.d.ts.map
|
|
@@ -3,7 +3,7 @@ import { Either, Left } from "purify-ts";
|
|
|
3
3
|
import { Resource } from "rdfjs-resource";
|
|
4
4
|
export var PropertyPath;
|
|
5
5
|
(function (PropertyPath) {
|
|
6
|
-
function fromRdf(
|
|
6
|
+
function $fromRdf(resource, _) {
|
|
7
7
|
// Predicate path
|
|
8
8
|
// sh:path ex:parent
|
|
9
9
|
if (resource.identifier.termType === "NamedNode") {
|
|
@@ -16,15 +16,9 @@ export var PropertyPath;
|
|
|
16
16
|
for (const value of values) {
|
|
17
17
|
const memberResource = value.toResource().toMaybe();
|
|
18
18
|
if (memberResource.isNothing()) {
|
|
19
|
-
return Left(new Resource.
|
|
20
|
-
focusResource: resource,
|
|
21
|
-
message: "non-identifier in property path list",
|
|
22
|
-
predicate: rdf.subject,
|
|
23
|
-
}));
|
|
19
|
+
return Left(new Error(`non-identifier in property path list ${Resource.Identifier.toString(listResource.identifier)}`));
|
|
24
20
|
}
|
|
25
|
-
const member = PropertyPath
|
|
26
|
-
resource: memberResource.unsafeCoerce(),
|
|
27
|
-
});
|
|
21
|
+
const member = PropertyPath.$fromRdf(memberResource.unsafeCoerce());
|
|
28
22
|
if (member.isLeft()) {
|
|
29
23
|
return member;
|
|
30
24
|
}
|
|
@@ -39,11 +33,7 @@ export var PropertyPath;
|
|
|
39
33
|
case "NamedNode":
|
|
40
34
|
break;
|
|
41
35
|
default:
|
|
42
|
-
return Left(new Resource.
|
|
43
|
-
focusResource: resource,
|
|
44
|
-
message: `non-BlankNode/NamedNode property path object on path ${resource.identifier.value}: ${quad.object.termType} ${quad.object.value}`,
|
|
45
|
-
predicate: quad.predicate,
|
|
46
|
-
}));
|
|
36
|
+
return Left(new Error(`non-BlankNode/NamedNode property path object on path ${Resource.Identifier.toString(resource.identifier)}: ${quad.object.termType} ${quad.object.value}`));
|
|
47
37
|
}
|
|
48
38
|
const objectResource = new Resource({
|
|
49
39
|
dataset: resource.dataset,
|
|
@@ -60,14 +50,14 @@ export var PropertyPath;
|
|
|
60
50
|
// Inverse path
|
|
61
51
|
// sh:path: [ sh:inversePath ex:parent ]
|
|
62
52
|
if (quad.predicate.equals(sh.inversePath)) {
|
|
63
|
-
return PropertyPath
|
|
53
|
+
return PropertyPath.$fromRdf(objectResource).map((path) => ({
|
|
64
54
|
kind: "InversePath",
|
|
65
55
|
path,
|
|
66
56
|
}));
|
|
67
57
|
}
|
|
68
58
|
// One or more path
|
|
69
59
|
if (quad.predicate.equals(sh.oneOrMorePath)) {
|
|
70
|
-
return PropertyPath
|
|
60
|
+
return PropertyPath.$fromRdf(objectResource).map((path) => ({
|
|
71
61
|
kind: "OneOrMorePath",
|
|
72
62
|
path,
|
|
73
63
|
}));
|
|
@@ -82,24 +72,24 @@ export var PropertyPath;
|
|
|
82
72
|
}
|
|
83
73
|
// Zero or more path
|
|
84
74
|
if (quad.predicate.equals(sh.zeroOrMorePath)) {
|
|
85
|
-
return PropertyPath
|
|
75
|
+
return PropertyPath.$fromRdf(objectResource).map((path) => ({
|
|
86
76
|
kind: "ZeroOrMorePath",
|
|
87
77
|
path,
|
|
88
78
|
}));
|
|
89
79
|
}
|
|
90
80
|
if (quad.predicate.equals(sh.zeroOrOnePath)) {
|
|
91
|
-
return PropertyPath
|
|
81
|
+
return PropertyPath.$fromRdf(objectResource).map((path) => ({
|
|
92
82
|
kind: "ZeroOrOnePath",
|
|
93
83
|
path,
|
|
94
84
|
}));
|
|
95
85
|
}
|
|
96
86
|
}
|
|
97
|
-
return Left(new Resource.
|
|
98
|
-
focusResource: resource,
|
|
99
|
-
message: `unrecognized or ill-formed SHACL property path ${resource.identifier.value}`,
|
|
100
|
-
predicate: rdf.subject,
|
|
101
|
-
}));
|
|
87
|
+
return Left(new Error(`unrecognized or ill-formed SHACL property path ${Resource.Identifier.toString(resource.identifier)}`));
|
|
102
88
|
}
|
|
103
|
-
PropertyPath
|
|
89
|
+
PropertyPath.$fromRdf = $fromRdf;
|
|
90
|
+
function $toRdf(_propertyPath, _options) {
|
|
91
|
+
throw new Error("not implemented");
|
|
92
|
+
}
|
|
93
|
+
PropertyPath.$toRdf = $toRdf;
|
|
104
94
|
})(PropertyPath || (PropertyPath = {}));
|
|
105
95
|
//# sourceMappingURL=PropertyPath.js.map
|
|
@@ -7,9 +7,11 @@ import type { NodeShape, Ontology, PropertyGroup, ShapesGraph } from "./index.js
|
|
|
7
7
|
export declare class PropertyShape extends ShaclCorePropertyShape<NodeShape, Ontology, PropertyGroup, any, Shape> {
|
|
8
8
|
private readonly generatedShaclmatePropertyShape;
|
|
9
9
|
constructor(generatedShaclmatePropertyShape: generated.ShaclmatePropertyShape, shapesGraph: ShapesGraph);
|
|
10
|
-
get
|
|
10
|
+
get lazy(): Maybe<boolean>;
|
|
11
11
|
get mutable(): Maybe<boolean>;
|
|
12
12
|
get shaclmateName(): Maybe<string>;
|
|
13
|
+
get stub(): Maybe<NodeShape>;
|
|
13
14
|
get visibility(): PropertyVisibility;
|
|
15
|
+
get widen(): Maybe<boolean>;
|
|
14
16
|
}
|
|
15
17
|
//# sourceMappingURL=PropertyShape.d.ts.map
|
|
@@ -6,8 +6,8 @@ export class PropertyShape extends ShaclCorePropertyShape {
|
|
|
6
6
|
super({ ...generatedShaclmatePropertyShape, uniqueLang: Maybe.empty() }, shapesGraph);
|
|
7
7
|
this.generatedShaclmatePropertyShape = generatedShaclmatePropertyShape;
|
|
8
8
|
}
|
|
9
|
-
get
|
|
10
|
-
return this.generatedShaclmatePropertyShape.
|
|
9
|
+
get lazy() {
|
|
10
|
+
return this.generatedShaclmatePropertyShape.lazy;
|
|
11
11
|
}
|
|
12
12
|
get mutable() {
|
|
13
13
|
return this.generatedShaclmatePropertyShape.mutable;
|
|
@@ -15,6 +15,9 @@ export class PropertyShape extends ShaclCorePropertyShape {
|
|
|
15
15
|
get shaclmateName() {
|
|
16
16
|
return this.generatedShaclmatePropertyShape.name;
|
|
17
17
|
}
|
|
18
|
+
get stub() {
|
|
19
|
+
return this.generatedShaclmatePropertyShape.stub.chain((identifier) => this.shapesGraph.nodeShapeByIdentifier(identifier));
|
|
20
|
+
}
|
|
18
21
|
get visibility() {
|
|
19
22
|
return this.generatedShaclmatePropertyShape.visibility
|
|
20
23
|
.map((iri) => {
|
|
@@ -31,5 +34,8 @@ export class PropertyShape extends ShaclCorePropertyShape {
|
|
|
31
34
|
})
|
|
32
35
|
.orDefault("public");
|
|
33
36
|
}
|
|
37
|
+
get widen() {
|
|
38
|
+
return this.generatedShaclmatePropertyShape.widen;
|
|
39
|
+
}
|
|
34
40
|
}
|
|
35
41
|
//# sourceMappingURL=PropertyShape.js.map
|
|
@@ -10,9 +10,8 @@ export class ShapesGraph extends RdfjsShapesGraph {
|
|
|
10
10
|
dataset,
|
|
11
11
|
factory: {
|
|
12
12
|
nodeShapeFromRdf({ resource, shapesGraph, }) {
|
|
13
|
-
return generated.ShaclmateNodeShape
|
|
13
|
+
return generated.ShaclmateNodeShape.$fromRdf(resource, {
|
|
14
14
|
ignoreRdfType: true,
|
|
15
|
-
resource,
|
|
16
15
|
}).map((generatedShape) => new NodeShape({
|
|
17
16
|
ancestorClassIris: ancestorClassIris(resource, Number.MAX_SAFE_INTEGER),
|
|
18
17
|
childClassIris: descendantClassIris(resource, 1),
|
|
@@ -26,21 +25,18 @@ export class ShapesGraph extends RdfjsShapesGraph {
|
|
|
26
25
|
}));
|
|
27
26
|
},
|
|
28
27
|
ontologyFromRdf({ resource, }) {
|
|
29
|
-
return generated.ShaclmateOntology
|
|
28
|
+
return generated.ShaclmateOntology.$fromRdf(resource, {
|
|
30
29
|
ignoreRdfType: true,
|
|
31
|
-
resource,
|
|
32
30
|
}).map((generatedOntology) => new Ontology(generatedOntology));
|
|
33
31
|
},
|
|
34
32
|
propertyGroupFromRdf({ resource, }) {
|
|
35
|
-
return generated.ShaclCorePropertyGroup
|
|
33
|
+
return generated.ShaclCorePropertyGroup.$fromRdf(resource, {
|
|
36
34
|
ignoreRdfType: true,
|
|
37
|
-
resource,
|
|
38
35
|
}).map((generatedPropertyGroup) => new PropertyGroup(generatedPropertyGroup));
|
|
39
36
|
},
|
|
40
37
|
propertyShapeFromRdf({ resource, shapesGraph, }) {
|
|
41
|
-
return generated.ShaclmatePropertyShape
|
|
38
|
+
return generated.ShaclmatePropertyShape.$fromRdf(resource, {
|
|
42
39
|
ignoreRdfType: true,
|
|
43
|
-
resource,
|
|
44
40
|
}).map((generatedShape) => new PropertyShape(generatedShape, shapesGraph));
|
|
45
41
|
},
|
|
46
42
|
},
|