@lincs.project/webannotation-schema 1.0.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/LICENSE +661 -0
- package/README.md +155 -0
- package/dist/context.jsonld +24 -0
- package/dist/defs.jsonld +949 -0
- package/dist/schema.jsonld +621 -0
- package/dist/validate.js +1 -0
- package/lib/index.d.ts +145 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +13 -0
- package/lib/index.js.map +1 -0
- package/lib/schema/config.d.ts +4 -0
- package/lib/schema/config.d.ts.map +1 -0
- package/lib/schema/config.js +4 -0
- package/lib/schema/config.js.map +1 -0
- package/lib/schema/context.d.ts +25 -0
- package/lib/schema/context.d.ts.map +1 -0
- package/lib/schema/context.js +25 -0
- package/lib/schema/context.js.map +1 -0
- package/lib/schema/definitions/agent.d.ts +36 -0
- package/lib/schema/definitions/agent.d.ts.map +1 -0
- package/lib/schema/definitions/agent.js +82 -0
- package/lib/schema/definitions/agent.js.map +1 -0
- package/lib/schema/definitions/body/citation.d.ts +27 -0
- package/lib/schema/definitions/body/citation.d.ts.map +1 -0
- package/lib/schema/definitions/body/citation.js +53 -0
- package/lib/schema/definitions/body/citation.js.map +1 -0
- package/lib/schema/definitions/body/common.d.ts +17 -0
- package/lib/schema/definitions/body/common.d.ts.map +1 -0
- package/lib/schema/definitions/body/common.js +46 -0
- package/lib/schema/definitions/body/common.js.map +1 -0
- package/lib/schema/definitions/body/conceptualObject.d.ts +27 -0
- package/lib/schema/definitions/body/conceptualObject.d.ts.map +1 -0
- package/lib/schema/definitions/body/conceptualObject.js +61 -0
- package/lib/schema/definitions/body/conceptualObject.js.map +1 -0
- package/lib/schema/definitions/body/correction.d.ts +24 -0
- package/lib/schema/definitions/body/correction.d.ts.map +1 -0
- package/lib/schema/definitions/body/correction.js +54 -0
- package/lib/schema/definitions/body/correction.js.map +1 -0
- package/lib/schema/definitions/body/date.d.ts +30 -0
- package/lib/schema/definitions/body/date.d.ts.map +1 -0
- package/lib/schema/definitions/body/date.js +61 -0
- package/lib/schema/definitions/body/date.js.map +1 -0
- package/lib/schema/definitions/body/index.d.ts +37 -0
- package/lib/schema/definitions/body/index.d.ts.map +1 -0
- package/lib/schema/definitions/body/index.js +220 -0
- package/lib/schema/definitions/body/index.js.map +1 -0
- package/lib/schema/definitions/body/keyword.d.ts +48 -0
- package/lib/schema/definitions/body/keyword.d.ts.map +1 -0
- package/lib/schema/definitions/body/keyword.js +100 -0
- package/lib/schema/definitions/body/keyword.js.map +1 -0
- package/lib/schema/definitions/body/link.d.ts +21 -0
- package/lib/schema/definitions/body/link.d.ts.map +1 -0
- package/lib/schema/definitions/body/link.js +37 -0
- package/lib/schema/definitions/body/link.js.map +1 -0
- package/lib/schema/definitions/body/note.d.ts +27 -0
- package/lib/schema/definitions/body/note.d.ts.map +1 -0
- package/lib/schema/definitions/body/note.js +54 -0
- package/lib/schema/definitions/body/note.js.map +1 -0
- package/lib/schema/definitions/body/organization.d.ts +27 -0
- package/lib/schema/definitions/body/organization.d.ts.map +1 -0
- package/lib/schema/definitions/body/organization.js +65 -0
- package/lib/schema/definitions/body/organization.js.map +1 -0
- package/lib/schema/definitions/body/person.d.ts +27 -0
- package/lib/schema/definitions/body/person.d.ts.map +1 -0
- package/lib/schema/definitions/body/person.js +61 -0
- package/lib/schema/definitions/body/person.js.map +1 -0
- package/lib/schema/definitions/body/physicalThing.d.ts +27 -0
- package/lib/schema/definitions/body/physicalThing.d.ts.map +1 -0
- package/lib/schema/definitions/body/physicalThing.js +61 -0
- package/lib/schema/definitions/body/physicalThing.js.map +1 -0
- package/lib/schema/definitions/body/place.d.ts +30 -0
- package/lib/schema/definitions/body/place.d.ts.map +1 -0
- package/lib/schema/definitions/body/place.js +64 -0
- package/lib/schema/definitions/body/place.js.map +1 -0
- package/lib/schema/definitions/body/work.d.ts +27 -0
- package/lib/schema/definitions/body/work.d.ts.map +1 -0
- package/lib/schema/definitions/body/work.js +61 -0
- package/lib/schema/definitions/body/work.js.map +1 -0
- package/lib/schema/definitions/index.d.ts +22 -0
- package/lib/schema/definitions/index.d.ts.map +1 -0
- package/lib/schema/definitions/index.js +24 -0
- package/lib/schema/definitions/index.js.map +1 -0
- package/lib/schema/definitions/target/index.d.ts +710 -0
- package/lib/schema/definitions/target/index.d.ts.map +1 -0
- package/lib/schema/definitions/target/index.js +231 -0
- package/lib/schema/definitions/target/index.js.map +1 -0
- package/lib/schema/definitions/target/selector/index.d.ts +5 -0
- package/lib/schema/definitions/target/selector/index.d.ts.map +1 -0
- package/lib/schema/definitions/target/selector/index.js +5 -0
- package/lib/schema/definitions/target/selector/index.js.map +1 -0
- package/lib/schema/definitions/target/selector/range.d.ts +141 -0
- package/lib/schema/definitions/target/selector/range.d.ts.map +1 -0
- package/lib/schema/definitions/target/selector/range.js +44 -0
- package/lib/schema/definitions/target/selector/range.js.map +1 -0
- package/lib/schema/definitions/target/selector/textPosition.d.ts +21 -0
- package/lib/schema/definitions/target/selector/textPosition.d.ts.map +1 -0
- package/lib/schema/definitions/target/selector/textPosition.js +57 -0
- package/lib/schema/definitions/target/selector/textPosition.js.map +1 -0
- package/lib/schema/definitions/target/selector/textQuote.d.ts +297 -0
- package/lib/schema/definitions/target/selector/textQuote.d.ts.map +1 -0
- package/lib/schema/definitions/target/selector/textQuote.js +78 -0
- package/lib/schema/definitions/target/selector/textQuote.js.map +1 -0
- package/lib/schema/definitions/target/selector/xpath.d.ts +46 -0
- package/lib/schema/definitions/target/selector/xpath.d.ts.map +1 -0
- package/lib/schema/definitions/target/selector/xpath.js +51 -0
- package/lib/schema/definitions/target/selector/xpath.js.map +1 -0
- package/lib/schema/index.d.ts +5 -0
- package/lib/schema/index.d.ts.map +1 -0
- package/lib/schema/index.js +5 -0
- package/lib/schema/index.js.map +1 -0
- package/lib/schema/root.d.ts +1076 -0
- package/lib/schema/root.d.ts.map +1 -0
- package/lib/schema/root.js +408 -0
- package/lib/schema/root.js.map +1 -0
- package/lib/validation.d.ts +25 -0
- package/lib/validation.d.ts.map +1 -0
- package/lib/validation.js +35 -0
- package/lib/validation.js.map +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../src/schema/root.ts"],"names":[],"mappings":"AAAA,OAAY,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAE1C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA2BxB,eAAO,MAAM,MAAM,6CAA8C,CAAC;AAClE,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;AAiB7C,eAAO,MAAM,UAAU,qGAQb,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAuBrD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8CQ,CAAC;AAEnC,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAI1D,eAAO,MAAM,mBAAmB,EAAE,cAAc,CAAC,QAAQ,CAAC,aAAa,CAAC,CAkTvE,CAAC"}
|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
import Ajv from 'ajv';
|
|
2
|
+
import addFormats from 'ajv-formats';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { schemaId, contextUri } from './config';
|
|
5
|
+
import { Body, Software, Target, User, personEntityTypeSchema } from './definitions';
|
|
6
|
+
import { citationEntityTypeSchema } from './definitions/body/citation';
|
|
7
|
+
import { conceptualObjectEntityTypeSchema } from './definitions/body/conceptualObject';
|
|
8
|
+
import { correctionEntityTypeSchema } from './definitions/body/correction';
|
|
9
|
+
import { dateEntityTypeSchema } from './definitions/body/date';
|
|
10
|
+
import { keywordEntityTypeSchema, keywordFolksnomyEntityTypeSchema, } from './definitions/body/keyword';
|
|
11
|
+
import { linkEntityTypeSchema } from './definitions/body/link';
|
|
12
|
+
import { noteEntityTypeSchema } from './definitions/body/note';
|
|
13
|
+
import { organizationEntityTypeSchema } from './definitions/body/organization';
|
|
14
|
+
import { physicalThingEntityTypeSchema } from './definitions/body/physicalThing';
|
|
15
|
+
import { placeEntityTypeSchema } from './definitions/body/place';
|
|
16
|
+
import { workEntityTypeSchema } from './definitions/body/work';
|
|
17
|
+
const ajv = new Ajv(); // options can be passed, e.g. {allErrors: true}
|
|
18
|
+
addFormats(ajv);
|
|
19
|
+
// * Pure Typescript Type - Just for reference
|
|
20
|
+
// type Status = 'draft' | 'approved' | 'published';
|
|
21
|
+
// * Type using Zod & Inference
|
|
22
|
+
export const Status = ['draft', 'approved', 'published'];
|
|
23
|
+
//** -------------- */
|
|
24
|
+
// * Pure Typescript Type - Just for reference
|
|
25
|
+
// type Motivation =
|
|
26
|
+
// | 'identifying'
|
|
27
|
+
// | 'describing'
|
|
28
|
+
// | 'correcting'
|
|
29
|
+
// | 'tagging'
|
|
30
|
+
// | 'classifying'
|
|
31
|
+
// | 'linking'
|
|
32
|
+
// | 'citing';
|
|
33
|
+
// * Type using Zod & Inference
|
|
34
|
+
export const Motivation = [
|
|
35
|
+
'identifying',
|
|
36
|
+
'describing',
|
|
37
|
+
'correcting',
|
|
38
|
+
'tagging',
|
|
39
|
+
'classifying',
|
|
40
|
+
'linking',
|
|
41
|
+
'citing',
|
|
42
|
+
];
|
|
43
|
+
//** -------------- */
|
|
44
|
+
// * Pure Typescript Type - Just for reference
|
|
45
|
+
// interface WebAnnotationRoot {
|
|
46
|
+
// '@context': ['http://www.w3.org/ns/anno.jsonld', contextUri];
|
|
47
|
+
// id: string;
|
|
48
|
+
// type: ['Annotation', 'crm:E33_Linguistic_Object'];
|
|
49
|
+
// motivation: [Motivation, 'crm:E33_Linguistic_Object'];
|
|
50
|
+
// created: string;
|
|
51
|
+
// modified?: string;
|
|
52
|
+
// creator: User;
|
|
53
|
+
// contributor?: User[];
|
|
54
|
+
// generator: Software;
|
|
55
|
+
// target: Target;
|
|
56
|
+
// body: Body;
|
|
57
|
+
// status: Status;
|
|
58
|
+
// }
|
|
59
|
+
// * Type using Zod & Inference
|
|
60
|
+
export const WebAnnotation = z
|
|
61
|
+
.object({
|
|
62
|
+
'@context': z
|
|
63
|
+
.tuple([
|
|
64
|
+
z.literal('http://www.w3.org/ns/anno.jsonld').describe('W3C Web Annotation Context.'),
|
|
65
|
+
z
|
|
66
|
+
.literal(contextUri)
|
|
67
|
+
.describe('LINCS Web Annotation Context.'),
|
|
68
|
+
])
|
|
69
|
+
.describe('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.'),
|
|
70
|
+
id: z
|
|
71
|
+
.union([
|
|
72
|
+
z.string().url(),
|
|
73
|
+
z.string().uuid(),
|
|
74
|
+
])
|
|
75
|
+
.describe('The identity of the Annotation. It must be a URI or UUID.'),
|
|
76
|
+
type: z
|
|
77
|
+
.tuple([z.literal('Annotation'), z.literal('crm:E33_Linguistic_Object')])
|
|
78
|
+
.describe('The type of the Annotation.'),
|
|
79
|
+
motivation: z
|
|
80
|
+
.tuple([z.enum(Motivation), z.literal('crm:E33_Linguistic_Object')])
|
|
81
|
+
.describe('The relationship between an Annotation and a Motivation.'),
|
|
82
|
+
created: z
|
|
83
|
+
.string()
|
|
84
|
+
.datetime() //* generates format: 'date-time'. But we might need 'iso-data-time',
|
|
85
|
+
.describe('The time at which the resource was created.'),
|
|
86
|
+
modified: z
|
|
87
|
+
.string()
|
|
88
|
+
.datetime() //* generates format: 'date-time'. But we might need 'iso-data-time',
|
|
89
|
+
.optional()
|
|
90
|
+
.describe('The time at which the resource was modified, after creation.'),
|
|
91
|
+
status: z.enum(Status).describe('The status of this annotation in a workflow.'),
|
|
92
|
+
creator: User.describe('The agent responsible for creating the resource.'),
|
|
93
|
+
contributor: z
|
|
94
|
+
.array(User.describe('The agents responsible for modifying the resource.'))
|
|
95
|
+
.nonempty()
|
|
96
|
+
.optional()
|
|
97
|
+
.describe('The agents responsible for modifying the resource.'),
|
|
98
|
+
generator: Software.describe('The agent responsible for generating the serialization of the Annotation. '),
|
|
99
|
+
target: Target.describe('The relationship between an Annotation and its Target.'),
|
|
100
|
+
body: Body.describe('The relationship between an Annotation and its Body.'),
|
|
101
|
+
})
|
|
102
|
+
.describe('Web Annotation Root');
|
|
103
|
+
// * JSONSchema
|
|
104
|
+
export const webAnnotationSchema = {
|
|
105
|
+
$id: schemaId,
|
|
106
|
+
type: 'object',
|
|
107
|
+
description: 'Web Annotation',
|
|
108
|
+
properties: {
|
|
109
|
+
'@context': {
|
|
110
|
+
type: 'array',
|
|
111
|
+
minItems: 2,
|
|
112
|
+
maxItems: 2,
|
|
113
|
+
items: [
|
|
114
|
+
{ type: 'string', const: 'http://www.w3.org/ns/anno.jsonld' },
|
|
115
|
+
{ type: 'string', const: contextUri },
|
|
116
|
+
],
|
|
117
|
+
description: '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.',
|
|
118
|
+
},
|
|
119
|
+
id: {
|
|
120
|
+
anyOf: [
|
|
121
|
+
{
|
|
122
|
+
type: 'string',
|
|
123
|
+
format: 'uri',
|
|
124
|
+
description: 'Idealy, this this uri must be a concatenation of an URI and UUID with an "_".',
|
|
125
|
+
},
|
|
126
|
+
{ type: 'string', format: 'uuid' },
|
|
127
|
+
],
|
|
128
|
+
description: 'The identity of the Annotation. It must be a URI or UUID.',
|
|
129
|
+
},
|
|
130
|
+
type: {
|
|
131
|
+
type: 'array',
|
|
132
|
+
minItems: 2,
|
|
133
|
+
maxItems: 2,
|
|
134
|
+
items: [
|
|
135
|
+
{ type: 'string', const: 'Annotation' },
|
|
136
|
+
{ type: 'string', const: 'crm:E33_Linguistic_Object' },
|
|
137
|
+
],
|
|
138
|
+
description: 'The type of the Annotation.',
|
|
139
|
+
},
|
|
140
|
+
motivation: {
|
|
141
|
+
type: 'array',
|
|
142
|
+
minItems: 2,
|
|
143
|
+
maxItems: 2,
|
|
144
|
+
items: [
|
|
145
|
+
{ type: 'string', enum: Motivation },
|
|
146
|
+
{ type: 'string', const: 'crm:E33_Linguistic_Object' },
|
|
147
|
+
],
|
|
148
|
+
description: 'The relationship between an Annotation and a Motivation.',
|
|
149
|
+
},
|
|
150
|
+
created: {
|
|
151
|
+
type: 'string',
|
|
152
|
+
format: 'date-time',
|
|
153
|
+
description: 'The time at which the resource was created.',
|
|
154
|
+
},
|
|
155
|
+
modified: {
|
|
156
|
+
type: 'string',
|
|
157
|
+
format: 'date-time',
|
|
158
|
+
description: 'The time at which the resource was modified, after creation.',
|
|
159
|
+
},
|
|
160
|
+
creator: { $ref: 'defs.jsonld#/definitions/creator' },
|
|
161
|
+
contributor: {
|
|
162
|
+
type: 'array',
|
|
163
|
+
items: { $ref: 'defs.jsonld#/definitions/creator' },
|
|
164
|
+
minItems: 1,
|
|
165
|
+
},
|
|
166
|
+
generator: { $ref: 'defs.jsonld#/definitions/software' },
|
|
167
|
+
target: { $ref: 'defs.jsonld#/definitions/target' },
|
|
168
|
+
body: { $ref: 'defs.jsonld#/definitions/body' },
|
|
169
|
+
status: { type: 'string', enum: Status },
|
|
170
|
+
},
|
|
171
|
+
required: [
|
|
172
|
+
'@context',
|
|
173
|
+
'id',
|
|
174
|
+
'type',
|
|
175
|
+
'motivation',
|
|
176
|
+
'created',
|
|
177
|
+
'creator',
|
|
178
|
+
'generator',
|
|
179
|
+
'target',
|
|
180
|
+
'body',
|
|
181
|
+
'status',
|
|
182
|
+
],
|
|
183
|
+
allOf: [
|
|
184
|
+
{
|
|
185
|
+
if: {
|
|
186
|
+
type: 'object',
|
|
187
|
+
properties: {
|
|
188
|
+
status: { const: 'published' },
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
then: {
|
|
192
|
+
type: 'object',
|
|
193
|
+
properties: {
|
|
194
|
+
id: { type: 'string', format: 'uri' },
|
|
195
|
+
},
|
|
196
|
+
required: ['status'],
|
|
197
|
+
},
|
|
198
|
+
else: {
|
|
199
|
+
type: 'object',
|
|
200
|
+
properties: {
|
|
201
|
+
id: { type: 'string', format: 'uuid' },
|
|
202
|
+
},
|
|
203
|
+
required: ['status'],
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
if: {
|
|
208
|
+
type: 'object',
|
|
209
|
+
properties: {
|
|
210
|
+
body: {
|
|
211
|
+
type: 'object',
|
|
212
|
+
properties: {
|
|
213
|
+
entityType: {
|
|
214
|
+
oneOf: [
|
|
215
|
+
personEntityTypeSchema,
|
|
216
|
+
placeEntityTypeSchema,
|
|
217
|
+
organizationEntityTypeSchema,
|
|
218
|
+
workEntityTypeSchema,
|
|
219
|
+
physicalThingEntityTypeSchema,
|
|
220
|
+
conceptualObjectEntityTypeSchema,
|
|
221
|
+
dateEntityTypeSchema,
|
|
222
|
+
],
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
then: {
|
|
229
|
+
type: 'object',
|
|
230
|
+
properties: {
|
|
231
|
+
motivation: {
|
|
232
|
+
type: 'array',
|
|
233
|
+
minItems: 2,
|
|
234
|
+
maxItems: 2,
|
|
235
|
+
items: [
|
|
236
|
+
{ type: 'string', const: 'identifying' },
|
|
237
|
+
{ type: 'string', const: 'crm:E33_Linguistic_Object' },
|
|
238
|
+
],
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
else: {
|
|
243
|
+
if: {
|
|
244
|
+
type: 'object',
|
|
245
|
+
properties: {
|
|
246
|
+
body: {
|
|
247
|
+
type: 'object',
|
|
248
|
+
properties: {
|
|
249
|
+
entityType: noteEntityTypeSchema,
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
then: {
|
|
255
|
+
type: 'object',
|
|
256
|
+
properties: {
|
|
257
|
+
motivation: {
|
|
258
|
+
type: 'array',
|
|
259
|
+
minItems: 2,
|
|
260
|
+
maxItems: 2,
|
|
261
|
+
items: [
|
|
262
|
+
{ type: 'string', const: 'describing' },
|
|
263
|
+
{ type: 'string', const: 'crm:E33_Linguistic_Object' },
|
|
264
|
+
],
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
else: {
|
|
269
|
+
if: {
|
|
270
|
+
type: 'object',
|
|
271
|
+
properties: {
|
|
272
|
+
body: {
|
|
273
|
+
type: 'object',
|
|
274
|
+
properties: {
|
|
275
|
+
entityType: correctionEntityTypeSchema,
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
then: {
|
|
281
|
+
type: 'object',
|
|
282
|
+
properties: {
|
|
283
|
+
motivation: {
|
|
284
|
+
type: 'array',
|
|
285
|
+
minItems: 2,
|
|
286
|
+
maxItems: 2,
|
|
287
|
+
items: [
|
|
288
|
+
{ type: 'string', const: 'correcting' },
|
|
289
|
+
{ type: 'string', const: 'crm:E33_Linguistic_Object' },
|
|
290
|
+
],
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
else: {
|
|
295
|
+
if: {
|
|
296
|
+
type: 'object',
|
|
297
|
+
properties: {
|
|
298
|
+
body: {
|
|
299
|
+
type: 'object',
|
|
300
|
+
properties: {
|
|
301
|
+
entityType: keywordFolksnomyEntityTypeSchema,
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
then: {
|
|
307
|
+
type: 'object',
|
|
308
|
+
properties: {
|
|
309
|
+
motivation: {
|
|
310
|
+
type: 'array',
|
|
311
|
+
minItems: 2,
|
|
312
|
+
maxItems: 2,
|
|
313
|
+
items: [
|
|
314
|
+
{ type: 'string', const: 'tagging' },
|
|
315
|
+
{ type: 'string', const: 'crm:E33_Linguistic_Object' },
|
|
316
|
+
],
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
},
|
|
320
|
+
else: {
|
|
321
|
+
if: {
|
|
322
|
+
type: 'object',
|
|
323
|
+
properties: {
|
|
324
|
+
body: {
|
|
325
|
+
type: 'object',
|
|
326
|
+
properties: {
|
|
327
|
+
entityType: keywordEntityTypeSchema,
|
|
328
|
+
},
|
|
329
|
+
},
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
then: {
|
|
333
|
+
type: 'object',
|
|
334
|
+
properties: {
|
|
335
|
+
motivation: {
|
|
336
|
+
type: 'array',
|
|
337
|
+
minItems: 2,
|
|
338
|
+
maxItems: 2,
|
|
339
|
+
items: [
|
|
340
|
+
{ type: 'string', const: 'classifying' },
|
|
341
|
+
{ type: 'string', const: 'crm:E33_Linguistic_Object' },
|
|
342
|
+
],
|
|
343
|
+
},
|
|
344
|
+
},
|
|
345
|
+
},
|
|
346
|
+
else: {
|
|
347
|
+
if: {
|
|
348
|
+
type: 'object',
|
|
349
|
+
properties: {
|
|
350
|
+
body: {
|
|
351
|
+
type: 'object',
|
|
352
|
+
properties: {
|
|
353
|
+
entityType: linkEntityTypeSchema,
|
|
354
|
+
},
|
|
355
|
+
},
|
|
356
|
+
},
|
|
357
|
+
},
|
|
358
|
+
then: {
|
|
359
|
+
type: 'object',
|
|
360
|
+
properties: {
|
|
361
|
+
motivation: {
|
|
362
|
+
type: 'array',
|
|
363
|
+
minItems: 2,
|
|
364
|
+
maxItems: 2,
|
|
365
|
+
items: [
|
|
366
|
+
{ type: 'string', const: 'linking' },
|
|
367
|
+
{ type: 'string', const: 'crm:E33_Linguistic_Object' },
|
|
368
|
+
],
|
|
369
|
+
},
|
|
370
|
+
},
|
|
371
|
+
},
|
|
372
|
+
else: {
|
|
373
|
+
if: {
|
|
374
|
+
type: 'object',
|
|
375
|
+
properties: {
|
|
376
|
+
body: {
|
|
377
|
+
type: 'object',
|
|
378
|
+
properties: {
|
|
379
|
+
entityType: citationEntityTypeSchema,
|
|
380
|
+
},
|
|
381
|
+
},
|
|
382
|
+
},
|
|
383
|
+
},
|
|
384
|
+
then: {
|
|
385
|
+
type: 'object',
|
|
386
|
+
properties: {
|
|
387
|
+
motivation: {
|
|
388
|
+
type: 'array',
|
|
389
|
+
minItems: 2,
|
|
390
|
+
maxItems: 2,
|
|
391
|
+
items: [
|
|
392
|
+
{ type: 'string', const: 'citing' },
|
|
393
|
+
{ type: 'string', const: 'crm:E33_Linguistic_Object' },
|
|
394
|
+
],
|
|
395
|
+
},
|
|
396
|
+
},
|
|
397
|
+
},
|
|
398
|
+
},
|
|
399
|
+
},
|
|
400
|
+
},
|
|
401
|
+
},
|
|
402
|
+
},
|
|
403
|
+
},
|
|
404
|
+
},
|
|
405
|
+
],
|
|
406
|
+
additionalProperties: false,
|
|
407
|
+
};
|
|
408
|
+
//# sourceMappingURL=root.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.js","sourceRoot":"","sources":["../../src/schema/root.ts"],"names":[],"mappings":"AAAA,OAAO,GAAuB,MAAM,KAAK,CAAC;AAC1C,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,gCAAgC,EAAE,MAAM,qCAAqC,CAAC;AACvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EACL,uBAAuB,EACvB,gCAAgC,GACjC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,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ACL,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;oDACnC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,2BAA2B,EAAE;iDACvD;6CACF;yCACF;qCACF;iCACF;6BACF;yBACF;qBACF;iBACF;aACF;SACF;KACF;IACD,oBAAoB,EAAE,KAAK;CAC5B,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ValidationError } from '@apideck/better-ajv-errors';
|
|
2
|
+
export type Annotation = {
|
|
3
|
+
[x: string]: any;
|
|
4
|
+
};
|
|
5
|
+
export interface ValidateResult {
|
|
6
|
+
errors?: ValidationError[];
|
|
7
|
+
valid: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* This function validates an annotation object and returns a validation result.
|
|
11
|
+
* @param {Annotation} annotation
|
|
12
|
+
* @returns Oject of type `ValidateResult`. The object has a `valid` property which is a boolean
|
|
13
|
+
* indicating whether the annotation is valid or not. If the annotation is not valid, the object
|
|
14
|
+
* also has an `errors` property which is an array of error messages.
|
|
15
|
+
*/
|
|
16
|
+
export declare const validate: (annotation: Annotation) => ValidateResult;
|
|
17
|
+
/**
|
|
18
|
+
* This function takes an annotation object and returns any validation errors using a schema and validator.
|
|
19
|
+
* @param {any} annotation
|
|
20
|
+
* @returns Array of error objects that are generated by the `betterAjvErrors` library. These errors are
|
|
21
|
+
* based on the `webAnnotationSchema` schema and the `annotation` data object that is passed as an argument
|
|
22
|
+
* to the function.
|
|
23
|
+
*/
|
|
24
|
+
export declare const getErrors: (annotation: any) => ValidationError[];
|
|
25
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAInF,MAAM,MAAM,UAAU,GAAG;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,CAAC;AAE9C,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC;IAC3B,KAAK,EAAE,OAAO,CAAC;CAChB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,eAAgB,UAAU,mBAO9C,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,eAAgB,GAAG,sBASxC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { betterAjvErrors } from '@apideck/better-ajv-errors';
|
|
2
|
+
import { validator } from './';
|
|
3
|
+
import { webAnnotationSchema } from './schema';
|
|
4
|
+
/**
|
|
5
|
+
* This function validates an annotation object and returns a validation result.
|
|
6
|
+
* @param {Annotation} annotation
|
|
7
|
+
* @returns Oject of type `ValidateResult`. The object has a `valid` property which is a boolean
|
|
8
|
+
* indicating whether the annotation is valid or not. If the annotation is not valid, the object
|
|
9
|
+
* also has an `errors` property which is an array of error messages.
|
|
10
|
+
*/
|
|
11
|
+
export const validate = (annotation) => {
|
|
12
|
+
const isValid = validator(annotation);
|
|
13
|
+
const result = { valid: isValid };
|
|
14
|
+
if (!isValid)
|
|
15
|
+
result.errors = getErrors(annotation);
|
|
16
|
+
return result;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* This function takes an annotation object and returns any validation errors using a schema and validator.
|
|
20
|
+
* @param {any} annotation
|
|
21
|
+
* @returns Array of error objects that are generated by the `betterAjvErrors` library. These errors are
|
|
22
|
+
* based on the `webAnnotationSchema` schema and the `annotation` data object that is passed as an argument
|
|
23
|
+
* to the function.
|
|
24
|
+
*/
|
|
25
|
+
export const getErrors = (annotation) => {
|
|
26
|
+
const errors = betterAjvErrors({
|
|
27
|
+
//@ts-ignore
|
|
28
|
+
schema: webAnnotationSchema,
|
|
29
|
+
data: annotation,
|
|
30
|
+
errors: validator.errors,
|
|
31
|
+
basePath: '{annotation}',
|
|
32
|
+
});
|
|
33
|
+
return errors;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAwB,MAAM,4BAA4B,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAS/C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,UAAsB,EAAE,EAAE;IACjD,MAAM,OAAO,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;IAEtC,MAAM,MAAM,GAAmB,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;IAClD,IAAI,CAAC,OAAO;QAAE,MAAM,CAAC,MAAM,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;IAEpD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,UAAe,EAAE,EAAE;IAC3C,MAAM,MAAM,GAAG,eAAe,CAAC;QAC7B,YAAY;QACZ,MAAM,EAAE,mBAAmB;QAC3B,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE,SAAS,CAAC,MAAM;QACxB,QAAQ,EAAE,cAAc;KACzB,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lincs.project/webannotation-schema",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "lincs project web annotation json schema and validator",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"lincs project",
|
|
7
|
+
"web annotation",
|
|
8
|
+
"json-ld",
|
|
9
|
+
"json schema"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://gitlab.com/calincs/conversion/lincs-webannotation",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://gitlab.com/calincs/conversion/lincs-webannotation/-/issues"
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://gitlab.com/calincs/conversion/lincs-webannotation.git"
|
|
18
|
+
},
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"license": "GPL-2.0",
|
|
23
|
+
"author": "Luciano Frizzera <lucaju@gmail.com>",
|
|
24
|
+
"exports": [
|
|
25
|
+
"./src/index.ts",
|
|
26
|
+
"./lib/index.js"
|
|
27
|
+
],
|
|
28
|
+
"types": "lib/index.d.ts",
|
|
29
|
+
"files": [
|
|
30
|
+
"dist",
|
|
31
|
+
"lib"
|
|
32
|
+
],
|
|
33
|
+
"module": "src/index.ts",
|
|
34
|
+
"main": "./dist/index.js",
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "npm run clean && tsc && npm run generate && npm run build-documentation",
|
|
37
|
+
"generate": "ts-node ./bin/generate.ts",
|
|
38
|
+
"clean": "shx rm -rf dist lib public",
|
|
39
|
+
"build-documentation": "typedoc --out docs src/index.ts",
|
|
40
|
+
"test": "jest",
|
|
41
|
+
"test-watch": "jest --watchAll --verbose",
|
|
42
|
+
"cm": "git-cz",
|
|
43
|
+
"prepublishOnly": "npm test && npm run build"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@apideck/better-ajv-errors": "^0.3.6",
|
|
47
|
+
"ajv": "^8.12.0",
|
|
48
|
+
"ajv-formats": "^2.1.1",
|
|
49
|
+
"typescript": "^5.1.3",
|
|
50
|
+
"zod": "^3.21.4"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@jest/globals": "^29.5.0",
|
|
54
|
+
"@types/fs-extra": "^11.0.1",
|
|
55
|
+
"@types/jest": "^29.5.2",
|
|
56
|
+
"@types/node": "^20.3.1",
|
|
57
|
+
"commitizen": "^4.3.0",
|
|
58
|
+
"eslint": "^8.43.0",
|
|
59
|
+
"fs-extra": "^11.1.1",
|
|
60
|
+
"git-cz": "^4.9.0",
|
|
61
|
+
"jest": "^29.5.0",
|
|
62
|
+
"kleur": "^4.1.5",
|
|
63
|
+
"prettier": "^2.8.8",
|
|
64
|
+
"shx": "^0.3.4",
|
|
65
|
+
"ts-jest": "^29.1.0",
|
|
66
|
+
"ts-node": "^10.9.1"
|
|
67
|
+
}
|
|
68
|
+
}
|