2. Portable Common Lisp Code Book Examples
Even though many examples in this book use AllegroGraph I also provide many
portable Common Lisp examples and utilities that I have written for my own work
and research:
1. KnowledgeBooks.com Lisp Natural Language Processing (NLP) library
2. Client library for using the Open Calais web service23
3. Example code for using the Freebase web service4
4. Example code for using DBpedia web services5
5. Example code for using GeoBase.org web services6
3. Using the Common Lisp ASDF Package
Manager
There are several package managers available for Common Lisp and I have chosen
to use ASDF for the examples in this book that are not self contained in a single
source directory. ASDF uses a search path list as a source of directories to find
package definition files (that end with the extension .asd). For instance, since some
of the examples in this book will need to make web service calls I have an example
directory aserve client to show you how to use Franz’s open source aserve client
library. The example code needs to use the Yason JSON parsing and generation
library in utils/yson:
(push "../utils/yason/" asdf:*central-registry*)
(asdf:operate ’asdf:load-op ’yason)
The first statement pushes the Yson package directory on the ASDF search path list
and the second line loads the package named yson.
2Requires the open source Portable AllegroServe and split-sequence libraries.
3The example program that puts entities found in text into an RDF data store requires the AllegroGraph library.
4Requires the Franz Portable AllegroServe client library. This is open source, but you will need to manually install Portable AllegroServe if you are using an alternative Common Lisp implementation
(e.g., SBCL or Clozure Common Lisp).
5Requires the AllegroGraph SPARQL client APIs but this code could be rewritten.
6Requires several open source libraries that are included in the ZIP file for this book’s examples: cl-json, s-xml, split-sequence, usocket, trivial-gray-streams, flexi-streams, chunga, cl-base64, puri, drakma, and cl-geonames.
xii
4. Information on the Companion Edition to this Book that Covers Java and JVM Languages
When you browse through the directories containing the examples in this book you
will notice that I use the convention of placing short snippets of test code that I often
include in the book text in files named test.lisp and put longer examples in files named
example.lisp.
This book is organized in layers:
1. Quick introduction to the AllegroGraph and Franz Lisp.
2. Theory (with some AllegroGraph-specific short examples).
3. Detailed treatment of AllegroGraph APIs.
4. Development of Useful Common Lisp libraries information processing, and
importing linked data sources like Freebase and Open Calais data to an Alle-
groGraph RDF store.
5. Development of a complete web portal using Semantic Web technologies.
4. Information on the Companion Edition to this
Book that Covers Java and JVM Languages
This book has a companion edition that covers the use of both AllegroGraph and the
open source Sesame project using JVM based languages like Java, Clojure, JRuby,
and Scala. If you primarily work with JVM languages then you will likely be better
off working through the other edition of this book. The JVM edition of this book
offers some portability: I provide the basic functionality of AllegroGraph for RDF
storage, SPARL queries, Geo Location, and free text search using the Sesame RDF
data store and my own search and Geo Location libraries.
The Free Java Edition of AllegroGraph does not have the commercial use restrictions
that the Free Lisp Edition does.
If you want a free commercial friendly Lisp development and deployment environ-
ment: I recommend that you use the companion book with the Clojure programming
language.
5. AllegroGraph
AllegroGraph is written in Common Lisp and comes bundled in several different
products:
xiii