@instruments/taxonomy 0.2.0 → 1.0.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,160 +1,53 @@
1
1
  # @instruments/taxonomy
2
2
 
3
- The canonical materials taxonomy for the Material Instruments ecosystem: the governed
4
- **dictionaries** (material families, sectors, and the hierarchical application zones) plus the
5
- **consumer crosswalks** that map an external vendor's local vocabulary onto the canon. This package
6
- is the single publishable home of the Material Semantics vocabularies that were previously vendored
7
- per-repo as drifting local copies.
3
+ The canonical, data-only interiors and architecture terminology corpus.
8
4
 
9
- It also publishes appearance concepts and a portable taste-assertion contract. Applications own
10
- their evidence stores and ranking policy; this package owns shared meaning, source crosswalk
11
- verdicts, and the envelope that lets evidence travel without turning a source label into fact.
5
+ ## Version one contract
12
6
 
13
- ## Install
7
+ The package root exports the governed corpus and its release metadata:
14
8
 
15
- ```sh
16
- pnpm add @instruments/taxonomy
17
- ```
18
-
19
- ## Import paths
20
-
21
- ### `@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.
22
14
 
23
- The pinned public vocabularies: `MATERIAL_FAMILIES` (17), `SECTORS` (10), `APPLICATIONS` (88 — 30
24
- top-level zones plus 58 children). Each ships a `*_TERMS` array of labelled `TaxonomyTerm`s, an
25
- `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.
26
16
 
27
- ```ts
28
- import {
29
- APPLICATIONS,
30
- MATERIAL_FAMILIES,
31
- applicationTopLevelOf,
32
- isMaterialFamily,
33
- type Application,
34
- } from "@instruments/taxonomy";
17
+ Every public identity is a permanent HTTPS URI with lowercase kebab-case path segments:
35
18
 
36
- isMaterialFamily("wood"); // true
37
- applicationTopLevelOf("stair_tread"); // "stair_elevator"
38
- 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
39
23
  ```
40
24
 
41
- ### `@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.
42
26
 
43
- Maps the Materials In Use (MIU) local vocabularies onto the canonical dictionaries. Total,
44
- compile-time-checked `Record` maps plus string accessors that resolve unknown input to `null`
45
- instead of throwing.
27
+ ## Install and consume
46
28
 
47
- ```ts
48
- import {
49
- miuFamilyToCanonical,
50
- MIU_SURFACE_APPLICATION_TO_CANONICAL,
51
- } from "@instruments/taxonomy/crosswalks/miu";
52
-
53
- miuFamilyToCanonical("ceramic_porcelain"); // "tile"
54
- miuFamilyToCanonical("greenery_planting"); // null (declines to classify)
55
- MIU_SURFACE_APPLICATION_TO_CANONICAL.railing; // "stair_railing"
29
+ ```sh
30
+ pnpm add @instruments/taxonomy
56
31
  ```
57
32
 
58
- ### Canonical bundles and match semantics
59
-
60
- Consumers compose qualified assertions into canonical bundles rather than minting app-specific
61
- compound tags. Every constitutive assertion is required; matched constitutive assertions score 2
62
- and matched accents score 1. Unroled assertions default to accent, extra candidate annotations are
63
- not penalised, and the package publishes residential and commercial test vectors so another
64
- language can reproduce the ranking exactly.
65
-
66
33
  ```ts
67
- import { defineBundle, matchBundle } from "@instruments/taxonomy";
68
-
69
- const quietKitchen = defineBundle([
70
- { assertion: "space.kitchen", role: "constitutive" },
71
- { assertion: "mood.calm" },
72
- { assertion: "style.minimalism" },
73
- ]);
74
-
75
- matchBundle(quietKitchen, ["space.kitchen", "mood.calm"]);
76
- // { eligible: true, score: 0.75, ... }
77
- ```
78
-
79
- `defineAlternatives` preserves a source term known to have one of several readings without
80
- guessing. The DesignShop and materia `Modern` crosswalk rows now carry an explicit any-of between
81
- `style.modernism` and `style.contemporary` instead of disappearing from downstream joins.
82
-
83
- ### Appearance axes
84
-
85
- Product category, specific material, pattern, finish, format and construction are independent
86
- axes. That separation is deliberate: plain porcelain, geometric porcelain and stone-effect
87
- porcelain share `material.porcelain` while carrying different pattern concepts. A commercial
88
- carpet and residential wallcovering use the same pattern semantics; there is no “commercial
89
- style” branch.
90
-
91
- Requirement concepts name dimensions such as slip resistance, availability and fire performance.
92
- The assertion envelope carries the operator and required value separately, because a taxonomy can
93
- name the question but cannot assert that a particular product passes it.
94
-
95
- ### `@instruments/taxonomy/crosswalks/designshop`
96
-
97
- 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";
98
39
 
99
- ```ts
100
- 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
+ );
101
45
 
102
- canonicaliseDesignShop({
103
- provenance: {
104
- sourceRecordId: "scheme:123",
105
- sourceSnapshotVersion: "designshop-estate-1",
106
- sourceSystem: "designshop",
107
- },
108
- sourceField: "pattern",
109
- sourceValue: "Solid",
110
- });
111
- // resolved -> pattern.plain
46
+ const walnutReadings = LEXICAL_ENTRIES.find(
47
+ (entry) => entry.phrase === "walnut"
48
+ );
112
49
  ```
113
50
 
114
- `resolved`, `ambiguous`, `unresolved` and `declined` are different results. Unknown input remains
115
- unresolved with its raw value intact; only a curated row can decline. `Modern` remains an ambiguous
116
- choice between contemporary and modernism until another source or a person confirms one reading.
117
- `DESIGNSHOP_APPEARANCE_TEST_VECTORS` is the executable consumer contract.
118
-
119
- ### `@instruments/taxonomy/taste`
120
-
121
- `PortableTasteAssertion` separates actor, taste subject and project; taste, context and
122
- requirement roles; canonical and unresolved meaning; scope, authority, polarity, time and
123
- provenance. It intentionally contains no boost, rank or serving weight. Those are application
124
- policy, not portable meaning. Requirement assertions additionally carry a typed constraint.
125
-
126
- `PORTABLE_ASSERTION_TEST_VECTORS` gives TypeScript and non-TypeScript consumers stable fixtures for
127
- serialization and contract tests.
128
-
129
- ## Provenance and the re-sync ritual
130
-
131
- The dictionaries are lifted **verbatim** from materialgraph —
132
- `packages/schema/src/registry/value-dictionaries.ts`, snapshot `2026-07-08` (see the exported
133
- `PROVENANCE` constant). Every term was lifecycle-active at that snapshot; lifecycle fields are
134
- deferred from the published shape until governance needs them.
135
-
136
- To re-sync: re-read the upstream file, re-check the terms list, the `broaderTermId` edges, and the
137
- lifecycle fields, then bump this package. `src/materialgraph-sync.test.ts` mechanises the check — it
138
- reads a sibling `~/Sites/materialgraph` checkout and asserts every id is still present upstream
139
- (skipping only when that checkout is absent).
140
-
141
- ## The other-vs-null policy
142
-
143
- For families and sectors, `other` is a **positive** classification — the canon's own dictionary
144
- would file the term under `other`. `null` **declines** to classify: it is not a member at all, it
145
- spans members, or any claim (including `other`) would be false. `unknown` therefore always maps to
146
- `null`, never `other` — unknown is epistemic ("we couldn't identify it") while other is ontological
147
- ("identified; fits no bucket"); the application crosswalk has no `other` term at all, so there its
148
- policy collapses to mapped-or-`null`.
149
-
150
- ## Versioning
151
-
152
- Semver; changesets will drive releases later. Consumers should keep a **single pin** of this
153
- package. The anti-pattern to avoid is the colorscope `3.6.0` / `3.7.1` split, where two pinned
154
- copies of the same taxonomy drifted apart inside one dependency graph — the exact fragmentation this
155
- package exists to end.
156
-
157
- ## 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.
158
52
 
159
- Additive minors, all backward-compatible: an exported Material Bank category tree artifact, and
160
- 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.