Read-only mirror of https://github.com/BLV-OSAV-USAV/PSMV-RDF — Federal Food Safety and Veterinary Office FSVO, Switzerland. Issues & pull requests at the source.
  • Python 48.7%
  • Turtle 47.9%
  • SPARQL 3.4%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-08-19 09:39:38 +00:00
.github Update contribution guideline 2026-06-19 16:03:27 +02:00
data chore(data): download and update CSVs from SFTP [skip ci] 2026-08-19 09:39:38 +00:00
docs Update documentation [skip ci] 2026-08-18 13:13:31 +00:00
rdf chore: fix substances and their shape constraints, fix wikidata URI 2026-08-14 11:08:39 +02:00
service update 2026-06-15 09:29:22 +02:00
src chore: fix substances and their shape constraints, fix wikidata URI 2026-08-14 11:08:39 +02:00
tests Add ProductIndication.csv to test SFTP files 2026-05-27 10:30:28 +02:00
.gitattributes Modify .gitattributes to include .sparql and .csv 2026-05-12 11:28:47 +02:00
.gitignore update gitignore 2026-05-20 15:59:21 +02:00
CHANGELOG.md chore(main): release 0.1.0 2026-05-26 13:49:06 +00:00
LICENSE add license AGPL v3 based on BK OSS rules 2026-05-20 14:12:26 +02:00
pyproject.toml chore: release 0.2.2 2026-06-17 15:22:09 +02:00
README.md Add reference to @Willubilu documentation 2026-06-19 16:04:33 +02:00
sparql-psmv-query-guide.md update query guide 2026-08-14 08:46:05 +02:00
uv.lock Update documentation [skip ci] 2026-06-23 07:52:45 +00:00

PSMV-RDF

Python License Status Docs CI

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

  1. Set up the virtual environment

    If uv is not yet installed: curl -LsSf https://astral.sh/uv/install.sh | sh

    uv venv psmv-rdf
    source psmv-rdf/bin/activate  
    
  2. Install the package in editable mode

    uv pip install -e .
    
  3. Start the data integration pipeline

    python -m service.pipeline
    
  4. To upload the graph, first, place a .env file 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-products
    

    Then 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 some products

List all prodcuts containing sulphur

Which products can be used for sweet corn when thrips are the target pest?

Acknowledgments