Skip to main content

# 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.

## CKAN extension This repository includes code to upload data from an RDF file to CKAN in order to show metadata about datasets. The upload script will utilize the extras field in CKAN to store this data. To display the data display these nicely you should install [this](https://github.com/openumea/ckanext-rdf-to-html) extension.

For more information on how to use this extension please refer to the readme [here](https://github.com/openumea/ckanext-rdf-to-html)

## 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/).

Metadata

Release files for rdf-to-html 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rdf-to-html 1.1.0
File Size Uploaded
rdf-to-html-1.1.0.tar.gz 14.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rdf-to-html 1.1.0
File Interpreter ABI Platform
rdf_to_html-1.1.0-py2-none-any.whl Python 2 none any Details

Total release size: 38.1 kB

Release files / rdf-to-html-1.1.0.tar.gz

Download URL rdf-to-html-1.1.0.tar.gz
Size 14.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e075cc2f69a42dd029bc7b25ced81802fb3faf3a3c94e9137ff722930b50a17e
BLAKE2b-256 checksum
How to use checksums
59cd182f0a75020be2854441aae4d33e827d80855ca5479a9f04d4dcb938ccf0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / rdf_to_html-1.1.0-py2-none-any.whl

Download URL rdf_to_html-1.1.0-py2-none-any.whl
Size 24.0 kB
Tags Python 2
SHA-256 checksum
How to use checksums
0eb152016a9afd788231d8dc8cfc9cb65bb9a5478472fd3c5b48fef271b2223b
BLAKE2b-256 checksum
How to use checksums
86ffacea1b2c1b25a8bdc0a9cd8856bed555ccea286cfa6521b7707c66dd3c70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.1

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page