I. Installing required Python modules
To use openvocabulary_django you need to install the following Python modules (these are listed for Linux, Ubuntu in particular; installation for Windows is probably impossible and at least very awkward):
- django
- python-mysqldb
- django-haystack: https://github.com/downloads/toastdriven/django-haystack/django-haystack-1.0.1-final.tar.gz
- xapian - i.e.: python-xapian, xapian-omega, xapian-tools, libxapian22; to install them add repository: deb http://ppa.launchpad.net/xapian-backports/xapian-1.2/ubuntu maverick main
- xapian-haystack: https://github.com/downloads/notanumber/xapian-haystack/xapian-haystack-1.1.3beta.tar.gz
- python-django-debug-toolbar
- python-django-piston: https://bitbucket.org/jespern/django-piston/downloads/django-piston-0.2.2.tar.gz
- django-dynamicresponse: http://pypi.python.org/packages/source/d/django-dynamicresponse/django-dynamicresponse-0.1.5.tar.gz
- BeautifulSoup? - http://www.crummy.com/software/BeautifulSoup/download/3.x/BeautifulSoup-3.2.0.tar.gz
If no URLs were given, a default Ubuntu repository may be used
II. Preparing the SQL database
1. Typical operations
OV uses SQL database in a way typical Django applications used to do that. This means that after checking out the source code you should:
- set appropriate DB name, user and password in settings.py
- run the command: python manage.py syncdb
After that you should have all the tables required by Django and its installed applications created.
2. Importing vocabularies
Although OpenVocabulary operates on RDF triples, they are not kept in a dedicated RDF store but in a MySQL database. That's why you have to populate MySQL first to be able to work with OV. To do that, you should use readin.py script which will handle whole conversion process. Usage is pretty straightforward:
python readin.py -f /path/to/rdf/file/rdf_file.nt
N3-formatted files containing vocabularies can be found in other projects available on opensource.knowledgehives.com/svn/OpenVocabulaty/trunk/ These include WordNet?, DMoz, DMoz-PL, ACM, DDC, Library of Congress, PKT (Polish Topical Classification) and UDC. Choose whitchever you want and feel free to add your own ones.
III. Preparing the index
Searching on the site is based on Xapian index of data, so to enable search you have to prepare appropriate index first. If all the packages from pt I have been installed all you need to do is run the command:
./ov_django/python manage.py rebuild_index
This will create the index in a default folder ov_django/xindex. The process can take up to 2 hours. Since index has a few hundreds of MB it is not stored on SVN.
IV. Launching the application
OV is launched just as any other Django applications:
openvocabulary/ov_django/python manage.py runserver <port_number>
Frontend will be available at http://localhost:<port_number>
V. WSGI
If you want to use this application behind HTTP server like Apache, configure it appropriately for WSGI. A file needed on the side of Django is included in this project.
