-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdatahub.kmska.be.fix
2922 lines (1881 loc) · 111 KB
/
datahub.kmska.be.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
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Catmandu Fix
# Institution: Royal Museum for Fine Arts Antwerp
# Description: Converts TMS datastructures to LIDO 1.0
# Created: 8/11/2017
### Prepare an intermediate structure
# Retain only those records where DepartmentID equals 1
select all_match(DepartmentID, '1')
# Copy relevant fields in order to create a dedicated LIDO structure
# Some fields, for example ObjectNumber, ObjectID, DateBegin, DateEnd, Dated and Medium, are obtained from the Objects table in MySQL
# Additional data is obtained from SQLite database files
# Identifiers
copy_field(ObjectNumber, or_record.object_number.local)
copy_field(ObjectID, or_record.object_number.tms)
copy_field(ObjectNumber, or_record.object_number.datapid)
lookup_in_store(or_record.object_number.datapid, DBI, data_source: 'dbi:SQLite:/tmp/tms_import.datapids.sqlite')
move_field(or_record.object_number.datapid.dataPid, or_record.object_number.pid.dataPid)
remove_field(or_record.object_number.datapid)
# Reject those records that have "(not assigned)" as data PID
reject all_match(or_record.object_number.pid.dataPid, '.*not assigned.*')
copy_field(ObjectNumber, or_record.object_number.workpid)
lookup_in_store(or_record.object_number.workpid, DBI, data_source: 'dbi:SQLite:/tmp/tms_import.workpids.sqlite')
move_field(or_record.object_number.workpid.workPid, or_record.object_number.pid.workPid)
remove_field(or_record.object_number.workpid)
copy_field(ObjectNumber, or_record.object_number.representationpid)
lookup_in_store(or_record.object_number.representationpid, DBI, data_source: 'dbi:SQLite:/tmp/tms_import.representationpids.sqlite')
move_field(or_record.object_number.representationpid.representationPid, or_record.object_number.pid.representationPid)
remove_field(or_record.object_number.representationpid)
# aat
copy_field(ObjectID, or_record.aat.db)
lookup_in_store(or_record.aat.db, DBI, data_source: 'dbi:SQLite:/tmp/tms_import.aat.sqlite')
# objectWrap
copy_field(ObjectID, or_record.objectWrap.db)
lookup_in_store(or_record.objectWrap.db, DBI, data_source: 'dbi:SQLite:/tmp/tms_import.objects.sqlite')
# objectNames
copy_field(ObjectID, or_record.objectNames.db)
lookup_in_store(or_record.objectNames.db, DBI, data_source: 'dbi:SQLite:/tmp/tms_import.objectnames.sqlite')
# classificationWrap
copy_field(ObjectID, or_record.classificationWrap.db)
lookup_in_store(or_record.classificationWrap.db, DBI, data_source: 'dbi:SQLite:/tmp/tms_import.classifications.sqlite')
# highlights
copy_field(ObjectID, or_record.highlights.db)
lookup_in_store(or_record.highlights.db, DBI, data_source: 'dbi:SQLite:/tmp/tms_import.highlights.sqlite')
# collectionPresentation
copy_field(ObjectID, or_record.collectionPresentation.db)
lookup_in_store(or_record.collectionPresentation.db, DBI, data_source: 'dbi:SQLite:/tmp/tms_import.collectionpresentation.sqlite')
# subjectWrap
copy_field(ObjectID, or_record.subjectWrap.db)
lookup_in_store(or_record.subjectWrap.db, DBI, data_source: 'dbi:SQLite:/tmp/tms_import.subjects.sqlite')
# materialWrap
copy_field(ObjectID, or_record.materialWrap.db)
lookup_in_store(or_record.materialWrap.db, DBI, data_source: 'dbi:SQLite:/tmp/tms_import.materials.sqlite')
# techniqueWrap
copy_field(ObjectID, or_record.techniqueWrap.db)
lookup_in_store(or_record.techniqueWrap.db, DBI, data_source: 'dbi:SQLite:/tmp/tms_import.techniques.sqlite')
# title
copy_field(ObjectNumber, or_record.titleWrap.db)
lookup_in_store(or_record.titleWrap.db, DBI, data_source: 'dbi:SQLite:/tmp/tms_import.objtitles.sqlite')
# inscriptions
copy_field(Inscribed, or_record.inscriptions)
# location
copy_field(ObjectID, or_record.location.db)
lookup_in_store(or_record.location.db, DBI, data_source: 'dbi:SQLite:/tmp/tms_import.locations.sqlite')
# clusters
# copy_field(ObjectID, or_record.clusters.db)
# lookup_in_store(or_record.clusters.db, DBI, data_source: 'dbi:SQLite:/tmp/tms_import.clusters.sqlite')
# halls
# copy_field(ObjectID, or_record.halls.db)
# lookup_in_store(or_record.halls.db, DBI, data_source: 'dbi:SQLite:/tmp/tms_import.halls.sqlite')
# textEntries
copy_field(ObjectID, or_record.textEntries.db)
lookup_in_store(or_record.textEntries.db, DBI, data_source: 'dbi:SQLite:/tmp/tms_import.textentries.sqlite')
# pageNumber
copy_field(ObjectID, or_record.pageNumber.db)
lookup_in_store(or_record.pageNumber.db, DBI, data_source: 'dbi:SQLite:/tmp/tms_import.pagenumbers.sqlite')
# handling
copy_field(ObjectID, or_record.handling.db)
lookup_in_store(or_record.handling.db, DBI, data_source: 'dbi:SQLite:/tmp/tms_import.handling.sqlite')
# objectMeasurements
copy_field(ObjectID, or_record.objectMeasurements.db)
lookup_in_store(or_record.objectMeasurements.db, DBI, data_source: 'dbi:SQLite:/tmp/tms_import.dimensions.sqlite')
# acquisition
copy_field(ObjectID, or_record.acquisition.db)
lookup_in_store(or_record.acquisition.db, DBI, data_source: 'dbi:SQLite:/tmp/tms_import.acquisition.sqlite')
# production actor (production)
copy_field(ObjectID, or_record.constituentWrap.db)
lookup_in_store(or_record.constituentWrap.db, DBI, data_source: 'dbi:SQLite:/tmp/tms_import.constituents.sqlite')
# production date (production)
unless all_equal(DateBegin, '0')
copy_field(DateBegin, or_record.date.begin)
end
unless all_equal(DateEnd, '0')
copy_field(DateEnd, or_record.date.end)
end
copy_field(Dated, or_record.date.display)
trim(or_record.date.begin)
trim(or_record.date.end)
trim(or_record.date.display)
# period
copy_field(ObjectID, or_record.periodName)
lookup_in_store(or_record.periodName, DBI, data_source: 'dbi:SQLite:/tmp/tms_import.periods.sqlite')
# place (not yet added)
# eventMaterialsTech
copy_field(Medium, or_record.eventMaterialsTech.display)
# provenance
copy_field(Provenance, or_record.provenance)
replace_all(or_record.provenance, '\r', '')
# restoration
copy_field(CreditLine, or_record.restoration)
# subjectConcept
copy_field(ObjectID, or_record.iconclass.db)
lookup_in_store(or_record.iconclass.db, DBI, data_source: 'dbi:SQLite:/tmp/tms_import.iconclass.sqlite')
# relatedWorksWrap
copy_field(ObjectID, or_record.relationWrap.db)
lookup_in_store(or_record.relationWrap.db, DBI, data_source: 'dbi:SQLite:/tmp/tms_import.relations.sqlite')
# linkLibrary
copy_field(UserNumber1, or_record.linkLibrary)
# linkArchive
copy_field(ObjectID, or_record.linkArchive.db)
lookup_in_store(or_record.linkArchive.db, DBI, data_source: 'dbi:SQLite:/tmp/tms_import.linkarchive.sqlite')
# recordSource
copy_field(ObjectID, or_record.department.db)
lookup_in_store(or_record.department.db, DBI, data_source: 'dbi:SQLite:/tmp/tms_import.departments.sqlite')
# resourceWrap
copy_field(ObjectNumber, or_record.iiif_manifest)
lookup_in_store(or_record.iiif_manifest, DBI, data_source: 'dbi:SQLite:/tmp/import.iiif_manifests.sqlite')
# Set placeholder if no manifest exists (look up 'placeholder_manifest' in sqlite)
unless all_match(or_record.iiif_manifest.manifest, '.*\S.*')
set_field(or_record.iiif_manifest, 'placeholder_manifest')
lookup_in_store(or_record.iiif_manifest, DBI, data_source: 'dbi:SQLite:/tmp/import.iiif_manifests.sqlite')
end
# translations
copy_field(ObjectID, or_record.translations.db)
lookup_in_store(or_record.translations.db, DBI, data_source: 'dbi:SQLite:/tmp/tms_import.translations.sqlite')
# Remove all fields from Objects, retaining only the ones necessary to create the LIDO structure
retain(or_record)
### Mapping to lido structure
# Mapping Facets
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# TMS - MySQL LIDO VKC Invulboek veld
# lido:lidoRecID
# vdatapids.dataPid type: purl waarde databanknummer
# type: urn
# vworkpids.workPid lido:objectPublishedID Work PURL waarde objectnummer
# lido:category
# lido:conceptID
# lido:term
# lido:objectWorkType
# lido:conceptID
# vobjectnames.objectNameID pref: preferred identificatie objectnaam
# lido:term
# vobjectnames.objectName pref: preferred Subtype term objectnaam
# lido:classification
# type: object-category
# lido:conceptID
# vclassifications.ClassificationID pref: preferred
# pref: alternate identificatie
# lido:term
# vclassifications.classification_nl pref: preferred / lang: nl Type term
# pref: alternate / lang: nl Type
# vclassifications.classification_en lang: en
# vclassifications.classification_fr lang: fr
# vhighlights lido:term
# vcollectionpresentation lido:term
# lido:titleSet
# lido:appellationValue
# vobjtitles.title lang: en titel
# vobjtitles.title lang: nl titel
# lido:sourceAppellation
# vobjtitles.titleid lang: en
# vobjtitles.titleid lang: nl
# lido:inscriptions
# lido:inscriptionDescription
# Objects.Inscribed lang: nl
# vtranslations.textEntry lang: en
# vtranslations.textEntry lang: fr
# lido:repositorySet
# lido:repositoryName
# vdepartments.DepartmentID lido:legalBodyID
# vdepartments.department lido:legalBodyName Instelling naam bewaarinstelling
# lido:workID
# Objects.ObjectNumber type: object-number Inventarisnummer waarde objectnummer
# lido:repositoryLocation
# vlocations.room_nl lang: nl
# vlocations.room_en lang: en
# vlocations.room_fr lang: fr
# lido:objectDescriptionSet
# vtextentries.textEntry lido:descriptiveNoteValue Beschrijving korte beschrijving
# type: page-number
# vpagenumbers.pageNumber lido:descriptiveNoteValue
# type: handling
# vhandling.handling lido:descriptiveNoteValue
# lido:objectMeasurementsSet
# vdimensions.display lido:displayObjectMeasurements
# lido:objectMeasurements
# lido:measurementsSet
# vdimensions.type lido:measurementType dimensie afmeting
# vdimensions.unit lido:measurementUnit Dimensies eenheid afmeting
# vdimensions.dimension lido:measurementValue Dimensies waarde afmeting
# vdimensions.element lido:extentMeasurements onderdeel afmeting
# lido:eventType
# lido:term
# acquisition
# lido:eventActor
# lido:actorID
# vacquisition.constituentID type: local
# vacquisition.name lido:nameActorSet naam verwervingsbron
# lido:eventDate
# vacquisition.date lido:displayDate waarde verwervingdatum
# lido:eventMethod
# lido:term
# vacquisition.role_nl lang: nl term verwervingsmethode
# vacquisition.role_en lang: en
# vacquisition.role_fr lang: fr
# lido:eventDescriptionSet
# lido:eventType
# lido:term
# production
# lido:eventActor
# lido:actorID
# vconstituents.ConstituentID type: local
# type: purl identificatie vervaardiger
# lido:nameActorSet
# vconstituents.DisplayName pref: preferred Vervaardiger naam vervaardiger
# pref: alternate
# lido:vitalDatesActor
# vconstituents.BeginDateISO lido:earliestDate
# vconstituents.EndDateISO lido:latestDate
# lido:roleActor
# vconstituents.role_nl lang: nl Vervaardiger rol vervaardiger
# vconstituents.role_en lang: en
# vconstituents.role_fr lang: fr
# lido:attributionQualifierActor
# vconstituents.role_nl lang: nl Vervaardiger kwalificatie vervaardiger
# vconstituents.role_en lang: en
# vconstituents.role_fr lang: fr
# lido:eventDate
# Objects.Dated lido:displayDate Datering
# lido:date
# Objects.DateBegin lido:earliestDate begindatum
# Objects.DateEnd lido:latestDate einddatum
# lido:periodName
# lido:term
# vperiods.term lang: nl
# vtranslations.textEntry lang: en
# vtranslations.textEntry lang: fr
# lido:eventMaterialsTech
# lido:termMaterialsTech
# type: material
# lido:conceptID
# vmaterials.TermID pref: preferred
# pref: alternate identificatie materiaal
# lido:term
# vmaterials.material pref: preferred Materiaal term materiaal
# pref: alternate
# type: technique
# lido:conceptID
# vtechniques.TermID pref: preferred
# lido:term
# vtechniques.technique pref: preferred
# lido:displayMaterialsTech
# Objects.Medium lang: nl
# vtranslations.textEntry lang: en
# vtranslations.textEntry lang: fr
# lido:eventType
# lido:term
# provenance
# Objects.Provenance lido:eventDescriptionSet
# lido:eventType
# lido:term
# restoration
# lido:eventDescriptionSet
# Objects.CreditLine lang: nl
# vtranslations.textEntry lang: en
# vtranslations.textEntry lang: fr
# lido:objectRelationWrap
# lido:subjectWrap
# lido:subject
# type: content-motif-general
# lido:subjectConcept
# lido:conceptID
# vsubjects.TermID pref: preferred
# pref: alternate identificatie hoofdmotief
# lido:term
# vsubjects.subject pref: preferred Onderwerp term hoofdmotief
# pref: alternate Onderwerp
# source: Iconclass
# lido:subjectConcept
# viconclass lido:conceptID identificatie afgebeeld concept
# viconclass lido:term term afgebeeld concept
# lido:relatedWorksWrap
# lido:relatedWorkSet
# vrelations.numbering sortorder
# lido:relatedWork
# lido:objectID
# vrelations.relatedObjectNumber type: local
# type: oai
# lido:relatedWorkRelType
# vrelations.relationshipID1(2) lido:conceptID
# type: local
# type: URI
# vrelations.relationship lido:term
# lido:relatedWorkSet
# Objects.UserNumber1 lido:objectWebResource
# label: link-library
# lido:relatedWorkSet
# vlinkarchive.link lido:objectWebResource
# label: link-archive
# lido:rightsWorkWrap
# lido:rightsType
# lido:conceptID identificatie rechten werk
# vconstituents.copyright lido:term term rechten werk
# vconstituents.copyright lido:creditLine
# lido:recordWrap
# lido:recordID
# vdatapids.dataPid type: global Data PURL waarde databanknummer
# Objects.ObjectID type: local waarde databanknummer
# lido:recordType
# lido:conceptID
# lido:term
# lido:recordSource
# vdepartments.DepartmentID lido:legalBodyID identificatie data provider
# vdepartments.department lido:legalBodyName naam data provider
# lido:legalBodyWeblink
# lido:resourceWrap
# vrepresentationpids.representationPid lido:resourceID
# lido:resourceRepresentation
# vrepresentationpids.representationPid lido:linkResource
### LIDO lidoRecID
# ID
#
# The ID in Solr is based on the data_pid. The data_pid is converted to a string
# which can be safely used as an identifier in Project Blacklight. The format of
# the ID field looks like this:
#
# oai:datahub.kmska.be:<domain>:<identifier>
# ex. oai:datahub.kmska.be:kmksa.be:254
# ex. oai:datahub.kmska.be:collectievlaamsegemeenschap.be:837
#
# Note: the .tld is stripped from the domainname because the . (dot) breaks the
# route matching algoritm.
# Create datahub record ID
copy_field('or_record.object_number.pid.dataPid', 'or_record.object_number.pid.oaiPid')
parse_text('or_record.object_number.pid.oaiPid', '.*://([A-Za-z0-9\-\.]+)/collection/work/data/(.*)')
join_field('or_record.object_number.pid.oaiPid', ':')
prepend('or_record.object_number.pid.oaiPid', 'oai:datahub.kmska.be:')
# Add datapid from TMS as LIDO lidoRecID (type:purl)
lido_baseid(
lidoRecID,
or_record.object_number.pid.dataPid,
-type: purl,
-source: 'Koninklijk Museum voor Schone Kunsten Antwerpen',
-label: dataPID,
-pref: alternate
)
# Add the created datahub record ID as LIDO lidoRecID (type:urn)
lido_baseid(
lidoRecID,
or_record.object_number.pid.oaiPid,
-type: urn,
-source: 'Koninklijk Museum voor Schone Kunsten Antwerpen',
-label: dataPID,
-pref: preferred
)
### LIDO objectPublishedID
# Add workpid from TMS as LIDO objectPublishedID
lido_baseid(
objectPublishedID,
or_record.object_number.pid.workPid,
-source: 'Koninklijk Museum voor Schone Kunsten Antwerpen',
-type: purl,
-label: workPID
)
### LIDO category
# Create CIDOCCategoryTerm and CIDOCCategoryURI
add_field(or_record.CIDOCCategoryTerm, 'Man-Made Object')
add_field(or_record.CIDOCCategoryURI, 'http://www.cidoc-crm.org/Entity/e22-man-made-object/version-6.1')
# Add the created CIDOCCategoryTerm to LIDO category as LIDO term along with the CIDOCCategoryURI as LIDO conceptID
lido_term(
category,
or_record.CIDOCCategoryTerm,
-conceptid: or_record.CIDOCCategoryURI,
-type: purl,
-source: cidoc-crm
)
### LIDO descriptiveMetadata
## LIDO objectClassificationWrap
# LIDO objectWorkType
# We'll have multiple object names: the corresponding value from AAT (source:AAT) and the value from TMS (source:TMS)
# Loop over the different object names from TMS
do list(path:or_record.objectNames.db.objectnames, var:n)
# Use ObjectNameTypeID 0 (not entered) or 2 (object name by form)
if all_match(n.objectNameTypeID, '^[02]$')
# Add each object name from TMS to LIDO objectWorkType as LIDO term (pref:preferred) along with the ObjectNameID from TMS as LIDO conceptID (pref:preferred)
lido_term(
descriptiveMetadata.objectClassificationWrap.objectWorkTypeWrap.objectWorkType.$append,
n.objectName,
-conceptid: n.objectNameID,
-type: local,
-source: TMS,
-pref: preferred,
-lang: nl
)
add_field(descriptiveMetadata.objectClassificationWrap.objectWorkTypeWrap.objectWorkType.$last.type, 'form')
end
end
set_field(or_record.objectName_aat_exists, '')
# Loop over the different object names from AAT
do list(path:or_record.aat.db.aat, var:a)
# Use path starting with 'TGO.AAI' or 'AAT.V'
if all_match(a.path, '^TGO\.AAI|AAT\.V.*$')
set_field(or_record.objectName_aat_exists, 'true')
lido_term(
descriptiveMetadata.objectClassificationWrap.objectWorkTypeWrap.objectWorkType.$append,
a.term,
-pref: preferred,
-lang: nl
)
# Retrieve the corresponding term and URI from the AAT vocabulary
copy_field(a.term, a.objectName_aat)
lookup_in_store(a.objectName_aat, DBI, data_source: "dbi:SQLite:/tmp/import.AAT_UTF8.sqlite")
# Add the corresponding term from the AAT vocabulary (if present) to LIDO objectWorkType as LIDO term (pref:alternate) along with the URI from the AAT vocabulary (if present) as LIDO conceptID (pref:alternate)
if all_match(a.objectName_aat.aatterm, '.*\S.*')
if all_match(a.objectName_aat.aaturi, '.*\S.*')
lido_term(
descriptiveMetadata.objectClassificationWrap.objectWorkTypeWrap.objectWorkType.$last,
a.objectName_aat.aatterm,
-conceptid: a.objectName_aat.aaturi,
-type: purl,
-source: AAT,
-pref: alternate,
-lang: nl
)
else
lido_term(
descriptiveMetadata.objectClassificationWrap.objectWorkTypeWrap.objectWorkType.$last,
a.objectName_aat.aatterm,
-pref: alternate,
-lang: nl
)
end
end
unless all_match(descriptiveMetadata.objectClassificationWrap.objectWorkTypeWrap.objectWorkType.$last.conceptID.source, '.*\S.*')
add_field(descriptiveMetadata.objectClassificationWrap.objectWorkTypeWrap.objectWorkType.$last.conceptID._, '')
add_field(descriptiveMetadata.objectClassificationWrap.objectWorkTypeWrap.objectWorkType.$last.conceptID.type, 'purl')
add_field(descriptiveMetadata.objectClassificationWrap.objectWorkTypeWrap.objectWorkType.$last.conceptID.source, 'AAT')
end
end
end
# If there is no object name from AAT, try using object terms
unless all_match(or_record.objectName_aat_exists, 'true')
# We'll have multiple object terms: the corresponding value from the AAT vocabulary (pref:alternate) and the value from TMS (pref:preferred)
# Loop over the different object terms from TMS
do list(path:or_record.objectWrap.db.objects, var:o)
# Add each object term from TMS to LIDO objectWorkType as LIDO term (pref:preferred) along with the termID from TMS as LIDO conceptID (pref:preferred)
lido_term(
descriptiveMetadata.objectClassificationWrap.objectWorkTypeWrap.objectWorkType.$append,
o.object,
-conceptid: o.TermID,
-type: local,
-source: TMS,
-pref: preferred,
-lang: nl
)
# Retrieve the corresponding term and URI from the AAT vocabulary
copy_field(o.object, o.object_aat)
lookup_in_store(o.object_aat, DBI, data_source: "dbi:SQLite:/tmp/import.AAT_UTF8.sqlite")
# Add the corresponding term from the AAT vocabulary (if present) to LIDO objectWorkType as LIDO term (pref:alternate) along with the URI from the AAT vocabulary (if present) as LIDO conceptID (pref:alternate)
if all_match(o.object_aat.aatterm, '.*\S.*')
if all_match(o.object_aat.aaturi, '.*\S.*')
lido_term(
descriptiveMetadata.objectClassificationWrap.objectWorkTypeWrap.objectWorkType.$last,
o.object_aat.aatterm,
-conceptid: o.object_aat.aaturi,
-type: purl,
-source: AAT,
-pref: alternate,
-lang: nl
)
else
lido_term(
descriptiveMetadata.objectClassificationWrap.objectWorkTypeWrap.objectWorkType.$last,
o.object_aat.aatterm,
-pref: alternate,
-lang: nl
)
end
end
end
end
# LIDO classification [type="object-category"]
# We'll have multiple terms for the type "object-category": the corresponding value from the AAT vocabulary (pref:alternate) and the value from TMS (pref:preferred)
# Loop over the different classification terms from TMS
do list(path:or_record.classificationWrap.db.classifications, var:c)
# Add each classification term from TMS to LIDO classification as LIDO term (pref:preferred) along with the classificationID from TMS as LIDO conceptID (pref:preferred)
lido_term(
descriptiveMetadata.objectClassificationWrap.classificationWrap.classification.$append,
c.classification_nl,
-conceptid: c.ClassificationID,
-type: local,
-source: TMS,
-pref: preferred,
-lang: nl
)
copy_field(c.classification_en, descriptiveMetadata.objectClassificationWrap.classificationWrap.classification.$last.term.$append._)
add_field(descriptiveMetadata.objectClassificationWrap.classificationWrap.classification.$last.term.$last.pref, "preferred")
add_field(descriptiveMetadata.objectClassificationWrap.classificationWrap.classification.$last.term.$last.lang, "en")
copy_field(c.classification_fr, descriptiveMetadata.objectClassificationWrap.classificationWrap.classification.$last.term.$append._)
add_field(descriptiveMetadata.objectClassificationWrap.classificationWrap.classification.$last.term.$last.pref, "preferred")
add_field(descriptiveMetadata.objectClassificationWrap.classificationWrap.classification.$last.term.$last.lang, "fr")
# Add type of LIDO classification
add_field(descriptiveMetadata.objectClassificationWrap.classificationWrap.classification.$last.type, "object-category")
# Retrieve the corresponding term and URI from the AAT vocabulary
copy_field(c.classification_nl, c.classification_aat)
lookup_in_store(c.classification_aat, DBI, data_source: "dbi:SQLite:/tmp/import.AAT_UTF8.sqlite")
# Add the corresponding term from the AAT vocabulary (if present) to LIDO classification as LIDO term (pref:alternate) along with the URI from the AAT vocabulary (if present) as LIDO conceptID (pref:alternate)
if all_match(c.classification_aat.aatterm, '.*\S.*')
if all_match(c.classification_aat.aaturi, '.*\S.*')
lido_term(
descriptiveMetadata.objectClassificationWrap.classificationWrap.classification.$last,
c.classification_aat.aatterm,
-conceptid: c.classification_aat.aaturi,
-type: purl,
-source: AAT,
-pref: alternate,
-lang: nl
)
else
lido_term(
descriptiveMetadata.objectClassificationWrap.classificationWrap.classification.$last,
c.classification_aat.aatterm,
-pref: alternate,
-lang: nl
)
end
# Add type of LIDO classification
add_field(descriptiveMetadata.objectClassificationWrap.classificationWrap.classification.$last.type, "object-category")
end
end
# LIDO classification
# Highlights
# Add term "highlights" from TMS (if present) to LIDO classification as LIDO term
if all_match('or_record.highlights.db._id', '.*\S.*')
set_field(or_record.highlights_term, "highlights")
lido_term(
descriptiveMetadata.objectClassificationWrap.classificationWrap.classification.$append,
or_record.highlights_term
)
end
# Collection presentation
# Add term "collection presentation" from TMS (if present) to LIDO classification as LIDO term
if all_match('or_record.collectionPresentation.db._id', '.*\S.*')
set_field(or_record.collectionPresentation_term, "collection presentation")
lido_term(
descriptiveMetadata.objectClassificationWrap.classificationWrap.classification.$append,
or_record.collectionPresentation_term
)
end
## LIDO objectIdentificationWrap
# LIDO titleSet
# Loop over the different titles from TMS
do list(path:or_record.titleWrap.db.objtitles, var:t)
# Use TitleTypeID 1 (titles)
if all_match(t.titletypeid, '1')
# Remove unnecessary whitespaces
trim(t.title)
trim(t.titleid)
# Add each title from TMS to LIDO titleSet as LIDO appellationValue along with the titleID from TMS as LIDO sourceAppellation
copy_field(t.title, descriptiveMetadata.objectIdentificationWrap.titleWrap.titleSet.appellationValue.$append._)
set_field(descriptiveMetadata.objectIdentificationWrap.titleWrap.titleSet.appellationValue.$last.pref, 'preferred')
copy_field(t.language, descriptiveMetadata.objectIdentificationWrap.titleWrap.titleSet.appellationValue.$last.lang)
copy_field(t.titleid, descriptiveMetadata.objectIdentificationWrap.titleWrap.titleSet.sourceAppellation.$append._)
copy_field(t.language, descriptiveMetadata.objectIdentificationWrap.titleWrap.titleSet.sourceAppellation.$last.lang)
end
end
# If there is no title, try using TitleTypeID 2 (series titles)
unless all_match(descriptiveMetadata.objectIdentificationWrap.titleWrap.titleSet.appellationValue.0._, '.*\S.*')
# Loop over the different titles from TMS
do list(path:or_record.titleWrap.db.objtitles, var:t)
if all_match(t.titletypeid, '2')
# Remove unnecessary whitespaces
trim(t.title)
trim(t.titleid)
# Add each series title from TMS to LIDO titleSet with type 'series-title' as LIDO appellationValue along with the titleID from TMS as LIDO sourceAppellation
set_field(descriptiveMetadata.objectIdentificationWrap.titleWrap.titleSet.type, 'series-title')
copy_field(t.title, descriptiveMetadata.objectIdentificationWrap.titleWrap.titleSet.appellationValue.$append._)
set_field(descriptiveMetadata.objectIdentificationWrap.titleWrap.titleSet.appellationValue.$last.pref, 'preferred')
copy_field(t.language, descriptiveMetadata.objectIdentificationWrap.titleWrap.titleSet.appellationValue.$last.lang)
copy_field(t.titleid, descriptiveMetadata.objectIdentificationWrap.titleWrap.titleSet.sourceAppellation.$append._)
copy_field(t.language, descriptiveMetadata.objectIdentificationWrap.titleWrap.titleSet.sourceAppellation.$last.lang)
end
end
end
# LIDO inscriptions
# Split separate inscriptions
split_field(or_record.inscriptions, '(\r\n|\r|\n)')
do list(path:or_record.translations.db.translations, var:t)
if all_match(t.textTypeID, '121')
copy_field(t.textEntry, or_record.inscriptions_en)
split_field(or_record.inscriptions_en, '(\r\n|\r|\n)')
end
if all_match(t.textTypeID, '129')
copy_field(t.textEntry, or_record.inscriptions_fr)
split_field(or_record.inscriptions_fr, '(\r\n|\r|\n)')
end
end
# Loop over the separate inscriptions
do list(path:or_record.inscriptions, var:i)
if all_match('i', '.*\S.*')
# Add a new, empty LIDO inscriptions field
add_field(descriptiveMetadata.objectIdentificationWrap.inscriptionsWrap.inscriptions.$append)
copy_field(i, or_record.inscription)
if all_match(or_record.inscription, '.*:.*')
# Split the inscriptions on the colon
split_field(or_record.inscription, ':')
set_field(or_record.inscriptionDescription)
# Loop over the different parts of the inscriptions
do list(path:or_record.inscription, var:in)
# Remove unnecessary whitespaces and parentheses
if all_match(in, '.*\S.*')
trim(in)
if all_match(in, '^\(.*\)$')
replace_all(in,'^\((.*)',$1)
replace_all(in,'(.*)\)$',$1)
end
if all_match (descriptiveMetadata.objectIdentificationWrap.inscriptionsWrap.inscriptions.$last.inscriptionDescription.$last.type, 'position')
# Add each inscription content from TMS (if present) to LIDO inscriptions as LIDO inscriptionTranscription
copy_field('in', descriptiveMetadata.objectIdentificationWrap.inscriptionsWrap.inscriptions.$last.inscriptionTranscription._)
paste(or_record.inscriptionDescription, or_record.inscriptionDescription, in, join_char:': ')
else
# Add each inscription position from TMS (if present) to LIDO inscriptions as LIDO inscriptionDescription (type:position)
copy_field('in', descriptiveMetadata.objectIdentificationWrap.inscriptionsWrap.inscriptions.$last.inscriptionDescription.$append.descriptiveNoteValue._)
add_field(descriptiveMetadata.objectIdentificationWrap.inscriptionsWrap.inscriptions.$last.inscriptionDescription.$last.type, "position")
add_field(descriptiveMetadata.objectIdentificationWrap.inscriptionsWrap.inscriptions.$last.inscriptionDescription.$last.descriptiveNoteValue.lang, "nl")
copy_field('in', or_record.inscriptionDescription)
end
end
end
# Add each entire inscription description from TMS (if present) to LIDO inscriptions as LIDO inscriptionDescription
if all_match('or_record.inscriptionDescription', '.*\S.*')
copy_field('or_record.inscriptionDescription', descriptiveMetadata.objectIdentificationWrap.inscriptionsWrap.inscriptions.$last.inscriptionDescription.$append.descriptiveNoteValue._)
add_field(descriptiveMetadata.objectIdentificationWrap.inscriptionsWrap.inscriptions.$last.inscriptionDescription.$last.descriptiveNoteValue.lang, "nl")
end
else
# Remove unnecessary whitespaces and parentheses
trim(or_record.inscription)
if all_match(or_record.inscription, '^\(.*\)$')
replace_all(or_record.inscription,'^\((.*)',$1)
replace_all(or_record.inscription,'(.*)\)$',$1)
end
# Add each entire inscription description from TMS (if present) to LIDO inscriptions as LIDO inscriptionDescription
copy_field('or_record.inscription', descriptiveMetadata.objectIdentificationWrap.inscriptionsWrap.inscriptions.$last.inscriptionDescription.$append.descriptiveNoteValue._)
add_field(descriptiveMetadata.objectIdentificationWrap.inscriptionsWrap.inscriptions.$last.inscriptionDescription.$last.descriptiveNoteValue.lang, "nl")
end
end
end
# Loop over the separate inscriptions
do list(path:or_record.inscriptions_en, var:i)
if all_match('i', '.*\S.*')
# Add a new, empty LIDO inscriptions field
add_field(descriptiveMetadata.objectIdentificationWrap.inscriptionsWrap.inscriptions.$append)
copy_field(i, or_record.inscription)
if all_match(or_record.inscription, '.*:.*')
# Split the inscriptions on the colon
split_field(or_record.inscription, ':')
set_field(or_record.inscriptionDescription)
# Loop over the different parts of the inscriptions
do list(path:or_record.inscription, var:in)
# Remove unnecessary whitespaces and parentheses
if all_match(in, '.*\S.*')
trim(in)
if all_match(in, '^\(.*\)$')
replace_all(in,'^\((.*)',$1)
replace_all(in,'(.*)\)$',$1)
end
if all_match (descriptiveMetadata.objectIdentificationWrap.inscriptionsWrap.inscriptions.$last.inscriptionDescription.$last.type, 'position')
# Add each inscription content from TMS (if present) to LIDO inscriptions as LIDO inscriptionTranscription
copy_field('in', descriptiveMetadata.objectIdentificationWrap.inscriptionsWrap.inscriptions.$last.inscriptionTranscription._)
paste(or_record.inscriptionDescription, or_record.inscriptionDescription, in, join_char:': ')
else
# Add each inscription position from TMS (if present) to LIDO inscriptions as LIDO inscriptionDescription (type:position)
copy_field('in', descriptiveMetadata.objectIdentificationWrap.inscriptionsWrap.inscriptions.$last.inscriptionDescription.$append.descriptiveNoteValue._)
add_field(descriptiveMetadata.objectIdentificationWrap.inscriptionsWrap.inscriptions.$last.inscriptionDescription.$last.type, "position")
add_field(descriptiveMetadata.objectIdentificationWrap.inscriptionsWrap.inscriptions.$last.inscriptionDescription.$last.descriptiveNoteValue.lang, "en")
copy_field('in', or_record.inscriptionDescription)
end