@lde/pipeline-shacl-sampler 0.3.2 → 0.4.0
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/README.md +16 -13
- package/dist/sampleStages.d.ts +1 -1
- package/dist/sampleStages.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -19,12 +19,15 @@ validate without false-positive ‘missing nested node’ violations.
|
|
|
19
19
|
## Usage
|
|
20
20
|
|
|
21
21
|
```typescript
|
|
22
|
-
import { Pipeline } from '@lde/pipeline';
|
|
22
|
+
import { Pipeline, FileWriter } from '@lde/pipeline';
|
|
23
23
|
import { shaclSampleStages } from '@lde/pipeline-shacl-sampler';
|
|
24
24
|
import { ShaclValidator } from '@lde/pipeline-shacl-validator';
|
|
25
25
|
|
|
26
26
|
const shapesFile = 'https://docs.nde.nl/schema-profile/shacl.ttl';
|
|
27
|
-
const validator = new ShaclValidator({
|
|
27
|
+
const validator = new ShaclValidator({
|
|
28
|
+
shapesFile,
|
|
29
|
+
reportWriters: [new FileWriter({ outputDir: './validation', format: 'turtle' })],
|
|
30
|
+
});
|
|
28
31
|
|
|
29
32
|
const stages = await shaclSampleStages({
|
|
30
33
|
shapesFile,
|
|
@@ -37,16 +40,16 @@ await new Pipeline({ /* … */, stages }).run();
|
|
|
37
40
|
|
|
38
41
|
## Options
|
|
39
42
|
|
|
40
|
-
| Option
|
|
41
|
-
|
|
|
42
|
-
| `shapesFile`
|
|
43
|
-
| `samplesPerClass`
|
|
44
|
-
| `timeout`
|
|
45
|
-
| `batchSize`
|
|
46
|
-
| `maxConcurrency`
|
|
47
|
-
| `validator`
|
|
48
|
-
| `onInvalid`
|
|
49
|
-
| `namespaceAliases
|
|
43
|
+
| Option | Default | Description |
|
|
44
|
+
| ------------------ | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
45
|
+
| `shapesFile` | — | URL or local path to the SHACL shapes file. Any format `rdf-dereference` accepts. |
|
|
46
|
+
| `samplesPerClass` | `50` | Number of top-level resources to sample per `sh:targetClass`. |
|
|
47
|
+
| `timeout` | `60000` | SPARQL query timeout in milliseconds. |
|
|
48
|
+
| `batchSize` | `samplesPerClass` | Maximum sampled subjects per executor call. Lower values spread work across multiple parallel queries. |
|
|
49
|
+
| `maxConcurrency` | `10` | Maximum concurrent in-flight executor batches per stage. |
|
|
50
|
+
| `validator` | — | Optional [`Validator`](../pipeline/src/validator.ts) attached to every generated stage (typically a `ShaclValidator`). |
|
|
51
|
+
| `onInvalid` | `'write'` | Behaviour when a sampled batch fails validation: `'write'` \| `'skip'` \| `'halt'`. Only used when `validator` is set. |
|
|
52
|
+
| `namespaceAliases` | `[]` | Namespaces to treat as equivalent when matching `sh:targetClass` and when handing quads to the validator. See [Namespace aliases](#namespace-aliases). |
|
|
50
53
|
|
|
51
54
|
## Namespace aliases
|
|
52
55
|
|
|
@@ -60,7 +63,7 @@ report vacuously-conformant runs against datasets that mix the two.
|
|
|
60
63
|
`namespaceAliases` closes the gap. For every declared pair the sampler:
|
|
61
64
|
|
|
62
65
|
- broadens its subject-selection SELECT to `?s a ?type . FILTER(?type IN
|
|
63
|
-
|
|
66
|
+
(<canonical/X>, <alias/X>))`, so instances typed under either
|
|
64
67
|
namespace are picked up;
|
|
65
68
|
- decorates the configured `validator` so any alias-namespace IRI in
|
|
66
69
|
the sampled quads is rewritten to the canonical form before the SHACL
|
package/dist/sampleStages.d.ts
CHANGED
|
@@ -86,7 +86,7 @@ export interface ShaclSampleStagesOptions {
|
|
|
86
86
|
* Pass a {@link Validator} to attach it to every generated stage:
|
|
87
87
|
*
|
|
88
88
|
* ```ts
|
|
89
|
-
* const validator = new ShaclValidator({ shapesFile,
|
|
89
|
+
* const validator = new ShaclValidator({ shapesFile, reportWriters: [...] });
|
|
90
90
|
* const stages = await shaclSampleStages({ shapesFile, validator });
|
|
91
91
|
* ```
|
|
92
92
|
*/
|
package/dist/sampleStages.js
CHANGED
|
@@ -14,7 +14,7 @@ const { namedNode, quad } = DataFactory;
|
|
|
14
14
|
* Pass a {@link Validator} to attach it to every generated stage:
|
|
15
15
|
*
|
|
16
16
|
* ```ts
|
|
17
|
-
* const validator = new ShaclValidator({ shapesFile,
|
|
17
|
+
* const validator = new ShaclValidator({ shapesFile, reportWriters: [...] });
|
|
18
18
|
* const stages = await shaclSampleStages({ shapesFile, validator });
|
|
19
19
|
* ```
|
|
20
20
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lde/pipeline-shacl-sampler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Per-class sampling stages for @lde/pipeline, derived from SHACL shapes",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "git+https://github.com/ldelements/lde.git",
|
|
@@ -32,6 +32,6 @@
|
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@lde/dataset": "0.7.4",
|
|
35
|
-
"@lde/pipeline": "0.
|
|
35
|
+
"@lde/pipeline": "0.30.0"
|
|
36
36
|
}
|
|
37
37
|
}
|