@rdfx/sparql-client 0.0.1
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/HttpSparqlBaseClient.d.ts +31 -0
- package/dist/HttpSparqlBaseClient.js +70 -0
- package/dist/HttpSparqlGraphStoreClient.d.ts +20 -0
- package/dist/HttpSparqlGraphStoreClient.js +91 -0
- package/dist/HttpSparqlQueryClient.d.ts +24 -0
- package/dist/HttpSparqlQueryClient.js +115 -0
- package/dist/HttpSparqlUpdateClient.d.ts +17 -0
- package/dist/HttpSparqlUpdateClient.js +56 -0
- package/dist/LoggingSparqlBaseClient.d.ts +15 -0
- package/dist/LoggingSparqlBaseClient.js +10 -0
- package/dist/LoggingSparqlGraphStoreClient.d.ts +11 -0
- package/dist/LoggingSparqlGraphStoreClient.js +34 -0
- package/dist/LoggingSparqlQueryClient.d.ts +12 -0
- package/dist/LoggingSparqlQueryClient.js +34 -0
- package/dist/LoggingSparqlUpdateClient.d.ts +9 -0
- package/dist/LoggingSparqlUpdateClient.js +12 -0
- package/dist/OxigraphSparqlClient.d.ts +36 -0
- package/dist/OxigraphSparqlClient.js +71 -0
- package/dist/SparqlGraphStoreClient.d.ts +44 -0
- package/dist/SparqlGraphStoreClient.js +2 -0
- package/dist/SparqlQueryClient.d.ts +22 -0
- package/dist/SparqlQueryClient.js +2 -0
- package/dist/SparqlUpdateClient.d.ts +7 -0
- package/dist/SparqlUpdateClient.js +2 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +11 -0
- package/package.json +33 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abstract base class for HTTP-based SPARQL clients.
|
|
3
|
+
*/
|
|
4
|
+
export declare abstract class HttpSparqlBaseClient<RequestOptionsT extends HttpSparqlBaseClient.RequestOptions> {
|
|
5
|
+
protected defaultRequestOptions?: RequestOptionsT;
|
|
6
|
+
protected readonly endpointUrl: string;
|
|
7
|
+
constructor({ defaultRequestOptions, endpointUrl, }: HttpSparqlBaseClient.Parameters<RequestOptionsT>);
|
|
8
|
+
protected ensureOkResponse(response: Response): Promise<Response>;
|
|
9
|
+
protected fetch({ body, hardCodedHeaders, method, options, url, }: {
|
|
10
|
+
body: RequestInit["body"] | null;
|
|
11
|
+
hardCodedHeaders: {
|
|
12
|
+
accept: string | null;
|
|
13
|
+
contentType: string | null;
|
|
14
|
+
} | null;
|
|
15
|
+
method: RequestInit["method"];
|
|
16
|
+
options: RequestOptionsT | null;
|
|
17
|
+
url: URL;
|
|
18
|
+
}): Promise<Response>;
|
|
19
|
+
protected responseToError(response: Response): Promise<Error>;
|
|
20
|
+
}
|
|
21
|
+
export declare namespace HttpSparqlBaseClient {
|
|
22
|
+
interface Parameters<RequestOptionsT extends RequestOptions> {
|
|
23
|
+
defaultRequestOptions?: RequestOptionsT;
|
|
24
|
+
endpointUrl: string;
|
|
25
|
+
}
|
|
26
|
+
interface RequestOptions {
|
|
27
|
+
cache?: Request["cache"];
|
|
28
|
+
headers?: Headers;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=HttpSparqlBaseClient.d.ts.map
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abstract base class for HTTP-based SPARQL clients.
|
|
3
|
+
*/
|
|
4
|
+
export class HttpSparqlBaseClient {
|
|
5
|
+
constructor({ defaultRequestOptions, endpointUrl, }) {
|
|
6
|
+
this.defaultRequestOptions = defaultRequestOptions;
|
|
7
|
+
this.endpointUrl = endpointUrl;
|
|
8
|
+
}
|
|
9
|
+
async ensureOkResponse(response) {
|
|
10
|
+
if (response.ok) {
|
|
11
|
+
return response;
|
|
12
|
+
}
|
|
13
|
+
throw await this.responseToError(response);
|
|
14
|
+
}
|
|
15
|
+
async fetch({ body, hardCodedHeaders, method, options, url, }) {
|
|
16
|
+
const mergedHeaders = new Headers();
|
|
17
|
+
// Keep track of which headers should be set vs. appended
|
|
18
|
+
// This is used to enforce the semantics that:
|
|
19
|
+
// - requestOptions headers overwrite (set) defaultRequestOptions headers
|
|
20
|
+
// - requestOptions headers don't overwrite (set) each other, but append
|
|
21
|
+
const setHeaderNames = new Set();
|
|
22
|
+
if (this.defaultRequestOptions?.headers) {
|
|
23
|
+
for (const [name, value,] of this.defaultRequestOptions.headers.entries()) {
|
|
24
|
+
mergedHeaders.append(name, value);
|
|
25
|
+
setHeaderNames.add(name);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (options?.headers) {
|
|
29
|
+
for (const [name, value] of options.headers.entries()) {
|
|
30
|
+
if (setHeaderNames.has(name)) {
|
|
31
|
+
mergedHeaders.set(name, value);
|
|
32
|
+
setHeaderNames.delete(name); // Append if we see another header with that name.
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
mergedHeaders.append(name, value);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (hardCodedHeaders?.accept) {
|
|
40
|
+
// Enforce our preference on accept
|
|
41
|
+
mergedHeaders.set("accept", hardCodedHeaders.accept);
|
|
42
|
+
}
|
|
43
|
+
if (hardCodedHeaders?.contentType) {
|
|
44
|
+
mergedHeaders.append("content-type", hardCodedHeaders.contentType);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
mergedHeaders.delete("content-type");
|
|
48
|
+
}
|
|
49
|
+
// if (this.logger.isLevelEnabled("trace")) {
|
|
50
|
+
// this.logger.trace("request URL: %s", url);
|
|
51
|
+
// this.logger.trace("request method: %s", method);
|
|
52
|
+
// for (const [name, value] of mergedHeaders.entries()) {
|
|
53
|
+
// this.logger.trace("request header: %s: %s", name, value);
|
|
54
|
+
// }
|
|
55
|
+
// if (body && typeof body === "string") {
|
|
56
|
+
// this.logger.trace("request body (length=%s):\n%s", body.length, body);
|
|
57
|
+
// }
|
|
58
|
+
// }
|
|
59
|
+
return await fetch(url, {
|
|
60
|
+
body,
|
|
61
|
+
// cache: options?.cache ?? this.defaultRequestOptions?.cache,
|
|
62
|
+
headers: mergedHeaders,
|
|
63
|
+
method,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
async responseToError(response) {
|
|
67
|
+
return new Error(`${response.status} ${response.statusText}: ${await response.text()}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=HttpSparqlBaseClient.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { DataFactory, DefaultGraph, NamedNode, Quad } from "@rdfjs/types";
|
|
2
|
+
import { HttpSparqlBaseClient } from "./HttpSparqlBaseClient.js";
|
|
3
|
+
import type { SparqlGraphStoreClient } from "./SparqlGraphStoreClient.js";
|
|
4
|
+
export declare class HttpSparqlGraphStoreClient extends HttpSparqlBaseClient<HttpSparqlGraphStoreClient.RequestOptions> implements SparqlGraphStoreClient {
|
|
5
|
+
private readonly dataFactory;
|
|
6
|
+
constructor({ dataFactory, ...superParameters }: HttpSparqlGraphStoreClient.Parameters);
|
|
7
|
+
deleteGraph(graph: DefaultGraph | NamedNode, options?: HttpSparqlGraphStoreClient.RequestOptions): Promise<boolean>;
|
|
8
|
+
getGraph(graph: DefaultGraph | NamedNode, options?: HttpSparqlGraphStoreClient.RequestOptions): Promise<readonly Quad[]>;
|
|
9
|
+
postGraph(graph: DefaultGraph | NamedNode, payload: Iterable<Quad>, options?: HttpSparqlGraphStoreClient.RequestOptions): Promise<void>;
|
|
10
|
+
putGraph(graph: DefaultGraph | NamedNode, payload: Iterable<Quad>, options?: HttpSparqlGraphStoreClient.RequestOptions): Promise<void>;
|
|
11
|
+
private graphUrl;
|
|
12
|
+
private postOrPutGraph;
|
|
13
|
+
}
|
|
14
|
+
export declare namespace HttpSparqlGraphStoreClient {
|
|
15
|
+
interface Parameters extends HttpSparqlBaseClient.Parameters<RequestOptions> {
|
|
16
|
+
dataFactory: DataFactory;
|
|
17
|
+
}
|
|
18
|
+
type RequestOptions = HttpSparqlBaseClient.RequestOptions;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=HttpSparqlGraphStoreClient.d.ts.map
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import N3 from "n3";
|
|
2
|
+
import { HttpSparqlBaseClient } from "./HttpSparqlBaseClient.js";
|
|
3
|
+
export class HttpSparqlGraphStoreClient extends HttpSparqlBaseClient {
|
|
4
|
+
constructor({ dataFactory, ...superParameters }) {
|
|
5
|
+
super(superParameters);
|
|
6
|
+
this.dataFactory = dataFactory;
|
|
7
|
+
}
|
|
8
|
+
async deleteGraph(graph, options) {
|
|
9
|
+
const response = await this.fetch({
|
|
10
|
+
body: null,
|
|
11
|
+
hardCodedHeaders: null,
|
|
12
|
+
method: "DELETE",
|
|
13
|
+
options: options ?? null,
|
|
14
|
+
url: this.graphUrl(graph),
|
|
15
|
+
});
|
|
16
|
+
if (response.ok) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
if (response.status === 404) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
throw await this.responseToError(response);
|
|
23
|
+
}
|
|
24
|
+
async getGraph(graph, options) {
|
|
25
|
+
const response = await this.fetch({
|
|
26
|
+
body: null,
|
|
27
|
+
hardCodedHeaders: {
|
|
28
|
+
accept: "application/n-triples; charset=utf-8",
|
|
29
|
+
contentType: null,
|
|
30
|
+
},
|
|
31
|
+
method: "GET",
|
|
32
|
+
options: options ?? null,
|
|
33
|
+
url: this.graphUrl(graph),
|
|
34
|
+
});
|
|
35
|
+
if (response.ok) {
|
|
36
|
+
return new N3.Parser({
|
|
37
|
+
factory: this.dataFactory,
|
|
38
|
+
format: "application/n-triples",
|
|
39
|
+
}).parse(await response.text());
|
|
40
|
+
}
|
|
41
|
+
if (response.status === 404) {
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
throw await this.responseToError(response);
|
|
45
|
+
}
|
|
46
|
+
async postGraph(graph, payload, options) {
|
|
47
|
+
return this.postOrPutGraph(graph, "POST", payload, options);
|
|
48
|
+
}
|
|
49
|
+
async putGraph(graph, payload, options) {
|
|
50
|
+
return this.postOrPutGraph(graph, "PUT", payload, options);
|
|
51
|
+
}
|
|
52
|
+
graphUrl(graph) {
|
|
53
|
+
const url = new URL(this.endpointUrl);
|
|
54
|
+
switch (graph.termType) {
|
|
55
|
+
case "DefaultGraph":
|
|
56
|
+
url.searchParams.append("default", "");
|
|
57
|
+
break;
|
|
58
|
+
case "NamedNode":
|
|
59
|
+
url.searchParams.append("graph", graph.value);
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
return url;
|
|
63
|
+
}
|
|
64
|
+
async postOrPutGraph(graph, method, payload, options) {
|
|
65
|
+
// Strip named graphs out of the payload quads, since everything should go to the same graph.
|
|
66
|
+
const quads = [];
|
|
67
|
+
for (const quad of payload) {
|
|
68
|
+
if (quad.graph.termType === "DefaultGraph") {
|
|
69
|
+
quads.push(quad);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
quads.push(this.dataFactory.quad(quad.subject, quad.predicate, quad.object));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
await this.ensureOkResponse(await this.fetch({
|
|
76
|
+
body: new N3.Writer({
|
|
77
|
+
format: "application/n-triples",
|
|
78
|
+
})
|
|
79
|
+
.quadsToString(quads)
|
|
80
|
+
.trimEnd(),
|
|
81
|
+
hardCodedHeaders: {
|
|
82
|
+
accept: null,
|
|
83
|
+
contentType: "application/n-triples; charset=utf-8",
|
|
84
|
+
},
|
|
85
|
+
method,
|
|
86
|
+
options: options ?? null,
|
|
87
|
+
url: this.graphUrl(graph),
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=HttpSparqlGraphStoreClient.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { BlankNode, DataFactory, Literal, NamedNode, Quad } from "@rdfjs/types";
|
|
2
|
+
import { HttpSparqlBaseClient } from "./HttpSparqlBaseClient.js";
|
|
3
|
+
import type { SparqlQueryClient } from "./SparqlQueryClient.js";
|
|
4
|
+
export declare class HttpSparqlQueryClient extends HttpSparqlBaseClient<HttpSparqlQueryClient.RequestOptions> implements SparqlQueryClient {
|
|
5
|
+
private readonly dataFactory;
|
|
6
|
+
constructor({ dataFactory, ...superParameters }: HttpSparqlQueryClient.Parameters);
|
|
7
|
+
queryBindings(query: string, options?: HttpSparqlQueryClient.RequestOptions): Promise<readonly Record<string, BlankNode | Literal | NamedNode>[]>;
|
|
8
|
+
queryBoolean(query: string, options?: HttpSparqlQueryClient.RequestOptions): Promise<boolean>;
|
|
9
|
+
queryQuads(query: string, options?: HttpSparqlQueryClient.RequestOptions): Promise<readonly Quad[]>;
|
|
10
|
+
private request;
|
|
11
|
+
private requestOptionsToUrlSearchParams;
|
|
12
|
+
}
|
|
13
|
+
export declare namespace HttpSparqlQueryClient {
|
|
14
|
+
interface Parameters extends HttpSparqlBaseClient.Parameters<RequestOptions> {
|
|
15
|
+
dataFactory: DataFactory;
|
|
16
|
+
}
|
|
17
|
+
interface RequestOptions extends HttpSparqlBaseClient.RequestOptions {
|
|
18
|
+
defaultGraphUris?: readonly NamedNode[];
|
|
19
|
+
method?: "GET" | "POSTDirectly" | "POSTWithUrlEncodedParameters";
|
|
20
|
+
namedGraphUris?: readonly NamedNode[];
|
|
21
|
+
unionDefaultGraph?: boolean;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=HttpSparqlQueryClient.d.ts.map
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import N3 from "n3";
|
|
2
|
+
import { HttpSparqlBaseClient } from "./HttpSparqlBaseClient.js";
|
|
3
|
+
export class HttpSparqlQueryClient extends HttpSparqlBaseClient {
|
|
4
|
+
constructor({ dataFactory, ...superParameters }) {
|
|
5
|
+
super(superParameters);
|
|
6
|
+
this.dataFactory = dataFactory;
|
|
7
|
+
}
|
|
8
|
+
async queryBindings(query, options) {
|
|
9
|
+
const response = await this.request(query, {
|
|
10
|
+
accept: "application/sparql-results+json",
|
|
11
|
+
}, options);
|
|
12
|
+
// https://www.w3.org/TR/sparql11-results-json/
|
|
13
|
+
const json = (await response.json());
|
|
14
|
+
return json.results.bindings.map((jsonResultsBindings) => {
|
|
15
|
+
const rdfjsBinding = {};
|
|
16
|
+
for (const [key, value] of Object.entries(jsonResultsBindings)) {
|
|
17
|
+
switch (value.type) {
|
|
18
|
+
case "bnode":
|
|
19
|
+
rdfjsBinding[key] = this.dataFactory.blankNode(value.value);
|
|
20
|
+
break;
|
|
21
|
+
case "literal":
|
|
22
|
+
if (value.datatype) {
|
|
23
|
+
rdfjsBinding[key] = this.dataFactory.literal(value.value, this.dataFactory.namedNode(value.datatype));
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
rdfjsBinding[key] = this.dataFactory.literal(value.value, value["xml:lang"]);
|
|
27
|
+
}
|
|
28
|
+
break;
|
|
29
|
+
case "uri":
|
|
30
|
+
rdfjsBinding[key] = this.dataFactory.namedNode(value.value);
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return rdfjsBinding;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
async queryBoolean(query, options) {
|
|
38
|
+
const response = await this.request(query, {
|
|
39
|
+
accept: "application/sparql-results+json",
|
|
40
|
+
}, options);
|
|
41
|
+
return (await response.json()).boolean;
|
|
42
|
+
}
|
|
43
|
+
async queryQuads(query, options) {
|
|
44
|
+
const response = await this.request(query, {
|
|
45
|
+
accept: "application/n-triples",
|
|
46
|
+
}, options);
|
|
47
|
+
return new N3.Parser({
|
|
48
|
+
factory: this.dataFactory,
|
|
49
|
+
format: "application/n-triples",
|
|
50
|
+
}).parse(await response.text());
|
|
51
|
+
}
|
|
52
|
+
async request(query, { accept }, options) {
|
|
53
|
+
const method = options?.method ?? this.defaultRequestOptions?.method ?? "GET";
|
|
54
|
+
const url = new URL(this.endpointUrl);
|
|
55
|
+
switch (method) {
|
|
56
|
+
case "GET": {
|
|
57
|
+
url.searchParams.set("query", query);
|
|
58
|
+
this.requestOptionsToUrlSearchParams(url.searchParams, options);
|
|
59
|
+
return await this.ensureOkResponse(await this.fetch({
|
|
60
|
+
body: null,
|
|
61
|
+
hardCodedHeaders: { accept, contentType: null },
|
|
62
|
+
method: "GET",
|
|
63
|
+
options: options ?? null,
|
|
64
|
+
url,
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
case "POSTDirectly": {
|
|
68
|
+
this.requestOptionsToUrlSearchParams(url.searchParams, options);
|
|
69
|
+
return await this.ensureOkResponse(await this.fetch({
|
|
70
|
+
body: query,
|
|
71
|
+
hardCodedHeaders: {
|
|
72
|
+
accept,
|
|
73
|
+
contentType: "application/sparql-query; charset=utf-8",
|
|
74
|
+
},
|
|
75
|
+
method: "POST",
|
|
76
|
+
options: options ?? null,
|
|
77
|
+
url,
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
case "POSTWithUrlEncodedParameters": {
|
|
81
|
+
const urlEncodedParameters = new URLSearchParams();
|
|
82
|
+
this.requestOptionsToUrlSearchParams(urlEncodedParameters, options);
|
|
83
|
+
urlEncodedParameters.set("query", query);
|
|
84
|
+
return await this.ensureOkResponse(await this.fetch({
|
|
85
|
+
body: urlEncodedParameters,
|
|
86
|
+
hardCodedHeaders: {
|
|
87
|
+
accept,
|
|
88
|
+
contentType: "application/x-www-form-urlencoded",
|
|
89
|
+
},
|
|
90
|
+
method: "POST",
|
|
91
|
+
options: options ?? null,
|
|
92
|
+
url,
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
requestOptionsToUrlSearchParams(urlSearchParams, requestOptions) {
|
|
98
|
+
for (const defaultGraphUri of requestOptions?.defaultGraphUris ??
|
|
99
|
+
this.defaultRequestOptions?.defaultGraphUris ??
|
|
100
|
+
[]) {
|
|
101
|
+
urlSearchParams.append("default-graph-uri", defaultGraphUri.value);
|
|
102
|
+
}
|
|
103
|
+
for (const namedGraphUri of requestOptions?.namedGraphUris ??
|
|
104
|
+
this.defaultRequestOptions?.namedGraphUris ??
|
|
105
|
+
[]) {
|
|
106
|
+
urlSearchParams.append("named-graph-uri", namedGraphUri.value);
|
|
107
|
+
}
|
|
108
|
+
if (requestOptions?.unionDefaultGraph ??
|
|
109
|
+
this.defaultRequestOptions?.unionDefaultGraph ??
|
|
110
|
+
false) {
|
|
111
|
+
urlSearchParams.append("union-default-graph", "");
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=HttpSparqlQueryClient.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { NamedNode } from "@rdfjs/types";
|
|
2
|
+
import { HttpSparqlBaseClient } from "./HttpSparqlBaseClient.js";
|
|
3
|
+
import type { SparqlUpdateClient } from "./SparqlUpdateClient.js";
|
|
4
|
+
export declare class HttpSparqlUpdateClient extends HttpSparqlBaseClient<HttpSparqlUpdateClient.RequestOptions> implements SparqlUpdateClient {
|
|
5
|
+
update(update: string, options?: HttpSparqlUpdateClient.RequestOptions): Promise<void>;
|
|
6
|
+
private requestOptionsToUrlSearchParams;
|
|
7
|
+
}
|
|
8
|
+
export declare namespace HttpSparqlUpdateClient {
|
|
9
|
+
type Parameters = HttpSparqlBaseClient.Parameters<RequestOptions>;
|
|
10
|
+
interface RequestOptions extends HttpSparqlBaseClient.RequestOptions {
|
|
11
|
+
method?: "POSTDirectly" | "POSTWithUrlEncodedParameters";
|
|
12
|
+
usingGraphUris?: readonly NamedNode[];
|
|
13
|
+
usingNamedGraphUris?: readonly NamedNode[];
|
|
14
|
+
usingUnionGraph?: boolean;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=HttpSparqlUpdateClient.d.ts.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { HttpSparqlBaseClient } from "./HttpSparqlBaseClient.js";
|
|
2
|
+
export class HttpSparqlUpdateClient extends HttpSparqlBaseClient {
|
|
3
|
+
async update(update, options) {
|
|
4
|
+
const method = options?.method ?? this.defaultRequestOptions?.method ?? "POSTDirectly";
|
|
5
|
+
const url = new URL(this.endpointUrl);
|
|
6
|
+
switch (method) {
|
|
7
|
+
case "POSTDirectly": {
|
|
8
|
+
this.requestOptionsToUrlSearchParams(url.searchParams, options);
|
|
9
|
+
await this.ensureOkResponse(await this.fetch({
|
|
10
|
+
body: update,
|
|
11
|
+
hardCodedHeaders: {
|
|
12
|
+
accept: null,
|
|
13
|
+
contentType: "application/sparql-update; charset=utf-8",
|
|
14
|
+
},
|
|
15
|
+
method: "POST",
|
|
16
|
+
options: options ?? null,
|
|
17
|
+
url,
|
|
18
|
+
}));
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
case "POSTWithUrlEncodedParameters": {
|
|
22
|
+
const urlEncodedParameters = new URLSearchParams();
|
|
23
|
+
this.requestOptionsToUrlSearchParams(urlEncodedParameters, options);
|
|
24
|
+
urlEncodedParameters.set("update", update);
|
|
25
|
+
await this.ensureOkResponse(await this.fetch({
|
|
26
|
+
body: urlEncodedParameters,
|
|
27
|
+
hardCodedHeaders: {
|
|
28
|
+
accept: null,
|
|
29
|
+
contentType: "application/x-www-form-urlencoded",
|
|
30
|
+
},
|
|
31
|
+
method: "POST",
|
|
32
|
+
options: options ?? null,
|
|
33
|
+
url,
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
requestOptionsToUrlSearchParams(urlSearchParams, requestOptions) {
|
|
39
|
+
for (const usingGraphUri of requestOptions?.usingGraphUris ??
|
|
40
|
+
this.defaultRequestOptions?.usingGraphUris ??
|
|
41
|
+
[]) {
|
|
42
|
+
urlSearchParams.append("using-graph-uri", usingGraphUri.value);
|
|
43
|
+
}
|
|
44
|
+
for (const usingNamedGraphUri of requestOptions?.usingNamedGraphUris ??
|
|
45
|
+
this.defaultRequestOptions?.usingNamedGraphUris ??
|
|
46
|
+
[]) {
|
|
47
|
+
urlSearchParams.append("using-named-graph-uri", usingNamedGraphUri.value);
|
|
48
|
+
}
|
|
49
|
+
if (requestOptions?.usingUnionGraph ??
|
|
50
|
+
this.defaultRequestOptions?.usingUnionGraph ??
|
|
51
|
+
false) {
|
|
52
|
+
urlSearchParams.append("using-union-graph", "");
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=HttpSparqlUpdateClient.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SparqlGraphStoreClient } from "./SparqlGraphStoreClient.js";
|
|
2
|
+
import type { SparqlQueryClient } from "./SparqlQueryClient.js";
|
|
3
|
+
import type { SparqlUpdateClient } from "./SparqlUpdateClient.js";
|
|
4
|
+
type Logger = (message: string, ...parameters: (boolean | number | string)[]) => void;
|
|
5
|
+
export declare class LoggingSparqlBaseClient<DelegateT extends SparqlGraphStoreClient | SparqlQueryClient | SparqlUpdateClient> {
|
|
6
|
+
protected delegate: DelegateT;
|
|
7
|
+
protected logger: Logger;
|
|
8
|
+
constructor({ delegate, logger }: {
|
|
9
|
+
delegate: DelegateT;
|
|
10
|
+
logger: Logger;
|
|
11
|
+
});
|
|
12
|
+
protected loggableQuery(query: string): string;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=LoggingSparqlBaseClient.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export class LoggingSparqlBaseClient {
|
|
2
|
+
constructor({ delegate, logger }) {
|
|
3
|
+
this.delegate = delegate;
|
|
4
|
+
this.logger = logger;
|
|
5
|
+
}
|
|
6
|
+
loggableQuery(query) {
|
|
7
|
+
return query.replace(/\s+/g, " ").trim();
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=LoggingSparqlBaseClient.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DatasetCore, DefaultGraph, NamedNode, Quad } from "@rdfjs/types";
|
|
2
|
+
import { LoggingSparqlBaseClient } from "./LoggingSparqlBaseClient.js";
|
|
3
|
+
import type { SparqlGraphStoreClient } from "./SparqlGraphStoreClient.js";
|
|
4
|
+
export declare class LoggingSparqlGraphStoreClient extends LoggingSparqlBaseClient<SparqlGraphStoreClient> implements SparqlGraphStoreClient {
|
|
5
|
+
deleteGraph(graph: DefaultGraph | NamedNode): Promise<boolean>;
|
|
6
|
+
getGraph(graph: DefaultGraph | NamedNode): Promise<readonly Quad[]>;
|
|
7
|
+
postGraph(graph: DefaultGraph | NamedNode, payload: DatasetCore): Promise<void>;
|
|
8
|
+
putGraph(graph: DefaultGraph | NamedNode, payload: DatasetCore): Promise<void>;
|
|
9
|
+
private loggableGraph;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=LoggingSparqlGraphStoreClient.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { LoggingSparqlBaseClient } from "./LoggingSparqlBaseClient.js";
|
|
2
|
+
export class LoggingSparqlGraphStoreClient extends LoggingSparqlBaseClient {
|
|
3
|
+
async deleteGraph(graph) {
|
|
4
|
+
this.logger("deleting graph %s", this.loggableGraph(graph));
|
|
5
|
+
const result = await this.delegate.deleteGraph(graph);
|
|
6
|
+
this.logger("deleted graph %s: %s", this.loggableGraph(graph), result);
|
|
7
|
+
return result;
|
|
8
|
+
}
|
|
9
|
+
async getGraph(graph) {
|
|
10
|
+
this.logger("getting dataset from %s", this.loggableGraph(graph));
|
|
11
|
+
const result = await this.delegate.getGraph(graph);
|
|
12
|
+
this.logger("got %d quads from %s", result.length, this.loggableGraph(graph));
|
|
13
|
+
return result;
|
|
14
|
+
}
|
|
15
|
+
async postGraph(graph, payload) {
|
|
16
|
+
this.logger("posting %d-quad dataset to %s", payload.size, this.loggableGraph(graph));
|
|
17
|
+
await this.delegate.postGraph(graph, payload);
|
|
18
|
+
this.logger("posted %d-quad dataset to %s", payload.size, this.loggableGraph(graph));
|
|
19
|
+
}
|
|
20
|
+
async putGraph(graph, payload) {
|
|
21
|
+
this.logger("putting %d-quad dataset to %s", payload.size, this.loggableGraph(graph));
|
|
22
|
+
await this.delegate.putGraph(graph, payload);
|
|
23
|
+
this.logger("put %d-quad dataset to %s", payload.size, this.loggableGraph(graph));
|
|
24
|
+
}
|
|
25
|
+
loggableGraph(graph) {
|
|
26
|
+
switch (graph.termType) {
|
|
27
|
+
case "DefaultGraph":
|
|
28
|
+
return "default graph";
|
|
29
|
+
case "NamedNode":
|
|
30
|
+
return `graph <${graph.value}>`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=LoggingSparqlGraphStoreClient.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BlankNode, Literal, NamedNode, Quad } from "@rdfjs/types";
|
|
2
|
+
import { LoggingSparqlBaseClient } from "./LoggingSparqlBaseClient.js";
|
|
3
|
+
import type { SparqlQueryClient } from "./SparqlQueryClient.js";
|
|
4
|
+
/**
|
|
5
|
+
* SparqlClient implementation that logs queries and delegates actual work to another SparqlClient implementation.
|
|
6
|
+
*/
|
|
7
|
+
export declare class LoggingSparqlQueryClient extends LoggingSparqlBaseClient<SparqlQueryClient> implements SparqlQueryClient {
|
|
8
|
+
queryBindings(query: string): Promise<readonly Record<string, BlankNode | Literal | NamedNode>[]>;
|
|
9
|
+
queryBoolean(query: string): Promise<boolean>;
|
|
10
|
+
queryQuads(query: string): Promise<readonly Quad[]>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=LoggingSparqlQueryClient.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import N3 from "n3";
|
|
2
|
+
import { LoggingSparqlBaseClient } from "./LoggingSparqlBaseClient.js";
|
|
3
|
+
/**
|
|
4
|
+
* SparqlClient implementation that logs queries and delegates actual work to another SparqlClient implementation.
|
|
5
|
+
*/
|
|
6
|
+
export class LoggingSparqlQueryClient extends LoggingSparqlBaseClient {
|
|
7
|
+
async queryBindings(query) {
|
|
8
|
+
this.logger(this.loggableQuery(query));
|
|
9
|
+
const result = await this.delegate.queryBindings(query);
|
|
10
|
+
this.logger("queryBindings results:\n%s", JSON.stringify(result, undefined, 2));
|
|
11
|
+
return result;
|
|
12
|
+
}
|
|
13
|
+
async queryBoolean(query) {
|
|
14
|
+
this.logger(this.loggableQuery(query));
|
|
15
|
+
const result = await this.delegate.queryBoolean(query);
|
|
16
|
+
this.logger("queryBoolean result: %s", result);
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
async queryQuads(query) {
|
|
20
|
+
this.logger(this.loggableQuery(query));
|
|
21
|
+
const result = await this.delegate.queryQuads(query);
|
|
22
|
+
this.logger("queryQuads result: %d quads", result.length);
|
|
23
|
+
// if (this.logger.isLevelEnabled("trace")) {
|
|
24
|
+
const writer = new N3.Writer({ format: "application/N-Quads" });
|
|
25
|
+
for (const quad of result) {
|
|
26
|
+
this.logger(writer
|
|
27
|
+
.quadToString(quad.subject, quad.predicate, quad.object, quad.graph)
|
|
28
|
+
.trimEnd());
|
|
29
|
+
}
|
|
30
|
+
// }
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=LoggingSparqlQueryClient.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { LoggingSparqlBaseClient } from "./LoggingSparqlBaseClient.js";
|
|
2
|
+
import type { SparqlUpdateClient } from "./SparqlUpdateClient.js";
|
|
3
|
+
/**
|
|
4
|
+
* SparqlClient implementation that logs queries and delegates actual work to another SparqlClient implementation.
|
|
5
|
+
*/
|
|
6
|
+
export declare class LoggingSparqlUpdateClient extends LoggingSparqlBaseClient<SparqlUpdateClient> implements SparqlUpdateClient {
|
|
7
|
+
update(update: string): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=LoggingSparqlUpdateClient.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LoggingSparqlBaseClient } from "./LoggingSparqlBaseClient.js";
|
|
2
|
+
/**
|
|
3
|
+
* SparqlClient implementation that logs queries and delegates actual work to another SparqlClient implementation.
|
|
4
|
+
*/
|
|
5
|
+
export class LoggingSparqlUpdateClient extends LoggingSparqlBaseClient {
|
|
6
|
+
async update(update) {
|
|
7
|
+
this.logger(this.loggableQuery(update));
|
|
8
|
+
await this.delegate.update(update);
|
|
9
|
+
this.logger("SPARQL update executed successfully");
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=LoggingSparqlUpdateClient.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { BlankNode, DataFactory, DefaultGraph, Literal, NamedNode, Quad, Term } from "@rdfjs/types";
|
|
2
|
+
import type { SparqlGraphStoreClient } from "./SparqlGraphStoreClient.js";
|
|
3
|
+
import type { SparqlQueryClient } from "./SparqlQueryClient.js";
|
|
4
|
+
import type { SparqlUpdateClient } from "./SparqlUpdateClient.js";
|
|
5
|
+
interface Store {
|
|
6
|
+
add(quad: Quad): void;
|
|
7
|
+
match(subject?: Term | null, predicate?: Term | null, object?: Term | null, graph?: Term | null): Quad[];
|
|
8
|
+
query(query: string, options?: {
|
|
9
|
+
base_iri?: NamedNode | string;
|
|
10
|
+
results_format?: string;
|
|
11
|
+
use_default_graph_as_union?: boolean;
|
|
12
|
+
}): boolean | Map<string, Term>[] | Quad[] | string;
|
|
13
|
+
update(update: string, options?: {
|
|
14
|
+
base_iri?: NamedNode | string;
|
|
15
|
+
}): void;
|
|
16
|
+
}
|
|
17
|
+
export declare class OxigraphSparqlClient implements SparqlGraphStoreClient, SparqlQueryClient, SparqlUpdateClient {
|
|
18
|
+
private readonly dataFactory;
|
|
19
|
+
private readonly store;
|
|
20
|
+
private readonly useDefaultGraphAsUnion;
|
|
21
|
+
constructor({ dataFactory, store, useDefaultGraphAsUnion, }: {
|
|
22
|
+
dataFactory: Pick<DataFactory, "quad">;
|
|
23
|
+
store: Store;
|
|
24
|
+
useDefaultGraphAsUnion?: boolean;
|
|
25
|
+
});
|
|
26
|
+
deleteGraph(graph: DefaultGraph | NamedNode): Promise<boolean>;
|
|
27
|
+
getGraph(graph: DefaultGraph | NamedNode): Promise<readonly Quad[]>;
|
|
28
|
+
postGraph(graph: DefaultGraph | NamedNode, payload: Iterable<Quad>): Promise<void>;
|
|
29
|
+
putGraph(graph: DefaultGraph | NamedNode, payload: Iterable<Quad>): Promise<void>;
|
|
30
|
+
queryBindings(query: string): Promise<readonly Record<string, BlankNode | Literal | NamedNode>[]>;
|
|
31
|
+
queryBoolean(query: string): Promise<boolean>;
|
|
32
|
+
queryQuads(query: string): Promise<readonly Quad[]>;
|
|
33
|
+
update(update: string): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=OxigraphSparqlClient.d.ts.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export class OxigraphSparqlClient {
|
|
2
|
+
constructor({ dataFactory, store, useDefaultGraphAsUnion, }) {
|
|
3
|
+
this.dataFactory = dataFactory;
|
|
4
|
+
this.store = store;
|
|
5
|
+
this.useDefaultGraphAsUnion = !!useDefaultGraphAsUnion;
|
|
6
|
+
}
|
|
7
|
+
async deleteGraph(graph) {
|
|
8
|
+
// https://www.w3.org/TR/2013/REC-sparql11-http-rdf-update-20130321/#http-put
|
|
9
|
+
if (graph.termType === "DefaultGraph") {
|
|
10
|
+
this.store.update("DROP SILENT DEFAULT");
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
try {
|
|
14
|
+
this.store.update(`DROP GRAPH <${graph.value}>`);
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
if (e instanceof Error && e.message.endsWith("does not exist")) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
throw e;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
async getGraph(graph) {
|
|
25
|
+
return [...this.store.match(null, null, null, graph)];
|
|
26
|
+
}
|
|
27
|
+
async postGraph(graph, payload) {
|
|
28
|
+
for (const quad of payload) {
|
|
29
|
+
this.store.add(this.dataFactory.quad(quad.subject, quad.predicate, quad.object, graph));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
async putGraph(graph, payload) {
|
|
33
|
+
await this.deleteGraph(graph);
|
|
34
|
+
await this.postGraph(graph, payload);
|
|
35
|
+
}
|
|
36
|
+
async queryBindings(query) {
|
|
37
|
+
const bindings = [];
|
|
38
|
+
for (const map of this.store.query(query, {
|
|
39
|
+
use_default_graph_as_union: this.useDefaultGraphAsUnion,
|
|
40
|
+
})) {
|
|
41
|
+
const mapBindings = {};
|
|
42
|
+
for (const entry of map.entries()) {
|
|
43
|
+
switch (entry[1].termType) {
|
|
44
|
+
case "BlankNode":
|
|
45
|
+
case "Literal":
|
|
46
|
+
case "NamedNode":
|
|
47
|
+
mapBindings[entry[0]] = entry[1];
|
|
48
|
+
break;
|
|
49
|
+
default:
|
|
50
|
+
throw new RangeError(entry[1].termType);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
bindings.push(mapBindings);
|
|
54
|
+
}
|
|
55
|
+
return bindings;
|
|
56
|
+
}
|
|
57
|
+
async queryBoolean(query) {
|
|
58
|
+
return this.store.query(query, {
|
|
59
|
+
use_default_graph_as_union: this.useDefaultGraphAsUnion,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
async queryQuads(query) {
|
|
63
|
+
return this.store.query(query, {
|
|
64
|
+
use_default_graph_as_union: this.useDefaultGraphAsUnion,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
async update(update) {
|
|
68
|
+
this.store.update(update, {});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=OxigraphSparqlClient.js.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { DefaultGraph, NamedNode, Quad } from "@rdfjs/types";
|
|
2
|
+
export interface SparqlGraphStoreClient {
|
|
3
|
+
/**
|
|
4
|
+
* Delete a graph.
|
|
5
|
+
*
|
|
6
|
+
* https://www.w3.org/TR/sparql11-http-rdf-update/#http-delete
|
|
7
|
+
*
|
|
8
|
+
* @param graph name of the graph or the default graph
|
|
9
|
+
* @return true on a 20x response, false on a 404 response
|
|
10
|
+
* @throw on any other response status
|
|
11
|
+
*/
|
|
12
|
+
deleteGraph(graph: DefaultGraph | NamedNode): Promise<boolean>;
|
|
13
|
+
/**
|
|
14
|
+
* Get the triples in a graph.
|
|
15
|
+
*
|
|
16
|
+
* https://www.w3.org/TR/sparql11-http-rdf-update/#http-get
|
|
17
|
+
*
|
|
18
|
+
* @param graph name of the graph or the default graph
|
|
19
|
+
*/
|
|
20
|
+
getGraph(graph: DefaultGraph | NamedNode): Promise<readonly Quad[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Post triples to a graph.
|
|
23
|
+
*
|
|
24
|
+
* https://www.w3.org/TR/sparql11-http-rdf-update/#http-post
|
|
25
|
+
*
|
|
26
|
+
* Ignores the graph part of every quad in the payload.
|
|
27
|
+
*
|
|
28
|
+
* @param graph name of the graph or the default graph
|
|
29
|
+
* @param payload iterable of triples
|
|
30
|
+
*/
|
|
31
|
+
postGraph(graph: DefaultGraph | NamedNode, payload: Iterable<Omit<Quad, "graph">>): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Replace the contents of a graph with the given triples.
|
|
34
|
+
*
|
|
35
|
+
* https://www.w3.org/TR/sparql11-http-rdf-update/#http-put
|
|
36
|
+
*
|
|
37
|
+
* Ignores the graph part of every quad in the payload.
|
|
38
|
+
*
|
|
39
|
+
* @param graph name of the
|
|
40
|
+
* @param payload
|
|
41
|
+
*/
|
|
42
|
+
putGraph(graph: DefaultGraph | NamedNode, payload: Iterable<Quad>): Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=SparqlGraphStoreClient.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { BlankNode, Literal, NamedNode, Quad } from "@rdfjs/types";
|
|
2
|
+
/**
|
|
3
|
+
* SPARQL 1.1 Protocol query operations (https://www.w3.org/TR/2013/REC-sparql11-protocol-20130321/#query-operation).
|
|
4
|
+
*
|
|
5
|
+
* Loosely modeled on the RDF/JS: Query specification (https://rdf.js.org/query-spec/#queryquads-interface),
|
|
6
|
+
* returning arrays rather than streams.
|
|
7
|
+
*/
|
|
8
|
+
export interface SparqlQueryClient {
|
|
9
|
+
/**
|
|
10
|
+
* SELECT queries.
|
|
11
|
+
*/
|
|
12
|
+
queryBindings(query: string): Promise<readonly Record<string, BlankNode | Literal | NamedNode>[]>;
|
|
13
|
+
/**
|
|
14
|
+
* ASK queries.
|
|
15
|
+
*/
|
|
16
|
+
queryBoolean(query: string): Promise<boolean>;
|
|
17
|
+
/**
|
|
18
|
+
* CONSTRUCT or DESCRIBE queries
|
|
19
|
+
*/
|
|
20
|
+
queryQuads(query: string): Promise<readonly Quad[]>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=SparqlQueryClient.d.ts.map
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./HttpSparqlGraphStoreClient.js";
|
|
2
|
+
export * from "./HttpSparqlQueryClient.js";
|
|
3
|
+
export * from "./HttpSparqlUpdateClient.js";
|
|
4
|
+
export * from "./LoggingSparqlGraphStoreClient.js";
|
|
5
|
+
export * from "./LoggingSparqlQueryClient.js";
|
|
6
|
+
export * from "./LoggingSparqlUpdateClient.js";
|
|
7
|
+
export * from "./OxigraphSparqlClient.js";
|
|
8
|
+
export * from "./SparqlGraphStoreClient.js";
|
|
9
|
+
export * from "./SparqlQueryClient.js";
|
|
10
|
+
export * from "./SparqlUpdateClient.js";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./HttpSparqlGraphStoreClient.js";
|
|
2
|
+
export * from "./HttpSparqlQueryClient.js";
|
|
3
|
+
export * from "./HttpSparqlUpdateClient.js";
|
|
4
|
+
export * from "./LoggingSparqlGraphStoreClient.js";
|
|
5
|
+
export * from "./LoggingSparqlQueryClient.js";
|
|
6
|
+
export * from "./LoggingSparqlUpdateClient.js";
|
|
7
|
+
export * from "./OxigraphSparqlClient.js";
|
|
8
|
+
export * from "./SparqlGraphStoreClient.js";
|
|
9
|
+
export * from "./SparqlQueryClient.js";
|
|
10
|
+
export * from "./SparqlUpdateClient.js";
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"dependencies": {
|
|
3
|
+
"@rdfjs/types": "~2.0.1",
|
|
4
|
+
"@types/n3": "~1.26.0",
|
|
5
|
+
"n3": "~1.26.0"
|
|
6
|
+
},
|
|
7
|
+
"devDependencies": {
|
|
8
|
+
"oxigraph": "0.4.7"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist/*.d.ts",
|
|
12
|
+
"dist/*.js"
|
|
13
|
+
],
|
|
14
|
+
"license": "Apache-2.0",
|
|
15
|
+
"main": "./dist/index.js",
|
|
16
|
+
"name": "@rdfx/sparql-client",
|
|
17
|
+
"packageManager": "npm@11.11.0",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/minorg/rdfx.git"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsc -b",
|
|
24
|
+
"clean": "rimraf dist",
|
|
25
|
+
"depcheck": "depcheck .",
|
|
26
|
+
"dev": "tsc -w --preserveWatchOutput",
|
|
27
|
+
"dev:tests": "tsc -p __tests__ -w --preserveWatchOutput",
|
|
28
|
+
"test": "cd ../.. && vitest run --project @rdfx/sparql-client"
|
|
29
|
+
},
|
|
30
|
+
"type": "module",
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"version": "0.0.1"
|
|
33
|
+
}
|