Skip to content

Commit

Permalink
rswk
Browse files Browse the repository at this point in the history
  • Loading branch information
blackwinter committed Oct 19, 2023
1 parent 35ef79b commit fe6b348
Show file tree
Hide file tree
Showing 4 changed files with 168 additions and 165 deletions.
44 changes: 3 additions & 41 deletions src/main/resources/transformation/alma.fix
Original file line number Diff line number Diff line change
Expand Up @@ -984,47 +984,9 @@ do list(path: "249??.a", "var": "$i")
end
end

# MARC/600, MARC/610, MARC/611, MARC/648, MARC/650, MARC/651
set_array("RSWK[]")
do list(path: "600??", "var": "$i")
call_macro("alma-subject-personal-name")
end
do list(path: "610??", "var": "$i")
call_macro("alma-subject-corporate-name")
end
do list(path: "611??", "var": "$i")
call_macro("alma-subject-meeting-name")
end
do list(path: "648??", "var": "$i")
call_macro("alma-subject-chronological-term")
end
do list(path: "650??", "var": "$i")
call_macro("alma-subject-topical-term")
end
do list(path: "651??", "var": "$i")
call_macro("alma-subject-geographic-name")
end
# MARC/689
do list(path: "689??", "var": "$i")
if any_equal("$i.D", "p")
call_macro("alma-subject-personal-name")
elsif any_equal("$i.D", "b")
call_macro("alma-subject-corporate-name")
elsif any_equal("$i.D", "f")
call_macro("alma-subject-meeting-name")
elsif any_equal("$i.D", "s")
call_macro("alma-subject-topical-term")
elsif any_equal("$i.D", "g")
call_macro("alma-subject-geographic-name")
end
end
uniq("RSWK[]")
do list(path: "RSWK[]", "var": "$i")
copy_field("$i.subjectGenre", "introx.subject[].$append")
#copy_field("$i.subjectGeoName", "introx.subject[].$append")
copy_field("$i.subjectTitleName", "introx.subject[].$append")
copy_field("$i.subjectUnit", "introx.subject[].$append")
end
# MARC/600, MARC/610, MARC/611, MARC/648, MARC/650, MARC/651, MARC/689
include("./marc/rswk.fix")

# MARC/653
set_array("Subject[]")
do list(path: "653??", "var": "$i")
Expand Down
124 changes: 124 additions & 0 deletions src/main/resources/transformation/macros.fix
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,130 @@ do put_macro("remove-nonsort-string")
#replace_all("$[source]", "<(.*?)>", "[$1]")
end

do put_macro("subject-common")
set_array("@combined_label")
copy_field("$i.a", "@combined_label.$append")
copy_field("$i.b", "@combined_label.$append")
join_field("@combined_label", " ")
split_field("@combined_label", ";|--")
replace_all("@combined_label.*", "(?<!\\p{Upper})[.]$|[,]$", "")
join_field("@combined_label", ", ")
if exists("$i.c")
paste("@combined_label", "@combined_label", "~, ", "$i.c", join_char: "")
end
if exists("$i.d")
paste("@combined_label", "@combined_label", "~ (", "$i.d", "~)", join_char: "")
end
if exists("$i.g")
paste("@combined_label", "@combined_label", "~ (", "$i.g", "~)", join_char: "")
end
if exists("$i.x")
paste("@combined_label", "@combined_label", "~/", "$i.x")
end
replace_all("@combined_label", "([a-z])[.]$", "$1")
call_macro("remove-nonsort", source: "@combined_label")
copy_field("@combined_label", "@rswk.combinedLabel")
move_field("@combined_label", "introx.subject[].$append")
set_array("@rswk.subjectIdentifier[]")
set_array("@rswk.identifierGND[]")
do list(path: "$i.0", "var": "$j")
copy_field("$j", "@rswk.subjectIdentifier[].$append")
if any_match("$j", "\\(DE-588\\).*")
copy_field("$j", "@rswk.identifierGND[].$append")
end
end
replace_all("@rswk.identifierGND[].*", "^\\(DE-588\\)", "")
replace_all("@rswk.subjectAddendum", "[.]$", "")
replace_all("@rswk.subjectChronological", "[.]$", "")
replace_all("@rswk.subjectConference", "[.]$", "")
replace_all("@rswk.subjectCorporateBodyName", "[.]$", "")
replace_all("@rswk.subjectCorporateBodySubUnit", "[.]$", "")
replace_all("@rswk.subjectDate", "\\s?[:.]?$", "")
replace_all("@rswk.subjectGenre", "[.]$", "")
replace_all("@rswk.subjectGeoAddendum", "^[(]|[.)]$", "")
replace_all("@rswk.subjectGeoName", "[.]$", "")
replace_all("@rswk.subjectNameAddendum", "^[(]|[.)]$", "")
replace_all("@rswk.subjectNumbering", "^[(]|\\s?[);:]?$", "")
replace_all("@rswk.subjectPersonName", "[,.]$", "")
replace_all("@rswk.subjectTitleName", "[.]$", "")
replace_all("@rswk.subjectUnit", "[.]$", "")
call_macro("remove-nonsort", source: "@rswk.subjectPersonName")
call_macro("remove-nonsort", source: "@rswk.subjectTitleName")
call_macro("remove-nonsort", source: "@rswk.subjectTopicName")
move_field("@rswk", "RSWK[].$append")
end

do put_macro("subject-personal-name")
set_hash("@rswk")
call_macro("copy-first-item", source: "$i.z", target: "@rswk.subjectGeoName")
call_macro("copy-first-item", source: "$i.y", target: "@rswk.subjectChronological")
call_macro("copy-first-item", source: "$i.d", target: "@rswk.subjectDate")
call_macro("copy-first-item", source: "$i.v", target: "@rswk.subjectGenre")
call_macro("copy-first-item", source: "$i.a", target: "@rswk.subjectPersonName")
call_macro("copy-first-item", source: "$i.t", target: "@rswk.subjectTitleName")
call_macro("copy-first-item", source: "$i.c", target: "@rswk.subjectNameAddendum")
call_macro("subject-common")
end

do put_macro("subject-corporate-name")
set_hash("@rswk")
call_macro("copy-first-item", source: "$i.z", target: "@rswk.subjectGeoName")
call_macro("copy-first-item", source: "$i.y", target: "@rswk.subjectChronological")
call_macro("copy-first-item", source: "$i.a", target: "@rswk.subjectCorporateBodyName")
call_macro("copy-first-item", source: "$i.b", target: "@rswk.subjectCorporateBodySubUnit")
call_macro("copy-first-item", source: "$i.v", target: "@rswk.subjectGenre")
call_macro("copy-first-item", source: "$i.n", target: "@rswk.subjectNumbering")
call_macro("copy-first-item", source: "$i.t", target: "@rswk.subjectTitleName")
call_macro("copy-first-item", source: "$i.p", target: "@rswk.subjectUnit")
call_macro("copy-first-item", source: "$i.c", target: "@rswk.subjectGeoAddendum")
call_macro("subject-common")
end

do put_macro("subject-meeting-name")
set_hash("@rswk")
call_macro("copy-first-item", source: "$i.z", target: "@rswk.subjectGeoName")
call_macro("copy-first-item", source: "$i.y", target: "@rswk.subjectChronological")
call_macro("copy-first-item", source: "$i.a", target: "@rswk.subjectConference")
call_macro("copy-first-item", source: "$i.d", target: "@rswk.subjectDate")
call_macro("copy-first-item", source: "$i.v", target: "@rswk.subjectGenre")
call_macro("copy-first-item", source: "$i.n", target: "@rswk.subjectNumbering")
call_macro("copy-first-item", source: "$i.t", target: "@rswk.subjectTitleName")
call_macro("copy-first-item", source: "$i.p", target: "@rswk.subjectUnit")
call_macro("copy-first-item", source: "$i.c", target: "@rswk.subjectGeoAddendum")
call_macro("subject-common")
end

do put_macro("subject-chronological-term")
set_hash("@rswk")
call_macro("copy-first-item", source: "$i.a", target: "@rswk.subjectChronological")
call_macro("subject-common")
end

do put_macro("subject-topical-term")
set_hash("@rswk")
call_macro("copy-first-item", source: "$i.a", target: "@subjectTopicName")
split_field("@subjectTopicName", ";|--")
set_array("@rswk.subjectTopicName")
do list(path: "@subjectTopicName", "var": "$j")
replace_all("$j", "[.]$", "")
copy_field("$j", "@rswk.subjectTopicName.$append")
end
remove_field("@subjectTopicName")
call_macro("copy-first-item", source: "$i.z", target: "@rswk.subjectGeoName")
call_macro("copy-first-item", source: "$i.y", target: "@rswk.subjectChronological")
call_macro("copy-first-item", source: "$i.x", target: "@rswk.subjectAddendum")
call_macro("copy-first-item", source: "$i.v", target: "@rswk.subjectGenre")
call_macro("subject-common")
end

do put_macro("subject-geographic-name")
set_hash("@rswk")
call_macro("copy-first-item", source: "$i.a", target: "@rswk.subjectGeoName")
call_macro("copy-first-item", source: "$i.y", target: "@rswk.subjectChronological")
call_macro("copy-first-item", source: "$i.v", target: "@rswk.subjectGenre")
call_macro("subject-common")
end

do put_macro("substring", length: "1")
copy_field("$[source]", "@substring")
substring("@substring", "$[start]", "$[length]")
Expand Down
124 changes: 0 additions & 124 deletions src/main/resources/transformation/macros/alma.fix
Original file line number Diff line number Diff line change
Expand Up @@ -14,130 +14,6 @@ do put_macro("alma-format-carrier", length: "1")
move_field("@alma-format-carrier-facet", "@facet_format.$append")
end

do put_macro("alma-subject-common")
set_array("@combined_label")
copy_field("$i.a", "@combined_label.$append")
copy_field("$i.b", "@combined_label.$append")
join_field("@combined_label", " ")
split_field("@combined_label", ";|--")
replace_all("@combined_label.*", "(?<!\\p{Upper})[.]$|[,]$", "")
join_field("@combined_label", ", ")
if exists("$i.c")
paste("@combined_label", "@combined_label", "~, ", "$i.c", join_char: "")
end
if exists("$i.d")
paste("@combined_label", "@combined_label", "~ (", "$i.d", "~)", join_char: "")
end
if exists("$i.g")
paste("@combined_label", "@combined_label", "~ (", "$i.g", "~)", join_char: "")
end
if exists("$i.x")
paste("@combined_label", "@combined_label", "~/", "$i.x")
end
replace_all("@combined_label", "([a-z])[.]$", "$1")
call_macro("remove-nonsort", source: "@combined_label")
copy_field("@combined_label", "@rswk.combinedLabel")
move_field("@combined_label", "introx.subject[].$append")
set_array("@rswk.subjectIdentifier[]")
set_array("@rswk.identifierGND[]")
do list(path: "$i.0", "var": "$j")
copy_field("$j", "@rswk.subjectIdentifier[].$append")
if any_match("$j", "\\(DE-588\\).*")
copy_field("$j", "@rswk.identifierGND[].$append")
end
end
replace_all("@rswk.identifierGND[].*", "^\\(DE-588\\)", "")
replace_all("@rswk.subjectAddendum", "[.]$", "")
replace_all("@rswk.subjectChronological", "[.]$", "")
replace_all("@rswk.subjectConference", "[.]$", "")
replace_all("@rswk.subjectCorporateBodyName", "[.]$", "")
replace_all("@rswk.subjectCorporateBodySubUnit", "[.]$", "")
replace_all("@rswk.subjectDate", "\\s?[:.]?$", "")
replace_all("@rswk.subjectGenre", "[.]$", "")
replace_all("@rswk.subjectGeoAddendum", "^[(]|[.)]$", "")
replace_all("@rswk.subjectGeoName", "[.]$", "")
replace_all("@rswk.subjectNameAddendum", "^[(]|[.)]$", "")
replace_all("@rswk.subjectNumbering", "^[(]|\\s?[);:]?$", "")
replace_all("@rswk.subjectPersonName", "[,.]$", "")
replace_all("@rswk.subjectTitleName", "[.]$", "")
replace_all("@rswk.subjectUnit", "[.]$", "")
call_macro("remove-nonsort", source: "@rswk.subjectPersonName")
call_macro("remove-nonsort", source: "@rswk.subjectTitleName")
call_macro("remove-nonsort", source: "@rswk.subjectTopicName")
move_field("@rswk", "RSWK[].$append")
end

do put_macro("alma-subject-personal-name")
set_hash("@rswk")
call_macro("copy-first-item", source: "$i.z", target: "@rswk.subjectGeoName")
call_macro("copy-first-item", source: "$i.y", target: "@rswk.subjectChronological")
call_macro("copy-first-item", source: "$i.d", target: "@rswk.subjectDate")
call_macro("copy-first-item", source: "$i.v", target: "@rswk.subjectGenre")
call_macro("copy-first-item", source: "$i.a", target: "@rswk.subjectPersonName")
call_macro("copy-first-item", source: "$i.t", target: "@rswk.subjectTitleName")
call_macro("copy-first-item", source: "$i.c", target: "@rswk.subjectNameAddendum")
call_macro("alma-subject-common")
end

do put_macro("alma-subject-corporate-name")
set_hash("@rswk")
call_macro("copy-first-item", source: "$i.z", target: "@rswk.subjectGeoName")
call_macro("copy-first-item", source: "$i.y", target: "@rswk.subjectChronological")
call_macro("copy-first-item", source: "$i.a", target: "@rswk.subjectCorporateBodyName")
call_macro("copy-first-item", source: "$i.b", target: "@rswk.subjectCorporateBodySubUnit")
call_macro("copy-first-item", source: "$i.v", target: "@rswk.subjectGenre")
call_macro("copy-first-item", source: "$i.n", target: "@rswk.subjectNumbering")
call_macro("copy-first-item", source: "$i.t", target: "@rswk.subjectTitleName")
call_macro("copy-first-item", source: "$i.p", target: "@rswk.subjectUnit")
call_macro("copy-first-item", source: "$i.c", target: "@rswk.subjectGeoAddendum")
call_macro("alma-subject-common")
end

do put_macro("alma-subject-meeting-name")
set_hash("@rswk")
call_macro("copy-first-item", source: "$i.z", target: "@rswk.subjectGeoName")
call_macro("copy-first-item", source: "$i.y", target: "@rswk.subjectChronological")
call_macro("copy-first-item", source: "$i.a", target: "@rswk.subjectConference")
call_macro("copy-first-item", source: "$i.d", target: "@rswk.subjectDate")
call_macro("copy-first-item", source: "$i.v", target: "@rswk.subjectGenre")
call_macro("copy-first-item", source: "$i.n", target: "@rswk.subjectNumbering")
call_macro("copy-first-item", source: "$i.t", target: "@rswk.subjectTitleName")
call_macro("copy-first-item", source: "$i.p", target: "@rswk.subjectUnit")
call_macro("copy-first-item", source: "$i.c", target: "@rswk.subjectGeoAddendum")
call_macro("alma-subject-common")
end

do put_macro("alma-subject-chronological-term")
set_hash("@rswk")
call_macro("copy-first-item", source: "$i.a", target: "@rswk.subjectChronological")
call_macro("alma-subject-common")
end

do put_macro("alma-subject-topical-term")
set_hash("@rswk")
call_macro("copy-first-item", source: "$i.a", target: "@subjectTopicName")
split_field("@subjectTopicName", ";|--")
set_array("@rswk.subjectTopicName")
do list(path: "@subjectTopicName", "var": "$j")
replace_all("$j", "[.]$", "")
copy_field("$j", "@rswk.subjectTopicName.$append")
end
remove_field("@subjectTopicName")
call_macro("copy-first-item", source: "$i.z", target: "@rswk.subjectGeoName")
call_macro("copy-first-item", source: "$i.y", target: "@rswk.subjectChronological")
call_macro("copy-first-item", source: "$i.x", target: "@rswk.subjectAddendum")
call_macro("copy-first-item", source: "$i.v", target: "@rswk.subjectGenre")
call_macro("alma-subject-common")
end

do put_macro("alma-subject-geographic-name")
set_hash("@rswk")
call_macro("copy-first-item", source: "$i.a", target: "@rswk.subjectGeoName")
call_macro("copy-first-item", source: "$i.y", target: "@rswk.subjectChronological")
call_macro("copy-first-item", source: "$i.v", target: "@rswk.subjectGenre")
call_macro("alma-subject-common")
end

do put_macro("alma-type-monograph")
call_macro("substring", source: "$i.A", target: "@alma-type-monograph", start: "$[start]")
copy_field("@alma-type-monograph", "@alma-type-monograph-facet")
Expand Down
41 changes: 41 additions & 0 deletions src/main/resources/transformation/marc/rswk.fix
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# MARC/600, MARC/610, MARC/611, MARC/648, MARC/650, MARC/651
set_array("RSWK[]")
do list(path: "600??", "var": "$i")
call_macro("subject-personal-name")
end
do list(path: "610??", "var": "$i")
call_macro("subject-corporate-name")
end
do list(path: "611??", "var": "$i")
call_macro("subject-meeting-name")
end
do list(path: "648??", "var": "$i")
call_macro("subject-chronological-term")
end
do list(path: "650??", "var": "$i")
call_macro("subject-topical-term")
end
do list(path: "651??", "var": "$i")
call_macro("subject-geographic-name")
end
# MARC/689
do list(path: "689??", "var": "$i")
if any_equal("$i.D", "p")
call_macro("subject-personal-name")
elsif any_equal("$i.D", "b")
call_macro("subject-corporate-name")
elsif any_equal("$i.D", "f")
call_macro("subject-meeting-name")
elsif any_equal("$i.D", "s")
call_macro("subject-topical-term")
elsif any_equal("$i.D", "g")
call_macro("subject-geographic-name")
end
end
uniq("RSWK[]")
do list(path: "RSWK[]", "var": "$i")
copy_field("$i.subjectGenre", "introx.subject[].$append")
#copy_field("$i.subjectGeoName", "introx.subject[].$append")
copy_field("$i.subjectTitleName", "introx.subject[].$append")
copy_field("$i.subjectUnit", "introx.subject[].$append")
end

0 comments on commit fe6b348

Please sign in to comment.