What's the best way to store Dublin Core metadata?
February 18, 2004 6:29 AM
What's the best way to store Dublin Core metadata?
I'm looking for something that will let me store a slew of Dublin Core records (the actual resources will be stored elsewhere and referenced by DC.Identifier). Mapping DC to a relational database seems to require all sorts of ridiculous contortions to handle repeatable elements, etc. It may still be the best way to do it, but I'd like to think there's something more elegant out there.
Encoding the DC in RDF/XML (according to the standard for XML encoding of qualified Dublin Core) and putting it into a native XML database seems like ridiculous overkill, given the unwieldiness of the DC-in-RDF standard. What I'm really looking for is some kind of dirt-simple object database, or even something that will let me store Perl lists/hashes persistently. Whatever I find needs to be accessible from Perl and, ideally, open-source or cheap.
I have googled this to death and inquired on the DC mailing list without a really satisfactory response.
I'm looking for something that will let me store a slew of Dublin Core records (the actual resources will be stored elsewhere and referenced by DC.Identifier). Mapping DC to a relational database seems to require all sorts of ridiculous contortions to handle repeatable elements, etc. It may still be the best way to do it, but I'd like to think there's something more elegant out there.
Encoding the DC in RDF/XML (according to the standard for XML encoding of qualified Dublin Core) and putting it into a native XML database seems like ridiculous overkill, given the unwieldiness of the DC-in-RDF standard. What I'm really looking for is some kind of dirt-simple object database, or even something that will let me store Perl lists/hashes persistently. Whatever I find needs to be accessible from Perl and, ideally, open-source or cheap.
I have googled this to death and inquired on the DC mailing list without a really satisfactory response.
Storable.pm is all you need. Just freeze() the DC records and put them in a hash indexed by their DC.Identifiers, then store() the hash in a file on disk. Or, if you don't want to read the whole DB back into memory at once, store() them each in seperate files named after checksums of the DC.Identifiers.
posted by nicwolff at 8:59 AM on February 18, 2004
posted by nicwolff at 8:59 AM on February 18, 2004
# Oh, hell, it's easier to code than to explain:
use Storable;
use Digest::MD5 'md5_hex';
map store( get_DC_record($_), md5_hex( $_ ) ), @DC_Identifiers;
# then, to get a record back:
my $record = retrieve( md5_hex( $DC_Identifier ) );
posted by nicwolff at 9:11 AM on February 18, 2004
use Storable;
use Digest::MD5 'md5_hex';
map store( get_DC_record($_), md5_hex( $_ ) ), @DC_Identifiers;
# then, to get a record back:
my $record = retrieve( md5_hex( $DC_Identifier ) );
posted by nicwolff at 9:11 AM on February 18, 2004
squish looks interesting, but worryingly old, and i guess you'd have found it yourself via google.
posted by andrew cooke at 10:39 AM on February 18, 2004
posted by andrew cooke at 10:39 AM on February 18, 2004
Thanks everyone. I was familiar with Berkeley DB as an RDBMS and the XML database available for it but didn't realize it could store native data structures; I will look into that. Storable.pm led me to IPC::Shareable (which uses Storable) which looks like it will be exactly what I need to keep a chunk of DC records in memory with a simple client-server setup. AskMefi rocks as usual.
posted by IshmaelGraves at 12:01 PM on February 18, 2004
posted by IshmaelGraves at 12:01 PM on February 18, 2004
This thread is closed to new comments.
It could really be worth the trouble to shove the thing into a database if you want DMBS features, but just to persist the data, probably not.
posted by majick at 6:49 AM on February 18, 2004