Skip to content
blw-ofag-ufagPublic

About

This standard is intended to help harmonize terms and data in both the public and private sectors of agricultural control systems, thereby facilitating the exchange and reuse of control data.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

57 Commits

Folders and files

Repository files navigation

GitHub last commit GitHub issues

eCH-0264 Agricultural Inspection Data (Working Draft)

This repository contains the eCH standard eCH-0264 «Landwirtschaftliche Kontrolldaten» (agricultural inspection data). It establishes the semantic and technical interoperability of inspection data between the federal administration, the cantons, inspection bodies and label organisations in Switzerland:

  • Fachglossar Kontrollwesen – a glossary of the Swiss agricultural inspection system as a SKOS concept scheme (src/rdf/data/glossary.skos.ttl). It is included in the documentation (Anhang C).
  • Documentation – the eCH document written in Quarto (docs/de/index.qmd), including the use cases and the needs of the stakeholders.

The logical data model and the code lists are developed step by step with the working group and will follow in a later version. A first draft is kept on the branch feature/datenmodell; the SHACL shapes will be added to src/rdf/shapes/model.shacl.ttl.

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

The repository is based on the semantic web template. It includes a full semantic web pipeline (make help lists all targets), including

  1. manual data curation (data files in src/rdf/data),
  2. data integration from a relational database (using python, specifically src/python/pipeline/...),
  3. OWL-based inferencing (using ontologies in src/rdf/ontology/),
  4. SPARQL-based processing of the graph (using rules in src/sparql/processing/...)
  5. SHACL-based graph data validation (using src/rdf/shapes/model.shacl.ttl)
  6. a customizable Pytest test suite, including glossary integrity checks,
  7. uploading of the final graph to LINDAS
  8. a documentation building pipeline using Quarto

Development Tools

This template 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.

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

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

    make setup
  3. Run the build process

    make

    Make sure you pass all tests with pytest.

  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

Any questions? Don't hesitate to contact us via agridata.ch@blw.admin.ch

About

This standard is intended to help harmonize terms and data in both the public and private sectors of agricultural control systems, thereby facilitating the exchange and reuse of control data.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages