@lincs.project/webannotation-schema 1.6.0 → 1.8.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/dist/index.d.mts +492 -409
- package/dist/index.d.ts +492 -409
- package/dist/index.js +387 -187
- package/dist/index.mjs +387 -186
- package/dist/v1/jsonld/context.jsonld +1 -0
- package/dist/v1/jsonld/defs.jsonld +90 -103
- package/dist/v1/jsonld/schema.jsonld +206 -151
- package/dist/v1/standalone/linc-wa-validator.js +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -37,6 +37,7 @@ var schemaContext = {
|
|
|
37
37
|
"@id": "rdf:type"
|
|
38
38
|
},
|
|
39
39
|
identifiedBy: "crm:P1_is_identified_by",
|
|
40
|
+
modeExistence: "edit:ModeExistence",
|
|
40
41
|
precision: {
|
|
41
42
|
"@type": "@id",
|
|
42
43
|
"@id": "crm:P2_has_type"
|
|
@@ -61,7 +62,7 @@ import { z } from "zod";
|
|
|
61
62
|
var userIdDescription = "The IRI that identifies the agent (Creator or Contributor).";
|
|
62
63
|
var User = z.object({
|
|
63
64
|
id: z.string().url().describe(userIdDescription),
|
|
64
|
-
type: z.
|
|
65
|
+
type: z.literal("crm:E21_Person").describe("The type of the Agent."),
|
|
65
66
|
name: z.string().min(1, { message: "Cannot be empty" }).describe("The name of the agent.")
|
|
66
67
|
}).describe("Human Agent");
|
|
67
68
|
var creatorSchema = {
|
|
@@ -69,15 +70,7 @@ var creatorSchema = {
|
|
|
69
70
|
description: "Software Agent",
|
|
70
71
|
properties: {
|
|
71
72
|
id: { type: "string", format: "uri", description: userIdDescription },
|
|
72
|
-
type: {
|
|
73
|
-
type: "array",
|
|
74
|
-
minItems: 2,
|
|
75
|
-
maxItems: 2,
|
|
76
|
-
items: [
|
|
77
|
-
{ type: "string", const: "foaf:Person" },
|
|
78
|
-
{ type: "string", const: "crm:E21_Person" }
|
|
79
|
-
]
|
|
80
|
-
},
|
|
73
|
+
type: { type: "string", const: "crm:E21_Person" },
|
|
81
74
|
name: { type: "string", minLength: 1, description: "The name of the agent." }
|
|
82
75
|
},
|
|
83
76
|
required: ["id", "type", "name"]
|
|
@@ -111,6 +104,37 @@ import { z as z3 } from "zod";
|
|
|
111
104
|
|
|
112
105
|
// src/v1/schema/definitions/body/common.ts
|
|
113
106
|
import { z as z2 } from "zod";
|
|
107
|
+
var ModeExistence = z2.union([
|
|
108
|
+
z2.literal("edit:modeReal").describe(
|
|
109
|
+
"An indication that an entity or thing, such as a person, place or text, is understood to be part of lived or historical existence."
|
|
110
|
+
),
|
|
111
|
+
z2.literal("edit:modeFictional").describe(
|
|
112
|
+
"An indication that an entity or a thing, such as a person, place or text, is invented or imagined."
|
|
113
|
+
),
|
|
114
|
+
z2.literal("edit:modeIdentifiable").describe(
|
|
115
|
+
"An indication that an entity or a thing is understood as both existing and imagined, for instance a character in a work of literature that corresponds to a historical person or a place represented under another name that can be identified as a real place."
|
|
116
|
+
)
|
|
117
|
+
]).describe("An indication of the state of being of an entity or thing (OED).");
|
|
118
|
+
var modeExistenceSchema = {
|
|
119
|
+
oneOf: [
|
|
120
|
+
{
|
|
121
|
+
type: "string",
|
|
122
|
+
const: "edit:modeReal",
|
|
123
|
+
description: "An indication that an entity or thing, such as a person, place or text, is understood to be part of lived or historical existence."
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
type: "string",
|
|
127
|
+
const: "edit:modeFictional",
|
|
128
|
+
description: "An indication that an entity or a thing, such as a person, place or text, is invented or imagined."
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
type: "string",
|
|
132
|
+
const: "edit:modeIdentifiable",
|
|
133
|
+
description: "An indication that an entity or a thing is understood as both existing and imagined, for instance a character in a work of literature that corresponds to a historical person or a place represented under another name that can be identified as a real place."
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
description: "An indication of the state of being of an entity or thing (OED)."
|
|
137
|
+
};
|
|
114
138
|
var labelDescription = "The title or name of a linked resource or named entity.";
|
|
115
139
|
var Label = z2.string().min(1, { message: "The label cannot be empty" }).describe(labelDescription);
|
|
116
140
|
var labelSchema = {
|
|
@@ -161,15 +185,13 @@ var citationSchema = {
|
|
|
161
185
|
import { z as z4 } from "zod";
|
|
162
186
|
var ConceptualObjectEntityType = z4.union([
|
|
163
187
|
z4.literal("crm:E28_Conceptual_Object"),
|
|
164
|
-
z4.tuple([
|
|
165
|
-
z4.literal("crm:E28_Conceptual_Object"),
|
|
166
|
-
z4.literal("wikidata:Q15831596").describe("Fictional Conceptual Object")
|
|
167
|
-
])
|
|
188
|
+
z4.tuple([z4.literal("crm:E28_Conceptual_Object"), z4.literal("wikidata:Q15831596")])
|
|
168
189
|
]);
|
|
169
190
|
var ConceptualObject = z4.object({
|
|
170
191
|
id: z4.string().url().describe(bodyIdDescription),
|
|
171
192
|
entityType: ConceptualObjectEntityType,
|
|
172
193
|
label: Label.optional(),
|
|
194
|
+
modeExistence: ModeExistence.optional(),
|
|
173
195
|
description: Description.optional()
|
|
174
196
|
}).describe("Conceptual Object");
|
|
175
197
|
var conceptualObjectEntityTypeSchema = {
|
|
@@ -181,7 +203,7 @@ var conceptualObjectEntityTypeSchema = {
|
|
|
181
203
|
maxItems: 2,
|
|
182
204
|
items: [
|
|
183
205
|
{ type: "string", const: "crm:E28_Conceptual_Object" },
|
|
184
|
-
{ type: "string", const: "wikidata:Q15831596"
|
|
206
|
+
{ type: "string", const: "wikidata:Q15831596" }
|
|
185
207
|
]
|
|
186
208
|
}
|
|
187
209
|
]
|
|
@@ -193,9 +215,32 @@ var conceptualObjectSchema = {
|
|
|
193
215
|
id: { type: "string", format: "uri", description: bodyIdDescription },
|
|
194
216
|
entityType: conceptualObjectEntityTypeSchema,
|
|
195
217
|
label: { $ref: "defs.jsonld#/definitions/label" },
|
|
218
|
+
modeExistence: { ...modeExistenceSchema, nullable: true },
|
|
196
219
|
description: { $ref: "defs.jsonld#/definitions/description" }
|
|
197
220
|
},
|
|
198
|
-
required: ["id", "entityType"]
|
|
221
|
+
required: ["id", "entityType"],
|
|
222
|
+
allOf: [
|
|
223
|
+
{
|
|
224
|
+
if: {
|
|
225
|
+
type: "object",
|
|
226
|
+
properties: {
|
|
227
|
+
modeExistence: "edit:modeReal"
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
then: {
|
|
231
|
+
type: "object",
|
|
232
|
+
properties: {
|
|
233
|
+
entityType: "crm:E28_Conceptual_Object"
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
else: {
|
|
237
|
+
type: "object",
|
|
238
|
+
properties: {
|
|
239
|
+
entityType: ["crm:E28_Conceptual_Object", "wikidata:Q15831596"]
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
]
|
|
199
244
|
};
|
|
200
245
|
|
|
201
246
|
// src/v1/schema/definitions/body/correction.ts
|
|
@@ -274,29 +319,27 @@ var dateSchema = {
|
|
|
274
319
|
|
|
275
320
|
// src/v1/schema/definitions/body/event.ts
|
|
276
321
|
import { z as z7 } from "zod";
|
|
277
|
-
var EventEntityType = z7.
|
|
278
|
-
z7.literal("
|
|
279
|
-
z7.
|
|
280
|
-
z7.literal("crm:E5_Event").describe("Real Event"),
|
|
281
|
-
z7.literal("crm:E89_Propositional_Object").describe("Fictional Event")
|
|
282
|
-
])
|
|
322
|
+
var EventEntityType = z7.union([
|
|
323
|
+
z7.literal("crm:E5_Event"),
|
|
324
|
+
z7.tuple([z7.literal("crm:E5_Event"), z7.literal("crm:E89_Propositional_Object")])
|
|
283
325
|
]);
|
|
284
326
|
var Event = z7.object({
|
|
285
327
|
id: z7.string().url().describe(bodyIdDescription),
|
|
286
328
|
entityType: EventEntityType,
|
|
287
329
|
label: Label.optional(),
|
|
330
|
+
modeExistence: ModeExistence.optional(),
|
|
288
331
|
description: Description.optional()
|
|
289
332
|
}).describe("Event");
|
|
290
333
|
var eventEntityTypeSchema = {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
maxItems: 2,
|
|
294
|
-
items: [
|
|
295
|
-
{ type: "string", const: "YET TO BE DEFINED EVENT CLASS" },
|
|
334
|
+
oneOf: [
|
|
335
|
+
{ type: "string", const: "crm:E5_Event" },
|
|
296
336
|
{
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
337
|
+
type: "array",
|
|
338
|
+
minItems: 2,
|
|
339
|
+
maxItems: 2,
|
|
340
|
+
items: [
|
|
341
|
+
{ type: "string", const: "crm:E5_Event" },
|
|
342
|
+
{ type: "string", const: "crm:E89_Propositional_Object" }
|
|
300
343
|
]
|
|
301
344
|
}
|
|
302
345
|
]
|
|
@@ -308,9 +351,32 @@ var eventSchema = {
|
|
|
308
351
|
id: { type: "string", format: "uri", description: bodyIdDescription },
|
|
309
352
|
entityType: eventEntityTypeSchema,
|
|
310
353
|
label: { $ref: "defs.jsonld#/definitions/label" },
|
|
354
|
+
modeExistence: { ...modeExistenceSchema, nullable: true },
|
|
311
355
|
description: { $ref: "defs.jsonld#/definitions/description" }
|
|
312
356
|
},
|
|
313
|
-
required: ["id", "entityType"]
|
|
357
|
+
required: ["id", "entityType"],
|
|
358
|
+
allOf: [
|
|
359
|
+
{
|
|
360
|
+
if: {
|
|
361
|
+
type: "object",
|
|
362
|
+
properties: {
|
|
363
|
+
modeExistence: "edit:modeReal"
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
then: {
|
|
367
|
+
type: "object",
|
|
368
|
+
properties: {
|
|
369
|
+
entityType: "crm:E5_Event"
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
else: {
|
|
373
|
+
type: "object",
|
|
374
|
+
properties: {
|
|
375
|
+
entityType: ["crm:E5_Event", "crm:E89_Propositional_Object"]
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
]
|
|
314
380
|
};
|
|
315
381
|
|
|
316
382
|
// src/v1/schema/definitions/body/keyword.ts
|
|
@@ -439,33 +505,27 @@ var noteSchema = {
|
|
|
439
505
|
|
|
440
506
|
// src/v1/schema/definitions/body/organization.ts
|
|
441
507
|
import { z as z11 } from "zod";
|
|
442
|
-
var OrganizationEntityType = z11.
|
|
443
|
-
z11.literal("
|
|
444
|
-
z11.
|
|
445
|
-
z11.literal("crm:E74_Group").describe("Real Organization"),
|
|
446
|
-
z11.literal("crm:E89_Propositional_Object").describe("Fictional Organization")
|
|
447
|
-
])
|
|
508
|
+
var OrganizationEntityType = z11.union([
|
|
509
|
+
z11.literal("crm:E74_Group"),
|
|
510
|
+
z11.tuple([z11.literal("foaf:Organization"), z11.literal("crm:E89_Propositional_Object")])
|
|
448
511
|
]);
|
|
449
512
|
var Organization = z11.object({
|
|
450
513
|
id: z11.string().url().describe(bodyIdDescription),
|
|
451
514
|
entityType: OrganizationEntityType,
|
|
452
515
|
label: Label.optional(),
|
|
516
|
+
modeExistence: ModeExistence.optional(),
|
|
453
517
|
description: Description.optional()
|
|
454
518
|
}).describe("Organization");
|
|
455
519
|
var organizationEntityTypeSchema = {
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
maxItems: 2,
|
|
459
|
-
items: [
|
|
460
|
-
{ type: "string", const: "foaf:Organization" },
|
|
520
|
+
oneOf: [
|
|
521
|
+
{ type: "string", const: "crm:E74_Group" },
|
|
461
522
|
{
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
}
|
|
523
|
+
type: "array",
|
|
524
|
+
minItems: 2,
|
|
525
|
+
maxItems: 2,
|
|
526
|
+
items: [
|
|
527
|
+
{ type: "string", const: "foaf:Organization" },
|
|
528
|
+
{ type: "string", const: "crm:E89_Propositional_Object" }
|
|
469
529
|
]
|
|
470
530
|
}
|
|
471
531
|
]
|
|
@@ -477,36 +537,57 @@ var organizationSchema = {
|
|
|
477
537
|
id: { type: "string", format: "uri", description: bodyIdDescription },
|
|
478
538
|
entityType: organizationEntityTypeSchema,
|
|
479
539
|
label: { $ref: "defs.jsonld#/definitions/label" },
|
|
540
|
+
modeExistence: { ...modeExistenceSchema, nullable: true },
|
|
480
541
|
description: { $ref: "defs.jsonld#/definitions/description" }
|
|
481
542
|
},
|
|
482
|
-
required: ["id", "entityType"]
|
|
543
|
+
required: ["id", "entityType"],
|
|
544
|
+
allOf: [
|
|
545
|
+
{
|
|
546
|
+
if: {
|
|
547
|
+
type: "object",
|
|
548
|
+
properties: {
|
|
549
|
+
modeExistence: "edit:modeReal"
|
|
550
|
+
}
|
|
551
|
+
},
|
|
552
|
+
then: {
|
|
553
|
+
type: "object",
|
|
554
|
+
properties: {
|
|
555
|
+
entityType: "crm:E74_Group"
|
|
556
|
+
}
|
|
557
|
+
},
|
|
558
|
+
else: {
|
|
559
|
+
type: "object",
|
|
560
|
+
properties: {
|
|
561
|
+
entityType: ["foaf:Organization", "crm:E89_Propositional_Object"]
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
]
|
|
483
566
|
};
|
|
484
567
|
|
|
485
568
|
// src/v1/schema/definitions/body/person.ts
|
|
486
569
|
import { z as z12 } from "zod";
|
|
487
|
-
var PersonEntityType = z12.
|
|
488
|
-
z12.literal("
|
|
489
|
-
z12.
|
|
490
|
-
z12.literal("crm:E21_Person").describe("Real Person"),
|
|
491
|
-
z12.literal("crm:E89_Propositional_Object").describe("Fictional Person")
|
|
492
|
-
])
|
|
570
|
+
var PersonEntityType = z12.union([
|
|
571
|
+
z12.literal("crm:E21_Person"),
|
|
572
|
+
z12.tuple([z12.literal("foaf:Person"), z12.literal("crm:E89_Propositional_Object")])
|
|
493
573
|
]);
|
|
494
574
|
var Person = z12.object({
|
|
495
575
|
id: z12.string().url().describe(bodyIdDescription),
|
|
496
576
|
entityType: PersonEntityType,
|
|
497
577
|
label: Label.optional(),
|
|
578
|
+
modeExistence: ModeExistence.optional(),
|
|
498
579
|
description: Description.optional()
|
|
499
580
|
}).describe("Person");
|
|
500
581
|
var personEntityTypeSchema = {
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
maxItems: 2,
|
|
504
|
-
items: [
|
|
505
|
-
{ type: "string", const: "foaf:Person" },
|
|
582
|
+
oneOf: [
|
|
583
|
+
{ type: "string", const: "crm:E21_Person" },
|
|
506
584
|
{
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
585
|
+
type: "array",
|
|
586
|
+
minItems: 2,
|
|
587
|
+
maxItems: 2,
|
|
588
|
+
items: [
|
|
589
|
+
{ type: "string", const: "foaf:Person" },
|
|
590
|
+
{ type: "string", const: "crm:E89_Propositional_Object" }
|
|
510
591
|
]
|
|
511
592
|
}
|
|
512
593
|
]
|
|
@@ -518,24 +599,45 @@ var personSchema = {
|
|
|
518
599
|
id: { type: "string", format: "uri", description: bodyIdDescription },
|
|
519
600
|
entityType: personEntityTypeSchema,
|
|
520
601
|
label: { $ref: "defs.jsonld#/definitions/label" },
|
|
602
|
+
modeExistence: { ...modeExistenceSchema, nullable: true },
|
|
521
603
|
description: { $ref: "defs.jsonld#/definitions/description" }
|
|
522
604
|
},
|
|
523
|
-
required: ["id", "entityType"]
|
|
605
|
+
required: ["id", "entityType"],
|
|
606
|
+
allOf: [
|
|
607
|
+
{
|
|
608
|
+
if: {
|
|
609
|
+
type: "object",
|
|
610
|
+
properties: {
|
|
611
|
+
modeExistence: "edit:modeReal"
|
|
612
|
+
}
|
|
613
|
+
},
|
|
614
|
+
then: {
|
|
615
|
+
type: "object",
|
|
616
|
+
properties: {
|
|
617
|
+
entityType: "crm:E21_Person"
|
|
618
|
+
}
|
|
619
|
+
},
|
|
620
|
+
else: {
|
|
621
|
+
type: "object",
|
|
622
|
+
properties: {
|
|
623
|
+
entityType: ["foaf:Person", "crm:E89_Propositional_Object"]
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
]
|
|
524
628
|
};
|
|
525
629
|
|
|
526
630
|
// src/v1/schema/definitions/body/physicalThing.ts
|
|
527
631
|
import { z as z13 } from "zod";
|
|
528
632
|
var PhysicalThingEntityType = z13.union([
|
|
529
633
|
z13.literal("crm:E18_Physical_Thing"),
|
|
530
|
-
z13.tuple([
|
|
531
|
-
z13.literal("crm:E18_Physical_Thing"),
|
|
532
|
-
z13.literal("wikidata:Q15831596").describe("Fictional Physical Thing")
|
|
533
|
-
])
|
|
634
|
+
z13.tuple([z13.literal("crm:E18_Physical_Thing"), z13.literal("wikidata:Q15831596")])
|
|
534
635
|
]);
|
|
535
636
|
var PhysicalThing = z13.object({
|
|
536
637
|
id: z13.string().url().describe(bodyIdDescription),
|
|
537
638
|
entityType: PhysicalThingEntityType,
|
|
538
639
|
label: Label.optional(),
|
|
640
|
+
modeExistence: ModeExistence.optional(),
|
|
539
641
|
description: Description.optional()
|
|
540
642
|
}).describe("Physical Thing");
|
|
541
643
|
var physicalThingEntityTypeSchema = {
|
|
@@ -547,7 +649,7 @@ var physicalThingEntityTypeSchema = {
|
|
|
547
649
|
maxItems: 2,
|
|
548
650
|
items: [
|
|
549
651
|
{ type: "string", const: "crm:E18_Physical_Thing" },
|
|
550
|
-
{ type: "string", const: "wikidata:Q15831596"
|
|
652
|
+
{ type: "string", const: "wikidata:Q15831596" }
|
|
551
653
|
]
|
|
552
654
|
}
|
|
553
655
|
]
|
|
@@ -559,24 +661,45 @@ var physicalThingSchema = {
|
|
|
559
661
|
id: { type: "string", format: "uri", description: bodyIdDescription },
|
|
560
662
|
entityType: physicalThingEntityTypeSchema,
|
|
561
663
|
label: { $ref: "defs.jsonld#/definitions/label" },
|
|
664
|
+
modeExistence: { ...modeExistenceSchema, nullable: true },
|
|
562
665
|
description: { $ref: "defs.jsonld#/definitions/description" }
|
|
563
666
|
},
|
|
564
|
-
required: ["id", "entityType"]
|
|
667
|
+
required: ["id", "entityType"],
|
|
668
|
+
allOf: [
|
|
669
|
+
{
|
|
670
|
+
if: {
|
|
671
|
+
type: "object",
|
|
672
|
+
properties: {
|
|
673
|
+
modeExistence: "edit:modeReal"
|
|
674
|
+
}
|
|
675
|
+
},
|
|
676
|
+
then: {
|
|
677
|
+
type: "object",
|
|
678
|
+
properties: {
|
|
679
|
+
entityType: "crm:E18_Physical_Thing"
|
|
680
|
+
}
|
|
681
|
+
},
|
|
682
|
+
else: {
|
|
683
|
+
type: "object",
|
|
684
|
+
properties: {
|
|
685
|
+
entityType: ["crm:E18_Physical_Thing", "wikidata:Q15831596"]
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
]
|
|
565
690
|
};
|
|
566
691
|
|
|
567
692
|
// src/v1/schema/definitions/body/place.ts
|
|
568
693
|
import { z as z14 } from "zod";
|
|
569
694
|
var PlaceEntityType = z14.union([
|
|
570
695
|
z14.literal("cwrc:place"),
|
|
571
|
-
z14.tuple([
|
|
572
|
-
z14.literal("cwrc:place"),
|
|
573
|
-
z14.literal("crm:E89_Propositional_Object").describe("Fictional Place")
|
|
574
|
-
])
|
|
696
|
+
z14.tuple([z14.literal("cwrc:place"), z14.literal("crm:E89_Propositional_Object")])
|
|
575
697
|
]);
|
|
576
698
|
var Place = z14.object({
|
|
577
699
|
id: z14.string().url().describe(bodyIdDescription),
|
|
578
700
|
entityType: PlaceEntityType,
|
|
579
701
|
label: Label.optional(),
|
|
702
|
+
modeExistence: ModeExistence.optional(),
|
|
580
703
|
description: Description.optional()
|
|
581
704
|
}).describe("Place");
|
|
582
705
|
var placeEntityTypeSchema = {
|
|
@@ -588,7 +711,7 @@ var placeEntityTypeSchema = {
|
|
|
588
711
|
maxItems: 2,
|
|
589
712
|
items: [
|
|
590
713
|
{ type: "string", const: "cwrc:place" },
|
|
591
|
-
{ type: "string", const: "crm:E89_Propositional_Object"
|
|
714
|
+
{ type: "string", const: "crm:E89_Propositional_Object" }
|
|
592
715
|
]
|
|
593
716
|
}
|
|
594
717
|
]
|
|
@@ -600,36 +723,57 @@ var placeSchema = {
|
|
|
600
723
|
id: { type: "string", format: "uri", description: bodyIdDescription },
|
|
601
724
|
entityType: placeEntityTypeSchema,
|
|
602
725
|
label: { $ref: "defs.jsonld#/definitions/label" },
|
|
726
|
+
modeExistence: { ...modeExistenceSchema, nullable: true },
|
|
603
727
|
description: { $ref: "defs.jsonld#/definitions/description" }
|
|
604
728
|
},
|
|
605
|
-
required: ["id", "entityType"]
|
|
729
|
+
required: ["id", "entityType"],
|
|
730
|
+
allOf: [
|
|
731
|
+
{
|
|
732
|
+
if: {
|
|
733
|
+
type: "object",
|
|
734
|
+
properties: {
|
|
735
|
+
modeExistence: "edit:modeReal"
|
|
736
|
+
}
|
|
737
|
+
},
|
|
738
|
+
then: {
|
|
739
|
+
type: "object",
|
|
740
|
+
properties: {
|
|
741
|
+
entityType: "cwrc:place"
|
|
742
|
+
}
|
|
743
|
+
},
|
|
744
|
+
else: {
|
|
745
|
+
type: "object",
|
|
746
|
+
properties: {
|
|
747
|
+
entityType: ["cwrc:place", "crm:E89_Propositional_Object"]
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
]
|
|
606
752
|
};
|
|
607
753
|
|
|
608
754
|
// src/v1/schema/definitions/body/work.ts
|
|
609
755
|
import { z as z15 } from "zod";
|
|
610
|
-
var WorkEntityType = z15.
|
|
756
|
+
var WorkEntityType = z15.union([
|
|
611
757
|
z15.literal("crm:E89_Propositional_Object"),
|
|
612
|
-
z15.
|
|
613
|
-
z15.literal("frbroo:F1").describe("Real Work"),
|
|
614
|
-
z15.literal("wikidata:Q15306849").describe("Fictional Work")
|
|
615
|
-
])
|
|
758
|
+
z15.tuple([z15.literal("frbroo:F1"), z15.literal("wikidata:Q15306849")])
|
|
616
759
|
]);
|
|
617
760
|
var Work = z15.object({
|
|
618
761
|
id: z15.string().url().describe(bodyIdDescription),
|
|
619
762
|
entityType: WorkEntityType,
|
|
620
763
|
label: Label.optional(),
|
|
764
|
+
modeExistence: ModeExistence.optional(),
|
|
621
765
|
description: Description.optional()
|
|
622
766
|
}).describe("Work");
|
|
623
767
|
var workEntityTypeSchema = {
|
|
624
|
-
|
|
625
|
-
minItems: 2,
|
|
626
|
-
maxItems: 2,
|
|
627
|
-
items: [
|
|
768
|
+
oneOf: [
|
|
628
769
|
{ type: "string", const: "crm:E89_Propositional_Object" },
|
|
629
770
|
{
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
771
|
+
type: "array",
|
|
772
|
+
minItems: 2,
|
|
773
|
+
maxItems: 2,
|
|
774
|
+
items: [
|
|
775
|
+
{ type: "string", const: "frbroo:F1" },
|
|
776
|
+
{ type: "string", const: "wikidata:Q15306849" }
|
|
633
777
|
]
|
|
634
778
|
}
|
|
635
779
|
]
|
|
@@ -641,9 +785,32 @@ var workSchema = {
|
|
|
641
785
|
id: { type: "string", format: "uri", description: bodyIdDescription },
|
|
642
786
|
entityType: workEntityTypeSchema,
|
|
643
787
|
label: { $ref: "defs.jsonld#/definitions/label" },
|
|
788
|
+
modeExistence: { ...modeExistenceSchema, nullable: true },
|
|
644
789
|
description: { $ref: "defs.jsonld#/definitions/description" }
|
|
645
790
|
},
|
|
646
|
-
required: ["id", "entityType"]
|
|
791
|
+
required: ["id", "entityType"],
|
|
792
|
+
allOf: [
|
|
793
|
+
{
|
|
794
|
+
if: {
|
|
795
|
+
type: "object",
|
|
796
|
+
properties: {
|
|
797
|
+
modeExistence: "edit:modeReal"
|
|
798
|
+
}
|
|
799
|
+
},
|
|
800
|
+
then: {
|
|
801
|
+
type: "object",
|
|
802
|
+
properties: {
|
|
803
|
+
entityType: "crm:E89_Propositional_Object"
|
|
804
|
+
}
|
|
805
|
+
},
|
|
806
|
+
else: {
|
|
807
|
+
type: "object",
|
|
808
|
+
properties: {
|
|
809
|
+
entityType: ["frbroo:F1", "wikidata:Q15306849"]
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
]
|
|
647
814
|
};
|
|
648
815
|
|
|
649
816
|
// src/v1/schema/definitions/body/choice.ts
|
|
@@ -735,6 +902,7 @@ var Body = z17.object({
|
|
|
735
902
|
additionalType: z17.union([z17.string(), z17.string().array()]).nullish().describe("Extra types that refines the body"),
|
|
736
903
|
value: z17.string().describe("The value of the body").optional(),
|
|
737
904
|
label: Label.optional(),
|
|
905
|
+
modeExistence: ModeExistence.optional(),
|
|
738
906
|
description: Description.optional()
|
|
739
907
|
}).describe("Web Annotation Body");
|
|
740
908
|
var bodySchema = {
|
|
@@ -749,6 +917,7 @@ var bodySchema = {
|
|
|
749
917
|
},
|
|
750
918
|
value: { type: "string" },
|
|
751
919
|
label: labelSchema,
|
|
920
|
+
modeExistence: modeExistenceSchema,
|
|
752
921
|
description: descriptionSchema
|
|
753
922
|
},
|
|
754
923
|
required: ["id", "entityType"],
|
|
@@ -1343,40 +1512,69 @@ var definitionSchema = {
|
|
|
1343
1512
|
};
|
|
1344
1513
|
|
|
1345
1514
|
// src/v1/schema/root.ts
|
|
1515
|
+
import { z as z27 } from "zod";
|
|
1516
|
+
|
|
1517
|
+
// src/v1/schema/definitions/motivation.ts
|
|
1346
1518
|
import { z as z26 } from "zod";
|
|
1519
|
+
var MotivationInstance = z26.union([
|
|
1520
|
+
z26.literal("identifying"),
|
|
1521
|
+
z26.literal("describing"),
|
|
1522
|
+
z26.literal("correcting"),
|
|
1523
|
+
z26.literal("tagging"),
|
|
1524
|
+
z26.literal("classifying"),
|
|
1525
|
+
z26.literal("linking"),
|
|
1526
|
+
z26.literal("citing")
|
|
1527
|
+
]);
|
|
1528
|
+
var MotivationType = z26.object({
|
|
1529
|
+
type: z26.literal("crm:E55_Type")
|
|
1530
|
+
});
|
|
1531
|
+
var Motivation = z26.record(MotivationInstance, MotivationType).describe("The relationship between an Annotation and a Motivation.");
|
|
1532
|
+
var motivationType = {
|
|
1533
|
+
type: "object",
|
|
1534
|
+
properties: {
|
|
1535
|
+
type: { type: "string", const: "crm:E55_Type" }
|
|
1536
|
+
},
|
|
1537
|
+
required: ["type"]
|
|
1538
|
+
};
|
|
1539
|
+
var motivationSchema = {
|
|
1540
|
+
type: "object",
|
|
1541
|
+
description: "The relationship between an Annotation and a Motivation.",
|
|
1542
|
+
properties: {
|
|
1543
|
+
identifying: { ...motivationType, nullable: true },
|
|
1544
|
+
describing: { ...motivationType, nullable: true },
|
|
1545
|
+
correcting: { ...motivationType, nullable: true },
|
|
1546
|
+
tagging: { ...motivationType, nullable: true },
|
|
1547
|
+
classifying: { ...motivationType, nullable: true },
|
|
1548
|
+
linking: { ...motivationType, nullable: true },
|
|
1549
|
+
citing: { ...motivationType, nullable: true }
|
|
1550
|
+
}
|
|
1551
|
+
};
|
|
1552
|
+
|
|
1553
|
+
// src/v1/schema/root.ts
|
|
1347
1554
|
var Status = ["edit:statusDraft", "edit:statusApproved", "edit:statusPublished"];
|
|
1348
|
-
var
|
|
1349
|
-
"
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
"tagging",
|
|
1353
|
-
"classifying",
|
|
1354
|
-
"linking",
|
|
1355
|
-
"citing"
|
|
1356
|
-
];
|
|
1357
|
-
var WebAnnotation = z26.object({
|
|
1358
|
-
"@context": z26.tuple([
|
|
1359
|
-
z26.literal("http://www.w3.org/ns/anno.jsonld").describe("W3C Web Annotation Context."),
|
|
1360
|
-
z26.literal(contextUri).describe("LINCS Web Annotation Context.")
|
|
1555
|
+
var WebAnnotation = z27.object({
|
|
1556
|
+
"@context": z27.tuple([
|
|
1557
|
+
z27.literal("http://www.w3.org/ns/anno.jsonld").describe("W3C Web Annotation Context."),
|
|
1558
|
+
z27.literal(contextUri).describe("LINCS Web Annotation Context.")
|
|
1361
1559
|
]).describe(
|
|
1362
1560
|
"The context that determines the meaning of the JSON as an Annotation. The itens should point to a URI containing the defiintion used in this schema."
|
|
1363
1561
|
),
|
|
1364
|
-
id:
|
|
1365
|
-
type:
|
|
1366
|
-
motivation:
|
|
1367
|
-
created:
|
|
1368
|
-
modified:
|
|
1562
|
+
id: z27.string().url().describe("The identity of the Annotation."),
|
|
1563
|
+
type: z27.tuple([z27.literal("Annotation"), z27.literal("crm:E33_Linguistic_Object")]).describe("The type of the Annotation."),
|
|
1564
|
+
motivation: Motivation,
|
|
1565
|
+
created: z27.string().datetime().describe("The time at which the resource was created."),
|
|
1566
|
+
modified: z27.string().datetime().optional().describe("The time at which the resource was modified, after creation."),
|
|
1369
1567
|
creator: User.describe("The agent responsible for creating the resource.").optional(),
|
|
1370
|
-
contributor:
|
|
1568
|
+
contributor: z27.array(User.describe("The agents responsible for modifying the resource.")).nonempty().optional().describe("The agents responsible for modifying the resource."),
|
|
1371
1569
|
generator: Software.describe(
|
|
1372
1570
|
"The agent responsible for generating the serialization of the Annotation. "
|
|
1373
1571
|
),
|
|
1374
1572
|
target: Target.describe("The relationship between an Annotation and its Target."),
|
|
1375
|
-
body:
|
|
1573
|
+
body: z27.union([BodyChoice, Body, z27.array(Body)]).describe("The relationship between an Annotation and its Body."),
|
|
1376
1574
|
certainty: Certainty.optional(),
|
|
1377
1575
|
precision: Precision.optional(),
|
|
1378
|
-
label:
|
|
1379
|
-
status:
|
|
1576
|
+
label: z27.string().min(1, { message: "The label cannot be empty" }).optional().describe("The descriptive label for the annotation"),
|
|
1577
|
+
status: z27.enum(Status).describe("The status of this annotation in a workflow.")
|
|
1380
1578
|
}).describe("Web Annotation Root");
|
|
1381
1579
|
var webAnnotationSchema = {
|
|
1382
1580
|
$id: schemaId,
|
|
@@ -1408,16 +1606,7 @@ var webAnnotationSchema = {
|
|
|
1408
1606
|
],
|
|
1409
1607
|
description: "The type of the Annotation."
|
|
1410
1608
|
},
|
|
1411
|
-
motivation:
|
|
1412
|
-
type: "array",
|
|
1413
|
-
minItems: 2,
|
|
1414
|
-
maxItems: 2,
|
|
1415
|
-
items: [
|
|
1416
|
-
{ type: "string", enum: Motivation },
|
|
1417
|
-
{ type: "string", const: "crm:E55_Type" }
|
|
1418
|
-
],
|
|
1419
|
-
description: "The relationship between an Annotation and a Motivation."
|
|
1420
|
-
},
|
|
1609
|
+
motivation: motivationSchema,
|
|
1421
1610
|
created: {
|
|
1422
1611
|
type: "string",
|
|
1423
1612
|
format: "date-time",
|
|
@@ -1466,6 +1655,7 @@ var webAnnotationSchema = {
|
|
|
1466
1655
|
"body",
|
|
1467
1656
|
"status"
|
|
1468
1657
|
],
|
|
1658
|
+
additionalProperties: false,
|
|
1469
1659
|
allOf: [
|
|
1470
1660
|
{
|
|
1471
1661
|
if: {
|
|
@@ -1494,13 +1684,15 @@ var webAnnotationSchema = {
|
|
|
1494
1684
|
type: "object",
|
|
1495
1685
|
properties: {
|
|
1496
1686
|
motivation: {
|
|
1497
|
-
type: "
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1687
|
+
type: "object",
|
|
1688
|
+
properties: {
|
|
1689
|
+
identifying: {
|
|
1690
|
+
type: "object",
|
|
1691
|
+
properties: {
|
|
1692
|
+
type: { type: "string", const: "crm:E55_Type" }
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1504
1696
|
}
|
|
1505
1697
|
}
|
|
1506
1698
|
},
|
|
@@ -1520,13 +1712,15 @@ var webAnnotationSchema = {
|
|
|
1520
1712
|
type: "object",
|
|
1521
1713
|
properties: {
|
|
1522
1714
|
motivation: {
|
|
1523
|
-
type: "
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1715
|
+
type: "object",
|
|
1716
|
+
properties: {
|
|
1717
|
+
describing: {
|
|
1718
|
+
type: "object",
|
|
1719
|
+
properties: {
|
|
1720
|
+
type: { type: "string", const: "crm:E55_Type" }
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1530
1724
|
}
|
|
1531
1725
|
}
|
|
1532
1726
|
},
|
|
@@ -1546,13 +1740,15 @@ var webAnnotationSchema = {
|
|
|
1546
1740
|
type: "object",
|
|
1547
1741
|
properties: {
|
|
1548
1742
|
motivation: {
|
|
1549
|
-
type: "
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1743
|
+
type: "object",
|
|
1744
|
+
properties: {
|
|
1745
|
+
correcting: {
|
|
1746
|
+
type: "object",
|
|
1747
|
+
properties: {
|
|
1748
|
+
type: { type: "string", const: "crm:E55_Type" }
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1556
1752
|
}
|
|
1557
1753
|
}
|
|
1558
1754
|
},
|
|
@@ -1572,13 +1768,15 @@ var webAnnotationSchema = {
|
|
|
1572
1768
|
type: "object",
|
|
1573
1769
|
properties: {
|
|
1574
1770
|
motivation: {
|
|
1575
|
-
type: "
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1771
|
+
type: "object",
|
|
1772
|
+
properties: {
|
|
1773
|
+
tagging: {
|
|
1774
|
+
type: "object",
|
|
1775
|
+
properties: {
|
|
1776
|
+
type: { type: "string", const: "crm:E55_Type" }
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1582
1780
|
}
|
|
1583
1781
|
}
|
|
1584
1782
|
},
|
|
@@ -1598,13 +1796,15 @@ var webAnnotationSchema = {
|
|
|
1598
1796
|
type: "object",
|
|
1599
1797
|
properties: {
|
|
1600
1798
|
motivation: {
|
|
1601
|
-
type: "
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1799
|
+
type: "object",
|
|
1800
|
+
properties: {
|
|
1801
|
+
classifying: {
|
|
1802
|
+
type: "object",
|
|
1803
|
+
properties: {
|
|
1804
|
+
type: { type: "string", const: "crm:E55_Type" }
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1608
1808
|
}
|
|
1609
1809
|
}
|
|
1610
1810
|
},
|
|
@@ -1624,13 +1824,15 @@ var webAnnotationSchema = {
|
|
|
1624
1824
|
type: "object",
|
|
1625
1825
|
properties: {
|
|
1626
1826
|
motivation: {
|
|
1627
|
-
type: "
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1827
|
+
type: "object",
|
|
1828
|
+
properties: {
|
|
1829
|
+
linking: {
|
|
1830
|
+
type: "object",
|
|
1831
|
+
properties: {
|
|
1832
|
+
type: { type: "string", const: "crm:E55_Type" }
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1634
1836
|
}
|
|
1635
1837
|
}
|
|
1636
1838
|
},
|
|
@@ -1650,13 +1852,15 @@ var webAnnotationSchema = {
|
|
|
1650
1852
|
type: "object",
|
|
1651
1853
|
properties: {
|
|
1652
1854
|
motivation: {
|
|
1653
|
-
type: "
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1855
|
+
type: "object",
|
|
1856
|
+
properties: {
|
|
1857
|
+
citing: {
|
|
1858
|
+
type: "object",
|
|
1859
|
+
properties: {
|
|
1860
|
+
type: { type: "string", const: "crm:E55_Type" }
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1660
1864
|
}
|
|
1661
1865
|
}
|
|
1662
1866
|
}
|
|
@@ -1667,8 +1871,7 @@ var webAnnotationSchema = {
|
|
|
1667
1871
|
}
|
|
1668
1872
|
}
|
|
1669
1873
|
}
|
|
1670
|
-
]
|
|
1671
|
-
additionalProperties: false
|
|
1874
|
+
]
|
|
1672
1875
|
};
|
|
1673
1876
|
|
|
1674
1877
|
// src/v1/validator/index.ts
|
|
@@ -1677,18 +1880,18 @@ import Ajv from "ajv";
|
|
|
1677
1880
|
import addFormats from "ajv-formats";
|
|
1678
1881
|
|
|
1679
1882
|
// src/v1/validator/types.ts
|
|
1680
|
-
import { z as
|
|
1681
|
-
var ValidationError =
|
|
1682
|
-
message:
|
|
1683
|
-
path:
|
|
1684
|
-
suggestion:
|
|
1685
|
-
context:
|
|
1686
|
-
errorType:
|
|
1687
|
-
}).and(
|
|
1883
|
+
import { z as z28 } from "zod";
|
|
1884
|
+
var ValidationError = z28.object({
|
|
1885
|
+
message: z28.string(),
|
|
1886
|
+
path: z28.string(),
|
|
1887
|
+
suggestion: z28.string().optional(),
|
|
1888
|
+
context: z28.object({
|
|
1889
|
+
errorType: z28.string()
|
|
1890
|
+
}).and(z28.unknown())
|
|
1688
1891
|
});
|
|
1689
|
-
var ValidateResult =
|
|
1690
|
-
valid:
|
|
1691
|
-
errors:
|
|
1892
|
+
var ValidateResult = z28.object({
|
|
1893
|
+
valid: z28.boolean(),
|
|
1894
|
+
errors: z28.array(ValidationError).optional()
|
|
1692
1895
|
});
|
|
1693
1896
|
|
|
1694
1897
|
// src/v1/validator/index.ts
|
|
@@ -1743,7 +1946,6 @@ __export(v1_exports, {
|
|
|
1743
1946
|
KeywordFolksnomyEntityType: () => KeywordFolksnomyEntityType,
|
|
1744
1947
|
Link: () => Link,
|
|
1745
1948
|
LinkEntityType: () => LinkEntityType,
|
|
1746
|
-
Motivation: () => Motivation,
|
|
1747
1949
|
Note: () => Note,
|
|
1748
1950
|
NoteEntityType: () => NoteEntityType,
|
|
1749
1951
|
Organization: () => Organization,
|
|
@@ -1859,7 +2061,6 @@ export {
|
|
|
1859
2061
|
KeywordFolksnomyEntityType,
|
|
1860
2062
|
Link,
|
|
1861
2063
|
LinkEntityType,
|
|
1862
|
-
Motivation,
|
|
1863
2064
|
Note,
|
|
1864
2065
|
NoteEntityType,
|
|
1865
2066
|
Organization,
|