@nesso-how/vocab-learning 0.1.0-alpha.34
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/LICENSE +21 -0
- package/README.md +34 -0
- package/dist/index.d.ts +67 -0
- package/dist/index.js +704 -0
- package/package.json +31 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Omar Desogus
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# @nesso-how/vocab-learning
|
|
2
|
+
|
|
3
|
+
The **Nesso Learning Vocabulary** for [Nesso](https://nesso.how) — a self-contained graph vocabulary: 52 typed relation types in 8 categories, semantic coefficients, category palettes, and private node parameters (FSRS review fields).
|
|
4
|
+
|
|
5
|
+
Graph JSON files declare which vocabulary they use via `VOCABULARY.id` and a normative `version`.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @nesso-how/vocab-learning
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import {
|
|
17
|
+
VOCABULARY,
|
|
18
|
+
RELATION_TYPES,
|
|
19
|
+
RELATION_TYPE_VALUES,
|
|
20
|
+
defaultConceptReviewFields,
|
|
21
|
+
} from '@nesso-how/vocab-learning'
|
|
22
|
+
|
|
23
|
+
const def = RELATION_TYPES['causes']
|
|
24
|
+
// { cat: 'causal', label: 'causes', inverse: 'caused-by', ... }
|
|
25
|
+
|
|
26
|
+
const freshNode = defaultConceptReviewFields()
|
|
27
|
+
// { stability: 0, difficulty: 0, due: 0, ... }
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Relation types reference: [Relation types](https://nesso.how/docs/reference/relation-types/).
|
|
31
|
+
|
|
32
|
+
## License
|
|
33
|
+
|
|
34
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/** OKG vocabulary identity — version bumps only on normative vocabulary changes, not npm releases. */
|
|
2
|
+
export declare const VOCABULARY: {
|
|
3
|
+
readonly id: "@nesso-how/vocab-learning";
|
|
4
|
+
readonly name: "Nesso Learning Vocabulary";
|
|
5
|
+
readonly domain: "learning";
|
|
6
|
+
readonly version: "0.1.0";
|
|
7
|
+
};
|
|
8
|
+
/** Private dynamic node parameters declared by the Nesso Learning Vocabulary. */
|
|
9
|
+
export interface LearningNodeParams extends Record<string, unknown> {
|
|
10
|
+
stability: number;
|
|
11
|
+
difficulty: number;
|
|
12
|
+
reps: number;
|
|
13
|
+
lapses: number;
|
|
14
|
+
/** ts-fsrs State: 0=New 1=Learning 2=Review 3=Relearning */
|
|
15
|
+
fsrsState: number;
|
|
16
|
+
/** Unix ms; due when <= now (0 = new / immediate). */
|
|
17
|
+
due: number;
|
|
18
|
+
/** Unix ms; 0 = never reviewed. */
|
|
19
|
+
lastReview: number;
|
|
20
|
+
/** 0=unrated, 1=Again 2=Hard 3=Good 4=Easy (matches ts-fsrs Rating). */
|
|
21
|
+
lastRating: number;
|
|
22
|
+
/** FSRS learning-step index; optional for records saved before it existed. */
|
|
23
|
+
learningSteps?: number;
|
|
24
|
+
}
|
|
25
|
+
/** Fresh private params for a new or shared-import concept (no personal review history). */
|
|
26
|
+
export declare function defaultConceptReviewFields(): LearningNodeParams;
|
|
27
|
+
export type EdgeCategory = 'taxonomic' | 'structural' | 'causal' | 'dependency' | 'temporal' | 'opposition' | 'similarity' | 'epistemic';
|
|
28
|
+
export type EdgeTypeName = 'subtype-of' | 'has-subtype' | 'instance-of' | 'has-instance' | 'part-of' | 'contains' | 'made-of' | 'composes' | 'causes' | 'caused-by' | 'produces' | 'produced-by' | 'enables' | 'enabled-by' | 'prevents' | 'prevented-by' | 'triggers' | 'triggered-by' | 'inhibits' | 'inhibited-by' | 'disables' | 'disabled-by' | 'consumes' | 'consumed-by' | 'delays' | 'delayed-by' | 'requires' | 'required-by' | 'uses' | 'used-by' | 'used-for' | 'purpose-of' | 'precedes' | 'follows' | 'occurs-in' | 'has-occurrence' | 'during' | 'spans' | 'overlaps-with' | 'derives-from' | 'gives-rise-to' | 'contrasts-with' | 'opposite-of' | 'similar-to' | 'analogous-to' | 'supports' | 'supported-by' | 'contradicts' | 'explains' | 'explained-by' | 'defines' | 'defined-by';
|
|
29
|
+
export type GlyphKind = 'triangle-up' | 'circle-dot' | 'diamond' | 'diamond-open' | 'hash' | 'arrow-right' | 'asterisk' | 'key' | 'block' | 'spark' | 'anchor' | 'tool' | 'chevron-r' | 'ring' | 'tilde' | 'x' | 'minus' | 'flag' | 'approx' | 'arrows-lr' | 'check' | 'slash' | 'bulb' | 'equals' | 'lock' | 'flame' | 'hourglass' | 'brackets' | 'overlap' | 'branch';
|
|
30
|
+
/** Transitivity of a relation: `Y` strict, `N` none, `weak` with decay (algorithms may discount weight per step). */
|
|
31
|
+
export type Transitivity = 'Y' | 'N' | 'weak';
|
|
32
|
+
/** Polarity in signed-network terms: `+1` positive effect, `-1` antagonistic, `0` neutral/structural. */
|
|
33
|
+
export type Polarity = -1 | 0 | 1;
|
|
34
|
+
/** Expected mapping cardinality. `N-N` means no a-priori constraint. */
|
|
35
|
+
export type Cardinality = '1-1' | '1-N' | 'N-1' | 'N-N';
|
|
36
|
+
export interface EdgeTypeDef {
|
|
37
|
+
cat: EdgeCategory;
|
|
38
|
+
label: string;
|
|
39
|
+
line: 'solid' | 'dashed' | 'dotted' | 'double' | 'wavy';
|
|
40
|
+
glyph: GlyphKind;
|
|
41
|
+
transitive: Transitivity;
|
|
42
|
+
/** Canonical inverse in the set; `'self'` for symmetric types. */
|
|
43
|
+
inverse: EdgeTypeName | 'self';
|
|
44
|
+
/** Per-type semantic weight in 0..1; intensity, not per-edge confidence. */
|
|
45
|
+
strength: number;
|
|
46
|
+
polarity: Polarity;
|
|
47
|
+
cardinality: Cardinality;
|
|
48
|
+
}
|
|
49
|
+
/** Canonical category labels and prompts. */
|
|
50
|
+
export declare const RELATION_CATEGORY_META: Record<EdgeCategory, {
|
|
51
|
+
label: string;
|
|
52
|
+
subtitle: string;
|
|
53
|
+
}>;
|
|
54
|
+
export declare const RELATION_TYPES: Record<EdgeTypeName, EdgeTypeDef>;
|
|
55
|
+
export declare const RELATION_TYPE_VALUES: EdgeTypeName[];
|
|
56
|
+
/** Forward member of each inverse pair (first in `RELATION_TYPE_VALUES`); all symmetric types. */
|
|
57
|
+
export declare function isPrimaryRelationType(id: EdgeTypeName): boolean;
|
|
58
|
+
export type CategoryPalette = 'default' | 'vivid' | 'muted' | 'monoCat';
|
|
59
|
+
/** Per-category hex colors for each named palette. */
|
|
60
|
+
export declare const PALETTES: Record<CategoryPalette, Record<EdgeCategory, string>>;
|
|
61
|
+
/**
|
|
62
|
+
* Raw SVG inner content for each glyph kind, on a 14×14 viewBox.
|
|
63
|
+
* Uses `currentColor` for stroke/fill — set CSS `color` on the parent to tint.
|
|
64
|
+
* Default stroke attrs: fill=none, stroke=currentColor, stroke-width=1.4,
|
|
65
|
+
* stroke-linecap=round, stroke-linejoin=round.
|
|
66
|
+
*/
|
|
67
|
+
export declare const GLYPH_PATHS: Record<GlyphKind, string>;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,704 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
/** OKG vocabulary identity — version bumps only on normative vocabulary changes, not npm releases. */
|
|
3
|
+
export const VOCABULARY = {
|
|
4
|
+
id: '@nesso-how/vocab-learning',
|
|
5
|
+
name: 'Nesso Learning Vocabulary',
|
|
6
|
+
domain: 'learning',
|
|
7
|
+
version: '0.1.0',
|
|
8
|
+
};
|
|
9
|
+
/** Fresh private params for a new or shared-import concept (no personal review history). */
|
|
10
|
+
export function defaultConceptReviewFields() {
|
|
11
|
+
return {
|
|
12
|
+
stability: 0,
|
|
13
|
+
difficulty: 0,
|
|
14
|
+
reps: 0,
|
|
15
|
+
lapses: 0,
|
|
16
|
+
fsrsState: 0,
|
|
17
|
+
due: 0,
|
|
18
|
+
lastReview: 0,
|
|
19
|
+
lastRating: 0,
|
|
20
|
+
learningSteps: 0,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/** Canonical category labels and prompts. */
|
|
24
|
+
export const RELATION_CATEGORY_META = {
|
|
25
|
+
taxonomic: { label: 'Taxonomic', subtitle: 'What kind of thing?' },
|
|
26
|
+
structural: { label: 'Structural', subtitle: "What's it made of?" },
|
|
27
|
+
causal: { label: 'Causal', subtitle: 'What does it do?' },
|
|
28
|
+
dependency: { label: 'Dependency', subtitle: 'What does it need?' },
|
|
29
|
+
temporal: { label: 'Temporal', subtitle: 'When? Where?' },
|
|
30
|
+
opposition: { label: 'Opposition', subtitle: 'What does it contrast with?' },
|
|
31
|
+
similarity: { label: 'Similarity', subtitle: 'What is it like?' },
|
|
32
|
+
epistemic: { label: 'Epistemic', subtitle: 'How do we know?' },
|
|
33
|
+
};
|
|
34
|
+
export const RELATION_TYPES = {
|
|
35
|
+
// taxonomic ────────────────────────────────────────────────────────────
|
|
36
|
+
'subtype-of': {
|
|
37
|
+
cat: 'taxonomic',
|
|
38
|
+
label: 'subtype of',
|
|
39
|
+
line: 'double',
|
|
40
|
+
glyph: 'triangle-up',
|
|
41
|
+
transitive: 'Y',
|
|
42
|
+
inverse: 'has-subtype',
|
|
43
|
+
strength: 0.9,
|
|
44
|
+
polarity: 0,
|
|
45
|
+
cardinality: 'N-1',
|
|
46
|
+
},
|
|
47
|
+
'has-subtype': {
|
|
48
|
+
cat: 'taxonomic',
|
|
49
|
+
label: 'has subtype',
|
|
50
|
+
line: 'double',
|
|
51
|
+
glyph: 'triangle-up',
|
|
52
|
+
transitive: 'Y',
|
|
53
|
+
inverse: 'subtype-of',
|
|
54
|
+
strength: 0.9,
|
|
55
|
+
polarity: 0,
|
|
56
|
+
cardinality: '1-N',
|
|
57
|
+
},
|
|
58
|
+
'instance-of': {
|
|
59
|
+
cat: 'taxonomic',
|
|
60
|
+
label: 'instance of',
|
|
61
|
+
line: 'solid',
|
|
62
|
+
glyph: 'circle-dot',
|
|
63
|
+
transitive: 'N',
|
|
64
|
+
inverse: 'has-instance',
|
|
65
|
+
strength: 0.95,
|
|
66
|
+
polarity: 0,
|
|
67
|
+
cardinality: 'N-1',
|
|
68
|
+
},
|
|
69
|
+
'has-instance': {
|
|
70
|
+
cat: 'taxonomic',
|
|
71
|
+
label: 'has instance',
|
|
72
|
+
line: 'solid',
|
|
73
|
+
glyph: 'circle-dot',
|
|
74
|
+
transitive: 'N',
|
|
75
|
+
inverse: 'instance-of',
|
|
76
|
+
strength: 0.95,
|
|
77
|
+
polarity: 0,
|
|
78
|
+
cardinality: '1-N',
|
|
79
|
+
},
|
|
80
|
+
// structural ───────────────────────────────────────────────────────────
|
|
81
|
+
'part-of': {
|
|
82
|
+
cat: 'structural',
|
|
83
|
+
label: 'part of',
|
|
84
|
+
line: 'solid',
|
|
85
|
+
glyph: 'diamond',
|
|
86
|
+
transitive: 'Y',
|
|
87
|
+
inverse: 'contains',
|
|
88
|
+
strength: 0.85,
|
|
89
|
+
polarity: 0,
|
|
90
|
+
cardinality: 'N-1',
|
|
91
|
+
},
|
|
92
|
+
contains: {
|
|
93
|
+
cat: 'structural',
|
|
94
|
+
label: 'contains',
|
|
95
|
+
line: 'solid',
|
|
96
|
+
glyph: 'diamond-open',
|
|
97
|
+
transitive: 'Y',
|
|
98
|
+
inverse: 'part-of',
|
|
99
|
+
strength: 0.85,
|
|
100
|
+
polarity: 0,
|
|
101
|
+
cardinality: '1-N',
|
|
102
|
+
},
|
|
103
|
+
'made-of': {
|
|
104
|
+
cat: 'structural',
|
|
105
|
+
label: 'made of',
|
|
106
|
+
line: 'dashed',
|
|
107
|
+
glyph: 'hash',
|
|
108
|
+
transitive: 'weak',
|
|
109
|
+
inverse: 'composes',
|
|
110
|
+
strength: 0.75,
|
|
111
|
+
polarity: 0,
|
|
112
|
+
cardinality: 'N-N',
|
|
113
|
+
},
|
|
114
|
+
composes: {
|
|
115
|
+
cat: 'structural',
|
|
116
|
+
label: 'composes',
|
|
117
|
+
line: 'dashed',
|
|
118
|
+
glyph: 'hash',
|
|
119
|
+
transitive: 'weak',
|
|
120
|
+
inverse: 'made-of',
|
|
121
|
+
strength: 0.75,
|
|
122
|
+
polarity: 0,
|
|
123
|
+
cardinality: 'N-N',
|
|
124
|
+
},
|
|
125
|
+
// causal ───────────────────────────────────────────────────────────────
|
|
126
|
+
causes: {
|
|
127
|
+
cat: 'causal',
|
|
128
|
+
label: 'causes',
|
|
129
|
+
line: 'solid',
|
|
130
|
+
glyph: 'arrow-right',
|
|
131
|
+
transitive: 'N',
|
|
132
|
+
inverse: 'caused-by',
|
|
133
|
+
strength: 0.85,
|
|
134
|
+
polarity: 1,
|
|
135
|
+
cardinality: 'N-N',
|
|
136
|
+
},
|
|
137
|
+
'caused-by': {
|
|
138
|
+
cat: 'causal',
|
|
139
|
+
label: 'caused by',
|
|
140
|
+
line: 'solid',
|
|
141
|
+
glyph: 'arrow-right',
|
|
142
|
+
transitive: 'N',
|
|
143
|
+
inverse: 'causes',
|
|
144
|
+
strength: 0.85,
|
|
145
|
+
polarity: 1,
|
|
146
|
+
cardinality: 'N-N',
|
|
147
|
+
},
|
|
148
|
+
produces: {
|
|
149
|
+
cat: 'causal',
|
|
150
|
+
label: 'produces',
|
|
151
|
+
line: 'solid',
|
|
152
|
+
glyph: 'asterisk',
|
|
153
|
+
transitive: 'N',
|
|
154
|
+
inverse: 'produced-by',
|
|
155
|
+
strength: 0.7,
|
|
156
|
+
polarity: 1,
|
|
157
|
+
cardinality: 'N-N',
|
|
158
|
+
},
|
|
159
|
+
'produced-by': {
|
|
160
|
+
cat: 'causal',
|
|
161
|
+
label: 'produced by',
|
|
162
|
+
line: 'solid',
|
|
163
|
+
glyph: 'asterisk',
|
|
164
|
+
transitive: 'N',
|
|
165
|
+
inverse: 'produces',
|
|
166
|
+
strength: 0.7,
|
|
167
|
+
polarity: 1,
|
|
168
|
+
cardinality: 'N-N',
|
|
169
|
+
},
|
|
170
|
+
enables: {
|
|
171
|
+
cat: 'causal',
|
|
172
|
+
label: 'enables',
|
|
173
|
+
line: 'dotted',
|
|
174
|
+
glyph: 'key',
|
|
175
|
+
transitive: 'weak',
|
|
176
|
+
inverse: 'enabled-by',
|
|
177
|
+
strength: 0.6,
|
|
178
|
+
polarity: 1,
|
|
179
|
+
cardinality: 'N-N',
|
|
180
|
+
},
|
|
181
|
+
'enabled-by': {
|
|
182
|
+
cat: 'causal',
|
|
183
|
+
label: 'enabled by',
|
|
184
|
+
line: 'dotted',
|
|
185
|
+
glyph: 'key',
|
|
186
|
+
transitive: 'weak',
|
|
187
|
+
inverse: 'enables',
|
|
188
|
+
strength: 0.6,
|
|
189
|
+
polarity: 1,
|
|
190
|
+
cardinality: 'N-N',
|
|
191
|
+
},
|
|
192
|
+
prevents: {
|
|
193
|
+
cat: 'causal',
|
|
194
|
+
label: 'prevents',
|
|
195
|
+
line: 'dotted',
|
|
196
|
+
glyph: 'block',
|
|
197
|
+
transitive: 'N',
|
|
198
|
+
inverse: 'prevented-by',
|
|
199
|
+
strength: 0.85,
|
|
200
|
+
polarity: -1,
|
|
201
|
+
cardinality: 'N-N',
|
|
202
|
+
},
|
|
203
|
+
'prevented-by': {
|
|
204
|
+
cat: 'causal',
|
|
205
|
+
label: 'prevented by',
|
|
206
|
+
line: 'dotted',
|
|
207
|
+
glyph: 'block',
|
|
208
|
+
transitive: 'N',
|
|
209
|
+
inverse: 'prevents',
|
|
210
|
+
strength: 0.85,
|
|
211
|
+
polarity: -1,
|
|
212
|
+
cardinality: 'N-N',
|
|
213
|
+
},
|
|
214
|
+
triggers: {
|
|
215
|
+
cat: 'causal',
|
|
216
|
+
label: 'triggers',
|
|
217
|
+
line: 'solid',
|
|
218
|
+
glyph: 'spark',
|
|
219
|
+
transitive: 'N',
|
|
220
|
+
inverse: 'triggered-by',
|
|
221
|
+
strength: 0.7,
|
|
222
|
+
polarity: 1,
|
|
223
|
+
cardinality: 'N-N',
|
|
224
|
+
},
|
|
225
|
+
'triggered-by': {
|
|
226
|
+
cat: 'causal',
|
|
227
|
+
label: 'triggered by',
|
|
228
|
+
line: 'solid',
|
|
229
|
+
glyph: 'spark',
|
|
230
|
+
transitive: 'N',
|
|
231
|
+
inverse: 'triggers',
|
|
232
|
+
strength: 0.7,
|
|
233
|
+
polarity: 1,
|
|
234
|
+
cardinality: 'N-N',
|
|
235
|
+
},
|
|
236
|
+
inhibits: {
|
|
237
|
+
cat: 'causal',
|
|
238
|
+
label: 'inhibits',
|
|
239
|
+
line: 'dotted',
|
|
240
|
+
glyph: 'minus',
|
|
241
|
+
transitive: 'N',
|
|
242
|
+
inverse: 'inhibited-by',
|
|
243
|
+
strength: 0.55,
|
|
244
|
+
polarity: -1,
|
|
245
|
+
cardinality: 'N-N',
|
|
246
|
+
},
|
|
247
|
+
'inhibited-by': {
|
|
248
|
+
cat: 'causal',
|
|
249
|
+
label: 'inhibited by',
|
|
250
|
+
line: 'dotted',
|
|
251
|
+
glyph: 'minus',
|
|
252
|
+
transitive: 'N',
|
|
253
|
+
inverse: 'inhibits',
|
|
254
|
+
strength: 0.55,
|
|
255
|
+
polarity: -1,
|
|
256
|
+
cardinality: 'N-N',
|
|
257
|
+
},
|
|
258
|
+
disables: {
|
|
259
|
+
cat: 'causal',
|
|
260
|
+
label: 'disables',
|
|
261
|
+
line: 'dotted',
|
|
262
|
+
glyph: 'lock',
|
|
263
|
+
transitive: 'weak',
|
|
264
|
+
inverse: 'disabled-by',
|
|
265
|
+
strength: 0.6,
|
|
266
|
+
polarity: -1,
|
|
267
|
+
cardinality: 'N-N',
|
|
268
|
+
},
|
|
269
|
+
'disabled-by': {
|
|
270
|
+
cat: 'causal',
|
|
271
|
+
label: 'disabled by',
|
|
272
|
+
line: 'dotted',
|
|
273
|
+
glyph: 'lock',
|
|
274
|
+
transitive: 'weak',
|
|
275
|
+
inverse: 'disables',
|
|
276
|
+
strength: 0.6,
|
|
277
|
+
polarity: -1,
|
|
278
|
+
cardinality: 'N-N',
|
|
279
|
+
},
|
|
280
|
+
consumes: {
|
|
281
|
+
cat: 'causal',
|
|
282
|
+
label: 'consumes',
|
|
283
|
+
line: 'solid',
|
|
284
|
+
glyph: 'flame',
|
|
285
|
+
transitive: 'N',
|
|
286
|
+
inverse: 'consumed-by',
|
|
287
|
+
strength: 0.65,
|
|
288
|
+
polarity: -1,
|
|
289
|
+
cardinality: 'N-N',
|
|
290
|
+
},
|
|
291
|
+
'consumed-by': {
|
|
292
|
+
cat: 'causal',
|
|
293
|
+
label: 'consumed by',
|
|
294
|
+
line: 'solid',
|
|
295
|
+
glyph: 'flame',
|
|
296
|
+
transitive: 'N',
|
|
297
|
+
inverse: 'consumes',
|
|
298
|
+
strength: 0.65,
|
|
299
|
+
polarity: -1,
|
|
300
|
+
cardinality: 'N-N',
|
|
301
|
+
},
|
|
302
|
+
delays: {
|
|
303
|
+
cat: 'causal',
|
|
304
|
+
label: 'delays',
|
|
305
|
+
line: 'dotted',
|
|
306
|
+
glyph: 'hourglass',
|
|
307
|
+
transitive: 'weak',
|
|
308
|
+
inverse: 'delayed-by',
|
|
309
|
+
strength: 0.55,
|
|
310
|
+
polarity: -1,
|
|
311
|
+
cardinality: 'N-N',
|
|
312
|
+
},
|
|
313
|
+
'delayed-by': {
|
|
314
|
+
cat: 'causal',
|
|
315
|
+
label: 'delayed by',
|
|
316
|
+
line: 'dotted',
|
|
317
|
+
glyph: 'hourglass',
|
|
318
|
+
transitive: 'weak',
|
|
319
|
+
inverse: 'delays',
|
|
320
|
+
strength: 0.55,
|
|
321
|
+
polarity: -1,
|
|
322
|
+
cardinality: 'N-N',
|
|
323
|
+
},
|
|
324
|
+
// dependency ───────────────────────────────────────────────────────────
|
|
325
|
+
requires: {
|
|
326
|
+
cat: 'dependency',
|
|
327
|
+
label: 'requires',
|
|
328
|
+
line: 'solid',
|
|
329
|
+
glyph: 'anchor',
|
|
330
|
+
transitive: 'Y',
|
|
331
|
+
inverse: 'required-by',
|
|
332
|
+
strength: 0.85,
|
|
333
|
+
polarity: 0,
|
|
334
|
+
cardinality: 'N-N',
|
|
335
|
+
},
|
|
336
|
+
'required-by': {
|
|
337
|
+
cat: 'dependency',
|
|
338
|
+
label: 'required by',
|
|
339
|
+
line: 'solid',
|
|
340
|
+
glyph: 'anchor',
|
|
341
|
+
transitive: 'Y',
|
|
342
|
+
inverse: 'requires',
|
|
343
|
+
strength: 0.85,
|
|
344
|
+
polarity: 0,
|
|
345
|
+
cardinality: 'N-N',
|
|
346
|
+
},
|
|
347
|
+
uses: {
|
|
348
|
+
cat: 'dependency',
|
|
349
|
+
label: 'uses',
|
|
350
|
+
line: 'dashed',
|
|
351
|
+
glyph: 'tool',
|
|
352
|
+
transitive: 'weak',
|
|
353
|
+
inverse: 'used-by',
|
|
354
|
+
strength: 0.5,
|
|
355
|
+
polarity: 0,
|
|
356
|
+
cardinality: 'N-N',
|
|
357
|
+
},
|
|
358
|
+
'used-by': {
|
|
359
|
+
cat: 'dependency',
|
|
360
|
+
label: 'used by',
|
|
361
|
+
line: 'dashed',
|
|
362
|
+
glyph: 'tool',
|
|
363
|
+
transitive: 'weak',
|
|
364
|
+
inverse: 'uses',
|
|
365
|
+
strength: 0.5,
|
|
366
|
+
polarity: 0,
|
|
367
|
+
cardinality: 'N-N',
|
|
368
|
+
},
|
|
369
|
+
'used-for': {
|
|
370
|
+
cat: 'dependency',
|
|
371
|
+
label: 'used for',
|
|
372
|
+
line: 'dashed',
|
|
373
|
+
glyph: 'flag',
|
|
374
|
+
transitive: 'N',
|
|
375
|
+
inverse: 'purpose-of',
|
|
376
|
+
strength: 0.55,
|
|
377
|
+
polarity: 1,
|
|
378
|
+
cardinality: 'N-N',
|
|
379
|
+
},
|
|
380
|
+
'purpose-of': {
|
|
381
|
+
cat: 'dependency',
|
|
382
|
+
label: 'purpose of',
|
|
383
|
+
line: 'dashed',
|
|
384
|
+
glyph: 'flag',
|
|
385
|
+
transitive: 'N',
|
|
386
|
+
inverse: 'used-for',
|
|
387
|
+
strength: 0.55,
|
|
388
|
+
polarity: 1,
|
|
389
|
+
cardinality: 'N-N',
|
|
390
|
+
},
|
|
391
|
+
// temporal ─────────────────────────────────────────────────────────────
|
|
392
|
+
precedes: {
|
|
393
|
+
cat: 'temporal',
|
|
394
|
+
label: 'precedes',
|
|
395
|
+
line: 'solid',
|
|
396
|
+
glyph: 'chevron-r',
|
|
397
|
+
transitive: 'Y',
|
|
398
|
+
inverse: 'follows',
|
|
399
|
+
strength: 0.5,
|
|
400
|
+
polarity: 0,
|
|
401
|
+
cardinality: 'N-N',
|
|
402
|
+
},
|
|
403
|
+
follows: {
|
|
404
|
+
cat: 'temporal',
|
|
405
|
+
label: 'follows',
|
|
406
|
+
line: 'solid',
|
|
407
|
+
glyph: 'chevron-r',
|
|
408
|
+
transitive: 'Y',
|
|
409
|
+
inverse: 'precedes',
|
|
410
|
+
strength: 0.5,
|
|
411
|
+
polarity: 0,
|
|
412
|
+
cardinality: 'N-N',
|
|
413
|
+
},
|
|
414
|
+
'occurs-in': {
|
|
415
|
+
cat: 'temporal',
|
|
416
|
+
label: 'occurs in',
|
|
417
|
+
line: 'dotted',
|
|
418
|
+
glyph: 'ring',
|
|
419
|
+
transitive: 'Y',
|
|
420
|
+
inverse: 'has-occurrence',
|
|
421
|
+
strength: 0.4,
|
|
422
|
+
polarity: 0,
|
|
423
|
+
cardinality: 'N-1',
|
|
424
|
+
},
|
|
425
|
+
'has-occurrence': {
|
|
426
|
+
cat: 'temporal',
|
|
427
|
+
label: 'has occurrence',
|
|
428
|
+
line: 'dotted',
|
|
429
|
+
glyph: 'ring',
|
|
430
|
+
transitive: 'Y',
|
|
431
|
+
inverse: 'occurs-in',
|
|
432
|
+
strength: 0.4,
|
|
433
|
+
polarity: 0,
|
|
434
|
+
cardinality: '1-N',
|
|
435
|
+
},
|
|
436
|
+
during: {
|
|
437
|
+
cat: 'temporal',
|
|
438
|
+
label: 'during',
|
|
439
|
+
line: 'solid',
|
|
440
|
+
glyph: 'brackets',
|
|
441
|
+
transitive: 'Y',
|
|
442
|
+
inverse: 'spans',
|
|
443
|
+
strength: 0.55,
|
|
444
|
+
polarity: 0,
|
|
445
|
+
cardinality: 'N-1',
|
|
446
|
+
},
|
|
447
|
+
spans: {
|
|
448
|
+
cat: 'temporal',
|
|
449
|
+
label: 'spans',
|
|
450
|
+
line: 'solid',
|
|
451
|
+
glyph: 'brackets',
|
|
452
|
+
transitive: 'Y',
|
|
453
|
+
inverse: 'during',
|
|
454
|
+
strength: 0.55,
|
|
455
|
+
polarity: 0,
|
|
456
|
+
cardinality: '1-N',
|
|
457
|
+
},
|
|
458
|
+
'overlaps-with': {
|
|
459
|
+
cat: 'temporal',
|
|
460
|
+
label: 'overlaps with',
|
|
461
|
+
line: 'dashed',
|
|
462
|
+
glyph: 'overlap',
|
|
463
|
+
transitive: 'N',
|
|
464
|
+
inverse: 'self',
|
|
465
|
+
strength: 0.45,
|
|
466
|
+
polarity: 0,
|
|
467
|
+
cardinality: 'N-N',
|
|
468
|
+
},
|
|
469
|
+
'derives-from': {
|
|
470
|
+
cat: 'temporal',
|
|
471
|
+
label: 'derives from',
|
|
472
|
+
line: 'solid',
|
|
473
|
+
glyph: 'branch',
|
|
474
|
+
transitive: 'Y',
|
|
475
|
+
inverse: 'gives-rise-to',
|
|
476
|
+
strength: 0.7,
|
|
477
|
+
polarity: 0,
|
|
478
|
+
cardinality: 'N-1',
|
|
479
|
+
},
|
|
480
|
+
'gives-rise-to': {
|
|
481
|
+
cat: 'temporal',
|
|
482
|
+
label: 'gives rise to',
|
|
483
|
+
line: 'solid',
|
|
484
|
+
glyph: 'branch',
|
|
485
|
+
transitive: 'Y',
|
|
486
|
+
inverse: 'derives-from',
|
|
487
|
+
strength: 0.7,
|
|
488
|
+
polarity: 0,
|
|
489
|
+
cardinality: '1-N',
|
|
490
|
+
},
|
|
491
|
+
// opposition ───────────────────────────────────────────────────────────
|
|
492
|
+
'contrasts-with': {
|
|
493
|
+
cat: 'opposition',
|
|
494
|
+
label: 'contrasts with',
|
|
495
|
+
line: 'wavy',
|
|
496
|
+
glyph: 'tilde',
|
|
497
|
+
transitive: 'N',
|
|
498
|
+
inverse: 'self',
|
|
499
|
+
strength: 0.5,
|
|
500
|
+
polarity: -1,
|
|
501
|
+
cardinality: 'N-N',
|
|
502
|
+
},
|
|
503
|
+
'opposite-of': {
|
|
504
|
+
cat: 'opposition',
|
|
505
|
+
label: 'opposite of',
|
|
506
|
+
line: 'double',
|
|
507
|
+
glyph: 'x',
|
|
508
|
+
transitive: 'N',
|
|
509
|
+
inverse: 'self',
|
|
510
|
+
strength: 0.8,
|
|
511
|
+
polarity: -1,
|
|
512
|
+
cardinality: '1-1',
|
|
513
|
+
},
|
|
514
|
+
// similarity ───────────────────────────────────────────────────────────
|
|
515
|
+
'similar-to': {
|
|
516
|
+
cat: 'similarity',
|
|
517
|
+
label: 'similar to',
|
|
518
|
+
line: 'dashed',
|
|
519
|
+
glyph: 'approx',
|
|
520
|
+
transitive: 'weak',
|
|
521
|
+
inverse: 'self',
|
|
522
|
+
strength: 0.4,
|
|
523
|
+
polarity: 1,
|
|
524
|
+
cardinality: 'N-N',
|
|
525
|
+
},
|
|
526
|
+
'analogous-to': {
|
|
527
|
+
cat: 'similarity',
|
|
528
|
+
label: 'analogous to',
|
|
529
|
+
line: 'dotted',
|
|
530
|
+
glyph: 'arrows-lr',
|
|
531
|
+
transitive: 'N',
|
|
532
|
+
inverse: 'self',
|
|
533
|
+
strength: 0.3,
|
|
534
|
+
polarity: 1,
|
|
535
|
+
cardinality: 'N-N',
|
|
536
|
+
},
|
|
537
|
+
// epistemic ────────────────────────────────────────────────────────────
|
|
538
|
+
supports: {
|
|
539
|
+
cat: 'epistemic',
|
|
540
|
+
label: 'supports',
|
|
541
|
+
line: 'dotted',
|
|
542
|
+
glyph: 'check',
|
|
543
|
+
transitive: 'weak',
|
|
544
|
+
inverse: 'supported-by',
|
|
545
|
+
strength: 0.7,
|
|
546
|
+
polarity: 1,
|
|
547
|
+
cardinality: 'N-N',
|
|
548
|
+
},
|
|
549
|
+
'supported-by': {
|
|
550
|
+
cat: 'epistemic',
|
|
551
|
+
label: 'supported by',
|
|
552
|
+
line: 'dotted',
|
|
553
|
+
glyph: 'check',
|
|
554
|
+
transitive: 'weak',
|
|
555
|
+
inverse: 'supports',
|
|
556
|
+
strength: 0.7,
|
|
557
|
+
polarity: 1,
|
|
558
|
+
cardinality: 'N-N',
|
|
559
|
+
},
|
|
560
|
+
contradicts: {
|
|
561
|
+
cat: 'epistemic',
|
|
562
|
+
label: 'contradicts',
|
|
563
|
+
line: 'dotted',
|
|
564
|
+
glyph: 'slash',
|
|
565
|
+
transitive: 'N',
|
|
566
|
+
inverse: 'self',
|
|
567
|
+
strength: 0.75,
|
|
568
|
+
polarity: -1,
|
|
569
|
+
cardinality: 'N-N',
|
|
570
|
+
},
|
|
571
|
+
explains: {
|
|
572
|
+
cat: 'epistemic',
|
|
573
|
+
label: 'explains',
|
|
574
|
+
line: 'solid',
|
|
575
|
+
glyph: 'bulb',
|
|
576
|
+
transitive: 'weak',
|
|
577
|
+
inverse: 'explained-by',
|
|
578
|
+
strength: 0.8,
|
|
579
|
+
polarity: 0,
|
|
580
|
+
cardinality: 'N-N',
|
|
581
|
+
},
|
|
582
|
+
'explained-by': {
|
|
583
|
+
cat: 'epistemic',
|
|
584
|
+
label: 'explained by',
|
|
585
|
+
line: 'solid',
|
|
586
|
+
glyph: 'bulb',
|
|
587
|
+
transitive: 'weak',
|
|
588
|
+
inverse: 'explains',
|
|
589
|
+
strength: 0.8,
|
|
590
|
+
polarity: 0,
|
|
591
|
+
cardinality: 'N-N',
|
|
592
|
+
},
|
|
593
|
+
defines: {
|
|
594
|
+
cat: 'epistemic',
|
|
595
|
+
label: 'defines',
|
|
596
|
+
line: 'solid',
|
|
597
|
+
glyph: 'equals',
|
|
598
|
+
transitive: 'N',
|
|
599
|
+
inverse: 'defined-by',
|
|
600
|
+
strength: 0.9,
|
|
601
|
+
polarity: 0,
|
|
602
|
+
cardinality: '1-1',
|
|
603
|
+
},
|
|
604
|
+
'defined-by': {
|
|
605
|
+
cat: 'epistemic',
|
|
606
|
+
label: 'defined by',
|
|
607
|
+
line: 'solid',
|
|
608
|
+
glyph: 'equals',
|
|
609
|
+
transitive: 'N',
|
|
610
|
+
inverse: 'defines',
|
|
611
|
+
strength: 0.9,
|
|
612
|
+
polarity: 0,
|
|
613
|
+
cardinality: '1-1',
|
|
614
|
+
},
|
|
615
|
+
};
|
|
616
|
+
export const RELATION_TYPE_VALUES = Object.keys(RELATION_TYPES);
|
|
617
|
+
/** Forward member of each inverse pair (first in `RELATION_TYPE_VALUES`); all symmetric types. */
|
|
618
|
+
export function isPrimaryRelationType(id) {
|
|
619
|
+
const def = RELATION_TYPES[id];
|
|
620
|
+
if (def.inverse === 'self')
|
|
621
|
+
return true;
|
|
622
|
+
return RELATION_TYPE_VALUES.indexOf(id) < RELATION_TYPE_VALUES.indexOf(def.inverse);
|
|
623
|
+
}
|
|
624
|
+
/** Per-category hex colors for each named palette. */
|
|
625
|
+
export const PALETTES = {
|
|
626
|
+
default: {
|
|
627
|
+
taxonomic: '#2f5d8e',
|
|
628
|
+
structural: '#6b4a8a',
|
|
629
|
+
causal: '#b14a2e',
|
|
630
|
+
dependency: '#8a6a1a',
|
|
631
|
+
temporal: '#2d6a55',
|
|
632
|
+
opposition: '#8a2e4a',
|
|
633
|
+
similarity: '#2a6878',
|
|
634
|
+
epistemic: '#3a4a8a',
|
|
635
|
+
},
|
|
636
|
+
vivid: {
|
|
637
|
+
taxonomic: '#0066cc',
|
|
638
|
+
structural: '#9333ea',
|
|
639
|
+
causal: '#dc2626',
|
|
640
|
+
dependency: '#ea580c',
|
|
641
|
+
temporal: '#0d9488',
|
|
642
|
+
opposition: '#be185d',
|
|
643
|
+
similarity: '#0891b2',
|
|
644
|
+
epistemic: '#4338ca',
|
|
645
|
+
},
|
|
646
|
+
muted: {
|
|
647
|
+
taxonomic: '#5a7896',
|
|
648
|
+
structural: '#806894',
|
|
649
|
+
causal: '#a86a52',
|
|
650
|
+
dependency: '#9a8556',
|
|
651
|
+
temporal: '#5a8276',
|
|
652
|
+
opposition: '#9a586c',
|
|
653
|
+
similarity: '#5a8090',
|
|
654
|
+
epistemic: '#5a6896',
|
|
655
|
+
},
|
|
656
|
+
monoCat: {
|
|
657
|
+
taxonomic: '#3a3a3a',
|
|
658
|
+
structural: '#3a3a3a',
|
|
659
|
+
causal: '#3a3a3a',
|
|
660
|
+
dependency: '#3a3a3a',
|
|
661
|
+
temporal: '#3a3a3a',
|
|
662
|
+
opposition: '#3a3a3a',
|
|
663
|
+
similarity: '#3a3a3a',
|
|
664
|
+
epistemic: '#3a3a3a',
|
|
665
|
+
},
|
|
666
|
+
};
|
|
667
|
+
/**
|
|
668
|
+
* Raw SVG inner content for each glyph kind, on a 14×14 viewBox.
|
|
669
|
+
* Uses `currentColor` for stroke/fill — set CSS `color` on the parent to tint.
|
|
670
|
+
* Default stroke attrs: fill=none, stroke=currentColor, stroke-width=1.4,
|
|
671
|
+
* stroke-linecap=round, stroke-linejoin=round.
|
|
672
|
+
*/
|
|
673
|
+
export const GLYPH_PATHS = {
|
|
674
|
+
'triangle-up': '<polygon points="7,3 11,10 3,10" fill="currentColor" stroke="none"/>',
|
|
675
|
+
'circle-dot': '<circle cx="7" cy="7" r="5"/><circle cx="7" cy="7" r="1.6" fill="currentColor" stroke="none"/>',
|
|
676
|
+
diamond: '<polygon points="7,2 12,7 7,12 2,7" fill="currentColor" stroke="none"/>',
|
|
677
|
+
'diamond-open': '<polygon points="7,2 12,7 7,12 2,7"/>',
|
|
678
|
+
hash: '<path d="M5 2v10M9 2v10M2 5h10M2 9h10"/>',
|
|
679
|
+
'arrow-right': '<path d="M2 7h10M8 3l4 4-4 4"/>',
|
|
680
|
+
asterisk: '<path d="M7 2v10M3 4l8 6M3 10l8-6"/>',
|
|
681
|
+
key: '<circle cx="5" cy="7" r="2.4"/><path d="M7.4 7H12M10 7v2M11.5 7v1.5"/>',
|
|
682
|
+
block: '<circle cx="7" cy="7" r="4.5"/><path d="M3.7 3.7l6.6 6.6"/>',
|
|
683
|
+
spark: '<path d="M7 2v3M7 9v3M2 7h3M9 7h3M3.5 3.5l2 2M8.5 8.5l2 2M3.5 10.5l2-2M8.5 5.5l2-2"/>',
|
|
684
|
+
anchor: '<circle cx="7" cy="4" r="1.5"/><path d="M7 5.5v6.5M3 9c0 2 2 3 4 3s4-1 4-3M4.5 8.5h5"/>',
|
|
685
|
+
tool: '<path d="M9 2.5L11.5 5l-1.2 1.2-2.5-2.5zM10.3 6.2l-7 7-1.5-1.5 7-7"/>',
|
|
686
|
+
'chevron-r': '<path d="M5 3l4 4-4 4M2 3l4 4-4 4"/>',
|
|
687
|
+
ring: '<circle cx="7" cy="7" r="4.5"/>',
|
|
688
|
+
tilde: '<path d="M2 8 Q4 5 7 7 T12 6"/>',
|
|
689
|
+
x: '<path d="M3 3l8 8M11 3l-8 8" stroke-width="1.8"/>',
|
|
690
|
+
minus: '<path d="M3 7h8" stroke-width="2"/>',
|
|
691
|
+
flag: '<path d="M4 12V2M4 2l7 3.5L4 9"/>',
|
|
692
|
+
approx: '<path d="M2 5 Q4 3 7 5 T12 5"/><path d="M2 9 Q4 7 7 9 T12 9"/>',
|
|
693
|
+
'arrows-lr': '<path d="M2 7h10M3.5 4.5L2 7l1.5 2.5M10.5 4.5L12 7l-1.5 2.5"/>',
|
|
694
|
+
check: '<path d="M2.5 7.5l3 3 6-7"/>',
|
|
695
|
+
slash: '<path d="M11 3l-8 8" stroke-width="1.8"/>',
|
|
696
|
+
bulb: '<path d="M7 2a3.2 3.2 0 0 0-2 5.7c.4.4.7.9.7 1.5v.3h2.6v-.3c0-.6.3-1.1.7-1.5A3.2 3.2 0 0 0 7 2zM5.7 10.5h2.6M6.2 12h1.6"/>',
|
|
697
|
+
equals: '<path d="M3 5.5h8M3 8.5h8" stroke-width="1.8"/>',
|
|
698
|
+
lock: '<rect x="3.5" y="6.5" width="7" height="5.5" rx="0.8"/><path d="M5 6.5V4.5a2 2 0 0 1 4 0v2"/>',
|
|
699
|
+
flame: '<path d="M7 2c-1 2.2-3 3.4-3 6a3 3 0 0 0 6 0c0-1.2-.6-2-1.4-2.6.2 1.2-.4 2.2-1.4 2C7.4 5.6 7.8 4 7 2z"/>',
|
|
700
|
+
hourglass: '<path d="M3.5 2.5h7M3.5 11.5h7M4 2.5v1.5L7 7l3-3V2.5M4 11.5v-1.5L7 7l3 3v1.5"/>',
|
|
701
|
+
brackets: '<path d="M4 3h-1.5v8H4M10 3h1.5v8H10"/>',
|
|
702
|
+
overlap: '<path d="M2 5.5h7M5 8.5h7" stroke-width="1.8"/>',
|
|
703
|
+
branch: '<path d="M7 2v10M7 7l-3 3M7 7l3 3"/>',
|
|
704
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nesso-how/vocab-learning",
|
|
3
|
+
"version": "0.1.0-alpha.34",
|
|
4
|
+
"description": "Nesso Learning Vocabulary — graph vocabulary (relation types, node params, palettes) shared across app and MCP",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/nesso-how/nesso",
|
|
9
|
+
"directory": "packages/vocab-learning"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"import": "./dist/index.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"typescript": "~5.8.3"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "rm -rf dist && tsc",
|
|
29
|
+
"dev": "tsc --watch"
|
|
30
|
+
}
|
|
31
|
+
}
|