[ apologies for cross-posting ]
Dan Chudnov recently pointed me in the direction of the LC Name Authority
File Web Service that OCLC has made available as part of their ResearchWorks
efforts [1]. They are doing some very cool stuff these days.
I wanted to see how easy it would be to query the service for authority
records for "Tolkien". Here's what I came up with:
    #!/usr/bin/perl
    use strict;
    use warnings;
    use SOAP::Lite;
    use XML::Simple;
    ## submit request
    my $result = SOAP::Lite
        ->proxy( 'http://alcme.oclc.org/eprintsUK/services/NACOMatch' )
        ->getNameAuthority(
            name( 'name' => 'Tolkien' ),
            name( 'maxList' => 100 )
        )
        ->result();
    ## parse xml response
    my $names = XMLin( $result );
    ## output each result
    foreach my $match ( @{ $names->{ match } } ) {
        print $match->{ establishedForm }, "\n";
    }
Which I was pleased with, so I wrote a little command line utility [2] that
does the same thing, with documentation if you want to try it out yourself.
//Ed
[1] http://www.oclc.org/research/researchworks/
[2] http://www.inkdroid.org/code/tools/naf
--
Ed Summers
aim: inkdroid
web: http://www.inkdroid.org
Life is short, art long, opportunity fleeting, experience treacherous, judgement difficult. [Hippocrates]
 |