@origintrail-official/dkg-okf 10.0.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.
Files changed (51) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +55 -0
  3. package/dist/bundle.d.ts +16 -0
  4. package/dist/bundle.d.ts.map +1 -0
  5. package/dist/bundle.js +132 -0
  6. package/dist/bundle.js.map +1 -0
  7. package/dist/constants.d.ts +52 -0
  8. package/dist/constants.d.ts.map +1 -0
  9. package/dist/constants.js +55 -0
  10. package/dist/constants.js.map +1 -0
  11. package/dist/document.d.ts +30 -0
  12. package/dist/document.d.ts.map +1 -0
  13. package/dist/document.js +72 -0
  14. package/dist/document.js.map +1 -0
  15. package/dist/export.d.ts +21 -0
  16. package/dist/export.d.ts.map +1 -0
  17. package/dist/export.js +210 -0
  18. package/dist/export.js.map +1 -0
  19. package/dist/index.d.ts +24 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +23 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/loader.d.ts +20 -0
  24. package/dist/loader.d.ts.map +1 -0
  25. package/dist/loader.js +42 -0
  26. package/dist/loader.js.map +1 -0
  27. package/dist/mapping.d.ts +38 -0
  28. package/dist/mapping.d.ts.map +1 -0
  29. package/dist/mapping.js +253 -0
  30. package/dist/mapping.js.map +1 -0
  31. package/dist/nquads.d.ts +13 -0
  32. package/dist/nquads.d.ts.map +1 -0
  33. package/dist/nquads.js +26 -0
  34. package/dist/nquads.js.map +1 -0
  35. package/dist/paths.d.ts +57 -0
  36. package/dist/paths.d.ts.map +1 -0
  37. package/dist/paths.js +126 -0
  38. package/dist/paths.js.map +1 -0
  39. package/dist/types.d.ts +134 -0
  40. package/dist/types.d.ts.map +1 -0
  41. package/dist/types.js +10 -0
  42. package/dist/types.js.map +1 -0
  43. package/dist/utils.d.ts +27 -0
  44. package/dist/utils.d.ts.map +1 -0
  45. package/dist/utils.js +53 -0
  46. package/dist/utils.js.map +1 -0
  47. package/dist/validation.d.ts +17 -0
  48. package/dist/validation.d.ts.map +1 -0
  49. package/dist/validation.js +80 -0
  50. package/dist/validation.js.map +1 -0
  51. package/package.json +38 -0
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The clean inverse of the importer (ADR 0005): reconstruct a conformant OKF
3
+ * bundle from imported Knowledge Assets. Designed so that
4
+ *
5
+ * import(bundle) → exportBundle(...) → import(...)
6
+ *
7
+ * reproduces an *equivalent graph* (same concepts, frontmatter triples, untyped
8
+ * edges and citations). It is graph-faithful, not byte-faithful: free-form prose
9
+ * is not recoverable from triples, so bodies are regenerated structurally (a
10
+ * `# Related` section of links + a `# Citations` section). Section headings from
11
+ * the original body are presentational and are not reconstructed — round-trip
12
+ * equivalence is asserted over the semantic (non-`hasSection`) quad set.
13
+ *
14
+ * This module is pure: it consumes a `BundleImport` and returns `BundleFile[]`.
15
+ * The `dkg okf export` command feeds it quads fetched from a Context Graph via
16
+ * SPARQL; the same function powers the offline round-trip test.
17
+ */
18
+ import type { BundleFile, BundleImport, OkfMappingOptions } from './types.js';
19
+ /** Serialise an imported bundle back into a conformant OKF `BundleFile[]`. */
20
+ export declare function exportBundle(imported: BundleImport, opts?: OkfMappingOptions): BundleFile[];
21
+ //# sourceMappingURL=export.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../src/export.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAmBH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAkB,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAuL9F,8EAA8E;AAC9E,wBAAgB,YAAY,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,GAAE,iBAAsB,GAAG,UAAU,EAAE,CAK/F"}
package/dist/export.js ADDED
@@ -0,0 +1,210 @@
1
+ /**
2
+ * The clean inverse of the importer (ADR 0005): reconstruct a conformant OKF
3
+ * bundle from imported Knowledge Assets. Designed so that
4
+ *
5
+ * import(bundle) → exportBundle(...) → import(...)
6
+ *
7
+ * reproduces an *equivalent graph* (same concepts, frontmatter triples, untyped
8
+ * edges and citations). It is graph-faithful, not byte-faithful: free-form prose
9
+ * is not recoverable from triples, so bodies are regenerated structurally (a
10
+ * `# Related` section of links + a `# Citations` section). Section headings from
11
+ * the original body are presentational and are not reconstructed — round-trip
12
+ * equivalence is asserted over the semantic (non-`hasSection`) quad set.
13
+ *
14
+ * This module is pure: it consumes a `BundleImport` and returns `BundleFile[]`.
15
+ * The `dkg okf export` command feeds it quads fetched from a Context Graph via
16
+ * SPARQL; the same function powers the offline round-trip test.
17
+ */
18
+ import { dump as dumpYaml } from 'js-yaml';
19
+ import { RDF_TYPE, SCHEMA_NS, SCHEMA_NAME, SCHEMA_DESCRIPTION, SCHEMA_KEYWORDS, SCHEMA_MENTIONS, SCHEMA_HAS_PART, SCHEMA_DATE_MODIFIED, SCHEMA_URL, SCHEMA_CITATION, XSD_INTEGER, XSD_DECIMAL, XSD_BOOLEAN, DEFAULT_IRI_BASE, } from './constants.js';
20
+ const LITERAL_RE = /^("(?:\\.|[^"\\])*")(?:\^\^<[^>]*>|@[A-Za-z-]+)?$/;
21
+ const TYPED_LITERAL_RE = /^("(?:\\.|[^"\\])*")\^\^<([^>]*)>$/;
22
+ /** Lexical value of a literal term, or `null` if the term is an IRI / blank node. */
23
+ function literalValue(term) {
24
+ if (!term.startsWith('"'))
25
+ return null;
26
+ const m = term.match(LITERAL_RE);
27
+ if (!m)
28
+ return null;
29
+ return JSON.parse(m[1]);
30
+ }
31
+ /**
32
+ * Recover the native JS value of a known typed scalar literal so producer-defined
33
+ * numeric/boolean keys survive the round-trip. Import maps `count: 3` →
34
+ * `"3"^^xsd:integer`; without this, export would emit YAML string `"3"`, which
35
+ * re-imports as a plain string literal (datatype lost). Returns `null` for
36
+ * unknown datatypes / plain literals so callers fall back to lexical handling.
37
+ */
38
+ function typedScalarValue(term) {
39
+ const m = term.match(TYPED_LITERAL_RE);
40
+ if (!m)
41
+ return null;
42
+ const lexical = JSON.parse(m[1]);
43
+ switch (m[2]) {
44
+ case XSD_INTEGER: {
45
+ const n = Number(lexical);
46
+ return Number.isInteger(n) ? n : null;
47
+ }
48
+ case XSD_DECIMAL: {
49
+ const n = Number(lexical);
50
+ return Number.isFinite(n) ? n : null;
51
+ }
52
+ case XSD_BOOLEAN:
53
+ return lexical === 'true' ? true : lexical === 'false' ? false : null;
54
+ default:
55
+ return null;
56
+ }
57
+ }
58
+ /** Map an rdf:type object IRI back to a writable `type` value. */
59
+ function typeValue(object) {
60
+ return object.startsWith(SCHEMA_NS) ? object.slice(SCHEMA_NS.length) : object;
61
+ }
62
+ function conceptIdFromIri(iri, iriBase) {
63
+ return iri.startsWith(iriBase) ? iri.slice(iriBase.length) : null;
64
+ }
65
+ const KNOWN_PREDICATES = new Set([
66
+ RDF_TYPE,
67
+ SCHEMA_NAME,
68
+ SCHEMA_DESCRIPTION,
69
+ SCHEMA_KEYWORDS,
70
+ SCHEMA_MENTIONS,
71
+ SCHEMA_HAS_PART,
72
+ SCHEMA_DATE_MODIFIED,
73
+ SCHEMA_URL,
74
+ SCHEMA_CITATION,
75
+ ]);
76
+ function reconstructConcept(c, iriBase) {
77
+ const frontmatter = {};
78
+ const tags = [];
79
+ const edges = [];
80
+ const citations = [];
81
+ const extras = {};
82
+ for (const q of c.quads) {
83
+ if (q.subject !== c.iri)
84
+ continue; // skip section nodes (skolemized genid subjects)
85
+ switch (q.predicate) {
86
+ case RDF_TYPE:
87
+ frontmatter.type = typeValue(q.object);
88
+ break;
89
+ case SCHEMA_NAME:
90
+ frontmatter.title = literalValue(q.object) ?? q.object;
91
+ break;
92
+ case SCHEMA_DESCRIPTION:
93
+ frontmatter.description = literalValue(q.object) ?? q.object;
94
+ break;
95
+ case SCHEMA_URL:
96
+ frontmatter.resource = q.object;
97
+ break;
98
+ case SCHEMA_DATE_MODIFIED:
99
+ frontmatter.timestamp = literalValue(q.object) ?? q.object;
100
+ break;
101
+ case SCHEMA_KEYWORDS: {
102
+ const v = literalValue(q.object);
103
+ if (v !== null)
104
+ tags.push(v);
105
+ break;
106
+ }
107
+ case SCHEMA_MENTIONS:
108
+ case SCHEMA_HAS_PART: {
109
+ // Both are cross-concept edges → reconstruct as body links. OKF links are
110
+ // untyped (SPEC §5.3), so a typed relation (e.g. hasPart) deliberately
111
+ // exports as a plain link; the DKG-side typing is not OKF-expressible.
112
+ const id = conceptIdFromIri(q.object, iriBase);
113
+ if (id)
114
+ edges.push(id);
115
+ break;
116
+ }
117
+ case SCHEMA_CITATION:
118
+ citations.push(literalValue(q.object) ?? q.object);
119
+ break;
120
+ default: {
121
+ if (q.predicate.startsWith(SCHEMA_NS) && !KNOWN_PREDICATES.has(q.predicate)) {
122
+ const key = q.predicate.slice(SCHEMA_NS.length);
123
+ // Preserve known typed scalars (integer/decimal/boolean) as native
124
+ // values so the datatype survives re-import; else fall back to lexical.
125
+ const scalar = typedScalarValue(q.object);
126
+ const v = scalar !== null ? scalar : (literalValue(q.object) ?? q.object);
127
+ if (key in extras) {
128
+ const cur = extras[key];
129
+ extras[key] = Array.isArray(cur) ? [...cur, v] : [cur, v];
130
+ }
131
+ else {
132
+ extras[key] = v;
133
+ }
134
+ }
135
+ }
136
+ }
137
+ }
138
+ if (tags.length > 0)
139
+ frontmatter.tags = tags;
140
+ Object.assign(frontmatter, extras);
141
+ // Stable key order: required/recommended first, then producer extras.
142
+ const order = ['type', 'resource', 'title', 'description', 'tags', 'timestamp'];
143
+ const ordered = {};
144
+ for (const k of order)
145
+ if (k in frontmatter)
146
+ ordered[k] = frontmatter[k];
147
+ for (const k of Object.keys(frontmatter))
148
+ if (!(k in ordered))
149
+ ordered[k] = frontmatter[k];
150
+ const yaml = dumpYaml(ordered, { sortKeys: false, lineWidth: -1 }).trimEnd();
151
+ const bodyParts = [];
152
+ const uniqueEdges = [...new Set(edges)].sort();
153
+ if (uniqueEdges.length > 0) {
154
+ bodyParts.push('# Related', '');
155
+ for (const id of uniqueEdges)
156
+ bodyParts.push(`* [${id}](/${id}.md)`);
157
+ bodyParts.push('');
158
+ }
159
+ if (citations.length > 0) {
160
+ bodyParts.push('# Citations', '');
161
+ citations.forEach((url, i) => bodyParts.push(`[${i + 1}] [${url}](${url})`));
162
+ bodyParts.push('');
163
+ }
164
+ return {
165
+ path: `${c.conceptId}.md`,
166
+ content: `---\n${yaml}\n---\n\n${bodyParts.join('\n')}`,
167
+ };
168
+ }
169
+ /** Regenerate a directory `index.md` listing immediate child concepts/subdirs (SPEC §6). */
170
+ function regenerateIndexes(conceptIds) {
171
+ const childrenByDir = new Map();
172
+ const add = (dir, entry) => {
173
+ if (!childrenByDir.has(dir))
174
+ childrenByDir.set(dir, new Set());
175
+ childrenByDir.get(dir).add(entry);
176
+ };
177
+ for (const id of conceptIds) {
178
+ const parts = id.split('/');
179
+ for (let i = 0; i < parts.length; i++) {
180
+ const dir = parts.slice(0, i).join('/');
181
+ const isLeaf = i === parts.length - 1;
182
+ add(dir, isLeaf ? `concept:${parts[i]}.md` : `dir:${parts[i]}`);
183
+ }
184
+ }
185
+ const files = [];
186
+ for (const [dir, entries] of [...childrenByDir.entries()].sort()) {
187
+ const lines = ['# Index', ''];
188
+ for (const e of [...entries].sort()) {
189
+ if (e.startsWith('concept:')) {
190
+ const name = e.slice('concept:'.length);
191
+ lines.push(`* [${name.replace(/\.md$/, '')}](${name})`);
192
+ }
193
+ else {
194
+ const name = e.slice('dir:'.length);
195
+ lines.push(`* [${name}](${name}/index.md)`);
196
+ }
197
+ }
198
+ lines.push('');
199
+ files.push({ path: dir ? `${dir}/index.md` : 'index.md', content: lines.join('\n') });
200
+ }
201
+ return files;
202
+ }
203
+ /** Serialise an imported bundle back into a conformant OKF `BundleFile[]`. */
204
+ export function exportBundle(imported, opts = {}) {
205
+ const iriBase = opts.iriBase ?? DEFAULT_IRI_BASE;
206
+ const concepts = imported.concepts.map((c) => reconstructConcept(c, iriBase));
207
+ const indexes = regenerateIndexes(imported.concepts.map((c) => c.conceptId));
208
+ return [...concepts, ...indexes].sort((a, b) => (a.path < b.path ? -1 : a.path > b.path ? 1 : 0));
209
+ }
210
+ //# sourceMappingURL=export.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export.js","sourceRoot":"","sources":["../src/export.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EACL,QAAQ,EACR,SAAS,EACT,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,UAAU,EACV,eAAe,EACf,WAAW,EACX,WAAW,EACX,WAAW,EACX,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AAGxB,MAAM,UAAU,GAAG,mDAAmD,CAAC;AACvE,MAAM,gBAAgB,GAAG,oCAAoC,CAAC;AAE9D,qFAAqF;AACrF,SAAS,YAAY,CAAC,IAAY;IAChC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IACvC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACjC,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACpB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAW,CAAC;AACpC,CAAC;AAED;;;;;;GAMG;AACH,SAAS,gBAAgB,CAAC,IAAY;IACpC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACvC,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACpB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAW,CAAC;IAC3C,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACb,KAAK,WAAW,CAAC,CAAC,CAAC;YACjB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AACf,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,YAAY,CAAC,QAAsB,EAAE,OAA0B,EAAE;IAC/E,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,gBAAgB,CAAC;IACjD,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;IAC9E,MAAM,OAAO,GAAG,iBAAiB,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IAC7E,OAAO,CAAC,GAAG,QAAQ,EAAE,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACpG,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * `@origintrail-official/dkg-okf` — deterministic Google Open Knowledge Format
3
+ * (OKF) → DKG Knowledge Asset mapper.
4
+ *
5
+ * Turns a portable OKF bundle (Markdown + YAML frontmatter + untyped cross-links)
6
+ * into owned, verifiable RDF Knowledge Assets, reconstructing the bundle's
7
+ * cross-concept link graph. Pure, no LLM, no network: same bundle ⇒ identical
8
+ * triples and IRIs. The `dkg okf` CLI command is a thin wrapper over this.
9
+ *
10
+ * See `CONTEXT.md` for the language/relationships/flagged-ambiguities and
11
+ * `docs/adr/0005-okf-rdf-mapping.md` for the locked OKF→RDF mapping.
12
+ */
13
+ export type { Quad, OkfDocument, OkfLink, OkfCitation, OkfMappingOptions, TypeRelation, ConceptMapping, OkfWarning, BundleImport, BundleFile, ConformanceReport, } from './types.js';
14
+ export * from './constants.js';
15
+ export { RESERVED_FILENAMES, isValidSegment, basename, isReservedFile, isConceptFile, pathToConceptId, conceptIdToIri, conceptIdToKaName, resolveLinkTarget, } from './paths.js';
16
+ export { parseDocument, OkfDocumentError } from './document.js';
17
+ export { frontmatterQuads, parseBody, mapConcept } from './mapping.js';
18
+ export { importBundle } from './bundle.js';
19
+ export { exportBundle } from './export.js';
20
+ export { validateBundle } from './validation.js';
21
+ export { quadsToNQuads } from './nquads.js';
22
+ export { loadBundleDir, loadBundleDirWithReport } from './loader.js';
23
+ export { isSafeIri, literalTerm, typedLiteralTerm } from './utils.js';
24
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,YAAY,EACV,IAAI,EACJ,WAAW,EACX,OAAO,EACP,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,UAAU,EACV,YAAY,EACZ,UAAU,EACV,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAEpB,cAAc,gBAAgB,CAAC;AAE/B,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,QAAQ,EACR,cAAc,EACd,aAAa,EACb,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,23 @@
1
+ /**
2
+ * `@origintrail-official/dkg-okf` — deterministic Google Open Knowledge Format
3
+ * (OKF) → DKG Knowledge Asset mapper.
4
+ *
5
+ * Turns a portable OKF bundle (Markdown + YAML frontmatter + untyped cross-links)
6
+ * into owned, verifiable RDF Knowledge Assets, reconstructing the bundle's
7
+ * cross-concept link graph. Pure, no LLM, no network: same bundle ⇒ identical
8
+ * triples and IRIs. The `dkg okf` CLI command is a thin wrapper over this.
9
+ *
10
+ * See `CONTEXT.md` for the language/relationships/flagged-ambiguities and
11
+ * `docs/adr/0005-okf-rdf-mapping.md` for the locked OKF→RDF mapping.
12
+ */
13
+ export * from './constants.js';
14
+ export { RESERVED_FILENAMES, isValidSegment, basename, isReservedFile, isConceptFile, pathToConceptId, conceptIdToIri, conceptIdToKaName, resolveLinkTarget, } from './paths.js';
15
+ export { parseDocument, OkfDocumentError } from './document.js';
16
+ export { frontmatterQuads, parseBody, mapConcept } from './mapping.js';
17
+ export { importBundle } from './bundle.js';
18
+ export { exportBundle } from './export.js';
19
+ export { validateBundle } from './validation.js';
20
+ export { quadsToNQuads } from './nquads.js';
21
+ export { loadBundleDir, loadBundleDirWithReport } from './loader.js';
22
+ export { isSafeIri, literalTerm, typedLiteralTerm } from './utils.js';
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAgBH,cAAc,gBAAgB,CAAC;AAE/B,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,QAAQ,EACR,cAAc,EACd,aAAa,EACb,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The package's only filesystem surface: read an OKF bundle directory into the
3
+ * in-memory `BundleFile[]` the pure mapper consumes. Kept separate so the mapper
4
+ * itself stays I/O-free and unit-testable in isolation.
5
+ */
6
+ import type { BundleFile } from './types.js';
7
+ /**
8
+ * Recursively read all `.md` files under `dir` as bundle-relative POSIX paths.
9
+ *
10
+ * Symbolic links are NOT followed (`lstat`, not `stat`): a bundle could ship a
11
+ * `secret.md -> ~/.dkg/auth.token` symlink, and following it would slurp a local
12
+ * file into the graph and (with `--share`) gossip it. Symlinked entries are
13
+ * skipped and collected in `skippedSymlinks` so callers can surface them.
14
+ */
15
+ export declare function loadBundleDir(dir: string): BundleFile[];
16
+ export declare function loadBundleDirWithReport(dir: string): {
17
+ files: BundleFile[];
18
+ skippedSymlinks: string[];
19
+ };
20
+ //# sourceMappingURL=loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,EAAE,CAEvD;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG;IACpD,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B,CAqBA"}
package/dist/loader.js ADDED
@@ -0,0 +1,42 @@
1
+ /**
2
+ * The package's only filesystem surface: read an OKF bundle directory into the
3
+ * in-memory `BundleFile[]` the pure mapper consumes. Kept separate so the mapper
4
+ * itself stays I/O-free and unit-testable in isolation.
5
+ */
6
+ import { readdirSync, readFileSync, lstatSync } from 'node:fs';
7
+ import { join, relative, sep } from 'node:path';
8
+ /**
9
+ * Recursively read all `.md` files under `dir` as bundle-relative POSIX paths.
10
+ *
11
+ * Symbolic links are NOT followed (`lstat`, not `stat`): a bundle could ship a
12
+ * `secret.md -> ~/.dkg/auth.token` symlink, and following it would slurp a local
13
+ * file into the graph and (with `--share`) gossip it. Symlinked entries are
14
+ * skipped and collected in `skippedSymlinks` so callers can surface them.
15
+ */
16
+ export function loadBundleDir(dir) {
17
+ return loadBundleDirWithReport(dir).files;
18
+ }
19
+ export function loadBundleDirWithReport(dir) {
20
+ const out = [];
21
+ const skippedSymlinks = [];
22
+ const walk = (current) => {
23
+ for (const entry of readdirSync(current).sort()) {
24
+ const full = join(current, entry);
25
+ const st = lstatSync(full);
26
+ if (st.isSymbolicLink()) {
27
+ skippedSymlinks.push(relative(dir, full).split(sep).join('/'));
28
+ continue;
29
+ }
30
+ if (st.isDirectory()) {
31
+ walk(full);
32
+ }
33
+ else if (st.isFile() && entry.endsWith('.md')) {
34
+ const rel = relative(dir, full).split(sep).join('/');
35
+ out.push({ path: rel, content: readFileSync(full, 'utf8') });
36
+ }
37
+ }
38
+ };
39
+ walk(dir);
40
+ return { files: out, skippedSymlinks };
41
+ }
42
+ //# sourceMappingURL=loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.js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rD,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;YAC/D,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IACF,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,eAAe,EAAE,CAAC;AACzC,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Deterministic OKF concept → RDF mapping (no LLM, no network).
3
+ *
4
+ * One OKF concept document maps to one Knowledge Asset subject IRI plus a set
5
+ * of content + linkage quads. The mapping reuses the node Markdown extractor's
6
+ * predicate vocabulary (so an OKF import and a native Markdown import converge),
7
+ * with the OKF-specific deltas recorded in `docs/adr/0005-okf-rdf-mapping.md`:
8
+ *
9
+ * - body links are real Markdown links `[text](path)` (OKF §5), NOT the
10
+ * extractor's `[[wikilinks]]`, so we resolve them with a real Markdown AST
11
+ * (`mdast-util-from-markdown`) — which is also what lets us honour the
12
+ * CommonMark rule that a link inside an inline code span is literal text;
13
+ * - OKF concept titles live in frontmatter, so body headings (including `#`
14
+ * H1s like `# Schema`) are genuine sections → `dkg:hasSection`;
15
+ * - `timestamp` is OKF's last-modified time → `schema:dateModified`.
16
+ */
17
+ import type { OkfDocument, OkfMappingOptions, ConceptMapping, Quad, OkfCitation } from './types.js';
18
+ /** Map the YAML frontmatter to quads (SPEC §4.1; see the locked table in ADR 0005). */
19
+ export declare function frontmatterQuads(iri: string, frontmatter: Record<string, unknown>): Quad[];
20
+ interface ParsedBody {
21
+ headings: string[];
22
+ /** Real Markdown links found outside the Citations section. */
23
+ bodyLinks: string[];
24
+ /** `[label](target)` patterns found inside inline code spans (outside Citations). */
25
+ codeSpanHrefs: string[];
26
+ /** Citations gathered from the `# Citations` section (both styles). */
27
+ citations: OkfCitation[];
28
+ }
29
+ /** Parse a concept body with a real Markdown AST. */
30
+ export declare function parseBody(body: string): ParsedBody;
31
+ /**
32
+ * Map a single concept to its Knowledge Asset quads + structured link/citation
33
+ * diagnostics. `conceptExists` decides whether a resolved link target is in the
34
+ * bundle (a candidate that is not present is a broken link — warned, never fatal).
35
+ */
36
+ export declare function mapConcept(doc: OkfDocument, iri: string, conceptExists: (conceptId: string) => boolean, opts?: OkfMappingOptions): ConceptMapping;
37
+ export {};
38
+ //# sourceMappingURL=mapping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapping.d.ts","sourceRoot":"","sources":["../src/mapping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAiCH,OAAO,KAAK,EACV,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,IAAI,EAEJ,WAAW,EACZ,MAAM,YAAY,CAAC;AAqCpB,uFAAuF;AACvF,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EAAE,CAmD1F;AAED,UAAU,UAAU;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,+DAA+D;IAC/D,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,qFAAqF;IACrF,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,uEAAuE;IACvE,SAAS,EAAE,WAAW,EAAE,CAAC;CAC1B;AAiBD,qDAAqD;AACrD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAmClD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,GAAG,EAAE,WAAW,EAChB,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,EAC7C,IAAI,GAAE,iBAAsB,GAC3B,cAAc,CAmFhB"}