Hello fellow Racketeers,
as a part of my research, my BibTeX bibliography file started quickly growing both in terms of the number of entries and also in terms of the content included in each entry (for example all the abstracts). I wondered whether there is a tool to work with the BibTeX "database" programmatically and ideally if such tool could expose SQL-like query interface. I found none.
Therefore, I quickly hacked one together. And because the best way to solve any problem is to create a language for solving the problem in question, I created such language.
Meet #lang bibtex - Dominik Joe PantΕ―Δek / bibtex-lang Β· GitLab and also consider looking at the preliminary documentation at BibTeX Language.
It works similarly to how Scribble works. At the beginning of your bibliography.bib file the #lang bibtex line needs to be added. The good thing is that both bibtex and biber (for biblatex) ignore this line. That is no coincidence, the specification clearly states that any processing software must ignore any text on lines not contained in the bibliography entries. With this little one-line change we can now (require "bibliography.bib") and the module provides a single binding called bib for now.
The bibtex/query module provides a nice interface for querying the data.
But the best feature - mainly the feature why I put this all together - is when you run the bibliography as a standalone program, like racket bibliography.bib. Let's see what happens:
> (select id author title)
βββββββββββ³βββββββββββββββββββββββββ³ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βId βAuthor βTitle β
β£βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ«
βdh76 βDiffie, W and Hellman, ββNew directions in cryptography,β IEEE Transactions on β
β βME βInformation Theory, vol. IT-22, pp. 644-654 β
β ββββββββββΌβββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββ¨
βelgamal85βElgamal, T. βA public key cryptosystem and a signature scheme based β
β β βon discrete logarithms β
β ββββββββββΌβββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββ¨
βrsa78 βRivest, R. L. and βA method for obtaining digital signatures and β
β βShamir, A. and Adleman, βpublic-key cryptosystems β
β βL. β β
βββββββββββ·βββββββββββββββββββββββββ·ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
> (select id author title #:where (> year 1980))
βββββββββββ³ββββββββββ³βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βId βAuthor βTitle β
β£βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ«
βelgamal85βElgamal, βA public key cryptosystem and a signature scheme based on discrete β
β βT. βlogarithms β
βββββββββββ·ββββββββββ·βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
> (select id author title #:where (and (like author "diffie") (< year 1980)))
ββββββ³ββββββββββββββββββ³ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βId βAuthor βTitle β
β£βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ«
βdh76βDiffie, W and ββNew directions in cryptography,β IEEE Transactions on Information β
β βHellman, ME βTheory, vol. IT-22, pp. 644-654 β
ββββββ·ββββββββββββββββββ·ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
The select syntax provides a small DSL just for querying the currently loaded bibliography. And the whole racket/base is available as well - that means you can interactively search your bibliography, store the results as bindings (using define) and work with them later. The REPL uses Expeditor: Terminal Expression Editor and you get almost all the bells and whistles as when you run the normal Racket REPL.
There are some open design questions and the package needs some polishing before I publish it on the package server. I would like to know what other racketeers think and what their preferred design decisions might be.
- What should the name of the package be? It started as
bib-lang, now I usebibtex-langas WIP name. - How should the collection be named? Again, it started as
bib-lang, but now it turned intobibtex- which allows#lang bibtexto be used. That sounds "natural" however I am concerned whether in the future something more relevant/powerful for BibTeX might show up and the name would already be taken. - As @spdegabrielle pointed out on Discord, perhaps the
#langinterface might be a barrier for other BibTeX users (mostly from academia). What do you think aboutraco bibtex bibliography.bibinterface?
And of course, any other thoughts or feature requests are more than welcome ![]()