RDF format conversion as a web-service.
A tiny HTTP service that allows to fetch an RDF ontology in a variety of different formats (e.g. RDF/XML, JSON-LD, Turtle, ...), as long as it is available in one of them.
This tool - when hosted - comes in handy when trying to comply with best practice of publishing ontologies/vocabularies, as part of that practice suggests to use content negotiation to provide the ontology in different formats. We could just statically convert our ontology into different formats, and be done with it, so why this service? As ontologies can somehow be though of as standards for communication, it would be good if they'd be very stable in most cases. In practice though - as live goes - it is pretty unwise to consider them as static, never changing entities of the digital world; that would mean, setting ourselves up for failure, stagnation, ... ultimately: project death. So we say: No! Ontologies have to change, and in practice, they do. Just as in software, they are best hosted on VCS/SCM like git. Naturally, they will also have versions - releases and latest development states, all of which we might want to make available (under different IRI/URIs), following best practice for publishing ontologies. This is unfeasible/impractical to do by hosting statically converted files for each revision for each RDF serialization format + HTML. Thats where this tool enters the scene.
As an example, let us imagine an ontology is served under IRI/URI https://w3id.org/SOME_ORG/ont/SOME_ONT
as Turtle. This tool - hosted as a public service - can then be used as a proxy: Given the above plus a target MIME-type (through the HTTP Accept
header) - for example application/ld+json
or text/html
, it will serve that format/MIME-type, if the conversion is possible.
Internally, we use pyLODE for conversion to HTML, and the python RDFlib (through a thin CLI wrapper) for all other conversions.
NOTE Caching is involved!
This tool is part of RDF-tools (not to be confused with rdftools), a Docker image, containing a collection of RDF related CLI and web-service tools. To use the tool alone/directly, follow the steps in the next few sections.
You need to have pylode
and rdf-convert
(from the rdftools tool set installed and available on your PATH
.
As for now, you have two choices:
(see Install and Prerequisites first)
using the compiled binary:
$ ontprox ... listening on 127.0.0.1:3000
or from source:
$ cargo run ... listening on 127.0.0.1:3000
The available CLI arguments:
$ ontprox --help
A tiny HTTP service that allows to fetch an RDF ontology
that is available in one/a few format(s),
in others.
Usage: ontprox [OPTIONS]
Options:
-V, --version
Print version information and exit. May be combined with -q,--quiet, to really only output the version string.
-v, --verbose
more verbose output (useful for debugging)
-q, --quiet
Minimize or suppress output to stderr; stdout is never used by this program, with or without this option set.
-p, --port <PORT>
the IP port to host this service on
[default: 3000]
-a, --address <IP_ADDRESS>
the IP address (v4 or v6) to host this service on
[default: 127.0.0.1]
-c, --cache-dir <DIR_PATH>
a variable key-value pair to be used for substitution in the text
[default: ~/.cache/ontprox]
-C, --prefer-conversion
Prefer conversion from a cached format over downloading the requested format directly from the supplied URI.
-h, --help
Print help (see a summary with '-h')
(see Run first)
When the service is running on http://127.0.0.1:3000
, you can fetch the HTML version of e.g. the ValueFlows (VF) ontology as HTML, either by opening http://127.0.0.1:3000?uri=https://w3id.org/valueflows/ont/vf.TTL
in your browser, or on the command line with CURL:
curl "http://127.0.0.1:3000?uri=https://w3id.org/valueflows/ont/vf.TTL" \ -H "Accept: text/html" \ > ont_vf.html
To give an other example, this fetches the Open Know-How (OKH) ontology as JSON-LD:
curl "http://127.0.0.1:3000?uri=https://w3id.org/oseg/ont/okh" \ -H "Accept: application/ld+json" \ > ont_okh.jsonld
You need to install Rust(lang) and Cargo. On most platforms, the best way to do this is with RustUp.
Then get the sources with:
git clone --recurse-submodules https://codeberg.org/elevont/ontprox.git cd ontprox
Then you can compile with:
If all goes well, the executable can be found at target/debug/ontprox
.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4