Skip to content

Commit

Permalink
MWDL IIIF and isShownAt (#558)
Browse files Browse the repository at this point in the history
* Add mapping for IIIF manifests
Update mapping for isShownAt to pull from display \ identifier

* Remove static prefix and suffix values
  • Loading branch information
scott authored Oct 19, 2023
1 parent 3d6b425 commit e95c63d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
17 changes: 10 additions & 7 deletions src/main/scala/dpla/ingestion3/mappers/providers/MwdlMapping.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ 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
Expand Down Expand Up @@ -117,12 +114,18 @@ class MwdlMapping extends XmlMapping with XmlExtractor {
.flatMap(extractStrings)
.map(URI)

override def isShownAt(data: Document[NodeSeq]): ZeroToMany[EdmWebResource] =
// baseIsShownAt + control\recordid
(data \\ "control" \ "recordid")
override def isShownAt(data: Document[NodeSeq]): ZeroToMany[EdmWebResource] = {
// PrimoNMBib > record > display > identifier.
(data \\ "display" \ "identifier")
.flatMap(extractStrings)
.map(baseIsShownAt + _.trim + suffixIsShownAt)
.map(stringOnlyWebResource)
}

override def iiifManifest(data: Document[NodeSeq]): ZeroToMany[URI] =
// links > lln02
(data \\ "links" \ "lln02")
.flatMap(extractStrings)
.map(URI)

override def originalRecord(data: Document[NodeSeq]): ExactlyOne[String] = Utils.formatXml(data)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ class MwdlMappingTest extends FlatSpec with BeforeAndAfter {
it should "extract the correct isShownAt" in {
val xml: NodeSeq = <PrimoNMBib xmlns="http://www.exlibrisgroup.com/xsd/primo/primo_nm_bib">
<record>
<control>
<recordid>
digcoll_slc_27works_598
</recordid>
</control>
<display>
<identifier>
http://libarchive.slcc.edu/islandora/object/works%3A598
</identifier>
</display>
</record>
</PrimoNMBib>
val expected = Seq(uriOnlyWebResource(URI("https://utah-primoprod.hosted.exlibrisgroup.com/primo-explore/fulldisplay?docid=digcoll_slc_27works_598&context=L&vid=MWDL")))
val expected = Seq(uriOnlyWebResource(URI("http://libarchive.slcc.edu/islandora/object/works%3A598")))
assert(extractor.isShownAt(Document(xml)) === expected)
}
it should "extract the correct preview" in {
Expand Down

0 comments on commit e95c63d

Please sign in to comment.