-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdescribedBy.fix
117 lines (87 loc) · 5.01 KB
/
describedBy.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
copy_field("almaMmsId", "describedBy.id")
prepend("describedBy.id", "http://lobid.org/resources/")
copy_field("almaMmsId", "describedBy.label")
prepend("describedBy.label", "Webseite der hbz-Ressource ")
set_array("describedBy.type[]", "BibliographicDescription")
add_field("describedBy.inDataset.id","http://lobid.org/resources/dataset#!")
add_field("describedBy.inDataset.label","lobid-resources – Der hbz-Verbundkatalog als Linked Open Data")
set_array("describedBy.resultOf.type[]", "CreateAction")
add_field("@createTime","$[createEndTime]")
if all_match("@createTime","0")
add_field("describedBy.resultOf.endTime","0000-00-00T00:00:00")
else
timestamp("describedBy.resultOf.endTime",format:"yyyy-MM-dd'T'HH:mm:ss", timezone:"Europe/Berlin")
end
add_field("describedBy.resultOf.instrument.id","https://github.com/hbz/lobid-resources")
set_array("describedBy.resultOf.instrument.type[]", "SoftwareApplication")
add_field("describedBy.resultOf.instrument.label","Software lobid-resources")
copy_field("almaMmsId","describedBy.resultOf.object.id")
prepend("describedBy.resultOf.object.id","https://lobid.org/marcxml/")
# MNG is a ALMA-specific element (MNG .b only states the indexing date into ALMA, while 008 is the initial cataloguing date.)
copy_field("008","@initialCataloguingDate")
substring("@initialCataloguingDate","0","6")
if any_match("@initialCataloguingDate","^[0-4].*")
prepend("@initialCataloguingDate","20")
elsif any_match("@initialCataloguingDate","\\d*")
prepend("@initialCataloguingDate","19")
else
copy_field("MNG .b","@initialCataloguingDate")
end
copy_field("@initialCataloguingDate","describedBy.resultOf.object.dateCreated")
copy_field("MNG .d","describedBy.resultOf.object.dateModified")
replace_all("describedBy.resultOf.object.dateCreated","-","")
replace_all("describedBy.resultOf.object.dateCreated"," .*","")
replace_all("describedBy.resultOf.object.dateCreated","c|©|\\s?|,|.|:|;|/|=","")
replace_all("describedBy.resultOf.object.dateModified","-","")
replace_all("describedBy.resultOf.object.dateModified"," .*","")
replace_all("describedBy.resultOf.object.dateModified","c|©|\\s?|,|.|:|;|/|=","")
#unless any_match("describedBy.resultOf.object.dateCreated","\\d{8}|\\d{4}")
# remove_field("describedBy.resultOf.object.dateCreated")
#end
#unless any_match("describedBy.resultOf.object.dateModified","\\d{8}|\\d{4}")
# remove_field("describedBy.resultOf.object.dateModified")
#end
replace_all("describedBy.resultOf.object.dateCreated","^(\\d{4})(\\d{2})(\\d{2})$","$1-$2-$3")
replace_all("describedBy.resultOf.object.dateModified","^(\\d{4})(\\d{2})(\\d{2})$","$1-$2-$3")
replace_all("describedBy.resultOf.object.dateCreated","^(\\d{4})$","$1-01-01")
replace_all("describedBy.resultOf.object.dateModified","^(\\d{4})$","$1-01-01")
set_array("describedBy.resultOf.object.type[]", "DataFeedItem")
copy_field("almaMmsId","describedBy.resultOf.object.label")
prepend("describedBy.resultOf.object.label","hbz-Ressource ")
append("describedBy.resultOf.object.label"," im Exportformat MARC21 XML")
add_field("describedBy.resultOf.object.inDataset.id", "https://datahub.io/dataset/hbz_unioncatalog")
add_field("describedBy.resultOf.object.inDataset.label", "hbz_unioncatalog")
set_array("describedBy.license[]")
add_field("describedBy.license[].$append.id","http://creativecommons.org/publicdomain/zero/1.0" )
add_field("describedBy.license[].$last.label","Creative Commons-Lizenz CC0 1.0 Universal" )
# TODO: It seems that there are a lot of organisations that are not in lobid, we should filter them out.
# 040 - Cataloging Source (NR) - Subfield: $a (NR), $c (NR), $d (R)
# ALMA has a lot of invalid repeated subfields $a
do list(path: "040 ", "var":"$i")
do list(path:"$i.a","var":"$j")
unless exists("describedBy.resultOf.object.sourceOrganization.id")
copy_field("$j", "describedBy.resultOf.object.sourceOrganization.id")
end
end
do list(path:"$i.c","var":"$j")
unless exists("describedBy.resultOf.object.provider.id")
copy_field("$j", "describedBy.resultOf.object.provider.id")
end
end
set_array("describedBy.resultOf.object.modifiedBy[]")
do list(path:"$i.d", "var":"$j")
copy_field("$j", "describedBy.resultOf.object.modifiedBy[].$append.id")
end
end
call_macro("provenanceLinks",field: "describedBy.resultOf.object.sourceOrganization.id")
copy_field("describedBy.resultOf.object.sourceOrganization.id","describedBy.resultOf.object.sourceOrganization.label")
lookup("describedBy.resultOf.object.sourceOrganization.label","lobidOrgLabels",delete:"true")
call_macro("provenanceLinks",field: "describedBy.resultOf.object.provider.id")
copy_field("describedBy.resultOf.object.provider.id","describedBy.resultOf.object.provider.label")
lookup("describedBy.resultOf.object.provider.label","lobidOrgLabels",delete:"true")
do list(path:"describedBy.resultOf.object.modifiedBy[]","var":"$i")
call_macro("provenanceLinks",field: "$i.id")
copy_field("$i.id","$i.label")
end
lookup("describedBy.resultOf.object.modifiedBy[].*.label","lobidOrgLabels",delete:"true")
uniq("describedBy.resultOf.object.modifiedBy[]")