-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathrelatedRessourcesAndLinks.fix
More file actions
943 lines (786 loc) · 34.4 KB
/
Copy pathrelatedRessourcesAndLinks.fix
File metadata and controls
943 lines (786 loc) · 34.4 KB
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
add_array("sameAs[]")
# 035 - System Control Number (R) - Subfield: $a (NR)
if any_match("almaMmsId","^.*6441$")
paste("sameAs[].$append.id", "~https://hub.culturegraph.org/resource/(DE-605)","almaMmsId",join_char:"")
add_field("sameAs[].$last.label","Culturegraph-Ressource")
end
# oclc
do list(path: "oclcNumber[]", "var": "$i")
paste("sameAs[].$append.id","~http://worldcat.org/oclc/", "$i", join_char:"")
add_field("sameAs[].$last.label","OCLC-Ressource")
end
# zdb
do list(path: "zdbId", "var": "$i")
paste("sameAs[].$append.id","~http://ld.zdb-services.de/resource/", "$i", join_char:"")
add_field("sameAs[].$last.label","ZDB-Ressource")
end
# dnb
do list(path: "dnbId", "var": "$i")
paste("sameAs[].$append.id","~https://d-nb.info/", "$i", join_char:"")
add_field("sameAs[].$last.label","DNB-Ressource")
end
# bvb
do list(path: "bvbId", "var": "$i")
paste("sameAs[].$append.id","~https://gateway-bayern.de/", "$i", join_char:"")
add_field("sameAs[].$last.label","BVB-Ressource")
end
# kobv
do list(path: "kobvId", "var": "$i")
paste("sameAs[].$append.id","~https://portal.kobv.de/uid.do?query=", "$i", "~&index=internal&plv=2", join_char:"")
add_field("sameAs[].$last.label","kobv-Ressource")
end
# k10Plus
do list(path: "kobvId", "var": "$i")
paste("sameAs[].$append.id","~https://opac.k10plus.de/DB=2.299/PPNSET?PPN=", "$i", "~&PRS=HOL&INDEXSET=21", join_char:"")
add_field("sameAs[].$last.label","K10plus-Ressource")
end
# k10Plus
do list(path: "k10PlusId", "var": "$i")
paste("sameAs[].$append.id","~https://opac.k10plus.de/DB=2.299/PPNSET?PPN=", "$i", "~&PRS=HOL&INDEXSET=21", join_char:"")
add_field("sameAs[].$last.label","K10plus-Ressource")
end
# hebis
do list(path: "hebisId", "var": "$i")
paste("sameAs[].$append.id","~http://cbsopac.rz.uni-frankfurt.de/DB=2.1/PPNSET?PPN=", "$i", join_char:"")
add_field("sameAs[].$last.label","hebis-Ressource")
end
# obv
do list(path: "obvId", "var": "$i")
paste("sameAs[].$append.id","~https://permalink.obvsg.at/", "$i", join_char:"")
add_field("sameAs[].$last.label","obv-Ressource")
end
# rpb
do list(path: "rpbId", "var": "$i")
paste("sameAs[].$append.id","~https://rpb.lbz-rlp.de/", "$i",join_char:"")
add_field("sameAs[].$last.label","RPB-Ressource")
end
# DBIS
do list(path: "856??", "var":"$i")
if exists("$i.u")
if all_match("$i.x", ".*DBIS.*")
copy_field("$i.u", "sameAs[].$append.id")
add_field("sameAs[].$last.label","DBIS-Ressource")
add_field("@dbis","DBIS-Ressource")
end
end
end
# nwbib, see below inCollection nwbib
# 770 - Supplement/Special Issue Entry (R) - Subflied: $i (R), $t (NR), $w (R)
add_array("supplement[]")
do list(path:"77008", "var":"$i")
if any_match("$i.i", "Beil.*|Supp.*")
add_hash( "supplement[].$append")
add_array("supplement[].$last.note[]")
do list(path:"$i.i","var":"$j")
copy_field("$j","supplement[].$last.note[].$append")
end
paste("supplement[].$last.label","$i.t","$i.b",join_char:". ")
do list(path:"$i.w","var": "$j")
if all_match("$j","^\\((?:DE-600|DE-605)\\)(.+)$")
copy_field("$j","supplement[].$last.id")
end
end
end
end
replace_all("supplement[].*.id","^\\(DE-605\\)(.+)$","http://lobid.org/resources/$1#!")
replace_all("supplement[].*.id","^\\(DE-600\\)(.+)$","http://lobid.org/resources/ZDB-$1#!")
replace_all("supplement[].*.label","<<|>>","")
call_macro("lobidResourcesFallbackLabel",field:"supplement[]")
# isPartOf
# it describes the relation between a published ressource and its superordinate series or collection.
# in contrast to containedIn it is a standalone publication
add_array("isPartOf[]")
# 773 - Host Item Entry (R) Subfield: $w (NR), $t (NR), $q (NR)
unless any_match("leader", "^.{7}[ad].*")
do list(path: "773??", "var": "$i")
unless any_equal("$i.9","LOCAL")
if any_match("$i.w","^\\((?:DE-600|DE-605)\\)(.+)$") # Handling of relations to HBZ/ZDB resources.
do list(path: "$i.w", "var": "$j")
if all_match("$j", "^\\((?:DE-600|DE-605)\\)(.+)$")
add_hash("isPartOf[].$append")
add_array("isPartOf[].$last.hasSuperordinate[]")
add_hash( "isPartOf[].$last.hasSuperordinate[].$append")
copy_field("$j", "isPartOf[].$last.hasSuperordinate[].$last.id")
copy_field("$i.t", "isPartOf[].$last.hasSuperordinate[].$last.label")
call_macro("alternateGraphicRepresentationIsPartOf",variable:"$i")
copy_field("$i.q", "isPartOf[].$last.numbering")
add_array("isPartOf[].$last.note[]")
do list(path:"$i.i","var":"$k")
copy_field("$k","isPartOf[].$last.note[].$append")
end
end
end
else # Handling of relations without HBZ/ZDB identifier
unless exists("isPartOf[].1.hasSuperordinate[].1.id") # This skips the mapping of relations without HBZ/ZDB refrence if already an isPartOf[] Object exists that links to a HBZ/ZDB resource.
add_hash("isPartOf[].$append")
add_array("isPartOf[].$last.hasSuperordinate[]")
add_hash( "isPartOf[].$last.hasSuperordinate[].$append")
copy_field("$i.t", "isPartOf[].$last.hasSuperordinate[].$last.label")
call_macro("alternateGraphicRepresentationIsPartOf",variable:"$i")
copy_field("$i.q", "isPartOf[].$last.numbering")
add_array("isPartOf[].$last.note[]")
do list(path:"$i.i","var":"$k")
copy_field("$k","isPartOf[].$last.note[].$append")
end
end
end
end
end
end
# 490 - Series Statement (R) - Subfield: $a (R)
# 490 with 1. Indicator 1 has an identical entry in 830. So only 490 with 1. Indicator 0
do list(path: "4900?", "var": "$i")
add_hash("isPartOf[].$append")
add_array("isPartOf[].$last.hasSuperordinate[]")
add_hash( "isPartOf[].$last.hasSuperordinate[].$append")
add_array("isPartOf[].$last.hasSuperordinate[].$last.label")
do list(path:"$i.a", "var":"$j")
copy_field("$j", "isPartOf[].$last.hasSuperordinate[].$last.label.$append")
end
join_field("isPartOf[].$last.hasSuperordinate[].$last.label", " / ")
call_macro("alternateGraphicRepresentationIsPartOf",variable:"$i")
add_array("isPartOf[].$last.numbering")
do list(path:"$i.v", "var":"$j")
copy_field("$j", "isPartOf[].$last.numbering.$append")
end
join_field("isPartOf[].$last.numbering")
end
unless exists("830??")
do list(path: "4901?", "var": "$i")
add_hash("isPartOf[].$append")
add_array("isPartOf[].$last.hasSuperordinate[]")
add_hash( "isPartOf[].$last.hasSuperordinate[].$append")
add_array("isPartOf[].$last.hasSuperordinate[].$last.label")
do list(path:"$i.a", "var":"$j")
copy_field("$j", "isPartOf[].$last.hasSuperordinate[].$last.label.$append")
end
join_field("isPartOf[].$last.hasSuperordinate[].$last.label", " / ")
call_macro("alternateGraphicRepresentationIsPartOf",variable:"$i")
add_array("isPartOf[].$last.numbering")
do list(path:"$i.v", "var":"$j")
copy_field("$j", "isPartOf[].$last.numbering.$append")
end
join_field("isPartOf[].$last.numbering")
end
end
# 830 - Series Added Entry-Uniform Title (R) - Subfield: $w (R), $a (NR), $v (NR)
# Element can be repeatable with local entries they have subfield $M.
do list(path: "830??", "var": "$i")
add_hash("isPartOf[].$append")
add_array("isPartOf[].$last.hasSuperordinate[]")
add_hash( "isPartOf[].$last.hasSuperordinate[].$append")
if all_match("$i.w", "^\\((?:DE-600|DE-605)\\)(.+)$")
copy_field("$i.w", "isPartOf[].$last.hasSuperordinate[].$last.id")
end
do list(path:"$i.a", "var":"$j")
copy_field("$j", "isPartOf[].$last.hasSuperordinate[].$last.label.$append")
end
join_field("isPartOf[].$last.hasSuperordinate[].$last.label", " / ")
unless is_empty("isPartOf[].$last.hasSuperordinate[].1")
copy_field("$i.v", "isPartOf[].$last.numbering")
end
end
do list(path: "4901?", "var": "$j") #alternateGraphicRepresentation for 830 is included in 4901?
call_macro("alternateGraphicRepresentationIsPartOf",variable:"$j")
end
replace_all("isPartOf[].*.hasSuperordinate[].*.label","<<|>>","")
# containedIn
# containedIn only states ressources that are not published by them self but as part of a host ressource.
add_array("containedIn[]")
# 773 - Host Item Entry (R) - $w (R)
if any_match("leader", "^.{7}[ad].*")
if exists("@titleOfSubSeries")
do list(path: "773??", "var": "$i")
unless any_equal("$i.9","LOCAL")
if any_match("$i.w","^\\((?:DE-600|DE-605)\\)(.+)$") # Handling of relations to HBZ/ZDB resources.
do list(path: "$i.w", "var": "$j")
if all_match("$j", "^\\((?:DE-600|DE-605)\\)(.+)$")
add_hash("isPartOf[].$append")
add_array("isPartOf[].$last.hasSuperordinate[]")
add_hash( "isPartOf[].$last.hasSuperordinate[].$append")
copy_field("$j", "isPartOf[].$last.hasSuperordinate[].$last.id")
copy_field("$i.t", "isPartOf[].$last.hasSuperordinate[].$last.label")
call_macro("alternateGraphicRepresentationIsPartOf",variable:"$i")
copy_field("$i.q", "isPartOf[].$last.numbering")
add_array("isPartOf[].$last.note[]")
do list(path:"$i.i","var":"$k")
copy_field("$k","isPartOf[].$last.note[].$append")
end
end
end
else # Handling of relations without HBZ/ZDB identifier
unless exists("isPartOf[].1.hasSuperordinate[].1.id") # This skips the mapping of relations without HBZ/ZDB refrence if already an isPartOf[] Object exists that links to a HBZ/ZDB resource.
add_hash("isPartOf[].$append")
add_array("isPartOf[].$last.hasSuperordinate[]")
add_hash( "isPartOf[].$last.hasSuperordinate[].$append")
copy_field("$i.t", "isPartOf[].$last.hasSuperordinate[].$last.label")
call_macro("alternateGraphicRepresentationIsPartOf",variable:"$i")
copy_field("$i.q", "isPartOf[].$last.numbering")
add_array("isPartOf[].$last.note[]")
do list(path:"$i.i","var":"$k")
copy_field("$k","isPartOf[].$last.note[].$append")
end
end
end
end
end
else # exclude subseries and subvolumes
do list(path:"773??", "var":"$i")
do list(path:"$i.w", "var":"$j")
if any_match("$j","^\\(DE-(600|605)\\).+$")
add_hash( "containedIn[].$append")
copy_field("$j","containedIn[].$last.id")
copy_field("$i.t","containedIn[].$last.label")
end
end
end
end
end
do list(path: "isPartOf[]","var":"$i")
if is_empty("$i.hasSuperordinate[].1")
if exists("$i.numbering")
add_field("$i.hasSuperordinate[].1.label","") # Add dummi field
end
end
unless is_empty("$i.hasSuperordinate[].1")
do list(path:"$i.hasSuperordinate[]", "var": "$j") ## This is the fallback for isPartOf[].*.hasSuperordinate[].*.label
unless exists("$j.label")
copy_field("@title", "$j.label")
end
if is_empty("$j.label")
copy_field("@title", "$j.label")
end
end
add_array("$i.type[]", "IsPartOfRelation")
end
end
replace_all("isPartOf[].*.hasSuperordinate[].*.id", "^\\(DE-605\\)(.+)$", "http://lobid.org/resources/$1#!")
replace_all("isPartOf[].*.hasSuperordinate[].*.id", "^\\(DE-600\\)(.+)$", "http://lobid.org/resources/ZDB-$1#!")
replace_all("isPartOf[].*.numbering", "^[©]|\\s?[,.:;/=]?$", "")
uniq("isPartOf[]")
replace_all("containedIn[].*.id", "^\\(DE-605\\)(.+)$", "http://lobid.org/resources/$1#!")
replace_all("containedIn[].*.id", "^\\(DE-600\\)(.+)$", "http://lobid.org/resources/ZDB-$1#!")
replace_all("containedIn[].*.label","<<|>>","")
call_macro("lobidResourcesFallbackLabel",field:"containedIn[]")
uniq("containedIn[]")
# primaryForm
# 776 - Additional Physical Form Entry (R) - $i (R), $w (R)
add_array("primaryForm[]")
do list(path: "77608", "var":"$i")
if any_match ("$i.i", ".*eproduktion von.*")
add_hash( "primaryForm[].$append")
if all_match("$i.w", "^\\((?:DE-600|DE-605)\\)(.+)$")
copy_field("$i.w", "primaryForm[].$last.id")
end
paste("primaryForm[].$last.label", "$i.i", "$i.w")
replace_all("primaryForm[].$last.label", "\\((?:DE-600|DE-605)\\)", "")
add_array("primaryForm[].$last.note[]")
do list(path:"$i.i","var":"$j")
copy_field("$j","primaryForm[].$last.note[].$append")
end
end
end
replace_all("primaryForm[].*.id", "^\\(DE-605\\)(.+)$", "http://lobid.org/resources/$1#!")
replace_all("primaryForm[].*.id", "^\\(DE-600\\)(.+)$", "http://lobid.org/resources/ZDB-$1#!")
call_macro("lobidResourcesFallbackLabel",field:"primaryForm[]")
# secondaryForm
add_array("secondaryForm[]")
do list(path: "77608", "var":"$i")
if any_match ("$i.i", ".*eproduktion")
add_hash( "secondaryForm[].$append")
if all_match("$i.w", "^\\((?:DE-600|DE-605)\\)(.+)$")
do list(path:"$i.w", "var":"$j")
replace_all("$j", "^\\(DE-605\\)(.+)$", "http://lobid.org/resources/$1#!")
replace_all("$j", "^\\(DE-600\\)(.+)$", "http://lobid.org/resources/ZDB-$1#!")
copy_field("$j", "secondaryForm[].$append.id")
copy_field("$i.i", "secondaryForm[].$last.label")
end
end
end
end
call_macro("lobidResourcesFallbackLabel",field:"secondaryForm[]")
# 856 - Electronic Location and Access (R) - Subfield: $u (R) $3 (NR)
# 1. Indicator: 4 = HTTP
add_array("tableOfContents[]")
do list(path: "856??", "var":"$i")
if all_match("$i.3", "^[Ii][Nn][Hh][aA][lL][tT][sS][vV].*") # Inhaltsverzeichnis
copy_field("$i.3", "tableOfContents[].$append.label")
copy_field("$i.u", "tableOfContents[].$last.id")
end
end
add_array("description[]")
do list(path: "856??", "var":"$i")
if all_match("$i.3", "^[Ii][Nn][Hh][aA][lL][tT][sS][tT].*") # Inhaltstext
copy_field("$i.3", "description[].$append.label")
copy_field("$i.u", "description[].$last.id")
end
end
add_array("seeAlso[]")
do list(path: "856??", "var":"$i")
if all_match("$i.3", "^[zZ][uU][sS].*") # Zusätzliche Angaben
copy_field("$i.3", "seeAlso[].$append.label")
copy_field("$i.u", "seeAlso[].$last.id")
end
end
add_array("fulltextOnline[]")
do list(path: "856??", "var":"$i")
if exists("$i.u")
unless any_match("$i.u",".*(doi.org|urn=urn:|\\.(org|de)/urn:).*") # This should not skip repository links like: https://sammlungen.ulb.uni-muenster.de/urn/urn:nbn:de:hbz:6-85659520092
if any_equal("$i.z", "kostenfrei") # kostenfrei, added more types of resources
if any_match("$i.x", ".*(Verlag|Agentur|Digitalisierung|Archivierte Online|EZB|Online-Ausg|Resolving-System|Volltext).*")
if exists("$i.x.1")
copy_field("$i.x.1", "fulltextOnline[].$append.label")
else
copy_field("$i.x", "fulltextOnline[].$append.label")
end
copy_field("$i.u", "fulltextOnline[].$last.id")
else
unless exists("$i.x") # also map if kostenfrei and no specific link description
add_field("fulltextOnline[].$append.label","Online-Ressource")
copy_field("$i.u", "fulltextOnline[].$last.id")
end
end
elsif any_equal("$i.7","0") # Open Access Marker
add_field("fulltextOnline[].$append.label","Online-Ressource")
copy_field("$i.u", "fulltextOnline[].$last.id")
elsif any_match("$i.x", ".*(Archivierte Online|EZB|Online-Ausg|Resolving-System|Volltext).*")
if exists("$i.x.1")
copy_field("$i.x.1", "fulltextOnline[].$append.label")
else
copy_field("$i.x", "fulltextOnline[].$append.label")
end
copy_field("$i.u", "fulltextOnline[].$last.id")
elsif any_match("$i.3", "^[vV][oO][lL].*") # Volltext
copy_field("$i.3", "fulltextOnline[].$append.label")
copy_field("$i.u", "fulltextOnline[].$last.id")
end
end
if all_match("$i.x", ".*(Aggregator).*")
if any_contain("$i.u","oersi")
add_field("sameAs[].$append.label","OERSI-Ressource")
copy_field("$i.u", "sameAs[].$last.id")
end
end
end
end
# doi for fullTextOnline and sameAs
do list(path:"doi[]","var":"$i")
copy_field("$i", "fulltextOnline[].$append.id")
prepend("fulltextOnline[].$last.id","https://doi.org/")
copy_field("fulltextOnline[].$last.id", "sameAs[].$append.id")
add_field("fulltextOnline[].$last.label", "DOI-Link")
add_field("sameAs[].$last.label", "DOI-Link")
end
# urn for fullTextOnline and sameAs
do list(path:"@urnLinks","var":"$i")
copy_field("$i", "fulltextOnline[].$append.id")
copy_field("fulltextOnline[].$last.id", "sameAs[].$append.id")
add_field("fulltextOnline[].$last.label", "URN-Link")
add_field("sameAs[].$last.label", "URN-Link")
end
if is_empty("@urnLinks")
do list(path:"urn[]","var":"$i")
copy_field("$i", "fulltextOnline[].$append.id")
prepend("fulltextOnline[].$last.id","https://nbn-resolving.org/")
copy_field("fulltextOnline[].$last.id", "sameAs[].$append.id")
add_field("fulltextOnline[].$last.label", "URN-Link")
add_field("sameAs[].$last.label", "URN-Link")
end
end
# TODO: hasVersion is outcommented since it needs some remodelling
# See https://github.com/hbz/lobid-resources/issues/1242
# <!--
# <entity name="hasVersion[]" flushWith="record">
# <entity name="" flushWith="856??" sameEntity="true">
# <if>
# <any flushWith="856??">
# <none flushWith="856??" sameEntity="true">
# <data source="856??.M" />
# </none>
# <data source="856??.M">
# <equals string="$[member]" />
# </data>
# </any>
# </if>
# <data name="id" source="856??.u">
# <occurrence only="1" sameEntity="true" />
# <unique />
# </data>
# <data name="label" source="856??.z">
# <occurrence only="1" sameEntity="true" />
# </data>
# </entity>
# </entity> -->
#
# 775 - Other Edition Entry (R) - Subfield: $w (R), $t (NR), $i (R), $n (R), $x(NR), $z (R)
# 776 - Additional Physical Form Entry (R) - Subfield: $w (R), $t (NR), $i (R), $n (R), $x (NR), $z (R)
add_array("related[]")
do list(path:"775??|776??", "var":"$i")
unless any_match ("$i.i", ".*eproduktion von.*|.*eproduktion")
do list_as("$hbzId":"$i.w", "$isbn":"$i.z", "$label":"$i.t", "$note":"$i.n", "$issn":"$i.x", "$info":"$i.i")
unless in("$isbn", "related[].*.isbn[]") # Skip duplicates
add_hash("related[].$append")
if all_match("$hbzId", "^\\((DE-600|DE-605)\\).+$")
copy_field("$hbzId", "related[].$last.id")
end
add_array("related[].$last.note[]")
paste("related[].$last.note[].$append","$info", "$note")
replace_all("related[].$last.note[].$last", "Erscheint auch als ","")
copy_field("$label", "related[].$last.label")
add_array("related[].$last.issn[]")
copy_field("$issn", "related[].$last.issn[].$append")
add_array("related[].$last.isbn[]")
isbn("$isbn", to:"isbn13")
copy_field("$isbn", "related[].$last.isbn[].$append")
isbn("$isbn", to:"isbn10")
copy_field("$isbn", "related[].$last.isbn[].$append")
end
end
end
end
do list(path:"related[]", "var":"$i")
uniq("$i.isbn[]")
replace_all("$i.issn[].*","-","")
end
do list(path: "50580", "var":"$i")
if any_match("$i.6","[A-Z]{2}\\d*")
add_hash("related[].$append")
paste("related[].$last.id","~http://lobid.org/resources/","$i.6","~#!",join_char:"")
copy_field("$i.t","related[].$last.label")
add_array("related[].$last.note[]")
copy_field("$i.g","related[].$last.note[].$append")
end
end
replace_all("related[].*.id", "^\\(DE-605\\)(.+)$", "http://lobid.org/resources/$1#!")
replace_all("related[].*.id", "^\\(DE-600\\)(.+)$", "http://lobid.org/resources/ZDB-$1#!")
replace_all("related[].*.label","<<|>>","")
call_macro("lobidResourcesFallbackLabel",field:"related[]")
add_array("inCollection[]")
# hbz NZ
# digiBib hbz Vk
if any_equal("MBD .M", "49HBZ_NETWORK")
add_field("inCollection[].$append.id", "https://nrw.digibib.net/search/hbzvk/")
add_field("inCollection[].$last.label", "DigiBib hbz Verbundkatalog")
if any_match("POR .A", ".*")
add_field("@inNZ", "true")
else
unless any_match("035 .a", "^\\(EXLCZ\\).+$")
add_field("@inNZ", "true")
end
end
end
copy_field("@todaysYear","@todaysYearMinus9")
de.hbz.lobid.helper.Minus("@todaysYearMinus9","9")
to_var("@todaysYearMinus9","todaysYearMinus9")
unless is_array("008")
if any_match("008","^.{6}[\\|bresticdkmu](\\d{4}).*$")
copy_field("008","@008standardPubDate")
replace_all("@008standardPubDate","^.{7}(\\d{4}).*$","$1")
if any_match("@008standardPubDate",".*?([01]\\d{3}|20\\d{2}).*")
copy_field("@008standardPubDate","@standardPubDate")
end
end
end
if exists("@inNZ")
add_field("inCollection[].$append.id", "http://lobid.org/organisations/DE-655#!")
add_field("inCollection[].$last.label", "hbz - Hochschulbibliothekszentrum des Landes Nordrhein-Westfalen, Netzwerkzone")
end
# zdb
if exists("zdbId")
add_field("inCollection[].$append.id", "http://lobid.org/resources/HT014846970#!")
add_field("inCollection[].$last.label", "Zeitschriftendatenbank (ZDB)")
end
# ezb
# 856 - Electronic Location and Access (R) - Subfield: $x - Nonpublic note (R)
# TODO: Check if src/test/resources/alma-fix/(CKB)5280000000199164.xml is also an EZB titel even when it has no 865.
do list(path:"856??", "var":"$i")
if any_equal("$i.x","EZB") # can test x and x.*
add_field("inCollection[].$append.id", "http://lobid.org/resources/HT016356466#!")
add_field("inCollection[].$last.label", "Elektronische Zeitschriftenbibliothek (EZB)")
elsif any_match("$i.u","http://www.bibliothek.uni-regensburg.de/ezeit.*")
add_field("inCollection[].$append.id", "http://lobid.org/resources/HT016356466#!")
add_field("inCollection[].$last.label", "Elektronische Zeitschriftenbibliothek (EZB)")
end
end
# edoweb
do list(path:"856??", "var":"$i")
if any_match("$i.u","^.*edoweb.*") # can test x and x.*
add_field("inCollection[].$append.id", "http://lobid.org/resources/HT016925914#!")
add_field("inCollection[].$last.label", "Edoweb Rheinland-Pfalz")
end
end
# publisso
# TODO: AlephMorph checked for ellinet in "078r1.a" but publisso is also stated in the Link URI is that enough?
do list(path:"856??", "var":"$i")
if any_match("$i.u","^.*publisso.*") # can test x and x.*
add_field("inCollection[].$append.id", "http://repository.publisso.de")
add_field("inCollection[].$last.label", "Fachrepositorium Lebenswissenschaften")
end
end
# nwbib
# 084 - Other Classification Number (R), Subfield: $2 (NR)
if any_equal("inCollection[].*.id", "http://lobid.org/organisations/DE-655#!") # only assign hbz NZ records and filter out CZ oder IZ records
do list(path:"084 ", "var":"$i")
if any_equal("$i.2","nwbib")
unless any_equal("inCollection[].*.id","http://lobid.org/resources/HT014176012#!")
add_field("inCollection[].$append.id", "http://lobid.org/resources/HT014176012#!")
add_field("inCollection[].$last.label", "Nordrhein-Westfälische Bibliographie (NWBib)")
end
end
end
do list(path:"960??", "var":"$i")
if any_contain("$i.n","NWBib")
unless any_equal("inCollection[].*.id","http://lobid.org/resources/HT014176012#!")
add_field("inCollection[].$append.id", "http://lobid.org/resources/HT014176012#!")
add_field("inCollection[].$last.label", "Nordrhein-Westfälische Bibliographie (NWBib)")
end
end
# nwbib Zeitschriften
if any_contain("$i.n","NWBib-Zeitschrift-6")
add_field("inCollection[].$append.id", "https://nwbib.de/journals")
add_field("inCollection[].$last.label", "Laufend ausgewertete NWBib-Zeitschriften")
end
# E-Pflicht NRW
if any_contain("$i.r","epfl-")
add_field("inCollection[].$append.id", "https://lobid.org/collections#epflichtnrw")
add_field("inCollection[].$last.label", "E-Pflicht NRW")
end
end
if any_equal("inCollection[].*.id", "http://lobid.org/resources/HT014176012#!")
paste("sameAs[].$append.id","~http://nwbib.de/", "almaMmsId", "~#!",join_char:"")
add_field("sameAs[].$last.label","NWBib-Ressource")
end
end
#rpb
# 084 - Other Classification Number (R), Subfield: $2 (NR)
if exists("rpbId")
add_field("inCollection[].$append.id", "http://lobid.org/resources/HT013494180#!")
add_field("inCollection[].$last.label", "Rheinland-Pfälzische Bibliographie (RPB)")
end
do list(path:"084??", "var":"$i")
if any_equal("$i.2","rpb")
if any_match("$i.a","^rpb.*") # exclude LBZ Notations
add_field("inCollection[].$append.id", "http://lobid.org/resources/HT013494180#!")
add_field("inCollection[].$last.label", "Rheinland-Pfälzische Bibliographie")
end
end
end
if any_equal("inCollection[].*.id", "http://lobid.org/organisations/DE-655#!") # only assign hbz NZ records and filter out CZ oder IZ records
do list(path:"960??", "var":"$i")
if any_contain("$i.r","rpb")
unless any_equal("inCollection[].*.id","http://lobid.org/resources/HT013494180#!")
add_field("inCollection[].$append.id", "http://lobid.org/resources/HT013494180#!")
add_field("inCollection[].$last.label", "Rheinland-Pfälzische Bibliographie")
end
end
end
# bibliovino
do list(path:"960??", "var":"$i")
if any_contain("$i.r","bibliovino")
add_field("inCollection[].$append.id", "https://lobid.org/resources/990120000550206441#!")
add_field("inCollection[].$last.label", "BiblioVino")
end
end
end
# DBIS
if exists("@dbis")
add_field("inCollection[].$append.id", "https://dbis.ur.de/")
add_field("inCollection[].$last.label", "Datenbank-Infosystem (DBIS)")
end
# eResource package
# 912 ## "(nur Präfix ZDB-, und "vd18")" no Information about repeatability
do list(path:"912 ", "var":"$i")
if any_match("$i.a", "(ZDB-[0-9]{1,6}-[a-zA-Z|0-9\\-]*).*")
copy_field("$i.a", "inCollection[].$append.id")
replace_all("inCollection[].$last.id", "(ZDB-[0-9]{1,6}-[a-zA-Z|0-9\\-]*).*", "http://lobid.org/organisations/$1#!")
copy_field("inCollection[].$last.id","$i.@label")
lookup("$i.@label","lobidOrgLabels",delete:"true")
unless exists("$i.@label")
add_field("$i.@label","lobid Organisation ZDB Collection")
end
move_field("$i.@label","inCollection[].$last.label")
elsif any_match("$i.a", "ZDB-OERSI")
add_field("inCollection[].$append.id", "https://oersi.org/")
add_field("inCollection[].$last.label", "OERSI")
elsif any_match("$i.a", "ZDB-(.*)")
copy_field("$i.a", "inCollection[].$append.id")
replace_all("inCollection[].$last.id", "^(.*)$", "https://lobid.org/collections#$1")
copy_field("inCollection[].$last.id","inCollection[].$last.label")
lookup("inCollection[].$last.label","collectionLabels")
if any_match("inCollection[].$last.label","https://lobid.org/collections.*") #Fallback label for hbz collections
replace_all("inCollection[].$last.label","https://lobid.org/collections#(.*)","$1 Collection")
end
end
end
# E-Book and digital copy selections (inofficial)
# 912 ## no Information about repeatability
do list(path:"962 ", "var":"$i")
do list(path:"$i.e", "var": "$j")
unless any_match("$j", "^ZDB.*")
copy_field("$j", "inCollection[].$append.id")
replace_all("inCollection[].$last.id", "^(.*)$", "https://lobid.org/collections#$1")
copy_field("inCollection[].$last.id","inCollection[].$last.label")
lookup("inCollection[].$last.label","collectionLabels")
if any_match("inCollection[].$last.label","https://lobid.org/collections.*") #Fallback label for hbz collections
replace_all("inCollection[].$last.label","https://lobid.org/collections#(.*)","$1 Collection")
end
end
end
end
# 940 BVB specific field
# DE-61 also assigns marker for Judaica
do list(path:"940??","var":"$i")
if any_equal("$i.n","jfk")
add_field("inCollection[].$append.id","https://lobid.org/resources/990225637530206441#!")
add_field("inCollection[].$last.label","Judaica-Portal")
end
end
do list(path:"subject[]","var":"$i")
if any_match("$i.id","https:\\/\\/nwbib.de\\/subjects#N(630100|631000|632000|632050|635000|636000|637000|638000)")
add_field("inCollection[].$append.id","https://lobid.org/resources/990225637530206441#!")
add_field("inCollection[].$last.label","Judaica-Portal")
end
end
do list(path:"hasItem[]","var":"$i")
if any_equal("$i.heldBy.isil","DE-6-336")
add_field("inCollection[].$append.id","https://lobid.org/resources/990225637530206441#!")
add_field("inCollection[].$last.label","Judaica-Portal")
end
end
# 960 ## no Information about repeatability
# TODO: This needs further inspection if we need a collection fr all subfields: https://service-wiki.hbz-nrw.de/display/VDBE/960+-+Selektionskennzeichen+NZ
# Values from r can be invalid.
# do list(path:"960??", "var":"$i")
# do list(path:"$i.?", "var": "$j")
# copy_field("$j", "inCollection[].$append.id")
# replace_all("inCollection[].$last.id", "^(.*)$", "http://lobid.org/collections#$1")
# # TODO: Do we need a label? https://github.com/hbz/lobid-resources/issues/1305#issuecomment-912312471, also labels seem wrong.
# end
# end
add_array("inCollection[].*.type[]","Collection")
# predecessor
# 780 - Preceding Entry (R) - Subfield: $t (NR), $w (R)
add_array("predecessor[]")
do list(path:"780??", "var":"$i")
add_hash( "predecessor[].$append")
copy_field("$i.t", "predecessor[].$last.label")
do list(path:"$i.w", "var":"$j")
if all_match("$j", "^\\((?:DE-600|DE-605)\\)(.+)$")
copy_field("$j", "predecessor[].$last.id")
end
end
replace_all("predecessor[].$last.label", "\\((?:DE-600|DE-605)\\)", "")
unless is_empty("predecessor[].$last")
add_array("predecessor[].$last.note[]")
do list(path:"$i.i","var":"$j")
copy_field("$j","predecessor[].$last.note[].$append")
end
end
end
replace_all("predecessor[].*.id", "^\\(DE-605\\)(.+)$", "http://lobid.org/resources/$1#!")
replace_all("predecessor[].*.id", "^\\(DE-600\\)(.+)$", "http://lobid.org/resources/ZDB-$1#!")
call_macro("lobidResourcesFallbackLabel",field:"predecessor[]")
replace_all("predecessor[].*.label","Vorg. ---> ","")
# successor
# 785 - Succeeding Entry (R) - Subfield: $t (NR), $w (R)
add_array("successor[]")
do list(path:"785??", "var":"$i")
add_hash( "successor[].$append")
copy_field("$i.t", "successor[].$last.label")
do list(path:"$i.w", "var":"$j")
if all_match("$j", "^\\((?:DE-600|DE-605)\\)(.+)$")
copy_field("$j", "successor[].$last.id")
end
end
add_array("successor[].$last.note[]")
do list(path:"$i.i","var":"$j")
copy_field("$j","successor[].$last.note[].$append")
end
end
replace_all("successor[].*.id", "^\\(DE-605\\)(.+)$", "http://lobid.org/resources/$1#!")
replace_all("successor[].*.id", "^\\(DE-600\\)(.+)$", "http://lobid.org/resources/ZDB-$1#!")
# 130 - Main Entry-Uniform Title (NR)
add_array("exampleOfWork.label")
copy_field("1300 .a", "exampleOfWork.label.$append")
copy_field("1300 .g", "exampleOfWork.label.$append")
do list(path: "1300 .0", "var":"$i")
if any_match("$i", "^\\(DE-588\\).+$")
copy_field("$i", "exampleOfWork.id")
replace_all("exampleOfWork.id","^\\(DE-588\\)(.+$)","https://d-nb.info/gnd/$1")
end
end
copy_field("24010.a", "exampleOfWork.label.$append")
copy_field("24010.g", "exampleOfWork.label.$append")
do list(path: "24010.0", "var":"$i")
if any_match("$i", "^\\(DE-588\\).+$")
copy_field("$i", "exampleOfWork.id")
replace_all("exampleOfWork.id","^\\(DE-588\\)(.+$)","https://d-nb.info/gnd/$1")
end
end
join_field("exampleOfWork.label", " ")
unless any_equal("exampleOfWork.label", "")
add_array("exampleOfWork.type[]","Work")
end
replace_all("exampleOfWork.label","<<|>>","")
# 041 h|k - Language code of original and/or intermediate translations of text
add_array("lang_temp")
copy_field("041[ 01] .[hk]", "lang_temp.$append")
add_array("exampleOfWork.language[]")
do list(path:"lang_temp", "var": "$i")
copy_field("$i","exampleOfWork.language[].$append.id")
copy_field("$i","exampleOfWork.language[].$last.label")
end
lookup("exampleOfWork.language[].*.label","ISO639-2-to-GND")
prepend("exampleOfWork.language[].*.id", "http://id.loc.gov/vocabulary/iso639-2/")
# following only with second indicator 2 for analytical entries:
# 700 - Added Entry-Personal Name (R)
# 710 - Added Entry-Corporate Name (R)
# 711 - Added Entry-Meeting Name (R)
# 730 - Added Entry-Uniform Title (R)
add_array("containsExampleOfWork[]")
do list(path:"700?2|710?2|711?2", "var": "$i")
add_array("containsExampleOfWork[].$append.label")
add_array("containsExampleOfWork[].$last.creatorOfWork")
copy_field("$i.a","containsExampleOfWork[].$last.creatorOfWork.$append")
copy_field("$i.d","containsExampleOfWork[].$last.creatorOfWork.$append")
copy_field("$i.t","containsExampleOfWork[].$last.label.$append")
copy_field("$i.p","containsExampleOfWork[].$last.label.$append")
copy_field("$i.n","containsExampleOfWork[].$last.label.$append")
copy_field("$i.r","containsExampleOfWork[].$last.label.$append")
join_field("containsExampleOfWork[].$last.label", ". ")
join_field("containsExampleOfWork[].$last.creatorOfWork", " ")
copy_field("$i.n","containsExampleOfWork[].$last.workNumbering")
copy_field("$i.r","containsExampleOfWork[].$last.musicalKey")
add_array("containsExampleOfWork[].$last.type[]","Work")
add_array("containsExampleOfWork[].$last.instrumentation[]")
do list(path:"$i.m","var":"$j")
copy_field("$j","containsExampleOfWork[].$last.instrumentation[].$append")
end
do list(path: "$i.0", "var":"$k")
if any_match("$k", "^\\(DE-588\\).+$")
copy_field("$k", "containsExampleOfWork[].$last.id")
replace_all("containsExampleOfWork[].$last.id","^\\(DE-588\\)(.+$)","https://d-nb.info/gnd/$1")
end
end
end
do list(path:"730?2", "var": "$i")
add_array("containsExampleOfWork[].$append.label")
copy_field("$i.a","containsExampleOfWork[].$last.label.$append")
copy_field("$i.d","containsExampleOfWork[].$last.label.$append")
join_field("containsExampleOfWork[].$last.label", " ")
copy_field("$i.n","containsExampleOfWork[].$last.workNumbering")
copy_field("$i.r","containsExampleOfWork[].$last.musicalKey")
add_array("containsExampleOfWork[].$last.type[]","Work")
add_array("containsExampleOfWork[].$last.instrumentation[]")
do list(path:"$i.m","var":"$j")
copy_field("$j","containsExampleOfWork[].$last.instrumentation[].$append")
end
do list(path: "$i.0", "var":"$k")
if any_match("$k", "^\\(DE-588\\).+$")
copy_field("$k", "containsExampleOfWork[].$last.id")
replace_all("containsExampleOfWork[].$last.id","^\\(DE-588\\)(.+$)","https://d-nb.info/gnd/$1")
end
end
end
replace_all("containsExampleOfWork[].*.label","<<|>>","")
uniq("inCollection[]")