linked-rolls 0.34.0 → 0.36.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/RollCopy.d.ts CHANGED
@@ -34,6 +34,11 @@ export interface GeneralRollCondition extends ConditionState<'general'> {
34
34
  * to a roll copy, annotatable with a belief about its certainty.
35
35
  */
36
36
  export type RollConditionAssignment = ObjectAssumption<GeneralRollCondition | PaperStretch>;
37
+ /**
38
+ * The keeper a copy is held by, as an object assumption, so that the
39
+ * statement can carry the belief it rests on and the reasons for it.
40
+ */
41
+ export type KeeperAssignment = ObjectAssumption<Agent>;
37
42
  export declare const rollConditions: readonly ['general', 'paper-stretch'];
38
43
  /**
39
44
  * A shift correction applied to a roll copy to align it
@@ -283,10 +288,13 @@ export interface RollCopy extends WithType<'RollCopy'>, WithId {
283
288
  siglum?: string;
284
289
  /**
285
290
  * The institution or person holding this copy. Left out where it is
286
- * not known, as for a copy known only from a recording.
291
+ * not known, as for a copy known only from a recording. An object
292
+ * assumption, so that a keeper read off a file header or adopted
293
+ * from a letter can say where it comes from. Who held the copy
294
+ * before is not stated here: P50 names the current keeper.
287
295
  * @see crm:P50 has current keeper
288
296
  */
289
- keeper?: Agent;
297
+ keeper?: KeeperAssignment;
290
298
  /**
291
299
  * The physical features found on this copy, with shift
292
300
  * and stretch already applied when `ops` says so.
package/lib/notes.d.ts CHANGED
@@ -4,6 +4,7 @@ export type NotePart = {
4
4
  } | {
5
5
  type: 'reference';
6
6
  id: string;
7
+ label?: string;
7
8
  };
8
9
  /** The note in the pieces it is shown in: stretches of text and what they refer to. */
9
10
  export declare const partsOfNote: (note: string) => NotePart[];
@@ -11,7 +12,8 @@ export declare const partsOfNote: (note: string) => NotePart[];
11
12
  export declare const referencesInNote: (note: string) => string[];
12
13
  /**
13
14
  * The note as it reads, with every reference resolved to the name the
14
- * edition gives that entity. A reference nothing answers to keeps its id,
15
- * so that the gap is visible rather than silent.
15
+ * edition gives that entity, or to the words the note puts in its place.
16
+ * A reference nothing answers to keeps its id, so that the gap is visible
17
+ * rather than silent.
16
18
  */
17
19
  export declare const resolveNote: (note: string, nameOf: (id: string) => string | undefined) => string;
package/lib/notes.js CHANGED
@@ -1,10 +1,15 @@
1
1
  /**
2
- * A note refers to a version or a copy instead of naming it, so that a
3
- * label the stemma decides is never written into the prose. A reference
4
- * reads `{{<id>}}`, where the id is the entity's, and is resolved when
5
- * the note is shown.
2
+ * A note refers to an entity instead of naming it, so that a label the
3
+ * stemma decides is never written into the prose. A reference reads
4
+ * `{{<id>}}`, where the id is the entity's, and is resolved when the note
5
+ * is shown.
6
+ *
7
+ * An entity the edition gives no name to, a perforation or an edit, needs
8
+ * the note's own words to stand in the sentence: `{{<id>|die Stanzung bei
9
+ * 7364,7 mm}}`. The name wins where the edition has one, so a siglum
10
+ * still follows the stemma and a written-out label cannot freeze it.
6
11
  */
7
- const reference = /\{\{\s*([^{}\s]+)\s*\}\}/g;
12
+ const reference = /\{\{\s*([^{}|\s]+)\s*(?:\|([^{}]*))?\}\}/g;
8
13
  /** The note in the pieces it is shown in: stretches of text and what they refer to. */
9
14
  export const partsOfNote = (note) => {
10
15
  const parts = [];
@@ -13,7 +18,8 @@ export const partsOfNote = (note) => {
13
18
  const at = match.index ?? 0;
14
19
  if (at > read)
15
20
  parts.push({ type: 'text', text: note.slice(read, at) });
16
- parts.push({ type: 'reference', id: match[1] });
21
+ const label = match[2]?.trim();
22
+ parts.push({ type: 'reference', id: match[1], ...(label && { label }) });
17
23
  read = at + match[0].length;
18
24
  }
19
25
  if (read < note.length)
@@ -24,9 +30,10 @@ export const partsOfNote = (note) => {
24
30
  export const referencesInNote = (note) => partsOfNote(note).flatMap(part => part.type === 'reference' ? [part.id] : []);
25
31
  /**
26
32
  * The note as it reads, with every reference resolved to the name the
27
- * edition gives that entity. A reference nothing answers to keeps its id,
28
- * so that the gap is visible rather than silent.
33
+ * edition gives that entity, or to the words the note puts in its place.
34
+ * A reference nothing answers to keeps its id, so that the gap is visible
35
+ * rather than silent.
29
36
  */
30
37
  export const resolveNote = (note, nameOf) => partsOfNote(note)
31
- .map(part => part.type === 'text' ? part.text : nameOf(part.id) ?? part.id)
38
+ .map(part => part.type === 'text' ? part.text : nameOf(part.id) ?? part.label ?? part.id)
32
39
  .join('');
package/lib/schema.json CHANGED
@@ -932,6 +932,10 @@
932
932
  "type": "object",
933
933
  "ontology": "crminf:I5 Inference Making"
934
934
  },
935
+ "KeeperAssignment": {
936
+ "$ref": "#/definitions/ObjectAssumption%3CAgent%3E",
937
+ "description": "The keeper a copy is held by, as an object assumption, so that the statement can carry the belief it rests on and the reasons for it."
938
+ },
935
939
  "Margins<\"mm\">": {
936
940
  "description": "The margins on the treble and bass sides of the roll, in the unit the scan was measured in.",
937
941
  "properties": {
@@ -1400,6 +1404,60 @@
1400
1404
  ],
1401
1405
  "description": "An object assumption wraps a complex object with an optional annotation. Used for structured values (e.g. persons, conditions) whose properties may be uncertain."
1402
1406
  },
1407
+ "ObjectAssumption<Agent>": {
1408
+ "description": "An object assumption wraps a complex object with an optional annotation. Used for structured values (e.g. persons, conditions) whose properties may be uncertain.",
1409
+ "properties": {
1410
+ "@annotation": {
1411
+ "description": "An optional annotation expressing a belief about this assumption. Uses the JSON-LD-star `@annotation` mechanism to attach epistemic metadata (certainty and reasons) to any triple.",
1412
+ "properties": {
1413
+ "belief": {
1414
+ "$ref": "#/definitions/Belief",
1415
+ "description": "The belief held about the annotated statement.",
1416
+ "ontology": "crminf:J4i is subject of"
1417
+ },
1418
+ "@id": {
1419
+ "description": "A unique identifier for this object.",
1420
+ "type": "string"
1421
+ }
1422
+ },
1423
+ "required": [
1424
+ "belief",
1425
+ "@id"
1426
+ ],
1427
+ "type": "object"
1428
+ },
1429
+ "name": {
1430
+ "description": "The name, e.g. \"Grünfeld, Alfred\", \"Wien\", \"M. Welte & Söhne\".",
1431
+ "type": "string",
1432
+ "ontology": "rdfs:label"
1433
+ },
1434
+ "role": {
1435
+ "$ref": "#/definitions/AgentRole",
1436
+ "description": "The role of the agent in the context of the edition.",
1437
+ "ontology": "crm:P2 has type"
1438
+ },
1439
+ "sameAs": {
1440
+ "description": "Authority records for the same thing: GND, Wikidata, geonames or similar.",
1441
+ "examples": [
1442
+ "https://d-nb.info/gnd/116888652"
1443
+ ],
1444
+ "items": {
1445
+ "type": "string"
1446
+ },
1447
+ "type": "array",
1448
+ "ontology": "owl:sameAs"
1449
+ },
1450
+ "@id": {
1451
+ "description": "A unique identifier for this object.",
1452
+ "type": "string"
1453
+ }
1454
+ },
1455
+ "required": [
1456
+ "name",
1457
+ "sameAs"
1458
+ ],
1459
+ "type": "object"
1460
+ },
1403
1461
  "ObjectAssumption<ConditionState<\"general\">>": {
1404
1462
  "description": "An object assumption wraps a complex object with an optional annotation. Used for structured values (e.g. persons, conditions) whose properties may be uncertain.",
1405
1463
  "properties": {
@@ -2192,8 +2250,8 @@
2192
2250
  "ontology": "crm:P56 bears feature"
2193
2251
  },
2194
2252
  "keeper": {
2195
- "$ref": "#/definitions/Agent",
2196
- "description": "The institution or person holding this copy. Left out where it is not known, as for a copy known only from a recording.",
2253
+ "$ref": "#/definitions/KeeperAssignment",
2254
+ "description": "The institution or person holding this copy. Left out where it is not known, as for a copy known only from a recording. An object assumption, so that a keeper read off a file header or adopted from a letter can say where it comes from. Who held the copy before is not stated here: P50 names the current keeper.",
2197
2255
  "ontology": "crm:P50 has current keeper"
2198
2256
  },
2199
2257
  "measurements": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linked-rolls",
3
- "version": "0.34.0",
3
+ "version": "0.36.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": {