@lde/sparql-qlever 0.15.2 → 0.15.4
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 +7 -33
- package/dist/createQlever.d.ts +16 -0
- package/dist/createQlever.d.ts.map +1 -1
- package/dist/createQlever.js +8 -1
- package/dist/server.d.ts +9 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +4 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,30 +1,12 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @lde/sparql-qlever
|
|
2
2
|
|
|
3
3
|
An adapter for the [QLever](https://github.com/ad-freiburg/qlever) SPARQL server.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Caching is enabled by default. Disable it by passing `cacheIndex: false` to `createQlever()` or the `Importer` constructor (e.g. driven by a `QLEVER_CACHE_INDEX=false` environment variable).
|
|
12
|
-
|
|
13
|
-
## Configuration
|
|
14
|
-
|
|
15
|
-
`createQlever()` accepts `indexOptions` and `serverOptions` to tune QLever's index builder and server respectively.
|
|
16
|
-
|
|
17
|
-
### Server options (`serverOptions`)
|
|
18
|
-
|
|
19
|
-
Passed to `qlever-server` at startup.
|
|
20
|
-
|
|
21
|
-
| Option | Description | Default |
|
|
22
|
-
| ----------------------- | ------------------------------------------------ | ------- |
|
|
23
|
-
| `memory-max-size` | Maximum memory for query processing and caching. | `'4G'` |
|
|
24
|
-
| `default-query-timeout` | Default query timeout. | `'30s'` |
|
|
25
|
-
| `cache-max-size` | Maximum cache size for query results. | – |
|
|
26
|
-
|
|
27
|
-
Example:
|
|
7
|
+
```sh
|
|
8
|
+
npm install @lde/sparql-qlever
|
|
9
|
+
```
|
|
28
10
|
|
|
29
11
|
```ts
|
|
30
12
|
const { importer, server } = createQlever({
|
|
@@ -37,14 +19,6 @@ const { importer, server } = createQlever({
|
|
|
37
19
|
});
|
|
38
20
|
```
|
|
39
21
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
Passed to `qlever-index` during import.
|
|
22
|
+
## Documentation
|
|
43
23
|
|
|
44
|
-
|
|
45
|
-
| ------------------------------- | --------------------------------------------------------------------------------------------- | ----------- |
|
|
46
|
-
| `ascii-prefixes-only` | Enable faster parsing for well-behaved TTL files. | `true` |
|
|
47
|
-
| `num-triples-per-batch` | Triples per batch; lower values reduce memory usage. | `3_000_000` |
|
|
48
|
-
| `stxxl-memory` | Memory budget for sorting during the index build. | `'10G'` |
|
|
49
|
-
| `parallel-parsing` | Parse input in parallel. | `true` |
|
|
50
|
-
| `only-pso-and-pos-permutations` | Build only PSO and POS permutations. Faster, but queries with predicate variables won't work. | `false` |
|
|
24
|
+
See the [full documentation](https://ldelements.org/reference/sparql-qlever).
|
package/dist/createQlever.d.ts
CHANGED
|
@@ -18,6 +18,22 @@ export type QleverOptions = {
|
|
|
18
18
|
mode: 'docker';
|
|
19
19
|
image: string;
|
|
20
20
|
containerName?: string;
|
|
21
|
+
network?: never;
|
|
22
|
+
} | {
|
|
23
|
+
mode: 'docker';
|
|
24
|
+
image: string;
|
|
25
|
+
/**
|
|
26
|
+
* Docker network to attach the QLever containers to. Set this when the
|
|
27
|
+
* consumer itself runs in a container on that network: the query
|
|
28
|
+
* endpoint is then addressed by `containerName` as hostname instead of
|
|
29
|
+
* a host-published `localhost` port, which a containerized consumer on
|
|
30
|
+
* a bridge network cannot reach. Leave unset when the consumer runs on
|
|
31
|
+
* the host (or shares the QLever container’s network namespace), where
|
|
32
|
+
* `localhost` is correct.
|
|
33
|
+
*/
|
|
34
|
+
network: string;
|
|
35
|
+
/** The hostname at which consumers on the network reach the endpoint. */
|
|
36
|
+
containerName: string;
|
|
21
37
|
} | {
|
|
22
38
|
mode: 'native';
|
|
23
39
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createQlever.d.ts","sourceRoot":"","sources":["../src/createQlever.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,UAAU,EAEX,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1D,MAAM,MAAM,aAAa,GAAG;IAC1B,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oBAAoB;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,6FAA6F;IAC7F,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mDAAmD;IACnD,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,sDAAsD;IACtD,aAAa,CAAC,EAAE,mBAAmB,CAAC;CACrC,GAAG,CACA;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"createQlever.d.ts","sourceRoot":"","sources":["../src/createQlever.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,UAAU,EAEX,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1D,MAAM,MAAM,aAAa,GAAG;IAC1B,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oBAAoB;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,6FAA6F;IAC7F,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mDAAmD;IACnD,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,sDAAsD;IACtD,aAAa,CAAC,EAAE,mBAAmB,CAAC;CACrC,GAAG,CACA;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB,GACD;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;;;OAQG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,aAAa,EAAE,MAAM,CAAC;CACvB,GACD;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CACrB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,aAAa;;;EAoClD"}
|
package/dist/createQlever.js
CHANGED
|
@@ -11,12 +11,18 @@ import { Server } from './server.js';
|
|
|
11
11
|
*/
|
|
12
12
|
export function createQlever(options) {
|
|
13
13
|
const port = options.port ?? 7001;
|
|
14
|
+
// On a shared network the endpoint is reached by container name, so don't
|
|
15
|
+
// claim a host port.
|
|
16
|
+
const hostname = options.mode === 'docker' && options.network
|
|
17
|
+
? options.containerName
|
|
18
|
+
: undefined;
|
|
14
19
|
const taskRunner = options.mode === 'docker'
|
|
15
20
|
? new DockerTaskRunner({
|
|
16
21
|
image: options.image,
|
|
17
22
|
containerName: options.containerName,
|
|
18
23
|
mountDir: options.dataDir,
|
|
19
|
-
|
|
24
|
+
network: options.network,
|
|
25
|
+
port: hostname ? undefined : port,
|
|
20
26
|
})
|
|
21
27
|
: new NativeTaskRunner({ cwd: options.dataDir });
|
|
22
28
|
return {
|
|
@@ -31,6 +37,7 @@ export function createQlever(options) {
|
|
|
31
37
|
taskRunner,
|
|
32
38
|
indexName: options.indexName ?? 'data',
|
|
33
39
|
port,
|
|
40
|
+
hostname,
|
|
34
41
|
qleverOptions: options.serverOptions,
|
|
35
42
|
}),
|
|
36
43
|
};
|
package/dist/server.d.ts
CHANGED
|
@@ -13,8 +13,9 @@ export declare class Server<Task> implements SparqlServer {
|
|
|
13
13
|
private readonly indexName;
|
|
14
14
|
private task?;
|
|
15
15
|
private readonly port;
|
|
16
|
+
private readonly hostname;
|
|
16
17
|
private readonly qleverOptions;
|
|
17
|
-
constructor({ taskRunner, indexName, port, qleverOptions }: Arguments<Task>);
|
|
18
|
+
constructor({ taskRunner, indexName, port, hostname, qleverOptions, }: Arguments<Task>);
|
|
18
19
|
start(): Promise<void>;
|
|
19
20
|
stop(): Promise<void>;
|
|
20
21
|
get queryEndpoint(): URL;
|
|
@@ -24,6 +25,13 @@ export interface Arguments<Task> {
|
|
|
24
25
|
indexName: string;
|
|
25
26
|
/** @default 7001 */
|
|
26
27
|
port?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Hostname at which consumers reach the query endpoint. Defaults to
|
|
30
|
+
* `localhost`, which is right whenever the server shares the consumer’s
|
|
31
|
+
* network namespace: a native process, a host-published Docker port, or
|
|
32
|
+
* QLever running inside the consumer’s own container.
|
|
33
|
+
*/
|
|
34
|
+
hostname?: string;
|
|
27
35
|
qleverOptions?: QleverServerOptions;
|
|
28
36
|
}
|
|
29
37
|
//# sourceMappingURL=server.d.ts.map
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,MAAM,WAAW,mBAAmB;IAClC,qEAAqE;IACrE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,4CAA4C;IAC5C,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,mEAAmE;IACnE,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAYD,qBAAa,MAAM,CAAC,IAAI,CAAE,YA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AS,EAAE,MAAM,CAAC;IAClB,oBAAoB;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,mBAAmB,CAAC;CACrC"}
|
package/dist/server.js
CHANGED
|
@@ -8,11 +8,13 @@ export class Server {
|
|
|
8
8
|
indexName;
|
|
9
9
|
task;
|
|
10
10
|
port;
|
|
11
|
+
hostname;
|
|
11
12
|
qleverOptions;
|
|
12
|
-
constructor({ taskRunner, indexName, port, qleverOptions }) {
|
|
13
|
+
constructor({ taskRunner, indexName, port, hostname, qleverOptions, }) {
|
|
13
14
|
this.taskRunner = taskRunner;
|
|
14
15
|
this.indexName = indexName;
|
|
15
16
|
this.port = port ?? 7001;
|
|
17
|
+
this.hostname = hostname ?? 'localhost';
|
|
16
18
|
this.qleverOptions = { ...defaultQleverServerOptions, ...qleverOptions };
|
|
17
19
|
}
|
|
18
20
|
async start() {
|
|
@@ -37,6 +39,6 @@ export class Server {
|
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
41
|
get queryEndpoint() {
|
|
40
|
-
return new URL(`http
|
|
42
|
+
return new URL(`http://${this.hostname}:${this.port}/sparql`);
|
|
41
43
|
}
|
|
42
44
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lde/sparql-qlever",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.4",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "git+https://github.com/ldelements/lde.git",
|
|
6
6
|
"directory": "packages/sparql-qlever"
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"@lde/sparql-importer": "^0.6.9",
|
|
30
30
|
"@lde/sparql-server": "^0.4.14",
|
|
31
31
|
"@lde/task-runner": "^0.2.13",
|
|
32
|
-
"@lde/task-runner-docker": "^0.2.
|
|
32
|
+
"@lde/task-runner-docker": "^0.2.16",
|
|
33
33
|
"@lde/task-runner-native": "^0.2.16",
|
|
34
|
-
"@lde/wait-for-sparql": "^0.2.
|
|
34
|
+
"@lde/wait-for-sparql": "^0.2.17",
|
|
35
35
|
"rdf-parse": "^5.0.0",
|
|
36
36
|
"rdf-serialize": "^5.1.0",
|
|
37
37
|
"tslib": "^2.3.0",
|