Last active
March 30, 2017 08:22
-
-
Save seanmcn/6360d4090c63ea1d5c5b to your computer and use it in GitHub Desktop.
[Dspace] Get assetstore file path of bitstream using database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Replace :asset_store_path, :handle and :sequence_id | |
*/ | |
select | |
':asset_store_path' || | |
substring(bit.internal_id, 1, 2) || '/' || | |
substring(bit.internal_id, 3, 2) || '/' || | |
substring(bit.internal_id, 5, 2) || '/' || | |
bit.internal_id | |
from bitstream bit | |
inner join bundle2bitstream b2b on b2b.bitstream_id=bit.bitstream_id | |
inner join bundle b on b.bundle_id=b2b.bundle_id and b.name='ORIGINAL' | |
inner join item2bundle i2b on i2b.bundle_id=b.bundle_id | |
inner join handle h on i2b.item_id=h.resource_id | |
where h.handle=':handle' and bit.sequence_id =:sequence_id; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@seanmcn could you enlighten me on how this works? I'm trying to create an API endpoint based on the DSpace database that get the item with its metadata and bitstream (PDF or JPG) files.