linked-rolls 0.25.1 → 0.27.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/README.md +35 -9
- package/lib/Assumption.d.ts +10 -1
- package/lib/Assumption.js +2 -0
- package/lib/EditionView.d.ts +1 -0
- package/lib/EditionView.js +10 -8
- package/lib/FeatureSource.d.ts +52 -12
- package/lib/FeatureSource.js +11 -8
- package/lib/RollCopy.d.ts +11 -3
- package/lib/Version.d.ts +28 -7
- package/lib/Version.js +17 -2
- package/lib/asJsonLd.js +2 -2
- package/lib/editionOps.d.ts +36 -5
- package/lib/editionOps.js +119 -19
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/migrate.js +22 -2
- package/lib/readers/phillipsEroll.js +1 -2
- package/lib/readers/spencerBar.js +0 -1
- package/lib/readers/stanfordAton.js +0 -1
- package/lib/reservations.d.ts +16 -9
- package/lib/reservations.js +57 -7
- package/lib/schema.json +155 -11
- package/lib/spec/context.json +13 -1
- package/lib/witnesses.d.ts +33 -0
- package/lib/witnesses.js +48 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,28 +43,54 @@ the keeper and the production metadata are nodes with a name and
|
|
|
43
43
|
authority links, and the roll names its reproducing system. Exports
|
|
44
44
|
are always in the current format.
|
|
45
45
|
|
|
46
|
+
## What a version derives from
|
|
47
|
+
|
|
48
|
+
A version names the versions it is held to derive from in `basedOn`,
|
|
49
|
+
each under the belief it rests on. Its text is read against the
|
|
50
|
+
principal derivation, the first of those held most certain, and one
|
|
51
|
+
held unlikely or false never gives the text. The others stand as
|
|
52
|
+
hypotheses, such as a contamination: `stateDerivation` adds one and
|
|
53
|
+
`clearDerivation` takes it back. A version may leave out its `edits`
|
|
54
|
+
where nobody can state them, as for a text that only a recording hints
|
|
55
|
+
at. It then reads as the version it derives from, and
|
|
56
|
+
`reservationsAboutVersion` says so. A file that names a single
|
|
57
|
+
derivation loads as a list of one.
|
|
58
|
+
|
|
46
59
|
## Where a copy's features come from
|
|
47
60
|
|
|
48
61
|
`readFrom` states what a copy's features were read from: the roll
|
|
49
62
|
itself, a `scan` of it, an `analysis` somebody else measured on a
|
|
50
|
-
scan,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
63
|
+
scan, a `reading` of the timed switches of a roll reader, an
|
|
64
|
+
`emulation` in which the roll has already been read into notes and
|
|
65
|
+
commands, or a `recording` of the copy being played on an instrument.
|
|
66
|
+
Beside the kind it holds who carried the capture out, on what device,
|
|
67
|
+
with what software, on which instrument a recorded copy was played,
|
|
68
|
+
when, and a note. What is not known is left out.
|
|
54
69
|
|
|
55
70
|
This says where the numbers of the edition come from and nothing
|
|
56
71
|
about the state of the paper, which is a condition of the copy. In
|
|
57
72
|
RDF it is `reo:capture`, an activity typed by what it read from; the
|
|
58
73
|
file it produced is `crmdig:L11 had output`, the machine it ran on
|
|
59
|
-
`crmdig:L12 happened on device
|
|
74
|
+
`crmdig:L12 happened on device`, the software `crmdig:L23 used
|
|
75
|
+
software or firmware`, the instrument `crm:P16 used specific object`.
|
|
60
76
|
|
|
61
77
|
Nothing records that a copy is doubtful. `reservationsAbout` works
|
|
62
78
|
out from what a copy states what the edition cannot vouch for in it:
|
|
63
79
|
that it names no source, that the making of its source is
|
|
64
|
-
undocumented, that
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
80
|
+
undocumented, that no software or instrument is named for an
|
|
81
|
+
emulation or a recording, that its features are somebody else's
|
|
82
|
+
reading, that its source bears no physical evidence, that no measuring
|
|
83
|
+
software is recorded, that it is not calibrated, that nobody is known
|
|
84
|
+
to hold it. A reservation goes away when the gap it names is filled.
|
|
85
|
+
|
|
86
|
+
A copy nobody can reach, such as one known only from a recording, has
|
|
87
|
+
no features to carry the symbols of a version. It states instead
|
|
88
|
+
which versions it is held to carry, in `carries`, each under a belief
|
|
89
|
+
that says how certainly and why. `witnessesOf` gathers the copies of a
|
|
90
|
+
version, whether their features carry its symbols or they state that
|
|
91
|
+
they carry it, and `carriageProblems` reports a statement made beside
|
|
92
|
+
features that carry symbols already, or one naming a version the
|
|
93
|
+
edition lacks.
|
|
68
94
|
|
|
69
95
|
```ts
|
|
70
96
|
import { reservationsAbout, stateSource } from 'linked-rolls'
|
package/lib/Assumption.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export type Certainty = typeof certainties[number];
|
|
|
13
13
|
* take a doubted statement for the edition's own.
|
|
14
14
|
*/
|
|
15
15
|
export declare const isAsserted: (certainty: Certainty) => boolean;
|
|
16
|
+
/** The certainty a statement is held with. One that carries no belief is stated plainly, and so held true. */
|
|
17
|
+
export declare const certaintyOf: (assumption: Readonly<Assumption>) => Certainty;
|
|
16
18
|
/**
|
|
17
19
|
* An argumentation provides reasons for a belief and
|
|
18
20
|
* may be associated with a person carrying out that argumentation.
|
|
@@ -42,11 +44,18 @@ export interface MeaningComprehension extends Argumentation<'meaningComprehensio
|
|
|
42
44
|
*/
|
|
43
45
|
export interface Inference extends Argumentation<'inference'> {
|
|
44
46
|
/**
|
|
45
|
-
* References (by `@id`) to the beliefs
|
|
47
|
+
* References (by `@id`) to the beliefs
|
|
46
48
|
* from which the conclusion is drawn.
|
|
47
49
|
* @see crminf:J1 used as premise
|
|
48
50
|
*/
|
|
49
51
|
premises: string[];
|
|
52
|
+
/**
|
|
53
|
+
* References (by `@id`) to what the inference worked on besides
|
|
54
|
+
* beliefs, such as the versions it compared or the analysis output
|
|
55
|
+
* it cites.
|
|
56
|
+
* @see crm:P16 used specific object
|
|
57
|
+
*/
|
|
58
|
+
used?: string[];
|
|
50
59
|
}
|
|
51
60
|
/**
|
|
52
61
|
* A belief adoption adopts someone else's belief. This type is used
|
package/lib/Assumption.js
CHANGED
|
@@ -12,6 +12,8 @@ export const certainties = [
|
|
|
12
12
|
* take a doubted statement for the edition's own.
|
|
13
13
|
*/
|
|
14
14
|
export const isAsserted = (certainty) => certainty === 'true' || certainty === 'likely';
|
|
15
|
+
/** The certainty a statement is held with. One that carries no belief is stated plainly, and so held true. */
|
|
16
|
+
export const certaintyOf = (assumption) => assumption['@annotation']?.belief.certainty ?? 'true';
|
|
15
17
|
export function valueOf(assumption) {
|
|
16
18
|
return assumption['@value'];
|
|
17
19
|
}
|
package/lib/EditionView.d.ts
CHANGED
|
@@ -60,6 +60,7 @@ export declare class EditionView {
|
|
|
60
60
|
speedScalesIn(version: Readonly<Version>): number[];
|
|
61
61
|
/** The copies of the version's own system that carry any of its symbols. */
|
|
62
62
|
copiesOwning(version: Readonly<Version>): Readonly<RollCopy>[];
|
|
63
|
+
/** The version the given one's text is read against, by its principal derivation. */
|
|
63
64
|
predecessorOf(versionId: string): Readonly<Version> | undefined;
|
|
64
65
|
/**
|
|
65
66
|
* Where along the roll the symbol lies, as its carriers put it, or
|
package/lib/EditionView.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { withBorneFeatures } from "./Feature";
|
|
2
|
-
import { deletedBy, insertedBy } from "./Version";
|
|
2
|
+
import { deletedBy, insertedBy, principalDerivationOf } from "./Version";
|
|
3
3
|
import { systemIdOf } from "./TrackerBar";
|
|
4
4
|
import { isPaperStretch } from "./RollCopy";
|
|
5
5
|
import { idOf, idsOf } from "./Assumption";
|
|
@@ -14,7 +14,7 @@ export const getAt = (path, obj) => {
|
|
|
14
14
|
return node;
|
|
15
15
|
};
|
|
16
16
|
/** Keys under which an object names others by id, singly or in a list. */
|
|
17
|
-
const referenceKeys = ['delete', 'comprehends', 'motivation'];
|
|
17
|
+
const referenceKeys = ['delete', 'comprehends', 'motivation', 'premises', 'used'];
|
|
18
18
|
const isObject = (v) => v !== null && typeof v === "object";
|
|
19
19
|
/** What a reference may state besides the id: a belief about it, and the tolerance a derivation was collated at. */
|
|
20
20
|
const referenceOwnKeys = new Set(['id', '@annotation', 'collationTolerance']);
|
|
@@ -138,8 +138,9 @@ export class EditionView {
|
|
|
138
138
|
if (!v)
|
|
139
139
|
return;
|
|
140
140
|
callback(v);
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
const principal = principalDerivationOf(v);
|
|
142
|
+
if (principal) {
|
|
143
|
+
this.travelUp(idOf(principal), callback);
|
|
143
144
|
}
|
|
144
145
|
}
|
|
145
146
|
/** The version and its ancestors, from the version up to the root. */
|
|
@@ -200,11 +201,11 @@ export class EditionView {
|
|
|
200
201
|
}));
|
|
201
202
|
return this.edition.copies.filter(copy => carrying.has(copy.id) && systemIdOf(copy.production?.system) === system);
|
|
202
203
|
}
|
|
204
|
+
/** The version the given one's text is read against, by its principal derivation. */
|
|
203
205
|
predecessorOf(versionId) {
|
|
204
206
|
const v = this.get(versionId);
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
return this.get(idOf(v.basedOn));
|
|
207
|
+
const principal = v && principalDerivationOf(v);
|
|
208
|
+
return principal && this.get(idOf(principal));
|
|
208
209
|
}
|
|
209
210
|
/**
|
|
210
211
|
* Where along the roll the symbol lies, as its carriers put it, or
|
|
@@ -271,7 +272,8 @@ export class EditionView {
|
|
|
271
272
|
}
|
|
272
273
|
inStack.add(id);
|
|
273
274
|
let gen;
|
|
274
|
-
const
|
|
275
|
+
const principal = principalDerivationOf(node);
|
|
276
|
+
const basedOn = principal && idOf(principal);
|
|
275
277
|
if (basedOn === undefined) {
|
|
276
278
|
gen = 0; // root
|
|
277
279
|
}
|
package/lib/FeatureSource.d.ts
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import { ActorAssignment, DateAssignment } from "./Assumption";
|
|
2
|
-
import { Concept } from "./Agent";
|
|
1
|
+
import { ActorAssignment, DateAssignment, ObjectAssumption } from "./Assumption";
|
|
2
|
+
import { Concept, Named } from "./Agent";
|
|
3
|
+
import { ConditionState } from "./ConditionState";
|
|
3
4
|
import { WithNote } from "./utils";
|
|
4
5
|
/**
|
|
5
6
|
* What a copy's features were read from. The kinds run from the paper
|
|
6
|
-
* itself
|
|
7
|
-
* and commands.
|
|
7
|
+
* itself, through files in which the roll has already been read into
|
|
8
|
+
* notes and commands, to a sound recording of the copy being played.
|
|
8
9
|
*/
|
|
9
|
-
export declare const sourceKinds: readonly ['roll', 'scan', 'analysis', 'emulation', 'recording'];
|
|
10
|
+
export declare const sourceKinds: readonly ['roll', 'scan', 'analysis', 'reading', 'emulation', 'recording'];
|
|
10
11
|
export type SourceKind = typeof sourceKinds[number];
|
|
11
12
|
/** How each kind of source is referred to in prose. */
|
|
12
13
|
export declare const sourceLabels: Record<SourceKind, string>;
|
|
13
14
|
/**
|
|
14
|
-
* Whether a source of this kind gives positions that were measured.
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* Whether a source of this kind gives positions that were measured. A
|
|
16
|
+
* roll reader measures when each perforation passes its bar. An
|
|
17
|
+
* emulation and a recording give the reading somebody else made: the
|
|
18
|
+
* roll has been turned into notes and commands already, and turning
|
|
19
|
+
* those back into holes reconstructs them.
|
|
18
20
|
*/
|
|
19
21
|
export declare const isMeasured: (kind: SourceKind) => boolean;
|
|
20
22
|
/**
|
|
@@ -23,11 +25,38 @@ export declare const isMeasured: (kind: SourceKind) => boolean;
|
|
|
23
25
|
* be observed on the roll and on an image of it, and on nothing else.
|
|
24
26
|
*/
|
|
25
27
|
export declare const bearsPhysicalEvidence: (kind: SourceKind) => boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Software a capture ran, such as the transcriber that read a recording
|
|
30
|
+
* into notes or the emulator that wrote a MIDI file.
|
|
31
|
+
* @see crmdig:D14 Software
|
|
32
|
+
*/
|
|
33
|
+
export interface Software {
|
|
34
|
+
/**
|
|
35
|
+
* @see rdfs:label
|
|
36
|
+
*/
|
|
37
|
+
name: string;
|
|
38
|
+
/**
|
|
39
|
+
* The release, or the model checkpoint of a transcriber.
|
|
40
|
+
* @see owl:versionInfo
|
|
41
|
+
*/
|
|
42
|
+
version?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* An instrument a copy was played on to be recorded. How it was
|
|
46
|
+
* regulated, where that is known, is its condition.
|
|
47
|
+
* @see crm:E22 Human-Made Object
|
|
48
|
+
*/
|
|
49
|
+
export interface Instrument extends Named {
|
|
50
|
+
/**
|
|
51
|
+
* @see crm:P44 has condition
|
|
52
|
+
*/
|
|
53
|
+
condition?: ObjectAssumption<ConditionState<'general'>>;
|
|
54
|
+
}
|
|
26
55
|
/**
|
|
27
56
|
* The capture by which a copy's features became data: what they were
|
|
28
|
-
* read from, who read them, on what device
|
|
29
|
-
* the numbers of the edition come from and says
|
|
30
|
-
* state of the paper, which is a condition.
|
|
57
|
+
* read from, who read them, on what device, with what software and
|
|
58
|
+
* when. It states where the numbers of the edition come from and says
|
|
59
|
+
* nothing about the state of the paper, which is a condition.
|
|
31
60
|
*
|
|
32
61
|
* What is not known is left out. A reader is told about the gap by
|
|
33
62
|
* `reservationsAbout`, which works out what a copy cannot vouch for
|
|
@@ -56,6 +85,17 @@ export interface FeatureSource extends WithNote {
|
|
|
56
85
|
* @see crmdig:L12 happened on device
|
|
57
86
|
*/
|
|
58
87
|
device?: Concept;
|
|
88
|
+
/**
|
|
89
|
+
* The software the capture ran, each with its version.
|
|
90
|
+
* @see crmdig:L23 used software or firmware
|
|
91
|
+
*/
|
|
92
|
+
software?: Software[];
|
|
93
|
+
/**
|
|
94
|
+
* The instrument the copy was played on, where the capture is a
|
|
95
|
+
* recording of it.
|
|
96
|
+
* @see crm:P16 used specific object
|
|
97
|
+
*/
|
|
98
|
+
instrument?: ObjectAssumption<Instrument>;
|
|
59
99
|
/**
|
|
60
100
|
* When the capture took place.
|
|
61
101
|
* @format date
|
package/lib/FeatureSource.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* What a copy's features were read from. The kinds run from the paper
|
|
3
|
-
* itself
|
|
4
|
-
* and commands.
|
|
3
|
+
* itself, through files in which the roll has already been read into
|
|
4
|
+
* notes and commands, to a sound recording of the copy being played.
|
|
5
5
|
*/
|
|
6
6
|
export const sourceKinds = [
|
|
7
7
|
'roll',
|
|
8
8
|
'scan',
|
|
9
9
|
'analysis',
|
|
10
|
+
'reading',
|
|
10
11
|
'emulation',
|
|
11
12
|
'recording'
|
|
12
13
|
];
|
|
@@ -15,16 +16,18 @@ export const sourceLabels = {
|
|
|
15
16
|
roll: 'the roll itself',
|
|
16
17
|
scan: 'a scan of the roll',
|
|
17
18
|
analysis: 'a hole analysis of a scan',
|
|
19
|
+
reading: 'the timed switches of a roll reader',
|
|
18
20
|
emulation: 'an emulated MIDI file',
|
|
19
|
-
recording: 'a
|
|
21
|
+
recording: 'a sound recording of the copy being played'
|
|
20
22
|
};
|
|
21
|
-
const measured = ['roll', 'scan', 'analysis'];
|
|
23
|
+
const measured = ['roll', 'scan', 'analysis', 'reading'];
|
|
22
24
|
const physical = ['roll', 'scan'];
|
|
23
25
|
/**
|
|
24
|
-
* Whether a source of this kind gives positions that were measured.
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
26
|
+
* Whether a source of this kind gives positions that were measured. A
|
|
27
|
+
* roll reader measures when each perforation passes its bar. An
|
|
28
|
+
* emulation and a recording give the reading somebody else made: the
|
|
29
|
+
* roll has been turned into notes and commands already, and turning
|
|
30
|
+
* those back into holes reconstructs them.
|
|
28
31
|
*/
|
|
29
32
|
export const isMeasured = (kind) => measured.includes(kind);
|
|
30
33
|
/**
|
package/lib/RollCopy.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { AnySymbol } from "./Symbol";
|
|
|
3
3
|
import { TrackerBar } from "./TrackerBar";
|
|
4
4
|
import { TrackCalibration } from "./TrackCalibration";
|
|
5
5
|
import { AnyFeature } from "./Feature";
|
|
6
|
-
import { ActorAssignment, DateAssignment, ObjectAssumption } from "./Assumption";
|
|
6
|
+
import { ActorAssignment, DateAssignment, ObjectAssumption, ReferenceAssumption } from "./Assumption";
|
|
7
7
|
import { WithId, WithType } from "./utils";
|
|
8
8
|
import { Agent, Concept } from "./Agent";
|
|
9
9
|
import { FeatureSource } from "./FeatureSource";
|
|
@@ -274,10 +274,11 @@ export interface RollCopy extends WithType<'RollCopy'>, WithId {
|
|
|
274
274
|
*/
|
|
275
275
|
conditions: RollConditionAssignment[];
|
|
276
276
|
/**
|
|
277
|
-
* The institution or person holding this copy.
|
|
277
|
+
* The institution or person holding this copy. Left out where it is
|
|
278
|
+
* not known, as for a copy known only from a recording.
|
|
278
279
|
* @see crm:P50 has current keeper
|
|
279
280
|
*/
|
|
280
|
-
keeper
|
|
281
|
+
keeper?: Agent;
|
|
281
282
|
/**
|
|
282
283
|
* The physical features found on this copy, with shift
|
|
283
284
|
* and stretch already applied when `ops` says so.
|
|
@@ -300,6 +301,13 @@ export interface RollCopy extends WithType<'RollCopy'>, WithId {
|
|
|
300
301
|
* @see reo:capture
|
|
301
302
|
*/
|
|
302
303
|
readFrom?: FeatureSource;
|
|
304
|
+
/**
|
|
305
|
+
* The versions this copy is held to carry, where its features are not
|
|
306
|
+
* read into symbols, as for a copy known only from a recording. Each
|
|
307
|
+
* statement carries the belief it rests on.
|
|
308
|
+
* @see crm:P128 carries
|
|
309
|
+
*/
|
|
310
|
+
carries?: ReferenceAssumption[];
|
|
303
311
|
}
|
|
304
312
|
/**
|
|
305
313
|
* Whether the condition is the stretch or shrinkage of the paper. A
|
package/lib/Version.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Edit } from "./Edit";
|
|
2
2
|
import { Concept } from "./Agent";
|
|
3
|
-
import { ActorAssignment, DateAssignment, ReferenceAssumption } from "./Assumption";
|
|
3
|
+
import { ActorAssignment, Certainty, DateAssignment, ReferenceAssumption } from "./Assumption";
|
|
4
4
|
import { CollationTolerance } from "./Collation";
|
|
5
5
|
import { AnySymbol } from "./Symbol";
|
|
6
6
|
import { WithId, WithNote, WithType } from "./utils";
|
|
@@ -98,15 +98,20 @@ export interface Version extends WithId, WithType<'Version'> {
|
|
|
98
98
|
system: Concept;
|
|
99
99
|
/**
|
|
100
100
|
* Whether the version served as a master for reproductions
|
|
101
|
-
* or exists on one copy only.
|
|
101
|
+
* or exists on one copy only. Left out where that is not known,
|
|
102
|
+
* as for a version only a secondary witness hints at.
|
|
102
103
|
* @see crm:P2 has type
|
|
103
104
|
*/
|
|
104
|
-
versionType
|
|
105
|
+
versionType?: VersionType;
|
|
105
106
|
/**
|
|
106
|
-
*
|
|
107
|
+
* The versions this one is held to derive from, each under the
|
|
108
|
+
* belief it rests on. The text is read against the principal one
|
|
109
|
+
* (`principalDerivationOf`); the others stand as hypotheses, such as
|
|
110
|
+
* a contamination. A version that names none represents the mother
|
|
111
|
+
* roll.
|
|
107
112
|
* @see lrmoo:R76 is derivative of
|
|
108
113
|
*/
|
|
109
|
-
basedOn?: Derivation;
|
|
114
|
+
basedOn?: Derivation[];
|
|
110
115
|
/**
|
|
111
116
|
* The act that made this version, where it is known: who carried it
|
|
112
117
|
* out, when, and by what rule.
|
|
@@ -114,16 +119,32 @@ export interface Version extends WithId, WithType<'Version'> {
|
|
|
114
119
|
*/
|
|
115
120
|
creation?: VersionCreation;
|
|
116
121
|
/**
|
|
117
|
-
* The list of edits that, applied to the base version, produce this
|
|
122
|
+
* The list of edits that, applied to the base version, produce this
|
|
123
|
+
* version. A hypothetical version whose changes nobody can state
|
|
124
|
+
* leaves it out; it then reads as the version it derives from.
|
|
118
125
|
* @see reo:involvedEdit
|
|
119
126
|
*/
|
|
120
|
-
edits
|
|
127
|
+
edits?: Edit[];
|
|
121
128
|
/**
|
|
122
129
|
* A collection of motivations used in this version's edits.
|
|
123
130
|
*/
|
|
124
131
|
motivations: Motivation[];
|
|
125
132
|
}
|
|
133
|
+
/** The edits the version states, none where it leaves its text unstated. */
|
|
134
|
+
export declare const editsOf: (version: Readonly<Version>) => Edit[];
|
|
126
135
|
/** The symbols the version's edits insert. */
|
|
127
136
|
export declare const insertedBy: (version: Readonly<Version>) => AnySymbol[];
|
|
128
137
|
/** The ids of the symbols the version's edits delete. */
|
|
129
138
|
export declare const deletedBy: (version: Readonly<Version>) => string[];
|
|
139
|
+
/** The parents the version names, each with the certainty its derivation is held with. */
|
|
140
|
+
export declare const derivationsOf: (version: Readonly<Version>) => {
|
|
141
|
+
parent: string;
|
|
142
|
+
certainty: Certainty;
|
|
143
|
+
}[];
|
|
144
|
+
/**
|
|
145
|
+
* The derivation the version's text is read against: the first of those
|
|
146
|
+
* held most certain. One held unlikely or false is a rejected hypothesis
|
|
147
|
+
* and gives no text. Lowering the certainty of the principal derivation
|
|
148
|
+
* below another's reads the version's edits against another parent.
|
|
149
|
+
*/
|
|
150
|
+
export declare const principalDerivationOf: (version: Readonly<Version>) => Readonly<Derivation> | undefined;
|
package/lib/Version.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { certainties, certaintyOf, idOf } from "./Assumption";
|
|
1
2
|
import { defaultCollationTolerance } from "./Collation";
|
|
2
3
|
export const versionTypes = [
|
|
3
4
|
/**
|
|
@@ -12,7 +13,21 @@ export const versionTypes = [
|
|
|
12
13
|
];
|
|
13
14
|
/** The tolerance the derivation was collated at, or the default where it states none. */
|
|
14
15
|
export const collationToleranceOf = (derivation) => derivation.collationTolerance ?? defaultCollationTolerance;
|
|
16
|
+
/** The edits the version states, none where it leaves its text unstated. */
|
|
17
|
+
export const editsOf = (version) => version.edits ?? [];
|
|
15
18
|
/** The symbols the version's edits insert. */
|
|
16
|
-
export const insertedBy = (version) => version.
|
|
19
|
+
export const insertedBy = (version) => editsOf(version).flatMap(edit => edit.insert ?? []);
|
|
17
20
|
/** The ids of the symbols the version's edits delete. */
|
|
18
|
-
export const deletedBy = (version) => version.
|
|
21
|
+
export const deletedBy = (version) => editsOf(version).flatMap(edit => edit.delete ?? []);
|
|
22
|
+
/** The parents the version names, each with the certainty its derivation is held with. */
|
|
23
|
+
export const derivationsOf = (version) => (version.basedOn ?? []).map(derivation => ({ parent: idOf(derivation), certainty: certaintyOf(derivation) }));
|
|
24
|
+
const rankOf = (derivation) => certainties.indexOf(certaintyOf(derivation));
|
|
25
|
+
/**
|
|
26
|
+
* The derivation the version's text is read against: the first of those
|
|
27
|
+
* held most certain. One held unlikely or false is a rejected hypothesis
|
|
28
|
+
* and gives no text. Lowering the certainty of the principal derivation
|
|
29
|
+
* below another's reads the version's edits against another parent.
|
|
30
|
+
*/
|
|
31
|
+
export const principalDerivationOf = (version) => (version.basedOn ?? [])
|
|
32
|
+
.filter(derivation => rankOf(derivation) <= certainties.indexOf('possible'))
|
|
33
|
+
.reduce((principal, derivation) => principal === undefined || rankOf(derivation) < rankOf(principal) ? derivation : principal, undefined);
|
package/lib/asJsonLd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { systemIdIn } from "./TrackerBar";
|
|
2
|
-
import { isAsserted } from "./Assumption";
|
|
2
|
+
import { certaintyOf, isAsserted } from "./Assumption";
|
|
3
3
|
import context from "./spec/context.json";
|
|
4
4
|
export const exportDate = (date) => {
|
|
5
5
|
const year = date.getFullYear();
|
|
@@ -76,7 +76,7 @@ const silentTerms = new Set(Object.entries(context['@context'])
|
|
|
76
76
|
const isDoubtedReference = (value) => isRecord(value)
|
|
77
77
|
&& typeof value['@id'] === 'string'
|
|
78
78
|
&& isRecord(value['@annotation'])
|
|
79
|
-
&& !isAsserted(value
|
|
79
|
+
&& !isAsserted(certaintyOf(value))
|
|
80
80
|
&& Object.keys(value).every(key => key === '@id' || key === '@annotation' || silentTerms.has(key));
|
|
81
81
|
/**
|
|
82
82
|
* The statement a doubted reference makes, as a JSON-LD-star embedded
|
package/lib/editionOps.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { CollationTolerance } from "./Collation";
|
|
|
6
6
|
import { Edit } from "./Edit";
|
|
7
7
|
import { GeneralRollCondition, RollCopy, ScaleReading, Shift } from "./RollCopy";
|
|
8
8
|
import { FeatureSource } from "./FeatureSource";
|
|
9
|
-
import { AnyArgumentation, Certainty, ObjectAssumption } from "./Assumption";
|
|
9
|
+
import { AnyArgumentation, Belief, Certainty, ObjectAssumption } from "./Assumption";
|
|
10
10
|
import { AnyFeature, FeatureConditionAssignment } from "./Feature";
|
|
11
11
|
/**
|
|
12
12
|
* A change to an edition, written onto an immer draft of it. One
|
|
@@ -22,6 +22,12 @@ export type EditionOp = (draft: Draft<Edition>) => void;
|
|
|
22
22
|
* system the copy was cut for.
|
|
23
23
|
*/
|
|
24
24
|
export declare const createVersion: (siglum: string, copy: RollCopy) => EditionOp;
|
|
25
|
+
/**
|
|
26
|
+
* Puts the copy into the edition without a version of its own, as for a
|
|
27
|
+
* copy whose features are not read into symbols: one known only from a
|
|
28
|
+
* recording states instead which versions it carries.
|
|
29
|
+
*/
|
|
30
|
+
export declare const addCopy: (copy: RollCopy) => EditionOp;
|
|
25
31
|
/**
|
|
26
32
|
* Shifts and then scales the copy's features into line with another
|
|
27
33
|
* copy's, and puts the scale down to what the reading says: the paper,
|
|
@@ -38,6 +44,16 @@ export declare const unalignCopy: (copyId: string) => EditionOp;
|
|
|
38
44
|
export declare const stateSource: (copyId: string, source: FeatureSource) => EditionOp;
|
|
39
45
|
/** Takes back the statement, leaving the copy silent about its source again. */
|
|
40
46
|
export declare const clearSource: (copyId: string) => EditionOp;
|
|
47
|
+
/**
|
|
48
|
+
* States that the copy carries the version, under the belief given. It
|
|
49
|
+
* is meant for a copy whose features are not read into symbols, such as
|
|
50
|
+
* one known only from a recording, and `carriageProblems` reports it
|
|
51
|
+
* where features carry symbols already. A second statement about one
|
|
52
|
+
* version is none.
|
|
53
|
+
*/
|
|
54
|
+
export declare const stateCarriage: (copyId: string, versionId: string, belief?: Belief) => EditionOp;
|
|
55
|
+
/** Takes back the copy's statement that it carries the version. */
|
|
56
|
+
export declare const clearCarriage: (copyId: string, versionId: string) => EditionOp;
|
|
41
57
|
/**
|
|
42
58
|
* Adds a general condition to the copy, beside whatever is stated of it
|
|
43
59
|
* already. The other condition a copy may be in, a paper stretch, is
|
|
@@ -99,7 +115,8 @@ export declare const mergeFeatures: (copyId: string, featureIds: readonly string
|
|
|
99
115
|
* with one the parent hands down adds its carriers to that symbol; the
|
|
100
116
|
* rest become the child's insertions, and what the parent hands down
|
|
101
117
|
* and the child lacks becomes its deletions. The derivation states the
|
|
102
|
-
* tolerance it was collated at
|
|
118
|
+
* tolerance it was collated at and becomes the principal one; the
|
|
119
|
+
* hypotheses the child stated beside its former one stay.
|
|
103
120
|
*/
|
|
104
121
|
export declare const connectVersions: (view: EditionView, childId: string, parentId: string, tolerance?: CollationTolerance) => EditionOp;
|
|
105
122
|
/**
|
|
@@ -110,16 +127,30 @@ export declare const connectVersions: (view: EditionView, childId: string, paren
|
|
|
110
127
|
export declare const collateSymbols: (view: EditionView, versionId: string, symbolIds: readonly string[], tolerance?: CollationTolerance) => EditionOp;
|
|
111
128
|
/**
|
|
112
129
|
* Makes the version stand on its own: what it inherited becomes its
|
|
113
|
-
* own insertions, and
|
|
114
|
-
* with the motivations that belonged to
|
|
130
|
+
* own insertions, and its derivations go, the hypotheses among them,
|
|
131
|
+
* with the motivations that belonged to them.
|
|
115
132
|
*/
|
|
116
133
|
export declare const detachVersion: (view: EditionView, versionId: string) => EditionOp;
|
|
117
|
-
/**
|
|
134
|
+
/**
|
|
135
|
+
* Takes the version out. Whatever read its text against it comes to
|
|
136
|
+
* stand on its own, a hypothesis that something derives from it goes,
|
|
137
|
+
* and so does a copy's statement that it carries the version.
|
|
138
|
+
*/
|
|
118
139
|
export declare const removeVersion: (view: EditionView, versionId: string) => EditionOp;
|
|
119
140
|
/** Takes the symbols out of the version's own insertions, and the edits that had nothing else. */
|
|
120
141
|
export declare const removeSymbols: (versionId: string, symbolIds: readonly string[]) => EditionOp;
|
|
121
142
|
/** Moves the edits into a new version based on this one. */
|
|
122
143
|
export declare const deriveVersion: (versionId: string, editIds: readonly string[]) => EditionOp;
|
|
144
|
+
/**
|
|
145
|
+
* States that the version may also derive from the parent, beside what
|
|
146
|
+
* it derives from already: a hypothesis, such as a contamination, under
|
|
147
|
+
* the belief given. The text stays read against the principal derivation
|
|
148
|
+
* unless the belief holds this one more certain. A version derives from
|
|
149
|
+
* itself, or twice from one parent, in no statement.
|
|
150
|
+
*/
|
|
151
|
+
export declare const stateDerivation: (versionId: string, parentId: string, belief?: Belief) => EditionOp;
|
|
152
|
+
/** Takes back the hypothesis that the version derives from the parent; the principal derivation goes with `detachVersion`. */
|
|
153
|
+
export declare const clearDerivation: (versionId: string, parentId: string) => EditionOp;
|
|
123
154
|
/**
|
|
124
155
|
* Replaces the edits with a single one carrying all their insertions
|
|
125
156
|
* and deletions, classified by a guess at what the exchange does.
|