@shaclmate/cli 4.0.60 → 4.0.61
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.js +27 -3
- package/dist/commands/generate.js +15 -13
- package/dist/commands/merge.d.ts +2 -1
- package/dist/commands/merge.js +12 -5
- package/dist/commands/validate.js +23 -80
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/logger.d.ts +2 -1
- package/dist/parseInputs.d.ts +1 -1
- package/dist/parseInputs.js +5 -34
- package/package.json +7 -11
- package/dist/shaclShaclDataset.d.ts +0 -3
- package/dist/shaclShaclDataset.js +0 -414
package/dist/cli.js
CHANGED
|
@@ -16,7 +16,7 @@ const inputPaths = restPositionals({
|
|
|
16
16
|
const outputFilePath = option({
|
|
17
17
|
defaultValue: () => "",
|
|
18
18
|
description: "path to a file to write output to; if not specified, write to stdout",
|
|
19
|
-
long: "output-path",
|
|
19
|
+
long: "output-file-path",
|
|
20
20
|
short: "o",
|
|
21
21
|
type: string,
|
|
22
22
|
});
|
|
@@ -89,6 +89,18 @@ run(subcommands({
|
|
|
89
89
|
},
|
|
90
90
|
}),
|
|
91
91
|
inputPaths,
|
|
92
|
+
objectDiscriminantPropertyJsonName: option({
|
|
93
|
+
defaultValue: () => TsGenerator.Configuration.default_.objectDiscriminantProperty
|
|
94
|
+
.jsonName,
|
|
95
|
+
description: "name of the property to use to discriminate object types (in JSON)",
|
|
96
|
+
long: "object-discriminant-property-json-name",
|
|
97
|
+
}),
|
|
98
|
+
objectDiscriminantPropertyName: option({
|
|
99
|
+
defaultValue: () => TsGenerator.Configuration.default_.objectDiscriminantProperty
|
|
100
|
+
.name,
|
|
101
|
+
description: "name of the property to use to discriminate object types",
|
|
102
|
+
long: "object-discriminant-property-name",
|
|
103
|
+
}),
|
|
92
104
|
outputFilePath,
|
|
93
105
|
syntheticNamePrefix: option({
|
|
94
106
|
defaultValue: () => TsGenerator.Configuration.default_.syntheticNamePrefix,
|
|
@@ -96,11 +108,15 @@ run(subcommands({
|
|
|
96
108
|
long: "synthetic-name-prefix",
|
|
97
109
|
}),
|
|
98
110
|
},
|
|
99
|
-
handler: async ({ features, inputPaths, outputFilePath, syntheticNamePrefix, }) => {
|
|
111
|
+
handler: async ({ features, inputPaths, objectDiscriminantPropertyJsonName, objectDiscriminantPropertyName, outputFilePath, syntheticNamePrefix, }) => {
|
|
100
112
|
(await generate({
|
|
101
113
|
generator: new TsGenerator({
|
|
102
114
|
configuration: {
|
|
103
115
|
features: new Set(features),
|
|
116
|
+
objectDiscriminantProperty: {
|
|
117
|
+
jsonName: objectDiscriminantPropertyJsonName,
|
|
118
|
+
name: objectDiscriminantPropertyName,
|
|
119
|
+
},
|
|
104
120
|
syntheticNamePrefix,
|
|
105
121
|
},
|
|
106
122
|
logger,
|
|
@@ -133,11 +149,19 @@ run(subcommands({
|
|
|
133
149
|
args: {
|
|
134
150
|
inputPaths,
|
|
135
151
|
outputFilePath,
|
|
152
|
+
outputFormat: option({
|
|
153
|
+
defaultValue: () => "application/n-quads",
|
|
154
|
+
description: "output RDF format",
|
|
155
|
+
long: "output-format",
|
|
156
|
+
short: "f",
|
|
157
|
+
type: string,
|
|
158
|
+
}),
|
|
136
159
|
},
|
|
137
|
-
handler: async ({ inputPaths, outputFilePath }) => {
|
|
160
|
+
handler: async ({ inputPaths, outputFilePath, outputFormat }) => {
|
|
138
161
|
(await merge({
|
|
139
162
|
inputPaths,
|
|
140
163
|
outputFilePath,
|
|
164
|
+
outputFormat,
|
|
141
165
|
})).unsafeCoerce();
|
|
142
166
|
},
|
|
143
167
|
}),
|
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
|
-
import Serializer from "@rdfjs/serializer-turtle";
|
|
3
2
|
import { Compiler, ShapesGraph } from "@shaclmate/compiler";
|
|
4
3
|
import { EitherAsync } from "purify-ts";
|
|
5
|
-
import SHACLValidator from "rdf-validate-shacl";
|
|
6
4
|
import { logger } from "../logger.js";
|
|
7
5
|
import { parseInputs } from "../parseInputs.js";
|
|
8
|
-
import { shaclShaclDataset } from "../shaclShaclDataset.js";
|
|
9
6
|
export async function generate({ generator, inputPaths, outputFilePath, }) {
|
|
10
7
|
return EitherAsync(async ({ liftEither }) => {
|
|
11
8
|
if (inputPaths.length === 0) {
|
|
12
9
|
throw new Error("must specify at least one input shapes graph file path");
|
|
13
10
|
}
|
|
14
11
|
const { dataset, prefixMap } = await liftEither(await parseInputs(inputPaths));
|
|
15
|
-
{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
12
|
+
// {
|
|
13
|
+
// const validationReport = await new SHACLValidator(
|
|
14
|
+
// shaclShaclDataset,
|
|
15
|
+
// {},
|
|
16
|
+
// ).validate(dataset);
|
|
17
|
+
// if (!validationReport.conforms) {
|
|
18
|
+
// process.stderr.write("input is not valid SHACL:\n");
|
|
19
|
+
// process.stderr.write(
|
|
20
|
+
// new Serializer({
|
|
21
|
+
// prefixes: prefixMap,
|
|
22
|
+
// }).transform(validationReport.dataset),
|
|
23
|
+
// );
|
|
24
|
+
// return;
|
|
25
|
+
// }
|
|
26
|
+
// }
|
|
25
27
|
const output = await liftEither(ShapesGraph.builder()
|
|
26
28
|
.parseDataset(dataset, { prefixMap })
|
|
27
29
|
.map((_) => _.build())
|
package/dist/commands/merge.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Either } from "purify-ts";
|
|
2
|
-
export declare function merge({ inputPaths, outputFilePath, }: {
|
|
2
|
+
export declare function merge({ inputPaths, outputFilePath, outputFormat, }: {
|
|
3
3
|
inputPaths: readonly string[];
|
|
4
4
|
outputFilePath: string;
|
|
5
|
+
outputFormat: string;
|
|
5
6
|
}): Promise<Either<Error, void>>;
|
|
6
7
|
//# sourceMappingURL=merge.d.ts.map
|
package/dist/commands/merge.js
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
|
-
import
|
|
2
|
+
import { Readable } from "node:stream";
|
|
3
|
+
import serializers from "@rdfx/serializers";
|
|
3
4
|
import { EitherAsync } from "purify-ts";
|
|
4
5
|
import { parseInputs } from "../parseInputs.js";
|
|
5
|
-
export async function merge({ inputPaths, outputFilePath, }) {
|
|
6
|
+
export async function merge({ inputPaths, outputFilePath, outputFormat, }) {
|
|
6
7
|
return EitherAsync(async ({ liftEither }) => {
|
|
7
8
|
const { dataset, prefixMap } = await liftEither(await parseInputs(inputPaths));
|
|
8
|
-
const
|
|
9
|
+
const outputStream = serializers({
|
|
10
|
+
prefixes: prefixMap,
|
|
11
|
+
rdfjs: { module: "ts" },
|
|
12
|
+
}).import(outputFormat, Readable.from([...dataset]));
|
|
13
|
+
if (outputStream === null) {
|
|
14
|
+
throw new RangeError(`invalid output format: ${outputFormat}`);
|
|
15
|
+
}
|
|
9
16
|
if (outputFilePath.length === 0) {
|
|
10
|
-
process.stdout
|
|
17
|
+
outputStream.pipe(process.stdout);
|
|
11
18
|
}
|
|
12
19
|
else {
|
|
13
|
-
|
|
20
|
+
outputStream.pipe(fs.createWriteStream(outputFilePath));
|
|
14
21
|
}
|
|
15
22
|
});
|
|
16
23
|
}
|
|
@@ -1,94 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import Serializer from "@rdfjs/serializer-turtle";
|
|
1
|
+
import { ZazukoValidator } from "@shaclmate/validator";
|
|
2
|
+
import { JenaValidator } from "@shaclmate/validator/JenaValidator";
|
|
3
|
+
import { PyShaclValidator } from "@shaclmate/validator/PyShaclValidator";
|
|
5
4
|
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
5
|
import { logger } from "../logger.js";
|
|
10
6
|
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
7
|
export async function validate({ dataGraphPaths, shapesGraphPaths, }) {
|
|
20
8
|
return EitherAsync(async ({ liftEither }) => {
|
|
21
|
-
const { dataset:
|
|
22
|
-
if (
|
|
9
|
+
const { dataset: dataGraph, prefixMap } = await liftEither(await parseInputs(dataGraphPaths));
|
|
10
|
+
if (dataGraph.size === 0) {
|
|
23
11
|
throw new Error("data graph is empty!");
|
|
24
12
|
}
|
|
25
|
-
logger.
|
|
26
|
-
const { dataset:
|
|
27
|
-
if (
|
|
13
|
+
logger.debug("data graph size: %d", dataGraph.size);
|
|
14
|
+
const { dataset: shapesGraph } = await liftEither(await parseInputs(shapesGraphPaths));
|
|
15
|
+
if (shapesGraph.size === 0) {
|
|
28
16
|
throw new Error("shapes graph is empty!");
|
|
29
17
|
}
|
|
30
|
-
logger.
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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");
|
|
18
|
+
logger.debug("shapes graph size: %d", shapesGraph.size);
|
|
19
|
+
for (const [validatorId, validator] of Object.entries({
|
|
20
|
+
zazuko: new ZazukoValidator({ logger, prefixMap, shapesGraph }),
|
|
21
|
+
jena: (await liftEither(await JenaValidator.create({ logger, prefixMap, shapesGraph }))).extractNullable(),
|
|
22
|
+
pyshacl: (await liftEither(await PyShaclValidator.create({ logger, prefixMap, shapesGraph }))).extractNullable(),
|
|
23
|
+
})) {
|
|
24
|
+
if (validator === null) {
|
|
25
|
+
continue;
|
|
76
26
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if (code !== 0) {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
27
|
+
logger.debug("validating with %s", validatorId);
|
|
28
|
+
const validationReport = await liftEither(await validator.validate(dataGraph));
|
|
29
|
+
if (!validationReport.conforms) {
|
|
30
|
+
logger.warn(validationReport.toString());
|
|
31
|
+
process.exit(1);
|
|
85
32
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
}, {
|
|
90
|
-
unsafeCleanup: true,
|
|
91
|
-
});
|
|
33
|
+
logger.info("validated with %s", validatorId);
|
|
34
|
+
}
|
|
92
35
|
});
|
|
93
36
|
}
|
|
94
37
|
//# sourceMappingURL=validate.js.map
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/logger.d.ts
CHANGED
package/dist/parseInputs.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import PrefixMap from "@rdfjs/prefix-map/PrefixMap.js";
|
|
2
2
|
import type { DatasetCore } from "@rdfjs/types";
|
|
3
|
-
import { Either } from "purify-ts";
|
|
3
|
+
import { type Either } from "purify-ts";
|
|
4
4
|
export declare function parseInputs(inputPaths: readonly string[]): Promise<Either<Error, {
|
|
5
5
|
dataset: DatasetCore;
|
|
6
6
|
prefixMap: PrefixMap;
|
package/dist/parseInputs.js
CHANGED
|
@@ -1,48 +1,19 @@
|
|
|
1
1
|
import datasetFactory from "@rdfjs/dataset";
|
|
2
2
|
import PrefixMap from "@rdfjs/prefix-map/PrefixMap.js";
|
|
3
3
|
import dataFactory from "@rdfx/data-factory";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { RdfFileSystemEntry } from "@rdfx/fs";
|
|
5
|
+
import { EitherAsync } from "purify-ts";
|
|
6
6
|
import { logger } from "./logger.js";
|
|
7
7
|
export async function parseInputs(inputPaths) {
|
|
8
8
|
return EitherAsync(async ({ liftEither }) => {
|
|
9
9
|
const dataset = datasetFactory.dataset();
|
|
10
|
-
const
|
|
10
|
+
const prefixMap = new PrefixMap(undefined, { factory: dataFactory });
|
|
11
11
|
for (const inputPath of inputPaths) {
|
|
12
|
-
|
|
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)));
|
|
12
|
+
await liftEither(await (await liftEither(await RdfFileSystemEntry.fromPath(inputPath, { logger }))).parseInto(dataset, { prefixMap, recursive: true }));
|
|
42
13
|
}
|
|
43
14
|
return {
|
|
44
15
|
dataset,
|
|
45
|
-
prefixMap
|
|
16
|
+
prefixMap,
|
|
46
17
|
};
|
|
47
18
|
});
|
|
48
19
|
}
|
package/package.json
CHANGED
|
@@ -3,26 +3,24 @@
|
|
|
3
3
|
"shaclmate": "dist/cli.js"
|
|
4
4
|
},
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@shaclmate/compiler": "4.0.
|
|
6
|
+
"@shaclmate/compiler": "4.0.61",
|
|
7
|
+
"@shaclmate/validator": "4.0.61",
|
|
7
8
|
"@rdfjs/dataset": "~2.0.2",
|
|
8
9
|
"@rdfjs/prefix-map": "~0.1.2",
|
|
9
|
-
"@rdfjs/serializer-turtle": "~1.1.5",
|
|
10
10
|
"@rdfx/data-factory": "0.0.30",
|
|
11
11
|
"@rdfx/fs": "0.0.30",
|
|
12
|
+
"@rdfx/serializers": "0.0.30",
|
|
12
13
|
"cmd-ts": "~0.15.0",
|
|
13
14
|
"pino": "~9.1.0",
|
|
14
15
|
"pino-pretty": "~13.1.2",
|
|
15
16
|
"purify-ts": "~2.1.4",
|
|
16
|
-
"
|
|
17
|
-
"tmp-promise": "~3.0.3",
|
|
18
|
-
"which": "~6.0.1"
|
|
17
|
+
"ts-log": "~3.0.2"
|
|
19
18
|
},
|
|
20
19
|
"description": "Command line program to generate TypeScript code from SHACL shapes",
|
|
21
20
|
"devDependencies": {
|
|
22
21
|
"@rdfjs/types": "~2.0.1",
|
|
23
22
|
"@types/rdfjs__dataset": "~2.0.7",
|
|
24
|
-
"@types/rdfjs__prefix-map": "~0.1.5"
|
|
25
|
-
"@types/which": "~3.0.4"
|
|
23
|
+
"@types/rdfjs__prefix-map": "~0.1.5"
|
|
26
24
|
},
|
|
27
25
|
"files": [
|
|
28
26
|
"README.md",
|
|
@@ -41,9 +39,7 @@
|
|
|
41
39
|
"dist/logger.d.ts",
|
|
42
40
|
"dist/logger.js",
|
|
43
41
|
"dist/parseInputs.d.ts",
|
|
44
|
-
"dist/parseInputs.js"
|
|
45
|
-
"dist/shaclShaclDataset.d.ts",
|
|
46
|
-
"dist/shaclShaclDataset.js"
|
|
42
|
+
"dist/parseInputs.js"
|
|
47
43
|
],
|
|
48
44
|
"homepage": "https://github.com/minorg/shaclmate",
|
|
49
45
|
"keywords": [
|
|
@@ -69,5 +65,5 @@
|
|
|
69
65
|
},
|
|
70
66
|
"type": "module",
|
|
71
67
|
"types": "./dist/index.d.ts",
|
|
72
|
-
"version": "4.0.
|
|
68
|
+
"version": "4.0.61"
|
|
73
69
|
}
|
|
@@ -1,414 +0,0 @@
|
|
|
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
|