linked-rolls 0.1.0 → 0.2.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/LICENSE +26 -0
- package/README.md +35 -0
- package/lib/Assumption.d.ts +7 -2
- package/lib/ConditionState.d.ts +8 -1
- package/lib/Edit.d.ts +4 -3
- package/lib/Edition.d.ts +65 -35
- package/lib/Edition.js +1 -1
- package/lib/Emulation.js +32 -10
- package/lib/Feature.d.ts +19 -4
- package/lib/Plan.js +2 -1
- package/lib/RollCopy.d.ts +65 -27
- package/lib/RollCopy.js +51 -7
- package/lib/Symbol.d.ts +37 -20
- package/lib/Symbol.js +12 -0
- package/lib/TrackerBar.d.ts +18 -0
- package/lib/TrackerBar.js +27 -0
- package/lib/Version.d.ts +12 -4
- package/lib/asJsonLd.js +16 -2
- package/lib/context.d.ts +2 -0
- package/lib/context.js +2 -0
- package/lib/importJsonLd.js +19 -5
- package/lib/migrate.d.ts +15 -0
- package/lib/migrate.js +77 -0
- package/lib/schema.json +322 -276
- package/lib/spec/context.json +201 -131
- package/lib/spec/welte-t100.context.json +10 -0
- package/lib/systems/welteT100.js +19 -17
- package/lib/validate.d.ts +26 -0
- package/lib/validate.js +46 -0
- package/package.json +2 -1
package/lib/spec/context.json
CHANGED
|
@@ -1,173 +1,243 @@
|
|
|
1
1
|
{
|
|
2
2
|
"@context": {
|
|
3
|
+
"@version": 1.1,
|
|
3
4
|
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
|
5
|
+
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
|
|
4
6
|
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
|
|
5
7
|
"owl": "http://www.w3.org/2002/07/owl#",
|
|
6
8
|
"dcterms": "http://purl.org/dc/terms/",
|
|
7
9
|
"crm": "http://www.cidoc-crm.org/cidoc-crm/",
|
|
8
|
-
"crmdig": "http://www.
|
|
9
|
-
"crminf": "http://www.cidoc-crm.org/
|
|
10
|
+
"crmdig": "http://www.cidoc-crm.org/extensions/crmdig/",
|
|
11
|
+
"crminf": "http://www.cidoc-crm.org/extensions/crminf/",
|
|
10
12
|
"lrmoo": "http://iflastandards.info/ns/lrm/lrmoo/",
|
|
11
|
-
"reo": "
|
|
12
|
-
"@vocab": "http://linked-rolls.org/reo/",
|
|
13
|
+
"reo": "https://w3id.org/reo/",
|
|
13
14
|
"Edition": "lrmoo:F2_Expression",
|
|
14
|
-
"
|
|
15
|
+
"Version": "lrmoo:F2_Expression",
|
|
16
|
+
"RollCopy": "lrmoo:F5_Item",
|
|
17
|
+
"Hole": "crm:E26_Physical_Feature",
|
|
18
|
+
"Mark": "crm:E25_Human-Made_Feature",
|
|
19
|
+
"Writing": "crm:E25_Human-Made_Feature",
|
|
20
|
+
"GluedOn": "crm:E22_Human-Made_Object",
|
|
15
21
|
"Addition": "crm:E79_Part_Addition",
|
|
16
22
|
"Removal": "crm:E80_Part_Removal",
|
|
17
|
-
"
|
|
23
|
+
"ConditionState": "crm:E3_Condition_State",
|
|
24
|
+
"note": "reo:Note",
|
|
25
|
+
"expression": "reo:Expression",
|
|
26
|
+
"text": {
|
|
27
|
+
"@id": "crm:E33_Linguistic_Object",
|
|
28
|
+
"@context": {
|
|
29
|
+
"text": "crm:P190_has_symbolic_content"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"edit": {
|
|
33
|
+
"@id": "reo:Edit",
|
|
34
|
+
"@context": {
|
|
35
|
+
"editType": {
|
|
36
|
+
"@id": "crm:P2_has_type",
|
|
37
|
+
"@type": "@vocab",
|
|
38
|
+
"@context": { "@vocab": "https://w3id.org/reo/type/" }
|
|
39
|
+
},
|
|
40
|
+
"motivation": {
|
|
41
|
+
"@id": "crm:P17_was_motivated_by",
|
|
42
|
+
"@type": "@id"
|
|
43
|
+
},
|
|
44
|
+
"insert": "reo:added",
|
|
45
|
+
"delete": {
|
|
46
|
+
"@id": "reo:removed",
|
|
47
|
+
"@type": "@id"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"motivation": {
|
|
52
|
+
"@id": "crm:E33_Linguistic_Object",
|
|
53
|
+
"@context": {
|
|
54
|
+
"note": "crm:P3_has_note"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"simpleArgumentation": {
|
|
58
|
+
"@id": "crminf:I1_Argumentation",
|
|
59
|
+
"@context": { "note": "crm:P3_has_note" }
|
|
60
|
+
},
|
|
61
|
+
"inference": {
|
|
62
|
+
"@id": "crminf:I5_Inference_Making",
|
|
63
|
+
"@context": { "note": "crm:P3_has_note" }
|
|
64
|
+
},
|
|
65
|
+
"beliefAdoption": {
|
|
66
|
+
"@id": "crminf:I7_Belief_Adoption",
|
|
67
|
+
"@context": { "note": "crm:P3_has_note" }
|
|
68
|
+
},
|
|
69
|
+
"meaningComprehension": {
|
|
70
|
+
"@id": "crminf:I16_Meaning_Comprehension",
|
|
71
|
+
"@context": { "note": "crm:P3_has_note" }
|
|
72
|
+
},
|
|
73
|
+
"title": "dcterms:title",
|
|
18
74
|
"license": {
|
|
19
75
|
"@id": "dcterms:license",
|
|
20
76
|
"@type": "@id"
|
|
21
77
|
},
|
|
78
|
+
"creation": "lrmoo:R17i_was_created_by",
|
|
79
|
+
"publisher": "crm:P14_carried_out_by",
|
|
80
|
+
"publicationDate": {
|
|
81
|
+
"@id": "dcterms:date",
|
|
82
|
+
"@type": "xsd:date"
|
|
83
|
+
},
|
|
84
|
+
"collationTolerance": null,
|
|
85
|
+
"roll": "lrmoo:R3i_realises",
|
|
86
|
+
"catalogueNumber": "dcterms:identifier",
|
|
87
|
+
"system": "crm:P2_has_type",
|
|
88
|
+
"recordingEvent": "lrmoo:R19i_was_realised_through",
|
|
89
|
+
"recorded": "lrmoo:R81_recorded",
|
|
90
|
+
"pianist": "crm:P14_carried_out_by",
|
|
91
|
+
"playing": {
|
|
92
|
+
"@id": "lrmoo:R80_performed",
|
|
93
|
+
"@type": "@id"
|
|
94
|
+
},
|
|
95
|
+
"place": "crm:P7_took_place_at",
|
|
96
|
+
"date": {
|
|
97
|
+
"@id": "dcterms:date",
|
|
98
|
+
"@type": "xsd:date"
|
|
99
|
+
},
|
|
100
|
+
"created": "lrmoo:R17_created",
|
|
101
|
+
"copies": "reo:witness",
|
|
102
|
+
"versions": "lrmoo:R75_incorporates",
|
|
103
|
+
"tempoAdjustment": {
|
|
104
|
+
"@id": "reo:tempo",
|
|
105
|
+
"@context": {
|
|
106
|
+
"startsWith": "reo:from",
|
|
107
|
+
"endsWith": "reo:to"
|
|
108
|
+
}
|
|
109
|
+
},
|
|
22
110
|
"name": "rdfs:label",
|
|
23
111
|
"sameAs": {
|
|
24
112
|
"@id": "owl:sameAs",
|
|
25
113
|
"@type": "@id"
|
|
26
114
|
},
|
|
27
|
-
"role":
|
|
28
|
-
|
|
29
|
-
|
|
115
|
+
"role": {
|
|
116
|
+
"@id": "crm:P2_has_type",
|
|
117
|
+
"@type": "@vocab",
|
|
118
|
+
"@context": { "@vocab": "https://w3id.org/reo/type/" }
|
|
119
|
+
},
|
|
120
|
+
"ops": null,
|
|
121
|
+
"measurements": {
|
|
122
|
+
"@id": "crm:P39i_was_measured_by",
|
|
123
|
+
"@context": {
|
|
124
|
+
"shift": null,
|
|
125
|
+
"trackCalibration": null,
|
|
126
|
+
"margins": null,
|
|
127
|
+
"dimensions": "reo:dimensions",
|
|
128
|
+
"width": "reo:width",
|
|
129
|
+
"height": "reo:height",
|
|
130
|
+
"punchDiameter": "reo:punchDiameter",
|
|
131
|
+
"holeSeparation": "reo:holeSeparation",
|
|
132
|
+
"value": "crm:P90_has_value",
|
|
133
|
+
"measuredBy": "crmdig:L23_used_software_or_firmware",
|
|
134
|
+
"software": "rdfs:label",
|
|
135
|
+
"version": "owl:versionInfo"
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"production": "lrmoo:R28i_was_produced_by",
|
|
139
|
+
"company": "crm:P14_carried_out_by",
|
|
140
|
+
"paper": "crm:P126_employed",
|
|
141
|
+
"conditions": "crm:P44_has_condition",
|
|
142
|
+
"condition": "crm:P44_has_condition",
|
|
143
|
+
"conditionType": {
|
|
144
|
+
"@id": "crm:P2_has_type",
|
|
145
|
+
"@type": "@vocab",
|
|
146
|
+
"@context": { "@vocab": "https://w3id.org/reo/type/" }
|
|
147
|
+
},
|
|
30
148
|
"description": "crm:P3_has_note",
|
|
149
|
+
"factor": "rdf:value",
|
|
150
|
+
"keeper": "crm:P50_has_current_keeper",
|
|
151
|
+
"features": "crm:P56_bears_feature",
|
|
152
|
+
"modifications": "crm:P31i_was_modified_by",
|
|
153
|
+
"scan": {
|
|
154
|
+
"@id": "crm:P138i_has_representation",
|
|
155
|
+
"@type": "@id"
|
|
156
|
+
},
|
|
31
157
|
"depiction": {
|
|
32
|
-
"@id": "crm:
|
|
158
|
+
"@id": "crm:P138i_has_representation",
|
|
33
159
|
"@type": "@id"
|
|
34
160
|
},
|
|
35
161
|
"horizontal": "crm:P43_has_dimension",
|
|
36
162
|
"vertical": "crm:P43_has_dimension",
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
|
|
163
|
+
"from": "reo:from",
|
|
164
|
+
"to": "reo:to",
|
|
165
|
+
"unit": {
|
|
166
|
+
"@id": "crm:P91_has_unit",
|
|
167
|
+
"@type": "@vocab",
|
|
168
|
+
"@context": { "@vocab": "https://w3id.org/reo/type/" }
|
|
169
|
+
},
|
|
170
|
+
"pattern": {
|
|
171
|
+
"@id": "reo:pattern",
|
|
172
|
+
"@type": "@vocab",
|
|
173
|
+
"@context": { "@vocab": "https://w3id.org/reo/type/" }
|
|
174
|
+
},
|
|
175
|
+
"method": {
|
|
176
|
+
"@id": "crm:P2_has_type",
|
|
177
|
+
"@type": "@vocab",
|
|
178
|
+
"@context": { "@vocab": "https://w3id.org/reo/type/" }
|
|
179
|
+
},
|
|
180
|
+
"transcription": "crm:P128_carries",
|
|
181
|
+
"material": {
|
|
182
|
+
"@id": "crm:P45_consists_of",
|
|
183
|
+
"@type": "@vocab",
|
|
184
|
+
"@context": { "@vocab": "https://w3id.org/reo/type/" }
|
|
185
|
+
},
|
|
186
|
+
"actor": "crm:P14_carried_out_by",
|
|
187
|
+
"added": {
|
|
188
|
+
"@id": "crm:P111_added",
|
|
40
189
|
"@type": "@id"
|
|
41
190
|
},
|
|
42
|
-
"
|
|
43
|
-
"@id": "crm:
|
|
191
|
+
"removed": {
|
|
192
|
+
"@id": "crm:P113_removed",
|
|
44
193
|
"@type": "@id"
|
|
45
194
|
},
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"material": "crm:P45_consists_of",
|
|
51
|
-
"condition": "crm:P44_has_condition",
|
|
52
|
-
"creation": {
|
|
53
|
-
"@id": "lrmoo:R17i_was_created_by",
|
|
54
|
-
"@context": {
|
|
55
|
-
"publisher": "crm:P14_carried_out_by",
|
|
56
|
-
"publicationDate": {
|
|
57
|
-
"@id": "crm:P4_has_time-span",
|
|
58
|
-
"@type": "xsd:date"
|
|
59
|
-
},
|
|
60
|
-
"collationTolerance": "crmdig:L13_used_parameters"
|
|
61
|
-
}
|
|
195
|
+
"purpose": {
|
|
196
|
+
"@id": "crm:P21_had_general_purpose",
|
|
197
|
+
"@type": "@vocab",
|
|
198
|
+
"@context": { "@vocab": "https://w3id.org/reo/type/" }
|
|
62
199
|
},
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
"@
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"@id": "lrmoo:R19i_was_realised_through",
|
|
69
|
-
"@context": {
|
|
70
|
-
"recorded": {
|
|
71
|
-
"@id": "lrmoo:R81_recorded",
|
|
72
|
-
"@context": {
|
|
73
|
-
"pianist": "crm:P14_carried_out_by",
|
|
74
|
-
"playing": {
|
|
75
|
-
"@type": "@id"
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
"place": "crm:P7_took_place_at",
|
|
80
|
-
"created": "lrmoo:R17_created"
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
200
|
+
"siglum": "reo:siglum",
|
|
201
|
+
"versionType": {
|
|
202
|
+
"@id": "crm:P2_has_type",
|
|
203
|
+
"@type": "@vocab",
|
|
204
|
+
"@context": { "@vocab": "https://w3id.org/reo/type/" }
|
|
84
205
|
},
|
|
85
|
-
"
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
"conditions": "crm:P44_has_condition",
|
|
97
|
-
"modifications": {
|
|
98
|
-
"@id": "crm:P31i_was_modified_by",
|
|
99
|
-
"@context": {
|
|
100
|
-
"added": "crm:P111_added",
|
|
101
|
-
"removed": "crm:P113_removed",
|
|
102
|
-
"purpose": "crm:P21_had_general_purpose"
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
"measurements": {
|
|
106
|
-
"@id": "crm:P39i_was_measured_by",
|
|
107
|
-
"@context": {
|
|
108
|
-
"measuredBy": {
|
|
109
|
-
"@context": {
|
|
110
|
-
"software": "crmdig:L23_used_software_or_firmware"
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
"features": {
|
|
116
|
-
"@id": "crm:P56_bears_feature",
|
|
117
|
-
"@context": {
|
|
118
|
-
"method": "crm:P2_has_type",
|
|
119
|
-
"transcription": "crm:P128_carries",
|
|
120
|
-
"pattern": "crm:P2_has_type",
|
|
121
|
-
"features": "crm:P56_bears_feature"
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
206
|
+
"basedOn": "lrmoo:R76_is_derivative_of",
|
|
207
|
+
"edits": "reo:involvedEdit",
|
|
208
|
+
"motivations": "@included",
|
|
209
|
+
"carriers": "crm:P128i_is_carried_by",
|
|
210
|
+
"alignedWith": "reo:alignedWith",
|
|
211
|
+
"pairedWith": "reo:pairedWith",
|
|
212
|
+
"pitch": {
|
|
213
|
+
"@id": "reo:pitch",
|
|
214
|
+
"@type": "xsd:integer"
|
|
125
215
|
},
|
|
126
|
-
"
|
|
127
|
-
"@id": "
|
|
128
|
-
"@
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
"edits": {
|
|
136
|
-
"@id": "reo:P16_involved_edit",
|
|
137
|
-
"@context": {
|
|
138
|
-
"editType": "crm:P2_has_type",
|
|
139
|
-
"motivation": {
|
|
140
|
-
"@id": "crm:P17_was_motivated_by",
|
|
141
|
-
"@type": "@id"
|
|
142
|
-
},
|
|
143
|
-
"insert": "reo:P7_added",
|
|
144
|
-
"delete": {
|
|
145
|
-
"@id": "reo:P8_removed",
|
|
146
|
-
"@type": "@id"
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
216
|
+
"scope": {
|
|
217
|
+
"@id": "reo:scope",
|
|
218
|
+
"@type": "@vocab",
|
|
219
|
+
"@context": { "@vocab": "https://w3id.org/reo/type/" }
|
|
220
|
+
},
|
|
221
|
+
"expressionType": {
|
|
222
|
+
"@id": "crm:P2_has_type",
|
|
223
|
+
"@type": "@vocab",
|
|
224
|
+
"@context": { "@vocab": "https://w3id.org/reo/type/" }
|
|
151
225
|
},
|
|
152
226
|
"belief": {
|
|
153
|
-
"@id": "crminf:
|
|
227
|
+
"@id": "crminf:J4i_is_subject_of",
|
|
154
228
|
"@context": {
|
|
155
229
|
"belief": "crminf:I2_Belief",
|
|
156
230
|
"certainty": "crminf:J5_holds_to_be",
|
|
157
|
-
"reasons":
|
|
158
|
-
"@id": "crminf:J2i_was_concluded_by",
|
|
159
|
-
"@context": {
|
|
160
|
-
"comprehends": {
|
|
161
|
-
"@id": "crminf:J22_interpreted_meaning_of",
|
|
162
|
-
"@type": "@id"
|
|
163
|
-
},
|
|
164
|
-
"premises": {
|
|
165
|
-
"@id": "crminf:J1_used_as_premise",
|
|
166
|
-
"@type": "@id"
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
231
|
+
"reasons": "crminf:J2i_was_concluded_by"
|
|
170
232
|
}
|
|
233
|
+
},
|
|
234
|
+
"comprehends": {
|
|
235
|
+
"@id": "crminf:J22_interpreted_meaning_of",
|
|
236
|
+
"@type": "@id"
|
|
237
|
+
},
|
|
238
|
+
"premises": {
|
|
239
|
+
"@id": "crminf:J1_used_as_premise",
|
|
240
|
+
"@type": "@id"
|
|
171
241
|
}
|
|
172
242
|
}
|
|
173
243
|
}
|
package/lib/systems/welteT100.js
CHANGED
|
@@ -14,22 +14,24 @@ export const defaultWelteT100Options = {
|
|
|
14
14
|
division: 54
|
|
15
15
|
};
|
|
16
16
|
/** What each expression code operates, in the emulator's terms. */
|
|
17
|
-
const CODES =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
17
|
+
const CODES = {
|
|
18
|
+
MezzoforteOn: ['mezzoforte', 'on'],
|
|
19
|
+
MezzoforteOff: ['mezzoforte', 'off'],
|
|
20
|
+
SlowCrescendoOn: ['crescendo', 'on'],
|
|
21
|
+
SlowCrescendoOff: ['crescendo', 'off'],
|
|
22
|
+
ForzandoOn: ['sforzando', 'on'],
|
|
23
|
+
ForzandoOff: ['sforzando', 'off'],
|
|
24
|
+
SustainPedalOn: ['sustainPedal', 'on'],
|
|
25
|
+
SustainPedalOff: ['sustainPedal', 'off'],
|
|
26
|
+
SoftPedalOn: ['hammerRail', 'on'],
|
|
27
|
+
SoftPedalOff: ['hammerRail', 'off'],
|
|
28
|
+
MotorOn: ['windResistance', 'on'],
|
|
29
|
+
MotorOff: ['windResistance', 'off'],
|
|
30
|
+
Rewind: ['rewind', 'on'],
|
|
31
|
+
ElectricCutOff: ['electricCutoff', 'on']
|
|
32
|
+
};
|
|
33
|
+
const isWelteT100ExpressionType = (type) => Object.hasOwn(CODES, type);
|
|
34
|
+
const codeOf = (expressionType) => isWelteT100ExpressionType(expressionType) ? CODES[expressionType] : undefined;
|
|
33
35
|
/** Paper the grid runs on past the last hole, so that a final pedal release completes. */
|
|
34
36
|
const RUN_OUT_MM = 100;
|
|
35
37
|
/**
|
|
@@ -51,7 +53,7 @@ const rowOf = (mm) => mm * ROWS_PER_MM;
|
|
|
51
53
|
export const secondsAt = (spool, mm) => paperSeconds(spool, mm / 10);
|
|
52
54
|
const halfOf = (note, division) => note.vertical.from >= division ? 'treble' : 'bass';
|
|
53
55
|
const readingOf = (event) => {
|
|
54
|
-
const code =
|
|
56
|
+
const code = codeOf(event.expressionType);
|
|
55
57
|
const half = scopeOf(event);
|
|
56
58
|
if (!code || !half)
|
|
57
59
|
return undefined;
|
package/lib/validate.d.ts
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
1
|
import { Edition } from "./Edition";
|
|
2
|
+
import { EditionView } from "./EditionView";
|
|
3
|
+
import { TrackerBar } from "./TrackerBar";
|
|
2
4
|
declare const validate: import("ajv").ValidateFunction<Edition>;
|
|
3
5
|
export { validate };
|
|
6
|
+
export type ConstraintProblem = {
|
|
7
|
+
version: string;
|
|
8
|
+
symbol: string;
|
|
9
|
+
problem: 'alignment-reference-missing' | 'partner-missing' | 'paired-with-itself' | 'in-several-pairs' | 'pair-aligned-on-both-sides';
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Where the alignments and pairings of the edition cannot hold as
|
|
13
|
+
* stated, version by version: a reference or partner absent from the
|
|
14
|
+
* version, a perforation claimed by several pairs, or a pair whose
|
|
15
|
+
* members are both aligned and so cannot keep their distance and
|
|
16
|
+
* follow their references at once.
|
|
17
|
+
*/
|
|
18
|
+
export declare const constraintProblems: (view: EditionView) => ConstraintProblem[];
|
|
19
|
+
export type UnknownExpressionType = {
|
|
20
|
+
version: string;
|
|
21
|
+
symbol: string;
|
|
22
|
+
expressionType: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* The expressions of the edition whose type the tracker bar does not
|
|
26
|
+
* read, version by version. The roll names its system; a type from
|
|
27
|
+
* another system, or a misspelt one, means nothing on it.
|
|
28
|
+
*/
|
|
29
|
+
export declare const unknownExpressionTypes: (view: EditionView, bar: TrackerBar) => UnknownExpressionType[];
|
package/lib/validate.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import Ajv from "ajv";
|
|
2
2
|
import * as schema from "./schema.json";
|
|
3
|
+
import { idOf } from "./Assumption";
|
|
4
|
+
import { pairsAmong } from "./Symbol";
|
|
3
5
|
const ajv = new Ajv({
|
|
4
6
|
strict: false,
|
|
5
7
|
formats: {
|
|
@@ -8,3 +10,47 @@ const ajv = new Ajv({
|
|
|
8
10
|
});
|
|
9
11
|
const validate = ajv.compile(schema);
|
|
10
12
|
export { validate };
|
|
13
|
+
const isPerforation = (symbol) => symbol.type !== 'text';
|
|
14
|
+
const problemsIn = (version, perforations) => {
|
|
15
|
+
const ids = new Set(perforations.map(p => p.id));
|
|
16
|
+
const report = (symbol, problem) => ({ version, symbol, problem });
|
|
17
|
+
const missingReferences = perforations
|
|
18
|
+
.filter(p => p.alignedWith && !ids.has(idOf(p.alignedWith)))
|
|
19
|
+
.map(p => report(p.id, 'alignment-reference-missing'));
|
|
20
|
+
const missingPartners = perforations
|
|
21
|
+
.filter(p => p.pairedWith && !ids.has(idOf(p.pairedWith)))
|
|
22
|
+
.map(p => report(p.id, 'partner-missing'));
|
|
23
|
+
const selfPaired = perforations
|
|
24
|
+
.filter(p => p.pairedWith && idOf(p.pairedWith) === p.id)
|
|
25
|
+
.map(p => report(p.id, 'paired-with-itself'));
|
|
26
|
+
const pairs = pairsAmong(perforations);
|
|
27
|
+
const pairsOf = (p) => pairs.filter(pair => pair.includes(p));
|
|
28
|
+
const inSeveralPairs = perforations
|
|
29
|
+
.filter(p => pairsOf(p).length > 1)
|
|
30
|
+
.map(p => report(p.id, 'in-several-pairs'));
|
|
31
|
+
const alignedOnBothSides = pairs
|
|
32
|
+
.filter(([one, other]) => one.alignedWith && other.alignedWith)
|
|
33
|
+
.flatMap(pair => pair.map(p => report(p.id, 'pair-aligned-on-both-sides')));
|
|
34
|
+
return [...missingReferences, ...missingPartners, ...selfPaired, ...inSeveralPairs, ...alignedOnBothSides];
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Where the alignments and pairings of the edition cannot hold as
|
|
38
|
+
* stated, version by version: a reference or partner absent from the
|
|
39
|
+
* version, a perforation claimed by several pairs, or a pair whose
|
|
40
|
+
* members are both aligned and so cannot keep their distance and
|
|
41
|
+
* follow their references at once.
|
|
42
|
+
*/
|
|
43
|
+
export const constraintProblems = (view) => view.edition.versions.flatMap(version => problemsIn(version.id, view.snapshot(version.id).filter(isPerforation)));
|
|
44
|
+
const isExpression = (symbol) => symbol.type === 'expression';
|
|
45
|
+
/**
|
|
46
|
+
* The expressions of the edition whose type the tracker bar does not
|
|
47
|
+
* read, version by version. The roll names its system; a type from
|
|
48
|
+
* another system, or a misspelt one, means nothing on it.
|
|
49
|
+
*/
|
|
50
|
+
export const unknownExpressionTypes = (view, bar) => {
|
|
51
|
+
const known = new Set(bar.expressionTypes);
|
|
52
|
+
return view.edition.versions.flatMap(version => view.snapshot(version.id)
|
|
53
|
+
.filter(isExpression)
|
|
54
|
+
.filter(symbol => !known.has(symbol.expressionType))
|
|
55
|
+
.map(symbol => ({ version: version.id, symbol: symbol.id, expressionType: symbol.expressionType })));
|
|
56
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "linked-rolls",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Digital editions of piano rolls: import, collation, editorial assumptions, JSON-LD export, and emulation through a reproducing system",
|
|
5
|
+
"license": "MIT",
|
|
5
6
|
"repository": {
|
|
6
7
|
"type": "git",
|
|
7
8
|
"url": "git+https://github.com/pfefferniels/linked-rolls.git"
|