A Relaxed Schema Graph Database Management System
JavaScript Python HTML CSS Shell
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.


https://travis-ci.org/CulturePlex/Sylva.png?branch=develop https://coveralls.io/repos/CulturePlex/Sylva/badge.png?branch=develop Code Health


Sylva is a Relaxed-Schema Graph Database Management System.


Just in case, first thing you need is to have installed pip and virtualenv in your machine:

$ sudo apt-get install python-pip python-dev build-essential python-profiler libpq-dev
$ sudo pip install --upgrade pip
$ sudo pip install --upgrade virtualenv

Then, it's a good option to use virtualenvwrapper:

$ sudo pip install virtualenvwrapper

In the instructions given on virtualenvwrapper, you should to set the working directory for your virtual environments. So, you could add it in the end of your .bashrc file (newer versions of virtualenvwrapper don't require this):

$ mkdir -p ~/.venvs
export WORKON_HOME=~/.venvs
source /usr/local/bin/virtualenvwrapper.sh

And finally, create a virtualenv for the project:

$ mkvirtualenv sylva --no-site-packages

After you setup your virtual environment, you should be able to enable and disable it. The system propmt must change where you have it enable:

$ workon sylva
$ deactivate

Now, if you didn't get the project yet, clone it in your desired location:

$ cd $HOME
$ git clone git@github.com:CulturePlex/sylva.git git/sylva

Enter in the new location and update the virtual environment previously created:

$ cd git/sylva/
$ workon sylva
$ pip install -U -r requirements.txt

Relational Database

Now you have installed the Django project and almost ready to run it. Before that, you must create a database. In developing stage, we use SQLite:

$ cd $HOME
$ cd sylva/sylva
$ python manage.py syncdb --noinput
$ python manage.py migrate
$ python manage.py createsuperuser

And that is. If you run the project using the standalone development server of Django, you could be able to access to the URL http://localhost:8000/:

$ python manage.py runserver localhost:8000
$ xdg-open http://localhost:8000/

Graph Database

The last piece to make Sylva works is the Neo4j graph database. You can download the most current version (only branch 1.9.x is supported, 1.9.9 as today). After downloading, we need to unzip and setup some parameters:

$ cd git/sylva
$ wget dist.neo4j.org/neo4j-community-1.9.9-unix.tar.gz
$ tar -zxvf neo4j-community-1.9.9-unix.tar.gz
$ mv neo4j-community-1.9.9-unix neo4j

Now, as indicated in settings.py in section GRAPHDATABASES, you need to edit the file neo4j/conf/neo4j-server.properties and set the next properies (the default configuration is reserved for testing client libraries):


And then you are ready to run the Neo4j server:

$ ./neo4j/bin/neo4j console


The analytics feature is only available for Neo4j backend, and only supportyed in 64-bits machines due to a limitiation in GraphLab. To enable them, set the next variable to True in your local settings.py:


Analytics are run as Celery tasks, so you need a broker and a backend. Of popular choice is to install Redis as the results backend, and RabbitMQ as the broker. But in order to simplify the process, just the broker is needed when using RabbitMQ.

There are many ways to install RabbitMQ, we recommend a system installation, although a local installation might be better for development:

$ wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.3.1/rabbitmq-server-generic-unix-3.3.1.tar.gz
$ tar xvf rabbitmq-server-generic-unix-3.3.1.tar.gz
$ ./rabbitmq_server-3.3.1/sbin/rabbitmq-server start

That should expose the URL amqp://guest@localhost// listening for requests, which is the default BROKER_URL in the settings. But if you are using a different broker or result backend, don't forget to configure those in your local settings:

BROKER_URL = "amqp://user:pass@hostname/app/"
CELERY_RESULT_BACKEND = "redis://:password@hostname:port/db"

Then export the settings if it's not the regular settings.py file:

$ export DJANGO_SETTINGS_MODULE=sylva.your_settings

And finally run Celery:

$ celery -A sylva.celery worker -l info

You can also run it in daemon mode by passing the argument multi:

$ celery multi start w1 w2 -A sylva.celery -l info

To disable prefork pool prefetch, simply add -Ofair at the end of the celery command.


Sylva now supports generation of reports based on queries plot into charts. To enable, just add:


And remember to add the celery beat:

$ celery --beat -A sylva.celery worker -l info

When in daemon mode, be sure to only run the beat once, otherwise you'll have duplicated tasks:

$ celery multi start w1 --beat -A sylva.celery -l info
$ celery multi start w2 -A sylva.celery -l info