Installing SuRF

SuRF can be most easily installed with setuptools (setuptools installation), by running this from command-line:

$ easy_install surf

alternativelly, SuRF can be downloaded and the following command executed:

$ sudo python setup.py install

if you choose the second option, than the dependencies must be installed beforehand. SuRF depends on rdflib and simplejson.

Installing rdflib

SuRF depends on rdflib version 2.4.x or 3.x.x. On Windows platforms the rdflib package requires python to be configured with a c/c++ compiler in order to build native extensions. Here are the steps to required set up rdflib on Windows:

  1. Download and install MinGW from http://www.mingw.org/

  2. Make sure gcc is installed

  3. Add the [MinGW]\bin folder to system Path

  4. Edit (create if it does not exist) the following file [Python 2.X dir]\lib\distutils\distutils.cfg:

    [build]
    compiler = mingw32
    
  5. Run this from command-line (or simply install surf - it will install rdflib for you automatically):

    $ easy_install rdflib>=2.4.2
    

Further information can be found here:

Installing SuRF plugins

SuRF can access and manipulate RDF data in several different ways. Each data access method is available in a separate plugin. You can install all or just some of the plugins. Currently available plugins are:

  • The sparql_protocol Plugin. Use this plugin to access data from SPARQL HTTP endpoints. Install it by running this from command-line:

    $ easy_install -U surf.sparql_protocol
    
  • The rdflib Plugin. This plugin uses rdflib for data access and manipulation. Install it by running this from command-line:

    $ easy_install -U surf.rdflib
    
  • The allegro_franz Plugin. Use this plugin to access Franz AllegroGraph triple store. Install it by running this from command-line:

    $ easy_install -U surf.allegro_franz
    
  • The sesame2 Plugin. Use this plugin to access data using Sesame2 HTTP protocol. Install it by running this from command-line:

    $ easy_install -U surf.sesame2
    

Loading plugins from path or running SuRF in embedded mode

In the cases where SuRF is distributed bundled with an application, one can choose to load the plugins from a specific location. You can do so via the surf.plugin.manager.add_plugin_path() method, as in the code snippet below:

Note

In order to run the following code snippet, one needs to generate the egg-info directory if not present, this can be done with the following command:

$ python setup.py egg_info
from surf.plugin import manager

#setup a local folder where the plugins are stored
manager.add_plugin_path('/path/to/plugins')
# reload plugins if, allready loaded
manager.load_plugins(reload=True)

# the rest of the application logic
...

Setting up SuRF in development mode

To get the latest development version of SuRF, check it out from subversion and install it using the setup.py script. Plugins live in the same subversion tree but each has it’s separate setup.py script, so they need to be installed separately.

Instructions for getting the code from subversion can be found here:

Here is a brief and useful list of commands for building eggs, installing in development mode and generating documentation:

Command Task
python setup.py bdist_egg Build the SuRF egg file
python setup.py bdist_egg register upload Build and register with pypi SuRF if you have access rights
python setup.py develop Install SuRF in development mode
make.bat html regenerate the documentation