Skip to content

Commit

Permalink
Rewrite to-lobid isPartOf[] transformation (RPB-256)
Browse files Browse the repository at this point in the history
- For type `Band`, use data from `inSeries[]` (Strapi: Gesamttitel)
and `volumeIn` (Strapi: Bandangaben) for `isPartOf[]` in lobid
- For all types, transform to the lobid `isPartOf[]` structure
  • Loading branch information
fsteeg committed Feb 25, 2025
1 parent fd108fd commit 7f8a344
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 99 deletions.
14 changes: 7 additions & 7 deletions conf/output/test-output-24.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
{
"isPartOf" : [ {
"type" : [ "IsPartOfRelation" ],
"hasSuperordinate" : [ {
"label" : "Kunst und Geschichte in Rheinland-Pfalz"
} ],
"numbering" : "82"
} ],
"@context" : "http://lobid.org/resources/context.jsonld",
"type" : [ "BibliographicResource", "Article" ],
"rpbId" : "107t01147873",
Expand All @@ -9,13 +16,6 @@
"label" : "Rheinland-Pfälzische Bibliographie"
} ],
"title" : "Das Hambacher Schloß.",
"isPartOf" : [ {
"type" : [ "IsPartOfRelation" ],
"hasSuperordinate" : [ {
"label" : "Kunst und Geschichte in Rheinland-Pfalz"
} ],
"numbering" : "82"
} ],
"publication" : [ {
"startDate" : "1982",
"type" : [ "PublicationEvent" ]
Expand Down
12 changes: 6 additions & 6 deletions conf/output/test-output-29.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"isPartOf" : [ {
"type" : [ "IsPartOfRelation" ],
"hasSuperordinate" : [ {
"label" : "150 Jahre Hambacher Fest : Festausgabe"
} ]
} ],
"@context" : "http://lobid.org/resources/context.jsonld",
"type" : [ "BibliographicResource", "Article" ],
"rpbId" : "107t01147878",
Expand All @@ -10,12 +16,6 @@
} ],
"title" : "Um- und Ausbau des Hambacher Schlosses von 1979 bis 1982",
"extent" : "Ill.",
"isPartOf" : [ {
"type" : [ "IsPartOfRelation" ],
"hasSuperordinate" : [ {
"label" : "150 Jahre Hambacher Fest : Festausgabe"
} ]
} ],
"publication" : [ {
"startDate" : "1982",
"type" : [ "PublicationEvent" ]
Expand Down
1 change: 0 additions & 1 deletion conf/output/test-output-57.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"label" : "Rheinland-Pfälzische Bibliographie"
} ],
"title" : "Das Leben der Bilder oder die Kunst des Sehens",
"alternativeTitle" : [ "Salto ; [13]" ],
"extent" : "141 S. : Ill.",
"note" : [ "Aus dem Engl. übers." ],
"responsibilityStatement" : [ "John Berger" ],
Expand Down
1 change: 0 additions & 1 deletion conf/output/test-output-85.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"label" : "Rheinland-Pfälzische Bibliographie"
} ],
"title" : "Wandern auf Rheinsteig und Rheinburgenweg",
"alternativeTitle" : [ "DuMont aktiv" ],
"extent" : "180 Seiten : Illustrationen, Diagramme, Karten",
"note" : [ "Enthält Index" ],
"responsibilityStatement" : [ "Manfred Böckling" ],
Expand Down
7 changes: 0 additions & 7 deletions conf/output/test-output-87.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@
"title" : "2000 Jahre Meilbrück : vom römischen Tempelbezirk zur modernen Raststätte; Von den Anfängen bis zum Ende der Römerherrschaft",
"alternativeTitle" : [ "Zweitausend Jahre Meilbrück" ],
"extent" : "Ill.",
"isPartOf" : [ {
"type" : [ "IsPartOfRelation" ],
"hasSuperordinate" : [ {
"id" : "http://rpb.lobid.org/121t0146618"
} ],
"numbering" : "1"
} ],
"publication" : [ {
"startDate" : "1990",
"type" : [ "PublicationEvent" ]
Expand Down
1 change: 0 additions & 1 deletion conf/output/test-output-90.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"label" : "Rheinland-Pfälzische Bibliographie"
} ],
"title" : "Der Krieg war aus! : Nachkriegsalltag in Wittlich",
"alternativeTitle" : [ "Beiträge zur Geschichte und Kultur der Stadt Wittlich" ],
"extent" : "254 S. : Ill.",
"note" : [ "Darin u.a. S. 7-20: Schreier, Susanne: \"Der Krieg war aus, aber er war auch nicht aus\". - S. 21-52: Schindelka, Martina: Das Leben unter und mit der Besatzung. - S. 53-76: Fritzsche, Wolfgang: Maggeln, Hamstern und Kompensieren bestimmten die Versorgung. - S. 77-93: Fritzsche, Wolfgang: \"Von 700 Litern Schnaps ein Haus gebaut\". - S. 227-233: Schreier, Susanne: \"Das ging leise, nicht wie eine Explosion\". - S. 235-241: Schreier, Susanne: Nachkriegszeit in Wittlich." ],
"responsibilityStatement" : [ "hrsg. von Susanne Schreier im Auftr. der Stiftung Stadt Wittlich" ],
Expand Down
1 change: 0 additions & 1 deletion conf/output/test-output-91.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"label" : "Rheinland-Pfälzische Bibliographie"
} ],
"title" : "Adressbuch der Stadt Ems : in 3 Heften",
"alternativeTitle" : [ "Bad Emser Hefte ; ..." ],
"responsibilityStatement" : [ "Verein für Geschichte, Denkmal- u. Landschaftspflege e.V. Bad Ems" ],
"publication" : [ {
"location" : [ "Bad Ems" ],
Expand Down
7 changes: 6 additions & 1 deletion conf/output/test-output-92.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
"@context" : "http://lobid.org/resources/context.jsonld",
"type" : [ "BibliographicResource", "Book" ],
"isPartOf" : [ {
"type" : [ "IsPartOfRelation" ],
"hasSuperordinate" : [ {
"label" : "Bad Emser Hefte"
} ],
"numbering" : "76"
}, {
"type" : [ "IsPartOfRelation" ],
"hasSuperordinate" : [ {
"id" : "http://rpb.lobid.org/929t163432",
Expand All @@ -17,7 +23,6 @@
"label" : "Rheinland-Pfälzische Bibliographie"
} ],
"title" : "Adressbuch der Stadt Ems : in 3 Heften : 1 (1989)",
"alternativeTitle" : [ "Bad Emser Hefte ; 76" ],
"extent" : "40 S.",
"publication" : [ {
"startDate" : "1989",
Expand Down
7 changes: 6 additions & 1 deletion conf/output/test-output-93.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
"@context" : "http://lobid.org/resources/context.jsonld",
"type" : [ "BibliographicResource", "Book" ],
"isPartOf" : [ {
"type" : [ "IsPartOfRelation" ],
"hasSuperordinate" : [ {
"label" : "Bad Emser Hefte"
} ],
"numbering" : "77"
}, {
"type" : [ "IsPartOfRelation" ],
"hasSuperordinate" : [ {
"id" : "http://rpb.lobid.org/929t163432",
Expand All @@ -17,7 +23,6 @@
"label" : "Rheinland-Pfälzische Bibliographie"
} ],
"title" : "Adressbuch der Stadt Ems : in 3 Heften : 2 ([1989])",
"alternativeTitle" : [ "Bad Emser Hefte ; 77" ],
"extent" : "S. 42 - 84",
"publication" : [ {
"startDate" : "1989",
Expand Down
7 changes: 6 additions & 1 deletion conf/output/test-output-94.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
"@context" : "http://lobid.org/resources/context.jsonld",
"type" : [ "BibliographicResource", "Book" ],
"isPartOf" : [ {
"type" : [ "IsPartOfRelation" ],
"hasSuperordinate" : [ {
"label" : "Bad Emser Hefte"
} ],
"numbering" : "78"
}, {
"type" : [ "IsPartOfRelation" ],
"hasSuperordinate" : [ {
"id" : "http://rpb.lobid.org/929t163432",
Expand All @@ -17,7 +23,6 @@
"label" : "Rheinland-Pfälzische Bibliographie"
} ],
"title" : "Adressbuch der Stadt Ems : in 3 Heften : 3 ([1989])",
"alternativeTitle" : [ "Bad Emser Hefte ; 78" ],
"extent" : "S. 86 - 128",
"publication" : [ {
"startDate" : "1989",
Expand Down
91 changes: 19 additions & 72 deletions conf/rpb-titel-to-lobid.fix
Original file line number Diff line number Diff line change
Expand Up @@ -63,28 +63,29 @@ if any_equal("type", "Mehrt. Mono (ÜO)")
set_field("type[].$append", "MultiVolumeBook")
end

# ------- isPartOf -------

if any_equal("type", "Band")
set_field("type[].$append", "Book")
call_macro("move_here", field: "isPartOf[]")
# disable after Allegro import:
copy_field("isPartOf[].label", "superordinateLabel")
unless exists("superordinateLabel")
copy_field("isPartOf[].value", "superordinateLabel")
end
copy_field("isPartOf[].numbering", "tempNumbering")
set_array("isPartOf[]")
set_array("isPartOf[].$append.type[]", "IsPartOfRelation")
set_array("isPartOf[].$last.hasSuperordinate[]")
# Set up superordinate ID: use the volume ID, remove the numbering part:
copy_field("volumeIn.value", "isPartOf[].$last.hasSuperordinate[].$append.id")
copy_field("superordinateLabel", "isPartOf[].$last.hasSuperordinate[].$last.label")
if exists("tempNumbering")
unless all_match("superordinateLabel", ".+ ; .+")
paste("isPartOf[].$last.hasSuperordinate[].$last.label", "superordinateLabel", "~;", "tempNumbering")
end
copy_field("inSeries[].*", "isPartOf[].$append") # Strapi: inSeries[] (Gesamttitel) -> isPartOf
copy_field("volumeIn", "isPartOf[].$append") # Strapi volumeIn (Bandangaben) -> isPartOf
copy_field("f20u", "isPartOf[].$last.label") # label is in f20u
end

# For all types: lobid structure
do list_as("ipo": "isPartOf[]")
set_array("ipo.type[]", "IsPartOfRelation")
if all_match("ipo.value", "^http.+")
move_field("ipo.value", "ipo.id")
else
move_field("ipo.value", "ipo.label")
end
copy_field("volumeIn.numbering", "isPartOf[].$last.numbering")
# disable after Allegro import until here ^
set_array("ipo.hasSuperordinate[]")
set_hash("ipo.hasSuperordinate[].$append")
move_field("ipo.id", "ipo.hasSuperordinate[].$last.id")
move_field("ipo.label", "ipo.hasSuperordinate[].$last.label")
call_macro("move_here", field: "ipo.numbering")
end

# ------- rpbId -------
Expand Down Expand Up @@ -144,13 +145,6 @@ copy_field("parallelTitle[].*.value", "otherTitleInformation[].$append")
move_field("alternativeTitle[]", "alternativeTitleObjects[]")
set_array("alternativeTitle[]")
copy_field("alternativeTitleObjects[].*.value", "alternativeTitle[].$append")
do list_as("inSeries": "inSeries[]")
if exists("inSeries.numbering")
paste("alternativeTitle[].$append", "inSeries.value", "~;", "inSeries.numbering")
else
copy_field("inSeries.value", "alternativeTitle[].$append")
end
end

# ------- "titleKeyword" -------
set_array("titleKeyword[]")
Expand All @@ -169,53 +163,6 @@ end
move_field("temp", "note[]")
uniq("note[]")

#-------- "isPartOf" -------
if exists("volumeIn")
unless any_equal("type", "Band") # disable after Allegro import
unless exists("isPartOf[]")
set_array("isPartOf[]")
end
move_field("volumeIn", "isPartOf[].$append")
end
end
if exists("isPartOf[]")
unless any_equal("type", "Band") # disable after Allegro import
set_array("temp")
do list (path:"isPartOf[]", "var": "$i")
set_array("temp.$append.type[]", "IsPartOfRelation")
set_array("temp.$last.hasSuperordinate[]")
if exists("$i.label")
split_field("$i.label", " ; ")
copy_field("$i.value", "temp.$last.hasSuperordinate[].$append.id")
copy_field("$i.label.1", "temp.$last.hasSuperordinate[].$last.label")
unless all_match("temp.$last.hasSuperordinate[].$last.id", "^http.+")
set_field("temp.$last.hasSuperordinate[].$last.id", "") # free text in Strapi
end
copy_field("$i.numbering", "temp.$last.numbering")
else
split_field("$i.value", " ; ")
if all_match("$i.value", "^http.+")
copy_field("$i.value", "temp.$last.hasSuperordinate[].$append.id")
else
copy_field("$i.value.1", "temp.$last.hasSuperordinate[].$append.label")
end
if exists("$i.numbering")
copy_field("$i.numbering", "temp.$last.numbering")
else
copy_field("$i.value.2", "temp.$last.numbering")
end
end
end
move_field("temp", "isPartOf[]")
end
end
do list_as(partOf: "isPartOf[]")
do list_as(hasSuperordinate: "partOf.hasSuperordinate[]")
unless exists("hasSuperordinate.label")
move_field("superordinate", "hasSuperordinate.label")
end
end
end
# ------- "medium" -------
# Dafür scheint es keine explizite Angabe zu geben.

Expand Down

0 comments on commit 7f8a344

Please sign in to comment.