Skip to content

Commit

Permalink
Keep Strapi labels in to-lobid transformation (RPB-223)
Browse files Browse the repository at this point in the history
  • Loading branch information
fsteeg committed Nov 12, 2024
1 parent 9ea23ad commit 87ce58d
Showing 1 changed file with 25 additions and 12 deletions.
37 changes: 25 additions & 12 deletions conf/rpb-titel-to-lobid.fix
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ end
if any_equal("type", "Band")
set_field("type[].$append", "Book")
call_macro("move_here", field: "isPartOf[]")
copy_field("isPartOf[].value", "superordinateLabel")
copy_field("isPartOf[].label", "superordinateLabel")
unless exists("superordinateLabel")
copy_field("isPartOf[].value", "superordinateLabel")
end
set_array("isPartOf[]")
set_array("isPartOf[].$append.type[]", "IsPartOfRelation")
set_array("isPartOf[].$last.hasSuperordinate[]")
Expand Down Expand Up @@ -124,9 +127,14 @@ if exists("isPartOf[]")
set_array("temp")
set_array("temp.$append.type[]", "IsPartOfRelation")
set_array("temp.$last.hasSuperordinate[]")
split_field("isPartOf[].1.value", " ; ")
copy_field("isPartOf[].1.value.1", "temp.$last.hasSuperordinate[].$append.label")
copy_field("isPartOf[].1.value.2", "temp.$last.numbering")
if exists("isPartOf[].1.label")
copy_field("isPartOf[].1.value", "temp.$last.hasSuperordinate[].$append.id")
copy_field("isPartOf[].1.label", "temp.$last.hasSuperordinate[].$last.label")
else
split_field("isPartOf[].1.value", " ; ")
copy_field("isPartOf[].1.value.1", "temp.$last.hasSuperordinate[].$append.label")
copy_field("isPartOf[].1.value.2", "temp.$last.numbering")
end
move_field("temp", "isPartOf[]")
end
end
Expand Down Expand Up @@ -208,10 +216,12 @@ end
do
list (path:"temp_subject.*.componentList[]", "var": "$i")
move_field("$i.value", "$i.id")
copy_field("$i.id", "$i.label")
replace_all("$i.label","^http.+[/#](.+)$","$1")
replace_all("$i.label","^(\\d+)-(\\d+)$","$1n$2")
lookup("$i.label", "./RPB-Export_HBZ_SW.tsv","sep_char":"\t")
unless exists("$i.label")
copy_field("$i.id", "$i.label")
replace_all("$i.label","^http.+[/#](.+)$","$1")
replace_all("$i.label","^(\\d+)-(\\d+)$","$1n$2")
lookup("$i.label", "./RPB-Export_HBZ_SW.tsv","sep_char":"\t")
end
if all_match("$i.id","^http://rpb.lobid.org/sw/.*$")
add_field("$i.source.id", "http://rpb.lobid.org/sw")
add_field("$i.source.label", "RPB-Sachsystematik")
Expand Down Expand Up @@ -287,11 +297,14 @@ do put_macro("contributions")
set_array("_temp")
copy_field("$[from][].*.value", "_temp.$append.agent.id")
do list_as(f: "$[from][]", c: "_temp")
copy_field("c.agent.id", "c.agent.label")
copy_field("f.label", "c.agent.label")
unless exists("c.agent.label")
copy_field("c.agent.id", "c.agent.label")
replace_all("c.agent.label","^http.+[/#](.+)$","$1")
replace_all("c.agent.label","^(\\d+)-(\\d+)$","$1n$2")
lookup("c.agent.label", "./RPB-Export_HBZ_SW.tsv","sep_char":"\t")
end
set_array("c.agent.type[]", "Person")
replace_all("c.agent.label","^http.+[/#](.+)$","$1")
replace_all("c.agent.label","^(\\d+)-(\\d+)$","$1n$2")
lookup("c.agent.label", "./RPB-Export_HBZ_SW.tsv","sep_char":"\t")
copy_field("f.type", "c.role.id")
copy_field("f.type", "c.role.label")
lookup("c.role.id", "role-to-uri")
Expand Down

0 comments on commit 87ce58d

Please sign in to comment.