chickadee » scbib

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.

scbib

A bibliography management system.

Documentation

The scbib library manages bibliographic data described as S-expressions and is capable of generating BiBTeX entries from a bibliographic database.

scbib maintains four databases: persons, journals, publishers and bibliographic entries:

(scbib-db-person)
( (KEY-SYMBOL (name STRING)) ... )
(scbib-db-publisher)
( (KEY-SYMBOL (name STRING) (web STRING) (address STRING)) ... )
(scbib-db-journal)
( (KEY-SYMBOL (name STRING) (web STRING) ) ... )
(scbib-db-bib)
(bibtype SYMBOL)(title STRING)(booktitle STRING)(author STRING-OR-KEY)(editor STRING-OR-KEY)(series STRING)(publisher STRING-OR-KEY)(journal STRING-OR-KEY)(volume STRING)(pages STRING)(abbrev STRING)

The person, journal and publisher databases can provide abbreviations to be used in the bibliographic database. Each KEY-SYMBOL defined in the first three databases can be used in the respective fields in the bibliographic database. The entries in the bibliographic database can of type: article, book, web, web, techreport or inproceedings.

Each database is defined as a parameter, i.e. procedures of zero or one arguments. To retrieve the value of a database call the corresponding parameter-procedure with zero arguments. To change the contents of a parameter, call the parameter-procedure with the new value as argument:

	   ;; appends a new item to the bibliographic database
	   (scbib-db-person (cons item (scbib-db-person))) 

Procedures

scbib-find:procedure

Locates an item in a database. This procedure applies the given query procedure to each element in the database and returns the first result where the query procedure returns a true value. QUERY must be a procedure of one argument. DB must be one of the database parameters defined by the library.

scbib-values:procedure

Returns the values associated with a certain field in the given bibliographic item. This procedure takes a bibliographic item and a field name and returns a list of values associated with the given field.

scbib-value:procedure

Returns a single value associated with a certain field in the given bibliographic item. This procedure takes a bibliographic item and a field name and returns the value associated with the given field.

scbib-load-db:procedure

Loads bibliographic entries from a file. This procedure takes a file name, reads all entries from the given file and puts them in the appropriate database(s). The file must contain entries in s-expression format of the format (TYPE ITEM), where TYPE is one of PERSON, JOURNAL, PUBLISHER, BIB, and ITEM is in the format appropriate for this type of item (see the beginning of this document).

scbib-load-db:procedure

Loads bibliographic entries from a file. This procedure takes an input file port, reads all entries from the given file and puts them in the appropriate database(s). The file must contain entries in s-expression format of the format (TYPE ITEM), where TYPE is one of PERSON, JOURNAL, PUBLISHER, BIB, and ITEM is in the format appropriate for this type of item (see the beginning of this document).

scbib-load-db-all:procedure

Loads bibliographic entries from all files in the load path. This procedure locates and reads all files with suffix .db in the scbib load path, loads all entries from those files and puts them in the appropriate database(s). The files must contain entries in s-expression format of the format (TYPE ITEM), where TYPE is one of PERSON, JOURNAL, PUBLISHER, BIB, and ITEM is in the format appropriate for this type of item (see the beginning of this document).

scbib-load-path:procedure

Parameter procedure that contains the current bibliographic database load path.

scbib-get-authors:procedure

Returns the list of authors for the given bibliographic item.

scbib-get-abbrev:procedure

Returns the abbreviation string for the given item. If KEY-STYLE is not given, the abbreviation format is the family name of the first author, followed by a colon, followed by the publication year. If KEY-STYLE is given, it is expected to be a procedure of two arguments, author and year.

scbib-add-to-db!:procedure

Adds the given entry to the appropriate database. The entry must be an s-expression of the form (TYPE CONTENTS), where TYPE is one of PERSON, JOURNAL, PUBLISHER, BIB, and CONTENTS is in the format appropriate for this type of item (see the beginning of this document).

Examples

(use scbib scbib-bibtex)

(define bibliography
  `((bib 
     (title   "Executable cell biology")
     (author  "Fisher, J" "Henzinger, T")
     (journal "Nature Biotechnology" )
     (number  "25") 
     (pages   "1239-1249")
     (year    "2007")
     (bibtype "article")
     (web     "http://www.nature.com/nbt/journal/v25/n11/abs/nbt1356.html"))

    (bib
     (title   "A computer architecture for highly parallel signal processing")
     (author  "Dennis, J" "Misunas, D")
     (journal "Proc. of the ACM Annual Conference")
     (pages   "402-409")
     (year    "1974")
     (bibtype "article")
     (web     "http://csg.csail.mit.edu/pubs/memos/Memo-108/Memo-108.pdf"))

    
    (bib
     (title    "The semantics of a simple language for parallel programming")
     (author   "Kahn, G")
     (journal  "Information Processing")
     (pages    "471-475")
     (year     "1974")
     (bibtype  "article")
     (web      "http://www1.cs.columbia.edu/~sedwards/papers/kahn1974semantics.pdf"))
  
    ))

(define (make-bib-db lst)
  (for-each (lambda (item) (scbib-add-to-db! item)) lst))

(define (generate-BiBTeX Content)
  (let ((key-style (lambda (author year) (format #f "~a:~a" author (substring year 2 4)))))
    (make-bib-db Content)
    (for-each (lambda (x) (scbib-bibtex-print-item x key-style)) (scbib-db-bib))))

(generate-BiBTeX bibliography)

About this egg

Author

Ivan Raikov

Version history

1.5
Added support for eid and doi fields in the bibtex module
1.4
Added regex as a dependency
1.3
Change allowing fields of bibliographic entries to be lists or strings
1.1
Documentation converted to wiki format
1.0
Initial release

License

Copyright (C) 2004 Satoru Takabayashi <satoru@namazu.org>.

Ported to Chicken Scheme and modified by Ivan Raikov. Portions
Copyright 2009-2010 Ivan Raikov.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

A full copy of the GPL license can be found at
<http://www.gnu.org/licenses/>.

Contents »