Open jillpe opened 3 months ago
The TOC here could make for a good checklist of expected functionality: https://github.com/CottageLabs/willow_sword/wiki/Usage#contents
We can use Hyku up to start development on this, while pals knapsack is still underway.
For ref, this is the gem we would essentially be updating https://github.com/CottageLabs/willow_sword CalState currently uses SWORD
TODO: Test - how do we handle different tenants?
master
branchCan we add this list to the acceptance criteria for clarity of expected functionality? https://github.com/CottageLabs/willow_sword/wiki/Usage#contents
Tested functionalities on staging, here are the results
Files used:
files_for_testing_willow_sword.zip
curl --request GET \
--url https://demo.palni-palci-staging.notch8.cloud/sword/service_document \
--header 'Api-key: some-api-key' \
--header 'Content-Type: application/xml'
response:
<service xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:sword="http://purl.org/net/sword/terms/" xmlns="http://www.w3.org/2007/app">
<sword:version>2.0</sword:version>
<workspace collections="1">
<atom:title>Hyrax Sword V2 server</atom:title>
<collection href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default">
<atom:title>Default collection</atom:title>
<accept>*/*</accept>
<accept alternate="multipart-related">
*/* </accept>
<sword:collectionPolicy>TODO: Collection Policy</sword:collectionPolicy>
<dcterms:abstract></dcterms:abstract>
<sword:mediation>true</sword:mediation>
<sword:treatment>TODO: Treatment description</sword:treatment>
<sword:acceptPackaging>http://purl.org/net/sword/package/SimpleZip</sword:acceptPackaging>
<sword:acceptPackaging>http://purl.org/net/sword/package/BagIt</sword:acceptPackaging>
<sword:acceptPackaging>http://purl.org/net/sword/package/Binary</sword:acceptPackaging>
</collection>
</workspace>
</service>
curl --request GET \
--url https://demo.palni-palci-staging.notch8.cloud/sword/collections/36b01b98-de55-4cf1-9328-f53c4ca05dd0 \
--header 'Api-key: some-api-key' \
--header 'Content-Type: application/xml'
response:
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Kirk's Collection</title>
<link rel="edit" href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/36b01b98-de55-4cf1-9328-f53c4ca05dd0/works"/>
</feed>
curl --request POST \
--url https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works \
--header 'Api-key: some-api-key' \
--header 'Content-Disposition: attachment; filename=metadata.xml' \
--header 'Content-Type: application/xml' \
--header 'In-Progress: false' \
--header 'On-Behalf-Of: support@notch8.com' \
--header 'Packaging: application/atom+xml;type=entry' \
--data-binary @dc.xml
response:
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Test record</title>
<content rel="src" href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/"/>
<link rel="edit" href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works//file_sets"/>
</feed>
curl --request POST \
--url https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works \
--header 'Api-key: some-api-key' \
--header 'In-Progress: false' \
--header 'On-Behalf-Of: support@notch8.com' \
-F metadata=@dc.xml
response:
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Test record</title>
<content rel="src" href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/"/>
<link rel="edit" href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works//file_sets"/>
</feed>
curl --request POST \
--url https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/ \
--header 'Api-key: some-api-key' \
--header 'Content-Disposition: attachment; filename=testPackage.zip' \
--header 'Content-Type: application/zip' \
--header 'In-Progress: false' \
--header 'On-Behalf-Of: support@notch8.com' \
--header 'Packaging: http://purl.org/net/sword/package/BagIt' \
--data-binary @testPackage.zip
response:
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Test record</title>
<content rel="src" href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/"/>
<link rel="edit" href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works//file_sets"/>
</feed>
curl --request POST \
--url https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/ \
--header 'Api-key: some-api-key' \
--header 'In-Progress: false' \
--header 'On-Behalf-Of: support@notch8.com' \
-F metadata=@testPackage2b/metadata/metadata.xml \
-F payload=@testPackage2b.zip
response:
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Test record</title>
<content rel="src" href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/"/>
<link rel="edit" href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works//file_sets"/>
</feed>
curl --request POST \
--url https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/ \
--header 'Api-key: some-api-key' \
--header 'In-Progress: false' \
--header 'On-Behalf-Of: support@notch8.com' \
-F payload=@testPackage2b.zip
response:
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Test record</title>
<content rel="src" href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/"/>
<link rel="edit" href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works//file_sets"/>
</feed>
curl --request POST \
--url https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/ \
--header 'Api-key: some-api-key' \
--header 'Content-Disposition: attachment; filename=testPackage1InBagit.zip' \
--header 'Content-MD5: 72722575f682e2b459604db51def039f' \
--header 'Content-Type: application/zip' \
--header 'Packaging: http://purl.org/net/sword/package/BagIt' \
--data-binary @testPackageInBagit.zip
response:
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Test record</title>
<content rel="src" href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/"/>
<link rel="edit" href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works//file_sets"/>
</feed>
curl --request POST \
--url https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/ \
--header 'Api-key: some-api-key' \
--header 'Content-MD5: 72722575f682e2b459604db51def039f' \
--header 'Packaging: http://purl.org/net/sword/package/BagIt' \
-F payload=@testPackage2InBagit.zip
response:
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Test record</title>
<content rel="src" href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/"/>
<link rel="edit" href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works//file_sets"/>
</feed>
curl --request GET \
--url https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/36425f03-462b-447c-b23c-0b37ab40cc04 \
--header 'Api-key: some-api-key'
response:
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>test</title>
<content rel="src" href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/36425f03-462b-447c-b23c-0b37ab40cc04"/>
<link rel="edit" href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/36425f03-462b-447c-b23c-0b37ab40cc04/file_sets"/>
<dc:title>test</dc:title>
<dc:depositor>support@notch8.com</dc:depositor>
<dc:admin_set_id>5ff17259-9147-43dd-a0b1-ee7aebd0a2fc</dc:admin_set_id>
<dc:member_of_collection_ids>a974a5ee-bc6c-4ea9-87f0-1f92fbd0614f</dc:member_of_collection_ids>
<dc:member_of_collection_ids>f2766aed-8999-47f1-a610-64617e1b3290</dc:member_of_collection_ids>
<dc:creator>0~test</dc:creator>
<dc:keyword>test</dc:keyword>
<dc:rights>http://rightsstatements.org/vocab/NKC/1.0/</dc:rights>
<dc:type>Article</dc:type>
<dc:admin_note></dc:admin_note>
<dc:show_pdf_viewer></dc:show_pdf_viewer>
<dc:show_pdf_download_button></dc:show_pdf_download_button>
<dc:video_embed></dc:video_embed>
</feed>
curl --request GET \
--url https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/09d32f64-8a1c-424b-9320-ff46f63faf0c \
--header 'Api-key: some-api-key'
response:
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Test record</title>
<content rel="src" href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/09d32f64-8a1c-424b-9320-ff46f63faf0c"/>
<link rel="edit" href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/09d32f64-8a1c-424b-9320-ff46f63faf0c/file_sets"/>
<entry>
<content rel="src" href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/09d32f64-8a1c-424b-9320-ff46f63faf0c/file_sets/1d63cd3f-81ef-47c9-8a7e-228c0c200f66"/>
<link rel="edit" href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/09d32f64-8a1c-424b-9320-ff46f63faf0c/file_sets/1d63cd3f-81ef-47c9-8a7e-228c0c200f66"/>
</entry>
<entry>
<content rel="src" href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/09d32f64-8a1c-424b-9320-ff46f63faf0c/file_sets/3b8354f2-0338-4e55-82a8-02148ed586bb"/>
<link rel="edit" href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/09d32f64-8a1c-424b-9320-ff46f63faf0c/file_sets/3b8354f2-0338-4e55-82a8-02148ed586bb"/>
</entry>
<entry>
<content rel="src" href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/09d32f64-8a1c-424b-9320-ff46f63faf0c/file_sets/8962a3ae-e93a-4b78-bec8-5d1433d10c0d"/>
<link rel="edit" href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/09d32f64-8a1c-424b-9320-ff46f63faf0c/file_sets/8962a3ae-e93a-4b78-bec8-5d1433d10c0d"/>
</entry>
<dc:title>Test record</dc:title>
<dc:depositor>support@notch8.com</dc:depositor>
<dc:admin_set_id>5ff17259-9147-43dd-a0b1-ee7aebd0a2fc</dc:admin_set_id>
<dc:member_ids>1d63cd3f-81ef-47c9-8a7e-228c0c200f66</dc:member_ids>
<dc:member_ids>3b8354f2-0338-4e55-82a8-02148ed586bb</dc:member_ids>
<dc:member_ids>8962a3ae-e93a-4b78-bec8-5d1433d10c0d</dc:member_ids>
<dc:representative_id>1d63cd3f-81ef-47c9-8a7e-228c0c200f66</dc:representative_id>
<dc:thumbnail_id>1d63cd3f-81ef-47c9-8a7e-228c0c200f66</dc:thumbnail_id>
<dc:creator>0~User, Some</dc:creator>
<dc:keyword>Test</dc:keyword>
<dc:keyword>Another</dc:keyword>
<dc:rights>http://rightsstatements.org/vocab/InC/1.0/</dc:rights>
<dc:type>Article</dc:type>
<dc:contributor>The dublin core generator</dc:contributor>
<dc:created>05/29/2024</dc:created>
<dc:description>This is a test to create a test record for Hyku Commons</dc:description>
<dc:language>English</dc:language>
<dc:publisher>Digital Nest</dc:publisher>
<dc:source>http://sword.digitalnest.com</dc:source>
<dc:subject>Sword</dc:subject>
<dc:subject>Crosswalk</dc:subject>
<dc:show_pdf_viewer>1</dc:show_pdf_viewer>
<dc:show_pdf_download_button>1</dc:show_pdf_download_button>
</feed>
curl --request GET \
--url https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/invalid_id \
--header 'Api-key: some-api-key'
response:
<sword:error xmlns:sword="http://purl.org/net/sword/" xmlns:arxiv="http://arxiv.org/schemas/atom" xmlns="http://www.w3.org/2005/Atom" href="http://purl.org/net/sword/error/ErrorBadRequest">
<author>
<name>Sword v2 server</name>
</author>
<title>ERROR</title>
<updated>2024-05-31T16:28:20Z</updated>
<generator uri="https://example.org/sword-app/" version="0.1">
sword@example.org </generator>
<summary>Server cannot find work with id invalid_id</summary>
<sword:treatment>processing failed</sword:treatment>
</sword:error>
curl --request GET \
--url https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/09d32f64-8a1c-424b-9320-ff46f63faf0c/file_sets/395282cb-830e-42d3-ad6d-cf8b7bde326b \
--header 'Api-key: some-api-key'
response:
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Swordv2Spec.pdf</title>
<content rel="src" href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/09d32f64-8a1c-424b-9320-ff46f63faf0c/file_sets/395282cb-830e-42d3-ad6d-cf8b7bde326b"/>
<link rel="edit" href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/09d32f64-8a1c-424b-9320-ff46f63faf0c/file_sets/395282cb-830e-42d3-ad6d-cf8b7bde326b"/>
<dc:title>Swordv2Spec.pdf</dc:title>
<dc:creator>support@notch8.com</dc:creator>
</feed>
curl --request POST \
--url https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/09d32f64-8a1c-424b-9320-ff46f63faf0c/file_sets/ \
--header 'Api-key: some-api-key' \
--header 'Content-Disposition: attachment; filename=cat_scan.pdf' \
--header 'Content-MD5: b89d04a5afefdfe3ee11a9de8b230320' \
--header 'Content-Type: application/pdf' \
--header 'In-Progress: false' \
--header 'On-Behalf-Of: support@notch8.com' \
--header 'Packaging: http://purl.org/net/sword/package/Binary' \
--data-binary @cat_scan.pdf
response:
<feed xmlns="http://www.w3.org/2005/Atom">
<title></title>
<content rel="src" href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/09d32f64-8a1c-424b-9320-ff46f63faf0c/file_sets/30d666fd-5a74-416a-8172-f4c9612bcad1"/>
<link rel="edit" href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/09d32f64-8a1c-424b-9320-ff46f63faf0c/file_sets/30d666fd-5a74-416a-8172-f4c9612bcad1"/>
</feed>
curl --request PUT \
--url https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/09d32f64-8a1c-424b-9320-ff46f63faf0c/file_sets/395282cb-830e-42d3-ad6d-cf8b7bde326b \
--header 'Api-key: some-api-key' \
--header 'Content-Disposition: attachment; filename=metadata.xml' \
--header 'Content-Type: application/xml' \
--header 'Packaging: application/atom+xml;type=entry' \
--data-binary @file_dc.xml
No reponse
curl --request PUT \
--url https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/09d32f64-8a1c-424b-9320-ff46f63faf0c/ \
--header 'Api-key: some-api-key' \
--header 'Content-Disposition: attachment; filename=metadata.xml' \
--header 'Content-Type: application/xml' \
--header 'Packaging: application/atom+xml;type=entry' \
--data-binary @updated_work_dc.xml
response:
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Update Success</title>
<updated>2024-05-31T16:40:30+00:00</updated>
<atom:title>Hyrax Sword V2 server</atom:title>
<link rel="self" href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works/09d32f64-8a1c-424b-9320-ff46f63faf0c"/>
<entry>
<id>09d32f64-8a1c-424b-9320-ff46f63faf0c</id>
<title>Updated Test record</title>
<content type="text">
<text>The work has been successfully updated.</text>
</content>
<updated>2024-05-31T16:33:55Z</updated>
</entry>
</feed>
@Jill Is sharing the gem's wiki enough?
https://github.com/scientist-softserv/amigos/issues/29 https://github.com/CottageLabs/willow_sword/wiki/Usage#authorizing-sword-requests
one difference is that Hyku is not limited to dc terms.
Summary
SOW
SoftServ will integrate SWORD v2, a protocol which enables clients and servers to communicate around complex digital objects, into the Hyku application. Although there is precedent for SWORD integration into Hyrax, it was developed and documented for Hyrax 2. Since the current version of Hyku runs on a later version of Hyrax, custom work will be required. This is especially so considering the Valkyrie migration from Fedora.
SoftServ’s approach to this will be to update the existing or create a new SWORD gem that would be both applicable to Hyku Commons as well as broadly usable for Hyrax and Hyku applications.
SoftServ allocates one 1-week sprint (apprx. 90 hours) including one midlevel and one senior engineer, project management, and QA resources to accomplish these goals.
Acceptance Criteria
Ref
1012
1013
1014
1037
Testing Instructions
These are a summary of the instructions found in the wiki: https://github.com/CottageLabs/willow_sword/wiki/Usage Adjust URL to match your set up.
Test files: swordv2_test_files.zip
Unzip the test files into a directory. Open a terminal from that directory and run the following commands:
1. Get service document
2. Get collection
3. Add New work: metadata only
i. Add new work: Metadata only (binary)
3. Add New work: metadata only
ii. Add new work: Metadata only (form-data)
4. Add new work: Zip file with metadata and file
i. Add new work: Zip file with metadata and file (binary)
4. Add new work: Zip file with metadata and file
ii. Add new work: metadata and zip payload (form-data)
4. Add new work: Zip file with metadata and file
iii. Add new work: zip payload with file and metadata (form-data)
5. Add new work: Metadata and file in bagit zip file
i. Add new work: Metadata and file in bagit zip file (binary)
5. Add new work: Metadata and file in bagit zip file
ii. Add new work: payload containing metadata and file in bagit zip (form-data)
6. Get work with only metadata
7. Get work with file and metadata
8. Get work that doesn't exist
9. Get file metadata
10. Add file to existing work (binary)
11. Update file metadata (binary)
12. Authorizing sword requests (Currently not implemented)
13. Update work