- Turtle 79.6%
- Python 11.3%
- YAML 2.3%
- RMarkdown 2%
- Makefile 1.6%
- Other 3.2%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| .github | ||
| docs | ||
| src | ||
| tests | ||
| .gitattributes | ||
| .gitignore | ||
| LICENSE.md | ||
| Makefile | ||
| publiccode.yml | ||
| README.md | ||
System map backend
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
- manual data curation (data files in
src/rdf/data), - OWL-based inferencing (using the ontology in
src/rdf/ontology/model.owl.ttl), - SPARQL-based processing of the graph (using rules in
src/sparql/processing/...), - SHACL-based graph data validation (using
src/rdf/shapes/model.shacl.ttl), - a Pytest test suite,
- uploading of the final graph to LINDAS (named graph
https://lindas.admin.ch/foag/system-map), - 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.
-
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 -
Set up dependencies:
make setup -
Run the build process:
makeThe default target runs
make testfollowed bymake docs.Run tests
To build the graph (reasoning, SPARQL processing and SHACL validation) and run the Pytest suite, run:
make testThe 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 docsNote that this step requires Quarto to be installed.
-
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
mainbranch. 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 publishBy 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 -
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:isPartOfanddcterms:hasPartdescribe 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 withschema:sameAs, notowl:sameAs.owl:sameAsdeclares 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.