- Python 48.7%
- Turtle 47.9%
- SPARQL 3.4%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .github | ||
| data | ||
| docs | ||
| rdf | ||
| service | ||
| src | ||
| tests | ||
| .gitattributes | ||
| .gitignore | ||
| CHANGELOG.md | ||
| LICENSE | ||
| pyproject.toml | ||
| README.md | ||
| sparql-psmv-query-guide.md | ||
| uv.lock | ||
PSMV-RDF
Note
This repository is under active development. Features, documentation, and structure will change frequently.
Plant Protection Products (PSMV) as Linked Data
A Python module for converting Swiss plant protection product data from CSV format to RDF and publishing it to the LINDAS Linked Data Service.
Reproduce the data integration pipeline
-
Set up the virtual environment
If
uvis not yet installed:curl -LsSf https://astral.sh/uv/install.sh | shuv venv psmv-rdf source psmv-rdf/bin/activate -
Install the package in editable mode
uv pip install -e . -
Start the data integration pipeline
python -m service.pipeline -
To upload the graph, first, place a
.envfile in the directory root:LINDAS_USER=******** LINDAS_PASSWORD=************ ENDPOINT=https://graphdb.lindas.admin.ch/repositories/lindas/rdf-graphs/service GRAPH=https://lindas.admin.ch/fsvo/plant-protection-productsThen trigger the upload to LINDAS:
python -m service.upload_graph
Project Structure
psmv-rdf/
├── .github/
│ └── workflows/ # github actions
├── data/ # any non-RDF data files, used as input data
│ ├── mapping/ # yaml mapping files
│ ├── namespaces/ #
│ ├── processed/ #
│ └── mapping/ # input CSV files
├── docs/ # project documentation
├── rdf/
│ ├── ontology/ # OWL ontology documentation
│ ├── shapes/ # SHACL shapes, also used as data model documentation
│ ├── data/ # the actual RDF data, split by classes
│ ├── example/ # example turtle files used for reference
│ └── processed/ # any automatically written/derived/merged turtle files
├── services/
│ └── pipeline.py
├── src/
│ ├── sparql # SPARQL queries and inference rules
│ └── python/ # Python scripts for specific tasks
├── tests/
├── LICENSE
├── README.md
└── .gitignore
Documentation
All ontology documentation files are written to rdf/ontology.
You may inspect a visual representation of the ontology used here.
A more restricted data model is written in SHACL and can be inspected here.
Note
We should align the SHACL data model with this documentation: https://github.com/user-attachments/files/28257903/177035312.Datenmodell.PSMV.docx
Project dependencies are listed in pyproject.toml.
Example queries
List all prodcuts containing sulphur
Which products can be used for sweet corn when thrips are the target pest?
Acknowledgments
- Built with rdflib
- Integrates with LINDAS, the Swiss federal linked data service.
- Orignial ontology and pipeline by Damian Oswald with plant protection pipeline