Outdated egg!

This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for the CHICKEN 5 version of this egg, if it exists.

If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.

  1. Outdated egg!
  2. isbn
    1. Introduction
    2. Usage
    3. Requirements
    4. Documentation
      1. isbn module
        1. normalize-isbn
        2. valid-isbn?
        3. isbn10->isbn13
        4. isbn-type
        5. Example
      2. isbndb
        1. Parameters: The API key & DB base URL
        2. isbn->alist
        3. isbndb Example
      3. openlibrary
        1. Parameters: Database URL
        2. available-keys
        3. isbn->alist
        4. Openlibrary Example
    5. Author
    6. License
    7. Version History

isbn

Introduction

isbn provides utilities for handling international standard book numbers. The isbn egg consists of two modules: isbn for validating isbns and isbndb for querying the database at http://isbndb.com. For this you need to provide an api key which is free of charge:

In line with the long term vision of the ISBNdb.com project the access to the data from individuals should be free of charge. In reality, this is extended to even broader range of application -- as long as the application does not send an excessive amount of requests and meets our pretty liberal terms and conditions -- most uses are OK, individual, research or commercial. source

Starting with version 0.3 of this egg, the open and free api of http://openlibrary.org is also supported. Advantages over isbndb are: No need for an API key, more detailed results plus links to cover images.

Usage

All modules can be loaded optionally. Note that the openlibrary needs normalized ISBNs to work with.

(require-extension isbn)
(require-extension isbndb)
(require-extension openlibrary)

Requirements

intarweb http-client ssax sxml-transforms sxpath sxpath-lolevel uri-common

Documentation

isbn module

normalize-isbn
[procedure] (normalize-isbn STRING)

Reduces the ISBN string to the allowed "compressed" format without spaces or dashes as separators.

valid-isbn?
[procedure] (valid-isbn? STRING)

Checks ISBN-10 and ISBN-13 numbers by normalizing them and running the checksums agains the numbers.

isbn10->isbn13
[procedure] (isbn10->isbn13 STRING)

Converts a ISBN-10 number to the EAN compatible ISBN-13 format. Returns a dash separated string or #f on error. This function has been added with version 0.2 of this egg.

isbn-type
[procedure] (isbn-type STRING)

Returns 10 for ISBN-10 and 13 for ISBN-13 numbers or #f if no valid number has been given. This function has been added with version 0.2 of this egg.

Example
#;1> (normalize-isbn "978-3854523871")
"9783854523871"
#;2> (valid-isbn? "978-3854523871")
#t

isbndb

Parameters: The API key & DB base URL
[parameter] (api-key STRING)

The isbndb web api requires you to register on the site to aquire a database key. Registration is instant and can be done here.

[parameter] (database-url STRING)

URL of the base API URL, in case this should ever change. Default: http://isbndb.com.

isbn->alist
[procedure] (isbn->alist STRING)

Queries the isdndb for an entry belonging to the ISBN string. No ISBN validation is done at this stage. Returns an alist containing title, authors, subtitle, publisher. Returns an empty list if no entry could be found.

isbndb Example
#;1> (isbn->alist "978-0262011532")
(((title . "Structure and interpretation of computer programs")
  (authors
    ("Harold Abelson and Gerald Jay Sussman, with Julie Sussman; foreword by Alan J. Perlis"))
  (publisher "Cambridge, Mass. : MIT Press ; c1996.")))

openlibrary

Parameters: Database URL
[parameter] (database-url STRING)

URL of the base API for openlibrary.org. Default: http://openlibrary.org/

available-keys

Descripes the available keys this module supports.

(define-constant user-keys
    '(title 
      authors
      publisher
      publishing-date
      number-of-pages
      cover-urls
      isbn-numbers))

;exported is this
(define available-keys user-keys)
isbn->alist
[procedure] (isbn->alist STRING #!optional (interesting-entries))

Queries openlibrary.org for an ISBN. It seems that you need to give it a normalized ISBN to make it work. interesting-entries is an optional parameter that can be a subset of the user-keys list. Defaults to user-keys: title, authors, publisher, publishing-date, number-of-pages, cover-urls, isbn-numbers

Openlibrary Example
#;1> (use openlibrary)

#;2> (pp (isbn->alist "0937073806"))
 ((title . "Literate programming")
 (authors ("Donald Knuth"))
 (publisher ("Center for the Study of Language and Information"))
 (publishing-date . "1992")
 (number-of-pages . 368)
 (cover-urls
   ("small" . "http://covers.openlibrary.org/b/id/715228-S.jpg")
   ("large" . "http://covers.openlibrary.org/b/id/715228-L.jpg")
   ("medium" . "http://covers.openlibrary.org/b/id/715228-M.jpg"))
 (isbn-numbers (("0937073806" "0937073814"))))

#;3> (pp (isbn->alist "0937073806" '(title authors publishing-date)))
((title . "Literate programming")
 (authors ("Donald Knuth"))
 (publishing-date . "1992"))

Author

Christian Kellermann

License

Copyright (c) 2010, Christian Kellermann
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.
3. The name of the authors may not be used to endorse or promote products
   derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 

Version History

0.1
initial release
0.2
isbn 10 -> 13 conversion added thanks to Alaric Snell-Pym
0.3
support for openlibrary.org API added
0.4
Bugfix release for isbn normalisation and conversion. Thanks to Jeronimo Pellegrini and Alaric Snell-Pym for suggestions and bug reports.
0.5
Changes lost in time (oops)
0.6
Small .meta file change to appease salmonella
0.7
Fix test cases for openlibary's image name changes