Print

Print


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