I do this in jruby using the dspace-jruby gem I developed
see on GitHub https://github.com/akinom/dspace-jruby
<https://github.com/akinom/dspace-jruby>
#find items with given metadata value
items = DSpace.findByMetadataValue('pu.workflow.state', 'reviewed',
DConstants::ITEM)
# print their ids and handles
items.each do |i|
puts [i.getID, i.getHandle].join "\t”
end
#find bitstreams with metadata dc.type = other
bits = DSpace.findByMetadataValue('dc.type', 'other', DConstants::BITSTREAM)
# then go look at file name with an extension that you are interested in
bits.each do |b|
ext = b.getName.split('.')[-1]
if (["pdf", "txt", "jpeg"].include?(ext)) then
puts [ext, b.getID, b.getName, b.getParentObject.getID,
b.getParentObject.getHandle].join "\t"
end
end
# bitstreams for items with dc.contributor = ‘University of Stuff’
items = DSpace.findByMetadataValue('dc.contributor', 'University of Stuff',
DConstants::ITEM)
items.each do |i|
bits = i.getBundles('ORIGINAL')[0].getBitstreams
# similar to the above example
end
Let me know if you need help with using this
Monika
________________
Monika Mevenkamp
[email protected]
http://mo-meven.tumblr.com/
http://mcmprogramming.com/mo.meven/
> On Apr 5, 2017, at 10:35 AM, Brendow Adriel <[email protected]> wrote:
>
> For example:
>
> How to select all bitstream from database
>
> where dc.contributor = ''University";
>
>
> Select all files with final (.pdf, txt, jpg, mp3)
>
> where dc.type= 'other'.
>
> or
>
> Select all files with final (.pdf, txt, jpeg, mp3)
>
> where dc.contributor = 'University of Technology'.
>
>
>
>
> --
> 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]
> <mailto:[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/dspace-tech
> <https://groups.google.com/group/dspace-tech>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
--
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.