linked-rolls 0.67.0 → 0.69.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.
@@ -10,6 +10,11 @@ export declare const placedCarriersOf: (edition: Pick<Edition, 'copies'>, symbol
10
10
  * Where along the roll the symbol lies, as its carriers put it, or
11
11
  * nothing for a symbol no copy carries.
12
12
  *
13
+ * Either end is the median of the carriers' rather than their mean, so
14
+ * that a copy which puts the symbol well away from the rest, torn,
15
+ * stretched or badly aligned there, does not draw it away from where
16
+ * the others agree it lies. Two carriers have the two alike.
17
+ *
13
18
  * Only the place is measured. Which track the symbol sits on is not
14
19
  * a measurement but a question for a tracker bar, since a note of
15
20
  * one pitch sits on exactly one position of a given bar: ask
@@ -20,7 +25,7 @@ export declare const placedCarriersOf: (edition: Pick<Edition, 'copies'>, symbol
20
25
  * position a semitone away on either bar.
21
26
  */
22
27
  export declare const placeOf: (edition: Pick<Edition, 'copies'>, symbol: AnySymbol) => Readonly<HorizontalSpan> | undefined;
23
- /** Where the symbol begins, as the mean onset of its carriers, or nothing for a symbol without a place. */
28
+ /** Where the symbol begins, as the median onset of its carriers, or nothing for a symbol without a place. */
24
29
  export declare const onsetOf: (edition: Pick<Edition, 'copies'>, symbol: AnySymbol) => Millimeters | undefined;
25
30
  /**
26
31
  * The symbols the version shows: what it and its ancestors insert,
@@ -1,7 +1,7 @@
1
1
  import { isPlaced } from "../model/Feature.js";
2
2
  import { deletedBy, insertedBy } from "../model/Version.js";
3
3
  import { idsOf } from "../model/Assumption.js";
4
- import { mean } from "../model/Quantity.js";
4
+ import { medianOf } from "../collation/statistics.js";
5
5
  import { featuresIn } from "../lookup/lookup.js";
6
6
  import { perState } from "../lookup/perState.js";
7
7
  import { lineageOf } from "./stemma.js";
@@ -12,6 +12,11 @@ export const placedCarriersOf = (edition, symbol) => carriersOf(edition, symbol)
12
12
  * Where along the roll the symbol lies, as its carriers put it, or
13
13
  * nothing for a symbol no copy carries.
14
14
  *
15
+ * Either end is the median of the carriers' rather than their mean, so
16
+ * that a copy which puts the symbol well away from the rest, torn,
17
+ * stretched or badly aligned there, does not draw it away from where
18
+ * the others agree it lies. Two carriers have the two alike.
19
+ *
15
20
  * Only the place is measured. Which track the symbol sits on is not
16
21
  * a measurement but a question for a tracker bar, since a note of
17
22
  * one pitch sits on exactly one position of a given bar: ask
@@ -23,15 +28,13 @@ export const placedCarriersOf = (edition, symbol) => carriersOf(edition, symbol)
23
28
  */
24
29
  export const placeOf = (edition, symbol) => {
25
30
  const carriers = placedCarriersOf(edition, symbol);
26
- if (carriers.length === 0)
31
+ const from = medianOf(carriers.map(carrier => carrier.horizontal.from));
32
+ const to = medianOf(carriers.map(carrier => carrier.horizontal.to));
33
+ if (from === undefined || to === undefined)
27
34
  return;
28
- return {
29
- unit: 'mm',
30
- from: mean(carriers.map(carrier => carrier.horizontal.from)),
31
- to: mean(carriers.map(carrier => carrier.horizontal.to))
32
- };
35
+ return { unit: 'mm', from, to };
33
36
  };
34
- /** Where the symbol begins, as the mean onset of its carriers, or nothing for a symbol without a place. */
37
+ /** Where the symbol begins, as the median onset of its carriers, or nothing for a symbol without a place. */
35
38
  export const onsetOf = (edition, symbol) => placeOf(edition, symbol)?.from;
36
39
  /** The symbols by onset, those without a place first; symbols at one place keep their order. */
37
40
  const inOrderOfPlace = (edition, symbols) => symbols
@@ -7,5 +7,7 @@ export type Path = (string | number)[];
7
7
  export declare const getAt: <T>(path: Path, obj: unknown) => T | undefined;
8
8
  /** Where the entity with the id stands in the edition, or nothing where it holds none. */
9
9
  export declare const pathIn: (edition: Edition, id: string) => Path | undefined;
10
+ /** Every id the edition gives an entity of its own, references left out. */
11
+ export declare const idsIn: (edition: Edition) => Iterable<string>;
10
12
  /** Where the edition references the id. */
11
13
  export declare const linksTo: (edition: Edition, id: string) => Path[];
@@ -74,5 +74,7 @@ export const pathIn = (edition, id) => {
74
74
  const trail = placesIn(edition).paths.get(id);
75
75
  return trail === undefined ? undefined : laidOut(trail);
76
76
  };
77
+ /** Every id the edition gives an entity of its own, references left out. */
78
+ export const idsIn = (edition) => placesIn(edition).paths.keys();
77
79
  /** Where the edition references the id. */
78
80
  export const linksTo = (edition, id) => (placesIn(edition).links.get(id) ?? []).map(laidOut);
@@ -21,7 +21,8 @@ export interface EditionCreation {
21
21
  */
22
22
  publisher: Person;
23
23
  /**
24
- * The date on which the edition was published.
24
+ * The date on which the edition was published: where it states a
25
+ * version, the date of that version.
25
26
  * @format date
26
27
  * @see dcterms:date
27
28
  */
@@ -116,6 +117,16 @@ export interface Edition {
116
117
  * @example "https://creativecommons.org/licenses/by/4.0/"
117
118
  */
118
119
  license: string;
120
+ /**
121
+ * The version of the edition, which a citation names together with
122
+ * the publication date. The editor raises it for each release and
123
+ * sets the publication date with it, so that what a reader cited can
124
+ * be told from what has changed since. An edition published before
125
+ * this field existed states none.
126
+ * @see owl:versionInfo
127
+ * @example "1.0"
128
+ */
129
+ version?: string;
119
130
  /**
120
131
  * The roll which is edited in this edition.
121
132
  * @see lrmoo:R3i realises
@@ -145,7 +156,7 @@ export interface Edition {
145
156
  */
146
157
  versions: Version[];
147
158
  }
148
- export type EditionMetadata = Pick<Edition, 'base' | 'title' | 'license' | 'creation' | 'roll'>;
159
+ export type EditionMetadata = Pick<Edition, 'base' | 'title' | 'license' | 'version' | 'creation' | 'roll'>;
149
160
  /**
150
161
  * The copy whose millimetres are the edition's axis: the one it names,
151
162
  * or where it names none or one it no longer has, the first copy with
package/lib/schema.json CHANGED
@@ -617,6 +617,14 @@
617
617
  "type": "string",
618
618
  "ontology": "dcterms:title"
619
619
  },
620
+ "version": {
621
+ "description": "The version of the edition, which a citation names together with the publication date. The editor raises it for each release and sets the publication date with it, so that what a reader cited can be told from what has changed since. An edition published before this field existed states none.",
622
+ "examples": [
623
+ "1.0"
624
+ ],
625
+ "type": "string",
626
+ "ontology": "owl:versionInfo"
627
+ },
620
628
  "versions": {
621
629
  "description": "The different versions of the roll on which this edition is based.",
622
630
  "items": {
@@ -649,7 +657,7 @@
649
657
  "ontology": "crm:P14 carried out by"
650
658
  },
651
659
  "publicationDate": {
652
- "description": "The date on which the edition was published.",
660
+ "description": "The date on which the edition was published: where it states a version, the date of that version.",
653
661
  "format": "date",
654
662
  "type": "string",
655
663
  "ontology": "dcterms:date"
@@ -97,6 +97,7 @@
97
97
  }
98
98
  },
99
99
  "title": "dcterms:title",
100
+ "version": "owl:versionInfo",
100
101
  "license": {
101
102
  "@id": "dcterms:license",
102
103
  "@type": "@id"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linked-rolls",
3
- "version": "0.67.0",
3
+ "version": "0.69.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": {