Print

Print


Kyle,

Following along the Ruby thread, I've got some rake task that will ingest images.  Let me know if you want to take a look at that.

...adam


-----Original Message-----
From: Code for Libraries on behalf of Bess Sadler
Sent: Wed 7/28/2010 8:20 PM
To: [log in to unmask]
Subject: Re: [CODE4LIB] Batch loading in fedora
 
Hi, Kyle.

Are you okay with using ruby? I've been using active fedora lately and I love it. Here is some pseudo-code. If you want something that I've actually syntax checked let me know. I sort of wrote this off the top of my head, so you might need to check method names and such:

require 'active-fedora'

fedora_url = "http://fedoraAdmin:[log in to unmask]:8080/fedora"
Fedora::Repository.register(fedora_url)

# At the start of the process, get a new pid
pid = Nokogiri::XML(open(fedora_url << "/management/getNextPID?xml=true&namespace=yournamespace", {:http_basic_authentication=>["fedoraAdmin", "fedoraAdmin"]})).xpath("//pid").text

obj = ActiveFedora::Base.new(:pid => pid)

dc_file = File.expand_path('/path/to/your/dublin_core_file')
image_file = File.expand_path('/path/to/your/image')

dc_datastream = ActiveFedora::Datastream.new(:pid=>pid, :dsid=>"DC", :dsLabel=>"Dublin Core", :blob=>IO.read(dc_file))
image_datastream = ActiveFedora::Datastream.new(:pid=>pid, :dsid=>"Image", :dsLabel=>"Image", :blob=>IO.read(image_file))

obj.add_datastream(dc_datastream)
obj.add_datastream(image_datastream)

obj.save



-- Bess

On Jul 28, 2010, at 8:36 PM, Kyle Banerjee wrote:

> Howdy all,
> 
> I've never used fedora before, and I've found myself in the position of
> needing to load thousands of objects with metadata into a test instance
> which I don't maintain (and won't have to maintain later). Timeline is tight
> so I need to figure this out fast.
> 
> The data are very simple -- DC records which correspond with a bunch of
> image files that I have
> 
> In the short time I've had to familiarize myself with fedora today, it
> appears that I need to use the batch utility. I've found some documentation,
> most notably at
> http://www.fedora-commons.org/download/1.0/userdocs/client/admin-gui/batch/<http://www.fedora-commons.org/download/1.0/userdocs/client/admin-gui/batch/index.html#d0e220>
> but
> I'm wondering where else I need to look.
> 
> If someone could point me to documentation (or better yet, an example) that
> a n00b could use fairly quickly prep what I have so that it will be ready to
> go in, it would be highly appreciated. I'm concerned that if I try to plow
> through documentation until I get it, I'll run out of time.
> 
> Thanks,
> 
> kyle
> 
> -- 
> ----------------------------------------------------------
> Kyle Banerjee
> Digital Services Program Manager
> Orbis Cascade Alliance
> [log in to unmask] / 503.999.9787


 
Rock & Roll: (noun) African American slang dating back to the early 20th Century. In the early 1950s, the term came to be used to describe a new form of music, steeped in the blues, rhythm & blues, country and gospel. Today, it refers to a wide variety of popular music -- frequently music with an edge and attitude, music with a good beat and --- often --- loud guitars.© 2005 Rock and Roll Hall of Fame and Museum.
 
This communication is a confidential and proprietary business communication. It is intended solely for the use of the designated recipient(s). If this communication is received in error, please contact the sender and delete this communication.