@lde/sparql-qlever 0.10.1 → 0.10.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.
- package/dist/importer.d.ts +2 -2
- package/dist/importer.d.ts.map +1 -1
- package/dist/importer.js +8 -4
- package/package.json +2 -2
package/dist/importer.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Importer as ImporterInterface, ImportFailed, ImportSuccessful, NotSupported } from '@lde/sparql-importer';
|
|
2
|
-
import {
|
|
2
|
+
import { Distribution } from '@lde/dataset';
|
|
3
3
|
import { Downloader } from '@lde/distribution-downloader';
|
|
4
4
|
import { TaskRunner } from '@lde/task-runner';
|
|
5
5
|
export interface Options {
|
|
@@ -26,7 +26,7 @@ export declare class Importer implements ImporterInterface {
|
|
|
26
26
|
private qleverOptions;
|
|
27
27
|
private cacheIndex;
|
|
28
28
|
constructor({ taskRunner, downloader, indexName, qleverOptions, cacheIndex, }: Options);
|
|
29
|
-
import(
|
|
29
|
+
import(distributions: Distribution[]): Promise<NotSupported | ImportSuccessful | ImportFailed>;
|
|
30
30
|
private doImport;
|
|
31
31
|
private fileFormatFromMimeType;
|
|
32
32
|
private parseTripleCount;
|
package/dist/importer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"importer.d.ts","sourceRoot":"","sources":["../src/importer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,IAAI,iBAAiB,EAC7B,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"importer.d.ts","sourceRoot":"","sources":["../src/importer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,IAAI,iBAAiB,EAC7B,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EACL,UAAU,EAEX,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAU9C,MAAM,WAAW,OAAO;IACtB,UAAU,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,aAAa,CAAC,EAAE;QACd,qBAAqB,EAAE,OAAO,CAAC;QAC/B,uBAAuB,EAAE,MAAM,CAAC;KACjC,CAAC;IACF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mGAAmG;IACnG,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAMD;;;;GAIG;AACH,qBAAa,QAAS,YAAW,iBAAiB;IAChD,OAAO,CAAC,SAAS,CAAC;IAClB,OAAO,CAAC,UAAU,CAAsB;IACxC,OAAO,CAAC,UAAU,CAAC;IACnB,OAAO,CAAC,aAAa,CAAC;IACtB,OAAO,CAAC,UAAU,CAAC;gBAEP,EACV,UAAU,EACV,UAAU,EACV,SAAS,EACT,aAAa,EACb,UAAU,GACX,EAAE,OAAO;IAWG,MAAM,CACjB,aAAa,EAAE,YAAY,EAAE,GAC5B,OAAO,CAAC,YAAY,GAAG,gBAAgB,GAAG,YAAY,CAAC;YA+B5C,QAAQ;IAkCtB,OAAO,CAAC,sBAAsB;IAQ9B,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,aAAa;IAIrB;;OAEG;YACW,eAAe;IA0B7B,yDAAyD;YAC3C,eAAe;YAaf,cAAc;YAKd,KAAK;CAmBpB"}
|
package/dist/importer.js
CHANGED
|
@@ -28,10 +28,8 @@ export class Importer {
|
|
|
28
28
|
};
|
|
29
29
|
this.cacheIndex = cacheIndex ?? true;
|
|
30
30
|
}
|
|
31
|
-
async import(
|
|
32
|
-
const downloadDistributions =
|
|
33
|
-
.getDownloadDistributions()
|
|
34
|
-
.filter((distribution) => distribution.mimeType !== undefined &&
|
|
31
|
+
async import(distributions) {
|
|
32
|
+
const downloadDistributions = distributions.filter((distribution) => distribution.mimeType !== undefined &&
|
|
35
33
|
supportedFormats.has(distribution.mimeType));
|
|
36
34
|
if (downloadDistributions.length === 0) {
|
|
37
35
|
return new NotSupported();
|
|
@@ -61,10 +59,16 @@ export class Importer {
|
|
|
61
59
|
const localFile = await this.downloader.download(distribution);
|
|
62
60
|
if (await this.isIndexUpToDate(localFile)) {
|
|
63
61
|
const tripleCount = await this.readTripleCount(localFile);
|
|
62
|
+
if (tripleCount === 0) {
|
|
63
|
+
return new ImportFailed(distribution, 'Index is cached but contains 0 triples');
|
|
64
|
+
}
|
|
64
65
|
return new ImportSuccessful(distribution, undefined, tripleCount);
|
|
65
66
|
}
|
|
66
67
|
const logs = await this.index(localFile, this.fileFormatFromMimeType(distribution.mimeType));
|
|
67
68
|
const tripleCount = this.parseTripleCount(logs);
|
|
69
|
+
if (tripleCount === 0) {
|
|
70
|
+
return new ImportFailed(distribution, 'Indexed 0 triples from distribution');
|
|
71
|
+
}
|
|
68
72
|
await this.writeCacheInfo(localFile);
|
|
69
73
|
return new ImportSuccessful(distribution, undefined, tripleCount);
|
|
70
74
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lde/sparql-qlever",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "git+https://github.com/ldelements/lde.git",
|
|
6
6
|
"directory": "packages/sparql-qlever"
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@lde/dataset": "0.7.2",
|
|
27
27
|
"@lde/distribution-downloader": "0.5.3",
|
|
28
|
-
"@lde/sparql-importer": "0.4.
|
|
28
|
+
"@lde/sparql-importer": "0.4.2",
|
|
29
29
|
"@lde/sparql-server": "0.4.10",
|
|
30
30
|
"@lde/task-runner": "0.2.10",
|
|
31
31
|
"@lde/task-runner-docker": "0.2.11",
|