Read-only mirror of https://github.com/blw-ofag-ufag/eCH-0265 — Bundesamt für Landwirtschaft. Issues & pull requests at the source.
  • Turtle 72.3%
  • Python 14.3%
  • RMarkdown 7.6%
  • Makefile 1.8%
  • YAML 1.6%
  • Other 2.4%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-12-03 18:06:57 +01:00
.github Install R packages with pak from src/r/DESCRIPTION 2026-10-08 10:34:10 +02:00
docs Changes in explanations of direct payment crops 2026-11-26 15:59:05 +01:00
src Bugfix: Correct French translations 2026-12-03 18:03:01 +01:00
tests Compare Näbi names in de/fr/it in data drift tests 2026-10-20 14:37:27 +02:00
.gitattributes Set up structure according to template 2026-07-17 19:36:52 +02:00
.gitignore Update .gitignore 2026-11-04 15:16:02 +01:00
LICENSE.md Update license header format 2026-08-12 11:35:42 +02:00
Makefile Install R packages with pak from src/r/DESCRIPTION 2026-10-08 10:34:10 +02:00
README.md Install R packages with pak from src/r/DESCRIPTION 2026-10-08 10:34:10 +02:00

eCH-0265 Agricultural Crops (Working Draft v2.0)

CI/CD GitHub last commit GitHub issues

This repository contains a data model for agricultural crops in Switzerland as well as associated reference objects, which can be retrieved in a machine-readable format as Linked Data. This aims to enable the domain-validated exchange and reuse of data between the fields of direct payments, nutrient balancing, and plant protection.

For detailed (but work-in-progress) documentation, visit https://blw-ofag-ufag.github.io/eCH-0265.

This repository includes a full semantic web pipeline, including

  1. manual data curation (Turtle files in src/rdf/data, one file per source system, plus the reference taxonomy in src/rdf/ontology/cultivationtypes.owl.ttl),
  2. optional automated data integration (any Python scripts placed in src/python/pipeline/ are executed by make and their output is merged into the graph; the directory is currently empty, all data is curated manually),
  3. OWL-based inferencing (using the ontology in src/rdf/ontology/model.owl.ttl),
  4. SPARQL-based processing of the graph, e.g. the derivation of the SKOS mappings (using the update queries in src/sparql/processing/),
  5. SHACL-based graph data validation (using src/rdf/shapes/model.shacl.ttl),
  6. a Pytest test suite for syntax, SHACL reports, links, prefixes and queries,
  7. uploading of the final graph to LINDAS, and
  8. a documentation building pipeline using Quarto (docs/).

Development tools

This repository uses a variety of tools to ensure robust data integration, reasoning, validation, and documentation.

  • HermiT: An OWL reasoner used for logical reasoning and inferring new knowledge from the ontology and data.
  • Pytest: A testing framework used to run syntax checks and evaluate SHACL validation reports.
  • PySHACL: A Python engine used to validate the generated RDF graphs against SHACL shape definitions.
  • ROBOT: CLI tool used to merge, reason, and process RDF graphs.
  • RDFLib: A Python library used to parse, serialize, and programmatically manipulate RDF data.
  • Quarto: An open-source publishing system used for rendering the documentation.

Semantic web standards

The project relies on core W3C Semantic Web standards to model, link, and validate data effectively.

  • RDF (Resource Description Framework): The foundational data model used to represent information as a directed graph of triples.
  • OWL (Web Ontology Language): Used to define the formal semantics, classes, and properties of the ontology.
  • SHACL (Shapes Constraint Language): Used to declare structural constraints and validate the integrity of the RDF data.
  • SPARQL: The standard query language used to extract, transform, and post-process the RDF graphs.
  • Turtle: The primary, human-readable serialization format used for all RDF files in this repository.

Build and deployment orchestration

To streamline the workflow, this project uses make as its primary orchestration tool, automating everything from setup to deployment. The Makefile defines a single entry point to sequentially execute data integration, logical reasoning, SPARQL updates, SHACL validation, testing, and documentation rendering. make help lists all available targets with a short description.

  1. Add variables to .env (for local execution)

    USER=********
    PASSWORD=********
    GRAPH=********
    ENDPOINT=********
    
  2. Set up dependencies:

    make setup
    
  3. Run the build process:

    make
    

    The default target runs make test followed by make docs.

    Run tests

    To build the graph (data integration, reasoning, SPARQL processing and SHACL validation) and run the Pytest suite, run:

    make test
    

    Build documentation

    To generate the class and glossary reference from the SHACL shapes and the SKOS glossary, render the PlantUML diagrams in docs/<lang>/assets/puml/ to SVG, and build the Quarto website into build/docs/:

    make docs
    

    Note that this step requires Quarto and R to be installed. The R packages of the documentation are listed in src/r/DESCRIPTION and installed by make setup with pak, together with the system libraries they need.

  4. Upload the final data to LINDAS, the linked data service by the federal archives:

    Automatic deployment

    The deployment is automatically triggered via GitHub Actions whenever changes are pushed or merged to the main branch. To enable this, configure the environment variables listed in step 1 as repository secrets in your GitHub project settings (Settings > Secrets and variables > Actions > New repository secret):

    Manual deployment

    You can still upload the final data manually by running:

    make publish
    

    By default, the publication process starts by deleting any pre-existing data in the provided named graph on LINDAS. You can also just delete any published data by running:

    make delete
    
  5. If you want to clean all written files:

    make clean
    

Contact

Do you have questions? Please do not hesitate to contact us at agridata.ch@blw.admin.ch, open an issue in this repository, or directly submit a Request for Change (RFC) via the official eCH feedback form.