@instruments/taxonomy 0.3.0 → 1.1.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/README.md CHANGED
@@ -1,116 +1,53 @@
1
1
  # @instruments/taxonomy
2
2
 
3
- The canonical materials taxonomy for the Material Instruments ecosystem: the governed **dictionaries** (material families, sectors, and the hierarchical application zones) plus the **consumer crosswalks** that map an external vendor's local vocabulary onto the canon. This package is the single publishable home of the Material Semantics vocabularies that were previously vendored per-repo as drifting local copies.
3
+ The canonical, data-only interiors and architecture terminology corpus.
4
4
 
5
- It also publishes appearance concepts and a portable taste-assertion contract. Applications own their evidence stores and ranking policy; this package owns shared meaning, source crosswalk verdicts, and the envelope that lets evidence travel without turning a source label into fact.
5
+ ## Version one contract
6
6
 
7
- ## Install
7
+ The package root exports the governed corpus and its release metadata:
8
8
 
9
- ```sh
10
- pnpm add @instruments/taxonomy
11
- ```
12
-
13
- ## Import paths
14
-
15
- ### `@instruments/taxonomy` — the dictionaries
9
+ - `TAXONOMY_BASE_URI` — the authority used for every canonical concept URI.
10
+ - `KNOWLEDGE_GRAPH` — normalized axis, facet, and concept nodes plus typed, bidirectional edges.
11
+ - `LEXICAL_ENTRIES` — exhaustive declarative `equivalent`, `ambiguous`, and `declined` records for every canonical or observed authored spelling.
12
+ - `TAXONOMY_CORPUS_METADATA` — deterministic node, edge, and lexical counts with the corpus revision, snapshot, and package version.
13
+ - `TAXONOMY_CORPUS_REVISION`, `TAXONOMY_SNAPSHOT`, and `TAXONOMY_VERSION` — the exact content fingerprint, source snapshot, and package release identifiers.
16
14
 
17
- The pinned public vocabularies: `MATERIAL_FAMILIES` (17), `SECTORS` (10), `APPLICATIONS` (88 — 30 top-level zones plus 58 children). Each ships a `*_TERMS` array of labelled `TaxonomyTerm`s, an `as const` id tuple, a string-literal type, and a `Set`-backed guard.
15
+ It also exports the TypeScript types for those values. It does not export a resolver, matcher, ranker, search route, local IDs, semantic IDs, or legacy aliases. Consumers build policy on top of the same data; the repository's private HTTP adapter is one such consumer.
18
16
 
19
- ```ts
20
- import {
21
- APPLICATIONS,
22
- MATERIAL_FAMILIES,
23
- applicationTopLevelOf,
24
- isMaterialFamily,
25
- type Application,
26
- } from "@instruments/taxonomy";
17
+ Every public identity is a permanent HTTPS URI with lowercase kebab-case path segments:
27
18
 
28
- isMaterialFamily("wood"); // true
29
- applicationTopLevelOf("stair_tread"); // "stair_elevator"
30
- applicationTopLevelOf("wall"); // "wall" (already top-level)
19
+ ```text
20
+ https://taxonomy.materialinstruments.com/id/axis/material
21
+ https://taxonomy.materialinstruments.com/id/facet/palette/hue
22
+ https://taxonomy.materialinstruments.com/id/material/walnut
31
23
  ```
32
24
 
33
- ### `@instruments/taxonomy/crosswalks/miu` — the MIU consumer crosswalk
25
+ ColorScope remains authoritative for colour concepts. Taxonomy does not mint graph nodes or URIs for ColorScope-governed terms; lexical records reference ColorScope identifiers without merging them into Taxonomy hierarchy. For example, `walnut` has a governed primary material reading and a secondary ColorScope reading.
34
26
 
35
- Maps the Materials In Use (MIU) local vocabularies onto the canonical dictionaries. Total, compile-time-checked `Record` maps plus string accessors that resolve unknown input to `null` instead of throwing.
27
+ ## Install and consume
36
28
 
37
- ```ts
38
- import {
39
- miuFamilyToCanonical,
40
- MIU_SURFACE_APPLICATION_TO_CANONICAL,
41
- } from "@instruments/taxonomy/crosswalks/miu";
42
-
43
- miuFamilyToCanonical("ceramic_porcelain"); // "tile"
44
- miuFamilyToCanonical("greenery_planting"); // null (declines to classify)
45
- MIU_SURFACE_APPLICATION_TO_CANONICAL.railing; // "stair_railing"
29
+ ```sh
30
+ pnpm add @instruments/taxonomy
46
31
  ```
47
32
 
48
- ### Canonical bundles and match semantics
49
-
50
- Consumers compose qualified assertions into canonical bundles rather than minting app-specific compound tags. Every constitutive assertion is required; matched constitutive assertions score 2 and matched accents score 1. Unroled assertions default to accent, extra candidate annotations are not penalised, and the package publishes residential and commercial test vectors so another language can reproduce the ranking exactly.
51
-
52
33
  ```ts
53
- import { defineBundle, matchBundle } from "@instruments/taxonomy";
54
-
55
- const quietKitchen = defineBundle([
56
- { assertion: "space.kitchen", role: "constitutive" },
57
- { assertion: "mood.calm" },
58
- { assertion: "style.minimalism" },
59
- ]);
60
-
61
- matchBundle(quietKitchen, ["space.kitchen", "mood.calm"]);
62
- // { eligible: true, score: 0.75, ... }
63
- ```
64
-
65
- `defineAlternatives` preserves a source term known to have one of several readings without guessing. The DesignShop and materia `Modern` crosswalk rows now carry an explicit any-of between `style.modernism` and `style.contemporary` instead of disappearing from downstream joins.
66
-
67
- ### Appearance axes
68
-
69
- Product category, specific material, pattern, finish, format and construction are independent axes. That separation is deliberate: plain porcelain, geometric porcelain and stone-effect porcelain share `material.porcelain` while carrying different pattern concepts. A commercial carpet and residential wallcovering use the same pattern semantics; there is no “commercial style” branch.
70
-
71
- Requirement concepts name dimensions such as slip resistance, availability and fire performance. The assertion envelope carries the operator and required value separately, because a taxonomy can name the question but cannot assert that a particular product passes it.
72
-
73
- ### `@instruments/taxonomy/crosswalks/designshop`
74
-
75
- The frozen DesignShop vocabulary resolves through a versioned four-state crosswalk:
34
+ import {
35
+ KNOWLEDGE_GRAPH,
36
+ LEXICAL_ENTRIES,
37
+ TAXONOMY_CORPUS_METADATA,
38
+ } from "@instruments/taxonomy";
76
39
 
77
- ```ts
78
- import { canonicaliseDesignShop } from "@instruments/taxonomy/crosswalks/designshop";
40
+ const walnut = KNOWLEDGE_GRAPH.nodes.find(
41
+ (node) =>
42
+ node.kind === "concept" &&
43
+ node.uri === "https://taxonomy.materialinstruments.com/id/material/walnut"
44
+ );
79
45
 
80
- canonicaliseDesignShop({
81
- provenance: {
82
- sourceRecordId: "scheme:123",
83
- sourceSnapshotVersion: "designshop-estate-1",
84
- sourceSystem: "designshop",
85
- },
86
- sourceField: "pattern",
87
- sourceValue: "Solid",
88
- });
89
- // resolved -> pattern.plain
46
+ const walnutReadings = LEXICAL_ENTRIES.find(
47
+ (entry) => entry.phrase === "walnut"
48
+ );
90
49
  ```
91
50
 
92
- `resolved`, `ambiguous`, `unresolved` and `declined` are different results. Unknown input remains unresolved with its raw value intact; only a curated row can decline. `Modern` remains an ambiguous choice between contemporary and modernism until another source or a person confirms one reading. `DESIGNSHOP_APPEARANCE_TEST_VECTORS` is the executable consumer contract.
93
-
94
- ### `@instruments/taxonomy/taste`
95
-
96
- `PortableTasteAssertion` separates actor, taste subject and project; taste, context and requirement roles; canonical and unresolved meaning; scope, authority, polarity, time and provenance. It intentionally contains no boost, rank or serving weight. Those are application policy, not portable meaning. Requirement assertions additionally carry a typed constraint.
97
-
98
- `PORTABLE_ASSERTION_TEST_VECTORS` gives TypeScript and non-TypeScript consumers stable fixtures for serialization and contract tests.
99
-
100
- ## Provenance and the re-sync ritual
101
-
102
- The dictionaries are lifted **verbatim** from materialgraph — `packages/schema/src/registry/value-dictionaries.ts`, snapshot `2026-07-08` (see the exported `PROVENANCE` constant). Every term was lifecycle-active at that snapshot; lifecycle fields are deferred from the published shape until governance needs them.
103
-
104
- To re-sync: re-read the upstream file, re-check the terms list, the `broaderTermId` edges, and the lifecycle fields, then bump this package. `src/materialgraph-sync.test.ts` mechanises the check — it reads a sibling `~/Sites/materialgraph` checkout and asserts every id is still present upstream (skipping only when that checkout is absent).
105
-
106
- ## The other-vs-null policy
107
-
108
- For families and sectors, `other` is a **positive** classification — the canon's own dictionary would file the term under `other`. `null` **declines** to classify: it is not a member at all, it spans members, or any claim (including `other`) would be false. `unknown` therefore always maps to `null`, never `other` — unknown is epistemic ("we couldn't identify it") while other is ontological ("identified; fits no bucket"); the application crosswalk has no `other` term at all, so there its policy collapses to mapped-or-`null`.
109
-
110
- ## Versioning
111
-
112
- Semver; changesets will drive releases later. Consumers should keep a **single pin** of this package. The anti-pattern to avoid is the colorscope `3.6.0` / `3.7.1` split, where two pinned copies of the same taxonomy drifted apart inside one dependency graph — the exact fragmentation this package exists to end.
113
-
114
- ## Roadmap
51
+ Changes to canonical meaning or identity are governed corpus changes. There is deliberately no backward-compatibility layer in V1; consumers migrate to the canonical URI.
115
52
 
116
- Additive minors, all backward-compatible: an exported Material Bank category tree artifact, and per-term lifecycle fields (status, deprecation, successor pointers) once governance requires them.
53
+ Pin the exact package version and compare `TAXONOMY_CORPUS_REVISION` when a deployment needs to detect content drift. The revision is computed from the normalized graph and lexical entries, so it changes when governed corpus content changes even if the V1 API shape does not.