The framework consists of the following elements
WNRDF.py
: The module for converting from the SQLite database to RDFWNRDFWeb.py
: The WSGI interface for rendering pages based on RDF dataWNFromRDF.py
: Convert the RDF data back into SQLite formatWNRDFTest.py
: Unit tests for the conversion
Other files are
build_ontology.py
: Generatesontology.rdf
from the current state of the databasefooter
andheader
: The nearly-static content returned at the beginning and end of HTML pages generated by WNRDFWebindex.html
: The static welcome page of WNRDFWeb (without header/footer)ontology.rdf
: The OWL ontology for WNrdf2html.xsl
: XSLT for generating HTML from RDFsparql.html
: The static page for the SPARQL query interfacesparql2html.xsl
: XSLT for generating HTML from SPARQL XML resultssparql_load.py
: Script for generating database for SPARQL querieswnrdf.css
: CSS file for the web interfacewordnet_3.1+.db
: Please symlink the database herewordnet.nt.gz
: All the RDF dataflag/*.gif
: Flags used to show language
The following files are not necessary to deploy the web interface
roundtrip.sh
: Test if database can be converted to RDF and reloaded into SQLwn_schema.py
: Contains data from some of the small tables (e.g.,linktype
) as Python dictswrite_schema.py
: Generateswn_schema.py
from the SQLite databasewrite_sql_schema.sh
: Generates the header (SQLCREATE
commands) necessary to create a new SQLite database from an existing databaseextra_indexes.sql
: Generates extra indexes in the SQLite database to speed up page load time
The application can be deployed either by configuring a WSGI application, this can be done by simply adding the following
to the apache2.conf
or httpd.conf
file:
WSGIScriptAlias /rdf /path/to/WNRDFWeb.py
More details here
Or by starting the server as a standalone, e.g.,
python WNRDFWeb.py -p 8051
To run this the following are required
- SQLite3
- Python (compiled with SQLite and WSGI)
- Python rdflib (http://www.rdflib.net)
- Python lxml (http://lxml.de)
- rdflib-jsonld plugin
RDFLib and LXML should be part of most Linux distributions, e.g., in Ubuntu/Debian:
apt-get install python-rdflib python-lxml
rdflib-jsonld should also be installed see https://github.com/RDFLib/rdflib-jsonld
All mappings are stored in the mapping
folder. To run most of the mapping scripts it is necessary to create the mapping database; this can be done as follows:
gunzip wn20-30.csv.gz wn30-31.csv.gz w3c-wn20.csv.gz
sqlite3 mapping.db < mapping.sql
gzip wn20-30.csv wn30-31.csv w3c-wn20.csv
The following mappings can be generated and added to the database
omwn
: Translations in 21 languages from Open Multilingual WordNetuby
: Links to the lemon version of Ubyvn
: Links to VerbNetw3c-synsets
: Links to the W3C version of WordNet 2.0
All files can either be generated from the appropriate .py
script or by running the NTriple file through WNFromRDF.py
(see next section)
First add the extra indexes and tables by
sqlite3 wordnet_3.1+.db < extra_indexes.sql
Then, each of the mappings can be added as follows
zcat mapping/omwn.nt.gz | python WNFromRDF.py | sqlite3 wordnet_3.1+.db
zcat mapping/uby.nt.gz | python WNFromRDF.py | sqlite3 wordnet_3.1+.db
zcat mapping/vn.nt.gz | python WNFromRDF.py | sqlite3 wordnet_3.1+.db
zcat mapping/w3c-synsets.nt.gz | python WNFromRDF.py | sqlite3 wordnet_3.1+.db
The file wordnet.nt.gz
should be generated each time the database is changed, this is done as follows
python WNRDF.py
gzip wordnet.nt
Once the dump is generated the SPARQL index in the folder store
must be generated as follows
python sparql_load.py