Skip to content

Commit 63815eb

Browse files
committed
Finalize fix for Marc21 to EDM example #589
1 parent 8169908 commit 63815eb

File tree

3 files changed

+49
-1635
lines changed

3 files changed

+49
-1635
lines changed

metafacture-runner/src/main/dist/examples/marc21-to-edm/MARC21-EDM.fix

Lines changed: 49 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Hint: This is a translated version of the morph transformation in metafacture-runner/src/main/dist/examples/morph/marc21-to-edm/MARC21-EDM.xml
2+
# Result is the same. The fix transformation could be adjusted to be even more efficient.
13

24
do once("maps")
35
put_map("rights",
@@ -95,9 +97,9 @@ paste("edm:isShownAt","@isShownByUrl","001","@isShownBySuffix", join_char:"")
9597
do list(path:"650?7|60017|61017|61017|630??|655?7|651?7|648??","var":"SUBJECT")
9698
do list(path:"SUBJECT.0","var":"SUBJECT_ID")
9799
if any_match("SUBJECT_ID","^\\(DE-588\\)(.*)$")
98-
copy_field("SUBJECT_ID","skos:Concept.$append.~rdf:about")
100+
copy_field("SUBJECT.a","skos:Concept.$append.skos:prefLabel$de")
101+
copy_field("SUBJECT_ID","skos:Concept.$last.~rdf:about")
99102
replace_all("skos:Concept.$last.~rdf:about","^\\(DE-588\\)(.*)$","http://d-nb.info/gnd/$1")
100-
copy_field("SUBJECT.a","skos:Concept.$last.skos:prefLabel$de")
101103
end
102104
end
103105
end
@@ -136,20 +138,19 @@ unless str_equal("$[sector]","")
136138
add_field("skos:Concept.$last.skos:notation","$[sector]")
137139
end
138140

141+
paste("@cEventID", "~#/event/", "001", "~-c", join_char:"")
142+
143+
paste("@pEventID", "~#/event/", "001", "~-p", join_char:"")
144+
145+
139146
copy_field("@publisherID","edm:Agent.$append.~rdf:about")
140147
do list(path:"2603 .b","var":"$i")
141148
unless exists("edm:Agent.$last.skos:prefLabel$de")
142149
copy_field("$i","edm:Agent.$last.skos:prefLabel$de")
150+
copy_field("@pEventID","edm:Agent.$last.#edm:wasPresent")
143151
end
144152
end
145153

146-
147-
paste("@cEventID", "~#/event/", "001", "~-c", join_char:"")
148-
149-
paste("@pEventID", "~#/event/", "001", "~-p", join_char:"")
150-
151-
copy_field("@pEventID","edm:Agent.$last.#edm:wasPresent")
152-
153154
do list(path:"2603 ","var":"$i")
154155
do list(path:"$i.a","var":"$a")
155156
unless exists("@place")
@@ -166,27 +167,22 @@ do list(path:"2603 ","var":"$i")
166167
end
167168
replace_all("@place"," \\[?u.a.\\]?.*$","")
168169

169-
paste("@placeID","~#/place/","001","~_place","@placeCount",join_char:"")
170-
170+
if exists("@place")
171+
paste("@placeID","~#/place/","001","~_place","@placeCount",join_char:"")
172+
end
171173

172174
do list(path:"260[ 3] ","var":"$i")
173175
do list(path:"$i.c","var":"$c")
174-
unless exists("@timeID")
175-
copy_field("$c","@timespan")
176-
copy_field("$c","@timespanList.$append")
177-
copy_field("@timespanList","@timespanCount")
178-
if is_array("@timespanCount")
179-
count("@timespanCount")
180-
else
181-
add_field("@timespanCount","1")
182-
end
183-
paste("@timeID","~#/timespan/","001","~_timespan","@timespanCount",join_char:"")
184-
end
176+
copy_field("$c","@timespanList.$append")
185177
end
186178
end
187179

188-
189-
paste("recordID","@recordIDUrl","001","@recordIDSuffix", join_char:"")
180+
if exists("@timespanList")
181+
unless exists("@timespanList.2")
182+
copy_field("@timespanList.1","@timespan")
183+
paste("@timeID","~#/timespan/","001","~_timespan1",join_char:"")
184+
end
185+
end
190186

191187
add_field("@mediatypeID","$[media_type]")
192188
lookup("@mediatypeID","mediatype")
@@ -198,6 +194,9 @@ lookup("@recordIDUrl","urls")
198194
copy_field("@isil","@recordIDSuffix")
199195
lookup("@recordIDSuffix","suffix")
200196

197+
paste("@recordID","@recordIDUrl","001","@recordIDSuffix", join_char:"")
198+
199+
201200
do list(path:"1001 |1101 |7001 |7101", "var":"CREATOR")
202201
do list(path: "CREATOR.0", "var":"CREATORID")
203202
if any_match("CREATORID", "^\\(DE-588\\)(.*)$")
@@ -231,9 +230,12 @@ copy_field("@placeID","edm:Place.~rdf:about")
231230
copy_field("@place","edm:Place.skos:prefLabel")
232231

233232

234-
copy_field("@timeID","edm:TimeSpan.~rdf:about")
235-
copy_field("260[ 3] .c","edm:TimeSpan.skos:notation")
236-
233+
if exists("@timeID")
234+
copy_field("@timeID","edm:TimeSpan.~rdf:about")
235+
do list(path:"2603 ","var":"$i")
236+
copy_field("$i.c","edm:TimeSpan.skos:notation")
237+
end
238+
end
237239

238240

239241

@@ -255,7 +257,8 @@ add_field("#dcterms:rights","http://creativecommons.org/publicdomain/zero/1.0/")
255257

256258
copy_field("@recordID","edm:ProvidedCHO.~rdf:about")
257259

258-
copy_field("@pEventID|@cEventID","edm:ProvidedCHO.#edm:wasPresent.$append")
260+
copy_field("@cEventID","edm:ProvidedCHO.#edm:wasPresent.$append")
261+
copy_field("@pEventID","edm:ProvidedCHO.#edm:wasPresent.$append")
259262

260263
copy_field("@mat","edm:ProvidedCHO.dc:type")
261264

@@ -273,8 +276,9 @@ copy_field("@lang","edm:ProvidedCHO.dc:language")
273276
paste("edm:ProvidedCHO.#dcterms:language","~http://id.loc.gov/vocabulary/iso639-2/","@lang",join_char:"")
274277

275278

276-
277-
paste("edm:ProvidedCHO.dcterms:bibliographicCitation","490??.a","~ ; ","490??.v", join_char:"")
279+
if exists("490??")
280+
paste("edm:ProvidedCHO.dcterms:bibliographicCitation","490??.a","~ ; ","490??.v", join_char:"")
281+
end
278282

279283
copy_field("1[10]01 .a","edm:ProvidedCHO.dc:creator.$append")
280284

@@ -290,10 +294,11 @@ do list(path:"830??|800??|810??|811??","var":"$i")
290294
end
291295

292296
do list(path:"650?7|60017|61017|61017|630??|655?7|651?7|648??","var":"$SUBJECT")
297+
copy_field("$SUBJECT.a","edm:ProvidedCHO.dc:subject.$append")
293298
do list(path:"$SUBJECT.0","var":"$SUBJECT_ID")
294299
if any_match("$SUBJECT_ID","^\\(DE-588\\)(.*)$")
295-
copy_field("$SUBJECT.a","edm:ProvidedCHO.dc:subject.$append")
296300
copy_field("$SUBJECT_ID","edm:ProvidedCHO.#dc:subject.$append")
301+
replace_all("edm:ProvidedCHO.#dc:subject.$last","^\\(DE-588\\)(.*)$","http://d-nb.info/gnd/$1")
297302
end
298303
end
299304
end
@@ -303,13 +308,22 @@ replace_all("edm:ProvidedCHO.#dcterms:isPartOf.*","^\\(DE-101\\)(.*)$","http://d
303308

304309
paste("edm:ProvidedCHO.dc:title","24510.a","24510.b",join_char:" : ")
305310

306-
307-
copy_field("260[ 3] .c","edm:ProvidedCHO.dcterms:issued")
311+
if exists("@timeID")
312+
copy_field("260[ 3] .c","edm:ProvidedCHO.dcterms:issued")
313+
end
308314

309315
copy_field("250 .a","edm:ProvidedCHO.dc:description.$append")
310316
copy_field("502??.a","edm:ProvidedCHO.dc:description.$append")
311317

318+
do list(path:"245 ?|490 ?|800 ?|810 ?|811 ?|830 ?","var":"$i")
319+
copy_field("$i.[nv]", "@position")
320+
end
321+
322+
unless exists("@position")
323+
add_field("@position","-1")
324+
end
312325

326+
paste("edm:ProvidedCHO.ddb:techinfo","~aggregation_entity:false; position:", "@position",join_char:"")
313327

314328
unless str_equal("$[dnb_subject]","")
315329
add_field("edm:ProvidedCHO.#dc:subject", "$[dnb_subject]")
@@ -333,4 +347,6 @@ do list(path:"85640","var":"$i")
333347
end
334348

335349

350+
351+
336352
retain("edm*","dc*","skos*", "aggregation_id", "#*")

0 commit comments

Comments
 (0)