@lde/pipeline 0.7.1 → 0.8.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.
@@ -3,7 +3,7 @@ import type { SparqlServer } from '@lde/sparql-server';
3
3
  import { type DistributionResolver, NoDistributionAvailable, ResolvedDistribution } from './resolver.js';
4
4
  export interface ImportResolverOptions {
5
5
  importer: Importer;
6
- server?: SparqlServer;
6
+ server: SparqlServer;
7
7
  }
8
8
  /**
9
9
  * A {@link DistributionResolver} decorator that adds import-as-fallback logic.
@@ -1 +1 @@
1
- {"version":3,"file":"importResolver.d.ts","sourceRoot":"","sources":["../../src/distribution/importResolver.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EACL,KAAK,oBAAoB,EACzB,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED;;;;;;GAMG;AACH,qBAAa,cAAe,YAAW,oBAAoB;IAEvD,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBADP,KAAK,EAAE,oBAAoB,EAC3B,OAAO,EAAE,qBAAqB;IAG3C,OAAO,CACX,GAAG,IAAI,EAAE,UAAU,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC,GACnD,OAAO,CAAC,oBAAoB,GAAG,uBAAuB,CAAC;IAoCpD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAG/B"}
1
+ {"version":3,"file":"importResolver.d.ts","sourceRoot":"","sources":["../../src/distribution/importResolver.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EACL,KAAK,oBAAoB,EACzB,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,YAAY,CAAC;CACtB;AAED;;;;;;GAMG;AACH,qBAAa,cAAe,YAAW,oBAAoB;IAEvD,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBADP,KAAK,EAAE,oBAAoB,EAC3B,OAAO,EAAE,qBAAqB;IAG3C,OAAO,CACX,GAAG,IAAI,EAAE,UAAU,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC,GACnD,OAAO,CAAC,oBAAoB,GAAG,uBAAuB,CAAC;IA2BpD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAG/B"}
@@ -22,15 +22,14 @@ export class ImportResolver {
22
22
  const [dataset] = args;
23
23
  const importResult = await this.options.importer.import(dataset);
24
24
  if (importResult instanceof ImportSuccessful) {
25
- if (this.options.server) {
26
- await this.options.server.start();
27
- return new ResolvedDistribution(Distribution.sparql(this.options.server.queryEndpoint, importResult.identifier), result.probeResults);
28
- }
29
- return new ResolvedDistribution(Distribution.sparql(importResult.distribution.accessUrl, importResult.identifier), result.probeResults);
25
+ await this.options.server.start();
26
+ const distribution = Distribution.sparql(this.options.server.queryEndpoint, importResult.identifier);
27
+ distribution.subjectFilter = importResult.distribution.subjectFilter;
28
+ return new ResolvedDistribution(distribution, result.probeResults);
30
29
  }
31
30
  return new NoDistributionAvailable(dataset, 'No SPARQL endpoint or importable data dump available', result.probeResults, importResult instanceof ImportFailed ? importResult : undefined);
32
31
  }
33
32
  async cleanup() {
34
- await this.options.server?.stop();
33
+ await this.options.server.stop();
35
34
  }
36
35
  }
@@ -8,7 +8,7 @@ export interface FileWriterOptions {
8
8
  outputDir: string;
9
9
  /**
10
10
  * File format to write.
11
- * @default 'turtle'
11
+ * @default 'n-triples'
12
12
  */
13
13
  format?: 'turtle' | 'n-triples' | 'n-quads';
14
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"fileWriter.d.ts","sourceRoot":"","sources":["../../src/writer/fileWriter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAMzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAC;CAC7C;AAsBD,qBAAa,UAAW,YAAW,MAAM;IACvC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAC;IACpD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAqB;gBAEtC,OAAO,EAAE,iBAAiB;IAKhC,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IA4BxE,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM;IAIvC,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM;IAQrC,OAAO,CAAC,YAAY;CAUrB"}
1
+ {"version":3,"file":"fileWriter.d.ts","sourceRoot":"","sources":["../../src/writer/fileWriter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAMzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAC;CAC7C;AAqBD,qBAAa,UAAW,YAAW,MAAM;IACvC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAC;IACpD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAqB;gBAEtC,OAAO,EAAE,iBAAiB;IAKhC,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IA4BxE,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM;IAIvC,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM;IAQrC,OAAO,CAAC,YAAY;CAUrB"}
@@ -12,10 +12,9 @@ import { Writer as N3Writer } from 'n3';
12
12
  * Subsequent calls for the same dataset append to it, so that multiple pipeline stages
13
13
  * can each contribute quads to a single output file.
14
14
  *
15
- * **Note:** With `format: 'turtle'` (the default) each append will repeat the prefix
16
- * declarations at the start of each chunk. For multi-stage pipelines, prefer
17
- * `format: 'n-triples'` or `format: 'n-quads'`, which produce clean line-oriented
18
- * output without repeated headers.
15
+ * **Note:** With `format: 'turtle'` each append will repeat the prefix declarations
16
+ * at the start of each chunk. The default `format: 'n-triples'` produces clean
17
+ * line-oriented output without repeated headers.
19
18
  */
20
19
  const formatMap = {
21
20
  turtle: 'Turtle',
@@ -28,7 +27,7 @@ export class FileWriter {
28
27
  writtenFiles = new Set();
29
28
  constructor(options) {
30
29
  this.outputDir = options.outputDir;
31
- this.format = options.format ?? 'turtle';
30
+ this.format = options.format ?? 'n-triples';
32
31
  }
33
32
  async write(dataset, quads) {
34
33
  // Peek at the first quad to avoid creating empty files.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lde/pipeline",
3
- "version": "0.7.1",
3
+ "version": "0.8.1",
4
4
  "repository": {
5
5
  "url": "https://github.com/ldengine/lde",
6
6
  "directory": "packages/pipeline"