@glossarist/concept-browser 0.7.88 → 0.7.90
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/package.json +1 -1
- package/scripts/__tests__/bibliography.test.mjs +29 -0
- package/scripts/generate-data.mjs +4 -2
- package/scripts/lib/bibliography.mjs +18 -0
- package/src/__tests__/cross-repo-multiplicity-contract.test.ts +84 -0
- package/src/__tests__/model-bridge-partitive-migration.test.ts +153 -0
- package/src/__tests__/wire-keys.test.ts +65 -0
- package/src/adapters/model-bridge/bridges.ts +159 -0
- package/src/adapters/model-bridge/concept.ts +87 -0
- package/src/adapters/model-bridge/entity-refs.ts +49 -0
- package/src/adapters/model-bridge/index.ts +46 -0
- package/src/adapters/model-bridge/jsonld-types.ts +169 -0
- package/src/adapters/model-bridge/mappers.ts +277 -0
- package/src/adapters/model-bridge/partitive.ts +79 -0
- package/src/adapters/model-bridge.ts +172 -297
- package/src/adapters/wire-keys.ts +154 -0
- package/vite.config.ts +4 -1
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire-format keys for the JSON-LD bridge.
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for the `'gl:*'` and `'@*'` string keys used
|
|
5
|
+
* across `src/adapters/model-bridge*.ts` to read the JSON-LD wire
|
|
6
|
+
* format produced by `scripts/generate-data.mjs`.
|
|
7
|
+
*
|
|
8
|
+
* Why this exists:
|
|
9
|
+
* - Replaces ~230 inline string literals that were spread across
|
|
10
|
+
* adapter files. Typos like `'gl:presnce'` were undetectable at
|
|
11
|
+
* compile time.
|
|
12
|
+
* - When glossarist-js's JSON-LD context adds/renames a field, the
|
|
13
|
+
* change is one entry here, not a grep-and-replace exercise.
|
|
14
|
+
*
|
|
15
|
+
* The interface declarations in `model-bridge/jsonld-types.ts` still
|
|
16
|
+
* use string literals — TypeScript interface keys cannot reference
|
|
17
|
+
* a `const`. The literals there MUST agree with the constants here;
|
|
18
|
+
* the `WireKeys` type at the bottom of this file constrains them to
|
|
19
|
+
* the same set.
|
|
20
|
+
*
|
|
21
|
+
* Adding a new wire field:
|
|
22
|
+
* 1. Add the key constant here.
|
|
23
|
+
* 2. Add the interface field in `jsonld-types.ts`.
|
|
24
|
+
* 3. Add the mapper logic in `model-bridge.ts`.
|
|
25
|
+
*
|
|
26
|
+
* (3 steps for new fields instead of touching 5+ files.)
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
export const GL = {
|
|
30
|
+
// JSON-LD core
|
|
31
|
+
ID: '@id',
|
|
32
|
+
TYPE: '@type',
|
|
33
|
+
|
|
34
|
+
// Concept-level
|
|
35
|
+
IDENTIFIER: 'gl:identifier',
|
|
36
|
+
TERM: 'gl:term',
|
|
37
|
+
LOCALIZED_CONCEPT: 'gl:localizedConcept',
|
|
38
|
+
RELATED: 'gl:related',
|
|
39
|
+
PARTITIVE_RELATIONS: 'gl:partitiveRelations',
|
|
40
|
+
TAGS: 'gl:tags',
|
|
41
|
+
|
|
42
|
+
// LocalizedConcept
|
|
43
|
+
LANGUAGE_CODE: 'gl:languageCode',
|
|
44
|
+
ENTRY_STATUS: 'gl:entryStatus',
|
|
45
|
+
CLASSIFICATION: 'gl:classification',
|
|
46
|
+
REVIEW_TYPE: 'gl:reviewType',
|
|
47
|
+
DOMAIN: 'gl:domain',
|
|
48
|
+
RELEASE: 'gl:release',
|
|
49
|
+
LINEAGE_SOURCE_SIMILARITY: 'gl:lineageSourceSimilarity',
|
|
50
|
+
SCRIPT: 'gl:script',
|
|
51
|
+
SYSTEM: 'gl:system',
|
|
52
|
+
DESIGNATION: 'gl:designation',
|
|
53
|
+
DEFINITION: 'gl:definition',
|
|
54
|
+
NOTES: 'gl:notes',
|
|
55
|
+
ANNOTATIONS: 'gl:annotations',
|
|
56
|
+
EXAMPLES: 'gl:examples',
|
|
57
|
+
SOURCE: 'gl:source',
|
|
58
|
+
DATES: 'gl:dates',
|
|
59
|
+
REFERENCES: 'gl:references',
|
|
60
|
+
|
|
61
|
+
// Review fields
|
|
62
|
+
REVIEW_DATE: 'gl:reviewDate',
|
|
63
|
+
REVIEW_DECISION_DATE: 'gl:reviewDecisionDate',
|
|
64
|
+
REVIEW_DECISION_EVENT: 'gl:reviewDecisionEvent',
|
|
65
|
+
REVIEW_STATUS: 'gl:reviewStatus',
|
|
66
|
+
REVIEW_DECISION: 'gl:reviewDecision',
|
|
67
|
+
REVIEW_DECISION_NOTES: 'gl:reviewDecisionNotes',
|
|
68
|
+
|
|
69
|
+
// Designation
|
|
70
|
+
NORMATIVE_STATUS: 'gl:normativeStatus',
|
|
71
|
+
ABSENT: 'gl:absent',
|
|
72
|
+
FIELD_OF_APPLICATION: 'gl:fieldOfApplication',
|
|
73
|
+
USAGE_INFO: 'gl:usageInfo',
|
|
74
|
+
GEOGRAPHICAL_AREA: 'gl:geographicalArea',
|
|
75
|
+
LANGUAGE: 'gl:language',
|
|
76
|
+
INTERNATIONAL: 'gl:international',
|
|
77
|
+
TERM_TYPE: 'gl:termType',
|
|
78
|
+
PRONUNCIATION: 'gl:pronunciation',
|
|
79
|
+
PREFIX: 'gl:prefix',
|
|
80
|
+
GENDER: 'gl:gender',
|
|
81
|
+
GRAMMAR_INFO: 'gl:grammarInfo',
|
|
82
|
+
|
|
83
|
+
// GrammarInfo
|
|
84
|
+
NUMBER: 'gl:number',
|
|
85
|
+
PART_OF_SPEECH: 'gl:partOfSpeech',
|
|
86
|
+
NOUN: 'gl:noun',
|
|
87
|
+
VERB: 'gl:verb',
|
|
88
|
+
ADJ: 'gl:adj',
|
|
89
|
+
ADVERB: 'gl:adverb',
|
|
90
|
+
PREPOSITION: 'gl:preposition',
|
|
91
|
+
PARTICIPLE: 'gl:participle',
|
|
92
|
+
|
|
93
|
+
// Pronunciation
|
|
94
|
+
COUNTRY: 'gl:country',
|
|
95
|
+
|
|
96
|
+
// Content (definition, notes, examples, annotations)
|
|
97
|
+
CONTENT: 'gl:content',
|
|
98
|
+
|
|
99
|
+
// Date
|
|
100
|
+
DATE: 'gl:date',
|
|
101
|
+
DATE_TYPE: 'gl:dateType',
|
|
102
|
+
|
|
103
|
+
// ConceptRef / Citation.Origin
|
|
104
|
+
REF: 'gl:ref',
|
|
105
|
+
LOCALITY: 'gl:locality',
|
|
106
|
+
LINK: 'gl:link',
|
|
107
|
+
VERSION: 'gl:version',
|
|
108
|
+
TEXT: 'gl:text',
|
|
109
|
+
|
|
110
|
+
// Locally-scoped id within source/origin/ref (NOT JSON-LD's @id)
|
|
111
|
+
LOCAL_ID: 'gl:id',
|
|
112
|
+
|
|
113
|
+
// Locality
|
|
114
|
+
LOCALITY_TYPE: 'gl:localityType',
|
|
115
|
+
REFERENCE_FROM: 'gl:referenceFrom',
|
|
116
|
+
REFERENCE_TO: 'gl:referenceTo',
|
|
117
|
+
|
|
118
|
+
// ConceptSource
|
|
119
|
+
SOURCE_TYPE: 'gl:sourceType',
|
|
120
|
+
SOURCE_STATUS: 'gl:sourceStatus',
|
|
121
|
+
MODIFICATION: 'gl:modification',
|
|
122
|
+
ORIGIN: 'gl:origin',
|
|
123
|
+
SOURCED_FROM: 'gl:sourcedFrom',
|
|
124
|
+
SOURCED_FROM_ALT: 'gl:sourced_from',
|
|
125
|
+
|
|
126
|
+
// RelatedConcept
|
|
127
|
+
RELATIONSHIP_TYPE: 'gl:relationshipType',
|
|
128
|
+
TARGET: 'gl:target',
|
|
129
|
+
SOURCE_ID: 'gl:sourceId',
|
|
130
|
+
CITATION: 'gl:citation',
|
|
131
|
+
|
|
132
|
+
// PartitiveMember (MECE)
|
|
133
|
+
PRESENCE: 'gl:presence',
|
|
134
|
+
COUNT: 'gl:count',
|
|
135
|
+
IS_DELIMITING: 'gl:isDelimiting',
|
|
136
|
+
MULTIPLICITY: 'gl:multiplicity',
|
|
137
|
+
CERTAINTY: 'gl:certainty',
|
|
138
|
+
|
|
139
|
+
// PartitiveRelation
|
|
140
|
+
COMPREHENSIVE: 'gl:comprehensive',
|
|
141
|
+
HAS_PARTITIVE: 'gl:hasPartitive',
|
|
142
|
+
COMPLETENESS: 'gl:completeness',
|
|
143
|
+
CRITERION: 'gl:criterion',
|
|
144
|
+
|
|
145
|
+
// Non-verbal entity references at concept level
|
|
146
|
+
FIGURE_REF: 'gl:figureRef',
|
|
147
|
+
TABLE_REF: 'gl:tableRef',
|
|
148
|
+
FORMULA_REF: 'gl:formulaRef',
|
|
149
|
+
|
|
150
|
+
// NonVerbalReference display string
|
|
151
|
+
DISPLAY: 'gl:display',
|
|
152
|
+
} as const;
|
|
153
|
+
|
|
154
|
+
export type WireKey = typeof GL[keyof typeof GL];
|
package/vite.config.ts
CHANGED