@lincs.project/webannotation-schema 1.11.0 → 1.13.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 +3984 -489
- package/dist/index.d.ts +3984 -489
- package/dist/index.js +215 -92
- package/dist/index.mjs +212 -91
- package/dist/v1/jsonld/context.jsonld +2 -1
- package/dist/v1/jsonld/defs.jsonld +188 -27
- package/dist/v1/jsonld/schema.jsonld +36 -5
- package/dist/v1/standalone/linc-wa-validator.js +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -13,14 +13,15 @@ var defsId = `https://wa.lincsproject.ca/${VERSION}/defs.jsonld`;
|
|
|
13
13
|
// src/v1/schema/context.ts
|
|
14
14
|
var schemaContext = {
|
|
15
15
|
"@context": {
|
|
16
|
+
biography: "http://id.lincsproject.ca/biography/",
|
|
16
17
|
bf: "http://www.openlinksw.com/schemas/bif#",
|
|
17
18
|
cito: "http://purl.org/spar/cito/",
|
|
19
|
+
crmdig: "http://www.ics.forth.gr/isl/CRMdig/",
|
|
18
20
|
cwrc: "http://id.lincsproject.ca/cwrc/",
|
|
19
21
|
edit: "http://id.lincsproject.ca/edit/",
|
|
20
22
|
fabio: "https://purl.org/spar/fabio/",
|
|
21
23
|
frbroo: "http://iflastandards.info/ns/fr/frbr/frbroo/",
|
|
22
24
|
wikidata: "http://www.wikidata.org/entity/",
|
|
23
|
-
crmdig: "http://www.ics.forth.gr/isl/CRMdig/",
|
|
24
25
|
citing: "edit:citing",
|
|
25
26
|
correcting: "edit:correcting",
|
|
26
27
|
"oa:identifying": {
|
|
@@ -65,43 +66,64 @@ var schemaContext = {
|
|
|
65
66
|
}
|
|
66
67
|
};
|
|
67
68
|
|
|
68
|
-
// src/v1/schema/definitions/
|
|
69
|
+
// src/v1/schema/definitions/agents.ts
|
|
69
70
|
import { z } from "zod";
|
|
70
|
-
var userIdDescription = "The IRI that identifies the agent (Creator or Contributor).";
|
|
71
71
|
var User = z.object({
|
|
72
|
-
id: z.string().url()
|
|
73
|
-
type: z.literal("crm:E21_Person")
|
|
74
|
-
name: z.string().min(1, { message: "Cannot be empty" }).describe(
|
|
72
|
+
id: z.string().url(),
|
|
73
|
+
type: z.literal("crm:E21_Person"),
|
|
74
|
+
name: z.string().min(1, { message: "Cannot be empty" }).describe(`The person's name.`)
|
|
75
75
|
}).describe("Human Agent");
|
|
76
|
-
var
|
|
76
|
+
var userSchema = {
|
|
77
77
|
type: "object",
|
|
78
|
-
description: "
|
|
78
|
+
description: "User Agent",
|
|
79
79
|
properties: {
|
|
80
|
-
id: { type: "string", format: "uri"
|
|
80
|
+
id: { type: "string", format: "uri" },
|
|
81
81
|
type: { type: "string", const: "crm:E21_Person" },
|
|
82
|
-
name: { type: "string", minLength: 1, description:
|
|
82
|
+
name: { type: "string", minLength: 1, description: `The person's name.` }
|
|
83
|
+
},
|
|
84
|
+
required: ["id", "type", "name"]
|
|
85
|
+
};
|
|
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
|
+
var groupSchema = {
|
|
92
|
+
type: "object",
|
|
93
|
+
description: "Group Agent",
|
|
94
|
+
properties: {
|
|
95
|
+
id: { type: "string", format: "uri" },
|
|
96
|
+
type: { type: "string", const: "crm:E74_Group" },
|
|
97
|
+
name: { type: "string", minLength: 1, description: `The group's name.` }
|
|
83
98
|
},
|
|
84
99
|
required: ["id", "type", "name"]
|
|
85
100
|
};
|
|
86
|
-
var softwareIdDescription = "The IRI that identifies the agent (software).";
|
|
87
101
|
var Software = z.object({
|
|
88
|
-
id: z.string().url()
|
|
89
|
-
type: z.literal("Software").
|
|
102
|
+
id: z.string().url(),
|
|
103
|
+
type: z.tuple([z.literal("Software"), z.literal("crm:E73_Information_Object")]),
|
|
90
104
|
P16_used_specific_object: z.string().url().optional().describe("The URI that identifies the agent (software)"),
|
|
91
|
-
|
|
105
|
+
name: z.string().min(1).describe(`The software's name.`),
|
|
92
106
|
softwareVersion: z.string().optional().describe("The software version.")
|
|
93
107
|
}).describe("Software Agent");
|
|
94
108
|
var softwareSchema = {
|
|
95
109
|
type: "object",
|
|
96
110
|
description: "Software Agent",
|
|
97
111
|
properties: {
|
|
98
|
-
id: { type: "string", format: "uri"
|
|
99
|
-
type: {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
112
|
+
id: { type: "string", format: "uri" },
|
|
113
|
+
type: {
|
|
114
|
+
type: "array",
|
|
115
|
+
minItems: 2,
|
|
116
|
+
maxItems: 2,
|
|
117
|
+
items: [
|
|
118
|
+
{ type: "string", const: "Software" },
|
|
119
|
+
{ type: "string", const: "crm:E73_Information_Object" }
|
|
120
|
+
]
|
|
121
|
+
},
|
|
122
|
+
P16_used_specific_object: { type: "string", format: "uri", nullable: true },
|
|
123
|
+
name: { type: "string", minLength: 1, description: `The software's name.` },
|
|
124
|
+
softwareVersion: { type: "string", nullable: true, description: "The software version." }
|
|
103
125
|
},
|
|
104
|
-
required: ["id", "type", "
|
|
126
|
+
required: ["id", "type", "name"]
|
|
105
127
|
};
|
|
106
128
|
|
|
107
129
|
// src/v1/schema/definitions/body/index.ts
|
|
@@ -700,8 +722,8 @@ var physicalThingSchema = {
|
|
|
700
722
|
// src/v1/schema/definitions/body/place.ts
|
|
701
723
|
import { z as z14 } from "zod";
|
|
702
724
|
var PlaceEntityType = z14.union([
|
|
703
|
-
z14.literal("
|
|
704
|
-
z14.tuple([z14.literal("
|
|
725
|
+
z14.literal("crm:E53_Place"),
|
|
726
|
+
z14.tuple([z14.literal("biography:fictionalPlace"), z14.literal("crm:E89_Propositional_Object")])
|
|
705
727
|
]);
|
|
706
728
|
var Place = z14.object({
|
|
707
729
|
id: z14.string().url().describe(bodyIdDescription),
|
|
@@ -712,13 +734,13 @@ var Place = z14.object({
|
|
|
712
734
|
}).describe("Place");
|
|
713
735
|
var placeEntityTypeSchema = {
|
|
714
736
|
oneOf: [
|
|
715
|
-
{ type: "string", const: "
|
|
737
|
+
{ type: "string", const: "crm:E53_Place" },
|
|
716
738
|
{
|
|
717
739
|
type: "array",
|
|
718
740
|
minItems: 2,
|
|
719
741
|
maxItems: 2,
|
|
720
742
|
items: [
|
|
721
|
-
{ type: "string", const: "
|
|
743
|
+
{ type: "string", const: "biography:fictionalPlace" },
|
|
722
744
|
{ type: "string", const: "crm:E89_Propositional_Object" }
|
|
723
745
|
]
|
|
724
746
|
}
|
|
@@ -746,13 +768,13 @@ var placeSchema = {
|
|
|
746
768
|
then: {
|
|
747
769
|
type: "object",
|
|
748
770
|
properties: {
|
|
749
|
-
entityType: "
|
|
771
|
+
entityType: "crm:E53_Place"
|
|
750
772
|
}
|
|
751
773
|
},
|
|
752
774
|
else: {
|
|
753
775
|
type: "object",
|
|
754
776
|
properties: {
|
|
755
|
-
entityType: ["
|
|
777
|
+
entityType: ["biography:fictionalPlace", "crm:E89_Propositional_Object"]
|
|
756
778
|
}
|
|
757
779
|
}
|
|
758
780
|
}
|
|
@@ -1001,10 +1023,10 @@ var bodySchema = {
|
|
|
1001
1023
|
};
|
|
1002
1024
|
|
|
1003
1025
|
// src/v1/schema/definitions/target/index.ts
|
|
1004
|
-
import { z as
|
|
1026
|
+
import { z as z25 } from "zod";
|
|
1005
1027
|
|
|
1006
1028
|
// src/v1/schema/definitions/target/selector/index.ts
|
|
1007
|
-
import { z as
|
|
1029
|
+
import { z as z23 } from "zod";
|
|
1008
1030
|
|
|
1009
1031
|
// src/v1/schema/definitions/target/selector/range.ts
|
|
1010
1032
|
import { z as z21 } from "zod";
|
|
@@ -1212,13 +1234,64 @@ var rangeSelectorSchema = {
|
|
|
1212
1234
|
required: ["id", "type", "startSelector", "endSelector"]
|
|
1213
1235
|
};
|
|
1214
1236
|
|
|
1237
|
+
// src/v1/schema/definitions/target/selector/css.ts
|
|
1238
|
+
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)
|
|
1246
|
+
});
|
|
1247
|
+
var cssSelectorSchema = {
|
|
1248
|
+
type: "object",
|
|
1249
|
+
description: "Css Selector",
|
|
1250
|
+
properties: {
|
|
1251
|
+
id: { type: "string", format: "uri", description: selectorIdDescription },
|
|
1252
|
+
type: {
|
|
1253
|
+
type: "array",
|
|
1254
|
+
minItems: 2,
|
|
1255
|
+
maxItems: 2,
|
|
1256
|
+
items: [
|
|
1257
|
+
{ type: "string", const: "CssSelector" },
|
|
1258
|
+
{ type: "string", const: "crm:E73_Information_Object" }
|
|
1259
|
+
],
|
|
1260
|
+
description: "The class of the Selector,"
|
|
1261
|
+
},
|
|
1262
|
+
value: {
|
|
1263
|
+
type: "string",
|
|
1264
|
+
description: "Web Annotation Target Select CSS"
|
|
1265
|
+
}
|
|
1266
|
+
},
|
|
1267
|
+
required: ["id", "type", "value"]
|
|
1268
|
+
};
|
|
1269
|
+
var cssSelectorExtendedSchema = {
|
|
1270
|
+
type: "object",
|
|
1271
|
+
description: "CSS Selector",
|
|
1272
|
+
properties: {
|
|
1273
|
+
...cssSelectorSchema.properties,
|
|
1274
|
+
refinedBy: {
|
|
1275
|
+
type: "object",
|
|
1276
|
+
description: selectorRefinedByDescription,
|
|
1277
|
+
anyOf: [
|
|
1278
|
+
{ $ref: "defs.jsonld#/definitions/textPositionSelector" },
|
|
1279
|
+
{ $ref: "defs.jsonld#/definitions/textQuoteSelector" }
|
|
1280
|
+
],
|
|
1281
|
+
required: []
|
|
1282
|
+
}
|
|
1283
|
+
},
|
|
1284
|
+
required: ["id", "type", "value"]
|
|
1285
|
+
};
|
|
1286
|
+
|
|
1215
1287
|
// src/v1/schema/definitions/target/selector/index.ts
|
|
1216
1288
|
var selectorIdDescription = "UUID that identifies the selector.";
|
|
1217
1289
|
var selectorRefinedByDescription = "The relationship between a broader selector and the more specific selector that should be applied to the results of the first.";
|
|
1218
|
-
var Selector =
|
|
1290
|
+
var Selector = z23.union([
|
|
1219
1291
|
TextQuoteSelectorExtended,
|
|
1220
1292
|
TextPositionSelectorExtended,
|
|
1221
1293
|
XpathSelectorExtended,
|
|
1294
|
+
CssSelectorExtended,
|
|
1222
1295
|
RangeSelector
|
|
1223
1296
|
]);
|
|
1224
1297
|
var selectorSchema = {
|
|
@@ -1227,22 +1300,23 @@ var selectorSchema = {
|
|
|
1227
1300
|
textQuoteSelectorExtendedSchema,
|
|
1228
1301
|
textPositionSelectorExtendedSchema,
|
|
1229
1302
|
xpathSelectorExtendedSchema,
|
|
1303
|
+
cssSelectorExtendedSchema,
|
|
1230
1304
|
rangeSelectorSchema
|
|
1231
1305
|
],
|
|
1232
1306
|
required: []
|
|
1233
1307
|
};
|
|
1234
1308
|
|
|
1235
1309
|
// src/v1/schema/definitions/target/source.ts
|
|
1236
|
-
import { z as
|
|
1310
|
+
import { z as z24 } from "zod";
|
|
1237
1311
|
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.";
|
|
1238
|
-
var Format =
|
|
1312
|
+
var Format = z24.string().min(1).describe(formatDescription);
|
|
1239
1313
|
var formatSchema = {
|
|
1240
1314
|
type: "string",
|
|
1241
1315
|
description: formatDescription,
|
|
1242
1316
|
minLength: 1
|
|
1243
1317
|
};
|
|
1244
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.";
|
|
1245
|
-
var Language =
|
|
1319
|
+
var Language = z24.string().min(2).max(3).describe(languageDescription);
|
|
1246
1320
|
var languageSchema = {
|
|
1247
1321
|
type: "string",
|
|
1248
1322
|
description: languageDescription,
|
|
@@ -1250,19 +1324,19 @@ var languageSchema = {
|
|
|
1250
1324
|
maxLength: 3
|
|
1251
1325
|
};
|
|
1252
1326
|
var sourceIdDescription = "The IRI that identifies the Target source.";
|
|
1253
|
-
var isIdentifiedBy =
|
|
1254
|
-
id:
|
|
1255
|
-
type:
|
|
1256
|
-
title:
|
|
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.")
|
|
1257
1331
|
});
|
|
1258
|
-
var Source =
|
|
1259
|
-
id:
|
|
1260
|
-
type:
|
|
1261
|
-
format:
|
|
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(
|
|
1262
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."
|
|
1263
1337
|
),
|
|
1264
1338
|
P1_is_identified_by: isIdentifiedBy.optional(),
|
|
1265
|
-
language:
|
|
1339
|
+
language: z24.union([Language, z24.array(Language).min(1)]).optional().describe(
|
|
1266
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."
|
|
1267
1341
|
)
|
|
1268
1342
|
}).describe("Web Annotation Target");
|
|
@@ -1288,7 +1362,6 @@ var sourceSchema = {
|
|
|
1288
1362
|
type: { type: "string", const: "crm:D1_Digital_Object" },
|
|
1289
1363
|
format: {
|
|
1290
1364
|
type: ["string", "array"],
|
|
1291
|
-
nullable: true,
|
|
1292
1365
|
anyOf: [
|
|
1293
1366
|
formatSchema,
|
|
1294
1367
|
{
|
|
@@ -1312,27 +1385,21 @@ var sourceSchema = {
|
|
|
1312
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."
|
|
1313
1386
|
}
|
|
1314
1387
|
]
|
|
1315
|
-
},
|
|
1316
|
-
title: {
|
|
1317
|
-
type: "string",
|
|
1318
|
-
minLength: 1,
|
|
1319
|
-
nullable: true,
|
|
1320
|
-
description: "The title of the document being annotated."
|
|
1321
1388
|
}
|
|
1322
1389
|
},
|
|
1323
|
-
required: ["id", "type"]
|
|
1390
|
+
required: ["id", "type", "format"]
|
|
1324
1391
|
};
|
|
1325
1392
|
|
|
1326
1393
|
// src/v1/schema/definitions/target/index.ts
|
|
1327
1394
|
var targetIdDescription = "The IRI that identifies the Target resource.";
|
|
1328
|
-
var Target =
|
|
1329
|
-
id:
|
|
1330
|
-
type:
|
|
1395
|
+
var Target = z25.object({
|
|
1396
|
+
id: z25.string().url().describe(targetIdDescription),
|
|
1397
|
+
type: z25.tuple([z25.literal("SpecificResource"), z25.literal("crm:E73_Information_Object")]).describe("The class of the Specific Resource."),
|
|
1331
1398
|
source: Source,
|
|
1332
1399
|
renderedVia: Software.optional().describe(
|
|
1333
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."
|
|
1334
1401
|
),
|
|
1335
|
-
selector:
|
|
1402
|
+
selector: z25.union([Selector, z25.array(Selector)]).describe("The relationship between a Specific Resource and a Selector.").optional()
|
|
1336
1403
|
}).describe("Web Annotation Target");
|
|
1337
1404
|
var targetSchema = {
|
|
1338
1405
|
type: "object",
|
|
@@ -1448,6 +1515,33 @@ var targetSchema = {
|
|
|
1448
1515
|
}
|
|
1449
1516
|
}
|
|
1450
1517
|
},
|
|
1518
|
+
{
|
|
1519
|
+
if: {
|
|
1520
|
+
type: "object",
|
|
1521
|
+
properties: {
|
|
1522
|
+
selector: {
|
|
1523
|
+
type: "object",
|
|
1524
|
+
properties: {
|
|
1525
|
+
type: {
|
|
1526
|
+
type: "array",
|
|
1527
|
+
minItems: 2,
|
|
1528
|
+
maxItems: 2,
|
|
1529
|
+
items: [
|
|
1530
|
+
{ type: "string", const: "CssSelector" },
|
|
1531
|
+
{ type: "string", const: "crm:E73_Information_Object" }
|
|
1532
|
+
]
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
},
|
|
1538
|
+
then: {
|
|
1539
|
+
type: "object",
|
|
1540
|
+
properties: {
|
|
1541
|
+
selector: { type: "object", required: ["type", "value"] }
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
},
|
|
1451
1545
|
{
|
|
1452
1546
|
if: {
|
|
1453
1547
|
type: "object",
|
|
@@ -1479,7 +1573,7 @@ var targetSchema = {
|
|
|
1479
1573
|
};
|
|
1480
1574
|
|
|
1481
1575
|
// src/v1/schema/definitions/common.ts
|
|
1482
|
-
import { z as
|
|
1576
|
+
import { z as z26 } from "zod";
|
|
1483
1577
|
var Quality = [
|
|
1484
1578
|
"edit:qualityLow",
|
|
1485
1579
|
"edit:qualityMedium",
|
|
@@ -1487,14 +1581,14 @@ var Quality = [
|
|
|
1487
1581
|
"edit:qualityUnknown"
|
|
1488
1582
|
];
|
|
1489
1583
|
var certaintyDescription = "Indicates the degree of certainty associated with some aspect of an assertion, description, identification, or entity linked to the annotation body.";
|
|
1490
|
-
var Certainty =
|
|
1584
|
+
var Certainty = z26.enum(Quality).describe(certaintyDescription);
|
|
1491
1585
|
var certaintySchema = {
|
|
1492
1586
|
type: "string",
|
|
1493
1587
|
enum: Quality,
|
|
1494
1588
|
description: certaintyDescription
|
|
1495
1589
|
};
|
|
1496
1590
|
var precisionDescription = "Indicates the degree of precision associated with the location of the entity linked to the annotation body.";
|
|
1497
|
-
var Precision =
|
|
1591
|
+
var Precision = z26.enum(Quality).describe(precisionDescription);
|
|
1498
1592
|
var precisionSchema = {
|
|
1499
1593
|
type: "string",
|
|
1500
1594
|
enum: Quality,
|
|
@@ -1506,7 +1600,8 @@ var definitionSchema = {
|
|
|
1506
1600
|
$id: defsId,
|
|
1507
1601
|
type: "object",
|
|
1508
1602
|
definitions: {
|
|
1509
|
-
|
|
1603
|
+
user: userSchema,
|
|
1604
|
+
group: groupSchema,
|
|
1510
1605
|
software: softwareSchema,
|
|
1511
1606
|
target: targetSchema,
|
|
1512
1607
|
textPositionSelector: textPositionSelectorSchema,
|
|
@@ -1520,7 +1615,7 @@ var definitionSchema = {
|
|
|
1520
1615
|
};
|
|
1521
1616
|
|
|
1522
1617
|
// src/v1/schema/root.ts
|
|
1523
|
-
import { z as
|
|
1618
|
+
import { z as z27 } from "zod";
|
|
1524
1619
|
var Motivation = [
|
|
1525
1620
|
"oa:identifying",
|
|
1526
1621
|
"oa:describing",
|
|
@@ -1530,30 +1625,30 @@ var Motivation = [
|
|
|
1530
1625
|
"oa:linking",
|
|
1531
1626
|
"citing"
|
|
1532
1627
|
];
|
|
1533
|
-
var WebAnnotation =
|
|
1534
|
-
"@context":
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1628
|
+
var WebAnnotation = z27.object({
|
|
1629
|
+
"@context": z27.tuple([
|
|
1630
|
+
z27.literal("http://www.w3.org/ns/anno.jsonld").describe("W3C Web Annotation Context."),
|
|
1631
|
+
z27.literal("https://www.cidoc-crm.org/cidoc-crm/json-ld_context.jsonld").describe("CIDOC Web Annotation Context."),
|
|
1632
|
+
z27.literal(contextUri).describe("LINCS Web Annotation Context.")
|
|
1538
1633
|
]).describe(
|
|
1539
1634
|
"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."
|
|
1540
1635
|
),
|
|
1541
|
-
id:
|
|
1542
|
-
type:
|
|
1543
|
-
motivation:
|
|
1544
|
-
created:
|
|
1545
|
-
modified:
|
|
1546
|
-
creator: User.describe("The agent responsible for creating the resource.").optional(),
|
|
1547
|
-
contributor:
|
|
1636
|
+
id: z27.string().url().describe("The identity of the Annotation."),
|
|
1637
|
+
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."),
|
|
1639
|
+
created: z27.string().datetime().describe("The time at which the resource was created."),
|
|
1640
|
+
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."),
|
|
1548
1643
|
generator: Software.describe(
|
|
1549
1644
|
"The agent responsible for generating the serialization of the Annotation. "
|
|
1550
1645
|
),
|
|
1551
|
-
target: Target.describe("The relationship between an Annotation and its Target."),
|
|
1552
|
-
body:
|
|
1646
|
+
target: z27.union([Target, z27.array(Target)]).describe("The relationship between an Annotation and its Target."),
|
|
1647
|
+
body: z27.union([BodyChoice, Body, z27.array(Body)]).describe("The relationship between an Annotation and its Body."),
|
|
1553
1648
|
certainty: Certainty.optional(),
|
|
1554
1649
|
precision: Precision.optional(),
|
|
1555
|
-
label:
|
|
1556
|
-
P2_has_type:
|
|
1650
|
+
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()
|
|
1557
1652
|
}).describe("Web Annotation Root");
|
|
1558
1653
|
var webAnnotationSchema = {
|
|
1559
1654
|
$id: schemaId,
|
|
@@ -1601,16 +1696,38 @@ var webAnnotationSchema = {
|
|
|
1601
1696
|
format: "date-time",
|
|
1602
1697
|
description: "The time at which the resource was modified, after creation."
|
|
1603
1698
|
},
|
|
1604
|
-
creator: {
|
|
1605
|
-
|
|
1699
|
+
creator: {
|
|
1700
|
+
oneOf: [
|
|
1701
|
+
{ $ref: "defs.jsonld#/definitions/user" },
|
|
1702
|
+
{ $ref: "defs.jsonld#/definitions/group" },
|
|
1703
|
+
{ $ref: "defs.jsonld#/definitions/software" }
|
|
1704
|
+
]
|
|
1705
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1706
|
+
},
|
|
1606
1707
|
contributor: {
|
|
1607
1708
|
type: "array",
|
|
1608
|
-
items: {
|
|
1709
|
+
items: {
|
|
1710
|
+
oneOf: [
|
|
1711
|
+
{ $ref: "defs.jsonld#/definitions/user" },
|
|
1712
|
+
{ $ref: "defs.jsonld#/definitions/group" },
|
|
1713
|
+
{ $ref: "defs.jsonld#/definitions/software" }
|
|
1714
|
+
]
|
|
1715
|
+
},
|
|
1609
1716
|
minItems: 1
|
|
1610
1717
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1611
1718
|
},
|
|
1612
1719
|
generator: { $ref: "defs.jsonld#/definitions/software" },
|
|
1613
|
-
target: {
|
|
1720
|
+
target: {
|
|
1721
|
+
oneOf: [
|
|
1722
|
+
{ $ref: "defs.jsonld#/definitions/target" },
|
|
1723
|
+
{
|
|
1724
|
+
type: "array",
|
|
1725
|
+
items: { $ref: "defs.jsonld#/definitions/target" },
|
|
1726
|
+
minItems: 1
|
|
1727
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1728
|
+
}
|
|
1729
|
+
]
|
|
1730
|
+
},
|
|
1614
1731
|
body: {
|
|
1615
1732
|
oneOf: [
|
|
1616
1733
|
{ $ref: "defs.jsonld#/definitions/bodyChoice" },
|
|
@@ -1797,18 +1914,18 @@ import Ajv from "ajv";
|
|
|
1797
1914
|
import addFormats from "ajv-formats";
|
|
1798
1915
|
|
|
1799
1916
|
// src/v1/validator/types.ts
|
|
1800
|
-
import { z as
|
|
1801
|
-
var ValidationError =
|
|
1802
|
-
message:
|
|
1803
|
-
path:
|
|
1804
|
-
suggestion:
|
|
1805
|
-
context:
|
|
1806
|
-
errorType:
|
|
1807
|
-
}).and(
|
|
1917
|
+
import { z as z28 } from "zod";
|
|
1918
|
+
var ValidationError = z28.object({
|
|
1919
|
+
message: z28.string(),
|
|
1920
|
+
path: z28.string(),
|
|
1921
|
+
suggestion: z28.string().optional(),
|
|
1922
|
+
context: z28.object({
|
|
1923
|
+
errorType: z28.string()
|
|
1924
|
+
}).and(z28.unknown())
|
|
1808
1925
|
});
|
|
1809
|
-
var ValidateResult =
|
|
1810
|
-
valid:
|
|
1811
|
-
errors:
|
|
1926
|
+
var ValidateResult = z28.object({
|
|
1927
|
+
valid: z28.boolean(),
|
|
1928
|
+
errors: z28.array(ValidationError).optional()
|
|
1812
1929
|
});
|
|
1813
1930
|
|
|
1814
1931
|
// src/v1/validator/index.ts
|
|
@@ -1857,6 +1974,7 @@ __export(v1_exports, {
|
|
|
1857
1974
|
Description: () => Description,
|
|
1858
1975
|
Event: () => Event,
|
|
1859
1976
|
EventEntityType: () => EventEntityType,
|
|
1977
|
+
Group: () => Group,
|
|
1860
1978
|
Keyword: () => Keyword,
|
|
1861
1979
|
KeywordEntityType: () => KeywordEntityType,
|
|
1862
1980
|
KeywordFolksnomy: () => KeywordFolksnomy,
|
|
@@ -1909,7 +2027,6 @@ __export(v1_exports, {
|
|
|
1909
2027
|
contextUri: () => contextUri,
|
|
1910
2028
|
correctionEntityTypeSchema: () => correctionEntityTypeSchema,
|
|
1911
2029
|
correctionSchema: () => correctionSchema,
|
|
1912
|
-
creatorSchema: () => creatorSchema,
|
|
1913
2030
|
dateEntityTypeSchema: () => dateEntityTypeSchema,
|
|
1914
2031
|
dateSchema: () => dateSchema,
|
|
1915
2032
|
definitionSchema: () => definitionSchema,
|
|
@@ -1918,6 +2035,7 @@ __export(v1_exports, {
|
|
|
1918
2035
|
eventEntityTypeSchema: () => eventEntityTypeSchema,
|
|
1919
2036
|
eventSchema: () => eventSchema,
|
|
1920
2037
|
formatSchema: () => formatSchema,
|
|
2038
|
+
groupSchema: () => groupSchema,
|
|
1921
2039
|
isIdentifiedBy: () => isIdentifiedBy,
|
|
1922
2040
|
isIndentifyBySchema: () => isIndentifyBySchema,
|
|
1923
2041
|
keywordEntityTypeSchema: () => keywordEntityTypeSchema,
|
|
@@ -1953,6 +2071,7 @@ __export(v1_exports, {
|
|
|
1953
2071
|
textPositionSelectorSchema: () => textPositionSelectorSchema,
|
|
1954
2072
|
textQuoteSelectorExtendedSchema: () => textQuoteSelectorExtendedSchema,
|
|
1955
2073
|
textQuoteSelectorSchema: () => textQuoteSelectorSchema,
|
|
2074
|
+
userSchema: () => userSchema,
|
|
1956
2075
|
validate: () => validate,
|
|
1957
2076
|
validator: () => validator,
|
|
1958
2077
|
webAnnotationSchema: () => webAnnotationSchema,
|
|
@@ -1978,6 +2097,7 @@ export {
|
|
|
1978
2097
|
Description,
|
|
1979
2098
|
Event,
|
|
1980
2099
|
EventEntityType,
|
|
2100
|
+
Group,
|
|
1981
2101
|
Keyword,
|
|
1982
2102
|
KeywordEntityType,
|
|
1983
2103
|
KeywordFolksnomy,
|
|
@@ -2030,7 +2150,6 @@ export {
|
|
|
2030
2150
|
contextUri,
|
|
2031
2151
|
correctionEntityTypeSchema,
|
|
2032
2152
|
correctionSchema,
|
|
2033
|
-
creatorSchema,
|
|
2034
2153
|
dateEntityTypeSchema,
|
|
2035
2154
|
dateSchema,
|
|
2036
2155
|
definitionSchema,
|
|
@@ -2039,6 +2158,7 @@ export {
|
|
|
2039
2158
|
eventEntityTypeSchema,
|
|
2040
2159
|
eventSchema,
|
|
2041
2160
|
formatSchema,
|
|
2161
|
+
groupSchema,
|
|
2042
2162
|
isIdentifiedBy,
|
|
2043
2163
|
isIndentifyBySchema,
|
|
2044
2164
|
keywordEntityTypeSchema,
|
|
@@ -2074,6 +2194,7 @@ export {
|
|
|
2074
2194
|
textPositionSelectorSchema,
|
|
2075
2195
|
textQuoteSelectorExtendedSchema,
|
|
2076
2196
|
textQuoteSelectorSchema,
|
|
2197
|
+
userSchema,
|
|
2077
2198
|
v1_exports as v1,
|
|
2078
2199
|
validate,
|
|
2079
2200
|
validator,
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"@context": {
|
|
3
|
+
"biography": "http://id.lincsproject.ca/biography/",
|
|
3
4
|
"bf": "http://www.openlinksw.com/schemas/bif#",
|
|
4
5
|
"cito": "http://purl.org/spar/cito/",
|
|
6
|
+
"crmdig": "http://www.ics.forth.gr/isl/CRMdig/",
|
|
5
7
|
"cwrc": "http://id.lincsproject.ca/cwrc/",
|
|
6
8
|
"edit": "http://id.lincsproject.ca/edit/",
|
|
7
9
|
"fabio": "https://purl.org/spar/fabio/",
|
|
8
10
|
"frbroo": "http://iflastandards.info/ns/fr/frbr/frbroo/",
|
|
9
11
|
"wikidata": "http://www.wikidata.org/entity/",
|
|
10
|
-
"crmdig": "http://www.ics.forth.gr/isl/CRMdig/",
|
|
11
12
|
"citing": "edit:citing",
|
|
12
13
|
"correcting": "edit:correcting",
|
|
13
14
|
"oa:identifying": {
|