@seedprotocol/rdf 0.0.0-stage → 0.8.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/CHANGELOG.md +15 -0
- package/README.md +191 -2
- package/dist/bin.d.ts +2 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +124 -0
- package/dist/bin.js.map +1 -0
- package/dist/cli.d.ts +11 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/graph.d.ts +65 -0
- package/dist/graph.d.ts.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +388 -0
- package/dist/index.js.map +1 -0
- package/dist/iri.d.ts +32 -0
- package/dist/iri.d.ts.map +1 -0
- package/dist/jsonld.d.ts +12 -0
- package/dist/jsonld.d.ts.map +1 -0
- package/dist/lens.d.ts +71 -0
- package/dist/lens.d.ts.map +1 -0
- package/dist/names.d.ts +12 -0
- package/dist/names.d.ts.map +1 -0
- package/dist/quads.d.ts +12 -0
- package/dist/quads.d.ts.map +1 -0
- package/dist/shacl.d.ts +17 -0
- package/dist/shacl.d.ts.map +1 -0
- package/dist/sidecar-BjHSnqHK.js +255 -0
- package/dist/sidecar-BjHSnqHK.js.map +1 -0
- package/dist/sidecar.d.ts +77 -0
- package/dist/sidecar.d.ts.map +1 -0
- package/dist/turtle.d.ts +7 -0
- package/dist/turtle.d.ts.map +1 -0
- package/dist/vocabulary.d.ts +6 -0
- package/dist/vocabulary.d.ts.map +1 -0
- package/package.json +75 -4
package/dist/quads.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type * as RDF from '@rdfjs/types';
|
|
2
|
+
import type { StateGraph } from './graph.js';
|
|
3
|
+
/**
|
|
4
|
+
* The graph as RDF/JS quads (`@rdfjs/types`), all in the default graph, for N3.js, Comunica,
|
|
5
|
+
* Oxigraph or rdf-ext. List cells are blank nodes labelled `l0`, `l1`, … in the order written.
|
|
6
|
+
*/
|
|
7
|
+
export declare function toQuads(graph: StateGraph): RDF.Quad[];
|
|
8
|
+
/** A string's characters escaped for a double-quoted N-Triples or Turtle literal. */
|
|
9
|
+
export declare const escapeLiteral: (value: string) => string;
|
|
10
|
+
/** N-Quads (RDF 1.1), one statement per line, in the order of `toQuads`. */
|
|
11
|
+
export declare function toNQuads(graph: StateGraph): string;
|
|
12
|
+
//# sourceMappingURL=quads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quads.d.ts","sourceRoot":"","sources":["../src/quads.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAA;AACxC,OAAO,KAAK,EAAa,UAAU,EAAE,MAAM,YAAY,CAAA;AAyEvD;;;GAGG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,UAAU,GAAG,GAAG,CAAC,IAAI,EAAE,CAyBrD;AAED,qFAAqF;AACrF,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,KAAG,MAC8D,CAAA;AAY5G,4EAA4E;AAC5E,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAIlD"}
|
package/dist/shacl.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type RdfLens } from './lens.js';
|
|
2
|
+
export type ShaclOptions = {
|
|
3
|
+
/** Base of the protocol IRIs, as given to the export. Default PROVISIONAL_BASE_IRI. */
|
|
4
|
+
base?: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* SHACL 2017 shapes in Turtle for state graphs exported with `lens`: one `sh:NodeShape` per model,
|
|
8
|
+
* targeting the class the export gives its seeds (the mapped term, else `{base}c/{model}`), with a
|
|
9
|
+
* property shape per property on the predicate the export uses. Text, Number, Boolean and Date
|
|
10
|
+
* values get `sh:datatype` (a Number any of `xsd:integer`, `xsd:decimal` or `xsd:double`), and every
|
|
11
|
+
* property `sh:maxCount 1`. Relations, Image, File, Html and Json values must be IRIs; their class
|
|
12
|
+
* isn't checked, because the related seed is often not in the export. A List is checked as a
|
|
13
|
+
* well-formed `rdf:List`, and a List of relations' members must be IRIs. `required: true` adds
|
|
14
|
+
* `sh:minCount 1`. Pass a sidecar with no `terms` for shapes over the protocol IRIs.
|
|
15
|
+
*/
|
|
16
|
+
export declare function toShacl(lens: RdfLens, options?: ShaclOptions): string;
|
|
17
|
+
//# sourceMappingURL=shacl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shacl.d.ts","sourceRoot":"","sources":["../src/shacl.ts"],"names":[],"mappings":"AAGA,OAAO,EAA0C,KAAK,OAAO,EAAE,MAAM,WAAW,CAAA;AAoBhF,MAAM,MAAM,YAAY,GAAG;IACzB,uFAAuF;IACvF,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,GAAE,YAAiB,GAAG,MAAM,CA6DzE"}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { listRelationEasName as e } from "@seedprotocol/query";
|
|
2
|
+
import { easName as t, fuzzyNameKey as n, isNameMatchLevel as r, matchEasName as i } from "@seedprotocol/eas";
|
|
3
|
+
//#region src/iri.ts
|
|
4
|
+
var a = "https://w3id.org/seedprotocol/", o = "http://www.w3.org/1999/02/22-rdf-syntax-ns#", s = "http://www.w3.org/2001/XMLSchema#", c = "http://www.w3.org/ns/prov#", l = `${o}type`, u = `${o}first`, d = `${o}rest`, f = `${o}nil`, p = /[\u0000- <>"{}|^`\\]/;
|
|
5
|
+
function m(e, t) {
|
|
6
|
+
if (!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(e) || p.test(e)) throw TypeError(`${t} is not an absolute IRI: ${JSON.stringify(e)}`);
|
|
7
|
+
return e;
|
|
8
|
+
}
|
|
9
|
+
function h(e, t = a) {
|
|
10
|
+
if (!Number.isSafeInteger(e) || e <= 0) throw TypeError(`chainId must be a positive integer, got ${e}`);
|
|
11
|
+
if (m(t, "base"), !t.endsWith("/")) throw TypeError(`base must end with "/": ${t}`);
|
|
12
|
+
let n = (e) => encodeURIComponent(e);
|
|
13
|
+
return {
|
|
14
|
+
base: t,
|
|
15
|
+
chainId: e,
|
|
16
|
+
seed: `${t}ns#`,
|
|
17
|
+
attestation: (r) => `${t}eas/${e}/${n(r.toLowerCase())}`,
|
|
18
|
+
modelClass: (e) => `${t}c/${n(e)}`,
|
|
19
|
+
property: (e, r) => `${t}p/${n(e)}/${n(r)}`,
|
|
20
|
+
account: (t) => `did:pkh:eip155:${e}:${n(t.toLowerCase())}`
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/lens.ts
|
|
25
|
+
var g = (e) => JSON.stringify(e, (e, t) => t && typeof t == "object" && !Array.isArray(t) ? Object.fromEntries(Object.entries(t).sort(([e], [t]) => e < t ? -1 : +(e > t))) : t), _ = /* @__PURE__ */ new Set([
|
|
26
|
+
"relation",
|
|
27
|
+
"image",
|
|
28
|
+
"file",
|
|
29
|
+
"html",
|
|
30
|
+
"json",
|
|
31
|
+
"blob"
|
|
32
|
+
]), v = (...e) => e.find((e) => r(e));
|
|
33
|
+
function y(e) {
|
|
34
|
+
let t = /* @__PURE__ */ new Map();
|
|
35
|
+
for (let [n, r] of Object.entries(e["@context"] ?? {})) !n.startsWith("@") && typeof r == "string" && t.set(n, r);
|
|
36
|
+
return t;
|
|
37
|
+
}
|
|
38
|
+
function b(e, t) {
|
|
39
|
+
let n = e.indexOf(":"), r = n > 0 ? t.get(e.slice(0, n)) : void 0, i = r === void 0 ? e : r + e.slice(n + 1);
|
|
40
|
+
if (r !== void 0 || /^(?:[a-zA-Z][a-zA-Z0-9+.-]*:\/\/|urn:)/.test(e)) try {
|
|
41
|
+
return m(i, "term");
|
|
42
|
+
} catch {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function x({ schema: n, sidecar: r }) {
|
|
47
|
+
if (!n.id || n.id !== r.schemaId) throw TypeError(`The sidecar is for schema ${r.schemaId}, not ${n.id ?? "a schema with no id"}`);
|
|
48
|
+
let a = y(r), o = [], s = new Set(Object.keys(r.terms)), c = (e) => {
|
|
49
|
+
if (!e || r.terms[e] === void 0) return;
|
|
50
|
+
s.delete(e);
|
|
51
|
+
let t = b(r.terms[e], a);
|
|
52
|
+
return t || o.push(`Term "${r.terms[e]}" for ${e} isn't an IRI or a name with a known prefix`), t;
|
|
53
|
+
}, l = Object.entries(n.models).map(([r, i]) => {
|
|
54
|
+
let a = Object.entries(i.properties).map(([r, a]) => {
|
|
55
|
+
let o = (a.type ?? a.dataType ?? "").toLowerCase(), s = a.ref ?? a.refModelName;
|
|
56
|
+
return {
|
|
57
|
+
value: {
|
|
58
|
+
term: c(a.id),
|
|
59
|
+
dataType: o
|
|
60
|
+
},
|
|
61
|
+
name: o === "list" && s ? e(r, s) : t(r),
|
|
62
|
+
relation: _.has(o) || o === "list" && !!s,
|
|
63
|
+
level: v(a.nameMatch, i.nameMatch, n.nameMatch)
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
return {
|
|
67
|
+
value: {
|
|
68
|
+
term: c(i.id),
|
|
69
|
+
candidates: a
|
|
70
|
+
},
|
|
71
|
+
name: t(r),
|
|
72
|
+
level: v(i.nameMatch, n.nameMatch)
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
for (let e of s) o.push(`Term "${r.terms[e]}" names ${e}, which is no model or property in the schema`);
|
|
76
|
+
let u = (e) => {
|
|
77
|
+
o.includes(e) || o.push(e);
|
|
78
|
+
}, d = (e) => {
|
|
79
|
+
let t = i(e, l);
|
|
80
|
+
return t.kind === "ambiguous" && u(`Model "${e}" matches several models in the schema`), t.kind === "match" ? t.value : void 0;
|
|
81
|
+
};
|
|
82
|
+
return {
|
|
83
|
+
prefixes: a,
|
|
84
|
+
warnings: o,
|
|
85
|
+
classOf: (e) => d(e)?.term,
|
|
86
|
+
propertyOf(e, t) {
|
|
87
|
+
let n = d(e);
|
|
88
|
+
if (!n) return;
|
|
89
|
+
let r = i(t, n.candidates);
|
|
90
|
+
return r.kind === "ambiguous" && u(`Property "${t}" of ${e} matches several properties in the schema`), r.kind === "match" ? r.value : void 0;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region src/sidecar.ts
|
|
96
|
+
function S({ schema: e, sidecar: n }, r = {}) {
|
|
97
|
+
let i = y(n), a = (e) => {
|
|
98
|
+
let t = e ? n.terms[e] : void 0;
|
|
99
|
+
return t !== void 0 && b(t, i) ? t : void 0;
|
|
100
|
+
}, o = { "@version": 1.1 };
|
|
101
|
+
for (let [e, t] of Object.entries(n["@context"] ?? {})) (e.startsWith("@") || typeof t == "string") && (o[e] = t);
|
|
102
|
+
for (let [n, i] of Object.entries(e.models)) {
|
|
103
|
+
let e = {};
|
|
104
|
+
for (let [t, n] of Object.entries(i.properties)) {
|
|
105
|
+
let r = a(n.id);
|
|
106
|
+
if (!r) continue;
|
|
107
|
+
let i = (n.type ?? n.dataType ?? "").toLowerCase(), o = n.ref ?? n.refModelName, c = { "@id": r };
|
|
108
|
+
(_.has(i) || i === "list" && o) && (c["@type"] = "@id"), i === "date" && (c["@type"] = `${s}dateTime`), i === "list" && (c["@container"] = "@list"), e[t] = Object.keys(c).length === 1 ? r : c;
|
|
109
|
+
}
|
|
110
|
+
let c = a(i.id);
|
|
111
|
+
(c || Object.keys(e).length !== 0) && (n in o || (o[n] = {
|
|
112
|
+
"@id": c ?? h(1, r.base).modelClass(t(n)),
|
|
113
|
+
...Object.keys(e).length > 0 && { "@context": e }
|
|
114
|
+
}));
|
|
115
|
+
}
|
|
116
|
+
return o;
|
|
117
|
+
}
|
|
118
|
+
function C(e) {
|
|
119
|
+
return Object.entries(e.models).flatMap(([e, { id: t, properties: n }]) => [{
|
|
120
|
+
model: e,
|
|
121
|
+
id: t
|
|
122
|
+
}, ...Object.entries(n).map(([t, { id: n }]) => ({
|
|
123
|
+
model: e,
|
|
124
|
+
property: t,
|
|
125
|
+
id: n
|
|
126
|
+
}))]);
|
|
127
|
+
}
|
|
128
|
+
function w({ schema: e, sidecar: t }) {
|
|
129
|
+
if (!e.id || e.id !== t.schemaId) throw TypeError(`The sidecar is for schema ${t.schemaId}, not ${e.id ?? "a schema with no id"}`);
|
|
130
|
+
}
|
|
131
|
+
function T(e, t = {}) {
|
|
132
|
+
w(e);
|
|
133
|
+
let { schema: n, sidecar: r } = e, i = C(n), a = new Set(i.flatMap((e) => e.id ? [e.id] : [])), o = y(r), s = Object.entries(r.terms).map(([e, t]) => ({
|
|
134
|
+
id: e,
|
|
135
|
+
term: t
|
|
136
|
+
}));
|
|
137
|
+
return {
|
|
138
|
+
stale: s.filter(({ id: e }) => !a.has(e)),
|
|
139
|
+
invalid: s.filter(({ id: e, term: t }) => a.has(e) && !b(t, o)),
|
|
140
|
+
unmapped: i.filter((e) => !e.id || r.terms[e.id] === void 0),
|
|
141
|
+
contextOutdated: g(r["@context"] ?? {}) !== g(S(e, t)),
|
|
142
|
+
versionOutdated: n.version !== void 0 && r.schemaVersion !== n.version
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function E(e, t = {}) {
|
|
146
|
+
w(e);
|
|
147
|
+
let { schema: n, sidecar: r } = e, { schemaId: i, schemaVersion: a, terms: o, "@context": s, ...c } = r;
|
|
148
|
+
return {
|
|
149
|
+
schemaId: i,
|
|
150
|
+
...n.version === void 0 ? a !== void 0 && { schemaVersion: a } : { schemaVersion: n.version },
|
|
151
|
+
...c,
|
|
152
|
+
terms: o,
|
|
153
|
+
"@context": S(e, t)
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
var D = {
|
|
157
|
+
schema: "https://schema.org/",
|
|
158
|
+
dcterms: "http://purl.org/dc/terms/"
|
|
159
|
+
}, O = (e, t = !1) => Object.fromEntries(Object.entries(e).map(([e, r]) => [n(e, { relation: t }), r])), k = O({
|
|
160
|
+
post: "schema:BlogPosting",
|
|
161
|
+
blogpost: "schema:BlogPosting",
|
|
162
|
+
article: "schema:Article",
|
|
163
|
+
newsarticle: "schema:NewsArticle",
|
|
164
|
+
page: "schema:WebPage",
|
|
165
|
+
person: "schema:Person",
|
|
166
|
+
organization: "schema:Organization",
|
|
167
|
+
event: "schema:Event",
|
|
168
|
+
place: "schema:Place",
|
|
169
|
+
image: "schema:ImageObject",
|
|
170
|
+
video: "schema:VideoObject",
|
|
171
|
+
podcast: "schema:PodcastSeries",
|
|
172
|
+
episode: "schema:Episode",
|
|
173
|
+
book: "schema:Book",
|
|
174
|
+
comment: "schema:Comment"
|
|
175
|
+
}), A = O({
|
|
176
|
+
title: "dcterms:title",
|
|
177
|
+
headline: "schema:headline",
|
|
178
|
+
name: "schema:name",
|
|
179
|
+
summary: "dcterms:abstract",
|
|
180
|
+
abstract: "dcterms:abstract",
|
|
181
|
+
excerpt: "dcterms:abstract",
|
|
182
|
+
description: "dcterms:description",
|
|
183
|
+
subtitle: "schema:alternativeHeadline",
|
|
184
|
+
language: "dcterms:language",
|
|
185
|
+
lang: "dcterms:language",
|
|
186
|
+
license: "dcterms:license",
|
|
187
|
+
url: "schema:url",
|
|
188
|
+
link: "schema:url",
|
|
189
|
+
canonicalurl: "schema:url",
|
|
190
|
+
email: "schema:email",
|
|
191
|
+
keyword: "schema:keywords",
|
|
192
|
+
body: "schema:text",
|
|
193
|
+
content: "schema:text",
|
|
194
|
+
text: "schema:text"
|
|
195
|
+
}), j = O({
|
|
196
|
+
publishedat: "dcterms:issued",
|
|
197
|
+
datepublished: "dcterms:issued",
|
|
198
|
+
publishdate: "dcterms:issued",
|
|
199
|
+
issued: "dcterms:issued",
|
|
200
|
+
createdat: "dcterms:created",
|
|
201
|
+
created: "dcterms:created",
|
|
202
|
+
updatedat: "dcterms:modified",
|
|
203
|
+
modifiedat: "dcterms:modified",
|
|
204
|
+
modified: "dcterms:modified",
|
|
205
|
+
startdate: "schema:startDate",
|
|
206
|
+
enddate: "schema:endDate"
|
|
207
|
+
}), M = O({
|
|
208
|
+
author: "dcterms:creator",
|
|
209
|
+
creator: "dcterms:creator",
|
|
210
|
+
byline: "dcterms:creator",
|
|
211
|
+
contributor: "dcterms:contributor",
|
|
212
|
+
publisher: "dcterms:publisher",
|
|
213
|
+
editor: "schema:editor",
|
|
214
|
+
image: "schema:image",
|
|
215
|
+
coverimage: "schema:image",
|
|
216
|
+
featuredimage: "schema:image",
|
|
217
|
+
cover: "schema:image",
|
|
218
|
+
thumbnail: "schema:thumbnail",
|
|
219
|
+
html: "schema:text",
|
|
220
|
+
body: "schema:text",
|
|
221
|
+
content: "schema:text",
|
|
222
|
+
tag: "dcterms:subject",
|
|
223
|
+
category: "dcterms:subject",
|
|
224
|
+
categories: "dcterms:subject",
|
|
225
|
+
topic: "dcterms:subject",
|
|
226
|
+
source: "dcterms:source",
|
|
227
|
+
file: "schema:associatedMedia"
|
|
228
|
+
}, !0);
|
|
229
|
+
function N(e) {
|
|
230
|
+
w(e);
|
|
231
|
+
let { schema: t, sidecar: r } = e, i = [];
|
|
232
|
+
for (let [e, { id: a, properties: o }] of Object.entries(t.models)) {
|
|
233
|
+
let t = k[n(e)];
|
|
234
|
+
a && r.terms[a] === void 0 && t && i.push({
|
|
235
|
+
model: e,
|
|
236
|
+
id: a,
|
|
237
|
+
term: t
|
|
238
|
+
});
|
|
239
|
+
for (let [t, a] of Object.entries(o)) {
|
|
240
|
+
if (!a.id || r.terms[a.id] !== void 0) continue;
|
|
241
|
+
let o = (a.type ?? a.dataType ?? "").toLowerCase(), s = _.has(o) || o === "list" && !!(a.ref ?? a.refModelName), c = n(t, { relation: s }), l = s ? M[c] : o === "date" ? j[c] : o === "text" ? A[c] : void 0;
|
|
242
|
+
l && i.push({
|
|
243
|
+
model: e,
|
|
244
|
+
property: t,
|
|
245
|
+
id: a.id,
|
|
246
|
+
term: l
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return i;
|
|
251
|
+
}
|
|
252
|
+
//#endregion
|
|
253
|
+
export { l as _, E as a, h as b, x as c, c as d, a as f, d as g, f as h, N as i, b as l, u as m, T as n, _ as o, o as p, S as r, g as s, D as t, y as u, s as v, m as y };
|
|
254
|
+
|
|
255
|
+
//# sourceMappingURL=sidecar-BjHSnqHK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidecar-BjHSnqHK.js","names":["PROVISIONAL_BASE_IRI","RDF","XSD","PROV","RDF_TYPE","RDF_FIRST","RDF_REST","RDF_NIL","INVALID_IRI","assertIri","iri","what","iriScheme","chainId","base","segment","s","uid","modelType","easType","easName","address","canonicalJson","value","v","a","b","RELATION_TYPES","level","values","isNameMatchLevel","prefixesOf","prefixes","prefix","sidecar","expandTerm","colon","term","expanded","compileLens","schema","warnings","unused","termOf","id","models","modelName","model","candidates","key","property","dataType","ref","listRelationEasName","warnOnce","message","modelOf","match","matchEasName","easPropertyName","sidecarContext","usable","context","scoped","entry","options","targets","properties","assertSameSchema","checkSidecar","lens","all","ids","t","terms","syncSidecar","_context","rest","schemaVersion","SUGGESTED_PREFIXES","keyed","name","fuzzyNameKey","MODEL_TERMS","TEXT_TERMS","DATE_TERMS","RELATION_TERMS","suggestTerms","suggestions","modelTerm","definition","relation"],"sources":["../src/iri.ts","../src/lens.ts","../src/sidecar.ts"],"sourcesContent":["/**\n * Base of every IRI the export mints. Provisional: the permanent namespace (w3id.org, see the RDF\n * plan) isn't registered yet, so don't publish exports that use it anywhere they can't be\n * replaced, such as an archive on Arweave.\n */\nexport const PROVISIONAL_BASE_IRI = 'https://w3id.org/seedprotocol/'\n\nexport const RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'\nexport const XSD = 'http://www.w3.org/2001/XMLSchema#'\nexport const PROV = 'http://www.w3.org/ns/prov#'\n\nexport const RDF_TYPE = `${RDF}type`\nexport const RDF_FIRST = `${RDF}first`\nexport const RDF_REST = `${RDF}rest`\nexport const RDF_NIL = `${RDF}nil`\n\n// Characters N-Triples and Turtle don't allow in an IRIREF, plus controls and space.\nconst INVALID_IRI = /[\\u0000- <>\"{}|^`\\\\]/\n\n/** Throws when `iri` can't be written as an IRI in N-Quads, Turtle or JSON-LD. */\nexport function assertIri(iri: string, what: string): string {\n if (!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(iri) || INVALID_IRI.test(iri)) {\n throw new TypeError(`${what} is not an absolute IRI: ${JSON.stringify(iri)}`)\n }\n return iri\n}\n\n/** The IRIs one export uses, from its base and chain. */\nexport type IriScheme = {\n readonly base: string\n readonly chainId: number\n /** The Seed vocabulary namespace, `{base}ns#`. */\n readonly seed: string\n /** A Seed, Version or other attestation on this chain. */\n attestation(uid: string): string\n /** The class for an on-chain model type (the Seed schema `bytes32 <model>`). */\n modelClass(modelType: string): string\n /** The predicate for an on-chain property schema `<easType> <easName>`. */\n property(easType: string, easName: string): string\n /** An attester address as a CAIP-10 `did:pkh`. */\n account(address: string): string\n}\n\nexport function iriScheme(chainId: number, base: string = PROVISIONAL_BASE_IRI): IriScheme {\n if (!Number.isSafeInteger(chainId) || chainId <= 0) {\n throw new TypeError(`chainId must be a positive integer, got ${chainId}`)\n }\n assertIri(base, 'base')\n if (!base.endsWith('/')) throw new TypeError(`base must end with \"/\": ${base}`)\n const segment = (s: string) => encodeURIComponent(s)\n return {\n base,\n chainId,\n seed: `${base}ns#`,\n attestation: (uid) => `${base}eas/${chainId}/${segment(uid.toLowerCase())}`,\n modelClass: (modelType) => `${base}c/${segment(modelType)}`,\n property: (easType, easName) => `${base}p/${segment(easType)}/${segment(easName)}`,\n account: (address) => `did:pkh:eip155:${chainId}:${segment(address.toLowerCase())}`,\n }\n}\n","import { easName, isNameMatchLevel, matchEasName, type NameMatchLevel } from '@seedprotocol/eas'\nimport { listRelationEasName } from '@seedprotocol/query'\nimport { assertIri } from './iri.js'\n\ntype LensProperty = {\n readonly id?: string\n readonly type?: string\n readonly dataType?: string\n readonly ref?: string\n readonly refModelName?: string\n readonly nameMatch?: string\n readonly [key: string]: unknown\n}\n\ntype LensModel = {\n readonly id?: string\n readonly nameMatch?: string\n readonly properties: { readonly [propertyName: string]: LensProperty }\n}\n\n/** As much of a schema file as the lens reads. A `SchemaFileFormat` can be passed as it is. */\nexport type LensSchema = {\n readonly id?: string\n readonly nameMatch?: string\n readonly models: { readonly [modelName: string]: LensModel }\n}\n\n/**\n * What an app says its models and properties mean. `terms` is keyed by model or property id, which\n * survive renames, so no older schema file is needed. Each term is a prefixed name or an absolute\n * IRI; prefixes come from the top level of `@context`.\n */\nexport type RdfSidecar = {\n /** The schema these terms were written for. Must equal the schema's `id`. */\n readonly schemaId: string\n /** The schema `version` the sidecar was last synced with. Informational: terms are read by id. */\n readonly schemaVersion?: number\n readonly '@context'?: { readonly [prefix: string]: unknown }\n readonly terms: { readonly [id: string]: string }\n}\n\n/** JSON with object keys sorted, so key order doesn't change it. */\nexport const canonicalJson = (value: unknown): string =>\n JSON.stringify(value, (_key, v) =>\n v && typeof v === 'object' && !Array.isArray(v) ? Object.fromEntries(Object.entries(v).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))) : v,\n )\n\nexport type RdfLens = {\n readonly schema: LensSchema\n readonly sidecar: RdfSidecar\n}\n\ntype PropertyEntry = { readonly term?: string; readonly dataType: string }\ntype ModelEntry = {\n readonly term?: string\n readonly candidates: readonly { value: PropertyEntry; name: string; relation: boolean; level?: NameMatchLevel }[]\n}\n\n/** How a lens reads one export's seeds and properties. */\nexport type CompiledLens = {\n readonly prefixes: ReadonlyMap<string, string>\n readonly warnings: string[]\n /** The class term of a seed's on-chain model, if the lens maps it. */\n classOf(modelType: string): string | undefined\n /** The local data type and term of an on-chain property of a model. */\n propertyOf(modelType: string, easPropertyName: string): PropertyEntry | undefined\n}\n\nexport const RELATION_TYPES = new Set(['relation', 'image', 'file', 'html', 'json', 'blob'])\n\nconst level = (...values: (string | undefined)[]): NameMatchLevel | undefined =>\n values.find((value): value is NameMatchLevel => isNameMatchLevel(value))\n\nexport function prefixesOf(sidecar: RdfSidecar): Map<string, string> {\n const prefixes = new Map<string, string>()\n for (const [prefix, value] of Object.entries(sidecar['@context'] ?? {})) {\n if (!prefix.startsWith('@') && typeof value === 'string') prefixes.set(prefix, value)\n }\n return prefixes\n}\n\n/** The absolute IRI of a term, or undefined when it can't be read. */\nexport function expandTerm(term: string, prefixes: ReadonlyMap<string, string>): string | undefined {\n const colon = term.indexOf(':')\n const prefix = colon > 0 ? prefixes.get(term.slice(0, colon)) : undefined\n const expanded = prefix !== undefined ? prefix + term.slice(colon + 1) : term\n if (prefix === undefined && !/^(?:[a-zA-Z][a-zA-Z0-9+.-]*:\\/\\/|urn:)/.test(term)) return undefined\n try {\n return assertIri(expanded, 'term')\n } catch {\n return undefined\n }\n}\n\n/**\n * Reads a lens for one export. A sidecar written for another schema throws; a term that matches no\n * model or property, or can't be expanded, is a warning, and the export uses the protocol IRI.\n */\nexport function compileLens({ schema, sidecar }: RdfLens): CompiledLens {\n if (!schema.id || schema.id !== sidecar.schemaId) {\n throw new TypeError(`The sidecar is for schema ${sidecar.schemaId}, not ${schema.id ?? 'a schema with no id'}`)\n }\n const prefixes = prefixesOf(sidecar)\n const warnings: string[] = []\n const unused = new Set(Object.keys(sidecar.terms))\n const termOf = (id: string | undefined): string | undefined => {\n if (!id || sidecar.terms[id] === undefined) return undefined\n unused.delete(id)\n const expanded = expandTerm(sidecar.terms[id]!, prefixes)\n if (!expanded) warnings.push(`Term \"${sidecar.terms[id]}\" for ${id} isn't an IRI or a name with a known prefix`)\n return expanded\n }\n\n const models = Object.entries(schema.models).map(([modelName, model]) => {\n const candidates = Object.entries(model.properties).map(([key, property]) => {\n const dataType = (property.type ?? property.dataType ?? '').toLowerCase()\n const ref = property.ref ?? property.refModelName\n return {\n value: { term: termOf(property.id), dataType },\n name: dataType === 'list' && ref ? listRelationEasName(key, ref) : easName(key),\n relation: RELATION_TYPES.has(dataType) || (dataType === 'list' && !!ref),\n level: level(property.nameMatch, model.nameMatch, schema.nameMatch),\n }\n })\n const entry: ModelEntry = { term: termOf(model.id), candidates }\n return { value: entry, name: easName(modelName), level: level(model.nameMatch, schema.nameMatch) }\n })\n for (const id of unused) warnings.push(`Term \"${sidecar.terms[id]}\" names ${id}, which is no model or property in the schema`)\n\n const warnOnce = (message: string) => {\n if (!warnings.includes(message)) warnings.push(message)\n }\n const modelOf = (modelType: string): ModelEntry | undefined => {\n const match = matchEasName(modelType, models)\n if (match.kind === 'ambiguous') warnOnce(`Model \"${modelType}\" matches several models in the schema`)\n return match.kind === 'match' ? match.value : undefined\n }\n\n return {\n prefixes,\n warnings,\n classOf: (modelType) => modelOf(modelType)?.term,\n propertyOf(modelType, easPropertyName) {\n const model = modelOf(modelType)\n if (!model) return undefined\n const match = matchEasName(easPropertyName, model.candidates)\n if (match.kind === 'ambiguous') warnOnce(`Property \"${easPropertyName}\" of ${modelType} matches several properties in the schema`)\n return match.kind === 'match' ? match.value : undefined\n },\n }\n}\n","import { easName, fuzzyNameKey } from '@seedprotocol/eas'\nimport { XSD, iriScheme } from './iri.js'\nimport { RELATION_TYPES, canonicalJson, expandTerm, prefixesOf, type RdfLens, type RdfSidecar } from './lens.js'\n\nexport type SidecarContextOptions = {\n /** Base of the protocol class for a model whose properties are mapped but which isn't. Default PROVISIONAL_BASE_IRI. */\n base?: string\n}\n\ntype ContextEntry = string | { readonly [key: string]: string | ContextEntry }\nexport type SidecarContext = { readonly [key: string]: unknown }\n\n/**\n * The sidecar's `@context` regenerated from its `terms` and the schema's current names: its\n * keywords and prefixes as they are, then one type-scoped entry per model that has a term or a\n * mapped property. A relation gets `\"@type\": \"@id\"`, a List `\"@container\": \"@list\"`, a Date\n * `xsd:dateTime`. A model without a term keeps its protocol class. Terms that can't be expanded are\n * left out.\n */\nexport function sidecarContext({ schema, sidecar }: RdfLens, options: SidecarContextOptions = {}): SidecarContext {\n const prefixes = prefixesOf(sidecar)\n const usable = (id: string | undefined): string | undefined => {\n const term = id ? sidecar.terms[id] : undefined\n return term !== undefined && expandTerm(term, prefixes) ? term : undefined\n }\n const context: Record<string, unknown> = { '@version': 1.1 }\n for (const [key, value] of Object.entries(sidecar['@context'] ?? {})) {\n if (key.startsWith('@') || typeof value === 'string') context[key] = value\n }\n\n for (const [modelName, model] of Object.entries(schema.models)) {\n const scoped: Record<string, ContextEntry> = {}\n for (const [key, property] of Object.entries(model.properties)) {\n const term = usable(property.id)\n if (!term) continue\n const dataType = (property.type ?? property.dataType ?? '').toLowerCase()\n const ref = property.ref ?? property.refModelName\n const entry: Record<string, string> = { '@id': term }\n if (RELATION_TYPES.has(dataType) || (dataType === 'list' && ref)) entry['@type'] = '@id'\n if (dataType === 'date') entry['@type'] = `${XSD}dateTime`\n if (dataType === 'list') entry['@container'] = '@list'\n scoped[key] = Object.keys(entry).length === 1 ? term : entry\n }\n const term = usable(model.id)\n if (!term && Object.keys(scoped).length === 0) continue\n if (modelName in context) continue\n context[modelName] = {\n '@id': term ?? iriScheme(1, options.base).modelClass(easName(modelName)),\n ...(Object.keys(scoped).length > 0 && { '@context': scoped }),\n }\n }\n return context\n}\n\n/** A model, or a property of one, that `terms` can name. */\nexport type SchemaTarget = { readonly model: string; readonly property?: string; readonly id?: string }\n\nexport type SidecarReport = {\n /** Terms whose id is no model or property in the schema, as after a deletion. */\n readonly stale: readonly { readonly id: string; readonly term: string }[]\n /** Terms that aren't an IRI or a name with a prefix in `@context`. */\n readonly invalid: readonly { readonly id: string; readonly term: string }[]\n /** Models and properties with no term. One without an `id` can't be mapped until the schema assigns it one. */\n readonly unmapped: readonly SchemaTarget[]\n /** `@context` differs from {@link sidecarContext}, as after a rename: `syncSidecar` rewrites it. */\n readonly contextOutdated: boolean\n /** `schemaVersion` differs from the schema's `version`. */\n readonly versionOutdated: boolean\n}\n\n/** A schema as the sidecar tools read it: the lens's, plus its version. */\nexport type SidecarSchema = RdfLens['schema'] & { readonly version?: number }\n\nfunction targets(schema: SidecarSchema): SchemaTarget[] {\n return Object.entries(schema.models).flatMap(([model, { id, properties }]) => [\n { model, id },\n ...Object.entries(properties).map(([property, { id }]) => ({ model, property, id })),\n ])\n}\n\nfunction assertSameSchema({ schema, sidecar }: RdfLens): void {\n if (!schema.id || schema.id !== sidecar.schemaId) {\n throw new TypeError(`The sidecar is for schema ${sidecar.schemaId}, not ${schema.id ?? 'a schema with no id'}`)\n }\n}\n\n/** What's out of date in a sidecar against its schema. Throws when it was written for another schema. */\nexport function checkSidecar(\n lens: { readonly schema: SidecarSchema; readonly sidecar: RdfSidecar },\n options: SidecarContextOptions = {},\n): SidecarReport {\n assertSameSchema(lens)\n const { schema, sidecar } = lens\n const all = targets(schema)\n const ids = new Set(all.flatMap((t) => (t.id ? [t.id] : [])))\n const prefixes = prefixesOf(sidecar)\n const terms = Object.entries(sidecar.terms).map(([id, term]) => ({ id, term }))\n return {\n stale: terms.filter(({ id }) => !ids.has(id)),\n invalid: terms.filter(({ id, term }) => ids.has(id) && !expandTerm(term, prefixes)),\n unmapped: all.filter((t) => !t.id || sidecar.terms[t.id] === undefined),\n contextOutdated: canonicalJson(sidecar['@context'] ?? {}) !== canonicalJson(sidecarContext(lens, options)),\n versionOutdated: schema.version !== undefined && sidecar.schemaVersion !== schema.version,\n }\n}\n\n/**\n * The sidecar with `@context` regenerated by {@link sidecarContext} and `schemaVersion` set to the\n * schema's `version`. `terms` is kept as it is, stale ones too: removing a mapping is the\n * developer's call.\n */\nexport function syncSidecar(\n lens: { readonly schema: SidecarSchema; readonly sidecar: RdfSidecar },\n options: SidecarContextOptions = {},\n): RdfSidecar {\n assertSameSchema(lens)\n const { schema, sidecar } = lens\n const { schemaId, schemaVersion, terms, '@context': _context, ...rest } = sidecar\n return {\n schemaId,\n ...(schema.version !== undefined ? { schemaVersion: schema.version } : schemaVersion !== undefined && { schemaVersion }),\n ...rest,\n terms,\n '@context': sidecarContext(lens, options),\n }\n}\n\nexport const SUGGESTED_PREFIXES = { schema: 'https://schema.org/', dcterms: 'http://purl.org/dc/terms/' } as const\n\n// Kept to names whose meaning rarely varies; anything else is left to the developer.\ntype Terms = { readonly [name: string]: string }\n// The tables by the fuzzy key a name is looked up by.\nconst keyed = (terms: Terms, relation = false): Terms =>\n Object.fromEntries(Object.entries(terms).map(([name, term]) => [fuzzyNameKey(name, { relation }), term]))\n\nconst MODEL_TERMS = keyed({\n post: 'schema:BlogPosting',\n blogpost: 'schema:BlogPosting',\n article: 'schema:Article',\n newsarticle: 'schema:NewsArticle',\n page: 'schema:WebPage',\n person: 'schema:Person',\n organization: 'schema:Organization',\n event: 'schema:Event',\n place: 'schema:Place',\n image: 'schema:ImageObject',\n video: 'schema:VideoObject',\n podcast: 'schema:PodcastSeries',\n episode: 'schema:Episode',\n book: 'schema:Book',\n comment: 'schema:Comment',\n})\nconst TEXT_TERMS = keyed({\n title: 'dcterms:title',\n headline: 'schema:headline',\n name: 'schema:name',\n summary: 'dcterms:abstract',\n abstract: 'dcterms:abstract',\n excerpt: 'dcterms:abstract',\n description: 'dcterms:description',\n subtitle: 'schema:alternativeHeadline',\n language: 'dcterms:language',\n lang: 'dcterms:language',\n license: 'dcterms:license',\n url: 'schema:url',\n link: 'schema:url',\n canonicalurl: 'schema:url',\n email: 'schema:email',\n keyword: 'schema:keywords',\n body: 'schema:text',\n content: 'schema:text',\n text: 'schema:text',\n})\nconst DATE_TERMS = keyed({\n publishedat: 'dcterms:issued',\n datepublished: 'dcterms:issued',\n publishdate: 'dcterms:issued',\n issued: 'dcterms:issued',\n createdat: 'dcterms:created',\n created: 'dcterms:created',\n updatedat: 'dcterms:modified',\n modifiedat: 'dcterms:modified',\n modified: 'dcterms:modified',\n startdate: 'schema:startDate',\n enddate: 'schema:endDate',\n})\nconst RELATION_TERMS = keyed(\n {\n author: 'dcterms:creator',\n creator: 'dcterms:creator',\n byline: 'dcterms:creator',\n contributor: 'dcterms:contributor',\n publisher: 'dcterms:publisher',\n editor: 'schema:editor',\n image: 'schema:image',\n coverimage: 'schema:image',\n featuredimage: 'schema:image',\n cover: 'schema:image',\n thumbnail: 'schema:thumbnail',\n html: 'schema:text',\n body: 'schema:text',\n content: 'schema:text',\n tag: 'dcterms:subject',\n category: 'dcterms:subject',\n categories: 'dcterms:subject',\n topic: 'dcterms:subject',\n source: 'dcterms:source',\n file: 'schema:associatedMedia',\n },\n true,\n)\n\nexport type TermSuggestion = SchemaTarget & { readonly id: string; readonly term: string }\n\n/**\n * Draft schema.org and dcterms terms for the unmapped models and properties whose names have a\n * common meaning (`title`, `summary`, `author`, `publishedAt`, `coverImage`), for the developer to\n * review. Names it doesn't know, and models or properties without an id, get no suggestion. The\n * terms use the prefixes in {@link SUGGESTED_PREFIXES}.\n */\nexport function suggestTerms(lens: { readonly schema: SidecarSchema; readonly sidecar: RdfSidecar }): TermSuggestion[] {\n assertSameSchema(lens)\n const { schema, sidecar } = lens\n const suggestions: TermSuggestion[] = []\n for (const [model, { id, properties }] of Object.entries(schema.models)) {\n const modelTerm = MODEL_TERMS[fuzzyNameKey(model)]\n if (id && sidecar.terms[id] === undefined && modelTerm) suggestions.push({ model, id, term: modelTerm })\n for (const [property, definition] of Object.entries(properties)) {\n if (!definition.id || sidecar.terms[definition.id] !== undefined) continue\n const dataType = (definition.type ?? definition.dataType ?? '').toLowerCase()\n const relation = RELATION_TYPES.has(dataType) || (dataType === 'list' && !!(definition.ref ?? definition.refModelName))\n const key = fuzzyNameKey(property, { relation })\n const term = relation ? RELATION_TERMS[key] : dataType === 'date' ? DATE_TERMS[key] : dataType === 'text' ? TEXT_TERMS[key] : undefined\n if (term) suggestions.push({ model, property, id: definition.id, term })\n }\n }\n return suggestions\n}\n"],"mappings":";;;AAKA,IAAaA,IAAuB,kCAEvBC,IAAM,+CACNC,IAAM,qCACNC,IAAO,8BAEPC,IAAW,GAAGH,EAAI,OAClBI,IAAY,GAAGJ,EAAI,QACnBK,IAAW,GAAGL,EAAI,OAClBM,IAAU,GAAGN,EAAI,MAGxBO,IAAc;AAGpB,SA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Y,KAAK;IAAE;IAAO;IAAU,IAAIE,EAAW;IAAI;GAAK,CAAC;EACzE;CACF;CACA,OAAOF;AACT"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type RdfLens, type RdfSidecar } from './lens.js';
|
|
2
|
+
export type SidecarContextOptions = {
|
|
3
|
+
/** Base of the protocol class for a model whose properties are mapped but which isn't. Default PROVISIONAL_BASE_IRI. */
|
|
4
|
+
base?: string;
|
|
5
|
+
};
|
|
6
|
+
export type SidecarContext = {
|
|
7
|
+
readonly [key: string]: unknown;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* The sidecar's `@context` regenerated from its `terms` and the schema's current names: its
|
|
11
|
+
* keywords and prefixes as they are, then one type-scoped entry per model that has a term or a
|
|
12
|
+
* mapped property. A relation gets `"@type": "@id"`, a List `"@container": "@list"`, a Date
|
|
13
|
+
* `xsd:dateTime`. A model without a term keeps its protocol class. Terms that can't be expanded are
|
|
14
|
+
* left out.
|
|
15
|
+
*/
|
|
16
|
+
export declare function sidecarContext({ schema, sidecar }: RdfLens, options?: SidecarContextOptions): SidecarContext;
|
|
17
|
+
/** A model, or a property of one, that `terms` can name. */
|
|
18
|
+
export type SchemaTarget = {
|
|
19
|
+
readonly model: string;
|
|
20
|
+
readonly property?: string;
|
|
21
|
+
readonly id?: string;
|
|
22
|
+
};
|
|
23
|
+
export type SidecarReport = {
|
|
24
|
+
/** Terms whose id is no model or property in the schema, as after a deletion. */
|
|
25
|
+
readonly stale: readonly {
|
|
26
|
+
readonly id: string;
|
|
27
|
+
readonly term: string;
|
|
28
|
+
}[];
|
|
29
|
+
/** Terms that aren't an IRI or a name with a prefix in `@context`. */
|
|
30
|
+
readonly invalid: readonly {
|
|
31
|
+
readonly id: string;
|
|
32
|
+
readonly term: string;
|
|
33
|
+
}[];
|
|
34
|
+
/** Models and properties with no term. One without an `id` can't be mapped until the schema assigns it one. */
|
|
35
|
+
readonly unmapped: readonly SchemaTarget[];
|
|
36
|
+
/** `@context` differs from {@link sidecarContext}, as after a rename: `syncSidecar` rewrites it. */
|
|
37
|
+
readonly contextOutdated: boolean;
|
|
38
|
+
/** `schemaVersion` differs from the schema's `version`. */
|
|
39
|
+
readonly versionOutdated: boolean;
|
|
40
|
+
};
|
|
41
|
+
/** A schema as the sidecar tools read it: the lens's, plus its version. */
|
|
42
|
+
export type SidecarSchema = RdfLens['schema'] & {
|
|
43
|
+
readonly version?: number;
|
|
44
|
+
};
|
|
45
|
+
/** What's out of date in a sidecar against its schema. Throws when it was written for another schema. */
|
|
46
|
+
export declare function checkSidecar(lens: {
|
|
47
|
+
readonly schema: SidecarSchema;
|
|
48
|
+
readonly sidecar: RdfSidecar;
|
|
49
|
+
}, options?: SidecarContextOptions): SidecarReport;
|
|
50
|
+
/**
|
|
51
|
+
* The sidecar with `@context` regenerated by {@link sidecarContext} and `schemaVersion` set to the
|
|
52
|
+
* schema's `version`. `terms` is kept as it is, stale ones too: removing a mapping is the
|
|
53
|
+
* developer's call.
|
|
54
|
+
*/
|
|
55
|
+
export declare function syncSidecar(lens: {
|
|
56
|
+
readonly schema: SidecarSchema;
|
|
57
|
+
readonly sidecar: RdfSidecar;
|
|
58
|
+
}, options?: SidecarContextOptions): RdfSidecar;
|
|
59
|
+
export declare const SUGGESTED_PREFIXES: {
|
|
60
|
+
readonly schema: "https://schema.org/";
|
|
61
|
+
readonly dcterms: "http://purl.org/dc/terms/";
|
|
62
|
+
};
|
|
63
|
+
export type TermSuggestion = SchemaTarget & {
|
|
64
|
+
readonly id: string;
|
|
65
|
+
readonly term: string;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Draft schema.org and dcterms terms for the unmapped models and properties whose names have a
|
|
69
|
+
* common meaning (`title`, `summary`, `author`, `publishedAt`, `coverImage`), for the developer to
|
|
70
|
+
* review. Names it doesn't know, and models or properties without an id, get no suggestion. The
|
|
71
|
+
* terms use the prefixes in {@link SUGGESTED_PREFIXES}.
|
|
72
|
+
*/
|
|
73
|
+
export declare function suggestTerms(lens: {
|
|
74
|
+
readonly schema: SidecarSchema;
|
|
75
|
+
readonly sidecar: RdfSidecar;
|
|
76
|
+
}): TermSuggestion[];
|
|
77
|
+
//# sourceMappingURL=sidecar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidecar.d.ts","sourceRoot":"","sources":["../src/sidecar.ts"],"names":[],"mappings":"AAEA,OAAO,EAAyD,KAAK,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAA;AAEhH,MAAM,MAAM,qBAAqB,GAAG;IAClC,wHAAwH;IACxH,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAGD,MAAM,MAAM,cAAc,GAAG;IAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,CAAA;AAEhE;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,GAAE,qBAA0B,GAAG,cAAc,CAiChH;AAED,4DAA4D;AAC5D,MAAM,MAAM,YAAY,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAEvG,MAAM,MAAM,aAAa,GAAG;IAC1B,iFAAiF;IACjF,QAAQ,CAAC,KAAK,EAAE,SAAS;QAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IACzE,sEAAsE;IACtE,QAAQ,CAAC,OAAO,EAAE,SAAS;QAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAC3E,+GAA+G;IAC/G,QAAQ,CAAC,QAAQ,EAAE,SAAS,YAAY,EAAE,CAAA;IAC1C,oGAAoG;IACpG,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAA;IACjC,2DAA2D;IAC3D,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAA;CAClC,CAAA;AAED,2EAA2E;AAC3E,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAe7E,yGAAyG;AACzG,wBAAgB,YAAY,CAC1B,IAAI,EAAE;IAAE,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAA;CAAE,EACtE,OAAO,GAAE,qBAA0B,GAClC,aAAa,CAcf;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE;IAAE,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAA;CAAE,EACtE,OAAO,GAAE,qBAA0B,GAClC,UAAU,CAWZ;AAED,eAAO,MAAM,kBAAkB;;;CAAmF,CAAA;AAqFlH,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAE1F;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE;IAAE,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAA;CAAE,GAAG,cAAc,EAAE,CAiBrH"}
|
package/dist/turtle.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { StateGraph } from './graph.js';
|
|
2
|
+
/**
|
|
3
|
+
* Turtle (RDF 1.1): prefixes, then one block per subject. Names are prefixed where the local
|
|
4
|
+
* part needs no escaping and written as full IRIs otherwise; lists use collection syntax.
|
|
5
|
+
*/
|
|
6
|
+
export declare function toTurtle(graph: StateGraph): string;
|
|
7
|
+
//# sourceMappingURL=turtle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turtle.d.ts","sourceRoot":"","sources":["../src/turtle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,UAAU,EAAE,MAAM,YAAY,CAAA;AAKvD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CA4BlD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vocabulary.d.ts","sourceRoot":"","sources":["../src/vocabulary.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,GAAE,MAA6B,GAAG,MAAM,CA8B1E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,77 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seedprotocol/rdf",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.8.1",
|
|
4
|
+
"description": "RDF export for Seed Protocol items: a state graph of each seed's current values as RDF/JS quads, N-Quads, Turtle or JSON-LD, with IRIs minted from the on-chain schemas",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"seed-protocol",
|
|
7
|
+
"rdf",
|
|
8
|
+
"linked-data",
|
|
9
|
+
"json-ld",
|
|
10
|
+
"turtle",
|
|
11
|
+
"n-quads",
|
|
12
|
+
"eas"
|
|
13
|
+
],
|
|
14
|
+
"type": "module",
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=20.12.0"
|
|
17
|
+
},
|
|
18
|
+
"bin": {
|
|
19
|
+
"seed-rdf": "./dist/bin.js"
|
|
20
|
+
},
|
|
21
|
+
"main": "./dist/index.js",
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"import": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"default": "./dist/index.js"
|
|
28
|
+
},
|
|
29
|
+
"require": {
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"default": "./dist/index.js"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"./package.json": "./package.json"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist",
|
|
38
|
+
"CHANGELOG.md"
|
|
39
|
+
],
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "rimraf dist && tsc -p tsconfig.build.json && vite build && node ../../scripts/fix-dts-specifiers.js",
|
|
42
|
+
"test": "vitest run --reporter=default",
|
|
43
|
+
"prepublishOnly": "bun run build && node ../../scripts/sync-versions.js"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@noble/hashes": "^1.8.0",
|
|
47
|
+
"@rdfjs/types": "^2.0.1",
|
|
48
|
+
"@seedprotocol/eas": "workspace:*",
|
|
49
|
+
"@seedprotocol/query": "workspace:*"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/jsonld": "1.5.15",
|
|
53
|
+
"@types/node": "^24.10.1",
|
|
54
|
+
"jsonld": "9.0.0",
|
|
55
|
+
"n3": "2.13.12",
|
|
56
|
+
"rdf-canonize": "5.0.0",
|
|
57
|
+
"rdf-validate-shacl": "0.6.5",
|
|
58
|
+
"rimraf": "^6.0.1",
|
|
59
|
+
"typescript": "~5.9.3",
|
|
60
|
+
"vite": "^8.0.0",
|
|
61
|
+
"vitest": "^4.1.11"
|
|
62
|
+
},
|
|
63
|
+
"author": "Keith Axline <keith@journodao.xyz>",
|
|
64
|
+
"license": "MIT",
|
|
65
|
+
"repository": {
|
|
66
|
+
"type": "git",
|
|
67
|
+
"url": "git+https://github.com/JournoLabs/seed-protocol-sdk.git",
|
|
68
|
+
"directory": "packages/rdf"
|
|
69
|
+
},
|
|
70
|
+
"homepage": "https://github.com/JournoLabs/seed-protocol-sdk/tree/main/packages/rdf#readme",
|
|
71
|
+
"bugs": {
|
|
72
|
+
"url": "https://github.com/JournoLabs/seed-protocol-sdk/issues"
|
|
73
|
+
},
|
|
74
|
+
"publishConfig": {
|
|
75
|
+
"access": "public"
|
|
76
|
+
}
|
|
77
|
+
}
|