linked-rolls 0.42.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/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/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": {
@@ -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.42.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": {