@lde/sparql-qlever 0.15.2 → 0.15.3
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 +14 -0
- 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 +2 -2
package/README.md
CHANGED
|
@@ -10,6 +10,20 @@ Only **one** index is cached at a time. In a multi-dataset pipeline, each datase
|
|
|
10
10
|
|
|
11
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
12
|
|
|
13
|
+
## Networking (Docker mode)
|
|
14
|
+
|
|
15
|
+
By default `createQlever({ mode: 'docker' })` publishes QLever’s port on the host and addresses the query endpoint as `localhost` – correct when the consumer runs on the host, or shares the QLever container’s network namespace. A consumer that itself runs in a container on a bridge network cannot reach a host-published port; pass `network` (a Docker network the consumer is attached to) together with `containerName`, and QLever joins that network with the endpoint addressed by container name instead:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
const { importer, server } = createQlever({
|
|
19
|
+
mode: 'docker',
|
|
20
|
+
image: 'adfreiburg/qlever:latest',
|
|
21
|
+
network: 'app_default',
|
|
22
|
+
containerName: 'qlever',
|
|
23
|
+
});
|
|
24
|
+
server.queryEndpoint.toString(); // 'http://qlever:7001/sparql'
|
|
25
|
+
```
|
|
26
|
+
|
|
13
27
|
## Configuration
|
|
14
28
|
|
|
15
29
|
`createQlever()` accepts `indexOptions` and `serverOptions` to tune QLever's index builder and server respectively.
|
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,YAAW,YAAY;IAC/C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAmB;IAC9C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,IAAI,CAAC,CAAO;IACpB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,aAAa,CACgB;gBAElC,
|
|
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,YAAW,YAAY;IAC/C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAmB;IAC9C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,IAAI,CAAC,CAAO;IACpB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,aAAa,CACgB;gBAElC,EACV,UAAU,EACV,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,aAAa,GACd,EAAE,SAAS,CAAC,IAAI,CAAC;IAQL,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAmBtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAOlC,IAAW,aAAa,IAAI,GAAG,CAE9B;CACF;AAED,MAAM,WAAW,SAAS,CAAC,IAAI;IAC7B,UAAU,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;IAC7B,SAAS,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.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "git+https://github.com/ldelements/lde.git",
|
|
6
6
|
"directory": "packages/sparql-qlever"
|
|
@@ -29,7 +29,7 @@
|
|
|
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
34
|
"@lde/wait-for-sparql": "^0.2.16",
|
|
35
35
|
"rdf-parse": "^5.0.0",
|