@nesso-how/vocab-learning 0.1.0-alpha.38 → 0.1.0-alpha.40
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/dist/relationTypes.d.ts +0 -1
- package/dist/relationTypes.js +1 -53
- package/package.json +2 -2
- package/dist/document.test.d.ts +0 -1
- package/dist/document.test.js +0 -32
package/dist/relationTypes.d.ts
CHANGED
|
@@ -11,7 +11,6 @@ export type Cardinality = '1-1' | '1-N' | 'N-1' | 'N-N';
|
|
|
11
11
|
export interface RelationTypeDef {
|
|
12
12
|
cat: RelationCategory;
|
|
13
13
|
label: string;
|
|
14
|
-
line: 'solid' | 'dashed' | 'dotted' | 'double' | 'wavy';
|
|
15
14
|
glyph: GlyphKind;
|
|
16
15
|
transitive: Transitivity;
|
|
17
16
|
/** Canonical inverse in the set; `'self'` for symmetric types. */
|
package/dist/relationTypes.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
//
|
|
3
3
|
// Semantic relation vocabulary: ordered categories, 52 typed relation ids, and
|
|
4
4
|
// per-type properties (transitive, inverse, strength, polarity, cardinality)
|
|
5
|
-
// plus visual encoding
|
|
5
|
+
// plus visual encoding (category colour + glyph). UI labels live in app i18n, not here.
|
|
6
6
|
export const RELATION_CATEGORIES = [
|
|
7
7
|
'taxonomic',
|
|
8
8
|
'structural',
|
|
@@ -18,7 +18,6 @@ export const RELATION_TYPES = {
|
|
|
18
18
|
'subtype-of': {
|
|
19
19
|
cat: 'taxonomic',
|
|
20
20
|
label: 'subtype of',
|
|
21
|
-
line: 'double',
|
|
22
21
|
glyph: 'triangle-up',
|
|
23
22
|
transitive: 'Y',
|
|
24
23
|
inverse: 'has-subtype',
|
|
@@ -29,7 +28,6 @@ export const RELATION_TYPES = {
|
|
|
29
28
|
'has-subtype': {
|
|
30
29
|
cat: 'taxonomic',
|
|
31
30
|
label: 'has subtype',
|
|
32
|
-
line: 'double',
|
|
33
31
|
glyph: 'triangle-up',
|
|
34
32
|
transitive: 'Y',
|
|
35
33
|
inverse: 'subtype-of',
|
|
@@ -40,7 +38,6 @@ export const RELATION_TYPES = {
|
|
|
40
38
|
'instance-of': {
|
|
41
39
|
cat: 'taxonomic',
|
|
42
40
|
label: 'instance of',
|
|
43
|
-
line: 'solid',
|
|
44
41
|
glyph: 'circle-dot',
|
|
45
42
|
transitive: 'N',
|
|
46
43
|
inverse: 'has-instance',
|
|
@@ -51,7 +48,6 @@ export const RELATION_TYPES = {
|
|
|
51
48
|
'has-instance': {
|
|
52
49
|
cat: 'taxonomic',
|
|
53
50
|
label: 'has instance',
|
|
54
|
-
line: 'solid',
|
|
55
51
|
glyph: 'circle-dot',
|
|
56
52
|
transitive: 'N',
|
|
57
53
|
inverse: 'instance-of',
|
|
@@ -63,7 +59,6 @@ export const RELATION_TYPES = {
|
|
|
63
59
|
'part-of': {
|
|
64
60
|
cat: 'structural',
|
|
65
61
|
label: 'part of',
|
|
66
|
-
line: 'solid',
|
|
67
62
|
glyph: 'diamond',
|
|
68
63
|
transitive: 'Y',
|
|
69
64
|
inverse: 'contains',
|
|
@@ -74,7 +69,6 @@ export const RELATION_TYPES = {
|
|
|
74
69
|
contains: {
|
|
75
70
|
cat: 'structural',
|
|
76
71
|
label: 'contains',
|
|
77
|
-
line: 'solid',
|
|
78
72
|
glyph: 'diamond-open',
|
|
79
73
|
transitive: 'Y',
|
|
80
74
|
inverse: 'part-of',
|
|
@@ -85,7 +79,6 @@ export const RELATION_TYPES = {
|
|
|
85
79
|
'made-of': {
|
|
86
80
|
cat: 'structural',
|
|
87
81
|
label: 'made of',
|
|
88
|
-
line: 'dashed',
|
|
89
82
|
glyph: 'hash',
|
|
90
83
|
transitive: 'weak',
|
|
91
84
|
inverse: 'composes',
|
|
@@ -96,7 +89,6 @@ export const RELATION_TYPES = {
|
|
|
96
89
|
composes: {
|
|
97
90
|
cat: 'structural',
|
|
98
91
|
label: 'composes',
|
|
99
|
-
line: 'dashed',
|
|
100
92
|
glyph: 'hash',
|
|
101
93
|
transitive: 'weak',
|
|
102
94
|
inverse: 'made-of',
|
|
@@ -108,7 +100,6 @@ export const RELATION_TYPES = {
|
|
|
108
100
|
causes: {
|
|
109
101
|
cat: 'causal',
|
|
110
102
|
label: 'causes',
|
|
111
|
-
line: 'solid',
|
|
112
103
|
glyph: 'arrow-right',
|
|
113
104
|
transitive: 'N',
|
|
114
105
|
inverse: 'caused-by',
|
|
@@ -119,7 +110,6 @@ export const RELATION_TYPES = {
|
|
|
119
110
|
'caused-by': {
|
|
120
111
|
cat: 'causal',
|
|
121
112
|
label: 'caused by',
|
|
122
|
-
line: 'solid',
|
|
123
113
|
glyph: 'arrow-right',
|
|
124
114
|
transitive: 'N',
|
|
125
115
|
inverse: 'causes',
|
|
@@ -130,7 +120,6 @@ export const RELATION_TYPES = {
|
|
|
130
120
|
produces: {
|
|
131
121
|
cat: 'causal',
|
|
132
122
|
label: 'produces',
|
|
133
|
-
line: 'solid',
|
|
134
123
|
glyph: 'asterisk',
|
|
135
124
|
transitive: 'N',
|
|
136
125
|
inverse: 'produced-by',
|
|
@@ -141,7 +130,6 @@ export const RELATION_TYPES = {
|
|
|
141
130
|
'produced-by': {
|
|
142
131
|
cat: 'causal',
|
|
143
132
|
label: 'produced by',
|
|
144
|
-
line: 'solid',
|
|
145
133
|
glyph: 'asterisk',
|
|
146
134
|
transitive: 'N',
|
|
147
135
|
inverse: 'produces',
|
|
@@ -152,7 +140,6 @@ export const RELATION_TYPES = {
|
|
|
152
140
|
enables: {
|
|
153
141
|
cat: 'causal',
|
|
154
142
|
label: 'enables',
|
|
155
|
-
line: 'dotted',
|
|
156
143
|
glyph: 'key',
|
|
157
144
|
transitive: 'weak',
|
|
158
145
|
inverse: 'enabled-by',
|
|
@@ -163,7 +150,6 @@ export const RELATION_TYPES = {
|
|
|
163
150
|
'enabled-by': {
|
|
164
151
|
cat: 'causal',
|
|
165
152
|
label: 'enabled by',
|
|
166
|
-
line: 'dotted',
|
|
167
153
|
glyph: 'key',
|
|
168
154
|
transitive: 'weak',
|
|
169
155
|
inverse: 'enables',
|
|
@@ -174,7 +160,6 @@ export const RELATION_TYPES = {
|
|
|
174
160
|
prevents: {
|
|
175
161
|
cat: 'causal',
|
|
176
162
|
label: 'prevents',
|
|
177
|
-
line: 'dotted',
|
|
178
163
|
glyph: 'block',
|
|
179
164
|
transitive: 'N',
|
|
180
165
|
inverse: 'prevented-by',
|
|
@@ -185,7 +170,6 @@ export const RELATION_TYPES = {
|
|
|
185
170
|
'prevented-by': {
|
|
186
171
|
cat: 'causal',
|
|
187
172
|
label: 'prevented by',
|
|
188
|
-
line: 'dotted',
|
|
189
173
|
glyph: 'block',
|
|
190
174
|
transitive: 'N',
|
|
191
175
|
inverse: 'prevents',
|
|
@@ -196,7 +180,6 @@ export const RELATION_TYPES = {
|
|
|
196
180
|
triggers: {
|
|
197
181
|
cat: 'causal',
|
|
198
182
|
label: 'triggers',
|
|
199
|
-
line: 'solid',
|
|
200
183
|
glyph: 'spark',
|
|
201
184
|
transitive: 'N',
|
|
202
185
|
inverse: 'triggered-by',
|
|
@@ -207,7 +190,6 @@ export const RELATION_TYPES = {
|
|
|
207
190
|
'triggered-by': {
|
|
208
191
|
cat: 'causal',
|
|
209
192
|
label: 'triggered by',
|
|
210
|
-
line: 'solid',
|
|
211
193
|
glyph: 'spark',
|
|
212
194
|
transitive: 'N',
|
|
213
195
|
inverse: 'triggers',
|
|
@@ -218,7 +200,6 @@ export const RELATION_TYPES = {
|
|
|
218
200
|
inhibits: {
|
|
219
201
|
cat: 'causal',
|
|
220
202
|
label: 'inhibits',
|
|
221
|
-
line: 'dotted',
|
|
222
203
|
glyph: 'minus',
|
|
223
204
|
transitive: 'N',
|
|
224
205
|
inverse: 'inhibited-by',
|
|
@@ -229,7 +210,6 @@ export const RELATION_TYPES = {
|
|
|
229
210
|
'inhibited-by': {
|
|
230
211
|
cat: 'causal',
|
|
231
212
|
label: 'inhibited by',
|
|
232
|
-
line: 'dotted',
|
|
233
213
|
glyph: 'minus',
|
|
234
214
|
transitive: 'N',
|
|
235
215
|
inverse: 'inhibits',
|
|
@@ -240,7 +220,6 @@ export const RELATION_TYPES = {
|
|
|
240
220
|
disables: {
|
|
241
221
|
cat: 'causal',
|
|
242
222
|
label: 'disables',
|
|
243
|
-
line: 'dotted',
|
|
244
223
|
glyph: 'lock',
|
|
245
224
|
transitive: 'weak',
|
|
246
225
|
inverse: 'disabled-by',
|
|
@@ -251,7 +230,6 @@ export const RELATION_TYPES = {
|
|
|
251
230
|
'disabled-by': {
|
|
252
231
|
cat: 'causal',
|
|
253
232
|
label: 'disabled by',
|
|
254
|
-
line: 'dotted',
|
|
255
233
|
glyph: 'lock',
|
|
256
234
|
transitive: 'weak',
|
|
257
235
|
inverse: 'disables',
|
|
@@ -262,7 +240,6 @@ export const RELATION_TYPES = {
|
|
|
262
240
|
consumes: {
|
|
263
241
|
cat: 'causal',
|
|
264
242
|
label: 'consumes',
|
|
265
|
-
line: 'solid',
|
|
266
243
|
glyph: 'flame',
|
|
267
244
|
transitive: 'N',
|
|
268
245
|
inverse: 'consumed-by',
|
|
@@ -273,7 +250,6 @@ export const RELATION_TYPES = {
|
|
|
273
250
|
'consumed-by': {
|
|
274
251
|
cat: 'causal',
|
|
275
252
|
label: 'consumed by',
|
|
276
|
-
line: 'solid',
|
|
277
253
|
glyph: 'flame',
|
|
278
254
|
transitive: 'N',
|
|
279
255
|
inverse: 'consumes',
|
|
@@ -284,7 +260,6 @@ export const RELATION_TYPES = {
|
|
|
284
260
|
delays: {
|
|
285
261
|
cat: 'causal',
|
|
286
262
|
label: 'delays',
|
|
287
|
-
line: 'dotted',
|
|
288
263
|
glyph: 'hourglass',
|
|
289
264
|
transitive: 'weak',
|
|
290
265
|
inverse: 'delayed-by',
|
|
@@ -295,7 +270,6 @@ export const RELATION_TYPES = {
|
|
|
295
270
|
'delayed-by': {
|
|
296
271
|
cat: 'causal',
|
|
297
272
|
label: 'delayed by',
|
|
298
|
-
line: 'dotted',
|
|
299
273
|
glyph: 'hourglass',
|
|
300
274
|
transitive: 'weak',
|
|
301
275
|
inverse: 'delays',
|
|
@@ -307,7 +281,6 @@ export const RELATION_TYPES = {
|
|
|
307
281
|
requires: {
|
|
308
282
|
cat: 'dependency',
|
|
309
283
|
label: 'requires',
|
|
310
|
-
line: 'solid',
|
|
311
284
|
glyph: 'anchor',
|
|
312
285
|
transitive: 'Y',
|
|
313
286
|
inverse: 'required-by',
|
|
@@ -318,7 +291,6 @@ export const RELATION_TYPES = {
|
|
|
318
291
|
'required-by': {
|
|
319
292
|
cat: 'dependency',
|
|
320
293
|
label: 'required by',
|
|
321
|
-
line: 'solid',
|
|
322
294
|
glyph: 'anchor',
|
|
323
295
|
transitive: 'Y',
|
|
324
296
|
inverse: 'requires',
|
|
@@ -329,7 +301,6 @@ export const RELATION_TYPES = {
|
|
|
329
301
|
uses: {
|
|
330
302
|
cat: 'dependency',
|
|
331
303
|
label: 'uses',
|
|
332
|
-
line: 'dashed',
|
|
333
304
|
glyph: 'tool',
|
|
334
305
|
transitive: 'weak',
|
|
335
306
|
inverse: 'used-by',
|
|
@@ -340,7 +311,6 @@ export const RELATION_TYPES = {
|
|
|
340
311
|
'used-by': {
|
|
341
312
|
cat: 'dependency',
|
|
342
313
|
label: 'used by',
|
|
343
|
-
line: 'dashed',
|
|
344
314
|
glyph: 'tool',
|
|
345
315
|
transitive: 'weak',
|
|
346
316
|
inverse: 'uses',
|
|
@@ -351,7 +321,6 @@ export const RELATION_TYPES = {
|
|
|
351
321
|
'used-for': {
|
|
352
322
|
cat: 'dependency',
|
|
353
323
|
label: 'used for',
|
|
354
|
-
line: 'dashed',
|
|
355
324
|
glyph: 'flag',
|
|
356
325
|
transitive: 'N',
|
|
357
326
|
inverse: 'purpose-of',
|
|
@@ -362,7 +331,6 @@ export const RELATION_TYPES = {
|
|
|
362
331
|
'purpose-of': {
|
|
363
332
|
cat: 'dependency',
|
|
364
333
|
label: 'purpose of',
|
|
365
|
-
line: 'dashed',
|
|
366
334
|
glyph: 'flag',
|
|
367
335
|
transitive: 'N',
|
|
368
336
|
inverse: 'used-for',
|
|
@@ -374,7 +342,6 @@ export const RELATION_TYPES = {
|
|
|
374
342
|
precedes: {
|
|
375
343
|
cat: 'temporal',
|
|
376
344
|
label: 'precedes',
|
|
377
|
-
line: 'solid',
|
|
378
345
|
glyph: 'chevron-r',
|
|
379
346
|
transitive: 'Y',
|
|
380
347
|
inverse: 'follows',
|
|
@@ -385,7 +352,6 @@ export const RELATION_TYPES = {
|
|
|
385
352
|
follows: {
|
|
386
353
|
cat: 'temporal',
|
|
387
354
|
label: 'follows',
|
|
388
|
-
line: 'solid',
|
|
389
355
|
glyph: 'chevron-r',
|
|
390
356
|
transitive: 'Y',
|
|
391
357
|
inverse: 'precedes',
|
|
@@ -396,7 +362,6 @@ export const RELATION_TYPES = {
|
|
|
396
362
|
'occurs-in': {
|
|
397
363
|
cat: 'temporal',
|
|
398
364
|
label: 'occurs in',
|
|
399
|
-
line: 'dotted',
|
|
400
365
|
glyph: 'ring',
|
|
401
366
|
transitive: 'Y',
|
|
402
367
|
inverse: 'has-occurrence',
|
|
@@ -407,7 +372,6 @@ export const RELATION_TYPES = {
|
|
|
407
372
|
'has-occurrence': {
|
|
408
373
|
cat: 'temporal',
|
|
409
374
|
label: 'has occurrence',
|
|
410
|
-
line: 'dotted',
|
|
411
375
|
glyph: 'ring',
|
|
412
376
|
transitive: 'Y',
|
|
413
377
|
inverse: 'occurs-in',
|
|
@@ -418,7 +382,6 @@ export const RELATION_TYPES = {
|
|
|
418
382
|
during: {
|
|
419
383
|
cat: 'temporal',
|
|
420
384
|
label: 'during',
|
|
421
|
-
line: 'solid',
|
|
422
385
|
glyph: 'brackets',
|
|
423
386
|
transitive: 'Y',
|
|
424
387
|
inverse: 'spans',
|
|
@@ -429,7 +392,6 @@ export const RELATION_TYPES = {
|
|
|
429
392
|
spans: {
|
|
430
393
|
cat: 'temporal',
|
|
431
394
|
label: 'spans',
|
|
432
|
-
line: 'solid',
|
|
433
395
|
glyph: 'brackets',
|
|
434
396
|
transitive: 'Y',
|
|
435
397
|
inverse: 'during',
|
|
@@ -440,7 +402,6 @@ export const RELATION_TYPES = {
|
|
|
440
402
|
'overlaps-with': {
|
|
441
403
|
cat: 'temporal',
|
|
442
404
|
label: 'overlaps with',
|
|
443
|
-
line: 'dashed',
|
|
444
405
|
glyph: 'overlap',
|
|
445
406
|
transitive: 'N',
|
|
446
407
|
inverse: 'self',
|
|
@@ -451,7 +412,6 @@ export const RELATION_TYPES = {
|
|
|
451
412
|
'derives-from': {
|
|
452
413
|
cat: 'temporal',
|
|
453
414
|
label: 'derives from',
|
|
454
|
-
line: 'solid',
|
|
455
415
|
glyph: 'branch',
|
|
456
416
|
transitive: 'Y',
|
|
457
417
|
inverse: 'gives-rise-to',
|
|
@@ -462,7 +422,6 @@ export const RELATION_TYPES = {
|
|
|
462
422
|
'gives-rise-to': {
|
|
463
423
|
cat: 'temporal',
|
|
464
424
|
label: 'gives rise to',
|
|
465
|
-
line: 'solid',
|
|
466
425
|
glyph: 'branch',
|
|
467
426
|
transitive: 'Y',
|
|
468
427
|
inverse: 'derives-from',
|
|
@@ -474,7 +433,6 @@ export const RELATION_TYPES = {
|
|
|
474
433
|
'contrasts-with': {
|
|
475
434
|
cat: 'opposition',
|
|
476
435
|
label: 'contrasts with',
|
|
477
|
-
line: 'wavy',
|
|
478
436
|
glyph: 'tilde',
|
|
479
437
|
transitive: 'N',
|
|
480
438
|
inverse: 'self',
|
|
@@ -485,7 +443,6 @@ export const RELATION_TYPES = {
|
|
|
485
443
|
'opposite-of': {
|
|
486
444
|
cat: 'opposition',
|
|
487
445
|
label: 'opposite of',
|
|
488
|
-
line: 'double',
|
|
489
446
|
glyph: 'x',
|
|
490
447
|
transitive: 'N',
|
|
491
448
|
inverse: 'self',
|
|
@@ -497,7 +454,6 @@ export const RELATION_TYPES = {
|
|
|
497
454
|
'similar-to': {
|
|
498
455
|
cat: 'similarity',
|
|
499
456
|
label: 'similar to',
|
|
500
|
-
line: 'dashed',
|
|
501
457
|
glyph: 'approx',
|
|
502
458
|
transitive: 'weak',
|
|
503
459
|
inverse: 'self',
|
|
@@ -508,7 +464,6 @@ export const RELATION_TYPES = {
|
|
|
508
464
|
'analogous-to': {
|
|
509
465
|
cat: 'similarity',
|
|
510
466
|
label: 'analogous to',
|
|
511
|
-
line: 'dotted',
|
|
512
467
|
glyph: 'arrows-lr',
|
|
513
468
|
transitive: 'N',
|
|
514
469
|
inverse: 'self',
|
|
@@ -520,7 +475,6 @@ export const RELATION_TYPES = {
|
|
|
520
475
|
supports: {
|
|
521
476
|
cat: 'epistemic',
|
|
522
477
|
label: 'supports',
|
|
523
|
-
line: 'dotted',
|
|
524
478
|
glyph: 'check',
|
|
525
479
|
transitive: 'weak',
|
|
526
480
|
inverse: 'supported-by',
|
|
@@ -531,7 +485,6 @@ export const RELATION_TYPES = {
|
|
|
531
485
|
'supported-by': {
|
|
532
486
|
cat: 'epistemic',
|
|
533
487
|
label: 'supported by',
|
|
534
|
-
line: 'dotted',
|
|
535
488
|
glyph: 'check',
|
|
536
489
|
transitive: 'weak',
|
|
537
490
|
inverse: 'supports',
|
|
@@ -542,7 +495,6 @@ export const RELATION_TYPES = {
|
|
|
542
495
|
contradicts: {
|
|
543
496
|
cat: 'epistemic',
|
|
544
497
|
label: 'contradicts',
|
|
545
|
-
line: 'dotted',
|
|
546
498
|
glyph: 'slash',
|
|
547
499
|
transitive: 'N',
|
|
548
500
|
inverse: 'self',
|
|
@@ -553,7 +505,6 @@ export const RELATION_TYPES = {
|
|
|
553
505
|
explains: {
|
|
554
506
|
cat: 'epistemic',
|
|
555
507
|
label: 'explains',
|
|
556
|
-
line: 'solid',
|
|
557
508
|
glyph: 'bulb',
|
|
558
509
|
transitive: 'weak',
|
|
559
510
|
inverse: 'explained-by',
|
|
@@ -564,7 +515,6 @@ export const RELATION_TYPES = {
|
|
|
564
515
|
'explained-by': {
|
|
565
516
|
cat: 'epistemic',
|
|
566
517
|
label: 'explained by',
|
|
567
|
-
line: 'solid',
|
|
568
518
|
glyph: 'bulb',
|
|
569
519
|
transitive: 'weak',
|
|
570
520
|
inverse: 'explains',
|
|
@@ -575,7 +525,6 @@ export const RELATION_TYPES = {
|
|
|
575
525
|
defines: {
|
|
576
526
|
cat: 'epistemic',
|
|
577
527
|
label: 'defines',
|
|
578
|
-
line: 'solid',
|
|
579
528
|
glyph: 'equals',
|
|
580
529
|
transitive: 'N',
|
|
581
530
|
inverse: 'defined-by',
|
|
@@ -586,7 +535,6 @@ export const RELATION_TYPES = {
|
|
|
586
535
|
'defined-by': {
|
|
587
536
|
cat: 'epistemic',
|
|
588
537
|
label: 'defined by',
|
|
589
|
-
line: 'solid',
|
|
590
538
|
glyph: 'equals',
|
|
591
539
|
transitive: 'N',
|
|
592
540
|
inverse: 'defines',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nesso-how/vocab-learning",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.40",
|
|
4
4
|
"description": "Nesso Learning Vocabulary — graph vocabulary (relation types, node params, palettes) shared across app and MCP",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@nesso-how/schema": "0.1.0-alpha.
|
|
25
|
+
"@nesso-how/schema": "0.1.0-alpha.40"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"typescript": "~5.8.3"
|
package/dist/document.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/document.test.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
import { describe, expect, it } from 'vitest';
|
|
3
|
-
import { deserialize, serialize } from './document.js';
|
|
4
|
-
describe('vocab-learning serialize / deserialize', () => {
|
|
5
|
-
it('round-trips a learning vocabulary graph document', () => {
|
|
6
|
-
const doc = {
|
|
7
|
-
vocabulary: { id: '@nesso-how/vocab-learning', version: '0.1.0' },
|
|
8
|
-
name: 'Demo',
|
|
9
|
-
concepts: [
|
|
10
|
-
{
|
|
11
|
-
id: 'n1',
|
|
12
|
-
label: 'Idea',
|
|
13
|
-
x: 0,
|
|
14
|
-
y: 0,
|
|
15
|
-
data: { elaboration: { definition: 'd', examples: 'e', notes: '' } },
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
relations: [{ id: 'e1', source: 'n1', target: 'n1', type: 'causes' }],
|
|
19
|
-
};
|
|
20
|
-
const parsed = deserialize(serialize(doc));
|
|
21
|
-
expect(parsed.concepts[0].label).toBe('Idea');
|
|
22
|
-
expect(parsed.relations[0].type).toBe('causes');
|
|
23
|
-
});
|
|
24
|
-
it('rejects an unknown relation type', () => {
|
|
25
|
-
const json = JSON.stringify({
|
|
26
|
-
name: 'X',
|
|
27
|
-
concepts: [{ id: 'n1', label: 'n1', x: 0, y: 0 }],
|
|
28
|
-
relations: [{ id: 'e1', source: 'n1', target: 'n1', type: 'not-a-real-type' }],
|
|
29
|
-
});
|
|
30
|
-
expect(() => deserialize(json)).toThrow(/unknown relation type/);
|
|
31
|
-
});
|
|
32
|
-
});
|