-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmsk.fix
488 lines (387 loc) · 14.6 KB
/
msk.fix
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
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
# Catmandu Fix
#
# Institution: Museum of Fine Arts Ghent
# Description: Converts Adlib Structured XML to LIDO 1.0
# Created: 1/12/2016
#
## Prepare an intermediate structure:
## Copy relevant Adlib fields to a dedicated lido structure.
## Remove all Adlib fields afterwards, retaining only the lido structure.
copy_field(priref, or_record.priref)
copy_field(object_number, or_record.object_number)
copy_field(or_record.object_number, or_record.identificator)
lookup_in_store(or_record.identificator, DBI, data_source: "dbi:SQLite:/tmp/import.PIDS.MSK.UTF8.sqlite")
#lookup_in_store(or_record.identificator, Resolver, username: catmandu, password: catmandu, url: 'http://resolver.mskgent.be')
copy_field(object_category, or_record.object_category)
copy_field(Object_name, or_record.object_name)
copy_field(Title, or_record.title)
copy_field(Title_translation, or_record.title_translation)
copy_field(Description, or_record.description)
copy_field(Dimension, or_record.dimensions)
copy_field(Production, or_record.production)
copy_field(Production_date, or_record.production_date)
copy_field('production\.period', or_record.production_period)
copy_field(physical_description, or_record.physical_description)
copy_field(Material, or_record.materials)
copy_field("institution\.name", or_record.institution)
copy_field('content\.motif\.general', 'or_record.subject')
## Set default values for required fields if value is missing
unless exists(or_record.production.creator.name)
add_field(or_record.production.creator.name, 'n/a')
end
retain(or_record)
#### Mapping starts here
## LIDO RecID
if exists(or_record.identificator.dataPid)
#if exists(or_record.identificator.data.persistentURIs)
lido_baseid(
lidoRecID,
or_record.identificator.dataPid,
-source: 'Museum voor Schone Kunsten Gent',
-type: 'global',
-label: 'dataPID'
)
end
## LIDO ObjectPublishedID
if exists(or_record.identificator.workPid)
#if exists(or_record.identificator.data.persistentURIs)
lido_baseid(
objectPublishedID,
or_record.identificator.workPid,
-source: 'Museum voor Schone Kunsten Gent',
-type: 'global',
-label: 'workPID'
)
#end
end
## LIDO Category
add_field("or_record.CIDOCCategoryTerm", "Man-Made Object")
add_field("or_record.CIDOCCategoryURI", "http://www.cidoc-crm.org/crm-concepts/E22")
lido_term(
or_record.category,
'or_record.CIDOCCategoryTerm',
-conceptid: 'or_record.CIDOCCategoryURI',
-type: 'URI',
-source: 'cidoc-crm',
)
## LIDO Classification
# Mapping Facets
# -----------------------------------------------------------------------------
# Adlib LIDO VKC
# object_category lido:objectWorkType Type kunstwerk
# lido:classification
# object_name (AAT) type:alternate
# object_name (Adlib) type:preferred
# content.motif.general (Adlib) lido:subjectWrap Voorstelling
# lido:materialsTech
# physical_description type:physicalDescription Materiaal
# institution.name lido:legalBodyName Museum
# creator.name lido:nameActorSet
# type:alternate
# type:preferred Kunstenaar
# production.period lido:periodName Periode
## LIDO classification & ObjectWorkType
if is_array(or_record.object_name)
# objectWorkType (we'll have multiple classifications)
lido_term(
descriptiveMetadata.objectClassificationWrap.objectWorkTypeWrap.objectWorkType.$append,
or_record.object_category.term,
-lang: nl,
-pref: preferred
)
do list(path: or_record.object_name, var: o)
copy_field(o.term, o.aat)
aat_match(o.aat)
if exists(o.aat.uri)
lido_term(
descriptiveMetadata.objectClassificationWrap.classificationWrap.classification.$append,
o.aat.prefLabel,
-conceptid: o.aat.uri,
-type: global,
-source: AAT,
-lang: nl,
-pref: alternate
)
else
copy_field(o.term, o.aat)
lookup_in_store(o.aat, DBI, data_source: "dbi:SQLite:/tmp/import.AAT.UTF8.sqlite")
lido_term(
descriptiveMetadata.objectClassificationWrap.classificationWrap.classification.$append,
o.aat.aatterm,
-conceptid: o.aat.aaturi,
-type: global,
-source: AAT,
-lang: nl,
-pref: alternate
)
end
lido_term(
descriptiveMetadata.objectClassificationWrap.classificationWrap.classification.$last,
o.term,
-pref: preferred,
)
end
else
copy_field(or_record.object_name.object_name.term, or_record.object_name.aat)
#lookup_in_store(or_record.object_name.aat, DBI, data_source: "dbi:SQLite:/tmp/import.AAT.UTF8.sqlite")
aat_match(or_record.object_name.aat)
if exists(or_record.object_name.aat.uri)
lido_classification (
or_record.object_category.term,
or_record.object_name.aat.prefLabel,
-classification_id: or_record.object_name.aat.uri,
-classification_type: global,
-classification_source: AAT,
-classification_type_lang: nl,
-classification_pref: 'alternate',
-object_work_type_lang: nl,
-object_work_type_pref: 'preferred',
)
else
copy_field(or_record.object_name.object_name.term, or_record.object_name.aat)
lookup_in_store(or_record.object_name.aat, DBI, data_source: "dbi:SQLite:/tmp/import.AAT.UTF8.sqlite")
lido_classification (
or_record.object_category.term,
or_record.object_name.aat.aatterm,
-classification_id: or_record.object_name.aat.aaturi,
-classification_type: global,
-classification_source: AAT,
-classification_type_lang: nl,
-classification_pref: 'alternate',
-object_work_type_lang: nl,
-object_work_type_pref: 'preferred',
)
end
lido_term(
descriptiveMetadata.objectClassificationWrap.classificationWrap.classification.$last,
or_record.object_name.object_name.term,
-pref: preferred,
)
end
## Adlib Object Name classification
# TODO: implement this as a to_array fix. Convert a single value to an array.
# Rationale: if a complexType with repeatable subnodes contains only one
# instance, it is converted to a string. Otherwise an array. Should always be
# an array so the paths don't turn variable & fixes shouldn't be repeated.
unless is_array(or_record.description)
copy_field(or_record.description.description, or_record.temp)
remove_field(or_record.description)
copy_field(or_record.temp, or_record.description.0.description)
remove_field(or_record.temp)
end
## LIDO Subject wrap
lido_term(
'descriptiveMetadata.objectRelationWrap.subjectWrap.subjectSet.subject.subjectConcept',
'or_record.subject.term',
-lang: 'nl'
)
### LIDO ObjectIdentification
## Title
lido_basenameset(
descriptiveMetadata.objectIdentificationWrap.titleWrap.titleSet,
or_record.title.title,
-value_lang: nl
)
if all_match('or_record.title_translation.1.title\.translation', '.*\S.*')
lido_basenameset(
descriptiveMetadata.objectIdentificationWrap.titleWrap.titleSet,
'or_record.title_translation.1.title\.translation',
-value_lang: en,
-value_pref: preferred
)
end
## Description
lido_descriptivenote(
descriptiveMetadata.objectIdentificationWrap.objectDescriptionWrap.objectDescriptionSet,
or_record.description.0.description,
-lang: 'nl'
)
lido_descriptivenote(
descriptiveMetadata.objectIdentificationWrap.objectDescriptionWrap.objectDescriptionSet,
or_record.description.2.description,
-lang: 'en'
)
## LIDO ObjectMeasurements
do list(path:or_record.dimensions, var:c)
if all_equal('c.dimension\.part', 'geheel')
copy_field('c.dimension\.type.term', c.dimension_type)
copy_field('c.dimension\.unit.term', c.dimension_unit)
copy_field('c.dimension\.value', c.dimension_value)
unless exists('c.dimension_unit')
add_field('c.dimension_unit', 'n/a')
end
unless exists('c.dimension_value')
# add_field('c.dimension_value', 'n/a')
end
unless all_match('c.dimension_value', '.*\S.*')
add_field('c.dimension_value', 'n/a')
end
lido_objectmeasurements(
'',
'c.dimension_type',
'c.dimension_unit',
'c.dimension_value'
)
end
end
##
# Event: production
##
## LIDO Event Type: Production
add_field(or_record.event_type, 'Production')
lido_term(
descriptiveMetadata.eventWrap.eventSet.$append.event.eventType,
or_record.event_type
)
## TODO: SQL lite support voor PID's integratie
## LIDO Event type: Actor (creator)
copy_field(or_record.production.creator.name, or_record.production.creator.pid)
lookup_in_store(or_record.production.creator.pid, DBI, data_source: "dbi:SQLite:/tmp/import.CREATORS.MSK.UTF8.sqlite")
lido_actor(
descriptiveMetadata.eventWrap.eventSet.$last.event.eventActor,
'or_record.production.creator\.lref',
or_record.production.creator.name,
-id_source: "Adlib",
-id_type: "local",
-birthdate: 'or_record.production.creator.birth\.date\.start',
-deathdate: 'or_record.production.creator.death\.date\.start',
-role: 'or_record.production.creator\.role.term',
-qualifier: 'or_record.production.creator\.qualifier',
-name_pref: 'alternate'
)
## Add Persistent URI data to actor
if exists(or_record.production.creator.pid.display_name)
## Preferred label from Flemish Art Collection concordance database
lido_basevalue(
descriptiveMetadata.eventWrap.eventSet.$last.event.eventActor.actorInRole.actor.nameActorSet.appellationValue,
or_record.production.creator.pid.display_name,
-pref: 'preferred'
)
## Creator Persistent URI's
lido_baseid(
descriptiveMetadata.eventWrap.eventSet.$last.event.eventActor.actorInRole.actor.actorID,
or_record.production.creator.pid.viaf_uri,
-source: 'VIAF',
-type: 'url'
)
lido_baseid(
descriptiveMetadata.eventWrap.eventSet.$last.event.eventActor.actorInRole.actor.actorID,
or_record.production.creator.pid.rkd_uri,
-source: 'RKD',
-type: 'url'
)
lido_baseid(
descriptiveMetadata.eventWrap.eventSet.$last.event.eventActor.actorInRole.actor.actorID,
or_record.production.creator.pid.wikidata_uri,
-source: 'Wikidata',
-type: 'url'
)
end
## LIDO Event date: creation date
lido_date(
descriptiveMetadata.eventWrap.eventSet.$last.event.eventDate.date,
-earliest_date: 'or_record.production_date.production\.date\.start',
-earliest_date_type: 'or_record.production_date.production\.date\.start\.prec',
-latest_date: 'or_record.production_date.production\.date\.end',
-latest_date_type: 'or_record.production_date.production\.date\.end\.prec'
)
## TODO: displayDate
paste(or_record.displayDate, "or_record.production_date.production\.date\.start", "or_record.production_date.production\.date\.end", join_char:" - ")
if all_match('or_record.production_date.production\.date\.start\.prec', '.*\S.*')
add_field('or_record.production_date.precision', 'circa')
end
if all_match('or_record.production_date.production\.date\.start\.prec', '.*\S.*'
)
add_field('or_record.production_date.precision', 'circa')
end
if exists('or_record.production_date.precision')
paste(or_record.displayDate, or_record.production_date.precision, or_record.displayDate)
end
lido_basevalue(
descriptiveMetadata.eventWrap.eventSet.$last.event.eventDate.displayDate,
or_record.displayDate
)
## LIDO Period name
## TODO: add local conceptID from Adlib
lido_term(
descriptiveMetadata.eventWrap.eventSet.$last.event.periodName,
'or_record.production_period.term',
-lang: 'nl'
)
## LIDO Event place: creation place
lido_basenameset (
descriptiveMetadata.eventWrap.eventSet.$last.event.eventPlace.place.namePlaceSet,
'or_record.production.production\.place.term',
-value_pref: 'preferred',
-value_lang: 'nl'
)
## LIDO eventMaterialsTech (Materiaal)
if exists(physical_description)
lido_basevalue(
descriptiveMetadata.eventWrap.eventSet.$last.event.eventMaterialsTech.displayMaterialsTech,
'or_record.physical_description',
)
end
# TODO: -conceptID does not work here
if exists(or_record.materials.material.term)
lido_term(
descriptiveMetadata.eventWrap.eventSet.$last.event.eventMaterialsTech.materialsTech.termMaterialsTech,
'or_record.materials.material.term',
-conceptid: 'or_record.materials.material.material\.lref', # Does not work
-source: 'Adlib',
-type: 'local'
)
add_field(descriptiveMetadata.eventWrap.eventSet.$last.event.eventMaterialsTech.materialsTech.termMaterialsTech.type, 'material')
end
## LIDO eventMaterialsTech (Techniek)
# TODO: -conceptID does not work here
if exists(or_record.physical_description)
lido_term(
descriptiveMetadata.eventWrap.eventSet.event.eventMaterialsTech.materialsTech.$append.termMaterialsTech,
'or_record.physical_description',
-conceptid: 'or_record.materials.material.material\.lref',
-source: 'Adlib'
)
# Debatable
add_field(descriptiveMetadata.eventWrap.eventSet.$last.event.eventMaterialsTech.materialsTech.termMaterialsTech.type, 'physicalDescription')
end
##
# recordWrap
##
## LIDO RecordID
lido_baseid(
administrativeMetadata.recordWrap.recordID,
or_record.object_number,
-type: 'local'
)
lido_baseid(
administrativeMetadata.recordWrap.recordID,
or_record.priref,
-type: 'Adlib'
)
## LIDO recordType
add_field('or_record.AATRecordTypeTerm', 'Item')
add_field('or_record.AATRecordTypeID', 'http://vocab.getty.edu/aat/300133025')
lido_term(
administrativeMetadata.recordWrap.recordType,
or_record.AATRecordTypeTerm,
-conceptid: 'or_record.AATRecordTypeID',
-type: 'local',
-source: 'AAT',
)
## LIDO recordSource
lido_basenameset(
administrativeMetadata.recordWrap.recordSource.legalBodyName,
or_record.institution.name
)
add_field('or_record.LegalBodyWebLink', 'http://mskgent.be')
lido_basevalue(
administrativeMetadata.recordWrap.recordSource.legalBodyWeblink,
or_record.LegalBodyWebLink
)
## Add lang attributes to descriptiveMetadata and administrativeMetadata
add_field(descriptiveMetadata.lang, 'nl')
add_field(administrativeMetadata.lang, 'nl')
## Remove the 'or_record' structure
remove_field(or_record)
#vacuum()