@grafctory/wire-sparql-rdf4j 0.0.0-stage → 0.13.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/LICENSE +201 -0
- package/README.md +63 -2
- package/dist/index.d.ts +67 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +241 -0
- package/dist/index.js.map +1 -0
- package/package.json +59 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,64 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @grafctory/wire-sparql-rdf4j
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@grafctory/wire-sparql-rdf4j)
|
|
4
|
+
|
|
5
|
+
SPARQL connector for [@grafctory/wire](https://github.com/grafctory/wire) backed by an RDF4J Server repository.
|
|
6
|
+
|
|
7
|
+
Exposes any [RDF4J Server](https://rdf4j.org/) repository through the common [@grafctory/wire-sparql] `Repository`
|
|
8
|
+
interface, bracketing each task in a server-managed transaction. One-off operations outside a transaction are delegated
|
|
9
|
+
to the [SPARQL 1.1 Protocol](https://www.w3.org/TR/sparql11-protocol/) through the companion
|
|
10
|
+
[@grafctory/wire-sparql-http] connector.
|
|
11
|
+
|
|
12
|
+
# Installation
|
|
13
|
+
|
|
14
|
+
```shell
|
|
15
|
+
npm install @grafctory/wire-sparql # the SPARQL query API
|
|
16
|
+
npm install @grafctory/wire-sparql-rdf4j # this connector
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
> [!WARNING]
|
|
20
|
+
>
|
|
21
|
+
> TypeScript consumers must use `"moduleResolution": "nodenext"/"node16"/"bundler"` in `tsconfig.json`.
|
|
22
|
+
> The legacy `"node"` resolver is not supported.
|
|
23
|
+
|
|
24
|
+
# Usage
|
|
25
|
+
|
|
26
|
+
Connect to an RDF4J Server repository with `createRDF4JRepository`, then issue queries and updates through the
|
|
27
|
+
[@grafctory/wire-sparql] `Repository` API:
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { createRDF4JRepository } from "@grafctory/wire-sparql-rdf4j";
|
|
31
|
+
|
|
32
|
+
const repository = createRDF4JRepository({
|
|
33
|
+
server: "https://example.org/rdf4j-server",
|
|
34
|
+
repository: "my-repo"
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The optional `infer` and `timeout` settings apply to every operation: `infer: false` restricts operations to explicit
|
|
39
|
+
statements, and `timeout` bounds the execution time of each operation, in seconds. RDF4J Server ignores `timeout` on
|
|
40
|
+
updates issued within an `execute` task, so an update that needs a time bound has to run outside a transaction.
|
|
41
|
+
|
|
42
|
+
See [@grafctory/wire-sparql] for the `Repository` API: `ask`, `select` and `construct` query the store, `update`,
|
|
43
|
+
`merge` and `store` write to it, and `execute` and `close` manage transactions and resources.
|
|
44
|
+
|
|
45
|
+
> [!IMPORTANT]
|
|
46
|
+
>
|
|
47
|
+
> This connector defers transaction isolation to the configured RDF4J repository: server-managed transactions bracket each task
|
|
48
|
+
> for atomic commit and rollback, achieving the isolation level of the underlying store (RDF4J's MemoryStore and
|
|
49
|
+
> NativeStore both default to `SNAPSHOT_READ`). The REST API exposes no isolation-level parameter on the
|
|
50
|
+
> start-transaction call.
|
|
51
|
+
|
|
52
|
+
[@grafctory/wire-sparql]: https://grafctory.github.io/wire/modules/_grafctory_wire-sparql.html
|
|
53
|
+
|
|
54
|
+
[@grafctory/wire-sparql-http]: https://grafctory.github.io/wire/modules/_grafctory_wire-sparql-http.html
|
|
55
|
+
|
|
56
|
+
# Support
|
|
57
|
+
|
|
58
|
+
- open an [issue](https://github.com/grafctory/wire/issues) to report a problem or to suggest a new feature
|
|
59
|
+
- start a [discussion](https://github.com/grafctory/wire/discussions) to ask a how-to question or to share an idea
|
|
60
|
+
|
|
61
|
+
# License
|
|
62
|
+
|
|
63
|
+
This project is licensed under the Apache 2.0 License –
|
|
64
|
+
see [LICENSE](https://github.com/grafctory/wire?tab=Apache-2.0-1-ov-file) file for details.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type Repository } from "@grafctory/wire-sparql";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a {@link Repository} backed by an
|
|
4
|
+
* {@link https://rdf4j.org/documentation/reference/rest-api/ RDF4J REST API} endpoint.
|
|
5
|
+
*
|
|
6
|
+
* Brackets every {@link Repository.execute | execute} task in a server-managed RDF4J transaction, committed when the
|
|
7
|
+
* task completes and rolled back if it throws or any transactional operation fails.
|
|
8
|
+
*
|
|
9
|
+
* Operations issued **outside** an enclosing `execute` task are dispatched to the canonical SPARQL 1.1 Protocol
|
|
10
|
+
* endpoints (`/repositories/{id}` for query, `/repositories/{id}/statements` for update) by delegating to a
|
|
11
|
+
* {@link createHTTPRepository} instance, so a one-off `ask` / `update` does not pay the start-and-commit roundtrip
|
|
12
|
+
* cost. A {@link Dataset} is honoured both inside and outside `execute` tasks, as the same protocol parameters.
|
|
13
|
+
*
|
|
14
|
+
* {@link Repository.merge | merge} and {@link Repository.store | store} upload their triples as N-Triples without
|
|
15
|
+
* parsing them as SPARQL text: outside `execute` tasks to the Graph Store Protocol service of the repository
|
|
16
|
+
* (`/repositories/{id}/rdf-graphs/service`), within them as transaction `ADD` operations, which a `store` precedes
|
|
17
|
+
* with a `DROP SILENT` update clearing the target graph. The default graph is the RDF4J null context.
|
|
18
|
+
*
|
|
19
|
+
* > [!IMPORTANT]
|
|
20
|
+
* > **Transaction Isolation** — Determined by the target RDF4J repository.
|
|
21
|
+
*
|
|
22
|
+
* **Error handling** — every HTTP exchange is funnelled through {@link createFetch}, so:
|
|
23
|
+
*
|
|
24
|
+
* - Network failures (DNS, refused connection, TLS, abort) reject with a {@link Problem} carrying `status: 0`
|
|
25
|
+
* - Non-2xx responses reject with a {@link Problem} carrying the wire status, the response `statusText` as `detail`,
|
|
26
|
+
* and the parsed body (RFC 7807 JSON, plain text, or omitted) as `report`
|
|
27
|
+
* - Malformed JSON in a 2xx `ask`/`select` response rejects with a synthesised {@link Problem} carrying the response
|
|
28
|
+
* status and a parse-failure `detail`
|
|
29
|
+
* - A 2xx `construct` response whose `Content-Type` is not N-Triples rejects with a synthesised {@link Problem}
|
|
30
|
+
* - A missing `Location` header on the start-transaction response rejects with a synthesised {@link Problem}
|
|
31
|
+
* - A malformed result payload surfaces the decoder's own error: a `SyntaxError` for ill-formed N-Triples, or a
|
|
32
|
+
* `RangeError` for a term component either syntax admits but the RDF data model rejects (a relative IRI, a lexical
|
|
33
|
+
* form holding an isolated surrogate, a non-conforming language tag), as well as for an unexpected SPARQL Results
|
|
34
|
+
* JSON term
|
|
35
|
+
*
|
|
36
|
+
* Rollback is best-effort: a network or 5xx failure on rollback is swallowed, so the original task error propagates.
|
|
37
|
+
*
|
|
38
|
+
* > [!WARNING]
|
|
39
|
+
* > RDF4J Server does not apply `timeout` to updates issued within an {@link Repository.execute | execute} task,
|
|
40
|
+
* > so they always run to completion. Aborting the exchange through a custom `fetch` does not stop them either: the
|
|
41
|
+
* > update keeps running on the server, and the rollback waits for it to finish. Updates issued outside `execute`
|
|
42
|
+
* > honour `timeout`, so an update that needs a time bound has to run there, giving up transactional atomicity.
|
|
43
|
+
*
|
|
44
|
+
* @param options - Server URL, repository identifier and the operation settings applied to every exchange
|
|
45
|
+
* @param options.server - RDF4J Server base URL, for example `http://localhost:8080/rdf4j-server`
|
|
46
|
+
* @param options.repository - Repository identifier within the RDF4J Server instance
|
|
47
|
+
* @param options.infer - Whether operations take inferred statements into account; when omitted, RDF4J includes them
|
|
48
|
+
* wherever the repository computes them, so set it to `false` to restrict operations to explicit statements
|
|
49
|
+
* @param options.timeout - Maximum execution time of each operation, as a positive integer number of seconds; when
|
|
50
|
+
* omitted, operations run under the execution limit configured on the server, if any
|
|
51
|
+
* @param options.fetch - Custom `fetch` implementation used for every HTTP exchange, enabling header, auth, and
|
|
52
|
+
* exchange customisation; defaults to the global `fetch`
|
|
53
|
+
*
|
|
54
|
+
* @returns A {@link Repository} instance
|
|
55
|
+
*
|
|
56
|
+
* @throws TypeError if `timeout` is not a positive integer
|
|
57
|
+
*
|
|
58
|
+
* @see {@link https://rdf4j.org/documentation/reference/rest-api/#transactions RDF4J REST API — Transactions}
|
|
59
|
+
*/
|
|
60
|
+
export declare function createRDF4JRepository({ server, repository, infer, timeout, fetch }: {
|
|
61
|
+
readonly server: string;
|
|
62
|
+
readonly repository: string;
|
|
63
|
+
readonly infer?: boolean;
|
|
64
|
+
readonly timeout?: number;
|
|
65
|
+
readonly fetch?: typeof globalThis.fetch;
|
|
66
|
+
}): Repository;
|
|
67
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAuCA,OAAO,EAEN,KAAK,UAAU,EAIf,MAAM,wBAAwB,CAAC;AAkBhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,wBAAgB,qBAAqB,CAAC,EAErC,MAAM,EACN,UAAU,EAEV,KAAK,EACL,OAAO,EAEP,KAAwB,EAExB,EAAE;IAEF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAE5B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAE1B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CAEzC,GAAG,UAAU,CAqMb"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2026 Metreeca srl
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* {@link https://rdf4j.org/documentation/reference/rest-api/ RDF4J REST API} endpoint connector for the
|
|
18
|
+
* {@link https://github.com/grafctory/wire @grafctory/wire} storage connector collection.
|
|
19
|
+
*
|
|
20
|
+
* Exposes any {@link https://rdf4j.org/ RDF4J Server} repository through the common {@link Repository} API,
|
|
21
|
+
* bracketing each task in a server-managed transaction and applying optional inference and timeout settings.
|
|
22
|
+
*
|
|
23
|
+
* > [!IMPORTANT]
|
|
24
|
+
* > **Transaction Isolation** — Determined by the target RDF4J repository.
|
|
25
|
+
*
|
|
26
|
+
* @module index
|
|
27
|
+
*
|
|
28
|
+
* @see {@link https://rdf4j.org/documentation/reference/rest-api/#transactions RDF4J REST API — Transactions}
|
|
29
|
+
*/
|
|
30
|
+
import { assert } from "@grafctory/core";
|
|
31
|
+
import { immutable } from "@grafctory/core/values";
|
|
32
|
+
import { resolve } from "@grafctory/core/resource";
|
|
33
|
+
import { createFetch } from "@grafctory/http";
|
|
34
|
+
import { success } from "@grafctory/http/success";
|
|
35
|
+
import { transport } from "@grafctory/http/transport";
|
|
36
|
+
import { encodeNTriples, NTriples } from "@grafctory/trio/ntriples";
|
|
37
|
+
import { SPARQLQuery, SPARQLUpdate } from "@grafctory/wire-sparql";
|
|
38
|
+
import { drop, silent } from "@grafctory/wire-sparql/builder";
|
|
39
|
+
import { createHTTPRepository } from "@grafctory/wire-sparql-http";
|
|
40
|
+
/**
|
|
41
|
+
* Names the SPARQL 1.1 Protocol parameters carrying a {@link Dataset}, forwarded onto the transaction endpoint.
|
|
42
|
+
*/
|
|
43
|
+
const DatasetParameters = new Set([
|
|
44
|
+
"default-graph-uri",
|
|
45
|
+
"named-graph-uri",
|
|
46
|
+
"using-graph-uri",
|
|
47
|
+
"using-named-graph-uri"
|
|
48
|
+
]);
|
|
49
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
50
|
+
/**
|
|
51
|
+
* Creates a {@link Repository} backed by an
|
|
52
|
+
* {@link https://rdf4j.org/documentation/reference/rest-api/ RDF4J REST API} endpoint.
|
|
53
|
+
*
|
|
54
|
+
* Brackets every {@link Repository.execute | execute} task in a server-managed RDF4J transaction, committed when the
|
|
55
|
+
* task completes and rolled back if it throws or any transactional operation fails.
|
|
56
|
+
*
|
|
57
|
+
* Operations issued **outside** an enclosing `execute` task are dispatched to the canonical SPARQL 1.1 Protocol
|
|
58
|
+
* endpoints (`/repositories/{id}` for query, `/repositories/{id}/statements` for update) by delegating to a
|
|
59
|
+
* {@link createHTTPRepository} instance, so a one-off `ask` / `update` does not pay the start-and-commit roundtrip
|
|
60
|
+
* cost. A {@link Dataset} is honoured both inside and outside `execute` tasks, as the same protocol parameters.
|
|
61
|
+
*
|
|
62
|
+
* {@link Repository.merge | merge} and {@link Repository.store | store} upload their triples as N-Triples without
|
|
63
|
+
* parsing them as SPARQL text: outside `execute` tasks to the Graph Store Protocol service of the repository
|
|
64
|
+
* (`/repositories/{id}/rdf-graphs/service`), within them as transaction `ADD` operations, which a `store` precedes
|
|
65
|
+
* with a `DROP SILENT` update clearing the target graph. The default graph is the RDF4J null context.
|
|
66
|
+
*
|
|
67
|
+
* > [!IMPORTANT]
|
|
68
|
+
* > **Transaction Isolation** — Determined by the target RDF4J repository.
|
|
69
|
+
*
|
|
70
|
+
* **Error handling** — every HTTP exchange is funnelled through {@link createFetch}, so:
|
|
71
|
+
*
|
|
72
|
+
* - Network failures (DNS, refused connection, TLS, abort) reject with a {@link Problem} carrying `status: 0`
|
|
73
|
+
* - Non-2xx responses reject with a {@link Problem} carrying the wire status, the response `statusText` as `detail`,
|
|
74
|
+
* and the parsed body (RFC 7807 JSON, plain text, or omitted) as `report`
|
|
75
|
+
* - Malformed JSON in a 2xx `ask`/`select` response rejects with a synthesised {@link Problem} carrying the response
|
|
76
|
+
* status and a parse-failure `detail`
|
|
77
|
+
* - A 2xx `construct` response whose `Content-Type` is not N-Triples rejects with a synthesised {@link Problem}
|
|
78
|
+
* - A missing `Location` header on the start-transaction response rejects with a synthesised {@link Problem}
|
|
79
|
+
* - A malformed result payload surfaces the decoder's own error: a `SyntaxError` for ill-formed N-Triples, or a
|
|
80
|
+
* `RangeError` for a term component either syntax admits but the RDF data model rejects (a relative IRI, a lexical
|
|
81
|
+
* form holding an isolated surrogate, a non-conforming language tag), as well as for an unexpected SPARQL Results
|
|
82
|
+
* JSON term
|
|
83
|
+
*
|
|
84
|
+
* Rollback is best-effort: a network or 5xx failure on rollback is swallowed, so the original task error propagates.
|
|
85
|
+
*
|
|
86
|
+
* > [!WARNING]
|
|
87
|
+
* > RDF4J Server does not apply `timeout` to updates issued within an {@link Repository.execute | execute} task,
|
|
88
|
+
* > so they always run to completion. Aborting the exchange through a custom `fetch` does not stop them either: the
|
|
89
|
+
* > update keeps running on the server, and the rollback waits for it to finish. Updates issued outside `execute`
|
|
90
|
+
* > honour `timeout`, so an update that needs a time bound has to run there, giving up transactional atomicity.
|
|
91
|
+
*
|
|
92
|
+
* @param options - Server URL, repository identifier and the operation settings applied to every exchange
|
|
93
|
+
* @param options.server - RDF4J Server base URL, for example `http://localhost:8080/rdf4j-server`
|
|
94
|
+
* @param options.repository - Repository identifier within the RDF4J Server instance
|
|
95
|
+
* @param options.infer - Whether operations take inferred statements into account; when omitted, RDF4J includes them
|
|
96
|
+
* wherever the repository computes them, so set it to `false` to restrict operations to explicit statements
|
|
97
|
+
* @param options.timeout - Maximum execution time of each operation, as a positive integer number of seconds; when
|
|
98
|
+
* omitted, operations run under the execution limit configured on the server, if any
|
|
99
|
+
* @param options.fetch - Custom `fetch` implementation used for every HTTP exchange, enabling header, auth, and
|
|
100
|
+
* exchange customisation; defaults to the global `fetch`
|
|
101
|
+
*
|
|
102
|
+
* @returns A {@link Repository} instance
|
|
103
|
+
*
|
|
104
|
+
* @throws TypeError if `timeout` is not a positive integer
|
|
105
|
+
*
|
|
106
|
+
* @see {@link https://rdf4j.org/documentation/reference/rest-api/#transactions RDF4J REST API — Transactions}
|
|
107
|
+
*/
|
|
108
|
+
export function createRDF4JRepository({ server, repository, infer, timeout, fetch = globalThis.fetch }) {
|
|
109
|
+
const $timeout = assert(timeout, timeout => timeout === undefined || Number.isInteger(timeout) && timeout > 0, `expected positive integer timeout <${timeout}>`);
|
|
110
|
+
const settings = new URLSearchParams([
|
|
111
|
+
...infer === undefined ? [] : [["infer", String(infer)]],
|
|
112
|
+
...$timeout === undefined ? [] : [["timeout", String($timeout)]]
|
|
113
|
+
]).toString();
|
|
114
|
+
const remote = createFetch(success(), transport(fetch));
|
|
115
|
+
const query = `${server}/repositories/${repository}`;
|
|
116
|
+
const update = `${query}/statements`;
|
|
117
|
+
const graphs = `${query}/rdf-graphs/service`;
|
|
118
|
+
const txns = `${query}/transactions`;
|
|
119
|
+
return immutable({
|
|
120
|
+
...createHTTPRepository({ query: configure(query), update: configure(update), graphs, fetch }),
|
|
121
|
+
async execute(task) {
|
|
122
|
+
const response = await remote(txns, { method: "POST" });
|
|
123
|
+
const location = response.headers.get("Location");
|
|
124
|
+
if (location === null) {
|
|
125
|
+
throw immutable({
|
|
126
|
+
status: response.status,
|
|
127
|
+
detail: `missing <Location> header in response to POST <${txns}>`
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
const txn = resolve(txns, location);
|
|
131
|
+
// transaction-scoped repository: an ordinary SPARQL-over-HTTP repository whose every exchange is retargeted
|
|
132
|
+
// onto the RDF4J transaction endpoint (`PUT <txn>?action=…`) by the transact() fetch wrapper, while graph
|
|
133
|
+
// store writes run as transaction `ADD` operations against that same endpoint
|
|
134
|
+
const http = createHTTPRepository({ query: txn, update: txn, fetch: transact(txn) });
|
|
135
|
+
const scoped = immutable({
|
|
136
|
+
...http,
|
|
137
|
+
merge: (triples, graph) => add(txn, triples, graph),
|
|
138
|
+
store: (triples, graph) => http.update(silent(drop(graph ?? "default"))).then(() => add(txn, triples, graph))
|
|
139
|
+
});
|
|
140
|
+
try {
|
|
141
|
+
const value = await task(scoped);
|
|
142
|
+
await remote(`${txn}?action=COMMIT`, { method: "PUT" });
|
|
143
|
+
return value;
|
|
144
|
+
}
|
|
145
|
+
catch (e) { // best-effort rollback — see TSDoc; swallow rollback errors so the task error propagates
|
|
146
|
+
await remote(txn, { method: "DELETE" }).catch(() => undefined);
|
|
147
|
+
throw e;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
/**
|
|
152
|
+
* Applies the configured operation settings to an RDF4J endpoint.
|
|
153
|
+
*
|
|
154
|
+
* @param url - Endpoint URL, possibly already carrying URL parameters
|
|
155
|
+
*
|
|
156
|
+
* @returns `url` extended with the `infer` and `timeout` parameters, or `url` itself when none is configured
|
|
157
|
+
*/
|
|
158
|
+
function configure(url) {
|
|
159
|
+
return settings === "" ? url : `${url}${url.includes("?") ? "&" : "?"}${settings}`;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Adds triples to a graph within an open RDF4J transaction.
|
|
163
|
+
*
|
|
164
|
+
* @param txn - Transaction endpoint URL from the start-transaction `Location` header
|
|
165
|
+
* @param triples - The triples to add; when empty, no exchange is issued
|
|
166
|
+
* @param graph - The IRI of the target graph; when omitted, the null context
|
|
167
|
+
*/
|
|
168
|
+
function add(txn, triples, graph) {
|
|
169
|
+
return triples.length === 0 ? Promise.resolve() : remote(configure(`${txn}?${new URLSearchParams([
|
|
170
|
+
["action", "ADD"],
|
|
171
|
+
["context", graph === undefined ? "null" : `<${graph}>`]
|
|
172
|
+
])}`), {
|
|
173
|
+
method: "PUT",
|
|
174
|
+
headers: { "Content-Type": NTriples },
|
|
175
|
+
body: encodeNTriples(triples)
|
|
176
|
+
}).then(() => { });
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Builds a {@link fetch} that retargets SPARQL-over-HTTP exchanges onto an open RDF4J transaction.
|
|
180
|
+
*
|
|
181
|
+
* The returned fetch rewrites every exchange to `PUT <txn>?action=…` with the configured operation settings,
|
|
182
|
+
* deriving the action from the request {@link operation} and lifting the SPARQL text into the PUT body so the
|
|
183
|
+
* mapping is independent of how the originating exchange was transmitted. The `Accept` header is forwarded so
|
|
184
|
+
* response negotiation (SPARQL Results JSON for `ask` and `select`, N-Triples for `construct`) is preserved.
|
|
185
|
+
*
|
|
186
|
+
* @param txn - Transaction endpoint URL from the start-transaction `Location` header
|
|
187
|
+
*
|
|
188
|
+
* @returns A {@link fetch} issuing every call as an operation against the transaction `txn`
|
|
189
|
+
*/
|
|
190
|
+
function transact(txn) {
|
|
191
|
+
return async (input, init) => {
|
|
192
|
+
const request = new Request(input, init);
|
|
193
|
+
const { action, sparql } = await operation(request);
|
|
194
|
+
const contentType = action === "UPDATE" ? SPARQLUpdate : SPARQLQuery;
|
|
195
|
+
const accept = request.headers.get("Accept");
|
|
196
|
+
const dataset = [...new URL(request.url).searchParams].filter(([name]) => DatasetParameters.has(name));
|
|
197
|
+
return fetch(configure(`${txn}?${new URLSearchParams([["action", action], ...dataset])}`), {
|
|
198
|
+
method: "PUT",
|
|
199
|
+
headers: accept === null
|
|
200
|
+
? { "Content-Type": contentType }
|
|
201
|
+
: { "Content-Type": contentType, "Accept": accept },
|
|
202
|
+
body: sparql
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Extracts the SPARQL operation carried by a SPARQL 1.1 Protocol request.
|
|
208
|
+
*
|
|
209
|
+
* Normalises the three protocol request encodings into a uniform action/text pair: query-via-GET (SPARQL in the
|
|
210
|
+
* `query` URL parameter; GET never carries updates), URL-encoded form POST (SPARQL in the `query` or `update`
|
|
211
|
+
* field, whose name selects the action), and direct POST (SPARQL verbatim in the body, with the action on the
|
|
212
|
+
* `Content-Type`). A request carrying no SPARQL decodes to an empty `sparql` string.
|
|
213
|
+
*
|
|
214
|
+
* @param request - Originating SPARQL-over-HTTP request
|
|
215
|
+
*
|
|
216
|
+
* @returns The decoded operation: its `action` (`QUERY` or `UPDATE`) and the extracted `sparql` text
|
|
217
|
+
*/
|
|
218
|
+
async function operation(request) {
|
|
219
|
+
const contentType = request.headers.get("Content-Type") ?? "";
|
|
220
|
+
if (request.method === "GET") {
|
|
221
|
+
// query-via-GET: SPARQL in the `query` parameter; GET never carries updates
|
|
222
|
+
return { action: "QUERY", sparql: new URL(request.url).searchParams.get("query") ?? "" };
|
|
223
|
+
}
|
|
224
|
+
else if (contentType.startsWith("application/x-www-form-urlencoded")) {
|
|
225
|
+
// URL-encoded POST: SPARQL in the `query` or `update` field, whose name carries the operation
|
|
226
|
+
const form = new URLSearchParams(await request.text());
|
|
227
|
+
const update = form.get("update");
|
|
228
|
+
return update !== null
|
|
229
|
+
? { action: "UPDATE", sparql: update }
|
|
230
|
+
: { action: "QUERY", sparql: form.get("query") ?? "" };
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
// direct POST: SPARQL travels verbatim in the body, with the operation on the Content-Type
|
|
234
|
+
const sparql = await request.text();
|
|
235
|
+
return contentType === SPARQLUpdate
|
|
236
|
+
? { action: "UPDATE", sparql }
|
|
237
|
+
: { action: "QUERY", sparql };
|
|
238
|
+
}
|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ACvD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAElC,OAAO,MAAM,KAAK,IAAI;gBACrB,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE;gBACtC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;QAEzD,CAAC;aAAM,CAAC;YAEP,2FAA2F;YAE3F,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC;YAEpC,OAAO,WAAW,KAAK,YAAY;gBAClC,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE;gBAC9B,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;QAEhC,CAAC;IAEF,CAAC;AAEF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,61 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafctory/wire-sparql-rdf4j",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.13.2",
|
|
4
|
+
"description": "SPARQL connector for @grafctory/wire backed by an RDF4J Server repository.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"typescript",
|
|
7
|
+
"json-ld",
|
|
8
|
+
"model-driven",
|
|
9
|
+
"sparql",
|
|
10
|
+
"rdf4j"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://grafctory.github.io/wire/",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/grafctory/wire/issues",
|
|
15
|
+
"email": "info@grafctory.dev"
|
|
16
|
+
},
|
|
17
|
+
"license": "Apache-2.0",
|
|
18
|
+
"author": {
|
|
19
|
+
"name": "Metreeca",
|
|
20
|
+
"email": "info@metreeca.com",
|
|
21
|
+
"url": "https://www.metreeca.com/"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/grafctory/wire.git",
|
|
26
|
+
"directory": "packages/wire-sparql-rdf4j"
|
|
27
|
+
},
|
|
28
|
+
"type": "module",
|
|
29
|
+
"sideEffects": false,
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"@grafctory/source": "./src/index.ts",
|
|
33
|
+
"default": "./dist/index.js"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"README.md",
|
|
38
|
+
"LICENSE",
|
|
39
|
+
"dist"
|
|
40
|
+
],
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=22.22.0"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"clean": "ush rm dist docs node_modules",
|
|
46
|
+
"build": "ush rm dist && tsc -p tsconfig.build.json",
|
|
47
|
+
"check": "npx vitest --typecheck run"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@grafctory/core": "^0.14.0",
|
|
51
|
+
"@grafctory/http": "^0.6.0",
|
|
52
|
+
"@grafctory/trio": "^0.3.0",
|
|
53
|
+
"@grafctory/wire-sparql": "^0.13.2",
|
|
54
|
+
"@grafctory/wire-sparql-http": "^0.13.2"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"typescript": "^6.0.3",
|
|
58
|
+
"vitest": "^4.0.13"
|
|
59
|
+
},
|
|
60
|
+
"peerDependencies": null
|
|
61
|
+
}
|