@shaclmate/shacl-ast 4.0.29 → 4.0.31
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/AbstractShapesGraph.d.ts +2 -2
- package/dist/AbstractShapesGraph.js +8 -8
- package/dist/ShapesGraph.d.ts +4 -4
- package/dist/ShapesGraph.js +4 -4
- package/dist/generated.d.ts +184 -250
- package/dist/generated.js +654 -711
- package/package.json +1 -1
|
@@ -45,10 +45,10 @@ export declare abstract class AbstractShapesGraph<NodeShapeT extends generated.N
|
|
|
45
45
|
}
|
|
46
46
|
type IdentifierMap<T> = TermMap<BlankNode | NamedNode, T>;
|
|
47
47
|
type TypeFunctions<T> = {
|
|
48
|
-
|
|
48
|
+
fromRdfResource: (resource: Resource, options?: {
|
|
49
49
|
ignoreRdfType?: boolean;
|
|
50
50
|
}) => Either<Error, T>;
|
|
51
|
-
|
|
51
|
+
toRdfResource: (value: T, options?: {
|
|
52
52
|
resourceSet?: ResourceSet;
|
|
53
53
|
}) => Resource;
|
|
54
54
|
};
|
|
@@ -73,18 +73,18 @@ export class AbstractShapesGraph {
|
|
|
73
73
|
const dataset = datasetFactory.dataset();
|
|
74
74
|
const resourceSet = new ResourceSet({ dataFactory, dataset });
|
|
75
75
|
for (const nodeShape of this.nodeShapes) {
|
|
76
|
-
this.typeFunctions.NodeShape
|
|
76
|
+
this.typeFunctions.NodeShape.toRdfResource(nodeShape, { resourceSet });
|
|
77
77
|
}
|
|
78
78
|
for (const ontology of this.ontologies) {
|
|
79
|
-
this.typeFunctions.Ontology
|
|
79
|
+
this.typeFunctions.Ontology.toRdfResource(ontology, { resourceSet });
|
|
80
80
|
}
|
|
81
81
|
for (const propertyGroup of this.propertyGroups) {
|
|
82
|
-
this.typeFunctions.PropertyGroup
|
|
82
|
+
this.typeFunctions.PropertyGroup.toRdfResource(propertyGroup, {
|
|
83
83
|
resourceSet,
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
86
|
for (const propertyShape of this.propertyShapes) {
|
|
87
|
-
this.typeFunctions.PropertyShape
|
|
87
|
+
this.typeFunctions.PropertyShape.toRdfResource(propertyShape, {
|
|
88
88
|
resourceSet,
|
|
89
89
|
});
|
|
90
90
|
}
|
|
@@ -216,7 +216,7 @@ export class AbstractShapesGraph {
|
|
|
216
216
|
if (this.ontologiesByIdentifier.has(ontologyResource.identifier)) {
|
|
217
217
|
continue;
|
|
218
218
|
}
|
|
219
|
-
this.typeFunctions.Ontology
|
|
219
|
+
this.typeFunctions.Ontology.fromRdfResource(ontologyResource, {
|
|
220
220
|
ignoreRdfType: true,
|
|
221
221
|
}).ifRight((ontology) => this.add(ontology));
|
|
222
222
|
}
|
|
@@ -228,7 +228,7 @@ export class AbstractShapesGraph {
|
|
|
228
228
|
if (this.propertyGroupsByIdentifier.has(propertyGroupResource.identifier)) {
|
|
229
229
|
continue;
|
|
230
230
|
}
|
|
231
|
-
this.typeFunctions.PropertyGroup
|
|
231
|
+
this.typeFunctions.PropertyGroup.fromRdfResource(curieResourceSet.resource(propertyGroupResource.identifier), { ignoreRdfType: true }).ifRight((propertyGroup) => this.add(propertyGroup));
|
|
232
232
|
}
|
|
233
233
|
// Read shapes
|
|
234
234
|
// Collect the shape identifiers in sets
|
|
@@ -342,13 +342,13 @@ export class AbstractShapesGraph {
|
|
|
342
342
|
for (const shapeNode of shapeNodeSet) {
|
|
343
343
|
if (dataset.match(shapeNode, sh.path, null, graph).size > 0) {
|
|
344
344
|
// A property shape is a shape in the shapes graph that is the subject of a triple that has sh:path as its predicate. A shape has at most one value for sh:path. Each value of sh:path in a shape must be a well-formed SHACL property path. It is recommended, but not required, for a property shape to be declared as a SHACL instance of sh:PropertyShape. SHACL instances of sh:PropertyShape have one value for the property sh:path.
|
|
345
|
-
this.add(this.typeFunctions.PropertyShape
|
|
345
|
+
this.add(this.typeFunctions.PropertyShape.fromRdfResource(curieResourceSet.resource(shapeNode), {
|
|
346
346
|
ignoreRdfType: true,
|
|
347
347
|
}).unsafeCoerce());
|
|
348
348
|
}
|
|
349
349
|
else {
|
|
350
350
|
// A node shape is a shape in the shapes graph that is not the subject of a triple with sh:path as its predicate. It is recommended, but not required, for a node shape to be declared as a SHACL instance of sh:NodeShape. SHACL instances of sh:NodeShape cannot have a value for the property sh:path.
|
|
351
|
-
this.add(this.typeFunctions.NodeShape
|
|
351
|
+
this.add(this.typeFunctions.NodeShape.fromRdfResource(curieResourceSet.resource(shapeNode), {
|
|
352
352
|
ignoreRdfType: true,
|
|
353
353
|
}).unsafeCoerce());
|
|
354
354
|
}
|
package/dist/ShapesGraph.d.ts
CHANGED
|
@@ -18,10 +18,10 @@ export declare namespace ShapesGraph {
|
|
|
18
18
|
readonly PropertyShape: typeof generated.PropertyShape;
|
|
19
19
|
};
|
|
20
20
|
build(): ShapesGraph;
|
|
21
|
-
nodeShape(parameters?: Parameters<typeof generated.NodeShape
|
|
22
|
-
ontology(parameters?: Parameters<typeof generated.Ontology
|
|
23
|
-
propertyGroup(parameters?: Parameters<typeof generated.PropertyGroup
|
|
24
|
-
propertyShape(parameters: Parameters<typeof generated.PropertyShape
|
|
21
|
+
nodeShape(parameters?: Parameters<typeof generated.NodeShape.create>[0]): generated.NodeShape;
|
|
22
|
+
ontology(parameters?: Parameters<typeof generated.Ontology.create>[0]): generated.Ontology;
|
|
23
|
+
propertyGroup(parameters?: Parameters<typeof generated.PropertyGroup.create>[0]): generated.PropertyGroup;
|
|
24
|
+
propertyShape(parameters: Parameters<typeof generated.PropertyShape.create>[0]): generated.PropertyShape;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
//# sourceMappingURL=ShapesGraph.d.ts.map
|
package/dist/ShapesGraph.js
CHANGED
|
@@ -24,22 +24,22 @@ export class ShapesGraph extends AbstractShapesGraph {
|
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
nodeShape(parameters) {
|
|
27
|
-
const nodeShape = generated.NodeShape
|
|
27
|
+
const nodeShape = generated.NodeShape.create(parameters);
|
|
28
28
|
this.add(nodeShape);
|
|
29
29
|
return nodeShape;
|
|
30
30
|
}
|
|
31
31
|
ontology(parameters) {
|
|
32
|
-
const ontology = generated.Ontology
|
|
32
|
+
const ontology = generated.Ontology.create(parameters);
|
|
33
33
|
this.add(ontology);
|
|
34
34
|
return ontology;
|
|
35
35
|
}
|
|
36
36
|
propertyGroup(parameters) {
|
|
37
|
-
const propertyGroup = generated.PropertyGroup
|
|
37
|
+
const propertyGroup = generated.PropertyGroup.create(parameters);
|
|
38
38
|
this.add(propertyGroup);
|
|
39
39
|
return propertyGroup;
|
|
40
40
|
}
|
|
41
41
|
propertyShape(parameters) {
|
|
42
|
-
const propertyShape = generated.PropertyShape
|
|
42
|
+
const propertyShape = generated.PropertyShape.create(parameters);
|
|
43
43
|
this.add(propertyShape);
|
|
44
44
|
return propertyShape;
|
|
45
45
|
}
|