@lde/pipeline-void 0.2.12 → 0.2.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.
@@ -23,7 +23,7 @@ export interface PerClassAnalyzerOptions {
23
23
  * This approach prevents timeouts and OOM errors on large datasets by splitting
24
24
  * the analysis into smaller queries per class.
25
25
  *
26
- * Supports template substitution:
26
+ * Supports legacy template substitution:
27
27
  * - `#subjectFilter#` — replaced with the dataset's subject filter (if any)
28
28
  * - `#namedGraph#` — replaced with `FROM <graph>` clause if the distribution has a named graph
29
29
  * - `?dataset` — replaced with the dataset IRI
@@ -32,7 +32,7 @@ export interface PerClassAnalyzerOptions {
32
32
  export declare class PerClassAnalyzer extends BaseAnalyzer {
33
33
  readonly name: string;
34
34
  private readonly fetcher;
35
- private readonly executor;
35
+ private readonly query;
36
36
  private readonly maxClasses;
37
37
  constructor(name: string, query: string, options?: PerClassAnalyzerOptions);
38
38
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"perClassAnalyzer.d.ts","sourceRoot":"","sources":["../src/perClassAnalyzer.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,iBAAiB,EACvB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAG9D,OAAO,EACL,YAAY,EACZ,OAAO,EACP,OAAO,EACP,YAAY,EACb,MAAM,wBAAwB,CAAC;AAIhC,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,OAAO,CAAC,EAAE,qBAAqB,CAAC;IAChC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,gBAAiB,SAAQ,YAAY;aAM9B,IAAI,EAAE,MAAM;IAL9B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwB;IAChD,OAAO,CAAC,QAAQ,CAAC,QA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AC,OAAO,CAAwB;IAChD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;gBAGlB,IAAI,EAAE,MAAM,EAC5B,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,uBAAuB;IAYnC;;;;;OAKG;WACiB,QAAQ,CAC1B,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,uBAAuB,GAChC,OAAO,CAAC,gBAAgB,CAAC;IAKf,OAAO,CAClB,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,OAAO,GAAG,OAAO,GAAG,YAAY,CAAC;YAyC9B,UAAU;CAkCzB;AAED,wBAAgB,sBAAsB,CACpC,OAAO,CAAC,EAAE,uBAAuB,GAChC,OAAO,CAAC,gBAAgB,CAAC,CAE3B;AAED,wBAAgB,sBAAsB,CACpC,OAAO,CAAC,EAAE,uBAAuB,GAChC,OAAO,CAAC,gBAAgB,CAAC,CAE3B;AAED,wBAAgB,yBAAyB,CACvC,OAAO,CAAC,EAAE,uBAAuB,GAChC,OAAO,CAAC,gBAAgB,CAAC,CAE3B"}
@@ -11,7 +11,7 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
11
11
  * This approach prevents timeouts and OOM errors on large datasets by splitting
12
12
  * the analysis into smaller queries per class.
13
13
  *
14
- * Supports template substitution:
14
+ * Supports legacy template substitution:
15
15
  * - `#subjectFilter#` — replaced with the dataset's subject filter (if any)
16
16
  * - `#namedGraph#` — replaced with `FROM <graph>` clause if the distribution has a named graph
17
17
  * - `?dataset` — replaced with the dataset IRI
@@ -20,22 +20,18 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
20
20
  export class PerClassAnalyzer extends BaseAnalyzer {
21
21
  name;
22
22
  fetcher;
23
- executor;
23
+ query;
24
24
  maxClasses;
25
25
  constructor(name, query, options) {
26
26
  super();
27
27
  this.name = name;
28
+ this.query = query;
28
29
  this.fetcher =
29
30
  options?.fetcher ??
30
31
  new SparqlEndpointFetcher({
31
32
  timeout: options?.timeout ?? 300_000,
32
33
  });
33
34
  this.maxClasses = options?.maxClasses ?? 1000;
34
- this.executor = new SparqlConstructExecutor({
35
- query,
36
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
37
- fetcher: this.fetcher,
38
- });
39
35
  }
40
36
  /**
41
37
  * Create an analyzer from a query file in the queries directory.
@@ -56,11 +52,15 @@ export class PerClassAnalyzer extends BaseAnalyzer {
56
52
  try {
57
53
  // Phase 1: Get all classes.
58
54
  const classes = await this.getClasses(sparqlDistribution, dataset);
59
- // Phase 2: Run query for each class via SparqlConstructExecutor.
55
+ // Phase 2: Run query for each class.
60
56
  for (const classIri of classes) {
61
- const result = await this.executor.execute(dataset, {
62
- bindings: { '<#class#>': `<${classIri}>` },
57
+ const substituted = substituteQueryTemplates(this.query.replaceAll('<#class#>', `<${classIri}>`), sparqlDistribution, dataset);
58
+ const executor = new SparqlConstructExecutor({
59
+ query: substituted,
60
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
61
+ fetcher: this.fetcher,
63
62
  });
63
+ const result = await executor.execute(dataset);
64
64
  if (result instanceof NotSupported) {
65
65
  return result;
66
66
  }
@@ -15,7 +15,7 @@ export interface SparqlQueryAnalyzerOptions {
15
15
  /**
16
16
  * Analyzer that executes a SPARQL CONSTRUCT query against a dataset's SPARQL endpoint.
17
17
  *
18
- * Supports template substitution:
18
+ * Supports legacy template substitution:
19
19
  * - `#subjectFilter#` — replaced with the dataset's subject filter (if any)
20
20
  * - `#namedGraph#` — replaced with `FROM <graph>` clause if the distribution has a named graph
21
21
  * - `?dataset` — replaced with the dataset IRI
@@ -24,7 +24,8 @@ export interface SparqlQueryAnalyzerOptions {
24
24
  */
25
25
  export declare class SparqlQueryAnalyzer extends BaseAnalyzer {
26
26
  readonly name: string;
27
- private readonly executor;
27
+ private readonly query;
28
+ private readonly fetcher;
28
29
  constructor(name: string, query: string, options?: SparqlQueryAnalyzerOptions);
29
30
  /**
30
31
  * Create an analyzer from a query file in the queries directory.
@@ -1 +1 @@
1
- {"version":3,"file":"sparqlQueryAnalyzer.d.ts","sourceRoot":"","sources":["../src/sparqlQueryAnalyzer.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAG9D,OAAO,EACL,YAAY,EACZ,OAAO,EACP,OAAO,EACP,YAAY,EACb,MAAM,wBAAwB,CAAC;AAIhC,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,OAAO,CAAC,EAAE,qBAAqB,CAAC;CACjC;AAED;;;;;;;;;GASG;AACH,qBAAa,mBAAoB,SAAQ,YAAY;aAIjC,IAAI,EAAE,MAAM;IAH9B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA0B;gBAGjC,IAAI,EAAE,MAAM,EAC5B,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,0BAA0B;IAiBtC;;;;;OAKG;WACiB,QAAQ,CAC1B,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,0BAA0B,GACnC,OAAO,CAAC,mBAAmB,CAAC;IAKlB,OAAO,CAClB,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,OAAO,GAAG,OAAO,GAAG,YAAY,CAAC;CAqB7C"}
1
+ {"version":3,"file":"sparqlQueryAnalyzer.d.ts","sourceRoot":"","sources":["../src/sparqlQueryAnalyzer.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,iBAAiB,EACvB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAG9D,OAAO,EACL,YAAY,EACZ,OAAO,EACP,OAAO,EACP,YAAY,EACb,MAAM,wBAAwB,CAAC;AAIhC,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,OAAO,CAAC,EAAE,qBAAqB,CAAC;CACjC;AAED;;;;;;;;;GASG;AACH,qBAAa,mBAAoB,SAAQ,YAAY;aAKjC,IAAI,EAAE,MAAM;IAJ9B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwB;gBAG9B,IAAI,EAAE,MAAM,EAC5B,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,0BAA0B;IAWtC;;;;;OAKG;WACiB,QAAQ,CAC1B,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,0BAA0B,GACnC,OAAO,CAAC,mBAAmB,CAAC;IAKlB,OAAO,CAClB,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,OAAO,GAAG,OAAO,GAAG,YAAY,CAAC;CA+B7C"}
@@ -1,4 +1,4 @@
1
- import { SparqlConstructExecutor, collect, readQueryFile, } from '@lde/pipeline';
1
+ import { SparqlConstructExecutor, substituteQueryTemplates, collect, readQueryFile, } from '@lde/pipeline';
2
2
  import { SparqlEndpointFetcher } from 'fetch-sparql-endpoint';
3
3
  import { resolve, dirname } from 'node:path';
4
4
  import { fileURLToPath } from 'node:url';
@@ -7,7 +7,7 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
7
7
  /**
8
8
  * Analyzer that executes a SPARQL CONSTRUCT query against a dataset's SPARQL endpoint.
9
9
  *
10
- * Supports template substitution:
10
+ * Supports legacy template substitution:
11
11
  * - `#subjectFilter#` — replaced with the dataset's subject filter (if any)
12
12
  * - `#namedGraph#` — replaced with `FROM <graph>` clause if the distribution has a named graph
13
13
  * - `?dataset` — replaced with the dataset IRI
@@ -16,19 +16,17 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
16
16
  */
17
17
  export class SparqlQueryAnalyzer extends BaseAnalyzer {
18
18
  name;
19
- executor;
19
+ query;
20
+ fetcher;
20
21
  constructor(name, query, options) {
21
22
  super();
22
23
  this.name = name;
23
- const fetcher = options?.fetcher ??
24
- new SparqlEndpointFetcher({
25
- timeout: options?.timeout ?? 300_000,
26
- });
27
- this.executor = new SparqlConstructExecutor({
28
- query,
29
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
- fetcher: fetcher, // Types differ between package instances
31
- });
24
+ this.query = query;
25
+ this.fetcher =
26
+ options?.fetcher ??
27
+ new SparqlEndpointFetcher({
28
+ timeout: options?.timeout ?? 300_000,
29
+ });
32
30
  }
33
31
  /**
34
32
  * Create an analyzer from a query file in the queries directory.
@@ -46,7 +44,13 @@ export class SparqlQueryAnalyzer extends BaseAnalyzer {
46
44
  return new NotSupported('No SPARQL distribution available');
47
45
  }
48
46
  try {
49
- const result = await this.executor.execute(dataset);
47
+ const substituted = substituteQueryTemplates(this.query, sparqlDistribution, dataset);
48
+ const executor = new SparqlConstructExecutor({
49
+ query: substituted,
50
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
51
+ fetcher: this.fetcher,
52
+ });
53
+ const result = await executor.execute(dataset);
50
54
  if (result instanceof NotSupported) {
51
55
  return result;
52
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lde/pipeline-void",
3
- "version": "0.2.12",
3
+ "version": "0.2.14",
4
4
  "description": "VOiD (Vocabulary of Interlinked Datasets) statistical analysis for RDF datasets",
5
5
  "repository": {
6
6
  "url": "https://github.com/ldengine/lde",
@@ -24,8 +24,8 @@
24
24
  "!**/*.tsbuildinfo"
25
25
  ],
26
26
  "dependencies": {
27
- "@lde/dataset": "0.6.6",
28
- "@lde/pipeline": "0.6.12",
27
+ "@lde/dataset": "0.6.8",
28
+ "@lde/pipeline": "0.6.14",
29
29
  "@rdfjs/types": "^2.0.1",
30
30
  "fetch-sparql-endpoint": "^6.0.0",
31
31
  "n3": "^1.17.0",