/
properties.js
404 lines (397 loc) · 8.4 KB
/
properties.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
import { propertiesValuesConstraints } from '#controllers/entities/lib/properties/properties_values_constraints'
const allLocallyEditedEntitiesTypes = [ 'edition', 'work', 'serie', 'human', 'publisher', 'collection' ]
export const authorRelationsProperties = [
'wdt:P50', // author
'wdt:P58', // scenarist
'wdt:P98', // editor
'wdt:P110', // illustrator
'wdt:P6338', // colorist
'wdt:P9191', // letterer
'wdt:P10836', // inker
'wdt:P10837', // penciller
]
// Default `category` = 'general'
// Default `subjectTypes` = allLocallyEditedEntitiesTypes
export const properties = {
// cover image hash
'invp:P2': {
subjectTypes: [ 'edition' ],
},
// instance of
'wdt:P31': {
subjectTypes: allLocallyEditedEntitiesTypes,
},
// founded by
'wdt:P112': {
subjectTypes: [ 'publisher' ],
},
// publisher
'wdt:P123': {
subjectTypes: [ 'edition', 'collection' ],
},
// owned by
'wdt:P127': {
subjectTypes: [ 'publisher' ],
},
// movement
'wdt:P135': {
subjectTypes: [ 'human' ],
},
// genre
'wdt:P136': {
subjectTypes: [ 'work', 'serie' ],
},
// based on
'wdt:P144': {
subjectTypes: [ 'work', 'serie' ],
},
// series
'wdt:P179': {
subjectTypes: [ 'work', 'serie' ],
},
// collection
'wdt:P195': {
subjectTypes: [ 'edition' ],
},
// ISBN-13
'wdt:P212': {
subjectTypes: [ 'edition' ],
},
// ISNI
'wdt:P213': {
subjectTypes: [ 'human' ],
},
// VIAF ID
'wdt:P214': {
subjectTypes: [ 'work', 'serie', 'edition', 'human' ],
},
// GND ID
'wdt:P227': {
subjectTypes: allLocallyEditedEntitiesTypes,
},
// OCLC control number
'wdt:P243': {
subjectTypes: allLocallyEditedEntitiesTypes,
},
// Library of Congress authority ID
'wdt:P244': {
subjectTypes: [ 'work', 'serie', 'human', 'publisher', 'collection' ],
},
// BNF ID
'wdt:P268': {
subjectTypes: allLocallyEditedEntitiesTypes,
},
// SUDOC authorities ID
'wdt:P269': {
subjectTypes: [ 'work', 'serie', 'human' ],
},
// NDL of Japan Auth ID
'wdt:P349': {
subjectTypes: [ 'human' ],
},
// language
'wdt:P407': {
subjectTypes: [ 'work', 'serie', 'edition' ],
},
// distribution format
'wdt:P437': {
subjectTypes: [ 'edition' ],
},
// ORCID ID
'wdt:P496': {
subjectTypes: [ 'human' ],
},
// date of birth
'wdt:P569': {
subjectTypes: [ 'human' ],
},
// date of death
'wdt:P570': {
subjectTypes: [ 'human' ],
},
// inception
'wdt:P571': {
subjectTypes: [ 'publisher' ],
},
// dissolution
'wdt:P576': {
subjectTypes: [ 'publisher' ],
},
// publication date
'wdt:P577': {
subjectTypes: [ 'work', 'serie', 'edition' ],
},
// edition or translation of
'wdt:P629': {
subjectTypes: [ 'edition' ],
},
// Open Library ID
'wdt:P648': {
subjectTypes: [ 'work', 'serie', 'human', 'edition' ],
},
// translator
'wdt:P655': {
subjectTypes: [ 'edition' ],
},
// Google Books ID
'wdt:P675': {
subjectTypes: [ 'edition' ],
},
// influenced by
'wdt:P737': {
subjectTypes: [ 'human' ],
},
// official website
'wdt:P856': {
subjectTypes: allLocallyEditedEntitiesTypes,
},
// SELIBR ID (Swedish)
'wdt:P906': {
subjectTypes: [ 'human' ],
},
// main subject
'wdt:P921': {
subjectTypes: [ 'work', 'serie', 'collection' ],
},
// inspired by
'wdt:P941': {
subjectTypes: [ 'work', 'serie' ],
},
// BNE ID
'wdt:P950': {
subjectTypes: allLocallyEditedEntitiesTypes,
},
// ISBN-10
'wdt:P957': {
subjectTypes: [ 'edition' ],
},
// Dutch National for Author Names ID
'wdt:P1006': {
subjectTypes: [ 'human' ],
},
// SUDOC editions
'wdt:P1025': {
subjectTypes: [ 'edition' ],
},
// SWB editions
'wdt:P1044': {
subjectTypes: [ 'edition' ],
},
// Librarything work ID
'wdt:P1085': {
subjectTypes: [ 'work' ],
},
// number of pages
'wdt:P1104': {
subjectTypes: [ 'edition' ],
},
// BN (Argentine) editions
'wdt:P1143': {
subjectTypes: [ 'edition' ],
},
// Library of Congress Control Number
'wdt:P1144': {
subjectTypes: [ 'edition' ],
},
// LIBRIS editions
'wdt:P1182': {
subjectTypes: [ 'edition' ],
},
// ISFDB title ID
'wdt:P1274': {
subjectTypes: [ 'edition' ],
},
// DNB editions
'wdt:P1292': {
subjectTypes: [ 'edition' ],
},
// languages of expression
'wdt:P1412': {
subjectTypes: [ 'human' ],
},
// published in
'wdt:P1433': {
subjectTypes: [ 'article' ],
},
// title
'wdt:P1476': {
subjectTypes: [ 'edition', 'collection' ],
},
// series ordinal
'wdt:P1545': {
subjectTypes: [ 'work', 'serie' ],
},
// subtitle
'wdt:P1680': {
subjectTypes: [ 'edition', 'collection' ],
},
// HathiTrust ID
'wdt:P1844': {
subjectTypes: [ 'edition' ],
},
// Google Scholar author ID
'wdt:P1960': {
subjectTypes: [ 'human' ],
},
// Anime News Network person ID
'wdt:P1982': {
subjectTypes: [ 'human' ],
},
// Anime News Network company ID
'wdt:P1983': {
subjectTypes: [ 'publisher' ],
},
// Anime News Network manga ID
'wdt:P1984': {
subjectTypes: [ 'work', 'serie' ],
},
// Twitter account
'wdt:P2002': {
subjectTypes: allLocallyEditedEntitiesTypes,
},
// Instagram username
'wdt:P2003': {
subjectTypes: allLocallyEditedEntitiesTypes,
},
// Facebook account
'wdt:P2013': {
subjectTypes: allLocallyEditedEntitiesTypes,
},
// YouTube channel ID
'wdt:P2397': {
subjectTypes: allLocallyEditedEntitiesTypes,
},
// BookBrainz author ID
'wdt:P2607': {
subjectTypes: [ 'human' ],
},
// number of volumes
'wdt:P2635': {
subjectTypes: [ 'edition' ],
},
// author of foreword
'wdt:P2679': {
subjectTypes: [ 'edition' ],
},
// author of afterword
'wdt:P2680': {
subjectTypes: [ 'edition' ],
},
// GoodReads author ID
'wdt:P2963': {
subjectTypes: [ 'human' ],
},
// GoodReads edition ID
'wdt:P2969': {
subjectTypes: [ 'edition' ],
},
// ISBN publisher prefix
'wdt:P3035': {
subjectTypes: [ 'publisher' ],
},
// Czech National Bibliography book ID
'wdt:P3184': {
subjectTypes: [ 'edition' ],
},
// Babelio author ID
'wdt:P3630': {
subjectTypes: [ 'human' ],
},
// Babelio work ID
'wdt:P3631': {
subjectTypes: [ 'work' ],
},
// Mastodon address
'wdt:P4033': {
subjectTypes: allLocallyEditedEntitiesTypes,
},
// MyAnimeList people ID
'wdt:P4084': {
subjectTypes: [ 'human' ],
},
// MyAnimeList manga ID
'wdt:P4087': {
subjectTypes: [ 'work', 'serie' ],
},
// Theses.fr person ID
'wdt:P4285': {
subjectTypes: [ 'human' ],
},
// British Library system number
'wdt:P5199': {
subjectTypes: [ 'edition' ],
},
// OCLC work ID
'wdt:P5331': {
subjectTypes: [ 'work', 'serie' ],
},
// BNB person ID
'wdt:P5361': {
subjectTypes: [ 'human' ],
},
// BD Gest' author ID
'wdt:P5491': {
subjectTypes: [ 'human' ],
},
// NooSFere book ID
'wdt:P5571': {
subjectTypes: [ 'edition' ],
},
// Goodreads series ID
'wdt:P6947': {
subjectTypes: [ 'serie' ],
},
// LibraryThing author ID
'wdt:P7400': {
subjectTypes: [ 'human' ],
},
// BookBrainz work ID
'wdt:P7823': {
subjectTypes: [ 'work' ],
},
// BookBrainz publisher ID
'wdt:P8063': {
subjectTypes: [ 'publisher' ],
},
// Goodreads work ID
'wdt:P8383': {
subjectTypes: [ 'work' ],
},
// LibraryThing series ID
'wdt:P8513': {
subjectTypes: [ 'serie' ],
},
// BookBrainz series ID
'wdt:P12048': {
subjectTypes: [ 'serie' ],
},
// Babelio serial ID
'wdt:P12319': {
subjectTypes: [ 'serie' ],
},
}
for (const property of authorRelationsProperties) {
properties[property] = {
subjectTypes: [ 'work', 'serie' ],
}
}
export const propertiesPerType = {}
for (const type of allLocallyEditedEntitiesTypes) {
propertiesPerType[type] = []
}
for (const [ property, { subjectTypes } ] of Object.entries(properties)) {
for (const type of subjectTypes) {
propertiesPerType[type]?.push(property)
}
const propertyValuesConstraints = propertiesValuesConstraints[property]
if (propertyValuesConstraints) {
const { datatype, uniqueValue, entityValueTypes } = propertyValuesConstraints
Object.assign(properties[property], {
datatype,
multivalue: !uniqueValue,
entityValueTypes,
})
} else {
throw new Error(`missing property values constraints: ${property}`)
}
}