From e3ddee00fe01964f6a0bbc4e6bd40746ef38257d Mon Sep 17 00:00:00 2001 From: scott Date: Tue, 19 Dec 2023 09:26:04 -0700 Subject: [PATCH] Revert isShownAt mapping changes for MWDL --- .../ingestion3/mappers/providers/MwdlMapping.scala | 11 +++++++---- .../mappers/providers/MwdlMappingTest.scala | 12 ++++++------ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/main/scala/dpla/ingestion3/mappers/providers/MwdlMapping.scala b/src/main/scala/dpla/ingestion3/mappers/providers/MwdlMapping.scala index 42a21fa74..b6d34f024 100644 --- a/src/main/scala/dpla/ingestion3/mappers/providers/MwdlMapping.scala +++ b/src/main/scala/dpla/ingestion3/mappers/providers/MwdlMapping.scala @@ -17,6 +17,9 @@ class MwdlMapping extends XmlMapping with XmlExtractor { override val enforceDuplicateIds: Boolean = false + private val baseIsShownAt = "https://utah-primoprod.hosted.exlibrisgroup.com/primo-explore/fulldisplay?docid=" + private val suffixIsShownAt = "&context=L&vid=MWDL" + val formatBlockList: Set[String] = DigitalSurrogateBlockList.termList ++ FormatTypeValuesBlockList.termList @@ -114,12 +117,12 @@ class MwdlMapping extends XmlMapping with XmlExtractor { .flatMap(extractStrings) .map(URI) - override def isShownAt(data: Document[NodeSeq]): ZeroToMany[EdmWebResource] = { - // PrimoNMBib > record > display > identifier. - (data \\ "display" \ "identifier") + override def isShownAt(data: Document[NodeSeq]): ZeroToMany[EdmWebResource] = + // baseIsShownAt + control\recordid + (data \\ "control" \ "recordid") .flatMap(extractStrings) + .map(baseIsShownAt + _.trim + suffixIsShownAt) .map(stringOnlyWebResource) - } override def iiifManifest(data: Document[NodeSeq]): ZeroToMany[URI] = // links > lln02 diff --git a/src/test/scala/dpla/ingestion3/mappers/providers/MwdlMappingTest.scala b/src/test/scala/dpla/ingestion3/mappers/providers/MwdlMappingTest.scala index 633b28d5d..e55413d69 100644 --- a/src/test/scala/dpla/ingestion3/mappers/providers/MwdlMappingTest.scala +++ b/src/test/scala/dpla/ingestion3/mappers/providers/MwdlMappingTest.scala @@ -72,14 +72,14 @@ class MwdlMappingTest extends FlatSpec with BeforeAndAfter { it should "extract the correct isShownAt" in { val xml: NodeSeq = - - - http://libarchive.slcc.edu/islandora/object/works%3A598 - - + + + digcoll_slc_27works_598 + + - val expected = Seq(uriOnlyWebResource(URI("http://libarchive.slcc.edu/islandora/object/works%3A598"))) + val expected = Seq(uriOnlyWebResource(URI("https://utah-primoprod.hosted.exlibrisgroup.com/primo-explore/fulldisplay?docid=digcoll_slc_27works_598&context=L&vid=MWDL"))) assert(extractor.isShownAt(Document(xml)) === expected) } it should "extract the correct preview" in {