Skip to content

Commit

Permalink
Merge #1381 from branch '1340-adjustAdditionalElementsToConformToSche…
Browse files Browse the repository at this point in the history
  • Loading branch information
dr0i committed Aug 15, 2022
2 parents a438bea + fde5ca6 commit 127804e
Show file tree
Hide file tree
Showing 84 changed files with 893 additions and 1,228 deletions.
76 changes: 38 additions & 38 deletions src/main/resources/alma/alma.fix
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ include ("./fix/maps.fix")
copy_field("001","almaMmsId")

# <data name="id" source="@almaMmsId">
# <regexp match="(.*)" format="https://lobid.org/resources/${1}#!"/>
# <regexp match="(.*)" format="http://lobid.org/resources/${1}#!"/>
# </data>
# </rules>

paste("id", "~https://lobid.org/resources/", "001", "~#!", join_char: "")
paste("id", "~http://lobid.org/resources/", "001", "~#!", join_char: "")

# <data name="\@context" source="@almaMmsId">
# <constant value="https://lobid.org/resources/context.jsonld"/>
# </data>

add_field("@context","https://lobid.org/resources/context.jsonld")
add_field("@context","http://lobid.org/resources/context.jsonld")

include ("./fix/titleRelatedFields.fix")
include ("./fix/describedBy.fix")
Expand All @@ -29,38 +29,38 @@ include ("./fix/contribution.fix")

vacuum()
retain(
"@context",
"abstract[]",
"almaMmsId",
"alternativeTitle[]",
"describedBy",
"contribution[]",
"doi[]",
"edition[]",
"hasItem[]",
"hbzId",
"id",
"inCollection[]",
"isbn[]",
"issn[]",
"ismn[]",
"isPartOf[]",
"language[]",
"medium[]",
"natureOfContent[]",
"note[]",
"oclcNumber[]",
"otherTitleInformation[]",
"publication[]",
"related[]",
"responsibilityStatement[]",
"sameAs[]",
"subject[]",
"subjectAltLabel[]",
"tableOfContents[]",
"thesisInformation[]",
"title",
"titleOfSubSeries",
"type[]",
"zdbId"
)
"@context",
"abstract[]",
"almaMmsId",
"alternativeTitle[]",
"describedBy",
"contribution[]",
"doi[]",
"edition[]",
"hasItem[]",
"hbzId",
"id",
"inCollection[]",
"isbn[]",
"issn[]",
"ismn[]",
"isPartOf[]",
"language[]",
"medium[]",
"natureOfContent[]",
"note[]",
"oclcNumber[]",
"otherTitleInformation[]",
"publication[]",
"related[]",
"responsibilityStatement[]",
"sameAs[]",
"subject[]",
"subjectAltLabel[]",
"tableOfContents[]",
"thesisInformation[]",
"title",
"titleOfSubSeries",
"type[]",
"zdbId"
)
10 changes: 5 additions & 5 deletions src/main/resources/alma/fix/contribution.fix
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ do list(path:"100[01] ", "var":"$i")
# type
set_array("contribution[].$last.agent.type[]","Person")
# role
copy_field("$j","contribution[].$last.agent.role.id")
copy_field("$j","contribution[].$last.role.id")
end
end
end
Expand Down Expand Up @@ -128,7 +128,7 @@ do list(path:"700[01] ", "var":"$i")
# type
set_array("contribution[].$last.agent.type[]","Person")
# role
copy_field("$j","contribution[].$last.agent.role.id")
copy_field("$j","contribution[].$last.role.id")
end
end
end
Expand Down Expand Up @@ -201,7 +201,7 @@ do list(path:"110[012] ", "var":"$i")
# type
set_array("contribution[].$last.agent.type[]","CorporateBody")
# role
copy_field("$j","contribution[].$last.agent.role.id")
copy_field("$j","contribution[].$last.role.id")
end
end
end
Expand Down Expand Up @@ -231,7 +231,7 @@ do list(path:"710[012] ", "var":"$i")
# type
set_array("contribution[].$last.agent.type[]","CorporateBody")
# role
copy_field("$j","contribution[].$last.agent.role.id")
copy_field("$j","contribution[].$last.role.id")
end
end
end
Expand All @@ -240,6 +240,6 @@ end
set_array("contribution[].*.type[]", "Contribution")
replace_all("contribution[].*.agent.id","^\\(DE-588\\)(.*$)","https://d-nb.info/gnd/$1")
replace_all("contribution[].*.agent.label","(?<!\\p{Upper})\\.$|[,]$","")
prepend("contribution[].*.agent.role.id","http://id.loc.gov/vocabulary/relators/")
prepend("contribution[].*.role.id","http://id.loc.gov/vocabulary/relators/")

# Deleted the "conference"-Element TODO: specific conference Info needs to be added elsewhere.
3 changes: 3 additions & 0 deletions src/main/resources/alma/fix/describedBy.fix
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ add_field("describedBy.license[].$last.label","Creative Commons-Lizenz CC0 1.0 U
# 040 - Cataloging Source (NR) - Subfield: $a (NR), $c (NR), $d (R)

copy_field("040 .a", "describedBy.sourceOrganization.id")
replace_all("describedBy.sourceOrganization.id", " ", "")
prepend("describedBy.sourceOrganization.id", "http://lobid.org/organisations/DE-")
append("describedBy.sourceOrganization.id", "#!")
if exists("describedBy.sourceOrganization.id")
Expand All @@ -180,6 +181,7 @@ end

# TODO: It seems that there are a lot of organisations that are not in lobid, we should filter them out.
copy_field("040 .c", "describedBy.provider.id")
replace_all("describedBy.provider.id", " ", "")
prepend("describedBy.provider.id", "http://lobid.org/organisations/DE-")
append("describedBy.provider.id", "#!")
if exists("describedBy.provider.id")
Expand Down Expand Up @@ -209,6 +211,7 @@ do list(path:"040 .d", "var":"$i")
end
end
replace_all("describedBy.modifiedBy.id", "(DE-)?(.*)", "$2")
replace_all("describedBy.modifiedBy.id", " ", "")
prepend("describedBy.modifiedBy.id", "http://lobid.org/organisations/DE-")
append("describedBy.modifiedBy.id", "#!")
if exists("describedBy.modifiedBy.id")
Expand Down
18 changes: 10 additions & 8 deletions src/main/resources/alma/fix/fields.fix
Original file line number Diff line number Diff line change
Expand Up @@ -804,14 +804,16 @@ end
#

# 960 ## no Information about repeatability

do list(path:"960??", "var":"$i")
do list(path:"$i.?", "var": "$j")
copy_field("$j", "inCollection[].$append.id")
replace_all("inCollection[].$last.id", "^(.*)$", "http://lobid.org/collections/$1#!")
# TODO: Do we need a label? https://github.com/hbz/lobid-resources/issues/1305#issuecomment-912312471, also labels seem wrong.
end
end
# TODO: This needs further inspection if we need a collection fr all subfields: https://service-wiki.hbz-nrw.de/display/VDBE/960+-+Selektionskennzeichen+NZ
# Values from r can be invalid.

# do list(path:"960??", "var":"$i")
# do list(path:"$i.?", "var": "$j")
# copy_field("$j", "inCollection[].$append.id")
# replace_all("inCollection[].$last.id", "^(.*)$", "http://lobid.org/collections/$1#!")
# # TODO: Do we need a label? https://github.com/hbz/lobid-resources/issues/1305#issuecomment-912312471, also labels seem wrong.
# end
# end


set_array("inCollection[].*.type[]","Collection")
32 changes: 16 additions & 16 deletions src/main/resources/alma/fix/item.fix
Original file line number Diff line number Diff line change
Expand Up @@ -108,22 +108,22 @@ end
# </combine>
# </entity>

# TODO: The morph only took up H52 without indices, but what about 1. inidice 8 ("H528 ") and 2. indice 1 ("H5281")
do list(path:"H52 ", "var": "$i")
if any_match("$i.8", ".*(\\d{4})$")
copy_field("$i.8", "hasItem[].$append.id")
prepend("hasItem[].$last.id","https://lobid.org/item/")
add_field("hasItem[].$last.label", "lobid Bestandsressource")
set_array("hasItem[].$last.type[]", "Item", "H52")
copy_field("$i.h", "hasItem[].$last.callNumber")
paste("hasItem[].$last.currentLocation", "$i.b", "~/", "$i.c")
copy_field("$i.8", "hasItem[].$last.heldBy.id")
replace_all("hasItem[].$last.heldBy.id",".*(\\d{4})$","$1")
lookup("hasItem[].$last.heldBy.id", "alma-institution-code-to-isil")
prepend("hasItem[].$last.heldBy.id", "http://lobid.org/organisations/")
append("hasItem[].$last.heldBy.id","#!")
end
end
# # TODO: The morph only took up H52 without indices, but what about 1. inidice 8 ("H528 ") and 2. indice 1 ("H5281")
# do list(path:"H52 ", "var": "$i")
# if any_match("$i.8", ".*(\\d{4})$")
# copy_field("$i.8", "hasItem[].$append.id")
# prepend("hasItem[].$last.id","https://lobid.org/item/")
# add_field("hasItem[].$last.label", "lobid Bestandsressource")
# set_array("hasItem[].$last.type[]", "Item", "H52")
# copy_field("$i.h", "hasItem[].$last.callNumber")
# paste("hasItem[].$last.currentLocation", "$i.b", "~/", "$i.c")
# copy_field("$i.8", "hasItem[].$last.heldBy.id")
# replace_all("hasItem[].$last.heldBy.id",".*(\\d{4})$","$1")
# lookup("hasItem[].$last.heldBy.id", "alma-institution-code-to-isil")
# prepend("hasItem[].$last.heldBy.id", "http://lobid.org/organisations/")
# append("hasItem[].$last.heldBy.id","#!")
# end
# end

#
# <!-- ITM -->
Expand Down
24 changes: 12 additions & 12 deletions src/test/resources/alma-fix/(CKB)2550000000015245.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"almaMmsId" : "99370746459806441",
"@context" : "https://lobid.org/resources/context.jsonld",
"@context" : "http://lobid.org/resources/context.jsonld",
"title" : "Equivalents of the axiom of choice",
"alternativeTitle" : [ "Studies in Logic and the Foundations of Mathematics" ],
"describedBy" : {
Expand Down Expand Up @@ -242,23 +242,23 @@
"contribution" : [ {
"agent" : {
"label" : "Rubin, Herman",
"type" : [ "Person" ],
"role" : {
"id" : "http://id.loc.gov/vocabulary/relators/aut",
"label" : "Autor/in"
}
"type" : [ "Person" ]
},
"role" : {
"id" : "http://id.loc.gov/vocabulary/relators/aut",
"label" : "Autor/in"
},
"type" : [ "Contribution" ]
}, {
"agent" : {
"label" : "Rubin, Jean",
"type" : [ "Person" ],
"role" : {
"id" : "http://id.loc.gov/vocabulary/relators/ctb",
"label" : "Beitragende/r"
}
"type" : [ "Person" ]
},
"role" : {
"id" : "http://id.loc.gov/vocabulary/relators/ctb",
"label" : "Beitragende/r"
},
"type" : [ "Contribution" ]
} ],
"id" : "https://lobid.org/resources/99370746459806441#!"
"id" : "http://lobid.org/resources/99370746459806441#!"
}
14 changes: 7 additions & 7 deletions src/test/resources/alma-fix/(CKB)2940000000001369.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"almaMmsId" : "99370699582506441",
"@context" : "https://lobid.org/resources/context.jsonld",
"@context" : "http://lobid.org/resources/context.jsonld",
"title" : "BUW-Output",
"alternativeTitle" : [ "BUW-Output", "BUW-Output", "Output" ],
"otherTitleInformation" : [ "Forschungsmagazin = Research bulletin / Universität Wuppertal ; hrsg. im Auftrag des Rektorates" ],
Expand Down Expand Up @@ -180,13 +180,13 @@
"gndIdentifier" : "(DE-588)64944-2",
"id" : "https://d-nb.info/gnd/64944-2",
"label" : "Bergische Universität Wuppertal",
"type" : [ "CorporateBody" ],
"role" : {
"id" : "http://id.loc.gov/vocabulary/relators/aut",
"label" : "Autor/in"
}
"type" : [ "CorporateBody" ]
},
"role" : {
"id" : "http://id.loc.gov/vocabulary/relators/aut",
"label" : "Autor/in"
},
"type" : [ "Contribution" ]
} ],
"id" : "https://lobid.org/resources/99370699582506441#!"
"id" : "http://lobid.org/resources/99370699582506441#!"
}
24 changes: 12 additions & 12 deletions src/test/resources/alma-fix/(CKB)4100000010077918.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"almaMmsId" : "99370763433806441",
"@context" : "https://lobid.org/resources/context.jsonld",
"@context" : "http://lobid.org/resources/context.jsonld",
"title" : "Uncanny bodies",
"otherTitleInformation" : [ "superhero comics and disability" ],
"describedBy" : {
Expand Down Expand Up @@ -173,23 +173,23 @@
"contribution" : [ {
"agent" : {
"label" : "Smith, Scott Thompson",
"type" : [ "Person" ],
"role" : {
"id" : "http://id.loc.gov/vocabulary/relators/ctb",
"label" : "Beitragende/r"
}
"type" : [ "Person" ]
},
"role" : {
"id" : "http://id.loc.gov/vocabulary/relators/ctb",
"label" : "Beitragende/r"
},
"type" : [ "Contribution" ]
}, {
"agent" : {
"label" : "Alaniz, José",
"type" : [ "Person" ],
"role" : {
"id" : "http://id.loc.gov/vocabulary/relators/ctb",
"label" : "Beitragende/r"
}
"type" : [ "Person" ]
},
"role" : {
"id" : "http://id.loc.gov/vocabulary/relators/ctb",
"label" : "Beitragende/r"
},
"type" : [ "Contribution" ]
} ],
"id" : "https://lobid.org/resources/99370763433806441#!"
"id" : "http://lobid.org/resources/99370763433806441#!"
}
14 changes: 7 additions & 7 deletions src/test/resources/alma-fix/(CKB)5280000000199164.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"almaMmsId" : "99370682219806441",
"@context" : "https://lobid.org/resources/context.jsonld",
"@context" : "http://lobid.org/resources/context.jsonld",
"title" : "Kirche weltweit",
"alternativeTitle" : [ "Kirche weltweit", "Mitteilungsblatt des Leipziger Missionswerkes der Evangelisch-Lutherischen Landeskirchen Mecklenburgs, Sachsens, Thüringens" ],
"otherTitleInformation" : [ "Mitteilungsblatt des Leipziger Missionswerkes der Evangelisch-Lutherischen Landeskirche Sachsens und der Evangelischen Kirche in Mitteldeutschland" ],
Expand Down Expand Up @@ -190,13 +190,13 @@
"gndIdentifier" : "(DE-588)5500538-X",
"id" : "https://d-nb.info/gnd/5500538-X",
"label" : "Evangelisch-Lutherisches Missionswerk Leipzig",
"type" : [ "CorporateBody" ],
"role" : {
"id" : "http://id.loc.gov/vocabulary/relators/isb",
"label" : "Herausgeber/in"
}
"type" : [ "CorporateBody" ]
},
"role" : {
"id" : "http://id.loc.gov/vocabulary/relators/isb",
"label" : "Herausgeber/in"
},
"type" : [ "Contribution" ]
} ],
"id" : "https://lobid.org/resources/99370682219806441#!"
"id" : "http://lobid.org/resources/99370682219806441#!"
}
4 changes: 2 additions & 2 deletions src/test/resources/alma-fix/(DE-6)1523217-49hbz_ulm.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"almaMmsId" : "991000688209706449",
"@context" : "https://lobid.org/resources/context.jsonld",
"@context" : "http://lobid.org/resources/context.jsonld",
"titleOfSubSeries" : "Bd. 63",
"title" : "Bayerische Vorgeschichtsblätter, Bd. 63",
"otherTitleInformation" : [ "BVbl" ],
Expand Down Expand Up @@ -72,5 +72,5 @@
} ],
"type" : [ "BibliographicResource", "Book" ],
"responsibilityStatement" : [ "hrsg. von der Kommission für Bayerische Landesgeschichte bei der Bayerischen Akademie der Wissenschaften in Verbindung mit der Archäologischen Staatssammlung und dem Bayerischen Landesamt für Denkmalpflege" ],
"id" : "https://lobid.org/resources/991000688209706449#!"
"id" : "http://lobid.org/resources/991000688209706449#!"
}
Loading

0 comments on commit 127804e

Please sign in to comment.