diff --git a/app/services/iiif_manifest.rb b/app/services/iiif_manifest.rb index 85f1e771..fa9cd8f1 100644 --- a/app/services/iiif_manifest.rb +++ b/app/services/iiif_manifest.rb @@ -58,8 +58,9 @@ def compound_id end def ark_url - return unless manifest["rendering"] && manifest["rendering"]["@id"] - manifest["rendering"]["@id"] + first_rendering = Array.wrap(manifest["rendering"]).first + return unless first_rendering && first_rendering["@id"] + first_rendering["@id"] end def noid diff --git a/app/services/iiif_service.rb b/app/services/iiif_service.rb index d9189d80..2902a9af 100644 --- a/app/services/iiif_service.rb +++ b/app/services/iiif_service.rb @@ -15,6 +15,29 @@ def self.iiif_response(url) end def create_iiif_manifest(manifest, collection = nil) - IiifManifest.new(url: manifest['@id'], manifest: manifest, collection: collection) + IiifManifest.new(url: manifest['@id'] || manifest['id'], manifest: manifest, collection: collection) + end + + def object + @object ||= ManifestParser.parse(JSON.parse(response)) + end + + def manifest? + object.is_a?(IIIF::Presentation::Manifest) || object.is_a?(ManifestParser::IIIF3Manifest) + end + + class ManifestParser + def self.parse(json) + return IIIF::Service.parse(json.to_json) unless json["@context"]&.include?("http://iiif.io/api/presentation/3/context.json") + IIIF3Manifest.new(json) + end + + # IIIF::Presentation doesn't support IIIF 3. Fortunately we don't use much + # of it, so a simple wrapper with a label for a manifest gets us there. + class IIIF3Manifest < SimpleDelegator + def label + Array.wrap(__getobj__["label"]).first["@none"] + end + end end end diff --git a/app/values/manifest_metadata.rb b/app/values/manifest_metadata.rb index 09221b4a..dbcf9e71 100644 --- a/app/values/manifest_metadata.rb +++ b/app/values/manifest_metadata.rb @@ -2,8 +2,11 @@ class ManifestMetadata < Spotlight::Resources::IiifManifest::Metadata def jsonld_url - return unless @manifest["see_also"] - json_ld_see_also = Array.wrap(@manifest["see_also"]).find { |v| v["format"] == "application/ld+json" } + # IIIF 3 manifests will have it in seeAlso, it's in see_also for + # IIIF::Presentation manifests. + see_also = @manifest["see_also"] || @manifest["seeAlso"] + return unless see_also + json_ld_see_also = Array.wrap(see_also).find { |v| v["format"] == "application/ld+json" } return unless json_ld_see_also json_ld_see_also["@id"] end diff --git a/spec/fixtures/manifests/recording_manifest.json b/spec/fixtures/manifests/recording_manifest.json new file mode 100644 index 00000000..a9176034 --- /dev/null +++ b/spec/fixtures/manifests/recording_manifest.json @@ -0,0 +1,918 @@ +{ + "@context": [ + "http://www.w3.org/ns/anno.jsonld", + "http://iiif.io/api/presentation/3/context.json" + ], + "type": "Manifest", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest", + "label": { + "@none": [ + "Concert, 2001, October 19 and 20" + ] + }, + "summary": { + "@none": [ + "Digital Audio Tape (DAT).", + "A complete program is available in Mendel Music Library." + ] + }, + "metadata": [ + { + "label": { + "@none": [ + "Author" + ] + }, + "value": { + "@none": [ + "Princeton University. Orchestra" + ] + } + }, + { + "label": { + "@none": [ + "Contents" + ] + }, + "value": { + "@none": [ + "Overture to Hansel and Gretel (1893) / E. Humperdinck -- Symphonic dances (1940) / S. Rachmaninoff -- Appalachian spring (1943) / A. Copland." + ] + } + }, + { + "label": { + "@none": [ + "Extent" + ] + }, + "value": { + "@none": [ + "1 sound cassette." + ] + } + }, + { + "label": { + "@none": [ + "Identifier" + ] + }, + "value": { + "@none": [ + "ark:/99999/fk4x36481t" + ] + } + }, + { + "label": { + "@none": [ + "Part Of" + ] + }, + "value": { + "@none": [ + "puo" + ] + } + }, + { + "label": { + "@none": [ + "Title" + ] + }, + "value": null + }, + { + "label": { + "@none": [ + "Contributor" + ] + }, + "value": { + "@none": [ + "Friends of Music at Princeton" + ] + } + }, + { + "label": { + "@none": [ + "Creator" + ] + }, + "value": { + "@none": [ + "Princeton University. Orchestra" + ] + } + }, + { + "label": { + "@none": [ + "Date" + ] + }, + "value": { + "@none": [ + "2001" + ] + } + }, + { + "label": { + "@none": [ + "Language" + ] + }, + "value": { + "@none": [ + "Undetermined" + ] + } + }, + { + "label": { + "@none": [ + "Local Identifier" + ] + }, + "value": { + "@none": [ + "1248", + "8331" + ] + } + }, + { + "label": { + "@none": [ + "Publisher" + ] + }, + "value": { + "@none": [ + "2001." + ] + } + }, + { + "label": { + "@none": [ + "Source Metadata Identifier" + ] + }, + "value": { + "@none": [ + "3757856" + ] + } + }, + { + "label": { + "@none": [ + "Call Number" + ] + }, + "value": { + "@none": [ + "DAT- 2001-10-19", + "DAT- 2001-10-20" + ] + } + }, + { + "label": { + "@none": [ + "Member Of Collections" + ] + }, + "value": { + "@none": [ + "Performance Ensembles" + ] + } + } + ], + "rendering": [], + "items": [ + { + "type": "Canvas", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/74714a3c-1d70-4753-ac44-fa4e929eacbf", + "label": { + "@none": [ + "Overture to Hansel and Gretel" + ] + }, + "items": [ + { + "type": "AnnotationPage", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/74714a3c-1d70-4753-ac44-fa4e929eacbf/annotation_page/13d808d3-bf42-4ba0-869a-8d6b4a9983fc", + "items": [ + { + "type": "Annotation", + "motivation": "painting", + "body": { + "id": "https://figgy.princeton.edu/downloads/74714a3c-1d70-4753-ac44-fa4e929eacbf/file/7d0b200e-a149-4a59-9659-c0ae64098b9d", + "type": "Audio", + "duration": 506.011, + "format": "application/vnd.apple.mpegurl", + "label": { + "@none": [ + "Overture to Hansel and Gretel" + ] + } + }, + "target": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/74714a3c-1d70-4753-ac44-fa4e929eacbf" + } + ] + } + ], + "local_identifier": "1165", + "rendering": [ + { + "@id": "https://figgy.princeton.edu/downloads/74714a3c-1d70-4753-ac44-fa4e929eacbf/file/67acba54-9823-4fab-815c-cb19afb5a2d5", + "label": "Download the original file", + "format": "audio/x-wav" + } + ], + "width": null, + "height": null, + "duration": 506.011 + }, + { + "type": "Canvas", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/d9621bab-69cd-4869-8ab2-0755183a9ae1", + "label": { + "@none": [ + "I. Non allegro" + ] + }, + "items": [ + { + "type": "AnnotationPage", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/d9621bab-69cd-4869-8ab2-0755183a9ae1/annotation_page/94f785ae-82c9-4bb7-8a01-cdbc2921a78d", + "items": [ + { + "type": "Annotation", + "motivation": "painting", + "body": { + "id": "https://figgy.princeton.edu/downloads/d9621bab-69cd-4869-8ab2-0755183a9ae1/file/65a7a06a-690f-485b-9f29-5b16dcceb64c", + "type": "Audio", + "duration": 675.921, + "format": "application/vnd.apple.mpegurl", + "label": { + "@none": [ + "I. Non allegro" + ] + } + }, + "target": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/d9621bab-69cd-4869-8ab2-0755183a9ae1" + } + ] + } + ], + "local_identifier": "12593", + "rendering": [ + { + "@id": "https://figgy.princeton.edu/downloads/d9621bab-69cd-4869-8ab2-0755183a9ae1/file/b6618749-e40a-4eed-9801-578e0e1fa8d7", + "label": "Download the original file", + "format": "audio/x-wav" + } + ], + "width": null, + "height": null, + "duration": 675.921 + }, + { + "type": "Canvas", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/741be008-f5de-4312-8b09-9d4b93bf14b8", + "label": { + "@none": [ + "II. Andante con moto" + ] + }, + "items": [ + { + "type": "AnnotationPage", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/741be008-f5de-4312-8b09-9d4b93bf14b8/annotation_page/218de09a-9ae0-4453-aeaf-4ec364c413cb", + "items": [ + { + "type": "Annotation", + "motivation": "painting", + "body": { + "id": "https://figgy.princeton.edu/downloads/741be008-f5de-4312-8b09-9d4b93bf14b8/file/15153d37-a156-470e-9a18-8e5ceec03482", + "type": "Audio", + "duration": 549.24, + "format": "application/vnd.apple.mpegurl", + "label": { + "@none": [ + "II. Andante con moto" + ] + } + }, + "target": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/741be008-f5de-4312-8b09-9d4b93bf14b8" + } + ] + } + ], + "local_identifier": "12594", + "rendering": [ + { + "@id": "https://figgy.princeton.edu/downloads/741be008-f5de-4312-8b09-9d4b93bf14b8/file/51245d62-69f9-4d15-8c6d-6a2367e8dfaa", + "label": "Download the original file", + "format": "audio/x-wav" + } + ], + "width": null, + "height": null, + "duration": 549.24 + }, + { + "type": "Canvas", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/87b9ca2f-3380-4506-ac5c-a4bd8ea4a120", + "label": { + "@none": [ + "III. Lento assai - Allegro vivace" + ] + }, + "items": [ + { + "type": "AnnotationPage", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/87b9ca2f-3380-4506-ac5c-a4bd8ea4a120/annotation_page/7d6b2c96-0586-4cd2-ba84-6b54f3080f4c", + "items": [ + { + "type": "Annotation", + "motivation": "painting", + "body": { + "id": "https://figgy.princeton.edu/downloads/87b9ca2f-3380-4506-ac5c-a4bd8ea4a120/file/7ee3e1d1-9d90-4bff-809f-1ad80a89effa", + "type": "Audio", + "duration": 768.145, + "format": "application/vnd.apple.mpegurl", + "label": { + "@none": [ + "III. Lento assai - Allegro vivace" + ] + } + }, + "target": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/87b9ca2f-3380-4506-ac5c-a4bd8ea4a120" + } + ] + } + ], + "local_identifier": "12595", + "rendering": [ + { + "@id": "https://figgy.princeton.edu/downloads/87b9ca2f-3380-4506-ac5c-a4bd8ea4a120/file/f2e6e756-ab76-4e9b-9306-9f69d0a81d33", + "label": "Download the original file", + "format": "audio/x-wav" + } + ], + "width": null, + "height": null, + "duration": 768.145 + }, + { + "type": "Canvas", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/e0609427-4554-4090-86c7-aefc0ebc0e93", + "label": { + "@none": [ + "Appalachian Spring" + ] + }, + "items": [ + { + "type": "AnnotationPage", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/e0609427-4554-4090-86c7-aefc0ebc0e93/annotation_page/5621ee7b-8468-4da7-8b9b-309793a0c5cb", + "items": [ + { + "type": "Annotation", + "motivation": "painting", + "body": { + "id": "https://figgy.princeton.edu/downloads/e0609427-4554-4090-86c7-aefc0ebc0e93/file/7e6c25c7-4cd0-41ae-b14c-c310f4f8f718", + "type": "Audio", + "duration": 1510.0, + "format": "application/vnd.apple.mpegurl", + "label": { + "@none": [ + "Appalachian Spring" + ] + } + }, + "target": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/e0609427-4554-4090-86c7-aefc0ebc0e93" + } + ] + } + ], + "local_identifier": "1533", + "rendering": [ + { + "@id": "https://figgy.princeton.edu/downloads/e0609427-4554-4090-86c7-aefc0ebc0e93/file/8f0b79fe-d2da-44bb-a6e0-97429ffd48eb", + "label": "Download the original file", + "format": "audio/x-wav" + } + ], + "width": null, + "height": null, + "duration": 1510.0 + }, + { + "type": "Canvas", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/431e0aa7-5d64-402e-9060-9094b4bf4032", + "label": { + "@none": [ + "Hansel und Gretel" + ] + }, + "items": [ + { + "type": "AnnotationPage", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/431e0aa7-5d64-402e-9060-9094b4bf4032/annotation_page/497e7493-66c6-4582-844a-9c0012da24bb", + "items": [ + { + "type": "Annotation", + "motivation": "painting", + "body": { + "id": "https://figgy.princeton.edu/downloads/431e0aa7-5d64-402e-9060-9094b4bf4032/file/bcb23184-fd20-41c4-bf93-2595bc77d16b", + "type": "Audio", + "duration": 507.345, + "format": "application/vnd.apple.mpegurl", + "label": { + "@none": [ + "Hansel und Gretel" + ] + } + }, + "target": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/431e0aa7-5d64-402e-9060-9094b4bf4032" + } + ] + } + ], + "local_identifier": "54498", + "rendering": [ + { + "@id": "https://figgy.princeton.edu/downloads/431e0aa7-5d64-402e-9060-9094b4bf4032/file/ad928aab-6be2-40a0-bc40-b4308a82b2d0", + "label": "Download the original file", + "format": "audio/x-wav" + } + ], + "width": null, + "height": null, + "duration": 507.345 + }, + { + "type": "Canvas", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/4b70c38a-6ce1-474f-8569-73ffb1320037", + "label": { + "@none": [ + "I. Non allegro" + ] + }, + "items": [ + { + "type": "AnnotationPage", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/4b70c38a-6ce1-474f-8569-73ffb1320037/annotation_page/931d337c-c322-4f24-bc45-580347cdb333", + "items": [ + { + "type": "Annotation", + "motivation": "painting", + "body": { + "id": "https://figgy.princeton.edu/downloads/4b70c38a-6ce1-474f-8569-73ffb1320037/file/665db122-b46e-4551-a57c-c9bd8f3d7818", + "type": "Audio", + "duration": 693.825, + "format": "application/vnd.apple.mpegurl", + "label": { + "@none": [ + "I. Non allegro" + ] + } + }, + "target": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/4b70c38a-6ce1-474f-8569-73ffb1320037" + } + ] + } + ], + "local_identifier": "54499", + "rendering": [ + { + "@id": "https://figgy.princeton.edu/downloads/4b70c38a-6ce1-474f-8569-73ffb1320037/file/4128c43f-a294-4b2b-95be-9d87d8dcf3ed", + "label": "Download the original file", + "format": "audio/x-wav" + } + ], + "width": null, + "height": null, + "duration": 693.825 + }, + { + "type": "Canvas", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/181358ff-9708-4c8a-941e-f318f5e424a8", + "label": { + "@none": [ + "II. Andante con moto" + ] + }, + "items": [ + { + "type": "AnnotationPage", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/181358ff-9708-4c8a-941e-f318f5e424a8/annotation_page/161a0e01-e56d-4a30-951a-5993730fcc28", + "items": [ + { + "type": "Annotation", + "motivation": "painting", + "body": { + "id": "https://figgy.princeton.edu/downloads/181358ff-9708-4c8a-941e-f318f5e424a8/file/e84e3a06-b20a-4e07-8623-e36b801b969a", + "type": "Audio", + "duration": 578.462, + "format": "application/vnd.apple.mpegurl", + "label": { + "@none": [ + "II. Andante con moto" + ] + } + }, + "target": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/181358ff-9708-4c8a-941e-f318f5e424a8" + } + ] + } + ], + "local_identifier": "54500", + "rendering": [ + { + "@id": "https://figgy.princeton.edu/downloads/181358ff-9708-4c8a-941e-f318f5e424a8/file/d069a031-8646-499a-aa39-1037ef6bee7b", + "label": "Download the original file", + "format": "audio/x-wav" + } + ], + "width": null, + "height": null, + "duration": 578.462 + }, + { + "type": "Canvas", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/f90ef79c-6abe-4ef4-a182-de5a214f42ea", + "label": { + "@none": [ + "III. Lento assai - Allegro vivace" + ] + }, + "items": [ + { + "type": "AnnotationPage", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/f90ef79c-6abe-4ef4-a182-de5a214f42ea/annotation_page/0c69e205-43d5-41ca-952c-4a105675d7bf", + "items": [ + { + "type": "Annotation", + "motivation": "painting", + "body": { + "id": "https://figgy.princeton.edu/downloads/f90ef79c-6abe-4ef4-a182-de5a214f42ea/file/f58da5ab-d5fb-4729-a5ed-613da985c7f3", + "type": "Audio", + "duration": 827.662, + "format": "application/vnd.apple.mpegurl", + "label": { + "@none": [ + "III. Lento assai - Allegro vivace" + ] + } + }, + "target": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/f90ef79c-6abe-4ef4-a182-de5a214f42ea" + } + ] + } + ], + "local_identifier": "54501", + "rendering": [ + { + "@id": "https://figgy.princeton.edu/downloads/f90ef79c-6abe-4ef4-a182-de5a214f42ea/file/c7a1470b-989c-4c3b-a5bf-cda73c03fd1a", + "label": "Download the original file", + "format": "audio/x-wav" + } + ], + "width": null, + "height": null, + "duration": 827.662 + }, + { + "type": "Canvas", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/b6ee500f-8e2f-417f-9038-3b18c2f867c5", + "label": { + "@none": [ + "Appalacian Spring" + ] + }, + "items": [ + { + "type": "AnnotationPage", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/b6ee500f-8e2f-417f-9038-3b18c2f867c5/annotation_page/15b3f48e-e00d-4362-878c-b342f9c661c7", + "items": [ + { + "type": "Annotation", + "motivation": "painting", + "body": { + "id": "https://figgy.princeton.edu/downloads/b6ee500f-8e2f-417f-9038-3b18c2f867c5/file/218ebd1c-3d9e-4f57-9be1-c9ee41d88543", + "type": "Audio", + "duration": 1600.06, + "format": "application/vnd.apple.mpegurl", + "label": { + "@none": [ + "Appalacian Spring" + ] + } + }, + "target": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/b6ee500f-8e2f-417f-9038-3b18c2f867c5" + } + ] + } + ], + "local_identifier": "54503", + "rendering": [ + { + "@id": "https://figgy.princeton.edu/downloads/b6ee500f-8e2f-417f-9038-3b18c2f867c5/file/8b673e04-35f5-49e8-ad99-456e87842c71", + "label": "Download the original file", + "format": "audio/x-wav" + } + ], + "width": null, + "height": null, + "duration": 1600.06 + } + ], + "behavior": [ + "auto-advance" + ], + "service": [ + { + "@context": "http://universalviewer.io/context.json", + "profile": "http://universalviewer.io/ui-extensions-profile", + "disableUI": [ + "mediaDownload" + ] + } + ], + "structures": [ + { + "type": "Range", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/range/rbc498c32-4115-449d-ac65-cd35adac36a1", + "label": { + "@none": [ + "2001-10-20" + ] + }, + "behavior": "top", + "items": [ + { + "type": "Range", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/range/redb628e0-4cf4-4bc8-9adc-16affacd0946", + "label": { + "@none": [ + "Hansel und Gretel, overture" + ] + }, + "items": [ + { + "type": "Range", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/range/rcd313a84-218b-4ce1-8876-fd76896664d2", + "label": { + "@none": [ + "Overture to Hansel and Gretel" + ] + }, + "items": [ + { + "type": "Canvas", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/74714a3c-1d70-4753-ac44-fa4e929eacbf#t=0,506.011", + "label": [] + } + ] + } + ] + }, + { + "type": "Range", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/range/r857ebd7d-72ae-400d-99ad-2ab5e47ce973", + "label": { + "@none": [ + "Symphonic dances" + ] + }, + "items": [ + { + "type": "Range", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/range/ra602a193-d1bb-429f-a597-b33887266bc4", + "label": { + "@none": [ + "I. Non allegro" + ] + }, + "items": [ + { + "type": "Canvas", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/d9621bab-69cd-4869-8ab2-0755183a9ae1#t=0,675.921", + "label": [] + } + ] + }, + { + "type": "Range", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/range/re63ccd9a-f553-4a3c-9b9a-0155dc0b85c2", + "label": { + "@none": [ + "II. Andante con moto" + ] + }, + "items": [ + { + "type": "Canvas", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/741be008-f5de-4312-8b09-9d4b93bf14b8#t=0,549.24", + "label": [] + } + ] + }, + { + "type": "Range", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/range/rc20bb834-e80d-489c-a583-2af0bba1947b", + "label": { + "@none": [ + "III. Lento assai - Allegro vivace" + ] + }, + "items": [ + { + "type": "Canvas", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/87b9ca2f-3380-4506-ac5c-a4bd8ea4a120#t=0,768.145", + "label": [] + } + ] + } + ] + }, + { + "type": "Range", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/range/r31dd5624-beae-4e36-b765-45a72971f985", + "label": { + "@none": [ + "Appalachain spring" + ] + }, + "items": [ + { + "type": "Range", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/range/r152a0b2d-1822-4d99-b7e1-2fab52bfdabc", + "label": { + "@none": [ + "Appalachian Spring" + ] + }, + "items": [ + { + "type": "Canvas", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/e0609427-4554-4090-86c7-aefc0ebc0e93#t=0,1510.0", + "label": [] + } + ] + } + ] + } + ] + }, + { + "type": "Range", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/range/r3123f617-4586-497d-af5f-bdbce6e32dab", + "label": { + "@none": [ + "2001-10-19" + ] + }, + "behavior": "top", + "items": [ + { + "type": "Range", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/range/r68c095e5-a6f4-4430-92e8-7ef2ef7bfc07", + "label": { + "@none": [ + "Hansel und Gretel: Overture" + ] + }, + "items": [ + { + "type": "Range", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/range/r07dfe531-8b91-4c7f-a58a-a8333cca6feb", + "label": { + "@none": [ + "Hansel und Gretel" + ] + }, + "items": [ + { + "type": "Canvas", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/431e0aa7-5d64-402e-9060-9094b4bf4032#t=0,507.345", + "label": [] + } + ] + } + ] + }, + { + "type": "Range", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/range/re0949782-8e04-4fa7-9f89-d60829194d81", + "label": { + "@none": [ + "Symphonic Dances" + ] + }, + "items": [ + { + "type": "Range", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/range/r56ace64e-1e73-49ca-bb1d-84e9353dacda", + "label": { + "@none": [ + "I. Non allegro" + ] + }, + "items": [ + { + "type": "Canvas", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/4b70c38a-6ce1-474f-8569-73ffb1320037#t=0,693.825", + "label": [] + } + ] + }, + { + "type": "Range", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/range/r96f109e3-cd7c-4d9b-af9d-d96a68063ce7", + "label": { + "@none": [ + "II. Andante con moto" + ] + }, + "items": [ + { + "type": "Canvas", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/181358ff-9708-4c8a-941e-f318f5e424a8#t=0,578.462", + "label": [] + } + ] + }, + { + "type": "Range", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/range/r08a12ce5-6f32-4197-b9f9-6b09643d9b34", + "label": { + "@none": [ + "III. Lento assai - Allegro vivace" + ] + }, + "items": [ + { + "type": "Canvas", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/f90ef79c-6abe-4ef4-a182-de5a214f42ea#t=0,827.662", + "label": [] + } + ] + } + ] + }, + { + "type": "Range", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/range/r5cd49c66-2f0d-4145-93ca-493abff039c0", + "label": { + "@none": [ + "Appalacian Spring" + ] + }, + "items": [ + { + "type": "Range", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/range/r09117ad6-3d34-4e87-9e4b-df2ed1304803", + "label": { + "@none": [ + "Appalacian Spring" + ] + }, + "items": [ + { + "type": "Canvas", + "id": "https://figgy.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest/canvas/b6ee500f-8e2f-417f-9038-3b18c2f867c5#t=0,1600.06", + "label": [] + } + ] + } + ] + } + ] + } + ], + "seeAlso": [ + { + "@id": "https://figgy.princeton.edu/catalog/ea3a706e-dd01-478c-a428-2ef99762e392.jsonld", + "format": "application/ld+json" + }, + { + "@id": "https://bibdata.princeton.edu/bibliographic/3757856", + "format": "text/xml" + } + ], + "license": "http://rightsstatements.org/vocab/NKC/1.0/", + "logo": "https://figgy.princeton.edu/assets/pul_logo_icon-7b5f9384dfa5ca04f4851c6ee9e44e2d6953e55f893472a3e205e1591d3b2ca6.png" +} diff --git a/spec/fixtures/metadata/ea3a706e-dd01-478c-a428-2ef99762e392.json b/spec/fixtures/metadata/ea3a706e-dd01-478c-a428-2ef99762e392.json new file mode 100644 index 00000000..2f7183ad --- /dev/null +++ b/spec/fixtures/metadata/ea3a706e-dd01-478c-a428-2ef99762e392.json @@ -0,0 +1,52 @@ +{ + "@context": "https://bibdata.princeton.edu/context.json", + "@id": "https://figgy-staging.princeton.edu/catalog/ea3a706e-dd01-478c-a428-2ef99762e392", + "title": [ + { + "@value": "Concert, 2001, October 19 and 20", + "@language": "und" + } + ], + "language": "und", + "creator": "Princeton University. Orchestra", + "call_number": [ + "DAT- 2001-10-19", + "DAT- 2001-10-20" + ], + "extent": "1 sound cassette.", + "format": "Audio", + "description": [ + "Digital Audio Tape (DAT).", + "A complete program is available in Mendel Music Library." + ], + "publisher": "2001.", + "title_sort": "[Concert, 2001, October 19 and 20] [sound recording].", + "contents": "Overture to Hansel and Gretel (1893) / E. Humperdinck -- Symphonic dances (1940) / S. Rachmaninoff -- Appalachian spring (1943) / A. Copland.", + "contributor": [ + "Friends of Music at Princeton" + ], + "author": "Princeton University. Orchestra", + "created": "2001-01-01T00:00:00Z", + "date": "2001", + "location": [ + "RCPPK DAT- 2001-10-19", + "RCPPK DAT- 2001-10-20" + ], + "identifier": [ + "ark:/99999/fk4x36481t" + ], + "edm_rights": { + "@id": "http://rightsstatements.org/vocab/NKC/1.0/", + "@type": "dcterms:RightsStatement", + "pref_label": "No Known Copyright" + }, + "memberOf": [ + { + "@id": "https://figgy-staging.princeton.edu/catalog/35a0bf8c-020a-428f-b9dc-c6748498ebc1", + "@type": "pcdm:Collection", + "title": "Performance Ensembles" + } + ], + "system_created_at": "2020-02-06T00:02:47Z", + "system_updated_at": "2020-02-07T18:31:35Z" +} diff --git a/spec/models/iiif_resource_spec.rb b/spec/models/iiif_resource_spec.rb index c892929f..424325c3 100644 --- a/spec/models/iiif_resource_spec.rb +++ b/spec/models/iiif_resource_spec.rb @@ -3,6 +3,24 @@ require 'rails_helper' describe IIIFResource do + context "when indexing a Recording IIIF v3 manifest" do + it "indexes succesfully" do + url = 'https://figgy-staging.princeton.edu/concern/scanned_resources/ea3a706e-dd01-478c-a428-2ef99762e392/manifest' + stub_manifest(url: url, fixture: 'recording_manifest.json') + stub_metadata(id: "ea3a706e-dd01-478c-a428-2ef99762e392") + exhibit = Spotlight::Exhibit.create title: 'Exhibit A' + resource = described_class.new url: url, exhibit: exhibit + resource.save + resource.reindex + + solr = Blacklight.default_index.connection + solr.commit + solr_doc = solr.select(q: "*:*")["response"]["docs"].first + + expect(solr_doc["full_title_tesim"]).to eq ['Concert, 2001, October 19 and 20'] + expect(solr_doc["sort_date_ssi"]).not_to be_blank + end + end context "when ingesting a manifest with full text" do it "indexes the full text into a TESIM field" do url = 'https://figgy.princeton.edu/concern/ephemera_folders/e41da87f-84af-4f50-ab69-781576cf82db/manifest'