RDF to HTML converter
Project description
# RDF to HTML converter
The RDF to HTML converter aims to provide documentation for RDF files by generating a more human readable version of the data.
The converter currently supports splitting all subjects of an RDF file into separate paragraphs, each with a title, type and description. Each paragraph can then be expanded to show all data contained in the file.
To further improve the readability, the converter also tries to download the specification for all predicates in the file. This allows it to generate a more readable version of the predicates as well.
The HTML files output by the converter will be HTML files with a language suffix (.en, .sv, etc.) to allow tools such as Apache mod_negotiation to serve different languages based on the users preferences.
## Setup * Create a virtual environment and activate it virtualenv venv; . venv/bin/activate * Run python setup.py install you will now have an executable named rdf-to-html in your path * Or install it via PyPi pip install rdf-to-html
## Run
- usage: rdf-to-html [-h] [–languages LANGUAGES] [–watch] [–verbose]
[–log-file LOG_FILE] DCAT_FILE [DCAT_FILE …] OUTPUT_DIR
RDF to HTML converter.
- positional arguments:
DCAT_FILE DCAT file OUTPUT_DIR Output directory
- optional arguments:
- -h, --help
show this help message and exit
- --languages LANGUAGES
Languages (on ISO-369-* format) to generate separated by comma (,). If omitted all encountered languages are generated.
- --watch
Watch input files for changes and run the conversion when a change occurs.
- --verbose
Only log critical events
- --log-file LOG_FILE
File to log to. If omitted logging will be sent to stdout
### Examples The easiest way to run the converter is to simply run in on a single file. Which will create one HTML file for each language present in the DCAT file.
rdf-to-html DCAT_FILE OUTPUT_DIR
If you only want to generate HTML for specific languages you can specify them as flags to the application. If the languages specified aren’t exactly the same those encountered in the DCAT file, the program will exit. This functionallity is mainly included to avoid to generate output for DCAT files containing typos in the language tags.
rdf-to-html –languages en,sv DCAT_FILE OUTPUT_DIR
The typical use case is to setup the script to watch for changes in one or more RDF files. This will enable you to always have an up to date human readable version of your datafile. To do this setup the following code to be run when the server starts.
rdf-to-html –watch DCAT_FILE [DCAT_FILE …] OUTPUT_DIR
Note The watch is bound to a specific inode, not a filename, which means that the script will still monitor the same file if you move/rename it.
An example HTML page generated by the converter can be found [here](http://opennorth.se/datasets/dcat).
## Develop The generated files can of course be opened manually, but for convenience a development web server is included at devel/webserver.py.
Just run python webserver.py in the folder where you have your generated HTML-files and you can view them in your browser localhost:8080/YOUR_FILE.
## Acknowledgements
This application was developed by [Dohi Agency](http://dohi.se/agency) in cooperation with [Umeå Kommun](http://umea.se) in a project financed by [Internetfonden](https://www.iis.se/vad-vi-gor/internetfonden/).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for rdf_to_html-1.0.1-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea8fc7ae89384ac522bb5af06cc56900883515fc09607d67198f6a9b5a076e90 |
|
MD5 | 089f1e8099e06af7fc06d44086921428 |
|
BLAKE2b-256 | 280b05a1d1cb677737c97ce0199eb64613c0738f0100f4bd6758e55cc481a3f9 |