@lincs.project/webannotation-schema 1.13.0 → 1.14.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.mjs CHANGED
@@ -19,6 +19,7 @@ var schemaContext = {
19
19
  crmdig: "http://www.ics.forth.gr/isl/CRMdig/",
20
20
  cwrc: "http://id.lincsproject.ca/cwrc/",
21
21
  edit: "http://id.lincsproject.ca/edit/",
22
+ event: "http://id.lincsproject.ca/event",
22
23
  fabio: "https://purl.org/spar/fabio/",
23
24
  frbroo: "http://iflastandards.info/ns/fr/frbr/frbroo/",
24
25
  wikidata: "http://www.wikidata.org/entity/",
@@ -39,27 +40,7 @@ var schemaContext = {
39
40
  "oa:linking": {
40
41
  type: "crm:E55_Type"
41
42
  },
42
- certainty: {
43
- "@type": "@id",
44
- "@id": "http://temp.lincsproject.ca/certainty"
45
- },
46
- precision: {
47
- "@type": "@id",
48
- "@id": "http://temp.lincsproject.ca/precision"
49
- },
50
43
  contributor: "dcterms:contributor",
51
- entityType: {
52
- "@type": "@id",
53
- "@id": "rdf:type"
54
- },
55
- additionalType: {
56
- "@type": "@id",
57
- "@id": "crm:P2_has_type"
58
- },
59
- modeExistence: {
60
- "@type": "@id",
61
- "@id": "edit:ModeExistence"
62
- },
63
44
  description: "rdfs:comment",
64
45
  title: "crm:P190_has_symbolic_content",
65
46
  softwareVersion: "schema:softwareVersion"
@@ -71,8 +52,20 @@ import { z } from "zod";
71
52
  var User = z.object({
72
53
  id: z.string().url(),
73
54
  type: z.literal("crm:E21_Person"),
74
- name: z.string().min(1, { message: "Cannot be empty" }).describe(`The person's name.`)
55
+ name: z.string().min(1).describe(`The person's name.`)
75
56
  }).describe("Human Agent");
57
+ var Group = z.object({
58
+ id: z.string().url(),
59
+ type: z.literal("crm:E74_Group"),
60
+ name: z.string().min(1).describe(`The group's name.`)
61
+ }).describe("Group Agent");
62
+ var Software = z.object({
63
+ id: z.string().url(),
64
+ type: z.tuple([z.literal("Software"), z.literal("crm:E73_Information_Object")]),
65
+ P16_used_specific_object: z.string().url().optional().describe("The URI that identifies the agent (software)"),
66
+ name: z.string().min(1).describe(`The software's name.`),
67
+ softwareVersion: z.string().optional().describe("The software version.")
68
+ }).describe("Software Agent");
76
69
  var userSchema = {
77
70
  type: "object",
78
71
  description: "User Agent",
@@ -83,11 +76,6 @@ var userSchema = {
83
76
  },
84
77
  required: ["id", "type", "name"]
85
78
  };
86
- var Group = z.object({
87
- id: z.string().url(),
88
- type: z.literal("crm:E74_Group"),
89
- name: z.string().min(1).describe(`The group's name.`)
90
- }).describe("Group Agent");
91
79
  var groupSchema = {
92
80
  type: "object",
93
81
  description: "Group Agent",
@@ -98,13 +86,6 @@ var groupSchema = {
98
86
  },
99
87
  required: ["id", "type", "name"]
100
88
  };
101
- var Software = z.object({
102
- id: z.string().url(),
103
- type: z.tuple([z.literal("Software"), z.literal("crm:E73_Information_Object")]),
104
- P16_used_specific_object: z.string().url().optional().describe("The URI that identifies the agent (software)"),
105
- name: z.string().min(1).describe(`The software's name.`),
106
- softwareVersion: z.string().optional().describe("The software version.")
107
- }).describe("Software Agent");
108
89
  var softwareSchema = {
109
90
  type: "object",
110
91
  description: "Software Agent",
@@ -134,37 +115,6 @@ import { z as z3 } from "zod";
134
115
 
135
116
  // src/v1/schema/definitions/body/common.ts
136
117
  import { z as z2 } from "zod";
137
- var ModeExistence = z2.union([
138
- z2.literal("edit:modeReal").describe(
139
- "An indication that an entity or thing, such as a person, place or text, is understood to be part of lived or historical existence."
140
- ),
141
- z2.literal("edit:modeFictional").describe(
142
- "An indication that an entity or a thing, such as a person, place or text, is invented or imagined."
143
- ),
144
- z2.literal("edit:modeIdentifiable").describe(
145
- "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."
146
- )
147
- ]).describe("An indication of the state of being of an entity or thing (OED).");
148
- var modeExistenceSchema = {
149
- oneOf: [
150
- {
151
- type: "string",
152
- const: "edit:modeReal",
153
- 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."
154
- },
155
- {
156
- type: "string",
157
- const: "edit:modeFictional",
158
- description: "An indication that an entity or a thing, such as a person, place or text, is invented or imagined."
159
- },
160
- {
161
- type: "string",
162
- const: "edit:modeIdentifiable",
163
- 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."
164
- }
165
- ],
166
- description: "An indication of the state of being of an entity or thing (OED)."
167
- };
168
118
  var labelDescription = "The title or name of a linked resource or named entity.";
169
119
  var Label = z2.string().min(1, { message: "The label cannot be empty" }).describe(labelDescription);
170
120
  var labelSchema = {
@@ -178,19 +128,40 @@ var descriptionSchema = {
178
128
  type: "string",
179
129
  description: descriptionDescription
180
130
  };
131
+ var modeExistenceDescription = "An indication of the state of being of an entity or thing (OED).";
132
+ var modeExistenceRealDescription = "An indication that an entity or thing, such as a person, place or text, is understood to be part of lived or historical existence.";
133
+ var modeExistenceFictionalDescription = "An indication that an entity or a thing, such as a person, place or text, is invented or imagined.";
134
+ var modeExistenceFictionalizedDescription = "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.";
135
+ var ModeExistence = z2.union([
136
+ z2.literal("edit:modeReal").describe(modeExistenceRealDescription),
137
+ z2.literal("edit:modeFictional").describe(modeExistenceFictionalDescription),
138
+ z2.literal("edit:Fictionalized").describe(modeExistenceFictionalizedDescription)
139
+ ]).describe(modeExistenceDescription);
140
+ var modeExistenceSchema = {
141
+ oneOf: [
142
+ { type: "string", const: "edit:modeReal", description: modeExistenceRealDescription },
143
+ { type: "string", const: "edit:modeFictional", description: modeExistenceFictionalDescription },
144
+ {
145
+ type: "string",
146
+ const: "edit:modeFictionalized",
147
+ description: modeExistenceFictionalizedDescription
148
+ }
149
+ ],
150
+ description: modeExistenceDescription
151
+ };
181
152
 
182
153
  // src/v1/schema/definitions/body/citation.ts
183
- var CitationEntityType = z3.tuple([
154
+ var TypeCitation = z3.tuple([
184
155
  z3.literal("cito:Citation"),
185
156
  z3.literal("crm:E73_Information_Object")
186
157
  ]);
187
158
  var Citation = z3.object({
188
159
  id: z3.string().url().describe(bodyIdDescription),
189
- entityType: CitationEntityType,
160
+ type: TypeCitation,
190
161
  label: Label.optional(),
191
162
  description: Description.optional()
192
163
  }).describe("Citation");
193
- var citationEntityTypeSchema = {
164
+ var typeCitationSchema = {
194
165
  type: "array",
195
166
  minItems: 2,
196
167
  maxItems: 2,
@@ -201,109 +172,74 @@ var citationEntityTypeSchema = {
201
172
  };
202
173
  var citationSchema = {
203
174
  type: "object",
204
- description: "A citation entity",
175
+ description: "Citation",
205
176
  properties: {
206
177
  id: { type: "string", format: "uri", description: bodyIdDescription },
207
- entityType: citationEntityTypeSchema,
178
+ type: typeCitationSchema,
208
179
  label: { $ref: "defs.jsonld#/definitions/label" },
209
180
  description: { $ref: "defs.jsonld#/definitions/description" }
210
181
  },
211
- required: ["id", "entityType"]
182
+ required: ["id", "type"]
212
183
  };
213
184
 
214
185
  // src/v1/schema/definitions/body/conceptualObject.ts
215
186
  import { z as z4 } from "zod";
216
- var ConceptualObjectEntityType = z4.union([
217
- z4.literal("crm:E28_Conceptual_Object"),
218
- z4.tuple([z4.literal("crm:E28_Conceptual_Object"), z4.literal("wikidata:Q15831596")])
219
- ]);
187
+ var TypeConceptualObject = z4.literal("crm:E28_Conceptual_Object");
220
188
  var ConceptualObject = z4.object({
221
189
  id: z4.string().url().describe(bodyIdDescription),
222
- entityType: ConceptualObjectEntityType,
190
+ type: TypeConceptualObject,
223
191
  label: Label.optional(),
224
- modeExistence: ModeExistence.optional(),
192
+ P2_has_type: z4.array(z4.string()).optional(),
225
193
  description: Description.optional()
226
194
  }).describe("Conceptual Object");
227
- var conceptualObjectEntityTypeSchema = {
228
- oneOf: [
229
- { type: "string", const: "crm:E28_Conceptual_Object" },
230
- {
231
- type: "array",
232
- minItems: 2,
233
- maxItems: 2,
234
- items: [
235
- { type: "string", const: "crm:E28_Conceptual_Object" },
236
- { type: "string", const: "wikidata:Q15831596" }
237
- ]
238
- }
239
- ]
195
+ var typeConceptualObjectSchema = {
196
+ type: "string",
197
+ const: "crm:E28_Conceptual_Object"
240
198
  };
241
199
  var conceptualObjectSchema = {
242
200
  type: "object",
243
- description: "A conceptual object entity",
201
+ description: "Conceptual Object",
244
202
  properties: {
245
203
  id: { type: "string", format: "uri", description: bodyIdDescription },
246
- entityType: conceptualObjectEntityTypeSchema,
204
+ type: typeConceptualObjectSchema,
247
205
  label: { $ref: "defs.jsonld#/definitions/label" },
248
- modeExistence: { ...modeExistenceSchema, nullable: true },
206
+ P2_has_type: { type: "array", items: { type: "string" } },
249
207
  description: { $ref: "defs.jsonld#/definitions/description" }
250
208
  },
251
- required: ["id", "entityType"],
252
- allOf: [
253
- {
254
- if: {
255
- type: "object",
256
- properties: {
257
- modeExistence: "edit:modeReal"
258
- }
259
- },
260
- then: {
261
- type: "object",
262
- properties: {
263
- entityType: "crm:E28_Conceptual_Object"
264
- }
265
- },
266
- else: {
267
- type: "object",
268
- properties: {
269
- entityType: ["crm:E28_Conceptual_Object", "wikidata:Q15831596"]
270
- }
271
- }
272
- }
273
- ]
209
+ required: ["id", "type"]
274
210
  };
275
211
 
276
212
  // src/v1/schema/definitions/body/correction.ts
277
213
  import { z as z5 } from "zod";
278
- var CorrectionEntityType = z5.tuple([
214
+ var TypeCorrection = z5.tuple([
215
+ z5.literal("TextualBody"),
279
216
  z5.literal("fabio:Correction"),
280
217
  z5.literal("crm:E33_Linguistic_Object")
281
218
  ]);
282
219
  var Correction = z5.object({
283
220
  id: z5.string().url().describe(bodyIdDescription),
284
- type: z5.literal("TextualBody"),
285
- entityType: CorrectionEntityType,
221
+ type: TypeCorrection,
286
222
  value: z5.string().describe("The correction.")
287
223
  }).describe("Correction");
288
- var correctionEntityTypeSchema = {
224
+ var typeCorrectionSchema = {
289
225
  type: "array",
290
- minItems: 2,
291
- maxItems: 2,
226
+ minItems: 3,
227
+ maxItems: 3,
292
228
  items: [
229
+ { type: "string", const: "TextualBody" },
293
230
  { type: "string", const: "fabio:Correction" },
294
231
  { type: "string", const: "crm:E33_Linguistic_Object" }
295
232
  ]
296
233
  };
297
234
  var correctionSchema = {
298
235
  type: "object",
299
- description: "A correction entity",
236
+ description: "Correction",
300
237
  properties: {
301
238
  id: { type: "string", format: "uri", description: bodyIdDescription },
302
- type: { type: "string", const: "TextualBody" },
303
- entityType: correctionEntityTypeSchema,
239
+ type: typeCorrectionSchema,
304
240
  value: { type: "string" }
305
241
  },
306
- required: ["id", "type", "entityType", "value"]
242
+ required: ["id", "type", "value"]
307
243
  // errorMessage: {
308
244
  // properties: {
309
245
  // type: 'must be exacty "TextualBody"',
@@ -314,53 +250,51 @@ var correctionSchema = {
314
250
  // src/v1/schema/definitions/body/date.ts
315
251
  import { z as z6 } from "zod";
316
252
  var DATE_RANGE_PATTERN = "^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2}(?:.\\d*)?)((-(\\d{2}):(\\d{2})|Z)?)\\/(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2}(?:.\\d*)?)((-(\\d{2}):(\\d{2})|Z)?)$";
317
- var DateEntityType = z6.tuple([z6.literal("xsd:date"), z6.literal("crm:E52_Time-Span")]);
253
+ var TypeDate = z6.tuple([
254
+ z6.literal("TextualBody"),
255
+ z6.literal("xsd:date"),
256
+ z6.literal("crm:E52_Time-Span")
257
+ ]);
318
258
  var Date = z6.object({
319
259
  id: z6.string().url().describe(bodyIdDescription),
320
- type: z6.literal("TextualBody"),
321
- entityType: DateEntityType,
322
- value: z6.string().regex(new RegExp(DATE_RANGE_PATTERN)).describe("The date time.")
260
+ type: TypeDate,
261
+ value: z6.string().regex(new RegExp(DATE_RANGE_PATTERN))
323
262
  }).describe("Date");
324
- var dateEntityTypeSchema = {
263
+ var typeDateSchema = {
325
264
  type: "array",
326
- minItems: 2,
327
- maxItems: 2,
265
+ minItems: 3,
266
+ maxItems: 3,
328
267
  items: [
268
+ { type: "string", const: "TextualBody" },
329
269
  { type: "string", const: "xsd:date" },
330
270
  { type: "string", const: "crm:E52_Time-Span" }
331
271
  ]
332
272
  };
333
273
  var dateSchema = {
334
274
  type: "object",
335
- description: "A date entity",
275
+ description: "Date",
336
276
  properties: {
337
277
  id: { type: "string", format: "uri", description: bodyIdDescription },
338
- type: { type: "string", const: "TextualBody" },
339
- entityType: dateEntityTypeSchema,
278
+ type: typeDateSchema,
340
279
  value: { type: "string", pattern: DATE_RANGE_PATTERN }
341
280
  },
342
- required: ["id", "type", "entityType", "value"]
343
- // errorMessage: {
344
- // properties: {
345
- // type: 'must be exacty "TextualBody"',
346
- // },
347
- // },
281
+ required: ["id", "type", "value"]
348
282
  };
349
283
 
350
284
  // src/v1/schema/definitions/body/event.ts
351
285
  import { z as z7 } from "zod";
352
- var EventEntityType = z7.union([
286
+ var TypeEvent = z7.union([
353
287
  z7.literal("crm:E5_Event"),
354
- z7.tuple([z7.literal("crm:E5_Event"), z7.literal("crm:E89_Propositional_Object")])
288
+ z7.tuple([z7.literal("event:Event"), z7.literal("crm:E89_Propositional_Object")])
355
289
  ]);
356
290
  var Event = z7.object({
357
291
  id: z7.string().url().describe(bodyIdDescription),
358
- entityType: EventEntityType,
292
+ type: TypeEvent,
359
293
  label: Label.optional(),
360
- modeExistence: ModeExistence.optional(),
294
+ P2_has_type: z7.tuple([ModeExistence]).rest(z7.string().optional()).optional(),
361
295
  description: Description.optional()
362
296
  }).describe("Event");
363
- var eventEntityTypeSchema = {
297
+ var typeEventSchema = {
364
298
  oneOf: [
365
299
  { type: "string", const: "crm:E5_Event" },
366
300
  {
@@ -368,7 +302,7 @@ var eventEntityTypeSchema = {
368
302
  minItems: 2,
369
303
  maxItems: 2,
370
304
  items: [
371
- { type: "string", const: "crm:E5_Event" },
305
+ { type: "string", const: "event:Event" },
372
306
  { type: "string", const: "crm:E89_Propositional_Object" }
373
307
  ]
374
308
  }
@@ -376,33 +310,39 @@ var eventEntityTypeSchema = {
376
310
  };
377
311
  var eventSchema = {
378
312
  type: "object",
379
- description: "An event entity",
313
+ description: "Event",
380
314
  properties: {
381
315
  id: { type: "string", format: "uri", description: bodyIdDescription },
382
- entityType: eventEntityTypeSchema,
316
+ type: typeEventSchema,
383
317
  label: { $ref: "defs.jsonld#/definitions/label" },
384
- modeExistence: { ...modeExistenceSchema, nullable: true },
318
+ P2_has_type: {
319
+ type: "array",
320
+ items: [{ ...modeExistenceSchema }],
321
+ minItems: 1,
322
+ maxItems: 100,
323
+ additionalItems: { type: "string", nullable: true }
324
+ },
385
325
  description: { $ref: "defs.jsonld#/definitions/description" }
386
326
  },
387
- required: ["id", "entityType"],
327
+ required: ["id", "type"],
388
328
  allOf: [
389
329
  {
390
330
  if: {
391
331
  type: "object",
392
332
  properties: {
393
- modeExistence: "edit:modeReal"
333
+ P2_has_type: ["edit:modeReal"]
394
334
  }
395
335
  },
396
336
  then: {
397
337
  type: "object",
398
338
  properties: {
399
- entityType: "crm:E5_Event"
339
+ type: "crm:E5_Event"
400
340
  }
401
341
  },
402
342
  else: {
403
343
  type: "object",
404
344
  properties: {
405
- entityType: ["crm:E5_Event", "crm:E89_Propositional_Object"]
345
+ type: ["event:Event", "crm:E89_Propositional_Object"]
406
346
  }
407
347
  }
408
348
  }
@@ -411,17 +351,27 @@ var eventSchema = {
411
351
 
412
352
  // src/v1/schema/definitions/body/keyword.ts
413
353
  import { z as z8 } from "zod";
414
- var KeywordEntityType = z8.tuple([
354
+ var TypeKeyword = z8.tuple([
415
355
  z8.literal("crm:E55_Type"),
416
356
  z8.literal("crmdig:D1_Digital_Object")
417
357
  ]);
418
358
  var Keyword = z8.object({
419
359
  id: z8.string().url().describe(bodyIdDescription),
420
- entityType: KeywordEntityType,
360
+ type: TypeKeyword,
421
361
  label: Label.optional(),
422
362
  description: Description.optional()
423
363
  }).describe("Keyword");
424
- var keywordEntityTypeSchema = {
364
+ var TypeKeywordFolksnomy = z8.tuple([
365
+ z8.literal("TextualBody"),
366
+ z8.literal("crm:E55_Type"),
367
+ z8.literal("crm:E33_Linguistic_Object")
368
+ ]);
369
+ var KeywordFolksnomy = z8.object({
370
+ id: z8.string().url().describe(bodyIdDescription),
371
+ type: TypeKeywordFolksnomy,
372
+ value: z8.string().describe("The keyword.")
373
+ }).describe("Keyword");
374
+ var typeKeywordSchema = {
425
375
  type: "array",
426
376
  minItems: 2,
427
377
  maxItems: 2,
@@ -432,44 +382,34 @@ var keywordEntityTypeSchema = {
432
382
  };
433
383
  var keywordSchema = {
434
384
  type: "object",
435
- description: "A keyword entity",
385
+ description: "Keyword",
436
386
  properties: {
437
387
  id: { type: "string", format: "uri", description: bodyIdDescription },
438
- entityType: keywordEntityTypeSchema,
388
+ type: typeKeywordSchema,
439
389
  label: { $ref: "defs.jsonld#/definitions/label" },
440
390
  description: { $ref: "defs.jsonld#/definitions/description" }
441
391
  },
442
- required: ["id", "entityType"]
392
+ required: ["id", "type"]
443
393
  };
444
- var KeywordFolksnomyEntityType = z8.tuple([
445
- z8.literal("crm:E55_Type"),
446
- z8.literal("crm:E33_Linguistic_Object")
447
- ]);
448
- var KeywordFolksnomy = z8.object({
449
- id: z8.string().url().describe(bodyIdDescription),
450
- type: z8.literal("TextualBody"),
451
- entityType: KeywordFolksnomyEntityType,
452
- value: z8.string().describe("The keyword.")
453
- }).describe("Keyword");
454
- var keywordFolksnomyEntityTypeSchema = {
394
+ var typeKeywordFolksnomy = {
455
395
  type: "array",
456
- minItems: 2,
457
- maxItems: 2,
396
+ minItems: 3,
397
+ maxItems: 3,
458
398
  items: [
399
+ { type: "string", const: "TextualBody" },
459
400
  { type: "string", const: "crm:E55_Type" },
460
401
  { type: "string", const: "crm:E33_Linguistic_Object" }
461
402
  ]
462
403
  };
463
404
  var keywordFolksnomySchema = {
464
405
  type: "object",
465
- description: "A keyword entity",
406
+ description: "keyword - Folksonomy",
466
407
  properties: {
467
408
  id: { type: "string", format: "uri", description: bodyIdDescription },
468
- type: { type: "string", const: "TextualBody" },
469
- entityType: keywordFolksnomyEntityTypeSchema,
409
+ type: typeKeywordFolksnomy,
470
410
  value: { type: "string" }
471
411
  },
472
- required: ["id", "type", "entityType", "value"]
412
+ required: ["id", "type", "value"]
473
413
  // errorMessage: {
474
414
  // properties: {
475
415
  // type: 'must be exacty "TextualBody"',
@@ -480,73 +420,69 @@ var keywordFolksnomySchema = {
480
420
  // src/v1/schema/definitions/body/link.ts
481
421
  import { z as z9 } from "zod";
482
422
  var idDescription = "The link URL.";
483
- var LinkEntityType = z9.literal("crmdig:D1_Digital_Object");
423
+ var TypeLink = z9.literal("crmdig:D1_Digital_Object");
484
424
  var Link = z9.object({
485
425
  id: z9.string().url().describe(idDescription),
486
- entityType: LinkEntityType
426
+ type: TypeLink
487
427
  }).describe("A link to a webpage");
488
- var linkEntityTypeSchema = {
428
+ var typeLinkSchema = {
489
429
  type: "string",
490
430
  const: "crmdig:D1_Digital_Object"
491
431
  };
492
432
  var linkSchema = {
493
433
  type: "object",
494
- description: "A link entity",
434
+ description: "Link",
495
435
  properties: {
496
436
  id: { type: "string", format: "uri", description: idDescription },
497
- entityType: linkEntityTypeSchema
437
+ type: typeLinkSchema
498
438
  },
499
- required: ["id", "entityType"]
439
+ required: ["id", "type"]
500
440
  };
501
441
 
502
442
  // src/v1/schema/definitions/body/note.ts
503
443
  import { z as z10 } from "zod";
504
- var NoteEntityType = z10.literal("crm:E33_Linguistic_Object");
444
+ var TypeNote = z10.tuple([z10.literal("TextualBody"), z10.literal("crm:E33_Linguistic_Object")]);
505
445
  var Note = z10.object({
506
446
  id: z10.string().url().describe(bodyIdDescription),
507
- type: z10.literal("TextualBody"),
508
- entityType: NoteEntityType,
509
- additionalType: z10.union([z10.string(), z10.string().array()]).optional().describe("Extra types that refines the note"),
510
- value: z10.string().describe("The note.")
447
+ type: TypeNote,
448
+ value: z10.string(),
449
+ P2_has_type: z10.array(z10.string()).optional()
511
450
  }).describe("Note");
512
- var noteEntityTypeSchema = {
513
- type: "string",
514
- const: "crm:E33_Linguistic_Object"
451
+ var typeNoteSchema = {
452
+ type: "array",
453
+ minItems: 2,
454
+ maxItems: 2,
455
+ items: [
456
+ { type: "string", const: "TextualBody" },
457
+ { type: "string", const: "crm:E33_Linguistic_Object" }
458
+ ]
515
459
  };
516
460
  var noteSchema = {
517
461
  type: "object",
518
- description: "A note entity",
462
+ description: "Note",
519
463
  properties: {
520
464
  id: { type: "string", format: "uri", description: bodyIdDescription },
521
- type: { type: "string", const: "TextualBody" },
522
- entityType: noteEntityTypeSchema,
523
- additionalType: {
524
- oneOf: [{ type: "string" }, { type: "array", items: { type: "string" } }]
525
- },
526
- value: { type: "string" }
465
+ type: typeNoteSchema,
466
+ value: { type: "string" },
467
+ P2_has_type: { type: "array", items: { type: "string" } }
527
468
  },
528
- required: ["id", "type", "entityType", "value"]
529
- // errorMessage: {
530
- // properties: {
531
- // type: 'must be exacty "TextualBody"',
532
- // },
533
- // },
469
+ required: ["id", "type", "value"]
534
470
  };
535
471
 
536
472
  // src/v1/schema/definitions/body/organization.ts
537
473
  import { z as z11 } from "zod";
538
- var OrganizationEntityType = z11.union([
474
+ var TypeOrganization = z11.union([
539
475
  z11.literal("crm:E74_Group"),
540
476
  z11.tuple([z11.literal("foaf:Organization"), z11.literal("crm:E89_Propositional_Object")])
541
477
  ]);
542
478
  var Organization = z11.object({
543
479
  id: z11.string().url().describe(bodyIdDescription),
544
- entityType: OrganizationEntityType,
480
+ type: TypeOrganization,
545
481
  label: Label.optional(),
546
- modeExistence: ModeExistence.optional(),
482
+ P2_has_type: z11.tuple([ModeExistence]).rest(z11.string().optional()).optional(),
547
483
  description: Description.optional()
548
484
  }).describe("Organization");
549
- var organizationEntityTypeSchema = {
485
+ var typeOrganizationSchema = {
550
486
  oneOf: [
551
487
  { type: "string", const: "crm:E74_Group" },
552
488
  {
@@ -562,33 +498,39 @@ var organizationEntityTypeSchema = {
562
498
  };
563
499
  var organizationSchema = {
564
500
  type: "object",
565
- description: "A organization entity",
501
+ description: "Organization",
566
502
  properties: {
567
503
  id: { type: "string", format: "uri", description: bodyIdDescription },
568
- entityType: organizationEntityTypeSchema,
504
+ type: typeOrganizationSchema,
569
505
  label: { $ref: "defs.jsonld#/definitions/label" },
570
- modeExistence: { ...modeExistenceSchema, nullable: true },
506
+ P2_has_type: {
507
+ type: "array",
508
+ items: [{ ...modeExistenceSchema }],
509
+ minItems: 1,
510
+ maxItems: 100,
511
+ additionalItems: { type: "string", nullable: true }
512
+ },
571
513
  description: { $ref: "defs.jsonld#/definitions/description" }
572
514
  },
573
- required: ["id", "entityType"],
515
+ required: ["id", "type"],
574
516
  allOf: [
575
517
  {
576
518
  if: {
577
519
  type: "object",
578
520
  properties: {
579
- modeExistence: "edit:modeReal"
521
+ P2_has_type: ["edit:modeReal"]
580
522
  }
581
523
  },
582
524
  then: {
583
525
  type: "object",
584
526
  properties: {
585
- entityType: "crm:E74_Group"
527
+ type: "crm:E74_Group"
586
528
  }
587
529
  },
588
530
  else: {
589
531
  type: "object",
590
532
  properties: {
591
- entityType: ["foaf:Organization", "crm:E89_Propositional_Object"]
533
+ type: ["foaf:Organization", "crm:E89_Propositional_Object"]
592
534
  }
593
535
  }
594
536
  }
@@ -597,18 +539,18 @@ var organizationSchema = {
597
539
 
598
540
  // src/v1/schema/definitions/body/person.ts
599
541
  import { z as z12 } from "zod";
600
- var PersonEntityType = z12.union([
542
+ var TypePerson = z12.union([
601
543
  z12.literal("crm:E21_Person"),
602
544
  z12.tuple([z12.literal("foaf:Person"), z12.literal("crm:E89_Propositional_Object")])
603
545
  ]);
604
546
  var Person = z12.object({
605
547
  id: z12.string().url().describe(bodyIdDescription),
606
- entityType: PersonEntityType,
548
+ type: TypePerson,
607
549
  label: Label.optional(),
608
- modeExistence: ModeExistence.optional(),
550
+ P2_has_type: z12.tuple([ModeExistence]).rest(z12.string().optional()).optional(),
609
551
  description: Description.optional()
610
552
  }).describe("Person");
611
- var personEntityTypeSchema = {
553
+ var typePersonSchema = {
612
554
  oneOf: [
613
555
  { type: "string", const: "crm:E21_Person" },
614
556
  {
@@ -624,33 +566,39 @@ var personEntityTypeSchema = {
624
566
  };
625
567
  var personSchema = {
626
568
  type: "object",
627
- description: "A person entity",
569
+ description: "Person",
628
570
  properties: {
629
571
  id: { type: "string", format: "uri", description: bodyIdDescription },
630
- entityType: personEntityTypeSchema,
572
+ type: typePersonSchema,
631
573
  label: { $ref: "defs.jsonld#/definitions/label" },
632
- modeExistence: { ...modeExistenceSchema, nullable: true },
574
+ P2_has_type: {
575
+ type: "array",
576
+ items: [{ ...modeExistenceSchema }],
577
+ minItems: 1,
578
+ maxItems: 1,
579
+ additionalItems: { type: "string", nullable: true }
580
+ },
633
581
  description: { $ref: "defs.jsonld#/definitions/description" }
634
582
  },
635
- required: ["id", "entityType"],
583
+ required: ["id", "type"],
636
584
  allOf: [
637
585
  {
638
586
  if: {
639
587
  type: "object",
640
588
  properties: {
641
- modeExistence: "edit:modeReal"
589
+ P2_has_type: ["edit:modeReal"]
642
590
  }
643
591
  },
644
592
  then: {
645
593
  type: "object",
646
594
  properties: {
647
- entityType: "crm:E21_Person"
595
+ type: "crm:E21_Person"
648
596
  }
649
597
  },
650
598
  else: {
651
599
  type: "object",
652
600
  properties: {
653
- entityType: ["foaf:Person", "crm:E89_Propositional_Object"]
601
+ type: ["foaf:Person", "crm:E89_Propositional_Object"]
654
602
  }
655
603
  }
656
604
  }
@@ -659,18 +607,18 @@ var personSchema = {
659
607
 
660
608
  // src/v1/schema/definitions/body/physicalThing.ts
661
609
  import { z as z13 } from "zod";
662
- var PhysicalThingEntityType = z13.union([
610
+ var TypePhysicalThing = z13.union([
663
611
  z13.literal("crm:E18_Physical_Thing"),
664
612
  z13.tuple([z13.literal("crm:E18_Physical_Thing"), z13.literal("wikidata:Q15831596")])
665
613
  ]);
666
614
  var PhysicalThing = z13.object({
667
615
  id: z13.string().url().describe(bodyIdDescription),
668
- entityType: PhysicalThingEntityType,
616
+ type: TypePhysicalThing,
669
617
  label: Label.optional(),
670
- modeExistence: ModeExistence.optional(),
618
+ P2_has_type: z13.tuple([ModeExistence]).rest(z13.string().optional()).optional(),
671
619
  description: Description.optional()
672
620
  }).describe("Physical Thing");
673
- var physicalThingEntityTypeSchema = {
621
+ var typePhysicalThingSchema = {
674
622
  oneOf: [
675
623
  { type: "string", const: "crm:E18_Physical_Thing" },
676
624
  {
@@ -686,33 +634,39 @@ var physicalThingEntityTypeSchema = {
686
634
  };
687
635
  var physicalThingSchema = {
688
636
  type: "object",
689
- description: "A physical thing entity",
637
+ description: "Physical Thing",
690
638
  properties: {
691
639
  id: { type: "string", format: "uri", description: bodyIdDescription },
692
- entityType: physicalThingEntityTypeSchema,
640
+ type: typePhysicalThingSchema,
693
641
  label: { $ref: "defs.jsonld#/definitions/label" },
694
- modeExistence: { ...modeExistenceSchema, nullable: true },
642
+ P2_has_type: {
643
+ type: "array",
644
+ items: [{ ...modeExistenceSchema }],
645
+ minItems: 1,
646
+ maxItems: 100,
647
+ additionalItems: { type: "string", nullable: true }
648
+ },
695
649
  description: { $ref: "defs.jsonld#/definitions/description" }
696
650
  },
697
- required: ["id", "entityType"],
651
+ required: ["id", "type"],
698
652
  allOf: [
699
653
  {
700
654
  if: {
701
655
  type: "object",
702
656
  properties: {
703
- modeExistence: "edit:modeReal"
657
+ P2_has_type: ["edit:modeReal"]
704
658
  }
705
659
  },
706
660
  then: {
707
661
  type: "object",
708
662
  properties: {
709
- entityType: "crm:E18_Physical_Thing"
663
+ type: "crm:E18_Physical_Thing"
710
664
  }
711
665
  },
712
666
  else: {
713
667
  type: "object",
714
668
  properties: {
715
- entityType: ["crm:E18_Physical_Thing", "wikidata:Q15831596"]
669
+ type: ["crm:E18_Physical_Thing", "wikidata:Q15831596"]
716
670
  }
717
671
  }
718
672
  }
@@ -721,18 +675,18 @@ var physicalThingSchema = {
721
675
 
722
676
  // src/v1/schema/definitions/body/place.ts
723
677
  import { z as z14 } from "zod";
724
- var PlaceEntityType = z14.union([
678
+ var TypePlace = z14.union([
725
679
  z14.literal("crm:E53_Place"),
726
680
  z14.tuple([z14.literal("biography:fictionalPlace"), z14.literal("crm:E89_Propositional_Object")])
727
681
  ]);
728
682
  var Place = z14.object({
729
683
  id: z14.string().url().describe(bodyIdDescription),
730
- entityType: PlaceEntityType,
684
+ type: TypePlace,
731
685
  label: Label.optional(),
732
- modeExistence: ModeExistence.optional(),
686
+ P2_has_type: z14.tuple([ModeExistence]).rest(z14.string().optional()).optional(),
733
687
  description: Description.optional()
734
688
  }).describe("Place");
735
- var placeEntityTypeSchema = {
689
+ var typePlaceSchema = {
736
690
  oneOf: [
737
691
  { type: "string", const: "crm:E53_Place" },
738
692
  {
@@ -748,33 +702,39 @@ var placeEntityTypeSchema = {
748
702
  };
749
703
  var placeSchema = {
750
704
  type: "object",
751
- description: "A place entity",
705
+ description: "Place",
752
706
  properties: {
753
707
  id: { type: "string", format: "uri", description: bodyIdDescription },
754
- entityType: placeEntityTypeSchema,
708
+ type: typePlaceSchema,
755
709
  label: { $ref: "defs.jsonld#/definitions/label" },
756
- modeExistence: { ...modeExistenceSchema, nullable: true },
710
+ P2_has_type: {
711
+ type: "array",
712
+ items: [{ ...modeExistenceSchema }],
713
+ minItems: 1,
714
+ maxItems: 100,
715
+ additionalItems: { type: "string", nullable: true }
716
+ },
757
717
  description: { $ref: "defs.jsonld#/definitions/description" }
758
718
  },
759
- required: ["id", "entityType"],
719
+ required: ["id", "type"],
760
720
  allOf: [
761
721
  {
762
722
  if: {
763
723
  type: "object",
764
724
  properties: {
765
- modeExistence: "edit:modeReal"
725
+ P2_has_type: ["edit:modeReal"]
766
726
  }
767
727
  },
768
728
  then: {
769
729
  type: "object",
770
730
  properties: {
771
- entityType: "crm:E53_Place"
731
+ type: "crm:E53_Place"
772
732
  }
773
733
  },
774
734
  else: {
775
735
  type: "object",
776
736
  properties: {
777
- entityType: ["biography:fictionalPlace", "crm:E89_Propositional_Object"]
737
+ type: ["biography:fictionalPlace", "crm:E89_Propositional_Object"]
778
738
  }
779
739
  }
780
740
  }
@@ -783,18 +743,18 @@ var placeSchema = {
783
743
 
784
744
  // src/v1/schema/definitions/body/work.ts
785
745
  import { z as z15 } from "zod";
786
- var WorkEntityType = z15.union([
746
+ var TypeWork = z15.union([
787
747
  z15.literal("frbroo:F1"),
788
748
  z15.tuple([z15.literal("frbroo:F1"), z15.literal("wikidata:Q15306849")])
789
749
  ]);
790
750
  var Work = z15.object({
791
751
  id: z15.string().url().describe(bodyIdDescription),
792
- entityType: WorkEntityType,
752
+ type: TypeWork,
793
753
  label: Label.optional(),
794
- modeExistence: ModeExistence.optional(),
754
+ P2_has_type: z15.tuple([ModeExistence]).rest(z15.string().optional()).optional(),
795
755
  description: Description.optional()
796
756
  }).describe("Work");
797
- var workEntityTypeSchema = {
757
+ var typeWorkSchema = {
798
758
  oneOf: [
799
759
  { type: "string", const: "frbroo:F1" },
800
760
  {
@@ -810,33 +770,39 @@ var workEntityTypeSchema = {
810
770
  };
811
771
  var workSchema = {
812
772
  type: "object",
813
- description: "A work entity",
773
+ description: "Work",
814
774
  properties: {
815
775
  id: { type: "string", format: "uri", description: bodyIdDescription },
816
- entityType: workEntityTypeSchema,
776
+ type: typeWorkSchema,
817
777
  label: { $ref: "defs.jsonld#/definitions/label" },
818
- modeExistence: { ...modeExistenceSchema, nullable: true },
778
+ P2_has_type: {
779
+ type: "array",
780
+ items: [{ ...modeExistenceSchema }],
781
+ minItems: 1,
782
+ maxItems: 100,
783
+ additionalItems: { type: "string", nullable: true }
784
+ },
819
785
  description: { $ref: "defs.jsonld#/definitions/description" }
820
786
  },
821
- required: ["id", "entityType"],
787
+ required: ["id", "type"],
822
788
  allOf: [
823
789
  {
824
790
  if: {
825
791
  type: "object",
826
792
  properties: {
827
- modeExistence: "edit:modeReal"
793
+ P2_has_type: ["edit:modeReal"]
828
794
  }
829
795
  },
830
796
  then: {
831
797
  type: "object",
832
798
  properties: {
833
- entityType: "crm:E89_Propositional_Object"
799
+ type: "crm:E89_Propositional_Object"
834
800
  }
835
801
  },
836
802
  else: {
837
803
  type: "object",
838
804
  properties: {
839
- entityType: ["frbroo:F1", "wikidata:Q15306849"]
805
+ type: ["frbroo:F1", "wikidata:Q15306849"]
840
806
  }
841
807
  }
842
808
  }
@@ -849,8 +815,6 @@ var bodyIdDescription2 = "The IRI that identifies the Body resource.";
849
815
  var BodyChoice = z16.object({
850
816
  id: z16.string().url().describe(bodyIdDescription2),
851
817
  type: z16.literal("Choice"),
852
- entityType: BodyEntityType,
853
- label: Label.optional(),
854
818
  items: z16.array(Body)
855
819
  });
856
820
  var bodyChoiceSchema = {
@@ -859,165 +823,103 @@ var bodyChoiceSchema = {
859
823
  properties: {
860
824
  id: { type: "string", format: "uri", description: bodyIdDescription2 },
861
825
  type: { type: "string", const: "Choice" },
862
- entityType: {
863
- oneOf: [
864
- personEntityTypeSchema,
865
- placeEntityTypeSchema,
866
- organizationEntityTypeSchema,
867
- workEntityTypeSchema,
868
- physicalThingEntityTypeSchema,
869
- conceptualObjectEntityTypeSchema,
870
- citationEntityTypeSchema,
871
- dateEntityTypeSchema,
872
- noteEntityTypeSchema,
873
- correctionEntityTypeSchema,
874
- keywordEntityTypeSchema,
875
- keywordFolksnomyEntityTypeSchema,
876
- linkEntityTypeSchema,
877
- eventEntityTypeSchema
878
- ]
879
- },
880
- label: labelSchema,
881
826
  items: {
882
827
  type: "array",
883
- // items: bodySchema,
884
828
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment
885
829
  items: { $ref: "defs.jsonld#/definitions/body" }
886
830
  }
887
831
  },
888
- required: ["id", "type", "entityType", "items"],
832
+ required: ["id", "type", "items"],
889
833
  additionalProperties: false
890
834
  };
891
835
 
892
836
  // src/v1/schema/definitions/body/index.ts
893
837
  var bodyIdDescription = "The IRI that identifies the Body resource.";
894
- var BodyEntityType = z17.union([
895
- PersonEntityType,
896
- PlaceEntityType,
897
- OrganizationEntityType,
898
- WorkEntityType,
899
- PhysicalThingEntityType,
900
- ConceptualObjectEntityType,
901
- CitationEntityType,
902
- DateEntityType,
903
- NoteEntityType,
904
- CorrectionEntityType,
905
- KeywordEntityType,
906
- KeywordFolksnomyEntityType,
907
- LinkEntityType,
908
- EventEntityType
838
+ var TypeBody = z17.union([
839
+ TypePerson,
840
+ TypePlace,
841
+ TypeOrganization,
842
+ TypeWork,
843
+ TypePhysicalThing,
844
+ TypeConceptualObject,
845
+ TypeCitation,
846
+ TypeDate,
847
+ TypeNote,
848
+ TypeCorrection,
849
+ TypeKeyword,
850
+ TypeKeywordFolksnomy,
851
+ TypeLink,
852
+ TypeEvent
909
853
  ]);
910
- var bodyEntityTypeSchema = {
911
- oneOf: [
912
- personEntityTypeSchema,
913
- placeEntityTypeSchema,
914
- organizationEntityTypeSchema,
915
- workEntityTypeSchema,
916
- physicalThingEntityTypeSchema,
917
- conceptualObjectEntityTypeSchema,
918
- citationEntityTypeSchema,
919
- dateEntityTypeSchema,
920
- noteEntityTypeSchema,
921
- correctionEntityTypeSchema,
922
- keywordEntityTypeSchema,
923
- keywordFolksnomyEntityTypeSchema,
924
- linkEntityTypeSchema,
925
- eventEntityTypeSchema
926
- ]
927
- };
928
854
  var Body = z17.object({
929
855
  id: z17.string().url().describe(bodyIdDescription),
930
- type: z17.literal("TextualBody").optional(),
931
- entityType: BodyEntityType,
932
- additionalType: z17.union([z17.string(), z17.string().array()]).nullish().describe("Extra types that refines the body"),
933
- value: z17.string().describe("The value of the body").optional(),
856
+ type: TypeBody,
857
+ value: z17.string().optional(),
934
858
  label: Label.optional(),
935
- modeExistence: ModeExistence.optional(),
859
+ P2_has_type: z17.array(z17.string()).optional(),
936
860
  description: Description.optional()
937
861
  }).describe("Web Annotation Body");
862
+ var typeBodySchema = {
863
+ oneOf: [
864
+ typePersonSchema,
865
+ typePlaceSchema,
866
+ typeOrganizationSchema,
867
+ typeWorkSchema,
868
+ typePhysicalThingSchema,
869
+ typeConceptualObjectSchema,
870
+ typeEventSchema,
871
+ typeCitationSchema,
872
+ typeDateSchema,
873
+ typeNoteSchema,
874
+ typeCorrectionSchema,
875
+ typeKeywordSchema,
876
+ typeKeywordFolksnomy,
877
+ typeLinkSchema
878
+ ]
879
+ };
938
880
  var bodySchema = {
939
881
  type: "object",
940
882
  description: "Web Annotation Body",
941
883
  properties: {
942
884
  id: { type: "string", format: "uri", description: bodyIdDescription },
943
- type: { type: "string", const: "TextualBody" },
944
- entityType: bodyEntityTypeSchema,
945
- additionalType: {
946
- anyOf: [{ type: "string" }, { type: "array", items: { type: "string" } }]
947
- },
885
+ type: typeBodySchema,
948
886
  value: { type: "string" },
949
887
  label: labelSchema,
950
- modeExistence: modeExistenceSchema,
888
+ P2_has_type: { type: "array", items: { type: "string" } },
951
889
  description: descriptionSchema
952
890
  },
953
- required: ["id", "entityType"],
954
- // * Conditional restrictions
891
+ required: ["id", "type"],
955
892
  anyOf: [
956
- //* IF entityType is date OR correction OR keyword THEN type = TextualBody
957
- //* && IF entityType is date THEN value = date range pattern ELSE value = string
958
893
  {
959
894
  if: {
960
895
  type: "object",
961
896
  properties: {
962
- entityType: {
963
- anyOf: [
964
- { const: "crm:E33_Linguistic_Object" },
965
- {
966
- type: "array",
967
- minItems: 2,
968
- maxItems: 2,
969
- items: [{ const: "xsd:date" }, { const: "crm:E52_Time-Span" }]
970
- },
971
- {
972
- type: "array",
973
- minItems: 2,
974
- maxItems: 2,
975
- items: [{ const: "fabio:Correction" }, { const: "crm:E33_Linguistic_Object" }]
976
- },
977
- {
978
- type: "array",
979
- minItems: 2,
980
- maxItems: 2,
981
- items: [{ const: "crm:E55_Type" }, { const: "crm:E33_Linguistic_Object" }]
982
- }
983
- ]
897
+ type: {
898
+ anyOf: [typeNoteSchema, typeDateSchema, typeCorrectionSchema, typeKeywordFolksnomy]
984
899
  }
985
900
  }
986
901
  },
987
902
  then: {
988
903
  type: "object",
989
- required: ["type", "value"],
990
- properties: {
991
- type: { type: "string", const: "TextualBody" }
992
- },
904
+ required: ["id", "type", "value"],
993
905
  if: {
994
906
  type: "object",
995
907
  properties: {
996
- entityType: {
997
- type: "array",
998
- minItems: 2,
999
- maxItems: 2,
1000
- items: [{ const: "xsd:date" }, { const: "crm:E52_Time-Span" }]
1001
- }
908
+ type: typeDateSchema
1002
909
  }
1003
910
  },
1004
911
  then: {
1005
912
  type: "object",
913
+ required: ["id", "type", "value"],
1006
914
  properties: {
1007
915
  value: {
1008
916
  type: "string",
1009
917
  pattern: DATE_RANGE_PATTERN
1010
918
  }
1011
919
  }
1012
- },
1013
- else: {
1014
- type: "object",
1015
- properties: { value: { type: "string" } }
1016
920
  }
1017
921
  }
1018
922
  }
1019
- // TODO: Add more restrictions
1020
- // ? Not accept value for some entityTypes
1021
923
  ],
1022
924
  additionalProperties: false
1023
925
  };
@@ -1028,10 +930,7 @@ import { z as z25 } from "zod";
1028
930
  // src/v1/schema/definitions/target/selector/index.ts
1029
931
  import { z as z23 } from "zod";
1030
932
 
1031
- // src/v1/schema/definitions/target/selector/range.ts
1032
- import { z as z21 } from "zod";
1033
-
1034
- // src/v1/schema/definitions/target/selector/xpath.ts
933
+ // src/v1/schema/definitions/target/selector/css.ts
1035
934
  import { z as z20 } from "zod";
1036
935
 
1037
936
  // src/v1/schema/definitions/target/selector/textPosition.ts
@@ -1157,18 +1056,18 @@ var textQuoteSelectorExtendedSchema = {
1157
1056
  required: ["id", "type", "exact", "prefix", "suffix"]
1158
1057
  };
1159
1058
 
1160
- // src/v1/schema/definitions/target/selector/xpath.ts
1161
- var XpathSelector = z20.object({
1059
+ // src/v1/schema/definitions/target/selector/css.ts
1060
+ var CssSelector = z20.object({
1162
1061
  id: z20.string().describe(selectorIdDescription),
1163
- type: z20.tuple([z20.literal("XPathSelector"), z20.literal("crm:E73_Information_Object")]),
1164
- value: z20.string().min(1).describe("The xpath to the selected segment.")
1165
- }).describe("Xpath Selector");
1166
- var XpathSelectorExtended = XpathSelector.extend({
1062
+ type: z20.tuple([z20.literal("CssSelector"), z20.literal("crm:E73_Information_Object")]),
1063
+ value: z20.string().min(1).describe("The CSS to the selected a segment.")
1064
+ }).describe("CSS Selector");
1065
+ var CssSelectorExtended = CssSelector.extend({
1167
1066
  refinedBy: z20.union([TextPositionSelector, TextQuoteSelector]).optional().describe(selectorRefinedByDescription)
1168
1067
  });
1169
- var xpathSelectorSchema = {
1068
+ var cssSelectorSchema = {
1170
1069
  type: "object",
1171
- description: "Xpath Selector",
1070
+ description: "Css Selector",
1172
1071
  properties: {
1173
1072
  id: { type: "string", format: "uri", description: selectorIdDescription },
1174
1073
  type: {
@@ -1176,23 +1075,23 @@ var xpathSelectorSchema = {
1176
1075
  minItems: 2,
1177
1076
  maxItems: 2,
1178
1077
  items: [
1179
- { type: "string", const: "XPathSelector" },
1078
+ { type: "string", const: "CssSelector" },
1180
1079
  { type: "string", const: "crm:E73_Information_Object" }
1181
1080
  ],
1182
1081
  description: "The class of the Selector,"
1183
1082
  },
1184
1083
  value: {
1185
1084
  type: "string",
1186
- description: "Web Annotation Target Select Xpath"
1085
+ description: "Web Annotation Target Select CSS"
1187
1086
  }
1188
1087
  },
1189
1088
  required: ["id", "type", "value"]
1190
1089
  };
1191
- var xpathSelectorExtendedSchema = {
1090
+ var cssSelectorExtendedSchema = {
1192
1091
  type: "object",
1193
- description: "Xpath Selector",
1092
+ description: "CSS Selector",
1194
1093
  properties: {
1195
- ...xpathSelectorSchema.properties,
1094
+ ...cssSelectorSchema.properties,
1196
1095
  refinedBy: {
1197
1096
  type: "object",
1198
1097
  description: selectorRefinedByDescription,
@@ -1207,46 +1106,21 @@ var xpathSelectorExtendedSchema = {
1207
1106
  };
1208
1107
 
1209
1108
  // src/v1/schema/definitions/target/selector/range.ts
1210
- var RangeSelector = z21.object({
1211
- id: z21.string().url().describe(selectorIdDescription),
1212
- type: z21.tuple([z21.literal("RangeSelector"), z21.literal("crm:E73_Information_Object")]),
1213
- startSelector: XpathSelector,
1214
- endSelector: XpathSelector
1215
- }).describe("Range Selector");
1216
- var rangeSelectorSchema = {
1217
- type: "object",
1218
- description: "Range Selector",
1219
- properties: {
1220
- id: { type: "string", format: "uri", description: selectorIdDescription },
1221
- type: {
1222
- type: "array",
1223
- minItems: 2,
1224
- maxItems: 2,
1225
- items: [
1226
- { type: "string", const: "RangeSelector" },
1227
- { type: "string", const: "crm:E73_Information_Object" }
1228
- ],
1229
- description: "The class of the Selector,"
1230
- },
1231
- startSelector: { $ref: "defs.jsonld#/definitions/xpathSelector" },
1232
- endSelector: { $ref: "defs.jsonld#/definitions/xpathSelector" }
1233
- },
1234
- required: ["id", "type", "startSelector", "endSelector"]
1235
- };
1236
-
1237
- // src/v1/schema/definitions/target/selector/css.ts
1238
1109
  import { z as z22 } from "zod";
1239
- var CssSelector = z22.object({
1240
- id: z22.string().describe(selectorIdDescription),
1241
- type: z22.tuple([z22.literal("CssSelector"), z22.literal("crm:E73_Information_Object")]),
1242
- value: z22.string().min(1).describe("The CSS to the selected a segment.")
1243
- }).describe("CSS Selector");
1244
- var CssSelectorExtended = CssSelector.extend({
1245
- refinedBy: z22.union([TextPositionSelector, TextQuoteSelector]).optional().describe(selectorRefinedByDescription)
1110
+
1111
+ // src/v1/schema/definitions/target/selector/xpath.ts
1112
+ import { z as z21 } from "zod";
1113
+ var XpathSelector = z21.object({
1114
+ id: z21.string().describe(selectorIdDescription),
1115
+ type: z21.tuple([z21.literal("XPathSelector"), z21.literal("crm:E73_Information_Object")]),
1116
+ value: z21.string().min(1).describe("The xpath to the selected segment.")
1117
+ }).describe("Xpath Selector");
1118
+ var XpathSelectorExtended = XpathSelector.extend({
1119
+ refinedBy: z21.union([TextPositionSelector, TextQuoteSelector]).optional().describe(selectorRefinedByDescription)
1246
1120
  });
1247
- var cssSelectorSchema = {
1121
+ var xpathSelectorSchema = {
1248
1122
  type: "object",
1249
- description: "Css Selector",
1123
+ description: "Xpath Selector",
1250
1124
  properties: {
1251
1125
  id: { type: "string", format: "uri", description: selectorIdDescription },
1252
1126
  type: {
@@ -1254,23 +1128,23 @@ var cssSelectorSchema = {
1254
1128
  minItems: 2,
1255
1129
  maxItems: 2,
1256
1130
  items: [
1257
- { type: "string", const: "CssSelector" },
1131
+ { type: "string", const: "XPathSelector" },
1258
1132
  { type: "string", const: "crm:E73_Information_Object" }
1259
1133
  ],
1260
1134
  description: "The class of the Selector,"
1261
1135
  },
1262
1136
  value: {
1263
1137
  type: "string",
1264
- description: "Web Annotation Target Select CSS"
1138
+ description: "Web Annotation Target Select Xpath"
1265
1139
  }
1266
1140
  },
1267
1141
  required: ["id", "type", "value"]
1268
1142
  };
1269
- var cssSelectorExtendedSchema = {
1143
+ var xpathSelectorExtendedSchema = {
1270
1144
  type: "object",
1271
- description: "CSS Selector",
1145
+ description: "Xpath Selector",
1272
1146
  properties: {
1273
- ...cssSelectorSchema.properties,
1147
+ ...xpathSelectorSchema.properties,
1274
1148
  refinedBy: {
1275
1149
  type: "object",
1276
1150
  description: selectorRefinedByDescription,
@@ -1284,6 +1158,34 @@ var cssSelectorExtendedSchema = {
1284
1158
  required: ["id", "type", "value"]
1285
1159
  };
1286
1160
 
1161
+ // src/v1/schema/definitions/target/selector/range.ts
1162
+ var RangeSelector = z22.object({
1163
+ id: z22.string().url().describe(selectorIdDescription),
1164
+ type: z22.tuple([z22.literal("RangeSelector"), z22.literal("crm:E73_Information_Object")]),
1165
+ startSelector: XpathSelector,
1166
+ endSelector: XpathSelector
1167
+ }).describe("Range Selector");
1168
+ var rangeSelectorSchema = {
1169
+ type: "object",
1170
+ description: "Range Selector",
1171
+ properties: {
1172
+ id: { type: "string", format: "uri", description: selectorIdDescription },
1173
+ type: {
1174
+ type: "array",
1175
+ minItems: 2,
1176
+ maxItems: 2,
1177
+ items: [
1178
+ { type: "string", const: "RangeSelector" },
1179
+ { type: "string", const: "crm:E73_Information_Object" }
1180
+ ],
1181
+ description: "The class of the Selector,"
1182
+ },
1183
+ startSelector: { $ref: "defs.jsonld#/definitions/xpathSelector" },
1184
+ endSelector: { $ref: "defs.jsonld#/definitions/xpathSelector" }
1185
+ },
1186
+ required: ["id", "type", "startSelector", "endSelector"]
1187
+ };
1188
+
1287
1189
  // src/v1/schema/definitions/target/selector/index.ts
1288
1190
  var selectorIdDescription = "UUID that identifies the selector.";
1289
1191
  var selectorRefinedByDescription = "The relationship between a broader selector and the more specific selector that should be applied to the results of the first.";
@@ -1309,48 +1211,41 @@ var selectorSchema = {
1309
1211
  // src/v1/schema/definitions/target/source.ts
1310
1212
  import { z as z24 } from "zod";
1311
1213
  var formatDescription = "The format of the Web Resource's content. The value of the property should be the media-type of the format, following the [rfc6838] specification.";
1214
+ var languageDescription = "The language of the Web Resource's content. The value of the property should be a language code following the [bcp47] specification.";
1215
+ var titleDescription = "The title of the document being annotated.";
1216
+ var sourceIdDescription = "The IRI that identifies the Target source.";
1312
1217
  var Format = z24.string().min(1).describe(formatDescription);
1218
+ var Language = z24.string().min(2).max(3).describe(languageDescription);
1219
+ var isIdentifiedBy = z24.object({
1220
+ id: z24.string().url(),
1221
+ type: z24.literal("crm:E33_E41_Linguistic_Appellation"),
1222
+ title: z24.string().min(1).describe(titleDescription)
1223
+ });
1224
+ var Source = z24.object({
1225
+ id: z24.string().url().describe(sourceIdDescription),
1226
+ type: z24.literal("crm:D1_Digital_Object"),
1227
+ format: z24.union([Format, z24.array(Format).min(1)]).describe(formatDescription),
1228
+ P1_is_identified_by: isIdentifiedBy.optional(),
1229
+ language: z24.union([Language, z24.array(Language).min(1)]).optional().describe(languageDescription)
1230
+ }).describe("Web Annotation Target");
1313
1231
  var formatSchema = {
1314
1232
  type: "string",
1315
1233
  description: formatDescription,
1316
1234
  minLength: 1
1317
1235
  };
1318
- var languageDescription = "The language of the Web Resource's content. The value of the property should be a language code following the [bcp47] specification.";
1319
- var Language = z24.string().min(2).max(3).describe(languageDescription);
1320
1236
  var languageSchema = {
1321
1237
  type: "string",
1322
1238
  description: languageDescription,
1323
1239
  minLength: 2,
1324
1240
  maxLength: 3
1325
1241
  };
1326
- var sourceIdDescription = "The IRI that identifies the Target source.";
1327
- var isIdentifiedBy = z24.object({
1328
- id: z24.string().url(),
1329
- type: z24.literal("crm:E33_E41_Linguistic_Appellation"),
1330
- title: z24.string().min(1).describe("The title of the document being annotated.")
1331
- });
1332
- var Source = z24.object({
1333
- id: z24.string().url().describe(sourceIdDescription),
1334
- type: z24.literal("crm:D1_Digital_Object"),
1335
- format: z24.union([Format, z24.array(Format).min(1)]).describe(
1336
- "The formats of the Web Resource's content. The value of the property should and array of media-types of the format, following the [rfc6838] specification."
1337
- ),
1338
- P1_is_identified_by: isIdentifiedBy.optional(),
1339
- language: z24.union([Language, z24.array(Language).min(1)]).optional().describe(
1340
- "The languages of the Web Resource's content. The value of the property should be an array of language code following the [bcp47] specification."
1341
- )
1342
- }).describe("Web Annotation Target");
1343
1242
  var isIndentifyBySchema = {
1344
1243
  type: "object",
1345
1244
  description: "indentifyBy",
1346
1245
  properties: {
1347
1246
  id: { type: "string", format: "uri" },
1348
1247
  type: { type: "string", const: "crm:E33_E41_Linguistic_Appellation" },
1349
- title: {
1350
- type: "string",
1351
- minLength: 1,
1352
- description: "The title of the document being annotated."
1353
- }
1248
+ title: { type: "string", minLength: 1, description: titleDescription }
1354
1249
  },
1355
1250
  required: ["id", "type", "title"]
1356
1251
  };
@@ -1364,12 +1259,7 @@ var sourceSchema = {
1364
1259
  type: ["string", "array"],
1365
1260
  anyOf: [
1366
1261
  formatSchema,
1367
- {
1368
- type: "array",
1369
- minItems: 1,
1370
- items: formatSchema,
1371
- description: "The formats of the Web Resource's content. The value of the property should and array of media-types of the format, following the [rfc6838] specification."
1372
- }
1262
+ { type: "array", minItems: 1, items: formatSchema, description: formatDescription }
1373
1263
  ]
1374
1264
  },
1375
1265
  P1_is_identified_by: { ...isIndentifyBySchema, nullable: true },
@@ -1378,12 +1268,7 @@ var sourceSchema = {
1378
1268
  nullable: true,
1379
1269
  anyOf: [
1380
1270
  languageSchema,
1381
- {
1382
- type: "array",
1383
- minItems: 1,
1384
- items: languageSchema,
1385
- description: "The languages of the Web Resource's content. The value of the property should be an array of language code following the [bcp47] specification."
1386
- }
1271
+ { type: "array", minItems: 1, items: languageSchema, description: languageDescription }
1387
1272
  ]
1388
1273
  }
1389
1274
  },
@@ -1392,13 +1277,12 @@ var sourceSchema = {
1392
1277
 
1393
1278
  // src/v1/schema/definitions/target/index.ts
1394
1279
  var targetIdDescription = "The IRI that identifies the Target resource.";
1280
+ var renderedViaDescription = "The relationship between the Specific Resource that represents the Target in the annotation, and the piece of software or other system that was used to render the Target when the annotation was created.";
1395
1281
  var Target = z25.object({
1396
1282
  id: z25.string().url().describe(targetIdDescription),
1397
1283
  type: z25.tuple([z25.literal("SpecificResource"), z25.literal("crm:E73_Information_Object")]).describe("The class of the Specific Resource."),
1398
1284
  source: Source,
1399
- renderedVia: Software.optional().describe(
1400
- "The relationship between the Specific Resource that represents the Target in the annotation, and the piece of software or other system that was used to render the Target when the annotation was created."
1401
- ),
1285
+ renderedVia: Software.optional().describe(renderedViaDescription),
1402
1286
  selector: z25.union([Selector, z25.array(Selector)]).describe("The relationship between a Specific Resource and a Selector.").optional()
1403
1287
  }).describe("Web Annotation Target");
1404
1288
  var targetSchema = {
@@ -1417,19 +1301,9 @@ var targetSchema = {
1417
1301
  description: "The class of the Specific Resource."
1418
1302
  },
1419
1303
  source: sourceSchema,
1420
- renderedVia: {
1421
- $ref: "defs.jsonld#/definitions/software",
1422
- description: "The relationship between the Specific Resource that represents the Target in the annotation, and the piece of software or other system that was used to render the Target when the annotation was created."
1423
- },
1304
+ renderedVia: { $ref: "defs.jsonld#/definitions/software", description: renderedViaDescription },
1424
1305
  selector: {
1425
- anyOf: [
1426
- selectorSchema,
1427
- {
1428
- type: "array",
1429
- items: selectorSchema,
1430
- minItems: 1
1431
- }
1432
- ]
1306
+ anyOf: [selectorSchema, { type: "array", items: selectorSchema, minItems: 1 }]
1433
1307
  }
1434
1308
  },
1435
1309
  required: ["id", "type", "source"],
@@ -1574,24 +1448,58 @@ var targetSchema = {
1574
1448
 
1575
1449
  // src/v1/schema/definitions/common.ts
1576
1450
  import { z as z26 } from "zod";
1577
- var Quality = [
1578
- "edit:qualityLow",
1579
- "edit:qualityMedium",
1580
- "edit:qualityHigh",
1581
- "edit:qualityUnknown"
1582
- ];
1583
- var certaintyDescription = "Indicates the degree of certainty associated with some aspect of an assertion, description, identification, or entity linked to the annotation body.";
1584
- var Certainty = z26.enum(Quality).describe(certaintyDescription);
1585
- var certaintySchema = {
1586
- type: "string",
1587
- enum: Quality,
1588
- description: certaintyDescription
1451
+ var descriptionMotivation = "The relationship between an Annotation and a Motivation.";
1452
+ var Motivation = z26.union([
1453
+ z26.literal("oa:identifying"),
1454
+ z26.literal("oa:describing"),
1455
+ z26.literal("correcting"),
1456
+ z26.literal("oa:tagging"),
1457
+ z26.literal("oa:classifying"),
1458
+ z26.literal("oa:linking"),
1459
+ z26.literal("citing")
1460
+ ]).describe(descriptionMotivation);
1461
+ var MotivationSchema = {
1462
+ oneOf: [
1463
+ { type: "string", const: "oa:identifying" },
1464
+ { type: "string", const: "oa:describing" },
1465
+ { type: "string", const: "correcting" },
1466
+ { type: "string", const: "oa:tagging" },
1467
+ { type: "string", const: "oa:classifying" },
1468
+ { type: "string", const: "oa:linking" },
1469
+ { type: "string", const: "citing" }
1470
+ ],
1471
+ description: descriptionMotivation
1472
+ };
1473
+ var descriptionCertainty = "Indicates the degree of certainty associated with some aspect of an assertion, description, identification, or entity linked to the annotation body.";
1474
+ var Certainty = z26.union([
1475
+ z26.literal("edit:qualityLowCertainty"),
1476
+ z26.literal("edit:qualityMediumCertainty"),
1477
+ z26.literal("edit:qualityHighCertainty"),
1478
+ z26.literal("edit:qualityUnknownCertainty")
1479
+ ]).describe(descriptionCertainty);
1480
+ var CertaintySchema = {
1481
+ oneOf: [
1482
+ { type: "string", const: "edit:qualityLowCertainty" },
1483
+ { type: "string", const: "edit:qualityMediumCertainty" },
1484
+ { type: "string", const: "edit:qualityHighCertainty" },
1485
+ { type: "string", const: "edit:qualityUnknownCertainty" }
1486
+ ],
1487
+ description: descriptionCertainty
1589
1488
  };
1590
1489
  var precisionDescription = "Indicates the degree of precision associated with the location of the entity linked to the annotation body.";
1591
- var Precision = z26.enum(Quality).describe(precisionDescription);
1592
- var precisionSchema = {
1593
- type: "string",
1594
- enum: Quality,
1490
+ var Precision = z26.union([
1491
+ z26.literal("edit:qualityLowPrecision"),
1492
+ z26.literal("edit:qualityMediumPrecision"),
1493
+ z26.literal("edit:qualityHighPrecision"),
1494
+ z26.literal("edit:qualityUnknownPrecision")
1495
+ ]).describe(precisionDescription);
1496
+ var PrecisionSchema = {
1497
+ oneOf: [
1498
+ { type: "string", const: "edit:qualityLowPrecision" },
1499
+ { type: "string", const: "edit:qualityMediumPrecision" },
1500
+ { type: "string", const: "edit:qualityHighPrecision" },
1501
+ { type: "string", const: "edit:qualityUnknownPrecision" }
1502
+ ],
1595
1503
  description: precisionDescription
1596
1504
  };
1597
1505
 
@@ -1616,15 +1524,6 @@ var definitionSchema = {
1616
1524
 
1617
1525
  // src/v1/schema/root.ts
1618
1526
  import { z as z27 } from "zod";
1619
- var Motivation = [
1620
- "oa:identifying",
1621
- "oa:describing",
1622
- "correcting",
1623
- "oa:tagging",
1624
- "oa:classifying",
1625
- "oa:linking",
1626
- "citing"
1627
- ];
1628
1527
  var WebAnnotation = z27.object({
1629
1528
  "@context": z27.tuple([
1630
1529
  z27.literal("http://www.w3.org/ns/anno.jsonld").describe("W3C Web Annotation Context."),
@@ -1635,21 +1534,26 @@ var WebAnnotation = z27.object({
1635
1534
  ),
1636
1535
  id: z27.string().url().describe("The identity of the Annotation."),
1637
1536
  type: z27.tuple([z27.literal("Annotation"), z27.literal("crm:E33_Linguistic_Object")]).describe("The type of the Annotation."),
1638
- motivation: z27.enum(Motivation).describe("The relationship between an Annotation and a Motivation."),
1537
+ motivation: Motivation,
1639
1538
  created: z27.string().datetime().describe("The time at which the resource was created."),
1640
1539
  modified: z27.string().datetime().optional().describe("The time at which the resource was modified, after creation."),
1641
- creator: z27.union([User, Group, Software]).describe("The agent responsible for creating the resource.").optional(),
1642
- contributor: z27.array(z27.union([User, Group, Software])).nonempty().optional().describe("The agents responsible for modifying the resource."),
1540
+ creator: z27.union([User, Group]).describe("The agent responsible for creating the resource.").optional(),
1541
+ contributor: z27.array(z27.union([User, Group])).nonempty().optional().describe("The agents responsible for modifying the resource."),
1643
1542
  generator: Software.describe(
1644
1543
  "The agent responsible for generating the serialization of the Annotation. "
1645
1544
  ),
1646
1545
  target: z27.union([Target, z27.array(Target)]).describe("The relationship between an Annotation and its Target."),
1647
1546
  body: z27.union([BodyChoice, Body, z27.array(Body)]).describe("The relationship between an Annotation and its Body."),
1648
- certainty: Certainty.optional(),
1649
- precision: Precision.optional(),
1650
1547
  label: z27.string().min(1, { message: "The label cannot be empty" }).optional().describe("The descriptive label for the annotation"),
1651
- P2_has_type: z27.union([z27.string().min(3), z27.array(z27.string().min(3)).min(1)]).optional()
1548
+ P2_has_type: z27.tuple([Motivation]).rest(z27.union([Certainty, Precision]).optional())
1652
1549
  }).describe("Web Annotation Root");
1550
+ var p2HasTypeSchema = {
1551
+ type: "array",
1552
+ minItems: 1,
1553
+ maxItems: 3,
1554
+ items: [{ ...MotivationSchema }],
1555
+ additionalItems: { oneOf: [CertaintySchema, PrecisionSchema] }
1556
+ };
1653
1557
  var webAnnotationSchema = {
1654
1558
  $id: schemaId,
1655
1559
  type: "object",
@@ -1681,11 +1585,7 @@ var webAnnotationSchema = {
1681
1585
  ],
1682
1586
  description: "The type of the Annotation."
1683
1587
  },
1684
- motivation: {
1685
- type: "string",
1686
- enum: Motivation,
1687
- description: "The relationship between an Annotation and a Motivation."
1688
- },
1588
+ motivation: MotivationSchema,
1689
1589
  created: {
1690
1590
  type: "string",
1691
1591
  format: "date-time",
@@ -1699,8 +1599,7 @@ var webAnnotationSchema = {
1699
1599
  creator: {
1700
1600
  oneOf: [
1701
1601
  { $ref: "defs.jsonld#/definitions/user" },
1702
- { $ref: "defs.jsonld#/definitions/group" },
1703
- { $ref: "defs.jsonld#/definitions/software" }
1602
+ { $ref: "defs.jsonld#/definitions/group" }
1704
1603
  ]
1705
1604
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1706
1605
  },
@@ -1740,25 +1639,20 @@ var webAnnotationSchema = {
1740
1639
  }
1741
1640
  ]
1742
1641
  },
1743
- certainty: certaintySchema,
1744
- precision: precisionSchema,
1745
1642
  label: { type: "string" },
1746
- P2_has_type: {
1747
- oneOf: [
1748
- { type: "string", minLength: 3 },
1749
- {
1750
- type: "array",
1751
- minItems: 1,
1752
- items: {
1753
- type: "string",
1754
- minLength: 3
1755
- },
1756
- uniqueItems: true
1757
- }
1758
- ]
1759
- }
1643
+ P2_has_type: p2HasTypeSchema
1760
1644
  },
1761
- required: ["@context", "id", "type", "motivation", "created", "generator", "target", "body"],
1645
+ required: [
1646
+ "@context",
1647
+ "id",
1648
+ "type",
1649
+ "motivation",
1650
+ "created",
1651
+ "generator",
1652
+ "target",
1653
+ "body",
1654
+ "P2_has_type"
1655
+ ],
1762
1656
  additionalProperties: false,
1763
1657
  allOf: [
1764
1658
  {
@@ -1768,16 +1662,16 @@ var webAnnotationSchema = {
1768
1662
  body: {
1769
1663
  type: "object",
1770
1664
  properties: {
1771
- entityType: {
1665
+ type: {
1772
1666
  oneOf: [
1773
- personEntityTypeSchema,
1774
- placeEntityTypeSchema,
1775
- organizationEntityTypeSchema,
1776
- workEntityTypeSchema,
1777
- physicalThingEntityTypeSchema,
1778
- conceptualObjectEntityTypeSchema,
1779
- dateEntityTypeSchema,
1780
- eventEntityTypeSchema
1667
+ typePersonSchema,
1668
+ typePlaceSchema,
1669
+ typeOrganizationSchema,
1670
+ typeWorkSchema,
1671
+ typePhysicalThingSchema,
1672
+ typeConceptualObjectSchema,
1673
+ typeDateSchema,
1674
+ typeEventSchema
1781
1675
  ]
1782
1676
  }
1783
1677
  }
@@ -1787,7 +1681,14 @@ var webAnnotationSchema = {
1787
1681
  then: {
1788
1682
  type: "object",
1789
1683
  properties: {
1790
- motivation: { type: "string", const: "oa:identifying" }
1684
+ motivation: { type: "string", const: "oa:identifying" },
1685
+ P2_has_type: {
1686
+ type: "array",
1687
+ minItems: 1,
1688
+ maxItems: 3,
1689
+ items: [{ type: "string", const: "oa:identifying" }],
1690
+ additionalItems: { oneOf: [CertaintySchema, PrecisionSchema] }
1691
+ }
1791
1692
  }
1792
1693
  },
1793
1694
  else: {
@@ -1797,7 +1698,7 @@ var webAnnotationSchema = {
1797
1698
  body: {
1798
1699
  type: "object",
1799
1700
  properties: {
1800
- entityType: noteEntityTypeSchema
1701
+ type: typeNoteSchema
1801
1702
  }
1802
1703
  }
1803
1704
  }
@@ -1805,7 +1706,11 @@ var webAnnotationSchema = {
1805
1706
  then: {
1806
1707
  type: "object",
1807
1708
  properties: {
1808
- motivation: { type: "string", const: "oa:describing" }
1709
+ motivation: { type: "string", const: "oa:describing" },
1710
+ P2_has_type: {
1711
+ ...p2HasTypeSchema,
1712
+ items: [{ type: "string", const: "oa:describing" }]
1713
+ }
1809
1714
  }
1810
1715
  },
1811
1716
  else: {
@@ -1815,7 +1720,7 @@ var webAnnotationSchema = {
1815
1720
  body: {
1816
1721
  type: "object",
1817
1722
  properties: {
1818
- entityType: correctionEntityTypeSchema
1723
+ type: typeCorrectionSchema
1819
1724
  }
1820
1725
  }
1821
1726
  }
@@ -1823,7 +1728,11 @@ var webAnnotationSchema = {
1823
1728
  then: {
1824
1729
  type: "object",
1825
1730
  properties: {
1826
- motivation: { type: "string", const: "correcting" }
1731
+ motivation: { type: "string", const: "correcting" },
1732
+ P2_has_type: {
1733
+ ...p2HasTypeSchema,
1734
+ items: [{ type: "string", const: "correcting" }]
1735
+ }
1827
1736
  }
1828
1737
  },
1829
1738
  else: {
@@ -1833,7 +1742,7 @@ var webAnnotationSchema = {
1833
1742
  body: {
1834
1743
  type: "object",
1835
1744
  properties: {
1836
- entityType: keywordFolksnomyEntityTypeSchema
1745
+ type: typeKeywordFolksnomy
1837
1746
  }
1838
1747
  }
1839
1748
  }
@@ -1841,7 +1750,11 @@ var webAnnotationSchema = {
1841
1750
  then: {
1842
1751
  type: "object",
1843
1752
  properties: {
1844
- motivation: { type: "string", const: "oa:tagging" }
1753
+ motivation: { type: "string", const: "oa:tagging" },
1754
+ P2_has_type: {
1755
+ ...p2HasTypeSchema,
1756
+ items: [{ type: "string", const: "oa:tagging" }]
1757
+ }
1845
1758
  }
1846
1759
  },
1847
1760
  else: {
@@ -1851,7 +1764,7 @@ var webAnnotationSchema = {
1851
1764
  body: {
1852
1765
  type: "object",
1853
1766
  properties: {
1854
- entityType: keywordEntityTypeSchema
1767
+ type: typeKeywordSchema
1855
1768
  }
1856
1769
  }
1857
1770
  }
@@ -1859,7 +1772,11 @@ var webAnnotationSchema = {
1859
1772
  then: {
1860
1773
  type: "object",
1861
1774
  properties: {
1862
- motivation: { type: "string", const: "oa:classifying" }
1775
+ motivation: { type: "string", const: "oa:classifying" },
1776
+ P2_has_type: {
1777
+ ...p2HasTypeSchema,
1778
+ items: [{ type: "string", const: "oa:classifying" }]
1779
+ }
1863
1780
  }
1864
1781
  },
1865
1782
  else: {
@@ -1869,7 +1786,7 @@ var webAnnotationSchema = {
1869
1786
  body: {
1870
1787
  type: "object",
1871
1788
  properties: {
1872
- entityType: linkEntityTypeSchema
1789
+ type: typeLinkSchema
1873
1790
  }
1874
1791
  }
1875
1792
  }
@@ -1877,7 +1794,11 @@ var webAnnotationSchema = {
1877
1794
  then: {
1878
1795
  type: "object",
1879
1796
  properties: {
1880
- motivation: { type: "string", const: "oa:linking" }
1797
+ motivation: { type: "string", const: "oa:linking" },
1798
+ P2_has_type: {
1799
+ ...p2HasTypeSchema,
1800
+ items: [{ type: "string", const: "oa:linking" }]
1801
+ }
1881
1802
  }
1882
1803
  },
1883
1804
  else: {
@@ -1887,7 +1808,7 @@ var webAnnotationSchema = {
1887
1808
  body: {
1888
1809
  type: "object",
1889
1810
  properties: {
1890
- entityType: citationEntityTypeSchema
1811
+ type: typeCitationSchema
1891
1812
  }
1892
1813
  }
1893
1814
  }
@@ -1895,7 +1816,11 @@ var webAnnotationSchema = {
1895
1816
  then: {
1896
1817
  type: "object",
1897
1818
  properties: {
1898
- motivation: { type: "string", const: "citing" }
1819
+ motivation: { type: "string", const: "citing" },
1820
+ P2_has_type: {
1821
+ ...p2HasTypeSchema,
1822
+ items: [{ type: "string", const: "citing" }]
1823
+ }
1899
1824
  }
1900
1825
  }
1901
1826
  }
@@ -1904,6 +1829,41 @@ var webAnnotationSchema = {
1904
1829
  }
1905
1830
  }
1906
1831
  }
1832
+ },
1833
+ {
1834
+ if: {
1835
+ type: "object",
1836
+ properties: {
1837
+ body: {
1838
+ type: "object",
1839
+ properties: {
1840
+ type: { type: "string", const: "Choice" }
1841
+ }
1842
+ }
1843
+ }
1844
+ },
1845
+ then: {
1846
+ type: "object",
1847
+ properties: {
1848
+ body: { $ref: "defs.jsonld#/definitions/bodyChoice" }
1849
+ }
1850
+ },
1851
+ else: {
1852
+ type: "object",
1853
+ properties: {
1854
+ body: {
1855
+ oneOf: [
1856
+ { $ref: "defs.jsonld#/definitions/body" },
1857
+ {
1858
+ type: "array",
1859
+ items: { $ref: "defs.jsonld#/definitions/body" },
1860
+ minItems: 1
1861
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1862
+ }
1863
+ ]
1864
+ }
1865
+ }
1866
+ }
1907
1867
  }
1908
1868
  ]
1909
1869
  };
@@ -1932,7 +1892,8 @@ var ValidateResult = z28.object({
1932
1892
  var ajv = new Ajv({
1933
1893
  code: { source: true },
1934
1894
  allErrors: true,
1935
- allowUnionTypes: true
1895
+ allowUnionTypes: true,
1896
+ strictTuples: false
1936
1897
  }).addSchema([webAnnotationSchema, definitionSchema]);
1937
1898
  addFormats(ajv);
1938
1899
  var validator = ajv.compile(webAnnotationSchema);
@@ -1960,42 +1921,32 @@ var v1_exports = {};
1960
1921
  __export(v1_exports, {
1961
1922
  Body: () => Body,
1962
1923
  BodyChoice: () => BodyChoice,
1963
- BodyEntityType: () => BodyEntityType,
1964
1924
  Certainty: () => Certainty,
1925
+ CertaintySchema: () => CertaintySchema,
1965
1926
  Citation: () => Citation,
1966
- CitationEntityType: () => CitationEntityType,
1967
1927
  ConceptualObject: () => ConceptualObject,
1968
- ConceptualObjectEntityType: () => ConceptualObjectEntityType,
1969
1928
  Correction: () => Correction,
1970
- CorrectionEntityType: () => CorrectionEntityType,
1929
+ CssSelector: () => CssSelector,
1930
+ CssSelectorExtended: () => CssSelectorExtended,
1971
1931
  DATE_RANGE_PATTERN: () => DATE_RANGE_PATTERN,
1972
1932
  Date: () => Date,
1973
- DateEntityType: () => DateEntityType,
1974
1933
  Description: () => Description,
1975
1934
  Event: () => Event,
1976
- EventEntityType: () => EventEntityType,
1977
1935
  Group: () => Group,
1978
1936
  Keyword: () => Keyword,
1979
- KeywordEntityType: () => KeywordEntityType,
1980
1937
  KeywordFolksnomy: () => KeywordFolksnomy,
1981
- KeywordFolksnomyEntityType: () => KeywordFolksnomyEntityType,
1982
1938
  Label: () => Label,
1983
1939
  Link: () => Link,
1984
- LinkEntityType: () => LinkEntityType,
1985
1940
  ModeExistence: () => ModeExistence,
1986
1941
  Motivation: () => Motivation,
1942
+ MotivationSchema: () => MotivationSchema,
1987
1943
  Note: () => Note,
1988
- NoteEntityType: () => NoteEntityType,
1989
1944
  Organization: () => Organization,
1990
- OrganizationEntityType: () => OrganizationEntityType,
1991
1945
  Person: () => Person,
1992
- PersonEntityType: () => PersonEntityType,
1993
1946
  PhysicalThing: () => PhysicalThing,
1994
- PhysicalThingEntityType: () => PhysicalThingEntityType,
1995
1947
  Place: () => Place,
1996
- PlaceEntityType: () => PlaceEntityType,
1997
1948
  Precision: () => Precision,
1998
- Quality: () => Quality,
1949
+ PrecisionSchema: () => PrecisionSchema,
1999
1950
  RangeSelector: () => RangeSelector,
2000
1951
  Selector: () => Selector,
2001
1952
  Software: () => Software,
@@ -2005,59 +1956,60 @@ __export(v1_exports, {
2005
1956
  TextPositionSelectorExtended: () => TextPositionSelectorExtended,
2006
1957
  TextQuoteSelector: () => TextQuoteSelector,
2007
1958
  TextQuoteSelectorExtended: () => TextQuoteSelectorExtended,
1959
+ TypeBody: () => TypeBody,
1960
+ TypeCitation: () => TypeCitation,
1961
+ TypeConceptualObject: () => TypeConceptualObject,
1962
+ TypeCorrection: () => TypeCorrection,
1963
+ TypeDate: () => TypeDate,
1964
+ TypeEvent: () => TypeEvent,
1965
+ TypeKeyword: () => TypeKeyword,
1966
+ TypeKeywordFolksnomy: () => TypeKeywordFolksnomy,
1967
+ TypeLink: () => TypeLink,
1968
+ TypeNote: () => TypeNote,
1969
+ TypeOrganization: () => TypeOrganization,
1970
+ TypePerson: () => TypePerson,
1971
+ TypePhysicalThing: () => TypePhysicalThing,
1972
+ TypePlace: () => TypePlace,
1973
+ TypeWork: () => TypeWork,
2008
1974
  User: () => User,
2009
1975
  VERSION: () => VERSION,
2010
1976
  ValidateResult: () => ValidateResult,
2011
1977
  ValidationError: () => ValidationError,
2012
1978
  WebAnnotation: () => WebAnnotation,
2013
1979
  Work: () => Work,
2014
- WorkEntityType: () => WorkEntityType,
2015
1980
  XpathSelector: () => XpathSelector,
2016
1981
  XpathSelectorExtended: () => XpathSelectorExtended,
2017
1982
  ajv: () => ajv,
2018
1983
  bodyChoiceSchema: () => bodyChoiceSchema,
2019
- bodyEntityTypeSchema: () => bodyEntityTypeSchema,
2020
1984
  bodyIdDescription: () => bodyIdDescription,
2021
1985
  bodySchema: () => bodySchema,
2022
- certaintySchema: () => certaintySchema,
2023
- citationEntityTypeSchema: () => citationEntityTypeSchema,
2024
1986
  citationSchema: () => citationSchema,
2025
- conceptualObjectEntityTypeSchema: () => conceptualObjectEntityTypeSchema,
2026
1987
  conceptualObjectSchema: () => conceptualObjectSchema,
2027
1988
  contextUri: () => contextUri,
2028
- correctionEntityTypeSchema: () => correctionEntityTypeSchema,
2029
1989
  correctionSchema: () => correctionSchema,
2030
- dateEntityTypeSchema: () => dateEntityTypeSchema,
1990
+ cssSelectorExtendedSchema: () => cssSelectorExtendedSchema,
1991
+ cssSelectorSchema: () => cssSelectorSchema,
2031
1992
  dateSchema: () => dateSchema,
2032
1993
  definitionSchema: () => definitionSchema,
2033
1994
  defsId: () => defsId,
2034
1995
  descriptionSchema: () => descriptionSchema,
2035
- eventEntityTypeSchema: () => eventEntityTypeSchema,
2036
1996
  eventSchema: () => eventSchema,
2037
1997
  formatSchema: () => formatSchema,
2038
1998
  groupSchema: () => groupSchema,
2039
1999
  isIdentifiedBy: () => isIdentifiedBy,
2040
2000
  isIndentifyBySchema: () => isIndentifyBySchema,
2041
- keywordEntityTypeSchema: () => keywordEntityTypeSchema,
2042
- keywordFolksnomyEntityTypeSchema: () => keywordFolksnomyEntityTypeSchema,
2043
2001
  keywordFolksnomySchema: () => keywordFolksnomySchema,
2044
2002
  keywordSchema: () => keywordSchema,
2045
2003
  labelSchema: () => labelSchema,
2046
2004
  languageSchema: () => languageSchema,
2047
- linkEntityTypeSchema: () => linkEntityTypeSchema,
2048
2005
  linkSchema: () => linkSchema,
2049
2006
  modeExistenceSchema: () => modeExistenceSchema,
2050
- noteEntityTypeSchema: () => noteEntityTypeSchema,
2051
2007
  noteSchema: () => noteSchema,
2052
- organizationEntityTypeSchema: () => organizationEntityTypeSchema,
2053
2008
  organizationSchema: () => organizationSchema,
2054
- personEntityTypeSchema: () => personEntityTypeSchema,
2009
+ p2HasTypeSchema: () => p2HasTypeSchema,
2055
2010
  personSchema: () => personSchema,
2056
- physicalThingEntityTypeSchema: () => physicalThingEntityTypeSchema,
2057
2011
  physicalThingSchema: () => physicalThingSchema,
2058
- placeEntityTypeSchema: () => placeEntityTypeSchema,
2059
2012
  placeSchema: () => placeSchema,
2060
- precisionSchema: () => precisionSchema,
2061
2013
  rangeSelectorSchema: () => rangeSelectorSchema,
2062
2014
  schemaContext: () => schemaContext,
2063
2015
  schemaId: () => schemaId,
@@ -2071,11 +2023,25 @@ __export(v1_exports, {
2071
2023
  textPositionSelectorSchema: () => textPositionSelectorSchema,
2072
2024
  textQuoteSelectorExtendedSchema: () => textQuoteSelectorExtendedSchema,
2073
2025
  textQuoteSelectorSchema: () => textQuoteSelectorSchema,
2026
+ typeBodySchema: () => typeBodySchema,
2027
+ typeCitationSchema: () => typeCitationSchema,
2028
+ typeConceptualObjectSchema: () => typeConceptualObjectSchema,
2029
+ typeCorrectionSchema: () => typeCorrectionSchema,
2030
+ typeDateSchema: () => typeDateSchema,
2031
+ typeEventSchema: () => typeEventSchema,
2032
+ typeKeywordFolksnomy: () => typeKeywordFolksnomy,
2033
+ typeKeywordSchema: () => typeKeywordSchema,
2034
+ typeLinkSchema: () => typeLinkSchema,
2035
+ typeNoteSchema: () => typeNoteSchema,
2036
+ typeOrganizationSchema: () => typeOrganizationSchema,
2037
+ typePersonSchema: () => typePersonSchema,
2038
+ typePhysicalThingSchema: () => typePhysicalThingSchema,
2039
+ typePlaceSchema: () => typePlaceSchema,
2040
+ typeWorkSchema: () => typeWorkSchema,
2074
2041
  userSchema: () => userSchema,
2075
2042
  validate: () => validate,
2076
2043
  validator: () => validator,
2077
2044
  webAnnotationSchema: () => webAnnotationSchema,
2078
- workEntityTypeSchema: () => workEntityTypeSchema,
2079
2045
  workSchema: () => workSchema,
2080
2046
  xpathSelectorExtendedSchema: () => xpathSelectorExtendedSchema,
2081
2047
  xpathSelectorSchema: () => xpathSelectorSchema
@@ -2083,42 +2049,32 @@ __export(v1_exports, {
2083
2049
  export {
2084
2050
  Body,
2085
2051
  BodyChoice,
2086
- BodyEntityType,
2087
2052
  Certainty,
2053
+ CertaintySchema,
2088
2054
  Citation,
2089
- CitationEntityType,
2090
2055
  ConceptualObject,
2091
- ConceptualObjectEntityType,
2092
2056
  Correction,
2093
- CorrectionEntityType,
2057
+ CssSelector,
2058
+ CssSelectorExtended,
2094
2059
  DATE_RANGE_PATTERN,
2095
2060
  Date,
2096
- DateEntityType,
2097
2061
  Description,
2098
2062
  Event,
2099
- EventEntityType,
2100
2063
  Group,
2101
2064
  Keyword,
2102
- KeywordEntityType,
2103
2065
  KeywordFolksnomy,
2104
- KeywordFolksnomyEntityType,
2105
2066
  Label,
2106
2067
  Link,
2107
- LinkEntityType,
2108
2068
  ModeExistence,
2109
2069
  Motivation,
2070
+ MotivationSchema,
2110
2071
  Note,
2111
- NoteEntityType,
2112
2072
  Organization,
2113
- OrganizationEntityType,
2114
2073
  Person,
2115
- PersonEntityType,
2116
2074
  PhysicalThing,
2117
- PhysicalThingEntityType,
2118
2075
  Place,
2119
- PlaceEntityType,
2120
2076
  Precision,
2121
- Quality,
2077
+ PrecisionSchema,
2122
2078
  RangeSelector,
2123
2079
  Selector,
2124
2080
  Software,
@@ -2128,59 +2084,60 @@ export {
2128
2084
  TextPositionSelectorExtended,
2129
2085
  TextQuoteSelector,
2130
2086
  TextQuoteSelectorExtended,
2087
+ TypeBody,
2088
+ TypeCitation,
2089
+ TypeConceptualObject,
2090
+ TypeCorrection,
2091
+ TypeDate,
2092
+ TypeEvent,
2093
+ TypeKeyword,
2094
+ TypeKeywordFolksnomy,
2095
+ TypeLink,
2096
+ TypeNote,
2097
+ TypeOrganization,
2098
+ TypePerson,
2099
+ TypePhysicalThing,
2100
+ TypePlace,
2101
+ TypeWork,
2131
2102
  User,
2132
2103
  VERSION,
2133
2104
  ValidateResult,
2134
2105
  ValidationError,
2135
2106
  WebAnnotation,
2136
2107
  Work,
2137
- WorkEntityType,
2138
2108
  XpathSelector,
2139
2109
  XpathSelectorExtended,
2140
2110
  ajv,
2141
2111
  bodyChoiceSchema,
2142
- bodyEntityTypeSchema,
2143
2112
  bodyIdDescription,
2144
2113
  bodySchema,
2145
- certaintySchema,
2146
- citationEntityTypeSchema,
2147
2114
  citationSchema,
2148
- conceptualObjectEntityTypeSchema,
2149
2115
  conceptualObjectSchema,
2150
2116
  contextUri,
2151
- correctionEntityTypeSchema,
2152
2117
  correctionSchema,
2153
- dateEntityTypeSchema,
2118
+ cssSelectorExtendedSchema,
2119
+ cssSelectorSchema,
2154
2120
  dateSchema,
2155
2121
  definitionSchema,
2156
2122
  defsId,
2157
2123
  descriptionSchema,
2158
- eventEntityTypeSchema,
2159
2124
  eventSchema,
2160
2125
  formatSchema,
2161
2126
  groupSchema,
2162
2127
  isIdentifiedBy,
2163
2128
  isIndentifyBySchema,
2164
- keywordEntityTypeSchema,
2165
- keywordFolksnomyEntityTypeSchema,
2166
2129
  keywordFolksnomySchema,
2167
2130
  keywordSchema,
2168
2131
  labelSchema,
2169
2132
  languageSchema,
2170
- linkEntityTypeSchema,
2171
2133
  linkSchema,
2172
2134
  modeExistenceSchema,
2173
- noteEntityTypeSchema,
2174
2135
  noteSchema,
2175
- organizationEntityTypeSchema,
2176
2136
  organizationSchema,
2177
- personEntityTypeSchema,
2137
+ p2HasTypeSchema,
2178
2138
  personSchema,
2179
- physicalThingEntityTypeSchema,
2180
2139
  physicalThingSchema,
2181
- placeEntityTypeSchema,
2182
2140
  placeSchema,
2183
- precisionSchema,
2184
2141
  rangeSelectorSchema,
2185
2142
  schemaContext,
2186
2143
  schemaId,
@@ -2194,12 +2151,26 @@ export {
2194
2151
  textPositionSelectorSchema,
2195
2152
  textQuoteSelectorExtendedSchema,
2196
2153
  textQuoteSelectorSchema,
2154
+ typeBodySchema,
2155
+ typeCitationSchema,
2156
+ typeConceptualObjectSchema,
2157
+ typeCorrectionSchema,
2158
+ typeDateSchema,
2159
+ typeEventSchema,
2160
+ typeKeywordFolksnomy,
2161
+ typeKeywordSchema,
2162
+ typeLinkSchema,
2163
+ typeNoteSchema,
2164
+ typeOrganizationSchema,
2165
+ typePersonSchema,
2166
+ typePhysicalThingSchema,
2167
+ typePlaceSchema,
2168
+ typeWorkSchema,
2197
2169
  userSchema,
2198
2170
  v1_exports as v1,
2199
2171
  validate,
2200
2172
  validator,
2201
2173
  webAnnotationSchema,
2202
- workEntityTypeSchema,
2203
2174
  workSchema,
2204
2175
  xpathSelectorExtendedSchema,
2205
2176
  xpathSelectorSchema