@lde/sparql-qlever 0.8.5 → 0.8.6
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.map +1 -1
- package/dist/importer.js +11 -10
- package/package.json +1 -1
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,OAAO,EAAgB,MAAM,cAAc,CAAC;AACrD,OAAO,EACL,UAAU,EAEX,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
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,OAAO,EAAgB,MAAM,cAAc,CAAC;AACrD,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;CACf;AAED;;;;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;gBAEV,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,EAAE,OAAO;IAU5D,MAAM,CACjB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,YAAY,GAAG,gBAAgB,GAAG,YAAY,CAAC;YAiC5C,QAAQ;IAYtB,OAAO,CAAC,sBAAsB;YAQhB,KAAK;CAsBpB"}
|
package/dist/importer.js
CHANGED
|
@@ -2,6 +2,11 @@ import { ImportFailed, ImportSuccessful, NotSupported, } from '@lde/sparql-impor
|
|
|
2
2
|
import { LastModifiedDownloader, } from '@lde/distribution-downloader';
|
|
3
3
|
import { basename, dirname } from 'path';
|
|
4
4
|
import { writeFile } from 'node:fs/promises';
|
|
5
|
+
const supportedFormats = new Map([
|
|
6
|
+
['application/n-triples', 'nt'],
|
|
7
|
+
['application/n-quads', 'nq'],
|
|
8
|
+
['text/turtle', 'ttl'],
|
|
9
|
+
]);
|
|
5
10
|
/**
|
|
6
11
|
* Import RDF to a QLever SPARQL server.
|
|
7
12
|
*
|
|
@@ -24,7 +29,8 @@ export class Importer {
|
|
|
24
29
|
async import(dataset) {
|
|
25
30
|
const downloadDistributions = dataset
|
|
26
31
|
.getDownloadDistributions()
|
|
27
|
-
.filter((distribution) => distribution.mimeType !== undefined
|
|
32
|
+
.filter((distribution) => distribution.mimeType !== undefined &&
|
|
33
|
+
supportedFormats.has(distribution.mimeType));
|
|
28
34
|
if (downloadDistributions.length === 0) {
|
|
29
35
|
return new NotSupported();
|
|
30
36
|
}
|
|
@@ -55,16 +61,11 @@ export class Importer {
|
|
|
55
61
|
return new ImportSuccessful(distribution);
|
|
56
62
|
}
|
|
57
63
|
fileFormatFromMimeType(mimeType) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
case 'application/n-quads':
|
|
62
|
-
return 'nq';
|
|
63
|
-
case 'text/turtle':
|
|
64
|
-
return 'ttl';
|
|
65
|
-
default:
|
|
66
|
-
throw new Error(`Unsupported media type: ${mimeType}`);
|
|
64
|
+
const format = supportedFormats.get(mimeType);
|
|
65
|
+
if (format === undefined) {
|
|
66
|
+
throw new Error(`Unsupported media type: ${mimeType}`);
|
|
67
67
|
}
|
|
68
|
+
return format;
|
|
68
69
|
}
|
|
69
70
|
async index(file, format) {
|
|
70
71
|
const workingDir = dirname(file);
|