Read-only mirror of https://github.com/blw-ofag-ufag/system-map-backend — Bundesamt für Landwirtschaft. Issues & pull requests at the source. https://www.opensource.admin.ch/en/softwares/phcrh7
  • Turtle 79.6%
  • Python 11.3%
  • YAML 2.3%
  • RMarkdown 2%
  • Makefile 1.6%
  • Other 3.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Damian Oswald 1d67b69f7d
Merge pull request #2 from blw-ofag-ufag/tvd-subgraph
Add TVD subgraph from system-map
2026-11-12 15:36:44 +01:00
.github Restore template documentation, CI and Makefile 2026-10-12 15:00:46 +02:00
docs Describe the data model in detail and align chapters 2 and 3 2026-10-14 14:44:28 +02:00
src Add TVD subgraph from system-map#192 2026-11-12 14:59:17 +01:00
tests Remove legacy pipeline (upload script, workflows, custom inference rules) 2026-10-09 14:24:11 +02:00
.gitattributes Initial commit 2026-10-07 13:43:20 +02:00
.gitignore Merge system-map history into template repository 2026-10-07 14:53:21 +02:00
LICENSE.md Initial commit 2026-10-07 13:43:20 +02:00
Makefile Restore template documentation, CI and Makefile 2026-10-12 15:00:46 +02:00
publiccode.yml Update README and publiccode.yml for the documented backend 2026-10-12 15:41:58 +02:00
README.md Remove leading blank line in README 2026-10-12 15:49:29 +02:00

System map backend

CI GitHub last commit GitHub issues

This repository contains the knowledge graph of the system map of the Federal Office for Agriculture: IT systems of the Swiss agri-food sector, the data they contain, the services they provide and consume, and the organizations that operate, own or develop them. It is built on the semantic-web-template and uses its semantic web pipeline, including

  1. manual data curation (data files in src/rdf/data),
  2. OWL-based inferencing (using the ontology in src/rdf/ontology/model.owl.ttl),
  3. SPARQL-based processing of the graph (using rules in src/sparql/processing/...),
  4. SHACL-based graph data validation (using src/rdf/shapes/model.shacl.ttl),
  5. a Pytest test suite,
  6. uploading of the final graph to LINDAS (named graph https://lindas.admin.ch/foag/system-map),
  7. a documentation building pipeline using Quarto, which describes the data model based on the SHACL shapes.

The published graph is visualized by the system map frontend, which queries it live from LINDAS.

Note

This repository was migrated from system-map; its full commit history is preserved here.

Development tools

This project uses a variety of tools to ensure robust 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 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=lindas-foag-system-map
    PASSWORD=********
    GRAPH=https://lindas.admin.ch/foag/system-map
    ENDPOINT=https://graphdb.lindas.admin.ch/repositories/lindas/rdf-graphs/service
    
  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 (reasoning, SPARQL processing and SHACL validation) and run the Pytest suite, run:

    make test
    

    The processed graph is written to build/rdf/03-processed.ttl.

    Build documentation

    To generate the data model pages from the SHACL shapes and build the Quarto website into build/docs/, run:

    make docs
    

    Note that this step requires Quarto to be installed.

  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
    

Subgraphs

Subgraphs of the system map show one part of the overall system without the multitude of connected nodes around it, for example MARS III, digiFLUX, Acontrol, AGIS or NTGS. An up-to-date list of all subgraphs is returned by the query src/sparql/queries/subgraphs.rq.

Modelling decisions and deviations from the template

The repository follows the structure and pipeline of the semantic-web-template. These decisions are deliberate:

  • Namespace and IRIs: The project keeps its existing namespace https://agriculture.ld.admin.ch/system-map/ and its random identifiers (e.g. systemmap:SvDlxaJ5YMkuZGH6k), instead of a versioned namespace and readable IRIs. Changing them would break the frontend, saved queries and external links.
  • Hierarchy properties are not transitive: schema:parentOrganization, schema:subOrganization, dcterms:isPartOf and dcterms:hasPart describe direct relations only, as in schema.org and Dublin Core. Indirect relations can be queried with property paths, e.g. schema:parentOrganization+.
  • Links to registers use schema:sameAs: Organizations point to their entries in the Staatskalender and in Zefix with schema:sameAs, not owl:sameAs. owl:sameAs declares two IRIs to be the same individual, so the reasoner would copy all statements onto the register IRIs and create duplicate organizations.
  • Not an eCH standard: The documentation uses the layout of the template, but the system map has no eCH number, version or category (docs/_ech.yml).

Contact

Do you have questions? Please do not hesitate to contact us at agridata.ch@blw.admin.ch or open an issue in this repository.