Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adjust urn regex #2035

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/main/resources/alma/fix/identifiers.fix
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,18 @@ end
# Sometimes urn are not set in 024 then we could pick up the missing from 856.
# 856 - Electronic Location and Access (R) - Subfield: $u (R) $3 (NR)
# 1. Indicator: 4 = HTTP
set_array("@urnLinks")

do list(path:"8564?", "var":"$i")
if all_match("$i.u", "^http[s]?:\\/\\/nbn-resolving.(de|org)\\/(.*)")
if all_match("$i.u", "^http.*(urn=|[org|de]/)(urn:.+$)") # This should ignore repository links like: https://sammlungen.ulb.uni-muenster.de/urn/urn:nbn:de:hbz:6-85659520092
copy_field("$i.u", "urn[].$append")
replace_all("urn[].$last", "^http[s]?:\\/\\/nbn-resolving.(de|org)\\/(.*)", "$2")
copy_field("$i.u", "@urnLinks.$append")
replace_all("urn[].$last", "^http.*[/=](urn:.+$)", "$1")
end
end

replace_all("urn[].*","^(nbn:de:.*\\d)$","urn:$1")

uniq("@urnLinks")
uniq("urn[]")

# 035 - System Control Number (R) - Subfield: $a (NR)
Expand Down
15 changes: 12 additions & 3 deletions src/main/resources/alma/fix/relatedRessourcesAndLinks.fix
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ set_array("fulltextOnline[]")

do list(path: "8564?", "var":"$i")
if exists("$i.u")
unless any_match("$i.u",".*(doi.org|nbn-resolving).*")
unless any_match("$i.u",".*(doi.org|urn=urn:|(org|de)/urn:).*") # This should not skip repository links like: https://sammlungen.ulb.uni-muenster.de/urn/urn:nbn:de:hbz:6-85659520092
if all_equal("$i.z", "kostenfrei") # kostenfrei, added Digitalisierung not only Verlag or Agentur as filter
if all_match("$i.x", "Verlag|Agentur|Digitalisierung")
copy_field("$i.x", "fulltextOnline[].$append.label")
Expand Down Expand Up @@ -301,13 +301,22 @@ end

# urn for fullTextOnline and sameAs

do list(path:"urn[]","var":"$i")
do list(path:"@urnLinks","var":"$i")
copy_field("$i", "fulltextOnline[].$append.id")
prepend("fulltextOnline[].$last.id","https://nbn-resolving.de/")
copy_field("fulltextOnline[].$last.id", "sameAs[].$append.id")
add_field("fulltextOnline[].$last.label", "URN-Link")
end

if is_empty("@urnLinks")
do list(path:"urn[]","var":"$i")
copy_field("$i", "fulltextOnline[].$append.id")
prepend("fulltextOnline[].$last.id","https://nbn-resolving.org/")
copy_field("fulltextOnline[].$last.id", "sameAs[].$append.id")
add_field("fulltextOnline[].$last.label", "URN-Link")
end
end


# TODO: hasVersion is outcommented since it needs some remodelling
# See https://github.com/hbz/lobid-resources/issues/1242
# <!--
Expand Down
4 changes: 2 additions & 2 deletions src/test/resources/alma-fix/990184127410206441.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"id" : "https://d-nb.info/1009982311",
"label" : "DNB-Ressource"
}, {
"id" : "https://nbn-resolving.de/urn:nbn:de:hbz:061:3-3091",
"id" : "https://nbn-resolving.org/urn:nbn:de:hbz:061:3-3091",
"label" : "urn:nbn:de:hbz:061:3-3091"
}, {
"id" : "http://nwbib.de/990184127410206441#!",
Expand All @@ -94,7 +94,7 @@
"label" : "Verlag",
"id" : "http://www.duesseldorf.de/wohnen/veroeffentlichung/index.shtml"
}, {
"id" : "https://nbn-resolving.de/urn:nbn:de:hbz:061:3-3091",
"id" : "https://nbn-resolving.org/urn:nbn:de:hbz:061:3-3091",
"label" : "URN-Link"
} ],
"inCollection" : [ {
Expand Down
4 changes: 2 additions & 2 deletions src/test/resources/alma-fix/990193229450206441.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"id" : "https://d-nb.info/1026654807",
"label" : "DNB-Ressource"
}, {
"id" : "https://nbn-resolving.de/urn:nbn:de:hbz:6-85659520092",
"id" : "https://nbn-resolving.org/urn:nbn:de:hbz:6-85659520092",
"label" : "urn:nbn:de:hbz:6-85659520092"
}, {
"id" : "http://nwbib.de/990193229450206441#!",
Expand All @@ -109,7 +109,7 @@
"label" : "Digitalisierung",
"id" : "http://sammlungen.ulb.uni-muenster.de/urn/urn:nbn:de:hbz:6-85659520092"
}, {
"id" : "https://nbn-resolving.de/urn:nbn:de:hbz:6-85659520092",
"id" : "https://nbn-resolving.org/urn:nbn:de:hbz:6-85659520092",
"label" : "URN-Link"
} ],
"inCollection" : [ {
Expand Down
4 changes: 2 additions & 2 deletions src/test/resources/alma-fix/990197067610206441.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"id" : "https://hub.culturegraph.org/resource/(DE-605)990197067610206441",
"label" : "Culturegraph Ressource"
}, {
"id" : "https://nbn-resolving.de/urn:nbn:de:hbz:061:1-249692",
"id" : "http://nbn-resolving.de/urn:nbn:de:hbz:061:1-249692",
"label" : "urn:nbn:de:hbz:061:1-249692"
} ],
"primaryForm" : [ {
Expand All @@ -77,7 +77,7 @@
"note" : [ "Elektronische Reproduktion von" ]
} ],
"fulltextOnline" : [ {
"id" : "https://nbn-resolving.de/urn:nbn:de:hbz:061:1-249692",
"id" : "http://nbn-resolving.de/urn:nbn:de:hbz:061:1-249692",
"label" : "URN-Link"
} ],
"inCollection" : [ {
Expand Down
163 changes: 163 additions & 0 deletions src/test/resources/alma-fix/990198125850206441.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
{
"@context" : "http://lobid.org/resources/context.jsonld",
"id" : "http://lobid.org/resources/990198125850206441#!",
"type" : [ "BibliographicResource", "Book" ],
"medium" : [ {
"label" : "Datenträger",
"id" : "http://rdaregistry.info/termList/RDAMediaType/1003"
}, {
"label" : "Online-Ressource",
"id" : "http://rdaregistry.info/termList/RDACarrierType/1018"
} ],
"title" : "Zur Geschichte und Kunde des ehemaligen Nahe-Gaues",
"almaMmsId" : "990198125850206441",
"urn" : [ "urn:nbn:de:bvb:12-bsb10020200-9" ],
"hbzId" : "HT017749938",
"deprecatedUri" : "http://lobid.org/resources/HT017749938#!",
"oclcNumber" : [ "162593822" ],
"publication" : [ {
"startDate" : "1853",
"type" : [ "PublicationEvent" ],
"location" : [ "Birkenfeld" ],
"publishedBy" : [ "Kittsteiner" ]
} ],
"describedBy" : {
"id" : "http://lobid.org/resources/990198125850206441",
"label" : "Webseite der hbz-Ressource 990198125850206441",
"type" : [ "BibliographicDescription" ],
"inDataset" : {
"id" : "http://lobid.org/resources/dataset#!",
"label" : "lobid-resources – Der hbz-Verbundkatalog als Linked Open Data"
},
"resultOf" : {
"type" : [ "CreateAction" ],
"endTime" : "0000-00-00T00:00:00",
"instrument" : {
"id" : "https://github.com/hbz/lobid-resources",
"type" : [ "SoftwareApplication" ],
"label" : "Software lobid-resources"
},
"object" : {
"id" : "https://lobid.org/marcxml/990198125850206441",
"dateCreated" : "2021-04-05",
"dateModified" : "2022-06-04",
"type" : [ "DataFeedItem" ],
"label" : "hbz-Ressource 990198125850206441 im Exportformat MARC21 XML",
"inDataset" : {
"id" : "https://datahub.io/dataset/hbz_unioncatalog",
"label" : "hbz_unioncatalog"
},
"sourceOrganization" : {
"id" : "http://lobid.org/organisations/DE-929#!",
"label" : "Landesbibliothekszentrum Rheinland-Pfalz / Rheinische Landesbibliothek"
},
"provider" : {
"id" : "http://lobid.org/organisations/DE-605#!",
"label" : "hbz - Hochschulbibliothekszentrum des Landes Nordrhein-Westfalen"
},
"modifiedBy" : [ {
"id" : "http://lobid.org/organisations/DE-605#!",
"label" : "hbz - Hochschulbibliothekszentrum des Landes Nordrhein-Westfalen"
} ]
}
},
"license" : [ {
"id" : "http://creativecommons.org/publicdomain/zero/1.0",
"label" : "Creative Commons-Lizenz CC0 1.0 Universal"
} ]
},
"sameAs" : [ {
"id" : "https://hub.culturegraph.org/resource/(DE-605)990198125850206441",
"label" : "Culturegraph Ressource"
}, {
"id" : "http://worldcat.org/oclc/162593822",
"label" : "OCLC Ressource"
}, {
"id" : "http://www.mdz-nbn-resolving.de/urn/resolver.pl?urn=urn:nbn:de:bvb:12-bsb10020200-9",
"label" : "resolver.pl?urn=urn:nbn:de:bvb:12-bsb10020200-9"
} ],
"fulltextOnline" : [ {
"id" : "http://www.mdz-nbn-resolving.de/urn/resolver.pl?urn=urn:nbn:de:bvb:12-bsb10020200-9",
"label" : "URN-Link"
} ],
"inCollection" : [ {
"id" : "https://nrw.digibib.net/search/hbzvk/",
"label" : "DigiBib hbz Verbundkatalog",
"type" : [ "Collection" ]
}, {
"id" : "http://lobid.org/organisations/DE-655#!",
"label" : "hbz - Hochschulbibliothekszentrum des Landes Nordrhein-Westfalen, Netzwerkzone",
"type" : [ "Collection" ]
} ],
"language" : [ {
"id" : "http://id.loc.gov/vocabulary/iso639-2/ger",
"label" : "Deutsch"
} ],
"extent" : "IV, 166 S., 1 Taf. 8\"",
"note" : [ "In Fraktur" ],
"subject" : [ {
"notation" : "130",
"type" : [ "Concept" ],
"id" : "https://w3id.org/lobid/rpb2#n130",
"label" : "Landeskunde Region Koblenz",
"source" : {
"id" : "https://w3id.org/lobid/rpb2",
"label" : "LBZ-Notationen"
}
}, {
"notation" : "140",
"type" : [ "Concept" ],
"id" : "https://w3id.org/lobid/rpb2#n140",
"label" : "Pflichtexemplar Region Koblenz",
"source" : {
"id" : "https://w3id.org/lobid/rpb2",
"label" : "LBZ-Notationen"
}
}, {
"notation" : "330",
"type" : [ "Concept" ],
"id" : "https://w3id.org/lobid/rpb2#n330",
"label" : "Geschichte",
"source" : {
"id" : "https://w3id.org/lobid/rpb2",
"label" : "LBZ-Notationen"
}
}, {
"type" : [ "ComplexSubject" ],
"label" : "Nahegau | Geschichte",
"componentList" : [ {
"type" : [ "PlaceOrGeographicName" ],
"label" : "Nahegau",
"source" : {
"label" : "Gemeinsame Normdatei (GND)",
"id" : "https://d-nb.info/gnd/7749153-1"
},
"id" : "https://d-nb.info/gnd/4580132-0",
"gndIdentifier" : "4580132-0"
}, {
"type" : [ "SubjectHeading" ],
"label" : "Geschichte"
} ]
} ],
"subjectslabels" : [ "Nahegau", "Geschichte" ],
"bibliographicLevel" : {
"label" : "Monograph/Item",
"id" : "https://www.loc.gov/marc/bibliographic/bdleader.html#Monograph_Item"
},
"responsibilityStatement" : [ "von Auctionsverwalter Leyser in Oberstein" ],
"contribution" : [ {
"agent" : {
"gndIdentifier" : "1034937715",
"id" : "https://d-nb.info/gnd/1034937715",
"label" : "Leyser, Johann Jakob",
"type" : [ "Person" ],
"dateOfBirth" : "1799",
"dateOfDeath" : "1867"
},
"role" : {
"id" : "http://id.loc.gov/vocabulary/relators/aut",
"label" : "Autor/in"
},
"type" : [ "Contribution" ]
} ]
}
Loading
Loading