agentfootprint 9.111.0 → 9.112.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 +48 -0
- package/CLAUDE.md +2 -2
- package/dist/esm/lib/injection-engine/intentScorer.js +15 -4
- package/dist/esm/lib/injection-engine/intentScorer.js.map +1 -1
- package/dist/esm/lib/injection-engine/routingPolicy.d.ts +3 -1
- package/dist/esm/lib/injection-engine/routingPolicy.js +15 -3
- package/dist/esm/lib/injection-engine/routingPolicy.js.map +1 -1
- package/dist/esm/ontology/fromSkos.d.ts +100 -0
- package/dist/esm/ontology/fromSkos.js +356 -0
- package/dist/esm/ontology/fromSkos.js.map +1 -0
- package/dist/esm/ontology/index.d.ts +6 -0
- package/dist/esm/ontology/index.js +6 -0
- package/dist/esm/ontology/index.js.map +1 -1
- package/dist/esm/ontology/skosJsonLd.d.ts +101 -0
- package/dist/esm/ontology/skosJsonLd.js +219 -0
- package/dist/esm/ontology/skosJsonLd.js.map +1 -0
- package/dist/esm/ontology/toSkos.d.ts +35 -0
- package/dist/esm/ontology/toSkos.js +105 -0
- package/dist/esm/ontology/toSkos.js.map +1 -0
- package/dist/lib/injection-engine/intentScorer.js +15 -4
- package/dist/lib/injection-engine/intentScorer.js.map +1 -1
- package/dist/lib/injection-engine/routingPolicy.js +15 -3
- package/dist/lib/injection-engine/routingPolicy.js.map +1 -1
- package/dist/ontology/fromSkos.js +362 -0
- package/dist/ontology/fromSkos.js.map +1 -0
- package/dist/ontology/index.js +14 -1
- package/dist/ontology/index.js.map +1 -1
- package/dist/ontology/skosJsonLd.js +232 -0
- package/dist/ontology/skosJsonLd.js.map +1 -0
- package/dist/ontology/toSkos.js +109 -0
- package/dist/ontology/toSkos.js.map +1 -0
- package/dist/types/lib/injection-engine/intentScorer.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/routingPolicy.d.ts +3 -1
- package/dist/types/lib/injection-engine/routingPolicy.d.ts.map +1 -1
- package/dist/types/ontology/fromSkos.d.ts +101 -0
- package/dist/types/ontology/fromSkos.d.ts.map +1 -0
- package/dist/types/ontology/index.d.ts +6 -0
- package/dist/types/ontology/index.d.ts.map +1 -1
- package/dist/types/ontology/skosJsonLd.d.ts +102 -0
- package/dist/types/ontology/skosJsonLd.d.ts.map +1 -0
- package/dist/types/ontology/toSkos.d.ts +36 -0
- package/dist/types/ontology/toSkos.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ontology/fromSkos — a customer's SKOS concept scheme (JSON-LD, already
|
|
3
|
+
* parsed) becomes OUR map: `readSkos` is the pure parse, `fromSkos` joins
|
|
4
|
+
* the host's sources onto it and returns an `OntologySpec` for
|
|
5
|
+
* `defineOntology` — the ONE shape everything else reads.
|
|
6
|
+
*
|
|
7
|
+
* Pattern: reader = adapter. Two pure functions over plain JSON; no I/O, no
|
|
8
|
+
* registry, no second validation path — the result goes through
|
|
9
|
+
* `defineOntology` unchanged, which is where an id that is not
|
|
10
|
+
* identifier-safe, an alias that collides with an id, or a source
|
|
11
|
+
* nobody declared is refused.
|
|
12
|
+
* Role: Map. Nothing here infers: a concept is a node typed
|
|
13
|
+
* `skos:Concept`, its id is the last segment of its IRI, its
|
|
14
|
+
* meaning is its `definition`, else its `scopeNote`, else its
|
|
15
|
+
* `prefLabel`; `broader` is `is-a`, `related` is `related`; every
|
|
16
|
+
* other name and every label in another language is left where it
|
|
17
|
+
* was. SKOS cannot say which SOURCE holds a term or which TOOL reads
|
|
18
|
+
* it — the host binds those by hand in `SkosJoin.bind`; a term with
|
|
19
|
+
* no binding is the honest state "declared, no source holds it".
|
|
20
|
+
* Emits: N/A.
|
|
21
|
+
*
|
|
22
|
+
* THE OWNER'S RULING (2026-09-18): customers already have taxonomies, almost
|
|
23
|
+
* always as SKOS. The library takes THEIRS in and turns it into OUR map;
|
|
24
|
+
* readers are adapters, `defineOntology` stays canonical. OWL is out of
|
|
25
|
+
* scope; a Turtle reader is a follow-up; serving the map back in SKOS
|
|
26
|
+
* vocabulary waits for the bench.
|
|
27
|
+
*
|
|
28
|
+
* REFUSALS — every one an `Error` with a `code` (`ERR_SKOS_…`), the IRI(s)
|
|
29
|
+
* involved and what was expected; the reader never returns a partial map:
|
|
30
|
+
* ERR_SKOS_INPUT not a JSON-LD document, or a node that is not an object
|
|
31
|
+
* ERR_SKOS_NAMED_GRAPH a node that is itself a named graph (`{ "@id", "@graph": [...] }`) —
|
|
32
|
+
* its concepts would be dropped without a word; flatten the document first
|
|
33
|
+
* ERR_SKOS_UNTYPED a node carrying SKOS properties with no `@type`
|
|
34
|
+
* ERR_SKOS_NO_CONCEPTS no `skos:Concept` in the document
|
|
35
|
+
* ERR_SKOS_NO_LABEL a concept with no prefLabel in the asked language
|
|
36
|
+
* ERR_SKOS_ID an IRI whose last segment is empty
|
|
37
|
+
* ERR_SKOS_ID_COLLISION two concepts collapsing to one id
|
|
38
|
+
* ERR_SKOS_UNKNOWN_CONCEPT a broader/narrower/related target the document does not hold
|
|
39
|
+
* ERR_SKOS_CYCLE a cycle in `broader` (SKOS forbids it)
|
|
40
|
+
* ERR_SKOS_SCHEME_MISSING no id or no version, from the join or the scheme node
|
|
41
|
+
* ERR_SKOS_SCHEME_AMBIGUOUS several scheme nodes and the join does not settle id and version
|
|
42
|
+
* ERR_SKOS_BIND_UNKNOWN_TERM a `bind` key naming a term the scheme does not hold
|
|
43
|
+
*/
|
|
44
|
+
import { expandIri, expandNode, FOOTPRINT, idFromIri, inLanguage, irisOf, isRecord, literalsOf, readContext, SKOS, typesOf, valuesOf, VERSION_IRIS, } from './skosJsonLd.js';
|
|
45
|
+
/** The one error the reader throws: a `code`, the IRI(s) involved, what was expected. */
|
|
46
|
+
export class SkosError extends Error {
|
|
47
|
+
code;
|
|
48
|
+
iris;
|
|
49
|
+
constructor(code, message, iris = []) {
|
|
50
|
+
super(`${code}: ${message}`);
|
|
51
|
+
this.name = 'SkosError';
|
|
52
|
+
this.code = code;
|
|
53
|
+
this.iris = Object.freeze([...iris]);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
57
|
+
const CONCEPT_PROPERTIES = [
|
|
58
|
+
SKOS.prefLabel,
|
|
59
|
+
SKOS.altLabel,
|
|
60
|
+
SKOS.hiddenLabel,
|
|
61
|
+
SKOS.definition,
|
|
62
|
+
SKOS.scopeNote,
|
|
63
|
+
SKOS.broader,
|
|
64
|
+
SKOS.narrower,
|
|
65
|
+
SKOS.related,
|
|
66
|
+
SKOS.inScheme,
|
|
67
|
+
SKOS.topConceptOf,
|
|
68
|
+
SKOS.hasTopConcept,
|
|
69
|
+
];
|
|
70
|
+
/** Split the input into its context and its node objects; refuse anything that is not a document. */
|
|
71
|
+
function readDocument(input) {
|
|
72
|
+
if (Array.isArray(input))
|
|
73
|
+
return { context: readContext(undefined), nodes: checkNodes(input) };
|
|
74
|
+
if (!isRecord(input)) {
|
|
75
|
+
throw new SkosError('ERR_SKOS_INPUT', 'expected a JSON-LD document: an object, an array of node objects, or { "@graph": [...] }.');
|
|
76
|
+
}
|
|
77
|
+
const context = readContext(input['@context']);
|
|
78
|
+
if ('@graph' in input) {
|
|
79
|
+
if (!Array.isArray(input['@graph'])) {
|
|
80
|
+
throw new SkosError('ERR_SKOS_INPUT', 'expected "@graph" to be an array of node objects.');
|
|
81
|
+
}
|
|
82
|
+
return { context, nodes: checkNodes(input['@graph']) };
|
|
83
|
+
}
|
|
84
|
+
const single = Object.fromEntries(Object.entries(input).filter(([key]) => key !== '@context'));
|
|
85
|
+
return { context, nodes: checkNodes([single]) };
|
|
86
|
+
}
|
|
87
|
+
function checkNodes(raw) {
|
|
88
|
+
return raw.map((node, i) => {
|
|
89
|
+
if (!isRecord(node)) {
|
|
90
|
+
throw new SkosError('ERR_SKOS_INPUT', `node ${i} is not an object; expected a JSON-LD node object.`);
|
|
91
|
+
}
|
|
92
|
+
// A named graph nested in the graph: JSON-LD allows it, this reader does not
|
|
93
|
+
// walk into it — and silently skipping it would hand back a partial map.
|
|
94
|
+
if ('@graph' in node) {
|
|
95
|
+
throw new SkosError('ERR_SKOS_NAMED_GRAPH', `node ${i}${typeof node['@id'] === 'string' ? ` ('${node['@id']}')` : ''} is a named graph; expected a flat "@graph" of node objects — flatten the document first.`, typeof node['@id'] === 'string' ? [node['@id']] : []);
|
|
96
|
+
}
|
|
97
|
+
return node;
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/** Sort the nodes by `@type`; a node with SKOS properties and no type is refused, never guessed. */
|
|
101
|
+
function typeNodes(doc) {
|
|
102
|
+
const concepts = [];
|
|
103
|
+
const schemes = [];
|
|
104
|
+
doc.nodes.forEach((node, i) => {
|
|
105
|
+
const props = expandNode(node, doc.context);
|
|
106
|
+
const rawId = props.get('@id');
|
|
107
|
+
const iri = typeof rawId === 'string' ? expandIri(rawId, doc.context) : `_:node${i}`;
|
|
108
|
+
const types = typesOf(props, doc.context);
|
|
109
|
+
if (types.includes(SKOS.Concept))
|
|
110
|
+
concepts.push({ iri, props });
|
|
111
|
+
else if (types.includes(SKOS.ConceptScheme))
|
|
112
|
+
schemes.push({ iri, props });
|
|
113
|
+
else if (types.length === 0 && CONCEPT_PROPERTIES.some((p) => props.has(p))) {
|
|
114
|
+
throw new SkosError('ERR_SKOS_UNTYPED', `node '${iri}' carries SKOS properties but no @type; expected skos:Concept or skos:ConceptScheme.`, [iri]);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
return { concepts, schemes };
|
|
118
|
+
}
|
|
119
|
+
function readConcept(raw, context, language) {
|
|
120
|
+
const { iri, props } = raw;
|
|
121
|
+
const id = idFromIri(iri);
|
|
122
|
+
if (id.length === 0) {
|
|
123
|
+
throw new SkosError('ERR_SKOS_ID', `concept '${iri}' has no last path or fragment segment to take an id from.`, [iri]);
|
|
124
|
+
}
|
|
125
|
+
const prefLabels = inLanguage(literalsOf(props, SKOS.prefLabel, context), language);
|
|
126
|
+
if (prefLabels.length === 0) {
|
|
127
|
+
const seen = literalsOf(props, SKOS.prefLabel, context).map((l) => l.language ?? 'untagged');
|
|
128
|
+
throw new SkosError('ERR_SKOS_NO_LABEL', `concept '${iri}' has no skos:prefLabel in language '${language}' (labels seen: ${seen.length === 0 ? 'none' : seen.join(', ')}); a label is never taken from another language.`, [iri]);
|
|
129
|
+
}
|
|
130
|
+
const prefLabel = prefLabels[0];
|
|
131
|
+
const meaning = inLanguage(literalsOf(props, SKOS.definition, context), language)[0] ??
|
|
132
|
+
inLanguage(literalsOf(props, SKOS.scopeNote, context), language)[0] ??
|
|
133
|
+
prefLabel;
|
|
134
|
+
const aliases = uniqueNames([
|
|
135
|
+
...inLanguage(literalsOf(props, SKOS.altLabel, context), language),
|
|
136
|
+
...inLanguage(literalsOf(props, SKOS.hiddenLabel, context), language),
|
|
137
|
+
...(prefLabel !== id ? [prefLabel] : []),
|
|
138
|
+
]).filter((alias) => alias !== id);
|
|
139
|
+
const unit = literalsOf(props, FOOTPRINT.unit, context)[0]?.value;
|
|
140
|
+
return {
|
|
141
|
+
iri,
|
|
142
|
+
id,
|
|
143
|
+
prefLabel,
|
|
144
|
+
node: {
|
|
145
|
+
meaning,
|
|
146
|
+
...(unit !== undefined && { unit }),
|
|
147
|
+
...(aliases.length > 0 && { aliases }),
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function uniqueNames(names) {
|
|
152
|
+
return [...new Set(names.map((n) => n.trim()).filter((n) => n.length > 0))];
|
|
153
|
+
}
|
|
154
|
+
/** Concepts sorted by id, with a collision refused naming both IRIs. */
|
|
155
|
+
function readConcepts(typed, context, language) {
|
|
156
|
+
if (typed.concepts.length === 0) {
|
|
157
|
+
throw new SkosError('ERR_SKOS_NO_CONCEPTS', 'the document holds no node typed skos:Concept.');
|
|
158
|
+
}
|
|
159
|
+
const byId = new Map();
|
|
160
|
+
for (const raw of typed.concepts) {
|
|
161
|
+
const concept = readConcept(raw, context, language);
|
|
162
|
+
const other = byId.get(concept.id);
|
|
163
|
+
if (other !== undefined) {
|
|
164
|
+
throw new SkosError('ERR_SKOS_ID_COLLISION', `concepts '${other.iri}' and '${concept.iri}' both collapse to id '${concept.id}'; expected distinct last segments.`, [other.iri, concept.iri]);
|
|
165
|
+
}
|
|
166
|
+
byId.set(concept.id, concept);
|
|
167
|
+
}
|
|
168
|
+
return [...byId.values()].sort((a, b) => (a.id < b.id ? -1 : 1));
|
|
169
|
+
}
|
|
170
|
+
// ─── Edges ──────────────────────────────────────────────────────────────
|
|
171
|
+
function readEdges(typed, concepts, context) {
|
|
172
|
+
const idOf = new Map(typed.concepts.map((c) => [c.iri, idFromIri(c.iri)]));
|
|
173
|
+
const resolve = (from, property, target) => {
|
|
174
|
+
const id = idOf.get(target);
|
|
175
|
+
if (id === undefined) {
|
|
176
|
+
throw new SkosError('ERR_SKOS_UNKNOWN_CONCEPT', `concept '${from}' has ${property} '${target}', which is not a skos:Concept in this document.`, [from, target]);
|
|
177
|
+
}
|
|
178
|
+
return id;
|
|
179
|
+
};
|
|
180
|
+
const propsOf = new Map(typed.concepts.map((c) => [c.iri, c.props]));
|
|
181
|
+
const isA = new Map();
|
|
182
|
+
const related = new Map();
|
|
183
|
+
const declared = [];
|
|
184
|
+
for (const concept of concepts) {
|
|
185
|
+
const props = propsOf.get(concept.iri) ?? new Map();
|
|
186
|
+
for (const target of irisOf(props, SKOS.broader, context)) {
|
|
187
|
+
addOnce(isA, {
|
|
188
|
+
from: concept.id,
|
|
189
|
+
to: resolve(concept.iri, 'skos:broader', target),
|
|
190
|
+
relation: 'is-a',
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
for (const target of irisOf(props, SKOS.narrower, context)) {
|
|
194
|
+
addOnce(isA, {
|
|
195
|
+
from: resolve(concept.iri, 'skos:narrower', target),
|
|
196
|
+
to: concept.id,
|
|
197
|
+
relation: 'is-a',
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
for (const target of irisOf(props, SKOS.related, context)) {
|
|
201
|
+
const other = resolve(concept.iri, 'skos:related', target);
|
|
202
|
+
const [from, to] = concept.id < other ? [concept.id, other] : [other, concept.id];
|
|
203
|
+
addOnce(related, { from, to, relation: 'related' });
|
|
204
|
+
}
|
|
205
|
+
for (const entry of valuesOf(props, FOOTPRINT.edge)) {
|
|
206
|
+
if (!isRecord(entry))
|
|
207
|
+
continue;
|
|
208
|
+
const edgeProps = expandNode(entry, context);
|
|
209
|
+
const target = irisOf(edgeProps, FOOTPRINT.to, context)[0];
|
|
210
|
+
const relation = literalsOf(edgeProps, FOOTPRINT.relation, context)[0]?.value;
|
|
211
|
+
const meaning = literalsOf(edgeProps, FOOTPRINT.meaning, context)[0]?.value;
|
|
212
|
+
if (target === undefined || relation === undefined)
|
|
213
|
+
continue;
|
|
214
|
+
const edge = {
|
|
215
|
+
from: concept.id,
|
|
216
|
+
to: resolve(concept.iri, 'footprint:edge', target),
|
|
217
|
+
relation,
|
|
218
|
+
...(meaning !== undefined && { meaning }),
|
|
219
|
+
};
|
|
220
|
+
// `toSkos` writes an `is-a`/`related` edge that carries a meaning BOTH
|
|
221
|
+
// as the SKOS relation and as a `footprint:edge`: the latter completes
|
|
222
|
+
// the former (same key, the meaning added) rather than doubling it.
|
|
223
|
+
const key = edgeKey(edge);
|
|
224
|
+
if (isA.has(key))
|
|
225
|
+
isA.set(key, edge);
|
|
226
|
+
else if (related.has(key))
|
|
227
|
+
related.set(key, edge);
|
|
228
|
+
else
|
|
229
|
+
declared.push(edge);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
// Sorted, so the same scheme written with `narrower` instead of `broader`
|
|
233
|
+
// (or in another node order) yields the same edges — and the same hash.
|
|
234
|
+
const edges = [
|
|
235
|
+
...sortEdges(isA.values()),
|
|
236
|
+
...sortEdges(related.values()),
|
|
237
|
+
...sortEdges(declared),
|
|
238
|
+
];
|
|
239
|
+
refuseCycles(concepts, [...isA.values()]);
|
|
240
|
+
return edges;
|
|
241
|
+
}
|
|
242
|
+
function sortEdges(edges) {
|
|
243
|
+
return [...edges].sort((a, b) => edgeKey(a).localeCompare(edgeKey(b)));
|
|
244
|
+
}
|
|
245
|
+
function edgeKey(edge) {
|
|
246
|
+
return `${edge.from} —${edge.relation}→ ${edge.to}`;
|
|
247
|
+
}
|
|
248
|
+
function addOnce(into, edge) {
|
|
249
|
+
const key = edgeKey(edge);
|
|
250
|
+
if (!into.has(key))
|
|
251
|
+
into.set(key, edge);
|
|
252
|
+
}
|
|
253
|
+
/** A cycle in `broader` is refused with the cycle named, id by id. */
|
|
254
|
+
function refuseCycles(concepts, isA) {
|
|
255
|
+
const broader = new Map();
|
|
256
|
+
for (const edge of isA)
|
|
257
|
+
broader.set(edge.from, [...(broader.get(edge.from) ?? []), edge.to]);
|
|
258
|
+
const done = new Set();
|
|
259
|
+
const iriOf = new Map(concepts.map((c) => [c.id, c.iri]));
|
|
260
|
+
const walk = (id, path) => {
|
|
261
|
+
const at = path.indexOf(id);
|
|
262
|
+
if (at >= 0) {
|
|
263
|
+
const cycle = [...path.slice(at), id];
|
|
264
|
+
throw new SkosError('ERR_SKOS_CYCLE', `skos:broader forms a cycle: ${cycle.join(' → ')}; SKOS forbids a concept broader than itself.`, cycle.map((c) => iriOf.get(c) ?? c));
|
|
265
|
+
}
|
|
266
|
+
if (done.has(id))
|
|
267
|
+
return;
|
|
268
|
+
for (const next of broader.get(id) ?? [])
|
|
269
|
+
walk(next, [...path, id]);
|
|
270
|
+
done.add(id);
|
|
271
|
+
};
|
|
272
|
+
for (const concept of concepts)
|
|
273
|
+
walk(concept.id, []);
|
|
274
|
+
}
|
|
275
|
+
function readSchemeIdentity(typed, context) {
|
|
276
|
+
if (typed.schemes.length !== 1)
|
|
277
|
+
return {};
|
|
278
|
+
const scheme = typed.schemes[0];
|
|
279
|
+
const id = idFromIri(scheme.iri);
|
|
280
|
+
let version;
|
|
281
|
+
for (const iri of VERSION_IRIS) {
|
|
282
|
+
version = literalsOf(scheme.props, iri, context)[0]?.value;
|
|
283
|
+
if (version !== undefined)
|
|
284
|
+
break;
|
|
285
|
+
}
|
|
286
|
+
return {
|
|
287
|
+
iri: scheme.iri,
|
|
288
|
+
...(id.length > 0 && { id }),
|
|
289
|
+
...(version !== undefined && { version }),
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
// ─── The two doors ──────────────────────────────────────────────────────
|
|
293
|
+
/**
|
|
294
|
+
* The pure parse: concepts (sorted by id), edges, and the scheme's identity
|
|
295
|
+
* when ONE `skos:ConceptScheme` node carries it. Refuses by code; never
|
|
296
|
+
* partial. Exported so a host can look before it joins, and for tests.
|
|
297
|
+
*/
|
|
298
|
+
export function readSkos(input, options = {}) {
|
|
299
|
+
const language = options.language ?? DEFAULT_LANGUAGE;
|
|
300
|
+
const doc = readDocument(input);
|
|
301
|
+
const typed = typeNodes(doc);
|
|
302
|
+
const concepts = readConcepts(typed, doc.context, language);
|
|
303
|
+
const edges = readEdges(typed, concepts, doc.context);
|
|
304
|
+
const scheme = readSchemeIdentity(typed, doc.context);
|
|
305
|
+
return Object.freeze({ ...scheme, language, concepts, edges });
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* The customer's scheme joined with the host's sources → an `OntologySpec`.
|
|
309
|
+
* The host calls `defineOntology(fromSkos(input, join))`: nothing is
|
|
310
|
+
* validated twice, and nothing is guessed — a term the join does not bind
|
|
311
|
+
* has no sources, which is the honest state.
|
|
312
|
+
*/
|
|
313
|
+
export function fromSkos(input, join) {
|
|
314
|
+
const typed = typeNodes(readDocument(input));
|
|
315
|
+
const scheme = readSkos(input, {
|
|
316
|
+
...(join.language !== undefined && { language: join.language }),
|
|
317
|
+
});
|
|
318
|
+
const identity = settleIdentity(typed, scheme, join);
|
|
319
|
+
const bind = join.bind ?? {};
|
|
320
|
+
const known = new Set(scheme.concepts.map((c) => c.id));
|
|
321
|
+
for (const term of Object.keys(bind)) {
|
|
322
|
+
if (!known.has(term)) {
|
|
323
|
+
throw new SkosError('ERR_SKOS_BIND_UNKNOWN_TERM', `bind names term '${term}', which the scheme does not hold; expected one of: ${[
|
|
324
|
+
...known,
|
|
325
|
+
].join(', ')}.`);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
const nodes = {};
|
|
329
|
+
for (const concept of scheme.concepts) {
|
|
330
|
+
const sources = bind[concept.id];
|
|
331
|
+
nodes[concept.id] = { ...concept.node, ...(sources !== undefined && { sources }) };
|
|
332
|
+
}
|
|
333
|
+
return {
|
|
334
|
+
id: identity.id,
|
|
335
|
+
version: identity.version,
|
|
336
|
+
sources: join.sources,
|
|
337
|
+
nodes,
|
|
338
|
+
edges: scheme.edges,
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
function settleIdentity(typed, scheme, join) {
|
|
342
|
+
if (typed.schemes.length > 1 && (join.id === undefined || join.version === undefined)) {
|
|
343
|
+
throw new SkosError('ERR_SKOS_SCHEME_AMBIGUOUS', `the document holds ${typed.schemes.length} skos:ConceptScheme nodes; expected one, or join.id and join.version to settle the identity.`, typed.schemes.map((s) => s.iri));
|
|
344
|
+
}
|
|
345
|
+
const id = join.id ?? scheme.id;
|
|
346
|
+
const version = join.version ?? scheme.version;
|
|
347
|
+
const where = scheme.iri === undefined ? 'no skos:ConceptScheme node' : `scheme '${scheme.iri}'`;
|
|
348
|
+
if (id === undefined) {
|
|
349
|
+
throw new SkosError('ERR_SKOS_SCHEME_MISSING', `no map id: join.id not given and ${where} yields no last IRI segment.`, scheme.iri ? [scheme.iri] : []);
|
|
350
|
+
}
|
|
351
|
+
if (version === undefined) {
|
|
352
|
+
throw new SkosError('ERR_SKOS_SCHEME_MISSING', `no map version: join.version not given and ${where} carries none of dcterms:modified, owl:versionInfo, schema:version.`, scheme.iri ? [scheme.iri] : []);
|
|
353
|
+
}
|
|
354
|
+
return { id, version };
|
|
355
|
+
}
|
|
356
|
+
//# sourceMappingURL=fromSkos.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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E,OAAO,EAAE,CAAC;AACzB,CAAC"}
|
|
@@ -7,9 +7,15 @@
|
|
|
7
7
|
* is the ONE way to build an `Ontology`; `.ontology(...)` on the agent
|
|
8
8
|
* builder is the ONE way to mount it; `ontologyPiece` is the ONE composer of
|
|
9
9
|
* what the model is served, called by the wire and by the rebuild.
|
|
10
|
+
* `fromSkos` / `readSkos` / `toSkos` (9.112.0) are the SKOS adapter — a
|
|
11
|
+
* customer's concept scheme in, our spec out, and back — never a second
|
|
12
|
+
* validation path: `defineOntology` still reads the result.
|
|
10
13
|
*/
|
|
11
14
|
export { defineOntology, ontologyHash, ONTOLOGY_LIMITS } from './define.js';
|
|
12
15
|
export { ONTOLOGY_INSTRUCTION, ONTOLOGY_INSTRUCTION_ID } from './instruction.js';
|
|
13
16
|
export { ontologyPiece, ONTOLOGY_PIECE_LIMITS, type OntologyPiece } from './serve.js';
|
|
14
17
|
export { scoreAbsence, summarizeAbsence, type AbsenceExpectation, type AbsenceScore, type AbsenceSummary, type AbsenceTurn, } from './score.js';
|
|
18
|
+
export { fromSkos, readSkos, SkosError, type ReadSkosOptions, type SkosConcept, type SkosErrorCode, type SkosInput, type SkosJoin, type SkosScheme, } from './fromSkos.js';
|
|
19
|
+
export { toSkos, SKOS_IRI_BASE, type SkosDocument, type ToSkosOptions } from './toSkos.js';
|
|
20
|
+
export { SKOS_NS, FOOTPRINT_NS } from './skosJsonLd.js';
|
|
15
21
|
export type { Ontology, OntologyAsk, OntologyEdge, OntologyJoin, OntologyNode, OntologyNodeSource, OntologyRecord, OntologySource, OntologySpec, } from './types.js';
|
|
@@ -7,9 +7,15 @@
|
|
|
7
7
|
* is the ONE way to build an `Ontology`; `.ontology(...)` on the agent
|
|
8
8
|
* builder is the ONE way to mount it; `ontologyPiece` is the ONE composer of
|
|
9
9
|
* what the model is served, called by the wire and by the rebuild.
|
|
10
|
+
* `fromSkos` / `readSkos` / `toSkos` (9.112.0) are the SKOS adapter — a
|
|
11
|
+
* customer's concept scheme in, our spec out, and back — never a second
|
|
12
|
+
* validation path: `defineOntology` still reads the result.
|
|
10
13
|
*/
|
|
11
14
|
export { defineOntology, ontologyHash, ONTOLOGY_LIMITS } from './define.js';
|
|
12
15
|
export { ONTOLOGY_INSTRUCTION, ONTOLOGY_INSTRUCTION_ID } from './instruction.js';
|
|
13
16
|
export { ontologyPiece, ONTOLOGY_PIECE_LIMITS } from './serve.js';
|
|
14
17
|
export { scoreAbsence, summarizeAbsence, } from './score.js';
|
|
18
|
+
export { fromSkos, readSkos, SkosError, } from './fromSkos.js';
|
|
19
|
+
export { toSkos, SKOS_IRI_BASE } from './toSkos.js';
|
|
20
|
+
export { SKOS_NS, FOOTPRINT_NS } from './skosJsonLd.js';
|
|
15
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ontology/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ontology/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAsB,MAAM,YAAY,CAAC;AACtF,OAAO,EACL,YAAY,EACZ,gBAAgB,GAKjB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,SAAS,GAOV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,aAAa,EAAyC,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ontology/skosJsonLd — the JSON-LD spellings a SKOS document uses, resolved
|
|
3
|
+
* to IRIs with no inference.
|
|
4
|
+
*
|
|
5
|
+
* Pattern: pure functions over an already-parsed JSON-LD document; a
|
|
6
|
+
* zero-import leaf under `fromSkos.ts`.
|
|
7
|
+
* Role: Map (reader side). A key is resolved by the document's own
|
|
8
|
+
* `@context` when it has one — a term mapping, a prefix, `@vocab` —
|
|
9
|
+
* else by the fixed table of the vocabularies SKOS documents lean on
|
|
10
|
+
* (`skos:`, `dcterms:`, `owl:`, `schema:`, `footprint:`). A full IRI
|
|
11
|
+
* is itself. A bare key no context maps is NOT a SKOS property: it
|
|
12
|
+
* is left unresolved, never guessed from its spelling.
|
|
13
|
+
* Emits: N/A.
|
|
14
|
+
*
|
|
15
|
+
* Out of scope, by the owner's ruling (2026-09-18): a Turtle parser (the
|
|
16
|
+
* input is an OBJECT), remote `@context` fetching (a context given by URL is
|
|
17
|
+
* not resolved), OWL.
|
|
18
|
+
*/
|
|
19
|
+
/** The SKOS core namespace. */
|
|
20
|
+
export declare const SKOS_NS = "http://www.w3.org/2004/02/skos/core#";
|
|
21
|
+
/** The OWL namespace — read for `owl:versionInfo` only; OWL itself is out of scope. */
|
|
22
|
+
export declare const OWL_NS = "http://www.w3.org/2002/07/owl#";
|
|
23
|
+
/** Our own namespace for what SKOS cannot say: units, sources, tools, coverage, other relations. */
|
|
24
|
+
export declare const FOOTPRINT_NS = "https://footprintjs.dev/ns/ontology#";
|
|
25
|
+
/** The prefixes the reader knows without a context — the fixed table. */
|
|
26
|
+
export declare const KNOWN_PREFIXES: Readonly<Record<string, string>>;
|
|
27
|
+
/** The IRIs the reader looks at, by name. */
|
|
28
|
+
export declare const SKOS: Readonly<{
|
|
29
|
+
readonly Concept: "http://www.w3.org/2004/02/skos/core#Concept";
|
|
30
|
+
readonly ConceptScheme: "http://www.w3.org/2004/02/skos/core#ConceptScheme";
|
|
31
|
+
readonly prefLabel: "http://www.w3.org/2004/02/skos/core#prefLabel";
|
|
32
|
+
readonly altLabel: "http://www.w3.org/2004/02/skos/core#altLabel";
|
|
33
|
+
readonly hiddenLabel: "http://www.w3.org/2004/02/skos/core#hiddenLabel";
|
|
34
|
+
readonly definition: "http://www.w3.org/2004/02/skos/core#definition";
|
|
35
|
+
readonly scopeNote: "http://www.w3.org/2004/02/skos/core#scopeNote";
|
|
36
|
+
readonly broader: "http://www.w3.org/2004/02/skos/core#broader";
|
|
37
|
+
readonly narrower: "http://www.w3.org/2004/02/skos/core#narrower";
|
|
38
|
+
readonly related: "http://www.w3.org/2004/02/skos/core#related";
|
|
39
|
+
readonly inScheme: "http://www.w3.org/2004/02/skos/core#inScheme";
|
|
40
|
+
readonly topConceptOf: "http://www.w3.org/2004/02/skos/core#topConceptOf";
|
|
41
|
+
readonly hasTopConcept: "http://www.w3.org/2004/02/skos/core#hasTopConcept";
|
|
42
|
+
}>;
|
|
43
|
+
/** Where a scheme's version may be written, in the order the reader looks. */
|
|
44
|
+
export declare const VERSION_IRIS: readonly string[];
|
|
45
|
+
/** The `footprint:` properties `toSkos` writes and `readSkos` reads back. */
|
|
46
|
+
export declare const FOOTPRINT: Readonly<{
|
|
47
|
+
readonly unit: "https://footprintjs.dev/ns/ontology#unit";
|
|
48
|
+
readonly edge: "https://footprintjs.dev/ns/ontology#edge";
|
|
49
|
+
readonly to: "https://footprintjs.dev/ns/ontology#to";
|
|
50
|
+
readonly relation: "https://footprintjs.dev/ns/ontology#relation";
|
|
51
|
+
readonly meaning: "https://footprintjs.dev/ns/ontology#meaning";
|
|
52
|
+
}>;
|
|
53
|
+
export type JsonLdNode = Readonly<Record<string, unknown>>;
|
|
54
|
+
/** A resolved `@context`: term → IRI, prefix → IRI, an optional `@vocab` and default `@language`. */
|
|
55
|
+
export interface SkosContext {
|
|
56
|
+
readonly terms: ReadonlyMap<string, string>;
|
|
57
|
+
readonly prefixes: ReadonlyMap<string, string>;
|
|
58
|
+
readonly vocab?: string;
|
|
59
|
+
readonly language?: string;
|
|
60
|
+
}
|
|
61
|
+
export declare function isRecord(value: unknown): value is JsonLdNode;
|
|
62
|
+
/**
|
|
63
|
+
* Read a `@context` (an object, an array of objects, or a URL — the last
|
|
64
|
+
* is not fetched). A term whose value is a string or `{ "@id": … }` maps
|
|
65
|
+
* to that IRI; a term whose value ends in `#` or `/` is also a prefix.
|
|
66
|
+
*/
|
|
67
|
+
export declare function readContext(context: unknown): SkosContext;
|
|
68
|
+
/**
|
|
69
|
+
* Resolve a key or a `@type` / `@id` value to an IRI: a keyword stays a
|
|
70
|
+
* keyword; a term the context maps; `prefix:local`; a full IRI; a bare
|
|
71
|
+
* name under `@vocab`. Anything else stays as written (a bare literal),
|
|
72
|
+
* which no SKOS IRI ever equals — so it is ignored, not misread.
|
|
73
|
+
*/
|
|
74
|
+
export declare function expandIri(value: string, context: SkosContext): string;
|
|
75
|
+
/** A node's properties keyed by expanded IRI (keywords keep their `@` names). */
|
|
76
|
+
export declare function expandNode(node: JsonLdNode, context: SkosContext): ReadonlyMap<string, unknown>;
|
|
77
|
+
/** Every value under a property as a flat list (`@list`, arrays and singles alike). */
|
|
78
|
+
export declare function valuesOf(node: ReadonlyMap<string, unknown>, iri: string): readonly unknown[];
|
|
79
|
+
/** The `@type` IRIs of a node. */
|
|
80
|
+
export declare function typesOf(node: ReadonlyMap<string, unknown>, context: SkosContext): readonly string[];
|
|
81
|
+
/** A language-tagged or plain literal. */
|
|
82
|
+
export interface Literal {
|
|
83
|
+
readonly value: string;
|
|
84
|
+
readonly language?: string;
|
|
85
|
+
}
|
|
86
|
+
/** The literals under a property: plain strings, numbers and `{ "@value", "@language"? }` objects. */
|
|
87
|
+
export declare function literalsOf(node: ReadonlyMap<string, unknown>, iri: string, context: SkosContext): readonly Literal[];
|
|
88
|
+
/** The IRIs a property points at: strings (resolved) and `{ "@id": … }` objects. */
|
|
89
|
+
export declare function irisOf(node: ReadonlyMap<string, unknown>, iri: string, context: SkosContext): readonly string[];
|
|
90
|
+
/**
|
|
91
|
+
* The literal in the asked language: a label TAGGED with it wins; a label
|
|
92
|
+
* with no tag at all serves any language (it is not tagged as another);
|
|
93
|
+
* a label tagged with a different language is never taken. Tags compare
|
|
94
|
+
* case-insensitively and exactly (`en` is not `en-US`).
|
|
95
|
+
*/
|
|
96
|
+
export declare function inLanguage(literals: readonly Literal[], language: string): readonly string[];
|
|
97
|
+
/**
|
|
98
|
+
* A concept id from its IRI: the last `/` or `#` segment, percent-decoded,
|
|
99
|
+
* lower-cased, `-` and spaces to `_`. Empty when the IRI ends in a delimiter.
|
|
100
|
+
*/
|
|
101
|
+
export declare function idFromIri(iri: string): string;
|