@shaclmate/cli 2.0.12 → 2.0.14

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/cli.js CHANGED
@@ -1,13 +1,15 @@
1
1
  import * as fs from "node:fs";
2
2
  import PrefixMap from "@rdfjs/prefix-map/PrefixMap";
3
- import { ShapesGraphToAstTransformer } from "@shaclmate/compiler/ShapesGraphToAstTransformer.js";
3
+ import { Compiler } from "@shaclmate/compiler";
4
4
  import * as generators from "@shaclmate/compiler/generators";
5
- import { dashDataset } from "@shaclmate/compiler/vocabularies/dashDataset.js";
6
- import { array, command, multioption, oneOf, option, restPositionals, run, string, subcommands, } from "cmd-ts";
5
+ import { command, option, restPositionals, run, string, subcommands, } from "cmd-ts";
7
6
  import { ExistingPath } from "cmd-ts/dist/esm/batteries/fs.js";
7
+ import * as N3 from "n3";
8
8
  import { DataFactory, Parser, Store } from "n3";
9
9
  import pino from "pino";
10
- import { ShapesGraph } from "shacl-ast";
10
+ import SHACLValidator from "rdf-validate-shacl";
11
+ import { dashDataset } from "./dashDataset.js";
12
+ import { shaclShaclDataset } from "./shaclShaclDataset.js";
11
13
  const inputFilePaths = restPositionals({
12
14
  displayName: "inputFilePaths",
13
15
  description: "paths to RDF files containing SHACL shapes",
@@ -26,7 +28,7 @@ const outputFilePath = option({
26
28
  short: "o",
27
29
  type: string,
28
30
  });
29
- function readInput(inputFilePaths) {
31
+ function generate({ generator, inputFilePaths, outputFilePath, }) {
30
32
  if (inputFilePaths.length === 0) {
31
33
  throw new Error("must specify at least one input shapes graph file path");
32
34
  }
@@ -49,24 +51,37 @@ function readInput(inputFilePaths) {
49
51
  iriPrefixes.push([prefix, prefixNode]);
50
52
  }));
51
53
  }
52
- const shapesGraph = ShapesGraph.fromDataset(dataset);
53
- return new ShapesGraphToAstTransformer({
54
- iriPrefixMap: new PrefixMap(iriPrefixes, { factory: DataFactory }),
55
- shapesGraph,
56
- })
57
- .transform()
54
+ const iriPrefixMap = new PrefixMap(iriPrefixes, { factory: DataFactory });
55
+ const validationReport = new SHACLValidator(shaclShaclDataset).validate(dataset);
56
+ if (!validationReport.conforms) {
57
+ process.stderr.write("input is not valid SHACL:\n");
58
+ const n3WriterPrefixes = {};
59
+ for (const prefixEntry of iriPrefixMap.entries()) {
60
+ n3WriterPrefixes[prefixEntry[0]] = prefixEntry[1].value;
61
+ }
62
+ const n3Writer = new N3.Writer({
63
+ format: "text/turtle",
64
+ prefixes: n3WriterPrefixes,
65
+ });
66
+ for (const quad of validationReport.dataset) {
67
+ n3Writer.addQuad(quad);
68
+ }
69
+ n3Writer.end((_error, result) => process.stderr.write(result));
70
+ return;
71
+ }
72
+ const output = new Compiler({ generator, iriPrefixMap }).compile(dataset);
73
+ output
58
74
  .ifLeft((error) => {
59
75
  throw error;
60
76
  })
61
- .extract();
62
- }
63
- function writeOutput(output, outputFilePath) {
64
- if (outputFilePath.length === 0) {
65
- process.stdout.write(output);
66
- }
67
- else {
68
- fs.writeFileSync(outputFilePath, output);
69
- }
77
+ .ifRight((output) => {
78
+ if (outputFilePath.length === 0) {
79
+ process.stdout.write(output);
80
+ }
81
+ else {
82
+ fs.writeFileSync(outputFilePath, output);
83
+ }
84
+ });
70
85
  }
71
86
  run(subcommands({
72
87
  cmds: {
@@ -74,63 +89,15 @@ run(subcommands({
74
89
  name: "generate",
75
90
  description: "generate TypeScript for the SHACL Shapes Graph AST",
76
91
  args: {
77
- dataFactoryImport: option({
78
- defaultValue: () => generators.ts.TsGenerator.Configuration.Defaults
79
- .dataFactoryImport,
80
- description: "import line to get an RDF/JS DataFactory",
81
- long: "data-factory-import",
82
- type: string,
83
- }),
84
- dataFactoryVariable: option({
85
- defaultValue: () => generators.ts.TsGenerator.Configuration.Defaults
86
- .dataFactoryVariable,
87
- description: "variable of the RDF/JS DataFactory that was imported",
88
- long: "data-factory-variable",
89
- type: string,
90
- }),
91
- features: multioption({
92
- description: "generator features to enable",
93
- long: "feature",
94
- type: array(oneOf([
95
- "class",
96
- "equals",
97
- "fromRdf",
98
- "toRdf",
99
- "sparql-graph-patterns",
100
- ])),
101
- }),
102
92
  inputFilePaths,
103
93
  outputFilePath,
104
- objectTypeDeclarationType: option({
105
- defaultValue: () => generators.ts.TsGenerator.Configuration.Defaults
106
- .objectTypeDeclarationType,
107
- long: "object-type-declaration-type",
108
- type: oneOf(["class", "interface"]),
109
- }),
110
- objectTypeDiscriminatorPropertyName: option({
111
- defaultValue: () => generators.ts.TsGenerator.Configuration.Defaults
112
- .objectTypeDiscriminatorPropertyName,
113
- description: "name of a property to add to generated object types to discriminate them with a string enum",
114
- long: "object-type-discriminator-property-name",
115
- type: string,
116
- }),
117
- objectTypeIdentifierPropertyName: option({
118
- defaultValue: () => generators.ts.TsGenerator.Configuration.Defaults
119
- .objectTypeIdentifierPropertyName,
120
- description: "name of a property to add to generated object types to discriminate them with a string enum",
121
- long: "object-type-discriminator-property-name",
122
- type: string,
123
- }),
124
94
  },
125
- handler: async ({ dataFactoryImport, dataFactoryVariable, features, inputFilePaths, objectTypeDeclarationType, objectTypeDiscriminatorPropertyName, objectTypeIdentifierPropertyName, outputFilePath, }) => {
126
- writeOutput(new generators.ts.TsGenerator(readInput(inputFilePaths), new generators.ts.TsGenerator.Configuration({
127
- dataFactoryImport,
128
- dataFactoryVariable,
129
- features: new Set(features),
130
- objectTypeDeclarationType: objectTypeDeclarationType,
131
- objectTypeDiscriminatorPropertyName,
132
- objectTypeIdentifierPropertyName,
133
- })).generate(), outputFilePath);
95
+ handler: async ({ inputFilePaths, outputFilePath }) => {
96
+ generate({
97
+ generator: new generators.ts.TsGenerator(),
98
+ inputFilePaths,
99
+ outputFilePath,
100
+ });
134
101
  },
135
102
  }),
136
103
  "show-ast-json": command({
@@ -141,7 +108,11 @@ run(subcommands({
141
108
  outputFilePath,
142
109
  },
143
110
  handler: async ({ inputFilePaths, outputFilePath }) => {
144
- writeOutput(new generators.json.AstJsonGenerator(readInput(inputFilePaths)).generate(), outputFilePath);
111
+ generate({
112
+ generator: new generators.json.AstJsonGenerator(),
113
+ inputFilePaths,
114
+ outputFilePath,
115
+ });
145
116
  },
146
117
  }),
147
118
  },
@@ -0,0 +1,8 @@
1
+ import type { DatasetCore } from "@rdfjs/types";
2
+ /**
3
+ * A subset of DASH (https://datashapes.org/dash.html) that's added to command line inputs for convenience.
4
+ *
5
+ * Parts that don't validate with SHACL-SHACL have been excised.
6
+ */
7
+ export declare const dashDataset: DatasetCore;
8
+ //# sourceMappingURL=dashDataset.d.ts.map
package/dashDataset.js ADDED
@@ -0,0 +1,69 @@
1
+ import { Parser, Store } from "n3";
2
+ /**
3
+ * A subset of DASH (https://datashapes.org/dash.html) that's added to command line inputs for convenience.
4
+ *
5
+ * Parts that don't validate with SHACL-SHACL have been excised.
6
+ */
7
+ export const dashDataset = new Store(new Parser({ format: "text/turtle" }).parse(`
8
+ # baseURI: http://datashapes.org/dash
9
+ # imports: http://www.w3.org/ns/shacl#
10
+ # prefix: dash
11
+
12
+ @prefix dash: <http://datashapes.org/dash#> .
13
+ @prefix owl: <http://www.w3.org/2002/07/owl#> .
14
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
15
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
16
+ @prefix sh: <http://www.w3.org/ns/shacl#> .
17
+ @prefix tosh: <http://topbraid.org/tosh#> .
18
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
19
+
20
+ <http://datashapes.org/dash>
21
+ a owl:Ontology ;
22
+ rdfs:comment "DASH is a SHACL library for frequently needed features and design patterns. The constraint components in this library are 100% standards compliant and will work on any engine that fully supports SHACL." ;
23
+ rdfs:label "DASH Data Shapes Vocabulary" ;
24
+ owl:imports sh: ;
25
+ sh:declare [
26
+ sh:namespace "http://datashapes.org/dash#"^^xsd:anyURI ;
27
+ sh:prefix "dash" ;
28
+ ] ;
29
+ sh:declare [
30
+ sh:namespace "http://purl.org/dc/terms/"^^xsd:anyURI ;
31
+ sh:prefix "dcterms" ;
32
+ ] ;
33
+ sh:declare [
34
+ sh:namespace "http://www.w3.org/1999/02/22-rdf-syntax-ns#"^^xsd:anyURI ;
35
+ sh:prefix "rdf" ;
36
+ ] ;
37
+ sh:declare [
38
+ sh:namespace "http://www.w3.org/2000/01/rdf-schema#"^^xsd:anyURI ;
39
+ sh:prefix "rdfs" ;
40
+ ] ;
41
+ sh:declare [
42
+ sh:namespace "http://www.w3.org/2001/XMLSchema#"^^xsd:anyURI ;
43
+ sh:prefix "xsd" ;
44
+ ] ;
45
+ sh:declare [
46
+ sh:namespace "http://www.w3.org/2002/07/owl#"^^xsd:anyURI ;
47
+ sh:prefix "owl" ;
48
+ ] ;
49
+ sh:declare [
50
+ sh:namespace "http://www.w3.org/2004/02/skos/core#"^^xsd:anyURI ;
51
+ sh:prefix "skos" ;
52
+ ] ;
53
+ .
54
+
55
+ dash:StringOrLangString
56
+ a rdf:List ;
57
+ rdf:first [
58
+ sh:datatype xsd:string ;
59
+ ] ;
60
+ rdf:rest (
61
+ [
62
+ sh:datatype rdf:langString ;
63
+ ]
64
+ ) ;
65
+ rdfs:comment "An rdf:List that can be used in property constraints as value for sh:or to indicate that all values of a property must be either xsd:string or rdf:langString." ;
66
+ rdfs:label "String or langString" ;
67
+ .
68
+ `));
69
+ //# sourceMappingURL=dashDataset.js.map
package/package.json CHANGED
@@ -3,12 +3,19 @@
3
3
  "shaclmate": "cli.js"
4
4
  },
5
5
  "dependencies": {
6
- "@shaclmate/compiler": "2.0.12",
6
+ "@shaclmate/compiler": "2.0.14",
7
+ "@types/n3": "^1.21.1",
8
+ "@types/rdf-validate-shacl": "^0.4.7",
7
9
  "cmd-ts": "^0.13.0",
8
- "pino": "^9.1.0"
10
+ "n3": "^1.21.3",
11
+ "pino": "^9.1.0",
12
+ "rdf-validate-shacl": "^0.5.6"
9
13
  },
10
14
  "devDependencies": {},
11
- "files": ["*.d.ts", "*.js"],
15
+ "files": [
16
+ "*.d.ts",
17
+ "*.js"
18
+ ],
12
19
  "main": "index.js",
13
20
  "license": "Apache-2.0",
14
21
  "name": "@shaclmate/cli",
@@ -30,7 +37,8 @@
30
37
  "test:coverage": "biome check && vitest run --coverage",
31
38
  "test:watch": "vitest watch",
32
39
  "unlink": "npm unlink -g @shaclmate/cli",
33
- "watch": "tsc -w --preserveWatchOutput"
40
+ "watch": "tsc -w --preserveWatchOutput",
41
+ "watch:noEmit": "tsc --noEmit -w --preserveWatchOutput"
34
42
  },
35
43
  "repository": {
36
44
  "type": "git",
@@ -38,5 +46,5 @@
38
46
  },
39
47
  "type": "module",
40
48
  "types": "index.d.ts",
41
- "version": "2.0.12"
49
+ "version": "2.0.14"
42
50
  }
@@ -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