Chapter 4. Setting up to use the Sesame libraries

Table of Contents

4.1. Downloading the libraries
4.2. Logging: SLF4J initialization

In this chapter, we explain some basics about setting up your application development environment to work with Sesame. In Chapter 8, The Repository API we go into details of the use of the APIs. If you do not want to program against the Sesame libraries but just want to install and run the Sesame HTTP server, please skip ahead to Chapter 6, Server software installation.

4.1. Downloading the libraries

As was explained in Chapter 2, Source code and binaries, various download options are available to you. The quickest way to get started with using the Sesame libraries is to download the Sesame onejar library and include it in your classpath.

However, it is important to note that the Sesame Framework consists of a set of libraries: Sesame is not a monolithic piece of software, you can pick and choose which parts you want and which ones you don't. In those cases where you don't care about picking and choosing and just want to get on with it, the onejar is a good choice. If, however, you want a little more control over what is included, you can download the complete SDK and select (from the lib directory) those sesame libraries that you require.

An alternative to picking libraries by hand is to use maven. Apache Maven is a software management tool that helps you by offering things like library version management and dependency management (which is very useful because it means that once you decide you need a particular Sesame library, maven automatically downloads all the libraries that your library of choice requires in turn), and giving you a handy-dandy build environment. For details on how to start using maven, we advise you to take a look at the Apache Maven website at http://maven.apache.org/. If you are familiar with Maven, here are a few pointers to help set up your maven project.

The groupId for all Sesame core artifacts is org.openrdf.sesame. For many projects you will need only a part of the Sesame framework. For example, if you require functionality for quick in-memory storage and querying of RDF, you will only need to include dependencies on the SAIL repository module (artifactId sesame-repository-sail) and the in-memory storage backend module (artifactId sesame-sail-memory).

To include a maven dependency in your project that automatically gets you the entire Sesame core framework, use artifactId sesame-runtime.

4.2. Logging: SLF4J initialization

Before you begin using the Sesame libraries, one important configuration step needs to be taken: the initialization and configuration of a logging framework.

Sesame uses the Simple Logging Facade for Java (SLF4J), which is a framework for abstracting from the actual logging implementation. SLF4J allows you, as a user of the Sesame framework, to plug in your own favorite logging implementation at deployment time. SLF4J supports the most popular logging implementations such as Java Logging, Apache Commons Logging, Logback, log4j, etc. See the SLF4J website for more info.

What you need to do is to determine/decide which logging implementation you (are going to) use and include the appropriate SLF4J-bridge jar-file in your classpath. For example, if you decide to use Apache log4j, you need to include the SLF4J-to-log4j bridge in your classpath. The SLF4J release packages include bridges to various logging implementations; just download the SLF4J release package and include the appropriate bridge in your classpath (or, when using Maven, set the appropriate dependency); slf4j-logj12-1.6.1.jar, for example. That's all!