@lde/pipeline 0.30.0 → 0.30.2
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.
|
@@ -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,MA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AAI,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.
|
|
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.30.
|
|
3
|
+
"version": "0.30.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "git+https://github.com/ldelements/lde.git",
|
|
6
6
|
"directory": "packages/pipeline"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@lde/dataset": "0.7.4",
|
|
28
28
|
"@lde/dataset-registry-client": "0.8.0",
|
|
29
|
-
"@lde/distribution-probe": "0.1.
|
|
29
|
+
"@lde/distribution-probe": "0.1.4",
|
|
30
30
|
"@lde/sparql-importer": "0.6.2",
|
|
31
31
|
"@lde/sparql-server": "0.4.11",
|
|
32
32
|
"@rdfjs/types": "^2.0.1",
|