Skip to content

Commit

Permalink
Finalize fix for Marc21 to EDM example #589
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasNx committed Jan 31, 2025
1 parent 8169908 commit 63815eb
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1,635 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Hint: This is a translated version of the morph transformation in metafacture-runner/src/main/dist/examples/morph/marc21-to-edm/MARC21-EDM.xml
# Result is the same. The fix transformation could be adjusted to be even more efficient.

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

paste("@cEventID", "~#/event/", "001", "~-c", join_char:"")

paste("@pEventID", "~#/event/", "001", "~-p", join_char:"")


copy_field("@publisherID","edm:Agent.$append.~rdf:about")
do list(path:"2603 .b","var":"$i")
unless exists("edm:Agent.$last.skos:prefLabel$de")
copy_field("$i","edm:Agent.$last.skos:prefLabel$de")
copy_field("@pEventID","edm:Agent.$last.#edm:wasPresent")
end
end


paste("@cEventID", "~#/event/", "001", "~-c", join_char:"")

paste("@pEventID", "~#/event/", "001", "~-p", join_char:"")

copy_field("@pEventID","edm:Agent.$last.#edm:wasPresent")

do list(path:"2603 ","var":"$i")
do list(path:"$i.a","var":"$a")
unless exists("@place")
Expand All @@ -166,27 +167,22 @@ do list(path:"2603 ","var":"$i")
end
replace_all("@place"," \\[?u.a.\\]?.*$","")

paste("@placeID","~#/place/","001","~_place","@placeCount",join_char:"")

if exists("@place")
paste("@placeID","~#/place/","001","~_place","@placeCount",join_char:"")
end

do list(path:"260[ 3] ","var":"$i")
do list(path:"$i.c","var":"$c")
unless exists("@timeID")
copy_field("$c","@timespan")
copy_field("$c","@timespanList.$append")
copy_field("@timespanList","@timespanCount")
if is_array("@timespanCount")
count("@timespanCount")
else
add_field("@timespanCount","1")
end
paste("@timeID","~#/timespan/","001","~_timespan","@timespanCount",join_char:"")
end
copy_field("$c","@timespanList.$append")
end
end


paste("recordID","@recordIDUrl","001","@recordIDSuffix", join_char:"")
if exists("@timespanList")
unless exists("@timespanList.2")
copy_field("@timespanList.1","@timespan")
paste("@timeID","~#/timespan/","001","~_timespan1",join_char:"")
end
end

add_field("@mediatypeID","$[media_type]")
lookup("@mediatypeID","mediatype")
Expand All @@ -198,6 +194,9 @@ lookup("@recordIDUrl","urls")
copy_field("@isil","@recordIDSuffix")
lookup("@recordIDSuffix","suffix")

paste("@recordID","@recordIDUrl","001","@recordIDSuffix", join_char:"")


do list(path:"1001 |1101 |7001 |7101", "var":"CREATOR")
do list(path: "CREATOR.0", "var":"CREATORID")
if any_match("CREATORID", "^\\(DE-588\\)(.*)$")
Expand Down Expand Up @@ -231,9 +230,12 @@ copy_field("@placeID","edm:Place.~rdf:about")
copy_field("@place","edm:Place.skos:prefLabel")


copy_field("@timeID","edm:TimeSpan.~rdf:about")
copy_field("260[ 3] .c","edm:TimeSpan.skos:notation")

if exists("@timeID")
copy_field("@timeID","edm:TimeSpan.~rdf:about")
do list(path:"2603 ","var":"$i")
copy_field("$i.c","edm:TimeSpan.skos:notation")
end
end



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

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

copy_field("@pEventID|@cEventID","edm:ProvidedCHO.#edm:wasPresent.$append")
copy_field("@cEventID","edm:ProvidedCHO.#edm:wasPresent.$append")
copy_field("@pEventID","edm:ProvidedCHO.#edm:wasPresent.$append")

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

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



paste("edm:ProvidedCHO.dcterms:bibliographicCitation","490??.a","~ ; ","490??.v", join_char:"")
if exists("490??")
paste("edm:ProvidedCHO.dcterms:bibliographicCitation","490??.a","~ ; ","490??.v", join_char:"")
end

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

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

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

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


copy_field("260[ 3] .c","edm:ProvidedCHO.dcterms:issued")
if exists("@timeID")
copy_field("260[ 3] .c","edm:ProvidedCHO.dcterms:issued")
end

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

do list(path:"245 ?|490 ?|800 ?|810 ?|811 ?|830 ?","var":"$i")
copy_field("$i.[nv]", "@position")
end

unless exists("@position")
add_field("@position","-1")
end

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

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




retain("edm*","dc*","skos*", "aggregation_id", "#*")
Loading

0 comments on commit 63815eb

Please sign in to comment.