This repository contains an example application of the PRObs ontology to querying data about a small subset of the UK production system.
In the following, we assume that both are installed and added to the PATH.
The installation is simplified and automated using Poetry. You only need to run:
poetry install
This will set up a Python virtual environment with the necessary dependencies. To use this Python environment, either activate it using poetry shell
, or prefix all the commmands below with poetry run
.
You need to convert the data only if you modified the mapping. Otherwise, go to the Reasoning section.
To convert the data, run doit
from the root folder:
doit run conversion
This will add all the data sources and mappings to RDFox, apply rules, and save data/probs_data.nt.gz
. It does this via the probs-ontology
package; if this has been installed in editable mode (as specified in pyproject.toml
, or with the -e
option to pip
) then any changes made within probs-ontology
to the scripts will be picked up here, but you may need to force doit to rerun using the doit run -as conversion
option.
This process takes place within the _rdfox_working/conversion
folder, where a temporary set of scripts is assembled. You can show all the output from RDFox by setting the PROBS_DEBUG
environment variable when running this command.
To load the ontology and the data and start the RDFox endpoint, run:
doit run reasoning
Then go to http://localhost:12110/console/default
to run your SPARQL queries.
Build using jupyter-book:
jupyter-book build docs
The results are in docs/_build
. This includes example queries.
We include some data from other sources in the raw_data
and datasources
directories, but these are only for the purpose of illustrating the operation of the PRObs ontology and any use of this data is subject to the original source: COMTRADE, PRODCOM and BGS.
The other documents and code is licensed under a Creative Commons Attribution 4.0 International License.