I run a python script that does title lookups using the Open Library API. I
think I'm using the deprecated verison of the API for the title look up
but it works so I use it.
The initial lookup returns a list of identifiers. My code then steps
through those to retrieve the Open Library citations that match the
identifiers.

Here is an example of a citation that has been enhanced with links to
related editions available in scanned form on the Internet Archive

http://www.library.nps.gov/cgi-bin/Pwebrecon.cgi?DB=local&BOOL1=all+of+these&FLD1=Keyword+Anywhere+(GKEY)&CNT=25+records+per+page&SAB1=NPSPARKINDE3842


I've included a bit more technical detail below. I've been exploring the
Open Office database software as an alternative to MS Access but have not
yet figured out
ODBC connectivity to it.

Basically the script shells out from an MS Access application that I've
made for my own use for review of new citations that get added to the
National Park Service online catalog.

 I have an MS Access table with normalized titles of  books being added, an
example would be:
PICTORIAL HISTORY OF THE AMERICAN REVOLUTION WITH A SKETCH OF THE EARLY
HISTORY OF THE COUNTRY

If the title in question is for a pre 1922 publication I click a button on
an MS Access form which uses a current numeric identifier as a parameter
to the python script, which then retrieves the title from the MS Access
table via a lookup that uses the python pyodbc library.

cnxn = pyodbc.connect('DRIVER={Microsoft Access Driver (*.mdb)}
;DBQ=c:\\ProciteLoads\INDE2.mdb;SERVER=localhost;DATABASE=testdb;UID=me;PWD=pass')
cursor = cnxn.cursor()
cursor.execute("select SeqNum, title from MatchesAid where seqnum=" +
sys.argv[1])

My code then shortens the title to whatever precedes any embedded
punctuation and replaces spaces with "+"

It then queries the Open Library with
data = urllib.urlopen('http://openlibrary.org/api/search?q={"query":";' + s
+ '"}&has_fulltext=1').read()

where s would be something like
"PICTORIAL+HISTORY+OF+THE+AMERICAN+REVOLUTION+WITH+A+SKETCH+OF+THE+EARLY+HISTORY+OF+THE+COUNTRY"

The initial result is a list of identifiers. My python code then does a
follow up using these values to retrieve actual citations with links.

data2 = urllib.urlopen('http://openlibrary.org/api/books?bibkeys='+ s +
'&jscmd=data&format=json').read()
where in this case the variable s would look like "OLID:OL6918977M"

I can then easily dereference the json format results with code that looks
like this:

if 'ebooks' in cite[s]:
    cite=eval(data2)
    sTitle=cite[s]['title']

and so on to get:

The pictorial history of the American revolution
New York
R. Sears
1856
http://www.archive.org/details/pictorialhistory01sear
http://openlibrary.org/books/OL6561307M/The_pictorial_history_of_the_American_revolution

The above values then get recorded in another MS Access table as fields
that I call TITLE, PLACE, PUBLISHER, PUBDATE, IAURL, OLURL
I then evaluate the somewhat fuzzy results of the title search and
construct and embed links in our NPS citations.

The Open Library indexing system  does a nice job providing fairly good
results which seem to have the right amount of "fuzziness" so I don't get
many false
matches and I do get related editions and some related works.


Richard Aroksaar
NPS Voyager System Administrator
206-220-4252
206-612-2006 (cell)


                                                                           
             George Oates                                                  
             <[email protected]>                                             
             Sent by:                                                   To 
             ol-tech-bounces@a         Open Library -- technical           
             rchive.org                discussion <[email protected]>    
                                                                        cc 
                                                                           
             03/07/2011 11:21                                      Subject 
             AM                        [ol-tech] Use of Open Library API?  
                                       Collecting examples...              
                                                                           
             Please respond to                                             
              Open Library --                                              
                 technical                                                 
                discussion                                                 
             <ol-tech@archive.                                             
                   org>                                                    
                                                                           
                                                                           




Hi all,

I'm writing to request some information from you... we don't specifically
track
external use of the Open Library API or data, but we're interested to know
who
is using us and how.

If you have used the API or covers or are showing OL data on your site,
would
you be so kind as to reply to the list (or to me separately if you prefer)
with
links and/or any interesting background information you think is relevant?

Thank you!
george
_______________________________________________
Ol-tech mailing list
[email protected]
http://mail.archive.org/cgi-bin/mailman/listinfo/ol-tech
To unsubscribe from this mailing list, send email to
[email protected]


_______________________________________________
Ol-tech mailing list
[email protected]
http://mail.archive.org/cgi-bin/mailman/listinfo/ol-tech
To unsubscribe from this mailing list, send email to 
[email protected]

Reply via email to