@lde/pipeline 0.28.12 → 0.28.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/README.md CHANGED
@@ -74,7 +74,10 @@ Selects resources from the distribution and fans out executor calls per batch of
74
74
 
75
75
  ```typescript
76
76
  interface ItemSelector {
77
- select(distribution: Distribution, batchSize?: number): AsyncIterable<VariableBindings>;
77
+ select(
78
+ distribution: Distribution,
79
+ batchSize?: number,
80
+ ): AsyncIterable<VariableBindings>;
78
81
  }
79
82
  ```
80
83
 
@@ -218,6 +221,26 @@ new Stage({
218
221
 
219
222
  `Validator` is an interface, so you can implement your own validation strategy. See [@lde/pipeline-shacl-validator](../pipeline-shacl-validator) for the SHACL implementation.
220
223
 
224
+ #### Per-dataset reporting
225
+
226
+ After all stages for a dataset have run, the pipeline calls `validator.report(dataset)` once for each distinct validator attached to any stage and emits a `datasetValidated(dataset, report)` event on the reporter. The call happens **regardless of whether any stage actually invoked `validate()`** — useful for decorators that want to surface a verdict even when every stage’s `ItemSelector` returned zero items.
227
+
228
+ #### `requireNonEmptyData`
229
+
230
+ A small generic decorator over any `Validator`. Wraps the inner validator so its dataset report flips to non-conforming when `quadsValidated === 0` for that dataset — i.e. no stage ever produced data for the validator to inspect.
231
+
232
+ ```typescript
233
+ import { requireNonEmptyData } from '@lde/pipeline';
234
+ import { ShaclValidator } from '@lde/pipeline-shacl-validator';
235
+
236
+ const validator = requireNonEmptyData(
237
+ new ShaclValidator({ shapesFile: './shapes.ttl', reportDir: './validation' }),
238
+ { message: 'No target class matched in this dataset.' },
239
+ );
240
+ ```
241
+
242
+ The decorator is stateless; per-dataset accumulation stays in the inner validator.
243
+
221
244
  ### Writer
222
245
 
223
246
  Writes generated quads to a destination:
@@ -35,6 +35,8 @@ export declare class Pipeline {
35
35
  constructor(options: PipelineOptions);
36
36
  run(): Promise<void>;
37
37
  private processDataset;
38
+ private reportValidators;
39
+ private collectStages;
38
40
  /**
39
41
  * Run a stage with reporting and return whether it was supported.
40
42
  * Returns `true` if the stage produced results, `false` if NotSupported.
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../src/pipeline.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,4BAA4B,CAAC;AAQpC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAEV,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAE/B,wDAAwD;AACxD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,gBAAgB,CAAC,EAAE,aAAa,CAAC;CAClC;AAED,MAAM,WAAW,eAAe;IAC9B,eAAe,EAAE,eAAe,CAAC;IACjC,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,QAAQ,CAAC,EAAE;QACT,mBAAmB,EAAE,mBAAmB,CAAC;QACzC,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,QAAQ,CAAC,EAAE,gBAAgB,CAAC;CAC7B;AAgFD,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAkB;IAClD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;IACjC,O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,CAAC,EAAE;QACT,mBAAmB,EAAE,mBAAmB,CAAC;QACzC,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,QAAQ,CAAC,EAAE,gBAAgB,CAAC;CAC7B;AAgFD,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAkB;IAClD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAuB;IAC5D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAA8B;IACxD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAmB;gBAEjC,OAAO,EAAE,eAAe;IAgC9B,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;YAoBZ,cAAc;YAmEd,gBAAgB;IAW9B,OAAO,CAAE,aAAa;IAOtB;;;OAGG;YACW,QAAQ;IAwCtB,2EAA2E;YAC7D,eAAe;YAcf,QAAQ;YAmDP,SAAS;CAczB"}
package/dist/pipeline.js CHANGED
@@ -163,12 +163,31 @@ export class Pipeline {
163
163
  await this.distributionResolver.cleanup?.();
164
164
  }
165
165
  await this.writer.flush?.(dataset);
166
+ await this.reportValidators(dataset);
166
167
  const datasetMemory = process.memoryUsage();
167
168
  this.reporter?.datasetComplete?.(dataset, {
168
169
  memoryUsageBytes: datasetMemory.rss,
169
170
  heapUsedBytes: datasetMemory.heapUsed,
170
171
  });
171
172
  }
173
+ async reportValidators(dataset) {
174
+ const validators = new Set();
175
+ for (const stage of this.collectStages(this.stages)) {
176
+ if (stage.validator)
177
+ validators.add(stage.validator);
178
+ }
179
+ for (const validator of validators) {
180
+ const report = await validator.report(dataset);
181
+ this.reporter?.datasetValidated?.(dataset, report);
182
+ }
183
+ }
184
+ *collectStages(stages) {
185
+ for (const stage of stages) {
186
+ yield stage;
187
+ if (stage.stages.length > 0)
188
+ yield* this.collectStages(stage.stages);
189
+ }
190
+ }
172
191
  /**
173
192
  * Run a stage with reporting and return whether it was supported.
174
193
  * Returns `true` if the stage produced results, `false` if NotSupported.
@@ -200,10 +219,6 @@ export class Pipeline {
200
219
  quadsGenerated,
201
220
  duration: Date.now() - stageStart,
202
221
  });
203
- if (stage.validator) {
204
- const report = await stage.validator.report(dataset);
205
- this.reporter?.stageValidated?.(stage.name, report);
206
- }
207
222
  return true;
208
223
  }
209
224
  /** Run a stage in chained mode, throwing if the stage is not supported. */
@@ -32,9 +32,15 @@ export interface ProgressReporter {
32
32
  duration: number;
33
33
  }): void;
34
34
  stageFailed?(stage: string, error: Error): void;
35
- /** Called after a stage completes if it has a validator. */
36
- stageValidated?(stage: string, report: ValidationReport): void;
37
35
  stageSkipped?(stage: string, reason: string): void;
36
+ /**
37
+ * Called once per (dataset, validator) pair after all stages for a dataset
38
+ * have run. Fires regardless of whether any stage actually invoked
39
+ * `validate()` — the report reflects the validator’s accumulated state,
40
+ * which lets decorators such as `requireNonEmptyData` surface a verdict
41
+ * even when no stage produced data.
42
+ */
43
+ datasetValidated?(dataset: Dataset, report: ValidationReport): void;
38
44
  datasetComplete?(dataset: Dataset, result: {
39
45
  memoryUsageBytes: number;
40
46
  heapUsedBytes: number;
@@ -1 +1 @@
1
- {"version":3,"file":"progressReporter.d.ts","sourceRoot":"","sources":["../src/progressReporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,MAAM,WAAW,0BAA0B;IACzC,YAAY,EAAE,YAAY,CAAC;IAC3B,IAAI,EAAE,QAAQ,GAAG,WAAW,GAAG,eAAe,CAAC;IAC/C,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,C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1D,IAAI,CAAC;IACR,cAAc,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACxD,gBAAgB,CAAC,CAAC,MAAM,EAAE;QACxB,QAAQ,EAAE,MAAM,CAAC;QACjB,gBAAgB,EAAE,MAAM,CAAC;QACzB,aAAa,EAAE,MAAM,CAAC;KACvB,GAAG,IAAI,CAAC;CACV"}
@@ -18,4 +18,26 @@ export interface ValidationResult {
18
18
  export interface ValidationReport extends ValidationResult {
19
19
  quadsValidated: number;
20
20
  }
21
+ /** Options for {@link requireNonEmptyData}. */
22
+ export interface RequireNonEmptyDataOptions {
23
+ /**
24
+ * Message attached to the synthesised non-conformance.
25
+ * @default 'Validator received no quads for this dataset.'
26
+ */
27
+ message?: string;
28
+ }
29
+ /**
30
+ * Decorate a {@link Validator} so its dataset report flips to non-conforming
31
+ * when no quads were ever validated for that dataset.
32
+ *
33
+ * Useful when the upstream stages are expected to produce *some* data — for
34
+ * instance per-class samplers whose `ItemSelector` returns zero subjects for
35
+ * every target class. The decorator keeps the underlying validator’s
36
+ * semantics intact: it only synthesises an extra violation when
37
+ * {@link ValidationReport.quadsValidated} is `0`.
38
+ *
39
+ * The decorator is stateless; per-dataset accumulation stays in the
40
+ * underlying validator.
41
+ */
42
+ export declare function requireNonEmptyData(inner: Validator, options?: RequireNonEmptyDataOptions): Validator;
21
43
  //# sourceMappingURL=validator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,wDAAwD;AACxD,MAAM,WAAW,SAAS;IACxB,iEAAiE;IACjE,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,gBAAgB,C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AAE,0BAA0B,GACnC,SAAS,CAgBX"}
package/dist/validator.js CHANGED
@@ -1 +1,30 @@
1
- export {};
1
+ /**
2
+ * Decorate a {@link Validator} so its dataset report flips to non-conforming
3
+ * when no quads were ever validated for that dataset.
4
+ *
5
+ * Useful when the upstream stages are expected to produce *some* data — for
6
+ * instance per-class samplers whose `ItemSelector` returns zero subjects for
7
+ * every target class. The decorator keeps the underlying validator’s
8
+ * semantics intact: it only synthesises an extra violation when
9
+ * {@link ValidationReport.quadsValidated} is `0`.
10
+ *
11
+ * The decorator is stateless; per-dataset accumulation stays in the
12
+ * underlying validator.
13
+ */
14
+ export function requireNonEmptyData(inner, options) {
15
+ const message = options?.message ?? 'Validator received no quads for this dataset.';
16
+ return {
17
+ validate: (quads, dataset) => inner.validate(quads, dataset),
18
+ async report(dataset) {
19
+ const innerReport = await inner.report(dataset);
20
+ if (innerReport.quadsValidated > 0)
21
+ return innerReport;
22
+ return {
23
+ conforms: false,
24
+ violations: innerReport.violations + 1,
25
+ quadsValidated: 0,
26
+ message,
27
+ };
28
+ },
29
+ };
30
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lde/pipeline",
3
- "version": "0.28.12",
3
+ "version": "0.28.14",
4
4
  "repository": {
5
5
  "url": "git+https://github.com/ldelements/lde.git",
6
6
  "directory": "packages/pipeline"
@@ -25,14 +25,14 @@
25
25
  ],
26
26
  "dependencies": {
27
27
  "@lde/dataset": "0.7.3",
28
- "@lde/dataset-registry-client": "0.7.6",
28
+ "@lde/dataset-registry-client": "0.7.7",
29
29
  "@lde/distribution-probe": "0.1.2",
30
30
  "@lde/sparql-importer": "0.6.1",
31
31
  "@lde/sparql-server": "0.4.11",
32
32
  "@rdfjs/types": "^2.0.1",
33
- "@traqula/generator-sparql-1-1": "^1.0.7",
33
+ "@traqula/generator-sparql-1-1": "^1.1.1",
34
34
  "@traqula/parser-sparql-1-1": "^1.0.4",
35
- "@traqula/rules-sparql-1-1": "^1.0.4",
35
+ "@traqula/rules-sparql-1-1": "^1.1.0",
36
36
  "fetch-sparql-endpoint": "^7.1.0",
37
37
  "filenamify-url": "^4.0.0",
38
38
  "is-network-error": "^1.3.1",