@lde/pipeline 0.6.21 → 0.6.23

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
@@ -10,13 +10,37 @@ Framework for building RDF data processing pipelines with SPARQL.
10
10
  - **SparqlConstructExecutor** — streaming SPARQL CONSTRUCT with template substitution and variable bindings
11
11
  - **Distribution analysis** — probe and analyze dataset distributions
12
12
 
13
- ## Subpath exports
13
+ ## Components
14
14
 
15
- | Export | Description |
16
- | ------------------------ | ------------------------------------------------------------- |
17
- | `@lde/pipeline` | Steps, pipeline, builder, config, SPARQL |
18
- | `@lde/pipeline/analyzer` | Analyzer contracts (`Analyzer`, `BaseAnalyzer`, result types) |
19
- | `@lde/pipeline/writer` | Write RDF data to files or SPARQL endpoints |
15
+ A **Pipeline** consists of:
16
+
17
+ - one **[Dataset Selector](#dataset-selector)**
18
+ - one **[Distribution Resolver](#distribution-resolver)** that resolves the input dataset to a usable SPARQL distribution
19
+ - one or more **Stages**, each consisting of:
20
+ - an optional **Selector** that filters resources
21
+ - one or more **Executors** that generate triples for each selected resource
22
+
23
+ ### Dataset Selector
24
+
25
+ Selects datasets, either manually by the user or dynamically by querying a DCAT Dataset Registry.
26
+
27
+ ### Distribution Resolver
28
+
29
+ Resolves each selected dataset to a usable distribution.
30
+
31
+ #### SPARQL Distribution Resolver
32
+
33
+ If a working SPARQL endpoint is already available for the dataset, that is used.
34
+ If not, and a valid RDF datadump is available, that is imported to a local SPARQL server.
35
+
36
+ #### Other Distribution Resolvers
37
+
38
+ ### Bindings Selector
39
+
40
+ Selects resources from the dataset and to fan out queries per result in the executor.
41
+ Bindings are free, and replaced with `VALUES { ... }`.
42
+
43
+ ### Executor
20
44
 
21
45
  ## Usage
22
46
 
package/dist/builder.d.ts CHANGED
@@ -30,6 +30,11 @@ export interface WriterConfig {
30
30
  type: 'file' | 'sparql';
31
31
  outputDir?: string;
32
32
  endpoint?: URL;
33
+ /**
34
+ * Value for the Authorization header sent with SPARQL UPDATE requests, e.g.
35
+ * `"Basic dXNlcjpwYXNz"`, `"Bearer my-token"`, or `"GDB eyJ…"`.
36
+ */
37
+ auth?: string;
33
38
  }
34
39
  /**
35
40
  * Complete pipeline configuration.
@@ -110,5 +115,6 @@ export declare function fileWriter(options: {
110
115
  */
111
116
  export declare function sparqlWriter(options: {
112
117
  endpoint: URL;
118
+ auth?: string;
113
119
  }): WriterConfig;
114
120
  //# sourceMappingURL=builder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../src/builder.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EACR,sBAAsB,EACtB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC1B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,CAAW;IAC5B,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,OA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sB,CAKpE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,YAAY,CAKvE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE;IACpC,QAAQ,EAAE,GAAG,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,YAAY,CAMf"}
package/dist/builder.js CHANGED
@@ -111,5 +111,6 @@ export function sparqlWriter(options) {
111
111
  return {
112
112
  type: 'sparql',
113
113
  endpoint: options.endpoint,
114
+ auth: options.auth,
114
115
  };
115
116
  }
package/dist/config.d.ts CHANGED
@@ -17,6 +17,7 @@ export interface RawPipelineConfig {
17
17
  type: 'file' | 'sparql';
18
18
  outputDir?: string;
19
19
  endpoint?: string;
20
+ auth?: string;
20
21
  }>;
21
22
  }
22
23
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,YAAY,EAIb,MAAM,cAAc,CAAC;AAKtB;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE;QACT,IAAI,EAAE,UAAU,GAAG,QAAQ,CAAC;QAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;KACrB,CAAC;IACF,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC;QACZ,IAAI,EAAE,cAAc,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC,CAAC;IACH,OAAO,CAAC,EAAE,KAAK,CAAC;QACd,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;QACxB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,WAAW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;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,iBAAiB,GAAG,iBAAiB,CAEzE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,cAAc,CAAC,CAWzB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,iBAAiB,GAAG,cAAc,CAOtE"}
package/dist/config.js CHANGED
@@ -102,7 +102,11 @@ function normalizeWriters(raw) {
102
102
  if (!writer.endpoint) {
103
103
  throw new Error('SPARQL writer requires endpoint');
104
104
  }
105
- return { type: 'sparql', endpoint: new URL(writer.endpoint) };
105
+ return {
106
+ type: 'sparql',
107
+ endpoint: new URL(writer.endpoint),
108
+ auth: writer.auth,
109
+ };
106
110
  default:
107
111
  throw new Error(`Unknown writer type: ${writer.type}`);
108
112
  }
package/dist/index.d.ts CHANGED
@@ -8,4 +8,5 @@ export * from './builder.js';
8
8
  export * from './config.js';
9
9
  export * from './sparql/index.js';
10
10
  export * from './distribution/index.js';
11
+ export * from './writer/index.js';
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -8,4 +8,4 @@ export * from './builder.js';
8
8
  export * from './config.js';
9
9
  export * from './sparql/index.js';
10
10
  export * from './distribution/index.js';
11
- // first test
11
+ export * from './writer/index.js';
@@ -6,6 +6,11 @@ export interface SparqlWriterOptions {
6
6
  * The SPARQL UPDATE endpoint URL.
7
7
  */
8
8
  endpoint: URL;
9
+ /**
10
+ * Value for the Authorization header, e.g.
11
+ * `"Basic dXNlcjpwYXNz"`, `"Bearer my-token"`, or `"GDB eyJ…"`.
12
+ */
13
+ auth?: string;
9
14
  /**
10
15
  * Optional fetch implementation for making HTTP requests.
11
16
  * @default globalThis.fetch
@@ -26,6 +31,7 @@ export interface SparqlWriterOptions {
26
31
  */
27
32
  export declare class SparqlUpdateWriter implements Writer {
28
33
  private readonly endpoint;
34
+ private readonly auth?;
29
35
  private readonly fetch;
30
36
  private readonly batchSize;
31
37
  constructor(options: SparqlWriterOptions);
@@ -1 +1 @@
1
- {"version":3,"file":"sparqlUpdateWriter.d.ts","sourceRoot":"","sources":["../../src/writer/sparqlUpdateWriter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,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,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAChC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,qBAAa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,aAAa;CAqB5B"}
@@ -8,10 +8,12 @@ import { serializeQuads } from './serialize.js';
8
8
  */
9
9
  export class SparqlUpdateWriter {
10
10
  endpoint;
11
+ auth;
11
12
  fetch;
12
13
  batchSize;
13
14
  constructor(options) {
14
15
  this.endpoint = options.endpoint;
16
+ this.auth = options.auth;
15
17
  this.fetch = options.fetch ?? globalThis.fetch;
16
18
  this.batchSize = options.batchSize ?? 10000;
17
19
  }
@@ -30,11 +32,15 @@ export class SparqlUpdateWriter {
30
32
  await this.executeUpdate(`INSERT DATA { GRAPH <${graphUri}> { ${turtleData} } }`);
31
33
  }
32
34
  async executeUpdate(query) {
35
+ const headers = {
36
+ 'Content-Type': 'application/sparql-update',
37
+ };
38
+ if (this.auth) {
39
+ headers['Authorization'] = this.auth;
40
+ }
33
41
  const response = await this.fetch(this.endpoint.toString(), {
34
42
  method: 'POST',
35
- headers: {
36
- 'Content-Type': 'application/sparql-update',
37
- },
43
+ headers,
38
44
  body: query,
39
45
  });
40
46
  if (!response.ok) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lde/pipeline",
3
- "version": "0.6.21",
3
+ "version": "0.6.23",
4
4
  "repository": {
5
5
  "url": "https://github.com/ldengine/lde",
6
6
  "directory": "packages/pipeline"
@@ -13,18 +13,6 @@
13
13
  "import": "./dist/index.js",
14
14
  "development": "./src/index.ts",
15
15
  "default": "./dist/index.js"
16
- },
17
- "./writer": {
18
- "types": "./dist/writer/index.d.ts",
19
- "import": "./dist/writer/index.js",
20
- "development": "./src/writer/index.ts",
21
- "default": "./dist/writer/index.js"
22
- },
23
- "./analyzer": {
24
- "types": "./dist/analyzer.d.ts",
25
- "import": "./dist/analyzer.js",
26
- "development": "./src/analyzer.ts",
27
- "default": "./dist/analyzer.js"
28
16
  }
29
17
  },
30
18
  "main": "./dist/index.js",