agentfootprint 9.111.0 → 9.112.0
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 +29 -0
- package/CLAUDE.md +2 -2
- 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/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/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
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,35 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [9.112.0] - 2026-09-18
|
|
9
|
+
|
|
10
|
+
### Added — bringing your own taxonomy: SKOS in, our map out
|
|
11
|
+
|
|
12
|
+
- `fromSkos(input, join)` on `agentfootprint/ontology` reads a customer's SKOS concept scheme —
|
|
13
|
+
JSON-LD, already parsed (`@graph`, a flat array or one node; full IRIs, the `skos:` prefix, or
|
|
14
|
+
bare keys under the document's `@context`) — and returns an `OntologySpec` for `defineOntology`,
|
|
15
|
+
which stays the one shape everything reads. No inference: a concept's id is the last IRI
|
|
16
|
+
segment (lower-cased, `-`/space → `_`), its meaning `skos:definition` else `scopeNote` else the
|
|
17
|
+
prefLabel, its aliases every `altLabel`/`hiddenLabel` in the asked language (`join.language`,
|
|
18
|
+
default `'en'`) plus the prefLabel; `broader`/`narrower` → one `is-a` edge per pair, `related`
|
|
19
|
+
→ `related` once per pair; the scheme node's last segment and `dcterms:modified` /
|
|
20
|
+
`owl:versionInfo` / `schema:version` give id and version unless the join names them. What SKOS
|
|
21
|
+
cannot say — which source holds a term, which tool reads it, coverage, units — the host binds by
|
|
22
|
+
hand (`SkosJoin.sources` + `bind`); an unbound term has no sources, the honest state. Every
|
|
23
|
+
refusal is one `SkosError` with a `code` (`ERR_SKOS_…`), the IRI(s) and what was expected: no
|
|
24
|
+
label in the language, two concepts collapsing to one id, a relation to a concept the document
|
|
25
|
+
does not hold, a `broader` cycle, a missing id or version, a `bind` key the scheme does not hold.
|
|
26
|
+
- `readSkos(input, { language })` — the pure parse (concepts sorted by id, edges sorted, the
|
|
27
|
+
scheme's identity), for a host that wants to look before it joins.
|
|
28
|
+
- `toSkos(spec)` — the reverse walk to JSON-LD, with unit, sources, via, coverage and any other
|
|
29
|
+
relation in a `footprint:` namespace declared in the `@context`; `readSkos(toSkos(spec))` gives
|
|
30
|
+
the spec's terms and edges back (pinned). An export, not a serving: the model still reads
|
|
31
|
+
`ontologyPiece`.
|
|
32
|
+
- Nothing in the existing ontology moved: `define.ts`, `serve.ts`, `instruction.ts`, `score.ts`
|
|
33
|
+
and `types.ts` are untouched, and `test/ontology/fromSkos.test.ts` pins the hash and served text
|
|
34
|
+
of the reference spec to the literals captured before this release. Out of scope by ruling: a
|
|
35
|
+
Turtle parser, OWL, serving the map in SKOS vocabulary (bench first).
|
|
36
|
+
|
|
8
37
|
## [9.111.0] - 2026-09-18
|
|
9
38
|
|
|
10
39
|
### Added — the story's ask and return beats carry the tool call id
|
package/CLAUDE.md
CHANGED
|
@@ -87,7 +87,7 @@ does not exist, so the table can go out of date by OMISSION but can never lie
|
|
|
87
87
|
about what it names.
|
|
88
88
|
|
|
89
89
|
## Module map
|
|
90
|
-
Entry points — SEVENTEEN doors, and `package.json` `exports` is exhaustive, so a path not on this list does not resolve at all: `.` core API · `/providers` everything you plug a backend into (mock/anthropic/openai/bedrock/browser*, embedders, staticTools/gatedTools/skillScopedTools/mcpClient, thinking handlers, code runners) · `/memory` (defineMemory, MEMORY_TYPES, InMemoryStore, mockEmbedder, redis/agentcore/bedrockAgentMemory stores) · `/rag` index-time loaders/splitters/indexCorpus · `/cache` prompt caching (+ registerCacheStrategy; side-effectful, hence its own door) · `/observe` the whole watching story (recorders, recordRun, strategies + attach*, vendor sinks, run-autopsy finders, toSSE, status, locales) · `/events` typed event system · `/context` the injection engine (defineInjection/Skill/Fact/Instruction/Steering, decideSkill) · `/resilience` provider decorators + the reliability RULES · `/hosting` nodeHost/httpHost/standingAgent + session stores · `/security` permissions + tool credentials (it absorbed the old identity door) · `/reliability` the retained alias, kept ONLY because it is the sole home of the gate's `CircuitOpenError` · `/skill-graph` the framework-neutral routing layer · `/recipes` the declared unit of agent CONFIGURATION (defineAgentRecipe → `.recipe()`; authoring-time vocabulary, so it stays off the main barrel) · `/maps` the mount kernel's vocabulary (9.58.0: Claim<T> + the engagement lease machine + its renewal feed — pure data and pure functions, no run entry point; mounted via `.maps()`) · `/classify` the calibrated-classifier port (9.104.0: `Classifier`, `typesafe`, `mockClassifier`, `ClassifierError` — a backend that SCORES declared candidates; spent by `.findings({ judge })` and by `classifierScorer` on `/skill-graph`) · `/ontology` the declared map (9.106.0: `defineOntology`, `ontologyHash`, `ontologyPiece`, `ONTOLOGY_INSTRUCTION`, the shapes — what each term IS, how terms RELATE, which SOURCE holds a term and which registered TOOL reads it; pure data and pure functions, no run entry point, no fetch path; mounted via `.ontology()`, served as one request-only system piece per call). 9.0.0 removed sixteen older paths (`/llm-providers`, `/injection-engine`, `/tool-providers`, `/strategies`, `/observability-providers`, `/identity`, `/stream`, `/thinking`, `/status`, `/locales`, `/debug`, `/debug/finders`, `/memory-providers`, `/embedders`, `/hosting-providers`, `/observability/contextError/finders`) — it removed PATHS, not code; each name still ships through the door that absorbed it. This list is pinned against `package.json` by test/api-conformance/documented-doors.test.ts, and the removed sixteen by subpath-exports.test.ts. **Main barrel does NOT export** mock/browser*/defineMemory/defineSkill/skillGraph/mcpClient/InMemoryStore — import from the doors above.
|
|
90
|
+
Entry points — SEVENTEEN doors, and `package.json` `exports` is exhaustive, so a path not on this list does not resolve at all: `.` core API · `/providers` everything you plug a backend into (mock/anthropic/openai/bedrock/browser*, embedders, staticTools/gatedTools/skillScopedTools/mcpClient, thinking handlers, code runners) · `/memory` (defineMemory, MEMORY_TYPES, InMemoryStore, mockEmbedder, redis/agentcore/bedrockAgentMemory stores) · `/rag` index-time loaders/splitters/indexCorpus · `/cache` prompt caching (+ registerCacheStrategy; side-effectful, hence its own door) · `/observe` the whole watching story (recorders, recordRun, strategies + attach*, vendor sinks, run-autopsy finders, toSSE, status, locales) · `/events` typed event system · `/context` the injection engine (defineInjection/Skill/Fact/Instruction/Steering, decideSkill) · `/resilience` provider decorators + the reliability RULES · `/hosting` nodeHost/httpHost/standingAgent + session stores · `/security` permissions + tool credentials (it absorbed the old identity door) · `/reliability` the retained alias, kept ONLY because it is the sole home of the gate's `CircuitOpenError` · `/skill-graph` the framework-neutral routing layer · `/recipes` the declared unit of agent CONFIGURATION (defineAgentRecipe → `.recipe()`; authoring-time vocabulary, so it stays off the main barrel) · `/maps` the mount kernel's vocabulary (9.58.0: Claim<T> + the engagement lease machine + its renewal feed — pure data and pure functions, no run entry point; mounted via `.maps()`) · `/classify` the calibrated-classifier port (9.104.0: `Classifier`, `typesafe`, `mockClassifier`, `ClassifierError` — a backend that SCORES declared candidates; spent by `.findings({ judge })` and by `classifierScorer` on `/skill-graph`) · `/ontology` the declared map (9.106.0: `defineOntology`, `ontologyHash`, `ontologyPiece`, `ONTOLOGY_INSTRUCTION`, the shapes — what each term IS, how terms RELATE, which SOURCE holds a term and which registered TOOL reads it; pure data and pure functions, no run entry point, no fetch path; mounted via `.ontology()`, served as one request-only system piece per call; 9.112.0 `fromSkos`/`readSkos`/`toSkos` — the SKOS JSON-LD adapter onto the same spec, no second validation path). 9.0.0 removed sixteen older paths (`/llm-providers`, `/injection-engine`, `/tool-providers`, `/strategies`, `/observability-providers`, `/identity`, `/stream`, `/thinking`, `/status`, `/locales`, `/debug`, `/debug/finders`, `/memory-providers`, `/embedders`, `/hosting-providers`, `/observability/contextError/finders`) — it removed PATHS, not code; each name still ships through the door that absorbed it. This list is pinned against `package.json` by test/api-conformance/documented-doors.test.ts, and the removed sixteen by subpath-exports.test.ts. **Main barrel does NOT export** mock/browser*/defineMemory/defineSkill/skillGraph/mcpClient/InMemoryStore — import from the doors above.
|
|
91
91
|
|
|
92
92
|
| src/ | one job |
|
|
93
93
|
|---|---|
|
|
@@ -103,7 +103,7 @@ Entry points — SEVENTEEN doors, and `package.json` `exports` is exhaustive, so
|
|
|
103
103
|
| recorders/core/ | bridges footprintjs events → typed EventDispatcher (ContextRecorder, EmitBridge, typedEmit) — auto-attached by Agent.createExecutor; most factories also exported via `/observe` for manual wiring (EmitBridge itself stays internal) |
|
|
104
104
|
| recorders/observability/ | consumer recorders over the typed stream (RunStepRecorder, FlowchartRecorder, Status, Trace replay) + `recordRun` — THE producer of a recording `{snapshot, events, structure}` (the shape lens's `observeRecording` consumes; `structure` = `getSpec().buildTimeStructure`, which no snapshot carries). Anything that saves a run goes through it |
|
|
105
105
|
| rag/ | (8.10.0, door `/rag`) index-TIME: `DocumentLoader` adapters (text/markdown/html zero-dep, pdf via lazy `unpdf`) + `Splitter` factories + `indexCorpus` — a REAL footprintjs chart whose commit log IS the indexing report. `defineRAG` deliberately stays on the MAIN barrel (run-time wiring); this door is the half that runs once, before any agent exists |
|
|
106
|
-
| ontology/ | (9.106.0) the declared map — `defineOntology` (validate, detach, freeze, `ontologyHash` through the receipt's `stableJson`) + `serve.ts · ontologyPiece` (the ONE composer, called by `callLLM` and by `servedView.viewOf`; every line quotes the declaration under a constant header that quotes the context contract's three meanings) + `instruction.ts` (the always-on ask). Behind the `/ontology` door; `Agent.buildChart` checks every `via` tool name against `registryByName` at build; `seed` writes `AgentState.ontology` once; the grouped chart crosses the key into `sf-llm-call` under `hasOntology` |
|
|
106
|
+
| ontology/ | (9.106.0) the declared map — `defineOntology` (validate, detach, freeze, `ontologyHash` through the receipt's `stableJson`) + `serve.ts · ontologyPiece` (the ONE composer, called by `callLLM` and by `servedView.viewOf`; every line quotes the declaration under a constant header that quotes the context contract's three meanings) + `instruction.ts` (the always-on ask). Behind the `/ontology` door; `Agent.buildChart` checks every `via` tool name against `registryByName` at build; `seed` writes `AgentState.ontology` once; the grouped chart crosses the key into `sf-llm-call` under `hasOntology`. 9.112.0 `fromSkos.ts`/`toSkos.ts`/`skosJsonLd.ts` = the SKOS adapter (a customer's concept scheme → `OntologySpec` → `defineOntology`, and back); `define.ts`/`serve.ts`/`instruction.ts`/`score.ts`/`types.ts` untouched by it, pinned by test/ontology/fromSkos.test.ts |
|
|
107
107
|
| lib/ | first-party sub-libraries: injection-engine/, context-bisect/ (localizeContextBug, toBacktrackTrace + sliceToBacktrackTrace — the atui board serializers), influence-core/, trace-toolpack/ (selfExplain; 6 tools incl. variable-first `backtrack(variable, element?)`), context-ledger/ (which pieces EARNED their tokens — post-run offers/uses/outcomes bookkeeping + demote-never-starve gates `ledgerToolGate`/`ledgerEntryScorer`/`ledgerGated`; grouped-mode folds sf-llm-call inner logs, unmeterable runs → undefined; /observe), mcp/, rag/, tool-lint/ |
|
|
108
108
|
| memory/ | store/ (MemoryStore port) + pipeline presets + stages + beats/facts + causal/ (dev-only, TOP_K+search()-only) + wire/mountMemoryPipeline + retrieval/ (8.8.0: the `RetrievalStrategy` seam + `RetrievalEvidence`, the record a retrieval leaves — `topK()` is what every earlier release did unnamed) |
|
|
109
109
|
| maps/ | (9.58.0, door `/maps`) the mount kernel: claim/ (`Claim<T>` honesty primitive) + engagement/ (lease machine `advanceEngagement` + renewal feed `renewalEvidenceOf` + vocabulary). Pure data/functions; the ONE framework hook is `ctx.parkedIds` in the evaluator (the `leaseActiveIds` mirror), fed by the Evaluate stage; state rides `AgentState.mapEngagement` as a TOP-LEVEL array (the StepPointerCarrier law) |
|
|
@@ -0,0 +1,100 @@
|
|
|
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 type { OntologyEdge, OntologyNode, OntologyNodeSource, OntologySource, OntologySpec } from './types.js';
|
|
45
|
+
import { type JsonLdNode } from './skosJsonLd.js';
|
|
46
|
+
/** A JSON-LD document, already parsed: one node, an array of nodes, or `{ "@context"?, "@graph": [...] }`. */
|
|
47
|
+
export type SkosInput = JsonLdNode | readonly JsonLdNode[];
|
|
48
|
+
export type SkosErrorCode = 'ERR_SKOS_INPUT' | 'ERR_SKOS_NAMED_GRAPH' | 'ERR_SKOS_UNTYPED' | 'ERR_SKOS_NO_CONCEPTS' | 'ERR_SKOS_NO_LABEL' | 'ERR_SKOS_ID' | 'ERR_SKOS_ID_COLLISION' | 'ERR_SKOS_UNKNOWN_CONCEPT' | 'ERR_SKOS_CYCLE' | 'ERR_SKOS_SCHEME_MISSING' | 'ERR_SKOS_SCHEME_AMBIGUOUS' | 'ERR_SKOS_BIND_UNKNOWN_TERM';
|
|
49
|
+
/** The one error the reader throws: a `code`, the IRI(s) involved, what was expected. */
|
|
50
|
+
export declare class SkosError extends Error {
|
|
51
|
+
readonly code: SkosErrorCode;
|
|
52
|
+
readonly iris: readonly string[];
|
|
53
|
+
constructor(code: SkosErrorCode, message: string, iris?: readonly string[]);
|
|
54
|
+
}
|
|
55
|
+
/** How to read the document: which language's labels to take (default `'en'`). */
|
|
56
|
+
export interface ReadSkosOptions {
|
|
57
|
+
readonly language?: string;
|
|
58
|
+
}
|
|
59
|
+
/** One concept as read: its IRI, its derived id, and the node it becomes (no sources — SKOS has none). */
|
|
60
|
+
export interface SkosConcept {
|
|
61
|
+
readonly iri: string;
|
|
62
|
+
readonly id: string;
|
|
63
|
+
readonly prefLabel: string;
|
|
64
|
+
readonly node: OntologyNode;
|
|
65
|
+
}
|
|
66
|
+
/** The pure parse: the scheme's identity when the document carries it, the concepts, the edges. */
|
|
67
|
+
export interface SkosScheme {
|
|
68
|
+
readonly iri?: string;
|
|
69
|
+
readonly id?: string;
|
|
70
|
+
readonly version?: string;
|
|
71
|
+
readonly language: string;
|
|
72
|
+
readonly concepts: readonly SkosConcept[];
|
|
73
|
+
/** `is-a` from `broader`/`narrower` (once per pair), then `related` (once per pair, ends ordered by id), then `footprint:edge` entries — each group sorted, so node order and the broader/narrower spelling never move the hash. */
|
|
74
|
+
readonly edges: readonly OntologyEdge[];
|
|
75
|
+
}
|
|
76
|
+
/** What SKOS cannot say and the host binds by hand: sources, and which term is held where. */
|
|
77
|
+
export interface SkosJoin {
|
|
78
|
+
/** The map's id — else the scheme node's last IRI segment. */
|
|
79
|
+
readonly id?: string;
|
|
80
|
+
/** The map's version — else the scheme node's `dcterms:modified` / `owl:versionInfo` / `schema:version`. */
|
|
81
|
+
readonly version?: string;
|
|
82
|
+
/** Which language's labels to take (default `'en'`). */
|
|
83
|
+
readonly language?: string;
|
|
84
|
+
readonly sources: Readonly<Record<string, OntologySource>>;
|
|
85
|
+
/** term id → the sources holding it; a key naming a term the scheme does not hold is refused. */
|
|
86
|
+
readonly bind?: Readonly<Record<string, readonly OntologyNodeSource[]>>;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The pure parse: concepts (sorted by id), edges, and the scheme's identity
|
|
90
|
+
* when ONE `skos:ConceptScheme` node carries it. Refuses by code; never
|
|
91
|
+
* partial. Exported so a host can look before it joins, and for tests.
|
|
92
|
+
*/
|
|
93
|
+
export declare function readSkos(input: SkosInput, options?: ReadSkosOptions): SkosScheme;
|
|
94
|
+
/**
|
|
95
|
+
* The customer's scheme joined with the host's sources → an `OntologySpec`.
|
|
96
|
+
* The host calls `defineOntology(fromSkos(input, join))`: nothing is
|
|
97
|
+
* validated twice, and nothing is guessed — a term the join does not bind
|
|
98
|
+
* has no sources, which is the honest state.
|
|
99
|
+
*/
|
|
100
|
+
export declare function fromSkos(input: SkosInput, join: SkosJoin): OntologySpec;
|
|
@@ -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
|
+
{"version":3,"file":"fromSkos.js","sourceRoot":"","sources":["../../../src/ontology/fromSkos.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AASH,OAAO,EACL,SAAS,EACT,UAAU,EACV,SAAS,EACT,SAAS,EACT,UAAU,EACV,MAAM,EACN,QAAQ,EACR,UAAU,EACV,WAAW,EACX,IAAI,EAGJ,OAAO,EACP,QAAQ,EACR,YAAY,GACb,MAAM,iBAAiB,CAAC;AAmBzB,yFAAyF;AACzF,MAAM,OAAO,SAAU,SAAQ,KAAK;IACzB,IAAI,CAAgB;IACpB,IAAI,CAAoB;IACjC,YAAY,IAAmB,EAAE,OAAe,EAAE,OAA0B,EAAE;QAC5E,KAAK,CAA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AAE,GAAG,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,EAAE,CAAC;IAChC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC;IAC/C,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,4BAA4B,CAAC,CAAC,CAAC,WAAW,MAAM,CAAC,GAAG,GAAG,CAAC;IACjG,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;QACrB,MAAM,IAAI,SAAS,CACjB,yBAAyB,EACzB,oCAAoC,KAAK,8BAA8B,EACvE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAC/B,CAAC;IACJ,CAAC;IACD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,IAAI,SAAS,CACjB,yBAAyB,EACzB,8CAA8C,KAAK,qEAAqE,EACxH,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAC/B,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,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"}
|