Pick an easy problem, OK?  :)

I can get you started and get you to the file name and sequence number, but 
the policy (isAllowed=y) is trickier because policies are hierarchical and 
inheritable.  I haven't worked much with policies in the database.

This will get you started, to get the other data given a handle:

select item2bundle.item_id, bundle_id, bitstream_id, text_value as 
filename, sequence_id
from bitstream --here we go up the hierarchy
join bundle2bitstream
using (bitstream_id)
join item2bundle
using (bundle_id)
join handle
on (handle.resource_id = item2bundle.item_id)
join metadatavalue
on (bitstream.bitstream_id = metadatavalue.resource_id) --file name is 
dc.title for the bitstream
where handle = '10568/70234' -- your handle example
and metadata_field_id = 64 -- dc.title
and bitstream_format_id = 11;

The text_value is the file name.  This will require some refinement, since 
there may be other jpeg bitstreams (bitstream_format_id = 11).  You could 
check that the file name ends in .pdf.jpg instead of using the 
bitstream_format_id.

You can look up the policies by using the resource_id in the resourcepolicy 
table, but deciphering that isn't straightforward.  It depends if you ever 
make thumbnails private.  We don't in our instance.

Cheers,
Chris

On Thursday, March 30, 2017 at 10:35:57 AM UTC-4, Tsegaselassie Tadesse 
wrote:
>
> I am trying to build a very light-weight API endpoint that lists items 
> from the database. I want to provide a url link to the item's thumbnail but 
> it seems DSpace works very differently from what I expected.
>
> I have read the Storage Layer 
> <https://wiki.duraspace.org/display/DSDOC5x/Storage+Layer> documentation 
> the Bitstream Store section to be specific on how to use the internal id to 
> get to the directory of the bitstream; however, I am looking for is just to 
> get the exact thumbnail for the item; e.g. on the detail page of an item, 
> https://cgspace.cgiar.org/handle/10568/70234, you will see the thumbnail 
> has a normal image source, https://cgspace.cgiar.org/
> bitstream/handle/10568/70234/beca_africanRice_poster_feb2016.pdf.jpg?sequence=4&isAllowed=y
> .
>
> How do I generate that?
>

-- 
You received this message because you are subscribed to the Google Groups 
"DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.

Reply via email to