linked-rolls 0.70.0 → 0.72.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.
Files changed (143) hide show
  1. package/README.md +106 -5
  2. package/lib/analysis/constraints.d.ts +7 -0
  3. package/lib/analysis/constraints.js +1 -0
  4. package/lib/analysis/ownPaper.d.ts +5 -1
  5. package/lib/analysis/ownPaper.js +5 -1
  6. package/lib/analysis/paper.d.ts +22 -4
  7. package/lib/analysis/paper.js +6 -0
  8. package/lib/analysis/reservations.d.ts +24 -1
  9. package/lib/analysis/reservations.js +15 -1
  10. package/lib/analysis/sigla.d.ts +6 -1
  11. package/lib/analysis/sigla.js +5 -1
  12. package/lib/analysis/stemma.d.ts +6 -1
  13. package/lib/analysis/stemma.js +6 -1
  14. package/lib/analysis/text.d.ts +16 -2
  15. package/lib/analysis/text.js +16 -2
  16. package/lib/analysis/witnesses.d.ts +20 -1
  17. package/lib/analysis/witnesses.js +4 -0
  18. package/lib/collation/Collation.d.ts +47 -8
  19. package/lib/collation/Collation.js +29 -5
  20. package/lib/collation/alignment.d.ts +16 -3
  21. package/lib/collation/alignment.js +15 -3
  22. package/lib/collation/scatter.d.ts +50 -9
  23. package/lib/collation/scatter.js +11 -1
  24. package/lib/collation/statistics.d.ts +39 -9
  25. package/lib/collation/statistics.js +27 -6
  26. package/lib/collation/substitution.d.ts +5 -0
  27. package/lib/collation/substitution.js +4 -0
  28. package/lib/emulation/Emulation.d.ts +16 -1
  29. package/lib/emulation/Emulation.js +10 -0
  30. package/lib/emulation/negotiation.d.ts +1 -0
  31. package/lib/emulation/negotiation.js +1 -0
  32. package/lib/filiation/adoption.d.ts +47 -0
  33. package/lib/filiation/adoption.js +190 -0
  34. package/lib/filiation/changes.d.ts +33 -0
  35. package/lib/filiation/changes.js +38 -0
  36. package/lib/filiation/index.d.ts +12 -0
  37. package/lib/filiation/index.js +12 -0
  38. package/lib/filiation/presence.d.ts +50 -0
  39. package/lib/filiation/presence.js +122 -0
  40. package/lib/filiation/proposal.d.ts +132 -0
  41. package/lib/filiation/proposal.js +376 -0
  42. package/lib/filiation/readings.d.ts +108 -0
  43. package/lib/filiation/readings.js +281 -0
  44. package/lib/filiation/search.d.ts +113 -0
  45. package/lib/filiation/search.js +268 -0
  46. package/lib/filiation/systems.d.ts +21 -0
  47. package/lib/filiation/systems.js +39 -0
  48. package/lib/filiation/trees.d.ts +20 -0
  49. package/lib/filiation/trees.js +69 -0
  50. package/lib/index.d.ts +34 -2
  51. package/lib/index.js +3 -1
  52. package/lib/io/asJsonLd.d.ts +10 -0
  53. package/lib/io/asJsonLd.js +10 -0
  54. package/lib/io/context.d.ts +16 -2
  55. package/lib/io/context.js +16 -2
  56. package/lib/io/importJsonLd.d.ts +1 -0
  57. package/lib/io/importJsonLd.js +1 -0
  58. package/lib/io/migrate.d.ts +8 -0
  59. package/lib/io/migrate.js +8 -0
  60. package/lib/lookup/lookup.d.ts +29 -5
  61. package/lib/lookup/lookup.js +29 -5
  62. package/lib/lookup/paths.d.ts +23 -3
  63. package/lib/lookup/paths.js +17 -3
  64. package/lib/model/Agent.d.ts +28 -2
  65. package/lib/model/Agent.js +15 -1
  66. package/lib/model/Assumption.d.ts +96 -7
  67. package/lib/model/Assumption.js +65 -7
  68. package/lib/model/ConditionState.d.ts +1 -0
  69. package/lib/model/Edit.d.ts +10 -0
  70. package/lib/model/Edit.js +8 -0
  71. package/lib/model/Edition.d.ts +11 -0
  72. package/lib/model/Edition.js +1 -0
  73. package/lib/model/Feature.d.ts +74 -7
  74. package/lib/model/Feature.js +41 -3
  75. package/lib/model/FeatureSource.d.ts +14 -1
  76. package/lib/model/FeatureSource.js +7 -1
  77. package/lib/model/Perforator.d.ts +10 -0
  78. package/lib/model/Perforator.js +1 -0
  79. package/lib/model/Quantity.d.ts +160 -13
  80. package/lib/model/Quantity.js +110 -6
  81. package/lib/model/RollCopy.d.ts +74 -12
  82. package/lib/model/RollCopy.js +53 -10
  83. package/lib/model/Symbol.d.ts +38 -1
  84. package/lib/model/Symbol.js +16 -0
  85. package/lib/model/TrackCalibration.d.ts +10 -2
  86. package/lib/model/TrackCalibration.js +9 -2
  87. package/lib/model/Version.d.ts +24 -4
  88. package/lib/model/Version.js +19 -4
  89. package/lib/model/notes.d.ts +15 -2
  90. package/lib/model/notes.js +9 -2
  91. package/lib/model/procedures.d.ts +5 -1
  92. package/lib/model/procedures.js +5 -1
  93. package/lib/model/vocabulary.d.ts +6 -1
  94. package/lib/model/vocabulary.js +6 -1
  95. package/lib/ops/beliefs.d.ts +23 -1
  96. package/lib/ops/beliefs.js +23 -1
  97. package/lib/ops/collation.d.ts +3 -0
  98. package/lib/ops/collation.js +3 -0
  99. package/lib/ops/commands.d.ts +17 -2
  100. package/lib/ops/commands.js +17 -2
  101. package/lib/ops/copies.d.ts +37 -6
  102. package/lib/ops/copies.js +37 -6
  103. package/lib/ops/draft.d.ts +2 -0
  104. package/lib/ops/draft.js +1 -0
  105. package/lib/ops/edits.d.ts +5 -1
  106. package/lib/ops/edits.js +5 -1
  107. package/lib/ops/features.d.ts +12 -1
  108. package/lib/ops/features.js +7 -0
  109. package/lib/ops/versions.d.ts +15 -3
  110. package/lib/ops/versions.js +15 -3
  111. package/lib/readers/phillipsEroll.d.ts +12 -1
  112. package/lib/readers/phillipsEroll.js +6 -1
  113. package/lib/readers/spencerBar.d.ts +12 -1
  114. package/lib/readers/spencerBar.js +7 -1
  115. package/lib/readers/stanfordAton.d.ts +15 -0
  116. package/lib/readers/stanfordAton.js +9 -0
  117. package/lib/schema.json +10 -0
  118. package/lib/shared/utils.d.ts +12 -0
  119. package/lib/spec/context.json +4 -0
  120. package/lib/systems/ReproducingSystem.d.ts +46 -3
  121. package/lib/systems/TrackerBar.d.ts +45 -4
  122. package/lib/systems/TrackerBar.js +20 -3
  123. package/lib/systems/index.d.ts +9 -2
  124. package/lib/systems/index.js +9 -2
  125. package/lib/systems/velocity.d.ts +1 -0
  126. package/lib/systems/velocity.js +1 -0
  127. package/lib/systems/welte.d.ts +18 -3
  128. package/lib/systems/welte.js +9 -2
  129. package/lib/systems/welteLicensee/bar.d.ts +1 -0
  130. package/lib/systems/welteLicensee/bar.js +1 -0
  131. package/lib/systems/welteLicensee/system.d.ts +18 -0
  132. package/lib/systems/welteLicensee/system.js +17 -0
  133. package/lib/systems/welteT100/bar.d.ts +8 -0
  134. package/lib/systems/welteT100/bar.js +4 -0
  135. package/lib/systems/welteT100/system.d.ts +46 -5
  136. package/lib/systems/welteT100/system.js +29 -3
  137. package/lib/systems/welteT98/bar.d.ts +6 -0
  138. package/lib/systems/welteT98/bar.js +2 -0
  139. package/lib/systems/welteT98/system.d.ts +58 -5
  140. package/lib/systems/welteT98/system.js +42 -3
  141. package/lib/validate.d.ts +16 -0
  142. package/lib/validate.js +15 -0
  143. package/package.json +2 -1
@@ -2,11 +2,19 @@ import { v4 } from "uuid";
2
2
  import { defaultTrackerBar, trackerBarOf } from "../systems/index.js";
3
3
  import { assignReference, certaintyOf, isAsserted } from "./Assumption.js";
4
4
  import { px, track } from "./Quantity.js";
5
+ /**
6
+ * The kinds of condition a copy may be stated to be in.
7
+ * @category Vocabulary
8
+ */
5
9
  export const rollConditions = [
6
10
  'general',
7
11
  'paper-stretch',
8
12
  'torn'
9
13
  ];
14
+ /**
15
+ * What a modification of a copy may have been for.
16
+ * @category Vocabulary
17
+ */
10
18
  export const modificationPurposes = [
11
19
  'musical-improvement',
12
20
  'technical-improvement',
@@ -16,49 +24,81 @@ export const modificationPurposes = [
16
24
  'dating',
17
25
  'glossing'
18
26
  ];
19
- /** What an act brought onto the copy: what it produced or glued on, a removal nothing. */
27
+ /**
28
+ * What an act brought onto the copy: what it produced or glued on, a removal nothing.
29
+ * @category Lookups
30
+ */
20
31
  export const featuresMadeBy = (modification) => {
21
32
  if (modification.type === 'Alteration')
22
33
  return modification.produced;
23
34
  return modification.type === 'Attachment' ? modification.added : [];
24
35
  };
25
- /** Whether the act is one that modified the copy, rather than the production that punched it. */
36
+ /**
37
+ * Whether the act is one that modified the copy, rather than the production that punched it.
38
+ * @category Lookups
39
+ */
26
40
  export const isModification = (act) => 'type' in act;
27
- /** Whether the act is left stating nothing: it produced, added or removed nothing. */
41
+ /**
42
+ * Whether the act is left stating nothing: it produced, added or removed nothing.
43
+ * @category Lookups
44
+ */
28
45
  export const statesNothing = (modification) => modification.type === 'Removal' ? modification.removed.length === 0 : featuresMadeBy(modification).length === 0;
29
46
  /**
30
47
  * The features of the copy act by act: what the punching produced
31
48
  * first, then what each modification produced or glued on. A feature a
32
49
  * patch bears states no place of its own and is not among them;
33
50
  * `withBorneFeatures` reaches those.
51
+ * @category Lookups
34
52
  */
35
53
  export const featuresByAct = (copy) => [copy.production?.produced ?? [], ...copy.modifications.map(featuresMadeBy)];
36
- /** Every feature the copy states at a place of its own, whichever act made it. */
54
+ /**
55
+ * Every feature the copy states at a place of its own, whichever act made it.
56
+ * @category Lookups
57
+ */
37
58
  export const featuresOf = (copy) => featuresByAct(copy).flat();
38
59
  /** The measurements of a copy the edition exports, each of which can say what took it. */
39
60
  const exportedMeasurementsOf = (copy) => [copy.measurements.dimensions, copy.measurements.holeSeparation, copy.measurements.scanResolution]
40
61
  .filter(value => value !== undefined);
41
- /** The programs the measurements of a copy name as having taken them, each once, as far as they name any. */
62
+ /**
63
+ * The programs the measurements of a copy name as having taken them, each once, as far as they name any.
64
+ * @category Lookups
65
+ */
42
66
  export const measuringSoftwareOf = (copy) => {
43
67
  const named = exportedMeasurementsOf(copy)
44
68
  .flatMap(value => value['@annotation']?.belief.reasons ?? [])
45
69
  .flatMap(reason => reason.type === 'measurement' ? reason.software ?? [] : []);
46
70
  return [...new Map(named.map(software => [`${software.name}\u0000${software.version ?? ''}`, software])).values()];
47
71
  };
48
- /** Whether the condition is the stretch or shrinkage of the paper, as measured on the copy. */
72
+ /**
73
+ * Whether the condition is the stretch or shrinkage of the paper, as measured on the copy.
74
+ * @category Lookups
75
+ */
49
76
  export const isPaperStretch = (condition) => condition.conditionType === 'paper-stretch';
50
- /** What the copy's paper was measured to have done, where anything was measured. */
77
+ /**
78
+ * What the copy's paper was measured to have done, where anything was measured.
79
+ * @category Lookups
80
+ */
51
81
  export const paperStretchOf = (copy) => copy.conditions.find(isPaperStretch);
52
- /** Whether the condition is a tear in the paper. */
82
+ /**
83
+ * Whether the condition is a tear in the paper.
84
+ * @category Lookups
85
+ */
53
86
  export const isTear = (condition) => condition.conditionType === 'torn';
54
- /** The tears the copy is stated to have. */
87
+ /**
88
+ * The tears the copy is stated to have.
89
+ * @category Lookups
90
+ */
55
91
  export const tearsOf = (copy) => copy.conditions.filter(isTear);
56
92
  /**
57
93
  * The bar a copy is read by, which is the one it was cut for. A copy
58
94
  * that names no system falls back to `defaultTrackerBar`.
95
+ * @category Systems and emulation
59
96
  */
60
97
  export const barOf = (copy) => trackerBarOf(copy.production?.system) ?? defaultTrackerBar;
61
- /** The diameter of the punch the copy was cut with, where the edition holds it true or likely. */
98
+ /**
99
+ * The diameter of the punch the copy was cut with, where the edition holds it true or likely.
100
+ * @category Lookups
101
+ */
62
102
  export const punchDiameterOf = (copy) => {
63
103
  const diameter = copy.production?.perforator?.condition?.punchDiameter;
64
104
  return diameter && isAsserted(certaintyOf(diameter)) ? diameter.value : undefined;
@@ -78,6 +118,7 @@ export const punchDiameterOf = (copy) => {
78
118
  * would be 318 notes nobody played. The features stay on the copy,
79
119
  * since they are really on the paper and are his calibration of his own
80
120
  * scan; it is the reading that stops.
121
+ * @category Sources
81
122
  */
82
123
  export function asSymbols(features, bar) {
83
124
  const chains = features.filter(feature => feature.type === 'HoleChain');
@@ -97,6 +138,7 @@ export function asSymbols(features, bar) {
97
138
  * A non-empty result usually means the scan is calibrated wrongly. A chain
98
139
  * lying across several positions is counted against each one the bar
99
140
  * cannot read, and not at all where it reads them all.
141
+ * @category Sources
100
142
  */
101
143
  export function unreadTracks(features, bar) {
102
144
  const counts = new Map();
@@ -116,6 +158,7 @@ export function unreadTracks(features, bar) {
116
158
  * were laid out with, and on the rolls measured so far it comes within
117
159
  * about a quarter of a track. It is kept for copies imported before the
118
160
  * calibration was written down; anything read since carries its own.
161
+ * @internal
119
162
  */
120
163
  export const calibrationOf = (copy) => {
121
164
  if (copy.measurements.trackCalibration) {
@@ -5,6 +5,7 @@ import { WithId } from "../shared/utils.js";
5
5
  * physical features on the roll. Symbols are the result of interpreting
6
6
  * the physical features (chains of holes, writings, etc.) on the roll copies.
7
7
  * @see crm:E90 Symbolic Object
8
+ * @category Format types
8
9
  */
9
10
  export interface Symbol<T extends string> extends WithId {
10
11
  type: T;
@@ -18,7 +19,16 @@ export interface Symbol<T extends string> extends WithId {
18
19
  */
19
20
  carriers: ReferenceAssumption[];
20
21
  }
22
+ /**
23
+ * Whether the object is a symbol: a note, an expression or a text.
24
+ * @category Lookups
25
+ */
21
26
  export declare const isSymbol: (object: any) => object is AnySymbol;
27
+ /**
28
+ * Whether the symbol is a command, a note or an expression, rather than
29
+ * a text.
30
+ * @category Lookups
31
+ */
22
32
  export declare const isCommand: (symbol: object | undefined) => symbol is AnyCommand;
23
33
  /**
24
34
  * A command is what the tracker bar reads from a chain of holes: the
@@ -26,6 +36,7 @@ export declare const isCommand: (symbol: object | undefined) => symbol is AnyCom
26
36
  * by such a chain, but it might also have different physical
27
37
  * appearances.
28
38
  * @see reo:Command
39
+ * @category Format types
29
40
  */
30
41
  export interface Command<T extends string> extends Symbol<T> {
31
42
  /**
@@ -63,10 +74,24 @@ export interface Command<T extends string> extends Symbol<T> {
63
74
  */
64
75
  pairedWith?: ReferenceAssumption;
65
76
  }
77
+ /**
78
+ * The ways a command may be placed relative to another, in the order
79
+ * `placementsOf` reports them.
80
+ * @category Vocabulary
81
+ */
66
82
  export declare const placementRelations: readonly ['alignedWith', 'before', 'after'];
67
- /** The ways a command may be placed relative to another. */
83
+ /**
84
+ * The ways a command may be placed relative to another.
85
+ * @category Format types
86
+ */
68
87
  export type PlacementRelation = typeof placementRelations[number];
88
+ /** @inline */
69
89
  type Placeable = Partial<Record<PlacementRelation, ReferenceAssumption>>;
90
+ /**
91
+ * A statement placing a command relative to another: how, and relative
92
+ * to which.
93
+ * @category Format types
94
+ */
70
95
  export type Placement = {
71
96
  relation: PlacementRelation;
72
97
  reference: ReferenceAssumption;
@@ -75,20 +100,24 @@ export type Placement = {
75
100
  * The statements placing a command relative to others, alignment first.
76
101
  * A command is meant to make one at most; the first is the one a
77
102
  * performance applies.
103
+ * @category Lookups
78
104
  */
79
105
  export declare const placementsOf: (command: Placeable) => Placement[];
106
+ /** @inline */
80
107
  type Pairable = WithId & {
81
108
  pairedWith?: ReferenceAssumption;
82
109
  };
83
110
  /**
84
111
  * The pairs among the given commands, each once and in the order the
85
112
  * pairing is stated. A pair whose partner is absent is left out.
113
+ * @category Lookups
86
114
  */
87
115
  export declare const pairsAmong: <S extends Pairable>(commands: readonly S[]) => [S, S][];
88
116
  /**
89
117
  * A note symbol, representing a single pitched musical event on the roll.
90
118
  * The pitch is encoded via the tracker bar position (track number).
91
119
  * @see reo:Note
120
+ * @category Format types
92
121
  */
93
122
  export interface Note extends Command<'note'> {
94
123
  /**
@@ -101,6 +130,7 @@ export interface Note extends Command<'note'> {
101
130
  * The scope of an expression command, indicating whether it applies to
102
131
  * the bass or treble register of the piano.
103
132
  * @see reo:scope
133
+ * @category Format types
104
134
  */
105
135
  export type ExpressionScope = 'bass' | 'treble';
106
136
  /**
@@ -109,6 +139,7 @@ export type ExpressionScope = 'bass' | 'treble';
109
139
  * than sounding a note. Each expression has a scope (bass or treble)
110
140
  * and a specific expression type.
111
141
  * @see reo:Expression
142
+ * @category Format types
112
143
  */
113
144
  export interface Expression extends Command<'expression'> {
114
145
  /**
@@ -128,6 +159,7 @@ export interface Expression extends Command<'expression'> {
128
159
  /**
129
160
  * A textual symbol, e.g. a label or annotation found on the roll.
130
161
  * @see crm:E33 Linguistic Object
162
+ * @category Format types
131
163
  */
132
164
  export interface Text extends Symbol<'text'> {
133
165
  type: 'text';
@@ -140,7 +172,12 @@ export interface Text extends Symbol<'text'> {
140
172
  /**
141
173
  * A symbol can be either a note, an expression, or a text.
142
174
  * Notes and expressions are commands; texts are carried by writings.
175
+ * @category Format types
143
176
  */
144
177
  export type AnySymbol = Note | Expression | Text;
178
+ /**
179
+ * A command: a note or an expression.
180
+ * @category Format types
181
+ */
145
182
  export type AnyCommand = Note | Expression;
146
183
  export {};
@@ -1,14 +1,29 @@
1
1
  import { idOf } from "./Assumption.js";
2
+ /**
3
+ * Whether the object is a symbol: a note, an expression or a text.
4
+ * @category Lookups
5
+ */
2
6
  export const isSymbol = (object) => {
3
7
  return ('type' in object
4
8
  && (object.type === 'note' || object.type === 'expression' || object.type === 'text'));
5
9
  };
10
+ /**
11
+ * Whether the symbol is a command, a note or an expression, rather than
12
+ * a text.
13
+ * @category Lookups
14
+ */
6
15
  export const isCommand = (symbol) => symbol !== undefined && 'type' in symbol && (symbol.type === 'note' || symbol.type === 'expression');
16
+ /**
17
+ * The ways a command may be placed relative to another, in the order
18
+ * `placementsOf` reports them.
19
+ * @category Vocabulary
20
+ */
7
21
  export const placementRelations = ['alignedWith', 'before', 'after'];
8
22
  /**
9
23
  * The statements placing a command relative to others, alignment first.
10
24
  * A command is meant to make one at most; the first is the one a
11
25
  * performance applies.
26
+ * @category Lookups
12
27
  */
13
28
  export const placementsOf = (command) => placementRelations.flatMap(relation => {
14
29
  const reference = command[relation];
@@ -17,6 +32,7 @@ export const placementsOf = (command) => placementRelations.flatMap(relation =>
17
32
  /**
18
33
  * The pairs among the given commands, each once and in the order the
19
34
  * pairing is stated. A pair whose partner is absent is left out.
35
+ * @category Lookups
20
36
  */
21
37
  export const pairsAmong = (commands) => {
22
38
  const byId = new Map(commands.map(p => [p.id, p]));
@@ -9,6 +9,7 @@ import { Pixels, Track } from "./Quantity.js";
9
9
  *
10
10
  * column = offset + scannerTrack * separation
11
11
  * trackerBar = scannerTrack + shift
12
+ * @category Format types
12
13
  */
13
14
  export interface TrackCalibration {
14
15
  unit: 'px';
@@ -19,13 +20,20 @@ export interface TrackCalibration {
19
20
  /** Added to the scanning software's numbering to reach the tracker bar. */
20
21
  shift: Track;
21
22
  }
22
- /** Image column at the centre of a tracker bar track. */
23
+ /**
24
+ * Image column at the centre of a tracker bar track.
25
+ * @internal
26
+ */
23
27
  export declare const columnOf: (position: Track, calibration: TrackCalibration) => Pixels;
24
- /** Tracker bar track covering an image column, unrounded. */
28
+ /**
29
+ * Tracker bar track covering an image column, unrounded.
30
+ * @internal
31
+ */
25
32
  export declare const trackAt: (column: Pixels, calibration: TrackCalibration) => Track;
26
33
  /**
27
34
  * The columns covered by a run of tracks, from the outer edge of the
28
35
  * first to the outer edge of the last.
36
+ * @internal
29
37
  */
30
38
  export declare const columnsOf: (from: Track, to: Track, calibration: TrackCalibration) => {
31
39
  from: Pixels;
@@ -1,11 +1,18 @@
1
1
  import { px, subtract, track } from "./Quantity.js";
2
- /** Image column at the centre of a tracker bar track. */
2
+ /**
3
+ * Image column at the centre of a tracker bar track.
4
+ * @internal
5
+ */
3
6
  export const columnOf = (position, calibration) => px(calibration.offset + (position - calibration.shift) * calibration.separation);
4
- /** Tracker bar track covering an image column, unrounded. */
7
+ /**
8
+ * Tracker bar track covering an image column, unrounded.
9
+ * @internal
10
+ */
5
11
  export const trackAt = (column, calibration) => track((column - calibration.offset) / calibration.separation + calibration.shift);
6
12
  /**
7
13
  * The columns covered by a run of tracks, from the outer edge of the
8
14
  * first to the outer edge of the last.
15
+ * @internal
9
16
  */
10
17
  export const columnsOf = (from, to, calibration) => {
11
18
  const [lower, upper] = from <= to ? [from, to] : [to, from];
@@ -8,6 +8,7 @@ import { WithId, WithNote, WithType } from "../shared/utils.js";
8
8
  * A motivation provides a reason or rationale for an editorial change.
9
9
  * Motivations are defined at the version level and referenced by edits.
10
10
  * @see crm:E33 Linguistic Object
11
+ * @category Format types
11
12
  */
12
13
  export type Motivation = WithType<'motivation'> & WithId & WithNote;
13
14
  /**
@@ -16,6 +17,7 @@ export type Motivation = WithType<'motivation'> & WithId & WithNote;
16
17
  * put a symbol depends on what they are and on how their features were
17
18
  * obtained, so the tolerance can differ from derivation to derivation.
18
19
  * @see lrmoo:R76 is derivative of
20
+ * @category Format types
19
21
  */
20
22
  export type Derivation = ReferenceAssumption & {
21
23
  /**
@@ -31,13 +33,17 @@ export type Derivation = ReferenceAssumption & {
31
33
  */
32
34
  collationTolerance?: ObjectAssumption<CollationTolerance>;
33
35
  };
34
- /** The tolerance the derivation was collated at, or the default where it states none. */
36
+ /**
37
+ * The tolerance the derivation was collated at, or the default where it states none.
38
+ * @category Collation and alignment
39
+ */
35
40
  export declare const collationToleranceOf: (derivation: Readonly<Derivation>) => CollationTolerance;
36
41
  /**
37
42
  * How long a version's paper runs for a length of the paper of the
38
43
  * version it derives from: about 0.77 for a Licensee or green re-cut of
39
44
  * a red roll, cut for a slower paper speed.
40
45
  * @see crm:E54 Dimension
46
+ * @category Format types
41
47
  */
42
48
  export interface LengthRatio {
43
49
  /**
@@ -60,6 +66,7 @@ export interface LengthRatio {
60
66
  * the version's edits carry it out, so the mechanical part of a
61
67
  * transfer is stated once instead of being spelled out per note.
62
68
  * @see lrmoo:F28 Expression Creation
69
+ * @category Format types
63
70
  */
64
71
  export interface VersionCreation {
65
72
  /**
@@ -100,6 +107,7 @@ export interface VersionCreation {
100
107
  * sigla off the stemma, so that a label never outlives the arrangement
101
108
  * it describes.
102
109
  * @see lrmoo:F2 Expression
110
+ * @category Format types
103
111
  */
104
112
  export interface Version extends WithId {
105
113
  /**
@@ -145,15 +153,25 @@ export interface Version extends WithId {
145
153
  */
146
154
  motivations: Motivation[];
147
155
  }
148
- /** The edits the version states, none where it leaves its text unstated. */
156
+ /**
157
+ * The edits the version states, none where it leaves its text unstated.
158
+ * @category Versions and stemma
159
+ */
149
160
  export declare const editsOf: (version: Readonly<Version>) => Edit[];
150
- /** The symbols the version's edits insert. */
161
+ /**
162
+ * The symbols the version's edits insert.
163
+ * @category Versions and stemma
164
+ */
151
165
  export declare const insertedBy: (version: Readonly<Version>) => AnySymbol[];
152
- /** The ids of the symbols the version's edits delete. */
166
+ /**
167
+ * The ids of the symbols the version's edits delete.
168
+ * @category Versions and stemma
169
+ */
153
170
  export declare const deletedBy: (version: Readonly<Version>) => string[];
154
171
  /**
155
172
  * The parents the version names, in the order of `basedOn`, each with the
156
173
  * certainty its derivation is held with and the belief it rests on.
174
+ * @category Versions and stemma
157
175
  */
158
176
  export declare const derivationsOf: (version: Readonly<Version>) => {
159
177
  parent: string;
@@ -165,6 +183,7 @@ export declare const derivationsOf: (version: Readonly<Version>) => {
165
183
  * held most certain. One held unlikely or false is a rejected hypothesis
166
184
  * and gives no text. Lowering the certainty of the principal derivation
167
185
  * below another's reads the version's edits against another parent.
186
+ * @category Versions and stemma
168
187
  */
169
188
  export declare const principalDerivationOf: (version: Readonly<Version>) => Readonly<Derivation> | undefined;
170
189
  /**
@@ -173,5 +192,6 @@ export declare const principalDerivationOf: (version: Readonly<Version>) => Read
173
192
  * among them: a hypothesis held more certain becomes the principal one.
174
193
  * A version derives from itself in no statement, and a stemma that
175
194
  * loops is walked once round.
195
+ * @category Versions and stemma
176
196
  */
177
197
  export declare const derivesFrom: (versions: readonly Readonly<Version>[], versionId: string, ancestorId: string) => boolean;
@@ -1,16 +1,29 @@
1
1
  import { certainties, certaintyOf, idOf } from "./Assumption.js";
2
2
  import { defaultCollationTolerance } from "../collation/Collation.js";
3
- /** The tolerance the derivation was collated at, or the default where it states none. */
3
+ /**
4
+ * The tolerance the derivation was collated at, or the default where it states none.
5
+ * @category Collation and alignment
6
+ */
4
7
  export const collationToleranceOf = (derivation) => derivation.collationTolerance ?? defaultCollationTolerance;
5
- /** The edits the version states, none where it leaves its text unstated. */
8
+ /**
9
+ * The edits the version states, none where it leaves its text unstated.
10
+ * @category Versions and stemma
11
+ */
6
12
  export const editsOf = (version) => version.edits ?? [];
7
- /** The symbols the version's edits insert. */
13
+ /**
14
+ * The symbols the version's edits insert.
15
+ * @category Versions and stemma
16
+ */
8
17
  export const insertedBy = (version) => editsOf(version).flatMap(edit => edit.insert ?? []);
9
- /** The ids of the symbols the version's edits delete. */
18
+ /**
19
+ * The ids of the symbols the version's edits delete.
20
+ * @category Versions and stemma
21
+ */
10
22
  export const deletedBy = (version) => editsOf(version).flatMap(edit => edit.delete ?? []);
11
23
  /**
12
24
  * The parents the version names, in the order of `basedOn`, each with the
13
25
  * certainty its derivation is held with and the belief it rests on.
26
+ * @category Versions and stemma
14
27
  */
15
28
  export const derivationsOf = (version) => (version.basedOn ?? []).map(derivation => {
16
29
  const belief = derivation['@annotation']?.belief;
@@ -22,6 +35,7 @@ const rankOf = (derivation) => certainties.indexOf(certaintyOf(derivation));
22
35
  * held most certain. One held unlikely or false is a rejected hypothesis
23
36
  * and gives no text. Lowering the certainty of the principal derivation
24
37
  * below another's reads the version's edits against another parent.
38
+ * @category Versions and stemma
25
39
  */
26
40
  export const principalDerivationOf = (version) => (version.basedOn ?? [])
27
41
  .filter(derivation => rankOf(derivation) <= certainties.indexOf('possible'))
@@ -32,6 +46,7 @@ export const principalDerivationOf = (version) => (version.basedOn ?? [])
32
46
  * among them: a hypothesis held more certain becomes the principal one.
33
47
  * A version derives from itself in no statement, and a stemma that
34
48
  * loops is walked once round.
49
+ * @category Versions and stemma
35
50
  */
36
51
  export const derivesFrom = (versions, versionId, ancestorId) => {
37
52
  const byId = new Map(versions.map(version => [version.id, version]));
@@ -1,3 +1,9 @@
1
+ /**
2
+ * A piece of a note as it is shown: a stretch of text, or a reference
3
+ * to an entity by its id, with the words the note puts in its place
4
+ * where it gives any.
5
+ * @category Format types
6
+ */
1
7
  export type NotePart = {
2
8
  type: 'text';
3
9
  text: string;
@@ -6,14 +12,21 @@ export type NotePart = {
6
12
  id: string;
7
13
  label?: string;
8
14
  };
9
- /** The note in the pieces it is shown in: stretches of text and what they refer to. */
15
+ /**
16
+ * The note in the pieces it is shown in: stretches of text and what they refer to.
17
+ * @category Lookups
18
+ */
10
19
  export declare const partsOfNote: (note: string) => NotePart[];
11
- /** The ids a note refers to, in the order it names them. */
20
+ /**
21
+ * The ids a note refers to, in the order it names them.
22
+ * @category Lookups
23
+ */
12
24
  export declare const referencesInNote: (note: string) => string[];
13
25
  /**
14
26
  * The note as it reads, with every reference resolved to the name the
15
27
  * edition gives that entity, or to the words the note puts in its place.
16
28
  * A reference nothing answers to keeps its id, so that the gap is visible
17
29
  * rather than silent.
30
+ * @category Lookups
18
31
  */
19
32
  export declare const resolveNote: (note: string, nameOf: (id: string) => string | undefined) => string;
@@ -10,7 +10,10 @@
10
10
  * still follows the stemma and a written-out label cannot freeze it.
11
11
  */
12
12
  const reference = /\{\{\s*([^{}|\s]+)\s*(?:\|([^{}]*))?\}\}/g;
13
- /** The note in the pieces it is shown in: stretches of text and what they refer to. */
13
+ /**
14
+ * The note in the pieces it is shown in: stretches of text and what they refer to.
15
+ * @category Lookups
16
+ */
14
17
  export const partsOfNote = (note) => {
15
18
  const parts = [];
16
19
  let read = 0;
@@ -26,13 +29,17 @@ export const partsOfNote = (note) => {
26
29
  parts.push({ type: 'text', text: note.slice(read) });
27
30
  return parts;
28
31
  };
29
- /** The ids a note refers to, in the order it names them. */
32
+ /**
33
+ * The ids a note refers to, in the order it names them.
34
+ * @category Lookups
35
+ */
30
36
  export const referencesInNote = (note) => partsOfNote(note).flatMap(part => part.type === 'reference' ? [part.id] : []);
31
37
  /**
32
38
  * The note as it reads, with every reference resolved to the name the
33
39
  * edition gives that entity, or to the words the note puts in its place.
34
40
  * A reference nothing answers to keeps its id, so that the gap is visible
35
41
  * rather than silent.
42
+ * @category Lookups
36
43
  */
37
44
  export const resolveNote = (note, nameOf) => partsOfNote(note)
38
45
  .map(part => part.type === 'text' ? part.text : nameOf(part.id) ?? part.label ?? part.id)
@@ -8,7 +8,11 @@ import { Concept } from "./Agent.js";
8
8
  * `ontology/types.ttl` is the place a procedure is defined. A test holds
9
9
  * this list against it.
10
10
  * @see crm:E29 Design or Procedure
11
+ * @category Vocabulary
11
12
  */
12
13
  export declare const procedures: readonly Concept[];
13
- /** The procedure of that IRI, where the vocabulary declares one. */
14
+ /**
15
+ * The procedure of that IRI, where the vocabulary declares one.
16
+ * @category Vocabulary
17
+ */
14
18
  export declare const procedureOf: (id: string | undefined) => Concept | undefined;
@@ -8,6 +8,7 @@ const PROCEDURE_IRI = 'https://w3id.org/reo/type/procedure/';
8
8
  * `ontology/types.ttl` is the place a procedure is defined. A test holds
9
9
  * this list against it.
10
10
  * @see crm:E29 Design or Procedure
11
+ * @category Vocabulary
11
12
  */
12
13
  export const procedures = [
13
14
  {
@@ -26,5 +27,8 @@ export const procedures = [
26
27
  sameAs: []
27
28
  }
28
29
  ];
29
- /** The procedure of that IRI, where the vocabulary declares one. */
30
+ /**
31
+ * The procedure of that IRI, where the vocabulary declares one.
32
+ * @category Vocabulary
33
+ */
30
34
  export const procedureOf = (id) => procedures.find(procedure => procedure.id === id);
@@ -3,13 +3,18 @@ import { Concept } from "./Agent.js";
3
3
  * The concepts the type vocabulary declares, whatever kind they are:
4
4
  * the reproducing systems, the procedures and the drives of a
5
5
  * perforator. An edition names one of them by its IRI alone.
6
+ * @category Vocabulary
6
7
  */
7
8
  export declare const vocabulary: readonly Concept[];
8
- /** The concept of that IRI, where the vocabulary declares one. */
9
+ /**
10
+ * The concept of that IRI, where the vocabulary declares one.
11
+ * @category Vocabulary
12
+ */
9
13
  export declare const conceptOf: (id: string | undefined) => Concept | undefined;
10
14
  /**
11
15
  * What a concept is called: the name it states, else the one the
12
16
  * vocabulary gives it, else its IRI, so that a reader always has
13
17
  * something to show.
18
+ * @category Vocabulary
14
19
  */
15
20
  export declare const nameOf: (concept: Concept) => string;
@@ -6,17 +6,22 @@ import { trackerBars } from "../systems/index.js";
6
6
  * The concepts the type vocabulary declares, whatever kind they are:
7
7
  * the reproducing systems, the procedures and the drives of a
8
8
  * perforator. An edition names one of them by its IRI alone.
9
+ * @category Vocabulary
9
10
  */
10
11
  export const vocabulary = [
11
12
  ...trackerBars.map(systemOf),
12
13
  ...procedures,
13
14
  ...drives
14
15
  ];
15
- /** The concept of that IRI, where the vocabulary declares one. */
16
+ /**
17
+ * The concept of that IRI, where the vocabulary declares one.
18
+ * @category Vocabulary
19
+ */
16
20
  export const conceptOf = (id) => id === undefined ? undefined : vocabulary.find(concept => concept.id === id);
17
21
  /**
18
22
  * What a concept is called: the name it states, else the one the
19
23
  * vocabulary gives it, else its IRI, so that a reader always has
20
24
  * something to show.
25
+ * @category Vocabulary
21
26
  */
22
27
  export const nameOf = (concept) => concept.name ?? conceptOf(concept.id)?.name ?? concept.id ?? '';
@@ -1,9 +1,31 @@
1
1
  import { Path } from "../lookup/paths.js";
2
2
  import { AnyArgumentation, Certainty } from "../model/Assumption.js";
3
3
  import { EditionOp } from "./draft.js";
4
- /** Annotates the assumption at the path with a belief held true, for reasons to be added. */
4
+ /**
5
+ * Annotates the assumption at the path with a belief held true, for reasons to be added.
6
+ * @category Operations
7
+ */
5
8
  export declare const createBelief: (path: Path) => EditionOp;
9
+ /**
10
+ * Takes the belief off the assumption at the path, which leaves the
11
+ * statement stated plainly.
12
+ * @category Operations
13
+ */
6
14
  export declare const clearBelief: (path: Path) => EditionOp;
15
+ /**
16
+ * Sets the certainty the belief on the assumption at the path is held
17
+ * with.
18
+ * @category Operations
19
+ */
7
20
  export declare const setCertainty: (path: Path, certainty: Certainty) => EditionOp;
21
+ /**
22
+ * Adds a reason to the belief on the assumption at the path.
23
+ * @category Operations
24
+ */
8
25
  export declare const addReason: (path: Path, reason: AnyArgumentation) => EditionOp;
26
+ /**
27
+ * Takes the reason at the index off the belief on the assumption at the
28
+ * path.
29
+ * @category Operations
30
+ */
9
31
  export declare const removeReason: (path: Path, index: number) => EditionOp;