@lde/pipeline 0.29.2 → 0.30.1

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
@@ -218,6 +218,7 @@ Quads are buffered, validated, and then written or discarded based on the `onInv
218
218
 
219
219
  ```typescript
220
220
  import { ShaclValidator } from '@lde/pipeline-shacl-validator';
221
+ import { FileWriter } from '@lde/pipeline';
221
222
 
222
223
  new Stage({
223
224
  name: 'transform',
@@ -225,7 +226,9 @@ new Stage({
225
226
  validation: {
226
227
  validator: new ShaclValidator({
227
228
  shapesFile: './shapes.ttl',
228
- reportDir: './validation',
229
+ reportWriters: [
230
+ new FileWriter({ outputDir: './validation', format: 'turtle' }),
231
+ ],
229
232
  }),
230
233
  onInvalid: 'write', // 'write' (default) | 'skip' | 'halt'
231
234
  },
@@ -22,6 +22,17 @@ export interface SparqlWriterOptions {
22
22
  * @default 10000
23
23
  */
24
24
  batchSize?: number;
25
+ /**
26
+ * Derive the named-graph URI from the dataset being written. Defaults to
27
+ * `dataset.iri`, which puts each dataset's quads in a graph named after its
28
+ * own IRI. Override when the quads are an enrichment (e.g. a SHACL validation
29
+ * report) that should land in a different graph than the dataset's own data.
30
+ *
31
+ * The same instance's `clearedGraphs` lifecycle (CLEAR on first write per
32
+ * graph) follows the derived URI, so two writers with different `graphIri`
33
+ * functions can target the same endpoint without interfering.
34
+ */
35
+ graphIri?: (dataset: Dataset) => URL;
25
36
  }
26
37
  /**
27
38
  * Writes RDF data to a SPARQL endpoint using SPARQL UPDATE INSERT DATA queries.
@@ -35,6 +46,7 @@ export declare class SparqlUpdateWriter implements Writer {
35
46
  private readonly auth?;
36
47
  private readonly fetch;
37
48
  private readonly batchSize;
49
+ private readonly graphIri;
38
50
  private readonly clearedGraphs;
39
51
  constructor(options: SparqlWriterOptions);
40
52
  write(dataset: Dataset, quads: AsyncIterable<Quad>): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"sparqlUpdateWriter.d.ts","sourceRoot":"","sources":["../../src/writer/sparqlUpdateWriter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAiB,MAAM,cAAc,CAAC;AACtD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,QAAQ,EAAE,GAAG,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAChC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,qBAAa,kBAAmB,YAAW,MAAM;IAC/C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAM;IAC/B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA0B;IAChD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAqB;gBAEvC,OAAO,EAAE,mBAAmB;IAOlC,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;YAc1D,UAAU;YAIV,WAAW;YAOX,aAAa;CAuB5B"}
1
+ {"version":3,"file":"sparqlUpdateWriter.d.ts","sourceRoot":"","sources":["../../src/writer/sparqlUpdateWriter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAiB,MAAM,cAAc,CAAC;AACtD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,QAAQ,EAAE,GAAG,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAChC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,GAAG,CAAC;CACtC;AAED;;;;;;GAMG;AACH,qBAAa,kBAAmB,YAAW,MAAM;IAC/C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAM;IAC/B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA0B;IAChD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA4B;IACrD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAqB;gBAEvC,OAAO,EAAE,mBAAmB;IAQlC,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;YAc1D,UAAU;YAIV,WAAW;YAOX,aAAa;CAuB5B"}
@@ -13,15 +13,17 @@ export class SparqlUpdateWriter {
13
13
  auth;
14
14
  fetch;
15
15
  batchSize;
16
+ graphIri;
16
17
  clearedGraphs = new Set();
17
18
  constructor(options) {
18
19
  this.endpoint = options.endpoint;
19
20
  this.auth = options.auth;
20
21
  this.fetch = options.fetch ?? globalThis.fetch;
21
22
  this.batchSize = options.batchSize ?? 10000;
23
+ this.graphIri = options.graphIri ?? ((dataset) => dataset.iri);
22
24
  }
23
25
  async write(dataset, quads) {
24
- const graphUri = dataset.iri.toString();
26
+ const graphUri = this.graphIri(dataset).toString();
25
27
  assertSafeIri(graphUri);
26
28
  if (!this.clearedGraphs.has(graphUri)) {
27
29
  await this.clearGraph(graphUri);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lde/pipeline",
3
- "version": "0.29.2",
3
+ "version": "0.30.1",
4
4
  "repository": {
5
5
  "url": "git+https://github.com/ldelements/lde.git",
6
6
  "directory": "packages/pipeline"
@@ -25,7 +25,7 @@
25
25
  ],
26
26
  "dependencies": {
27
27
  "@lde/dataset": "0.7.4",
28
- "@lde/dataset-registry-client": "0.7.9",
28
+ "@lde/dataset-registry-client": "0.8.0",
29
29
  "@lde/distribution-probe": "0.1.3",
30
30
  "@lde/sparql-importer": "0.6.2",
31
31
  "@lde/sparql-server": "0.4.11",