linked-rolls 0.41.0 → 0.43.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/lib/Agent.d.ts CHANGED
@@ -67,10 +67,15 @@ export type WithActor = {
67
67
  export interface Place extends Named {
68
68
  }
69
69
  /**
70
- * A term from a vocabulary, such as a roll system or a kind of
71
- * paper. A term the type vocabulary knows carries its IRI as `id`.
70
+ * A term from a vocabulary, such as a roll system, a procedure or a
71
+ * kind of paper.
72
+ *
73
+ * A term the type vocabulary declares is named by its IRI, and what it
74
+ * is called stands in the vocabulary rather than in the edition, so it
75
+ * needs no name of its own; `nameOf` reads one either way. A term the
76
+ * vocabulary does not have is given by name, which is then all there is
77
+ * to go on.
72
78
  * @see crm:E55 Type
73
79
  */
74
- export interface Concept extends Named, Partial<WithId> {
75
- }
80
+ export type Concept = (WithId & Partial<Named>) | (Named & Partial<WithId>);
76
81
  export {};
package/lib/Feature.d.ts CHANGED
@@ -131,36 +131,46 @@ export interface OnAFace {
131
131
  */
132
132
  side?: 'recto' | 'verso';
133
133
  }
134
+ export declare const techniques: readonly ['print', 'handwriting', 'stamp'];
135
+ /** How a trace was put on the paper. */
136
+ export type Technique = typeof techniques[number];
137
+ export declare const media: readonly ['ink', 'pencil', 'crayon'];
138
+ /** What a trace was put on with. */
139
+ export type Medium = typeof media[number];
134
140
  /**
135
141
  * A trace is a visible mark or writing on the roll surface.
136
142
  * Traces may fade over time.
137
143
  */
138
144
  export interface Trace<T extends FeatureType> extends RollFeature<T, typeof conditions[T][number]>, OnAFace {
145
+ /**
146
+ * How the trace was put on the paper.
147
+ * @see reo:technique
148
+ */
149
+ technique?: Technique;
150
+ /**
151
+ * What it was put on with, where it can be told. A date may be
152
+ * known to be handwritten where the pencil cannot be told from
153
+ * the ink, and a stamp leaves its ink as much as a pen does,
154
+ * which is why the two are stated apart.
155
+ * @see reo:medium
156
+ */
157
+ medium?: Medium;
139
158
  }
140
- export declare const writingMethods: readonly ['print', 'handwriting', 'stamp'];
141
- /**
142
- * The method by which a writing was produced on the roll:
143
- * printed, handwritten, or stamped.
144
- */
145
- export type WritingMethod = typeof writingMethods[number];
146
- export declare const markMethods: readonly ['ink', 'pencil', 'crayon'];
147
- /** The medium a mark was drawn in. */
148
- export type MarkMethod = typeof markMethods[number];
149
159
  /** The text a writing carries. It names no carriers of its own, the writing being its carrier. */
150
160
  export type Transcription = Omit<Text, 'carriers'>;
151
161
  /**
152
162
  * A piece of writing found on the roll, such as a label,
153
- * catalogue number, or annotation. Writings have a method
154
- * of production and a transcription of their content.
163
+ * catalogue number, or annotation. Writings state how they were made
164
+ * and a transcription of their content.
155
165
  * @see reo:Writing
156
166
  */
157
167
  export interface Writing extends Trace<'Writing'> {
158
168
  /**
159
- * The method by which this writing was produced
160
- * (e.g. through print, handwriting, or stamping).
161
- * @see reo:method
169
+ * A writing always states how it was put on the paper, which can
170
+ * be read off it where the medium cannot.
171
+ * @see reo:technique
162
172
  */
163
- method: WritingMethod;
173
+ technique: Technique;
164
174
  /**
165
175
  * A transcription of the text content of the writing.
166
176
  * This is an object assumption so that the transcription
@@ -186,11 +196,6 @@ export interface Writing extends Trace<'Writing'> {
186
196
  * @see reo:Mark
187
197
  */
188
198
  export interface Mark extends Trace<'Mark'> {
189
- /**
190
- * The medium the mark was drawn in, where it can be told.
191
- * @see reo:method
192
- */
193
- method?: MarkMethod;
194
199
  }
195
200
  /**
196
201
  * A piece of material (paper or tape) glued onto the roll surface.
package/lib/Feature.js CHANGED
@@ -6,8 +6,8 @@ export const conditions = {
6
6
  Mark: ['faded'],
7
7
  GluedOn: ['detaching', 'ripped']
8
8
  };
9
- export const writingMethods = ['print', 'handwriting', 'stamp'];
10
- export const markMethods = ['ink', 'pencil', 'crayon'];
9
+ export const techniques = ['print', 'handwriting', 'stamp'];
10
+ export const media = ['ink', 'pencil', 'crayon'];
11
11
  export const isRollFeature = (obj) => {
12
12
  return 'type' in obj && isFeatureType(obj.type);
13
13
  };
package/lib/index.d.ts CHANGED
@@ -18,6 +18,7 @@ export * from './ReproducingSystem';
18
18
  export * from './FeatureSource';
19
19
  export * from './RollCopy';
20
20
  export * from './procedures';
21
+ export * from './vocabulary';
21
22
  export * from './reservations';
22
23
  export * from './witnesses';
23
24
  export * from './alignment';
package/lib/index.js CHANGED
@@ -18,6 +18,7 @@ export * from './ReproducingSystem';
18
18
  export * from './FeatureSource';
19
19
  export * from './RollCopy';
20
20
  export * from './procedures';
21
+ export * from './vocabulary';
21
22
  export * from './reservations';
22
23
  export * from './witnesses';
23
24
  export * from './alignment';
package/lib/migrate.js CHANGED
@@ -1,4 +1,4 @@
1
- import { conditions, isFeatureType } from "./Feature";
1
+ import { conditions, isFeatureType, media, techniques } from "./Feature";
2
2
  import { rollConditions } from "./RollCopy";
3
3
  import { systemIdIn, systemOf, translationBetween } from "./TrackerBar";
4
4
  import { trackerBars } from "./systems";
@@ -14,7 +14,7 @@ const renamedKeys = {
14
14
  const referenceKeys = ['alignedWith', 'pairedWith', 'basedOn'];
15
15
  /**
16
16
  * The five type terms that were capitalised while the rest of the
17
- * vocabulary was not, under the keys that carry them.
17
+ * vocabulary was not, under the keys that carried them then.
18
18
  */
19
19
  const lowerCasedTerms = {
20
20
  method: { Print: 'print', Handwriting: 'handwriting', Stamp: 'stamp' },
@@ -44,6 +44,24 @@ const withLowerCaseTerms = (node) => Object.entries(lowerCasedTerms).reduce((res
44
44
  const lowered = terms[result[key]];
45
45
  return lowered ? { ...result, [key]: lowered } : result;
46
46
  }, node);
47
+ /** The key each term of the one-time `method` belongs under. */
48
+ const splitMethods = {
49
+ ...Object.fromEntries(techniques.map(term => [term, 'technique'])),
50
+ ...Object.fromEntries(media.map(term => [term, 'medium']))
51
+ };
52
+ /**
53
+ * How a writing or a mark was put on the paper and what it was put on
54
+ * with stood under one key, which left a handwriting no room to say it
55
+ * was pencilled. A term the format no longer knows stays where it is,
56
+ * so that it fails validation rather than being filed under a guess.
57
+ */
58
+ const withSplitMethod = (node) => {
59
+ const key = splitMethods[node.method];
60
+ if (!key)
61
+ return node;
62
+ const { method, ...rest } = node;
63
+ return { ...rest, [key]: method };
64
+ };
47
65
  const withReferences = (node) => referenceKeys.reduce((result, key) => {
48
66
  const reference = result[key];
49
67
  if (reference && typeof reference === 'object' && '@value' in reference) {
@@ -203,7 +221,7 @@ const withTimeSpanDates = (node) => {
203
221
  const { '@value': within, '@type': _typed, ...rest } = node;
204
222
  return { ...rest, within };
205
223
  };
206
- const migrateNode = (node) => [withRenamedKeys, withTypology, withoutVersionType, withLowerCaseTerms, withReferences, withKeeper, withoutEmptyKeeper,
224
+ const migrateNode = (node) => [withRenamedKeys, withTypology, withoutVersionType, withLowerCaseTerms, withSplitMethod, withReferences, withKeeper, withoutEmptyKeeper,
207
225
  withProductionNodes, withScale, withDerivationList, withReadingKind, withTimeSpanDates, withoutFeatureKind,
208
226
  withBorneFeaturesNamed, withFeaturesInActs]
209
227
  .reduce((result, step) => step(result), node);
package/lib/schema.json CHANGED
@@ -222,34 +222,66 @@
222
222
  "type": "object"
223
223
  },
224
224
  "Concept": {
225
- "description": "A term from a vocabulary, such as a roll system or a kind of paper. A term the type vocabulary knows carries its IRI as `id`.",
226
- "properties": {
227
- "name": {
228
- "description": "The name, e.g. \"Grünfeld, Alfred\", \"Wien\", \"M. Welte & Söhne\".",
229
- "type": "string",
230
- "ontology": "rdfs:label"
231
- },
232
- "sameAs": {
233
- "description": "Authority records for the same thing: GND, Wikidata, geonames or similar.",
234
- "examples": [
235
- "https://d-nb.info/gnd/116888652"
236
- ],
237
- "items": {
238
- "type": "string"
225
+ "anyOf": [
226
+ {
227
+ "properties": {
228
+ "name": {
229
+ "description": "The name, e.g. \"Grünfeld, Alfred\", \"Wien\", \"M. Welte & Söhne\".",
230
+ "type": "string",
231
+ "ontology": "rdfs:label"
232
+ },
233
+ "sameAs": {
234
+ "description": "Authority records for the same thing: GND, Wikidata, geonames or similar.",
235
+ "examples": [
236
+ "https://d-nb.info/gnd/116888652"
237
+ ],
238
+ "items": {
239
+ "type": "string"
240
+ },
241
+ "type": "array",
242
+ "ontology": "owl:sameAs"
243
+ },
244
+ "@id": {
245
+ "description": "A unique identifier for this object.",
246
+ "type": "string"
247
+ }
239
248
  },
240
- "type": "array",
241
- "ontology": "owl:sameAs"
249
+ "required": [
250
+ "@id"
251
+ ],
252
+ "type": "object"
242
253
  },
243
- "@id": {
244
- "description": "A unique identifier for this object.",
245
- "type": "string"
254
+ {
255
+ "properties": {
256
+ "name": {
257
+ "description": "The name, e.g. \"Grünfeld, Alfred\", \"Wien\", \"M. Welte & Söhne\".",
258
+ "type": "string",
259
+ "ontology": "rdfs:label"
260
+ },
261
+ "sameAs": {
262
+ "description": "Authority records for the same thing: GND, Wikidata, geonames or similar.",
263
+ "examples": [
264
+ "https://d-nb.info/gnd/116888652"
265
+ ],
266
+ "items": {
267
+ "type": "string"
268
+ },
269
+ "type": "array",
270
+ "ontology": "owl:sameAs"
271
+ },
272
+ "@id": {
273
+ "description": "A unique identifier for this object.",
274
+ "type": "string"
275
+ }
276
+ },
277
+ "required": [
278
+ "name",
279
+ "sameAs"
280
+ ],
281
+ "type": "object"
246
282
  }
247
- },
248
- "required": [
249
- "name",
250
- "sameAs"
251
283
  ],
252
- "type": "object",
284
+ "description": "A term from a vocabulary, such as a roll system, a procedure or a kind of paper.\n\nA term the type vocabulary declares is named by its IRI, and what it is called stands in the vocabulary rather than in the edition, so it needs no name of its own; `nameOf` reads one either way. A term the vocabulary does not have is given by name, which is then all there is to go on.",
253
285
  "ontology": "crm:E55 Type"
254
286
  },
255
287
  "DateAssignment": {
@@ -1024,10 +1056,10 @@
1024
1056
  "description": "Horizontal span of the feature on the roll.",
1025
1057
  "ontology": "crm:P43 has dimension"
1026
1058
  },
1027
- "method": {
1028
- "$ref": "#/definitions/MarkMethod",
1029
- "description": "The medium the mark was drawn in, where it can be told.",
1030
- "ontology": "reo:method"
1059
+ "medium": {
1060
+ "$ref": "#/definitions/Medium",
1061
+ "description": "What it was put on with, where it can be told. A date may be known to be handwritten where the pencil cannot be told from the ink, and a stamp leaves its ink as much as a pen does, which is why the two are stated apart.",
1062
+ "ontology": "reo:medium"
1031
1063
  },
1032
1064
  "side": {
1033
1065
  "description": "The face of the roll it lies on: the side that faces the reader as the roll plays, or the back of it.",
@@ -1038,6 +1070,11 @@
1038
1070
  "type": "string",
1039
1071
  "ontology": "reo:side"
1040
1072
  },
1073
+ "technique": {
1074
+ "$ref": "#/definitions/Technique",
1075
+ "description": "How the trace was put on the paper.",
1076
+ "ontology": "reo:technique"
1077
+ },
1041
1078
  "vertical": {
1042
1079
  "$ref": "#/definitions/VerticalSpan",
1043
1080
  "description": "Vertical span of the feature on the roll.",
@@ -1063,15 +1100,6 @@
1063
1100
  "type": "object",
1064
1101
  "ontology": "reo:Mark"
1065
1102
  },
1066
- "MarkMethod": {
1067
- "description": "The medium a mark was drawn in.",
1068
- "enum": [
1069
- "ink",
1070
- "pencil",
1071
- "crayon"
1072
- ],
1073
- "type": "string"
1074
- },
1075
1103
  "MeaningComprehension": {
1076
1104
  "description": "A meaning comprehension interprets or disambiguates the meaning of symbols or features. For example, interpreting a pencil mark as an instruction to add or remove a perforation or as the dating of the roll.",
1077
1105
  "properties": {
@@ -1195,6 +1223,15 @@
1195
1223
  "type": "object",
1196
1224
  "ontology": "crm:E54 Dimension"
1197
1225
  },
1226
+ "Medium": {
1227
+ "description": "What a trace was put on with.",
1228
+ "enum": [
1229
+ "ink",
1230
+ "pencil",
1231
+ "crayon"
1232
+ ],
1233
+ "type": "string"
1234
+ },
1198
1235
  "Millimeters": {
1199
1236
  "$ref": "#/definitions/Quantity%3C%22mm%22%3E",
1200
1237
  "description": "A place along the roll, or any length on the paper."
@@ -1451,10 +1488,10 @@
1451
1488
  "description": "Horizontal span of the feature on the roll. Left out by a feature a patch bears.",
1452
1489
  "ontology": "crm:P43 has dimension"
1453
1490
  },
1454
- "method": {
1455
- "$ref": "#/definitions/WritingMethod",
1456
- "description": "The method by which this writing was produced (e.g. through print, handwriting, or stamping).",
1457
- "ontology": "reo:method"
1491
+ "medium": {
1492
+ "$ref": "#/definitions/Medium",
1493
+ "description": "What it was put on with, where it can be told. A date may be known to be handwritten where the pencil cannot be told from the ink, and a stamp leaves its ink as much as a pen does, which is why the two are stated apart.",
1494
+ "ontology": "reo:medium"
1458
1495
  },
1459
1496
  "rotation": {
1460
1497
  "$ref": "#/definitions/Measure%3C%22deg%22%3E",
@@ -1470,6 +1507,11 @@
1470
1507
  "type": "string",
1471
1508
  "ontology": "reo:side"
1472
1509
  },
1510
+ "technique": {
1511
+ "$ref": "#/definitions/Technique",
1512
+ "description": "A writing always states how it was put on the paper, which can be read off it where the medium cannot.",
1513
+ "ontology": "reo:technique"
1514
+ },
1473
1515
  "transcription": {
1474
1516
  "$ref": "#/definitions/ObjectAssumption%3CTranscription%3E",
1475
1517
  "description": "A transcription of the text content of the writing. This is an object assumption so that the transcription can be annotated with a belief about its correctness.",
@@ -1493,7 +1535,7 @@
1493
1535
  },
1494
1536
  "required": [
1495
1537
  "@id",
1496
- "method",
1538
+ "technique",
1497
1539
  "transcription",
1498
1540
  "@type"
1499
1541
  ],
@@ -1516,10 +1558,10 @@
1516
1558
  "description": "Horizontal span of the feature on the roll. Left out by a feature a patch bears.",
1517
1559
  "ontology": "crm:P43 has dimension"
1518
1560
  },
1519
- "method": {
1520
- "$ref": "#/definitions/MarkMethod",
1521
- "description": "The medium the mark was drawn in, where it can be told.",
1522
- "ontology": "reo:method"
1561
+ "medium": {
1562
+ "$ref": "#/definitions/Medium",
1563
+ "description": "What it was put on with, where it can be told. A date may be known to be handwritten where the pencil cannot be told from the ink, and a stamp leaves its ink as much as a pen does, which is why the two are stated apart.",
1564
+ "ontology": "reo:medium"
1523
1565
  },
1524
1566
  "side": {
1525
1567
  "description": "The face of the roll it lies on: the side that faces the reader as the roll plays, or the back of it.",
@@ -1530,6 +1572,11 @@
1530
1572
  "type": "string",
1531
1573
  "ontology": "reo:side"
1532
1574
  },
1575
+ "technique": {
1576
+ "$ref": "#/definitions/Technique",
1577
+ "description": "How the trace was put on the paper.",
1578
+ "ontology": "reo:technique"
1579
+ },
1533
1580
  "vertical": {
1534
1581
  "$ref": "#/definitions/VerticalSpan",
1535
1582
  "description": "Vertical span of the feature on the roll. Left out by a feature a patch bears.",
@@ -2888,6 +2935,15 @@
2888
2935
  ],
2889
2936
  "type": "string"
2890
2937
  },
2938
+ "Technique": {
2939
+ "description": "How a trace was put on the paper.",
2940
+ "enum": [
2941
+ "print",
2942
+ "handwriting",
2943
+ "stamp"
2944
+ ],
2945
+ "type": "string"
2946
+ },
2891
2947
  "Text": {
2892
2948
  "description": "A textual symbol, e.g. a label or annotation found on the roll.",
2893
2949
  "properties": {
@@ -3068,7 +3124,7 @@
3068
3124
  "ontology": "crm:E54 Dimension"
3069
3125
  },
3070
3126
  "Writing": {
3071
- "description": "A piece of writing found on the roll, such as a label, catalogue number, or annotation. Writings have a method of production and a transcription of their content.",
3127
+ "description": "A piece of writing found on the roll, such as a label, catalogue number, or annotation. Writings state how they were made and a transcription of their content.",
3072
3128
  "properties": {
3073
3129
  "condition": {
3074
3130
  "$ref": "#/definitions/ObjectAssumption%3CConditionState%3C(%22illegible%22)%3E%3E",
@@ -3085,10 +3141,10 @@
3085
3141
  "description": "Horizontal span of the feature on the roll.",
3086
3142
  "ontology": "crm:P43 has dimension"
3087
3143
  },
3088
- "method": {
3089
- "$ref": "#/definitions/WritingMethod",
3090
- "description": "The method by which this writing was produced (e.g. through print, handwriting, or stamping).",
3091
- "ontology": "reo:method"
3144
+ "medium": {
3145
+ "$ref": "#/definitions/Medium",
3146
+ "description": "What it was put on with, where it can be told. A date may be known to be handwritten where the pencil cannot be told from the ink, and a stamp leaves its ink as much as a pen does, which is why the two are stated apart.",
3147
+ "ontology": "reo:medium"
3092
3148
  },
3093
3149
  "rotation": {
3094
3150
  "$ref": "#/definitions/Measure%3C%22deg%22%3E",
@@ -3104,6 +3160,11 @@
3104
3160
  "type": "string",
3105
3161
  "ontology": "reo:side"
3106
3162
  },
3163
+ "technique": {
3164
+ "$ref": "#/definitions/Technique",
3165
+ "description": "A writing always states how it was put on the paper, which can be read off it where the medium cannot.",
3166
+ "ontology": "reo:technique"
3167
+ },
3107
3168
  "transcription": {
3108
3169
  "$ref": "#/definitions/ObjectAssumption%3CTranscription%3E",
3109
3170
  "description": "A transcription of the text content of the writing. This is an object assumption so that the transcription can be annotated with a belief about its correctness.",
@@ -3128,22 +3189,13 @@
3128
3189
  "required": [
3129
3190
  "horizontal",
3130
3191
  "@id",
3131
- "method",
3192
+ "technique",
3132
3193
  "transcription",
3133
3194
  "@type",
3134
3195
  "vertical"
3135
3196
  ],
3136
3197
  "type": "object",
3137
3198
  "ontology": "reo:Writing"
3138
- },
3139
- "WritingMethod": {
3140
- "description": "The method by which a writing was produced on the roll: printed, handwritten, or stamped.",
3141
- "enum": [
3142
- "print",
3143
- "handwriting",
3144
- "stamp"
3145
- ],
3146
- "type": "string"
3147
3199
  }
3148
3200
  }
3149
3201
  }
@@ -241,8 +241,13 @@
241
241
  "@type": "@vocab",
242
242
  "@context": { "@vocab": "https://w3id.org/reo/type/" }
243
243
  },
244
- "method": {
245
- "@id": "reo:method",
244
+ "technique": {
245
+ "@id": "reo:technique",
246
+ "@type": "@vocab",
247
+ "@context": { "@vocab": "https://w3id.org/reo/type/" }
248
+ },
249
+ "medium": {
250
+ "@id": "reo:medium",
246
251
  "@type": "@vocab",
247
252
  "@context": { "@vocab": "https://w3id.org/reo/type/" }
248
253
  },
@@ -0,0 +1,15 @@
1
+ import { Concept } from "./Agent";
2
+ /**
3
+ * The concepts the type vocabulary declares, whatever kind they are:
4
+ * the reproducing systems and the procedures. An edition names one of
5
+ * them by its IRI alone.
6
+ */
7
+ export declare const vocabulary: readonly Concept[];
8
+ /** The concept of that IRI, where the vocabulary declares one. */
9
+ export declare const conceptOf: (id: string | undefined) => Concept | undefined;
10
+ /**
11
+ * What a concept is called: the name it states, else the one the
12
+ * vocabulary gives it, else its IRI, so that a reader always has
13
+ * something to show.
14
+ */
15
+ export declare const nameOf: (concept: Concept) => string;
@@ -0,0 +1,20 @@
1
+ import { procedures } from "./procedures";
2
+ import { systemOf } from "./TrackerBar";
3
+ import { trackerBars } from "./systems";
4
+ /**
5
+ * The concepts the type vocabulary declares, whatever kind they are:
6
+ * the reproducing systems and the procedures. An edition names one of
7
+ * them by its IRI alone.
8
+ */
9
+ export const vocabulary = [
10
+ ...trackerBars.map(systemOf),
11
+ ...procedures
12
+ ];
13
+ /** The concept of that IRI, where the vocabulary declares one. */
14
+ export const conceptOf = (id) => id === undefined ? undefined : vocabulary.find(concept => concept.id === id);
15
+ /**
16
+ * What a concept is called: the name it states, else the one the
17
+ * vocabulary gives it, else its IRI, so that a reader always has
18
+ * something to show.
19
+ */
20
+ export const nameOf = (concept) => concept.name ?? conceptOf(concept.id)?.name ?? concept.id ?? '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linked-rolls",
3
- "version": "0.41.0",
3
+ "version": "0.43.0",
4
4
  "description": "Digital editions of piano rolls: import, collation, editorial assumptions, JSON-LD export, and emulation through a reproducing system",
5
5
  "license": "MIT",
6
6
  "repository": {