Getting started

Obtaining the source

  • Download the latest release from Sourceforge

    or

  • Install git and clone the repository:
    • git clone git://git.code.sf.net/p/owl-cpp/code owlcpp or
    • git clone http://git.code.sf.net/p/owl-cpp/code owlcpp

Building

Note:for most current building instructions please see owlcpp/doc/build.txt.

The build process is managed by Boost.Build.

Libraries required by owlcpp are listed in owlcpp/doc/user-config.jam.

  1. Download current distribution of the Boost library. Expand the archive to a directory on your hard drive, e.g., to C:\Program Files\\boost\\boost_XX_XX_0. In this document, this directory will be referred as $(BOOST).

  2. In your terminal, change directory to $(BOOST)/tools/build/v2/. Run script bootstrap ( .bat or .sh ). This will produce Boost.Build executable, e.g., $(BOOST)/tools/build/v2/b2.exe.

  3. (optional) Add directory of Boost.Build executable to your PATH variable, e.g., $(BOOST)/tools/build/v2.

  4. If not already present, copy file owlcpp/doc/boost-build.jam to any directory above owlcpp. Edit the file to specify full path to Boost.Build. For details see owlcpp/doc/boost-build.jam file.

  5. If not already present, copy file owlcpp/doc/user-config.jam to your HOME directory. Edit the file to specify compilers and libraries used by owlcpp. For details see owlcpp/doc/user-config.jam file.

  6. Run Boost.Build in owlcpp directory

    b2 [<variants> <targets> <options>]

Boost.Build options

Variant Description
debug disable optimization, enable assertions and debug symbols
release enable optimization, disable assertions and debug symbols
profile enable optimization, profiling, and debug symbols
Target Description
by default, build static and shared versions of all owlcpp library modules and sample applications
rdf build rdf module
io build io module (requires Raptor and libxml)
logic build logic module (requires FaCT++)
test run owlcpp unit tests
bindings-py build owlcpp Python bindings
test-py run unit tests on Python bindings
distro-bindings-py build owlcpp Python bindings distribution module
autodoc generate owlcpp Doxygen documentation (requires Doxygen installed and configured in user-config.jam)
Option Description
-j n run build in n parallel processes
-d2 verbose output: print build commands
-q stop at first error
define="'m[= v ]'" define macro m as v

Examples:

b2 release
b2 debug test -j4
b2 release bindings-py

Building of owlcpp and the unit tests should complete without errors (warnings from external libraries are possible).

Something went wrong if the following lines appear at the end of the output:

...failed updating N targets...

...skipped M targets...

Please start troubleshooting by checking your user-config.jam file.

Use owlcpp in your C++ project

Create directory my_proj with the following two files:

main.cpp file:

#include <iostream>
#include "owlcpp/rdf/triple_store.hpp"
#include "owlcpp/io/input.hpp"

int main(int argc, char* argv[]) {
   if( argc < 2 ) {
      std::cerr << "input file expected" << std::endl;
      return 1;
   }
   owlcpp::Triple_store store;
   try{
      load_file(argv[1], store);
   } catch(...) {
      std::cerr << "error loading \"" << argv[1] << "\"" << std::endl;
      return 1;
   }
   std::cout
   << store.map_triple().size() << " triples" << '\n'
   << store.map_node().size() << " nodes" << '\n'
   << store.map_ns().size() << " namespace IRIs" << '\n'
   ;
   return 0;
}

jamroot.jam file:

use-project /owlcpp : $(OWLCPP[1]) ;

exe rdf-count
   : #sources
      main.cpp
   : #requirements
      <library>/owlcpp//rdf
      <library>/owlcpp//io
;

Build the rdf-count executable by running Boost.Build in my_proj directory:

b2 release

Use owlcpp in your Python project

to be continued..

© 2015 Mikhail K. Levin | contact