Skip to content

Commit

Permalink
Change urn-Link mapping to catch non nbn resolver-links #2034
Browse files Browse the repository at this point in the history
I try to catch all URN Links except those repository links that
are have a urn/urn pattern since they are not resolver links:
http://digital.ub.uni-duesseldorf.de/urn/urn:nbn:de:hbz:061:1-249692
or
https://sammlungen.ulb.uni-muenster.de/urn/urn:nbn:de:hbz:6-85659520092
  • Loading branch information
TobiasNx committed Aug 5, 2024
1 parent 2a41671 commit 79b3800
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
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.*[/=]urn:nbn.*")
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.+)(urn:.+$)", "$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.org/")
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/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.org/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.org/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
6 changes: 3 additions & 3 deletions src/test/resources/alma-fix/990198125850206441.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@
"id" : "http://worldcat.org/oclc/162593822",
"label" : "OCLC Ressource"
}, {
"id" : "https://nbn-resolving.org/urn:nbn:de:bvb:12-bsb10020200-9",
"label" : "urn:nbn:de:bvb:12-bsb10020200-9"
"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" : "https://nbn-resolving.org/urn:nbn:de:bvb:12-bsb10020200-9",
"id" : "http://www.mdz-nbn-resolving.de/urn/resolver.pl?urn=urn:nbn:de:bvb:12-bsb10020200-9",
"label" : "URN-Link"
} ],
"inCollection" : [ {
Expand Down

0 comments on commit 79b3800

Please sign in to comment.