Raptor RDF Parser Library - Building and Installing from Source

1. Getting the sources

There are several ways to get the sources. The most stable and tested versions are the sources shipped with each release and these are recommended as the first place to start. If you want to get a newer set, then there are nightly snapshots made of the development sources, which may not yet be committed to Subversion. For the latest developent sources, anonymous Subversion access is available but this may require some configuring of developer tools that are not needed for the snapshot releases.

The source bundle and package files contain all the HTML files and documentation provided on the web site.

1.1 Getting the sources from releases

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

1.2 Getting the sources from Subversion

  svn checkout http://svn.librdf.org/repository/raptor/trunk/ raptor
  cd raptor

At this stage, or after a svn 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, autoconf, libtool and dependencies. 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 is developed and built on x86 Linux and x86 OSX but is also tested on other systems occasionally.

Raptor requires an XML parser - either libxml2 (2.6.8 or newer) 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 and microformats parser.

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

On OSX you may have to explicitly set the LIBTOOLIZE variable for the libtoolize utility since on OSX libtoolize is a different program. The full path to the utility should be given:

  LIBTOOLIZE=/opt/local/bin/glibtoolize ./autogen.sh

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.10.2 (minimum version 1.7), autoconf 2.63 (minimum version 2.54) and libtool 2.2.6 (minimum version 2.2.0). These are only needed when compiling from Subversion sources. autogen.sh enforces the requirements.

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 Subversion.

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-debug

Enable debug messages (default not enabled). Maintainer mode automatically enables this.

--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. grddl requires libxml2 and libxstl 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.6.8 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.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

Legacy option that used to support the libwww library.

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-2010 Dave Beckett
Copyright 2000-2005 University of Bristol