# Raptor RDF Parser Toolkit - Building and Installing from Source

## 1. Getting the sources

## 1.1 Getting the sources from releases

The sources are available from http://librdf.org/dist/source/ (master site) and also from the SourceForge site.

## 1.2 Getting the sources from CVS

      # sh, bash, ...
      CVSROOT=:pserver:anonymous@cvs.librdf.org:/cvsroot
      export CVSROOT
      # csh, tcsh, ...
      setenv CVSROOT :pserver:anonymous@cvs.librdf.org:/cvsroot

      cvs login
    Logging in to :pserver:anonymous@cvs.librdf.org:2401/cvsroot
    CVS password:
      [return]

      cvs checkout redland/raptor

      cd redland/raptor

At this stage, or after a `cvs update` you will need to create the automake and autoconf derived files, as described below in Create the configure program by using the `autogen.sh` script.

Building Raptor in this way requires some particular development tools not needed when building from snapshot releases - automake and autoconf. The `autogen.sh` script looks for the newest versions of the auto* tools and checks that they meet the minimum versions.

## 2. Configuring and building

Raptor uses the GNU automake and autoconf to handle system dependency checking. It requires an XML parser - either libxml2 (2.4.0 or newer, 2.6.0 or later highly recommended) or expat. It will optionally use libcurl, libxml2 for retrieving URIs. It will optionally use libxslt (requiring libxml2 also) to provide the XSLT functionality for the GRDDL parser.

Raptor is developed and built on x86 GNU/Linux (Redhat Fedora Core 3, Debian unstable) but is also regularly tested on sparc Sun Solaris 2.x, x86 FreeBSD 4.10, ppc Apple OSX 10.3 and as part of Redland on several other systems via the SourceForge compile farm (typically AMD64, Alpha, Solaris x86, OpenBSD, NetBSD).

### 2.1. Create `configure` program

If there is no `configure` program, you can create it using the `autogen.sh` script, as long as you have the automake and autoconf tools. This is done by:

      ./autogen.sh

and you can also pass along arguments intended for configure (see below for what these are):

      ./autogen.sh --prefix=/usr/local/somewhere

Alternatively you can run them by hand with:

      aclocal; autoheader; automake --add-missing; autoconf

The automake and autoconf tools have many different versions and at present development is being done with automake 1.8.3 (minimum version 1.7), autoconf 2.59 (minimum version 2.54) and libtool 1.5.4 (minimum version 1.4). These are only needed when compiling from CVS sources. autogen.sh enforces the requirements. In future development will move to require automake 1.8, autoconf 2.58 and libtool 1.5.

Raptor also requires flex version 2.5.31 or newer (2.5.4 will not work) and GNU Bison to build lexers and parsers. These are only required when building from CVS.

### 2.2 Options for `configure`

Raptor also supports the following extra configure options:

`--disable-nfc-check`

  Disable Unicode Normal Form C (NFC) checking code. The code primarily consists of large tables plus some checking code which can be removed from the library with this option. All NFC checks will succeed when this is disabled.

`--with-expat-source=DIR`

  Build against a statically compiled expat source tree in directory DIR. This handles the older and newer style expat source directory structures.

`--enable-parsers=PARSERS`

  Pick the RDF parsers to build from the list:
  `rdfxml ntriples turtle rss-tag-soup`
  The default when this option is omitted is to enable all parsers. `rss-tag-soup` requires version 2.5.10 of libxml2 or newer so may not always be available. If all parsers are not enabled, parts of the test suite will likely fail.

  The parsers that a built library supports can be found from the API level using functions such as `raptor_parsers_enumerate` and `raptor_syntaxes_enumerate` or from the `rapper` utility in the help message.

`--enable-serializers=SERIALIZERS`

  Pick the RDF serializers to build from the list:
  `rdfxml ntriples rdfxml-abbrev`
  The default when this option is omitted is to enable all serializers. If all serializers are not enabled, parts of the test suite will likely fail.

  The serializers that a built library supports can be found from the API level using functions such as `raptor_serializers_enumerate` or from the `rapper` utility in the help message.

`--with-memory-signing`

  Enable signing of memory allocations so that when memory is allocated with malloc() and released free(), a check is made that the memory was allocated in the same library.

`--with-xml-parser=NAME`

  Pick an XML parser to use - either `libxml` (default) minimum version 2.4.0 (2.6.0 or newer prefered) or `expat`. If this option is not given, either will be used, with libxml preferred if both are present. These can either be installed system libraries or source trees in subdirectories of these sources named libxml, expat.

  Raptor has been tested with various combinations of these libraries including expat 1.95.1 (on RedHat 7.2), expat 1.95.2-2 (on RedHat 7.3), expat 1.95.2-6 (on Debian 3.0), expat 1.95.7 (on Redhat Fedora Core 2), expat 1.95.8 (on Debian unstable), libxml 2.4.10 (on RedHat 7.2), libxml 2.4.13 (on OSX 10.1.5), libxml 2.4.17 (on FreeBSD 4.5-RELEASE-p2), libxml 2.4.19 (on RedHat 7.2), libxml 2.4.23 (on Debian 3.0), libxml 2.4.24 (on FreeBSD 4.7-STABLE), libxml 2.4.25, 2.4.28, 2.4.30 (Debian unstable), libxml 2.5.3-2.5.4 (Redhat 9, Debian unstable, x86 Solaris 2.9), libxml 2.5.7 (Redhat 9, Debian unstable), libxml 2.5.8-2.5.9 (Debian unstable), libxml 2.6.0-2.6.10 (Debian unstable), libxml 2.6.8 (Redhat Fedora Core 2), libxml 2.6.9 (FreeBSD 4.10-STABLE)

  libxml1 is not supported.

  The libxml2 on Apple OSX 10.3.X is quite broken - the headers do not match the libraries. Install your own to get something coherent.

`--with-www=NAME`

  Pick a WWW library to use - either `curl`, `xml` (for libxml), `libwww` for W3C libwww or `none` to disable it.

`--with-xml2-config=NAME`

  Set the path to the libxml xml2-config program

`--with-xslt-config=NAME`

  Set the path to the libxslt xslt-config program

`--with-curl-config=NAME`

  Set the path to the libcurl curl-config program

`--with-libwww-config=NAME`

  Set the path to the W3C WWW library libwww-config program

### 2.3 Configuring

If everything is in the default place, do:

       ./configure

The most common configuration you will be doing something like this:

       ./configure --with-xml-parser=expat

### 2.4 Compiling

Compile the parser and the test program `rapper` with;

       make

Note: GNU make is probably required which may be called gmake or gnumake if your system has a different make available too.

### 2.5 Testing

Raptor has a built-in test suite that can be invoked with:

      make check

which should emit lots of exciting test messages to the screen but conclude with something like:
`All` n `tests passed`
if everything works correctly. There will be some Unicode NFC checking tests that give ignored failures in 1.3.2 or later as NFC checking has been temporarily removed.

Raptor builds a utility RDF parsing program rapper can be tried with RDF/XML content like this:

      rapper dc.rdf

Raptor can also extract RDF content inside general XML when the `-s` (`--scan`) option is user. For example if some RDF/XML is embedded inside some SVG, it could be extracted with:

      rapper -s /path/to/test/pic.svg

You can also run it on N-Triples files like this:

      rapper -i ntriples test.nt

The default output is a simple statement dump format, but it can be changed to emit N-Triples by using the `-o` option, like this:

      rapper -o ntriples dc.rdf

## 3. Using the library

Once the library has been configured and built, there are some C example programs that can be built apart from the rapper utility. They are in the `examples` sub-directory and can be built with:

       cd examples

       # Raptor GUI - only if you have the GTK libraries
       make grapper

       # If you have all requirements
       make examples

The public Raptor API is described in the libraptor.3 UNIX manual/web page

Copyright 2000-2005 Dave Beckett, Institute for Learning and Research Technology, University of Bristol