@shaclmate/cli 4.0.50 → 4.0.51

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/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1,8 @@
1
+ import type { Generator } from "@shaclmate/compiler";
2
+ import { type Either } from "purify-ts";
3
+ export declare function generate({ generator, inputPaths, outputFilePath, }: {
4
+ generator: Generator;
5
+ inputPaths: readonly string[];
6
+ outputFilePath: string;
7
+ }): Promise<Either<Error, void>>;
8
+ //# sourceMappingURL=generate.d.ts.map
@@ -0,0 +1,37 @@
1
+ import * as fs from "node:fs";
2
+ import Serializer from "@rdfjs/serializer-turtle";
3
+ import { Compiler, ShapesGraph } from "@shaclmate/compiler";
4
+ import { EitherAsync } from "purify-ts";
5
+ import SHACLValidator from "rdf-validate-shacl";
6
+ import { logger } from "../logger.js";
7
+ import { parseInputs } from "../parseInputs.js";
8
+ import { shaclShaclDataset } from "../shaclShaclDataset.js";
9
+ export async function generate({ generator, inputPaths, outputFilePath, }) {
10
+ return EitherAsync(async ({ liftEither }) => {
11
+ if (inputPaths.length === 0) {
12
+ throw new Error("must specify at least one input shapes graph file path");
13
+ }
14
+ const { dataset, prefixMap } = await liftEither(await parseInputs(inputPaths));
15
+ {
16
+ const validationReport = await new SHACLValidator(shaclShaclDataset, {}).validate(dataset);
17
+ if (!validationReport.conforms) {
18
+ process.stderr.write("input is not valid SHACL:\n");
19
+ process.stderr.write(new Serializer({
20
+ prefixes: prefixMap,
21
+ }).transform(validationReport.dataset));
22
+ return;
23
+ }
24
+ }
25
+ const output = await liftEither(ShapesGraph.builder()
26
+ .parseDataset(dataset, { prefixMap })
27
+ .map((_) => _.build())
28
+ .chain((shapesGraph) => new Compiler({ generator, logger }).compile(shapesGraph)));
29
+ if (outputFilePath.length === 0) {
30
+ process.stdout.write(output);
31
+ }
32
+ else {
33
+ await fs.promises.writeFile(outputFilePath, output);
34
+ }
35
+ });
36
+ }
37
+ //# sourceMappingURL=generate.js.map
@@ -0,0 +1,4 @@
1
+ export * from "./generate.js";
2
+ export * from "./merge.js";
3
+ export * from "./validate.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,4 @@
1
+ export * from "./generate.js";
2
+ export * from "./merge.js";
3
+ export * from "./validate.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ import { type Either } from "purify-ts";
2
+ export declare function merge({ inputPaths, outputFilePath, }: {
3
+ inputPaths: readonly string[];
4
+ outputFilePath: string;
5
+ }): Promise<Either<Error, void>>;
6
+ //# sourceMappingURL=merge.d.ts.map
@@ -0,0 +1,17 @@
1
+ import fs from "node:fs";
2
+ import Serializer from "@rdfjs/serializer-turtle";
3
+ import { EitherAsync } from "purify-ts";
4
+ import { parseInputs } from "../parseInputs.js";
5
+ export async function merge({ inputPaths, outputFilePath, }) {
6
+ return EitherAsync(async ({ liftEither }) => {
7
+ const { dataset, prefixMap } = await liftEither(await parseInputs(inputPaths));
8
+ const output = new Serializer({ prefixes: prefixMap }).transform(dataset);
9
+ if (outputFilePath.length === 0) {
10
+ process.stdout.write(output);
11
+ }
12
+ else {
13
+ await fs.promises.writeFile(outputFilePath, output);
14
+ }
15
+ });
16
+ }
17
+ //# sourceMappingURL=merge.js.map
@@ -0,0 +1,6 @@
1
+ import { type Either } from "purify-ts";
2
+ export declare function validate({ dataGraphPaths, shapesGraphPaths, }: {
3
+ dataGraphPaths: readonly string[];
4
+ shapesGraphPaths: readonly string[];
5
+ }): Promise<Either<Error, void>>;
6
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1,94 @@
1
+ import { spawn } from "node:child_process";
2
+ import fs from "node:fs/promises";
3
+ import path from "node:path";
4
+ import Serializer from "@rdfjs/serializer-turtle";
5
+ import { EitherAsync } from "purify-ts";
6
+ import SHACLValidator from "rdf-validate-shacl";
7
+ import * as tmp from "tmp-promise";
8
+ import which from "which";
9
+ import { logger } from "../logger.js";
10
+ import { parseInputs } from "../parseInputs.js";
11
+ function execFileStreaming(cmd, args) {
12
+ return new Promise((resolve) => {
13
+ const child = spawn(cmd, args, { stdio: "inherit" });
14
+ child.on("close", (code) => {
15
+ resolve(code);
16
+ });
17
+ });
18
+ }
19
+ export async function validate({ dataGraphPaths, shapesGraphPaths, }) {
20
+ return EitherAsync(async ({ liftEither }) => {
21
+ const { dataset: dataGraphDataset, prefixMap: dataGraphPrefixMap } = await liftEither(await parseInputs(dataGraphPaths));
22
+ if (dataGraphDataset.size === 0) {
23
+ throw new Error("data graph is empty!");
24
+ }
25
+ logger.info("data graph size: %d", dataGraphDataset.size);
26
+ const { dataset: shapesGraphDataset } = await liftEither(await parseInputs(shapesGraphPaths));
27
+ if (shapesGraphDataset.size === 0) {
28
+ throw new Error("shapes graph is empty!");
29
+ }
30
+ logger.info("shapes graph size: %d", shapesGraphDataset.size);
31
+ const serializer = new Serializer({
32
+ prefixes: dataGraphPrefixMap,
33
+ });
34
+ logger.info("validating with rdf-shacl-validate");
35
+ const validationReport = await new SHACLValidator(shapesGraphDataset, {}).validate(dataGraphDataset);
36
+ if (validationReport.conforms) {
37
+ logger.info("validated with rdf-shacl-validate: conforms");
38
+ }
39
+ else {
40
+ logger.info("validated with rdf-shacl-validate: does not conform");
41
+ process.stderr.write(serializer.transform(validationReport.dataset));
42
+ return;
43
+ }
44
+ const jenaShaclFilePath = await which("shacl", { nothrow: true });
45
+ const pyshaclFilePath = await which("pyshacl", { nothrow: true });
46
+ if (jenaShaclFilePath === null && pyshaclFilePath === null) {
47
+ logger.debug("neither Jena nor pyshacl found on PATH");
48
+ return;
49
+ }
50
+ await tmp.withDir(async ({ path: tmpDirectoryPath }) => {
51
+ const dataGraphFilePath = path.join(tmpDirectoryPath, "data.ttl");
52
+ logger.debug("writing data graph to %s", dataGraphFilePath);
53
+ await fs.writeFile(dataGraphFilePath, serializer.transform(dataGraphDataset));
54
+ logger.debug("wrote data graph to %s", dataGraphFilePath);
55
+ const shapesGraphFilePath = path.join(tmpDirectoryPath, "shapes.ttl");
56
+ logger.debug("writing shapes graph to %s", shapesGraphFilePath);
57
+ await fs.writeFile(shapesGraphFilePath, serializer.transform(shapesGraphDataset));
58
+ logger.debug("wrote shapes graph to %s", shapesGraphFilePath);
59
+ if (jenaShaclFilePath !== null) {
60
+ const args = [
61
+ "validate",
62
+ "--data",
63
+ dataGraphFilePath,
64
+ "--shapes",
65
+ shapesGraphFilePath,
66
+ ];
67
+ logger.info("validating with Jena (args=%s)", args);
68
+ const code = await execFileStreaming(jenaShaclFilePath, args);
69
+ logger.info("validated with Jena: %s", code === 0 ? "conforms" : "does not conform");
70
+ if (code !== 0) {
71
+ return;
72
+ }
73
+ }
74
+ else {
75
+ logger.info("Jena not found on PATH, skipping");
76
+ }
77
+ if (pyshaclFilePath !== null) {
78
+ const args = ["-s", shapesGraphFilePath, dataGraphFilePath];
79
+ logger.info("validating with pyshacl (args=%s)", args);
80
+ const code = await execFileStreaming(pyshaclFilePath, args);
81
+ logger.info("validated with pyshacl: %s", code === 0 ? "conforms" : "does not conform");
82
+ if (code !== 0) {
83
+ return;
84
+ }
85
+ }
86
+ else {
87
+ logger.info("pyshacl not found on PATH, skipping");
88
+ }
89
+ }, {
90
+ unsafeCleanup: true,
91
+ });
92
+ });
93
+ }
94
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1,5 @@
1
+ export * as commands from "./commands/index.js";
2
+ export * from "./logger.js";
3
+ export * from "./parseInputs.js";
4
+ export * from "./shaclShaclDataset.js";
5
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export * as commands from "./commands/index.js";
2
+ export * from "./logger.js";
3
+ export * from "./parseInputs.js";
4
+ export * from "./shaclShaclDataset.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ export declare const logger: import("pino").Logger<never>;
2
+ //# sourceMappingURL=logger.d.ts.map
package/dist/logger.js ADDED
@@ -0,0 +1,15 @@
1
+ import { pino } from "pino";
2
+ export const logger = pino({
3
+ level: process.env["NODE_ENV"] === "development" ||
4
+ process.env["NODE_ENV"] === "test"
5
+ ? "debug"
6
+ : "info",
7
+ transport: {
8
+ target: "pino-pretty",
9
+ options: {
10
+ destination: 2,
11
+ colorize: true,
12
+ },
13
+ },
14
+ });
15
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1,8 @@
1
+ import PrefixMap from "@rdfjs/prefix-map/PrefixMap.js";
2
+ import type { DatasetCore } from "@rdfjs/types";
3
+ import { Either } from "purify-ts";
4
+ export declare function parseInputs(inputPaths: readonly string[]): Promise<Either<Error, {
5
+ dataset: DatasetCore;
6
+ prefixMap: PrefixMap;
7
+ }>>;
8
+ //# sourceMappingURL=parseInputs.d.ts.map
@@ -0,0 +1,49 @@
1
+ import datasetFactory from "@rdfjs/dataset";
2
+ import PrefixMap from "@rdfjs/prefix-map/PrefixMap.js";
3
+ import dataFactory from "@rdfx/data-factory";
4
+ import { RdfDirectory, RdfFileSystemEntry } from "@rdfx/fs";
5
+ import { Either, EitherAsync, Left } from "purify-ts";
6
+ import { logger } from "./logger.js";
7
+ export async function parseInputs(inputPaths) {
8
+ return EitherAsync(async ({ liftEither }) => {
9
+ const dataset = datasetFactory.dataset();
10
+ const prefixMapInit = [];
11
+ for (const inputPath of inputPaths) {
12
+ const parseInputFileSystemEntry = async (inputFileSystemEntry) => {
13
+ if (inputFileSystemEntry instanceof RdfDirectory) {
14
+ for await (const file of inputFileSystemEntry.files({
15
+ recursive: true,
16
+ })) {
17
+ await parseInputFileSystemEntry(file);
18
+ }
19
+ return;
20
+ }
21
+ const inputFile = inputFileSystemEntry;
22
+ await liftEither(await new Promise((resolve) => {
23
+ const inputQuadStream = inputFile.parse();
24
+ inputQuadStream.on("data", (quad) => dataset.add(quad));
25
+ inputQuadStream.on("end", () => resolve(Either.of(null)));
26
+ inputQuadStream.on("error", (error) => resolve(Left(error)));
27
+ inputQuadStream.on("prefix", (prefix, prefixNode) => {
28
+ const existingPrefixMapEntry = prefixMapInit.find((prefixMapEntry) => prefixMapEntry[0] === prefix ||
29
+ prefixMapEntry[1].equals(prefixNode));
30
+ if (existingPrefixMapEntry) {
31
+ if (existingPrefixMapEntry[0] !== prefix ||
32
+ !existingPrefixMapEntry[1].equals(prefixNode)) {
33
+ logger.warn("conflicting prefix %s: %s", prefix, prefixNode.value);
34
+ }
35
+ return;
36
+ }
37
+ prefixMapInit.push([prefix, prefixNode]);
38
+ });
39
+ }));
40
+ };
41
+ await parseInputFileSystemEntry(await liftEither(await RdfFileSystemEntry.fromPath(inputPath)));
42
+ }
43
+ return {
44
+ dataset,
45
+ prefixMap: new PrefixMap(prefixMapInit, { factory: dataFactory }),
46
+ };
47
+ });
48
+ }
49
+ //# sourceMappingURL=parseInputs.js.map
@@ -0,0 +1,3 @@
1
+ import type { DatasetCore } from "@rdfjs/types";
2
+ export declare const shaclShaclDataset: DatasetCore;
3
+ //# sourceMappingURL=shaclShaclDataset.d.ts.map
@@ -0,0 +1,414 @@
1
+ import { Parser, Store } from "n3";
2
+ export const shaclShaclDataset = new Store(new Parser({ format: "text/turtle" }).parse(`
3
+ # baseURI: http://www.w3.org/ns/shacl-shacl#
4
+
5
+ # A SHACL shapes graph to validate SHACL shapes graphs
6
+ # Draft last edited 2017-04-04
7
+
8
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
9
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
10
+ @prefix sh: <http://www.w3.org/ns/shacl#> .
11
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
12
+
13
+ @prefix shsh: <http://www.w3.org/ns/shacl-shacl#> .
14
+
15
+ shsh:
16
+ rdfs:label "SHACL for SHACL"@en ;
17
+ rdfs:comment "This shapes graph can be used to validate SHACL shapes graphs against a subset of the syntax rules."@en ;
18
+ sh:declare [
19
+ sh:prefix "shsh" ;
20
+ sh:namespace "http://www.w3.org/ns/shacl-shacl#" ;
21
+ ] .
22
+
23
+
24
+ shsh:ListShape
25
+ a sh:NodeShape ;
26
+ rdfs:label "List shape"@en ;
27
+ rdfs:comment "A shape describing well-formed RDF lists. Currently does not check for non-recursion. This could be expressed using SHACL-SPARQL."@en ;
28
+ rdfs:seeAlso <https://www.w3.org/TR/shacl/#syntax-rule-SHACL-list> ;
29
+ sh:property [
30
+ sh:path [ sh:zeroOrMorePath rdf:rest ] ;
31
+ rdfs:comment "Each list member (including this node) must be have the shape shsh:ListNodeShape."@en ;
32
+ sh:hasValue rdf:nil ;
33
+ sh:node shsh:ListNodeShape ;
34
+ ] .
35
+
36
+ shsh:ListNodeShape
37
+ a sh:NodeShape ;
38
+ rdfs:label "List node shape"@en ;
39
+ rdfs:comment "Defines constraints on what it means for a node to be a node within a well-formed RDF list. Note that this does not check whether the rdf:rest items are also well-formed lists as this would lead to unsupported recursion."@en ;
40
+ sh:or ( [
41
+ sh:hasValue rdf:nil ;
42
+ sh:property [
43
+ sh:path rdf:first ;
44
+ sh:maxCount 0 ;
45
+ ] ;
46
+ sh:property [
47
+ sh:path rdf:rest ;
48
+ sh:maxCount 0 ;
49
+ ] ;
50
+ ]
51
+ [
52
+ sh:not [ sh:hasValue rdf:nil ] ;
53
+ sh:property [
54
+ sh:path rdf:first ;
55
+ sh:maxCount 1 ;
56
+ sh:minCount 1 ;
57
+ ] ;
58
+ sh:property [
59
+ sh:path rdf:rest ;
60
+ sh:maxCount 1 ;
61
+ sh:minCount 1 ;
62
+ ] ;
63
+ ] ) .
64
+
65
+ shsh:ShapeShape
66
+ a sh:NodeShape ;
67
+ rdfs:label "Shape shape"@en ;
68
+ rdfs:comment "A shape that can be used to validate syntax rules for other shapes."@en ;
69
+
70
+ # See https://www.w3.org/TR/shacl/#shapes for what counts as a shape
71
+ sh:targetClass sh:NodeShape ;
72
+ sh:targetClass sh:PropertyShape ;
73
+ sh:targetSubjectsOf sh:targetClass, sh:targetNode, sh:targetObjectsOf, sh:targetSubjectsOf ;
74
+ sh:targetSubjectsOf sh:and, sh:class, sh:closed, sh:datatype, sh:disjoint, sh:equals, sh:flags, sh:hasValue,
75
+ sh:ignoredProperties, sh:in, sh:languageIn, sh:lessThan, sh:lessThanOrEquals, sh:maxCount, sh:maxExclusive,
76
+ sh:maxInclusive, sh:maxLength, sh:minCount, sh:minExclusive, sh:minInclusive, sh:minLength, sh:node, sh:nodeKind,
77
+ sh:not, sh:or, sh:pattern, sh:property, sh:qualifiedMaxCount, sh:qualifiedMinCount, sh:qualifiedValueShape,
78
+ sh:qualifiedValueShape, sh:qualifiedValueShapesDisjoint, sh:qualifiedValueShapesDisjoint, sh:sparql, sh:uniqueLang, sh:xone ;
79
+
80
+ sh:targetObjectsOf sh:node ; # node-node
81
+ sh:targetObjectsOf sh:not ; # not-node
82
+ sh:targetObjectsOf sh:property ; # property-node
83
+ sh:targetObjectsOf sh:qualifiedValueShape ; # qualifiedValueShape-node
84
+
85
+ # Shapes are either node shapes or property shapes
86
+ sh:xone ( shsh:NodeShapeShape shsh:PropertyShapeShape ) ;
87
+
88
+ sh:property [
89
+ sh:path sh:targetNode ;
90
+ sh:nodeKind sh:IRIOrLiteral ; # targetNode-nodeKind
91
+ ] ;
92
+ sh:property [
93
+ sh:path sh:targetClass ;
94
+ sh:nodeKind sh:IRI ; # targetClass-nodeKind
95
+ ] ;
96
+ sh:property [
97
+ sh:path sh:targetSubjectsOf ;
98
+ sh:nodeKind sh:IRI ; # targetSubjectsOf-nodeKind
99
+ ] ;
100
+ sh:property [
101
+ sh:path sh:targetObjectsOf ;
102
+ sh:nodeKind sh:IRI ; # targetObjectsOf-nodeKind
103
+ ] ;
104
+ sh:or ( [ sh:not [
105
+ sh:class rdfs:Class ;
106
+ sh:or ( [ sh:class sh:NodeShape ] [ sh:class sh:PropertyShape ] )
107
+ ] ]
108
+ [ sh:nodeKind sh:IRI ]
109
+ ) ; # implicit-targetClass-nodeKind
110
+
111
+ sh:property [
112
+ sh:path sh:severity ;
113
+ sh:maxCount 1 ; # severity-maxCount
114
+ sh:nodeKind sh:IRI ; # severity-nodeKind
115
+ ] ;
116
+ sh:property [
117
+ sh:path sh:message ;
118
+ sh:or ( [ sh:datatype xsd:string ] [ sh:datatype rdf:langString ] ) ; # message-datatype
119
+ ] ;
120
+ sh:property [
121
+ sh:path sh:deactivated ;
122
+ sh:maxCount 1 ; # deactivated-maxCount
123
+ sh:in ( true false ) ; # deactivated-datatype
124
+ ] ;
125
+
126
+ sh:property [
127
+ sh:path sh:and ;
128
+ sh:node shsh:ListShape ; # and-node
129
+ ] ;
130
+ sh:property [
131
+ sh:path sh:class ;
132
+ sh:nodeKind sh:IRI ; # class-nodeKind
133
+ ] ;
134
+ sh:property [
135
+ sh:path sh:closed ;
136
+ sh:datatype xsd:boolean ; # closed-datatype
137
+ sh:maxCount 1 ; # multiple-parameters
138
+ ] ;
139
+ sh:property [
140
+ sh:path sh:ignoredProperties ;
141
+ sh:node shsh:ListShape ; # ignoredProperties-node
142
+ sh:maxCount 1 ; # multiple-parameters
143
+ ] ;
144
+ sh:property [
145
+ sh:path ( sh:ignoredProperties [ sh:zeroOrMorePath rdf:rest ] rdf:first ) ;
146
+ sh:nodeKind sh:IRI ; # ignoredProperties-members-nodeKind
147
+ ] ;
148
+ sh:property [
149
+ sh:path sh:datatype ;
150
+ sh:nodeKind sh:IRI ; # datatype-nodeKind
151
+ sh:maxCount 1 ; # datatype-maxCount
152
+ ] ;
153
+ sh:property [
154
+ sh:path sh:disjoint ;
155
+ sh:nodeKind sh:IRI ; # disjoint-nodeKind
156
+ ] ;
157
+ sh:property [
158
+ sh:path sh:equals ;
159
+ sh:nodeKind sh:IRI ; # equals-nodeKind
160
+ ] ;
161
+ sh:property [
162
+ sh:path sh:in ;
163
+ sh:maxCount 1 ; # in-maxCount
164
+ sh:node shsh:ListShape ; # in-node
165
+ ] ;
166
+ sh:property [
167
+ sh:path sh:languageIn ;
168
+ sh:maxCount 1 ; # languageIn-maxCount
169
+ sh:node shsh:ListShape ; # languageIn-node
170
+ ] ;
171
+ sh:property [
172
+ sh:path ( sh:languageIn [ sh:zeroOrMorePath rdf:rest ] rdf:first ) ;
173
+ sh:datatype xsd:string ; # languageIn-members-datatype
174
+ ] ;
175
+ sh:property [
176
+ sh:path sh:lessThan ;
177
+ sh:nodeKind sh:IRI ; # lessThan-nodeKind
178
+ ] ;
179
+ sh:property [
180
+ sh:path sh:lessThanOrEquals ;
181
+ sh:nodeKind sh:IRI ; # lessThanOrEquals-nodeKind
182
+ ] ;
183
+ sh:property [
184
+ sh:path sh:maxCount ;
185
+ sh:datatype xsd:integer ; # maxCount-datatype
186
+ sh:maxCount 1 ; # maxCount-maxCount
187
+ ] ;
188
+ sh:property [
189
+ sh:path sh:maxExclusive ;
190
+ sh:maxCount 1 ; # maxExclusive-maxCount
191
+ sh:nodeKind sh:Literal ; # maxExclusive-nodeKind
192
+ ] ;
193
+ sh:property [
194
+ sh:path sh:maxInclusive ;
195
+ sh:maxCount 1 ; # maxInclusive-maxCount
196
+ sh:nodeKind sh:Literal ; # maxInclusive-nodeKind
197
+ ] ;
198
+ sh:property [
199
+ sh:path sh:maxLength ;
200
+ sh:datatype xsd:integer ; # maxLength-datatype
201
+ sh:maxCount 1 ; # maxLength-maxCount
202
+ ] ;
203
+ sh:property [
204
+ sh:path sh:minCount ;
205
+ sh:datatype xsd:integer ; # minCount-datatype
206
+ sh:maxCount 1 ; # minCount-maxCount
207
+ ] ;
208
+ sh:property [
209
+ sh:path sh:minExclusive ;
210
+ sh:maxCount 1 ; # minExclusive-maxCount
211
+ sh:nodeKind sh:Literal ; # minExclusive-nodeKind
212
+ ] ;
213
+ sh:property [
214
+ sh:path sh:minInclusive ;
215
+ sh:maxCount 1 ; # minInclusive-maxCount
216
+ sh:nodeKind sh:Literal ; # minInclusive-nodeKind
217
+ ] ;
218
+ sh:property [
219
+ sh:path sh:minLength ;
220
+ sh:datatype xsd:integer ; # minLength-datatype
221
+ sh:maxCount 1 ; # minLength-maxCount
222
+ ] ;
223
+ sh:property [
224
+ sh:path sh:nodeKind ;
225
+ sh:in ( sh:BlankNode sh:IRI sh:Literal sh:BlankNodeOrIRI sh:BlankNodeOrLiteral sh:IRIOrLiteral ) ; # nodeKind-in
226
+ sh:maxCount 1 ; # nodeKind-maxCount
227
+ ] ;
228
+ sh:property [
229
+ sh:path sh:or ;
230
+ sh:node shsh:ListShape ; # or-node
231
+ ] ;
232
+ sh:property [
233
+ sh:path sh:pattern ;
234
+ sh:datatype xsd:string ; # pattern-datatype
235
+ sh:maxCount 1 ; # multiple-parameters
236
+ # Not implemented: syntax rule pattern-regex
237
+ ] ;
238
+ sh:property [
239
+ sh:path sh:flags ;
240
+ sh:datatype xsd:string ; # flags-datatype
241
+ sh:maxCount 1 ; # multiple-parameters
242
+ ] ;
243
+ sh:property [
244
+ sh:path sh:qualifiedMaxCount ;
245
+ sh:datatype xsd:integer ; # qualifiedMaxCount-datatype
246
+ sh:maxCount 1 ; # multiple-parameters
247
+ ] ;
248
+ sh:property [
249
+ sh:path sh:qualifiedMinCount ;
250
+ sh:datatype xsd:integer ; # qualifiedMinCount-datatype
251
+ sh:maxCount 1 ; # multiple-parameters
252
+ ] ;
253
+ sh:property [
254
+ sh:path sh:qualifiedValueShape ;
255
+ sh:maxCount 1 ; # multiple-parameters
256
+ ] ;
257
+ sh:property [
258
+ sh:path sh:qualifiedValueShapesDisjoint ;
259
+ sh:datatype xsd:boolean ; # qualifiedValueShapesDisjoint-datatype
260
+ sh:maxCount 1 ; # multiple-parameters
261
+ ] ;
262
+ sh:property [
263
+ sh:path sh:uniqueLang ;
264
+ sh:datatype xsd:boolean ; # uniqueLang-datatype
265
+ sh:maxCount 1 ; # uniqueLang-maxCount
266
+ ] ;
267
+ sh:property [
268
+ sh:path sh:xone ;
269
+ sh:node shsh:ListShape ; # xone-node
270
+ ] .
271
+
272
+ shsh:NodeShapeShape
273
+ a sh:NodeShape ;
274
+ sh:targetObjectsOf sh:node ; # node-node
275
+ sh:property [
276
+ sh:path sh:path ;
277
+ sh:maxCount 0 ; # NodeShape-path-maxCount
278
+ ] ;
279
+ sh:property [
280
+ sh:path sh:lessThan ;
281
+ sh:maxCount 0 ; # lessThan-scope
282
+ ] ;
283
+ sh:property [
284
+ sh:path sh:lessThanOrEquals ;
285
+ sh:maxCount 0 ; # lessThanOrEquals-scope
286
+ ] ;
287
+ sh:property [
288
+ sh:path sh:maxCount ;
289
+ sh:maxCount 0 ; # maxCount-scope
290
+ ] ;
291
+ sh:property [
292
+ sh:path sh:minCount ;
293
+ sh:maxCount 0 ; # minCount-scope
294
+ ] ;
295
+ sh:property [
296
+ sh:path sh:qualifiedValueShape ;
297
+ sh:maxCount 0 ; # qualifiedValueShape-scope
298
+ ] ;
299
+ sh:property [
300
+ sh:path sh:uniqueLang ;
301
+ sh:maxCount 0 ; # uniqueLang-scope
302
+ ] .
303
+
304
+ shsh:PropertyShapeShape
305
+ a sh:NodeShape ;
306
+ sh:targetObjectsOf sh:property ; # property-node
307
+ sh:property [
308
+ sh:path sh:path ;
309
+ sh:maxCount 1 ; # path-maxCount
310
+ sh:minCount 1 ; # PropertyShape-path-minCount
311
+ sh:node shsh:PathShape ; # path-node
312
+ ] .
313
+
314
+ # Values of sh:and, sh:or and sh:xone must be lists of shapes
315
+ shsh:ShapesListShape
316
+ a sh:NodeShape ;
317
+ sh:targetObjectsOf sh:and ; # and-members-node
318
+ sh:targetObjectsOf sh:or ; # or-members-node
319
+ sh:targetObjectsOf sh:xone ; # xone-members-node
320
+ sh:property [
321
+ sh:path ( [ sh:zeroOrMorePath rdf:rest ] rdf:first ) ;
322
+ sh:node shsh:ShapeShape ;
323
+ ] .
324
+
325
+
326
+ # A path of blank node path syntax, used to simulate recursion
327
+ _:PathPath
328
+ sh:alternativePath (
329
+ ( [ sh:zeroOrMorePath rdf:rest ] rdf:first )
330
+ ( sh:alternativePath [ sh:zeroOrMorePath rdf:rest ] rdf:first )
331
+ sh:inversePath
332
+ sh:zeroOrMorePath
333
+ sh:oneOrMorePath
334
+ sh:zeroOrOnePath
335
+ ) .
336
+
337
+ shsh:PathShape
338
+ a sh:NodeShape ;
339
+ rdfs:label "Path shape"@en ;
340
+ rdfs:comment "A shape that can be used to validate the syntax rules of well-formed SHACL paths."@en ;
341
+ rdfs:seeAlso <https://www.w3.org/TR/shacl/#property-paths> ;
342
+ sh:property [
343
+ sh:path [ sh:zeroOrMorePath _:PathPath ] ;
344
+ sh:node shsh:PathNodeShape ;
345
+ ] .
346
+
347
+ shsh:PathNodeShape
348
+ sh:xone ( # path-metarule
349
+ [ sh:nodeKind sh:IRI ] # 2.3.1.1: Predicate path
350
+ [ sh:nodeKind sh:BlankNode ; # 2.3.1.2: Sequence path
351
+ sh:node shsh:PathListWithAtLeast2Members ;
352
+ ]
353
+ [ sh:nodeKind sh:BlankNode ; # 2.3.1.3: Alternative path
354
+ sh:closed true ;
355
+ sh:property [
356
+ sh:path sh:alternativePath ;
357
+ sh:node shsh:PathListWithAtLeast2Members ;
358
+ sh:minCount 1 ;
359
+ sh:maxCount 1 ;
360
+ ]
361
+ ]
362
+ [ sh:nodeKind sh:BlankNode ; # 2.3.1.4: Inverse path
363
+ sh:closed true ;
364
+ sh:property [
365
+ sh:path sh:inversePath ;
366
+ sh:minCount 1 ;
367
+ sh:maxCount 1 ;
368
+ ]
369
+ ]
370
+ [ sh:nodeKind sh:BlankNode ; # 2.3.1.5: Zero-or-more path
371
+ sh:closed true ;
372
+ sh:property [
373
+ sh:path sh:zeroOrMorePath ;
374
+ sh:minCount 1 ;
375
+ sh:maxCount 1 ;
376
+ ]
377
+ ]
378
+ [ sh:nodeKind sh:BlankNode ; # 2.3.1.6: One-or-more path
379
+ sh:closed true ;
380
+ sh:property [
381
+ sh:path sh:oneOrMorePath ;
382
+ sh:minCount 1 ;
383
+ sh:maxCount 1 ;
384
+ ]
385
+ ]
386
+ [ sh:nodeKind sh:BlankNode ; # 2.3.1.7: Zero-or-one path
387
+ sh:closed true ;
388
+ sh:property [
389
+ sh:path sh:zeroOrOnePath ;
390
+ sh:minCount 1 ;
391
+ sh:maxCount 1 ;
392
+ ]
393
+ ]
394
+ ) .
395
+
396
+ shsh:PathListWithAtLeast2Members
397
+ a sh:NodeShape ;
398
+ sh:node shsh:ListShape ;
399
+ sh:property [
400
+ sh:path [ sh:oneOrMorePath rdf:rest ] ;
401
+ sh:minCount 2 ; # 1 other list node plus rdf:nil
402
+ ] .
403
+
404
+ shsh:ShapesGraphShape
405
+ a sh:NodeShape ;
406
+ sh:targetObjectsOf sh:shapesGraph ;
407
+ sh:nodeKind sh:IRI . # shapesGraph-nodeKind
408
+
409
+ shsh:EntailmentShape
410
+ a sh:NodeShape ;
411
+ sh:targetObjectsOf sh:entailment ;
412
+ sh:nodeKind sh:IRI . # entailment-nodeKind
413
+ `));
414
+ //# sourceMappingURL=shaclShaclDataset.js.map
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "shaclmate": "dist/cli.js"
4
4
  },
5
5
  "dependencies": {
6
- "@shaclmate/compiler": "4.0.50",
6
+ "@shaclmate/compiler": "4.0.51",
7
7
  "@rdfjs/dataset": "~2.0.2",
8
8
  "@rdfjs/prefix-map": "~0.1.2",
9
9
  "@rdfjs/serializer-turtle": "~1.1.5",
@@ -26,24 +26,24 @@
26
26
  },
27
27
  "files": [
28
28
  "README.md",
29
- "dist/cli.ts.d.ts",
30
- "dist/cli.ts.js",
31
- "dist/commands/generate.ts.d.ts",
32
- "dist/commands/generate.ts.js",
33
- "dist/commands/index.ts.d.ts",
34
- "dist/commands/index.ts.js",
35
- "dist/commands/merge.ts.d.ts",
36
- "dist/commands/merge.ts.js",
37
- "dist/commands/validate.ts.d.ts",
38
- "dist/commands/validate.ts.js",
39
- "dist/index.ts.d.ts",
40
- "dist/index.ts.js",
41
- "dist/logger.ts.d.ts",
42
- "dist/logger.ts.js",
43
- "dist/parseInputs.ts.d.ts",
44
- "dist/parseInputs.ts.js",
45
- "dist/shaclShaclDataset.ts.d.ts",
46
- "dist/shaclShaclDataset.ts.js"
29
+ "dist/cli.d.ts",
30
+ "dist/cli.js",
31
+ "dist/commands/generate.d.ts",
32
+ "dist/commands/generate.js",
33
+ "dist/commands/index.d.ts",
34
+ "dist/commands/index.js",
35
+ "dist/commands/merge.d.ts",
36
+ "dist/commands/merge.js",
37
+ "dist/commands/validate.d.ts",
38
+ "dist/commands/validate.js",
39
+ "dist/index.d.ts",
40
+ "dist/index.js",
41
+ "dist/logger.d.ts",
42
+ "dist/logger.js",
43
+ "dist/parseInputs.d.ts",
44
+ "dist/parseInputs.js",
45
+ "dist/shaclShaclDataset.d.ts",
46
+ "dist/shaclShaclDataset.js"
47
47
  ],
48
48
  "homepage": "https://github.com/minorg/shaclmate",
49
49
  "keywords": [
@@ -69,5 +69,5 @@
69
69
  },
70
70
  "type": "module",
71
71
  "types": "./dist/index.d.ts",
72
- "version": "4.0.50"
72
+ "version": "4.0.51"
73
73
  }