@grafctory/wire-sparql-http 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 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,63 @@
1
- # Temporary Holding Version
1
+ # @grafctory/wire-sparql-http
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![npm](https://img.shields.io/npm/v/@grafctory/wire-sparql-http)](https://www.npmjs.com/package/@grafctory/wire-sparql-http)
4
+
5
+ SPARQL connector for [@grafctory/wire](https://github.com/grafctory/wire) backed by a SPARQL 1.1 Protocol endpoint.
6
+
7
+ Exposes any [SPARQL 1.1 Protocol](https://www.w3.org/TR/sparql11-protocol/) compliant endpoint through the common
8
+ [@grafctory/wire-sparql] `Repository` interface, issuing each query and update as a single HTTP request. For [RDF4J
9
+ Server](https://rdf4j.org/) repositories with server-managed transactions, use the companion
10
+ [@grafctory/wire-sparql-rdf4j] connector.
11
+
12
+ # Installation
13
+
14
+ ```shell
15
+ npm install @grafctory/wire-sparql # the SPARQL query API
16
+ npm install @grafctory/wire-sparql-http # 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 a SPARQL 1.1 Protocol endpoint with `createHTTPRepository`, then issue queries and updates through the
27
+ [@grafctory/wire-sparql] `Repository` API:
28
+
29
+ ```typescript
30
+ import { createHTTPRepository } from "@grafctory/wire-sparql-http";
31
+
32
+ const repository = createHTTPRepository({
33
+ query: "https://example.org/sparql",
34
+ update: "https://example.org/sparql/statements"
35
+ });
36
+ ```
37
+
38
+ The optional `graphs` setting names a [Graph Store Protocol](https://www.w3.org/TR/sparql11-http-rdf-update/) endpoint,
39
+ where `merge` and `store` upload their triples in bulk. Without it, they run as SPARQL updates on the `update` endpoint,
40
+ with the same effect on the store, but with the data parsed as SPARQL text and sent as a single update request.
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 provides no transaction isolation: the SPARQL 1.1 Protocol exposes no transaction primitives, so each query and update is
48
+ > dispatched eagerly as a single HTTP request and `execute` runs its task directly, without bracketing. A
49
+ > multi-statement update is atomic only insofar as the endpoint applies it atomically.
50
+
51
+ [@grafctory/wire-sparql]: https://grafctory.github.io/wire/modules/_grafctory_wire-sparql.html
52
+
53
+ [@grafctory/wire-sparql-rdf4j]: https://grafctory.github.io/wire/modules/_grafctory_wire-sparql-rdf4j.html
54
+
55
+ # Support
56
+
57
+ - open an [issue](https://github.com/grafctory/wire/issues) to report a problem or to suggest a new feature
58
+ - start a [discussion](https://github.com/grafctory/wire/discussions) to ask a how-to question or to share an idea
59
+
60
+ # License
61
+
62
+ This project is licensed under the Apache 2.0 License –
63
+ see [LICENSE](https://github.com/grafctory/wire?tab=Apache-2.0-1-ov-file) file for details.
@@ -0,0 +1,87 @@
1
+ /**
2
+ * SPARQL Results JSON wire types and decoders.
3
+ *
4
+ * Backs the `index` module with the {@link SPARQLBoolean}, {@link SPARQLBindings}, and {@link SPARQLBinding}
5
+ * wire-document types and the {@link decodeTuples} and {@link decodeTerm} decoders that translate SPARQL 1.1 Query
6
+ * Results JSON into the {@link @grafctory/wire-sparql!index.Tuple | Tuple} and {@link @grafctory/trio!Term | Term}
7
+ * model.
8
+ *
9
+ * @module
10
+ *
11
+ * @see {@link https://www.w3.org/TR/sparql11-results-json/ SPARQL 1.1 Query Results JSON Format}
12
+ */
13
+ import { type Scope } from "@grafctory/core/scope";
14
+ import { type Blank, type Term } from "@grafctory/trio";
15
+ import { type Tuple } from "@grafctory/wire-sparql";
16
+ /**
17
+ * Boolean Results document for an `ASK` query, encoded in the SPARQL 1.1 Query Results JSON Format.
18
+ *
19
+ * @see {@link https://www.w3.org/TR/sparql11-results-json/#ask SPARQL Results JSON §3.2 — Boolean Results}
20
+ */
21
+ export type SPARQLBoolean = {
22
+ readonly boolean: boolean;
23
+ };
24
+ /**
25
+ * Variable Binding Results document for a `SELECT` query, encoded in the SPARQL 1.1 Query Results JSON Format.
26
+ *
27
+ * Restricted to the `results.bindings` projection: `head.vars` is intentionally omitted because the
28
+ * {@link Tuple} surface carries the variable identity through the row keys.
29
+ *
30
+ * @see {@link https://www.w3.org/TR/sparql11-results-json/#select SPARQL Results JSON §3.1 — Variable Binding Results}
31
+ */
32
+ export type SPARQLBindings = {
33
+ readonly results: {
34
+ readonly bindings: ReadonlyArray<{
35
+ readonly [variable: string]: SPARQLBinding;
36
+ }>;
37
+ };
38
+ };
39
+ /**
40
+ * RDF term in the SPARQL Results JSON wire encoding.
41
+ *
42
+ * Tolerates two legacy endpoint quirks: language tags may arrive under either `xml:lang` (canonical) or `lang`, and
43
+ * the `typed-literal` value of `type` is accepted as an alias of `literal`.
44
+ *
45
+ * @see {@link https://www.w3.org/TR/sparql11-results-json/#select-encode-terms SPARQL Results JSON
46
+ * — Encoding RDF Terms}
47
+ */
48
+ export type SPARQLBinding = {
49
+ readonly type: "uri" | "literal" | "typed-literal" | "bnode";
50
+ readonly value: string;
51
+ readonly "xml:lang"?: string;
52
+ readonly lang?: string;
53
+ readonly datatype?: string;
54
+ };
55
+ /**
56
+ * Decodes a {@link SPARQLBindings} value into the {@link Tuple} sequence produced for SPARQL `SELECT` results.
57
+ *
58
+ * Variable names are decoded from the wire string keys into {@link @grafctory/wire-sparql!index.Variable | Variable}
59
+ * tokens via {@link variable}. A single blank-node {@link createScope | scope}, shared across all rows, correlates
60
+ * `bnode` labels over the whole result set.
61
+ *
62
+ * @param value - Wire representation of a `SELECT` result set
63
+ *
64
+ * @returns The decoded solution sequence
65
+ *
66
+ * @throws RangeError if any variable name fails {@link variable} decoding or any binding fails
67
+ * {@link decodeTerm} decoding
68
+ */
69
+ export declare function decodeTuples(value: SPARQLBindings): readonly Tuple[];
70
+ /**
71
+ * Decodes a {@link SPARQLBinding} into an RDF {@link Term}.
72
+ *
73
+ * Decodes a `bnode` binding to a scope-numbered {@link @grafctory/trio!Blank | Blank}, minting one node per distinct
74
+ * label from `blanks` so repeats of one label correlate to the same node. The `uri` value is validated through
75
+ * {@link named}, and a literal's lexical form, language tag and `datatype` IRI through {@link tagged} and
76
+ * {@link typed}, while an unrecognised `type` is rejected.
77
+ *
78
+ * @param value - Wire representation of an RDF term
79
+ * @param blanks - The blank-node {@link Scope} correlating `bnode` labels; defaults to a fresh per-call scope
80
+ *
81
+ * @returns The decoded term
82
+ *
83
+ * @throws RangeError if `value.type` is unsupported, if the `uri` value or a `datatype` IRI is relative or malformed,
84
+ * if a lexical form holds an isolated UTF-16 surrogate code point, or if a language tag is not well-formed BCP 47
85
+ */
86
+ export declare function decodeTerm(value: SPARQLBinding, blanks?: Scope<Blank>): Term;
87
+ //# sourceMappingURL=index.core.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.core.d.ts","sourceRoot":"","sources":["../src/index.core.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAe,KAAK,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,KAAK,KAAK,EAAwB,KAAK,IAAI,EAAS,MAAM,iBAAiB,CAAC;AACrF,OAAO,EAAE,KAAK,KAAK,EAAY,MAAM,wBAAwB,CAAC;AAG9D;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG;IAE3B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAE1B,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG;IAE5B,QAAQ,CAAC,OAAO,EAAE;QAEjB,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;YAEhC,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,aAAa,CAAC;SAE3C,CAAC,CAAC;KAEH,CAAC;CAEF,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,aAAa,GAAG;IAE3B,QAAQ,CAAC,IAAI,EAAE,KAAK,GAAG,SAAS,GAAG,eAAe,GAAG,OAAO,CAAC;IAC7D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAE3B,CAAC;AAKF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,KAAK,EAAE,CAQpE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,GAAE,KAAK,CAAC,KAAK,CAAsB,GAAG,IAAI,CAkChG"}
@@ -0,0 +1,89 @@
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
+ * SPARQL Results JSON wire types and decoders.
18
+ *
19
+ * Backs the `index` module with the {@link SPARQLBoolean}, {@link SPARQLBindings}, and {@link SPARQLBinding}
20
+ * wire-document types and the {@link decodeTuples} and {@link decodeTerm} decoders that translate SPARQL 1.1 Query
21
+ * Results JSON into the {@link @grafctory/wire-sparql!index.Tuple | Tuple} and {@link @grafctory/trio!Term | Term}
22
+ * model.
23
+ *
24
+ * @module
25
+ *
26
+ * @see {@link https://www.w3.org/TR/sparql11-results-json/ SPARQL 1.1 Query Results JSON Format}
27
+ */
28
+ import { createScope } from "@grafctory/core/scope";
29
+ import { blank, named, tagged, typed } from "@grafctory/trio";
30
+ import { variable } from "@grafctory/wire-sparql";
31
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
32
+ /**
33
+ * Decodes a {@link SPARQLBindings} value into the {@link Tuple} sequence produced for SPARQL `SELECT` results.
34
+ *
35
+ * Variable names are decoded from the wire string keys into {@link @grafctory/wire-sparql!index.Variable | Variable}
36
+ * tokens via {@link variable}. A single blank-node {@link createScope | scope}, shared across all rows, correlates
37
+ * `bnode` labels over the whole result set.
38
+ *
39
+ * @param value - Wire representation of a `SELECT` result set
40
+ *
41
+ * @returns The decoded solution sequence
42
+ *
43
+ * @throws RangeError if any variable name fails {@link variable} decoding or any binding fails
44
+ * {@link decodeTerm} decoding
45
+ */
46
+ export function decodeTuples(value) {
47
+ const blanks = createScope(blank);
48
+ return value.results.bindings.map(row => Object.fromEntries(Object.entries(row).map(([name, binding]) => [variable(name), decodeTerm(binding, blanks)])));
49
+ }
50
+ /**
51
+ * Decodes a {@link SPARQLBinding} into an RDF {@link Term}.
52
+ *
53
+ * Decodes a `bnode` binding to a scope-numbered {@link @grafctory/trio!Blank | Blank}, minting one node per distinct
54
+ * label from `blanks` so repeats of one label correlate to the same node. The `uri` value is validated through
55
+ * {@link named}, and a literal's lexical form, language tag and `datatype` IRI through {@link tagged} and
56
+ * {@link typed}, while an unrecognised `type` is rejected.
57
+ *
58
+ * @param value - Wire representation of an RDF term
59
+ * @param blanks - The blank-node {@link Scope} correlating `bnode` labels; defaults to a fresh per-call scope
60
+ *
61
+ * @returns The decoded term
62
+ *
63
+ * @throws RangeError if `value.type` is unsupported, if the `uri` value or a `datatype` IRI is relative or malformed,
64
+ * if a lexical form holds an isolated UTF-16 surrogate code point, or if a language tag is not well-formed BCP 47
65
+ */
66
+ export function decodeTerm(value, blanks = createScope(blank)) {
67
+ if (value.type === "bnode") {
68
+ return blanks.resolve(value.value);
69
+ }
70
+ else if (value.type === "uri") {
71
+ return named(value.value);
72
+ }
73
+ else if (value.type === "literal" || value.type === "typed-literal") {
74
+ const language = value["xml:lang"] ?? value.lang;
75
+ if (language !== undefined) {
76
+ return tagged(value.value, language);
77
+ }
78
+ else if (value.datatype !== undefined) {
79
+ return typed(value.value, value.datatype);
80
+ }
81
+ else {
82
+ return typed(value.value);
83
+ }
84
+ }
85
+ else {
86
+ throw new RangeError(`unsupported term type <${value.type}>`);
87
+ }
88
+ }
89
+ //# sourceMappingURL=index.core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.core.js","sourceRoot":"","sources":["../src/index.core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,WAAW,EAAc,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAc,KAAK,EAAE,KAAK,EAAE,MAAM,EAAa,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACrF,OAAO,EAAc,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAwD9D,wHAAwH;AAExH;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,YAAY,CAAC,KAAqB;IAEjD,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IAElC,OAAO,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,WAAW,CAC1D,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC,O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
5
+ *
6
+ * Each query and update is dispatched eagerly as a single HTTP request. A {@link Dataset} is sent as protocol
7
+ * parameters added to any the endpoint URL already carries: `default-graph-uri` and `named-graph-uri` on queries,
8
+ * `using-graph-uri` and `using-named-graph-uri` on updates. An endpoint rejecting an update that declares its own
9
+ * dataset as well fails like any other non-2xx response, rejecting with a {@link Problem} carrying the wire status.
10
+ *
11
+ * {@link Repository.merge | merge} and {@link Repository.store | store} upload their triples as N-Triples to the
12
+ * Graph Store Protocol endpoint, when one is configured. Without one, they run as `INSERT DATA` updates on the update
13
+ * endpoint, preceded by `DROP SILENT` for `store`. Every SPARQL 1.1 Protocol endpoint supports this fallback, at the
14
+ * price of parsing the data as SPARQL text. A `merge` of no triples issues no request to either endpoint.
15
+ *
16
+ * > [!IMPORTANT]
17
+ * > **Transaction Isolation** — None. The SPARQL 1.1 Protocol exposes no transaction primitives.
18
+ *
19
+ * **Error handling** — every HTTP exchange is funnelled through {@link createFetch}, so:
20
+ *
21
+ * - Network failures (DNS, refused connection, TLS, abort) reject with a {@link Problem} carrying `status: 0`
22
+ * - Non-2xx responses reject with a {@link Problem} carrying the wire status, the response `statusText` as `detail`,
23
+ * and the parsed body (RFC 7807 JSON, plain text, or omitted) as `report`
24
+ * - Malformed JSON in a 2xx `ask`/`select` response rejects with a synthesised {@link Problem} carrying the response
25
+ * status and a parse-failure `detail`
26
+ * - A 2xx `construct` response whose `Content-Type` is not N-Triples rejects with a synthesised {@link Problem}
27
+ * - A malformed result payload surfaces the decoder's own error: a `SyntaxError` for ill-formed N-Triples, or a
28
+ * `RangeError` for a term component either syntax admits but the RDF data model rejects (a relative IRI, a lexical
29
+ * form holding an isolated surrogate, a non-conforming language tag), as well as for an unrecognised SPARQL Results
30
+ * JSON binding
31
+ *
32
+ * @param options - Endpoint URLs and the optional `fetch` override
33
+ * @param options.query - SPARQL query endpoint URL, for example `http://localhost:7200/repositories/my-repo`
34
+ * @param options.update - SPARQL update endpoint URL; defaults to `query` when omitted
35
+ * @param options.graphs - Graph Store Protocol endpoint URL, for example
36
+ * `http://localhost:7200/repositories/my-repo/rdf-graphs/service`; when omitted, graph store writes run as SPARQL
37
+ * updates on the `update` endpoint, with the same effect on the store but no bulk upload of the data
38
+ * @param options.fetch - Custom `fetch` implementation used for every HTTP exchange, enabling header, auth, and
39
+ * exchange customisation; defaults to the global `fetch`
40
+ *
41
+ * @returns An immutable {@link Repository} backed by the configured endpoints
42
+ */
43
+ export declare function createHTTPRepository({ query: queryURL, update: updateURL, graphs: graphsURL, fetch }: {
44
+ readonly query: string;
45
+ readonly update?: string;
46
+ readonly graphs?: string;
47
+ readonly fetch?: typeof globalThis.fetch;
48
+ }): Repository;
49
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAsCA,OAAO,EAEN,KAAK,UAAU,EAKf,MAAM,wBAAwB,CAAC;AAKhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAgB,oBAAoB,CAAC,EAEpC,KAAK,EAAE,QAAQ,EAEf,MAAM,EAAE,SAAoB,EAC5B,MAAM,EAAE,SAAS,EAEjB,KAAwB,EAExB,EAAE;IAEF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAEzB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CAEzC,GAAG,UAAU,CA+Lb"}
package/dist/index.js ADDED
@@ -0,0 +1,197 @@
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://www.w3.org/TR/sparql11-protocol/ SPARQL 1.1 Protocol} endpoint connector for the
18
+ * {@link https://github.com/grafctory/wire @grafctory/wire} storage connector collection.
19
+ *
20
+ * Exposes any SPARQL 1.1 Protocol compliant endpoint through the common {@link Repository} API.
21
+ *
22
+ * > [!IMPORTANT]
23
+ * > **Transaction Isolation** — None. The SPARQL 1.1 Protocol exposes no transaction primitives.
24
+ *
25
+ * @module index
26
+ *
27
+ * @see {@link https://www.w3.org/TR/sparql11-protocol/ SPARQL 1.1 Protocol}
28
+ */
29
+ import { isError } from "@grafctory/core";
30
+ import { immutable } from "@grafctory/core/values";
31
+ import { createFetch } from "@grafctory/http";
32
+ import { success } from "@grafctory/http/success";
33
+ import { transport } from "@grafctory/http/transport";
34
+ import { decodeNTriples, encodeNTriples, NTriples } from "@grafctory/trio/ntriples";
35
+ import { SPARQLQuery, SPARQLResults, SPARQLUpdate } from "@grafctory/wire-sparql";
36
+ import { data, drop, graph, insert, reference, silent, triples, update } from "@grafctory/wire-sparql/builder";
37
+ import { decodeTuples } from "./index.core.js";
38
+ /**
39
+ * Creates an HTTP-based {@link Repository} backed by a
40
+ * {@link https://www.w3.org/TR/sparql11-protocol/ SPARQL 1.1 Protocol} endpoint.
41
+ *
42
+ * Each query and update is dispatched eagerly as a single HTTP request. A {@link Dataset} is sent as protocol
43
+ * parameters added to any the endpoint URL already carries: `default-graph-uri` and `named-graph-uri` on queries,
44
+ * `using-graph-uri` and `using-named-graph-uri` on updates. An endpoint rejecting an update that declares its own
45
+ * dataset as well fails like any other non-2xx response, rejecting with a {@link Problem} carrying the wire status.
46
+ *
47
+ * {@link Repository.merge | merge} and {@link Repository.store | store} upload their triples as N-Triples to the
48
+ * Graph Store Protocol endpoint, when one is configured. Without one, they run as `INSERT DATA` updates on the update
49
+ * endpoint, preceded by `DROP SILENT` for `store`. Every SPARQL 1.1 Protocol endpoint supports this fallback, at the
50
+ * price of parsing the data as SPARQL text. A `merge` of no triples issues no request to either endpoint.
51
+ *
52
+ * > [!IMPORTANT]
53
+ * > **Transaction Isolation** — None. The SPARQL 1.1 Protocol exposes no transaction primitives.
54
+ *
55
+ * **Error handling** — every HTTP exchange is funnelled through {@link createFetch}, so:
56
+ *
57
+ * - Network failures (DNS, refused connection, TLS, abort) reject with a {@link Problem} carrying `status: 0`
58
+ * - Non-2xx responses reject with a {@link Problem} carrying the wire status, the response `statusText` as `detail`,
59
+ * and the parsed body (RFC 7807 JSON, plain text, or omitted) as `report`
60
+ * - Malformed JSON in a 2xx `ask`/`select` response rejects with a synthesised {@link Problem} carrying the response
61
+ * status and a parse-failure `detail`
62
+ * - A 2xx `construct` response whose `Content-Type` is not N-Triples rejects with a synthesised {@link Problem}
63
+ * - A malformed result payload surfaces the decoder's own error: a `SyntaxError` for ill-formed N-Triples, or a
64
+ * `RangeError` for a term component either syntax admits but the RDF data model rejects (a relative IRI, a lexical
65
+ * form holding an isolated surrogate, a non-conforming language tag), as well as for an unrecognised SPARQL Results
66
+ * JSON binding
67
+ *
68
+ * @param options - Endpoint URLs and the optional `fetch` override
69
+ * @param options.query - SPARQL query endpoint URL, for example `http://localhost:7200/repositories/my-repo`
70
+ * @param options.update - SPARQL update endpoint URL; defaults to `query` when omitted
71
+ * @param options.graphs - Graph Store Protocol endpoint URL, for example
72
+ * `http://localhost:7200/repositories/my-repo/rdf-graphs/service`; when omitted, graph store writes run as SPARQL
73
+ * updates on the `update` endpoint, with the same effect on the store but no bulk upload of the data
74
+ * @param options.fetch - Custom `fetch` implementation used for every HTTP exchange, enabling header, auth, and
75
+ * exchange customisation; defaults to the global `fetch`
76
+ *
77
+ * @returns An immutable {@link Repository} backed by the configured endpoints
78
+ */
79
+ export function createHTTPRepository({ query: queryURL, update: updateURL = queryURL, graphs: graphsURL, fetch = globalThis.fetch }) {
80
+ const remote = createFetch(success(), transport(fetch));
81
+ const repository = immutable({
82
+ async ask(query, dataset) {
83
+ const result = await json(await post(queries(dataset), SPARQLQuery, query, SPARQLResults));
84
+ return result.boolean;
85
+ },
86
+ async select(query, dataset) {
87
+ return decodeTuples(await json(await post(queries(dataset), SPARQLQuery, query, SPARQLResults)));
88
+ },
89
+ async construct(query, dataset) {
90
+ const response = await post(queries(dataset), SPARQLQuery, query, NTriples);
91
+ const contentType = response.headers.get("Content-Type") ?? "";
92
+ if (contentType.startsWith(NTriples)) {
93
+ return decodeNTriples(await response.text());
94
+ }
95
+ else {
96
+ throw immutable({
97
+ status: response.status,
98
+ detail: `unsupported response Content-Type <${contentType}> from <${response.url}>`
99
+ });
100
+ }
101
+ },
102
+ update(update, dataset) {
103
+ return post(updates(dataset), SPARQLUpdate, update);
104
+ },
105
+ merge(triples, graph) {
106
+ return triples.length === 0 ? Promise.resolve()
107
+ : graphsURL === undefined ? post(updateURL, SPARQLUpdate, inserting(triples, graph))
108
+ : upload(graphsURL, "POST", triples, graph);
109
+ },
110
+ store(triples, graph) {
111
+ return graphsURL === undefined ? post(updateURL, SPARQLUpdate, storing(triples, graph))
112
+ : upload(graphsURL, "PUT", triples, graph);
113
+ },
114
+ execute(task) {
115
+ return Promise.resolve(task(repository)); // no transaction support, run the task directly
116
+ },
117
+ close() {
118
+ return Promise.resolve();
119
+ }
120
+ });
121
+ return repository;
122
+ /**
123
+ * Targets the query endpoint at a dataset, as the `default-graph-uri` and `named-graph-uri` parameters.
124
+ */
125
+ function queries(dataset = {}) {
126
+ return target(queryURL, [
127
+ ...(dataset.default ?? []).map(iri => ["default-graph-uri", iri]),
128
+ ...(dataset.named ?? []).map(iri => ["named-graph-uri", iri])
129
+ ]);
130
+ }
131
+ /**
132
+ * Targets the update endpoint at a dataset, as the `using-graph-uri` and `using-named-graph-uri` parameters.
133
+ */
134
+ function updates(dataset = {}) {
135
+ return target(updateURL, [
136
+ ...(dataset.default ?? []).map(iri => ["using-graph-uri", iri]),
137
+ ...(dataset.named ?? []).map(iri => ["using-named-graph-uri", iri])
138
+ ]);
139
+ }
140
+ /**
141
+ * Extends an endpoint URL, possibly already carrying URL parameters, with further parameters.
142
+ */
143
+ function target(url, parameters) {
144
+ return parameters.length === 0 ? url
145
+ : `${url}${url.includes("?") ? "&" : "?"}${new URLSearchParams([...parameters])}`;
146
+ }
147
+ /**
148
+ * Renders a graph store merge as an `INSERT DATA` update.
149
+ */
150
+ function inserting(statements, target) {
151
+ return update(insert(data(target === undefined
152
+ ? triples(statements)
153
+ : graph(reference(target), triples(statements)))));
154
+ }
155
+ /**
156
+ * Renders a graph store replacement as a `DROP SILENT` update followed by an `INSERT DATA` one.
157
+ */
158
+ function storing(statements, target) {
159
+ return update(silent(drop(target ?? "default")), inserting(statements, target));
160
+ }
161
+ /**
162
+ * Uploads triples as N-Triples to a Graph Store Protocol endpoint, identifying the target graph indirectly.
163
+ */
164
+ async function upload(url, method, statements, target) {
165
+ await remote(`${url}${url.includes("?") ? "&" : "?"}${target === undefined
166
+ ? "default"
167
+ : new URLSearchParams([["graph", target]])}`, {
168
+ method,
169
+ headers: { "Content-Type": NTriples },
170
+ body: encodeNTriples(statements)
171
+ });
172
+ }
173
+ async function post(url, contentType, body, accept) {
174
+ const response = await remote(url, {
175
+ method: "POST",
176
+ headers: accept === undefined
177
+ ? { "Content-Type": contentType }
178
+ : { "Content-Type": contentType, "Accept": accept },
179
+ body
180
+ });
181
+ if (accept !== undefined) {
182
+ return response;
183
+ }
184
+ }
185
+ async function json(response) {
186
+ try {
187
+ return await response.json();
188
+ }
189
+ catch (e) {
190
+ throw immutable({
191
+ status: response.status,
192
+ detail: `malformed JSON response from <${response.url}>: ${isError(e) ? e.message : String(e)}`
193
+ });
194
+ }
195
+ }
196
+ }
197
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sour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CAAC,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAC1C,EAAE,EAAE;YAEH,MAAM;YAEN,OAAO,EAAE,EAAE,cAAc,EAAE,QAAQ,EAAE;YAErC,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC;SAEhC,CAAC,CAAC;IAEJ,CAAC;IAID,KAAK,UAAU,IAAI,CAAC,GAAW,EAAE,WAAmB,EAAE,IAAY,EAAE,MAAe;QAElF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,EAAE;YAElC,MAAM,EAAE,MAAM;YAEd,OAAO,EAAE,MAAM,KAAK,SAAS;gBAC5B,CAAC,CAAC,EAAE,cAAc,EAAE,WAAW,EAAE;gBACjC,CAAC,CAAC,EAAE,cAAc,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE;YAEpD,IAAI;SAEJ,CAAC,CAAC;QAEH,IAAK,MAAM,KAAK,SAAS,EAAG,CAAC;YAE5B,OAAO,QAAQ,CAAC;QAEjB,CAAC;IAEF,CAAC;IAED,KAAK,UAAU,IAAI,CAAI,QAAkB;QAExC,IAAI,CAAC;YAEJ,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAE9B,CAAC;QAAC,OAAQ,CAAC,EAAG,CAAC;YAEd,MAAM,SAAS,CAAU;gBACxB,MAAM,EAAE,QAAQ,CAAC,MAAM;gBACvB,MAAM,EAAE,iCAAiC,QAAQ,CAAC,GAAG,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;aAC/F,CAAC,CAAC;QAEJ,CAAC;IAEF,CAAC;AAEF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,60 @@
1
1
  {
2
2
  "name": "@grafctory/wire-sparql-http",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.13.2",
4
+ "description": "SPARQL connector for @grafctory/wire backed by a SPARQL 1.1 Protocol endpoint.",
5
+ "keywords": [
6
+ "typescript",
7
+ "json-ld",
8
+ "model-driven",
9
+ "sparql",
10
+ "http"
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-http"
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
+ },
55
+ "devDependencies": {
56
+ "typescript": "^6.0.3",
57
+ "vitest": "^4.0.13"
58
+ },
59
+ "peerDependencies": null
60
+ }