Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
== Outdated egg! This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for [[/eggref/5/isbn|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 [[https://wiki.call-cc.org/chicken-projects/egg-index-5.html|egg index]]. Otherwise, please consider porting this egg to the current version of CHICKEN. [[tags: egg]] [[toc:]] == 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. '' [[https://isbndb.com/docs/api/30-keys.html|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. <enscript highlight=scheme> (require-extension isbn) (require-extension isbndb) (require-extension openlibrary) </enscript> === Requirements [[intarweb]] [[http-client]] [[ssax]] [[sxml-transforms]] [[sxpath]] sxpath-lolevel [[uri-common]] === Documentation ==== isbn module ===== normalize-isbn <procedure>(normalize-isbn STRING)</procedure> Reduces the ISBN string to the allowed "compressed" format without spaces or dashes as separators. ===== valid-isbn? <procedure>(valid-isbn? STRING)</procedure> Checks ISBN-10 and ISBN-13 numbers by normalizing them and running the checksums agains the numbers. ===== isbn10->isbn13 <procedure>(isbn10->isbn13 STRING)</procedure> 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)</procedure> 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 <enscript highlight="scheme"> #;1> (normalize-isbn "978-3854523871") "9783854523871" #;2> (valid-isbn? "978-3854523871") #t </enscript> ==== isbndb ===== Parameters: The API key & DB base URL <parameter>(api-key STRING)</parameter> The isbndb web api requires you to register on the site to aquire a database key. Registration is instant and can be done [[https://isbndb.com/account/create.html|here]]. <parameter>(database-url STRING)</parameter> URL of the base API URL, in case this should ever change. Default: http://isbndb.com. ===== isbn->alist <procedure>(isbn->alist STRING)</procedure> 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 <enscript highlight ="scheme"> #;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."))) </enscript> ==== openlibrary ===== Parameters: Database URL <parameter>(database-url STRING)</parameter> URL of the base API for openlibrary.org. Default: http://openlibrary.org/ ===== available-keys Descripes the available keys this module supports. <enscript highlight="scheme"> (define-constant user-keys '(title authors publisher publishing-date number-of-pages cover-urls isbn-numbers)) ;exported is this (define available-keys user-keys) </enscript> ===== isbn->alist <procedure>(isbn->alist STRING #!optional (interesting-entries))</procedure> 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 <enscript highlight="scheme"> #;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")) </enscript> === Author [[/users/christian kellermann|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 [[/users/alaric-blagrave-snellpym|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 [[/users/alaric-blagrave-snellpym|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
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you subtract 22 from 21?