Swiss law is public. Every federal statute is on Fedlex. Every cantonal statute collection is online. Many court decisions are published on court websites. The data is there. But “there” and “usable” are two different things.
In three weeks, we built a database encompassing 27,795 Swiss statutes, 2.02 million structured law units, and 1.14 million court decisions from 115 courts. This article describes the path from official source to searchable knowledge base.
The Starting Point: What the Federal Government Provides
The Swiss Confederation operates Fedlex, one of the best open legal platforms in Europe. The Systematic Compilation of Federal Law (SR) is fully digitised and queryable via a SPARQL endpoint. The format is Akoma Ntoso, an international XML standard for legislative texts.
This means: every article, every paragraph, every amendment history is machine-readable. Not as a PDF, but as structured XML with semantic markup for references, definitions, and structural elements.
Step 1: Data Extraction
The first task was to extract all federal statutes and ordinances from Fedlex. Via the SPARQL endpoint, we queried all SR numbers and downloaded the corresponding Akoma Ntoso documents.
For cantonal statutes, the path was less uniform. Each of the 26 cantons operates its own statute collection. Some (Zurich, Bern, Vaud) offer structured APIs. Others publish exclusively as PDFs. A separate extractor had to be built for each canton.
In the end: 27,795 statutes from all 26 cantons, the federation, and intercantonal bodies. This covers: federal acts, federal ordinances, cantonal acts, cantonal ordinances, intercantonal agreements, and treaties.
Step 2: Structuring into Law Units
A statute as a whole is too large for AI applications. A single article is sometimes too small (missing context). The relevant unit is the “law unit”: a structured section with its own substantive focus.
We broke the 27,795 statutes into 2.02 million law units. Each unit contains:
- The full text
- The hierarchical position within the statute (Book > Title > Chapter > Section > Article > Paragraph)
- The SR number and paragraph reference
- The language (DE, FR, IT, EN)
- Metadata: entry into force, last amendment, status
This granularity is critical. When a lawyer searches for “notice period for indefinite employment contracts,” she should find Art. 335c CO, not the entire Code of Obligations.
Step 3: Court Decisions
Swiss courts publish their decisions on various platforms. The Federal Supreme Court on bger.ch. The Federal Administrative Court on bvger.ch. Cantonal courts on entscheidsuche.ch or their own portals.
We systematically collected all available decisions. The result: 1.14 million decisions from 115 courts. Federal Supreme Court decisions are complete. Federal Administrative Court decisions are complete (91,582 decisions, zero stubs). Cantonal decision coverage varies by canton.
Each decision was structured with: court, date, case number, type of proceedings, applied statutes, references to other decisions, and full text.
Step 4: The Citation Graph
Statutes cite other statutes. Decisions cite statutes. Decisions cite other decisions. These references form a network: the citation graph.
We extracted 1.42 million citation edges. Each edge connects a source (e.g., a Federal Supreme Court decision) with a target (e.g., an article of the CO or an earlier decision). This network makes visible how Swiss law is interconnected.
A concrete example: Art. 58 DBG (corporate income tax) is cited by 842 Federal Supreme Court decisions. 23 cantonal decisions reference it in the last two years. Citation frequency reveals which articles are contested in practice. Declining frequency may indicate a legal question has been settled. Increasing frequency signals emerging conflicts.
No other platform in Switzerland offers this analysis.
Step 5: Embedding and Semantic Search
Keyword search has a fundamental weakness: it only finds what is written exactly as searched. “Termination of the employment relationship” does not find “dissolution of the employment contract,” although both mean the same thing.
Semantic search solves this problem. Each of the 2.02 million law units and each of the 1.14 million decisions was converted into a vector (embedding). These vectors represent the content of the text, not its wording.
Total: 3.13 million embeddings. The result: a search for “employer must continue paying salary during illness” finds Art. 324a CO, even though that exact wording appears nowhere in the statutory text.
Step 6: Multilingual Capability
Swiss law exists in four languages. The three official languages (German, French, Italian) are legally equivalent. Many decisions exist only in one language.
Our database covers: 1.5 million law units in German, 232,000 in French, 235,000 in Italian, and 45,000 in English. The search works across languages: a question in German can find a relevant decision in French, if that decision contains the best answer.
What This Means for Practice
The combination of structured data, citation graph, and semantic search transforms legal research. Instead of spending an hour refining keywords, the lawyer describes her problem in natural language. The platform finds relevant statutes, decisions, and the connections between them.
Every result references the official source. No hallucinations. No guessing. If the answer is not in the data, the system says so.
All data originates from official government sources and is updated every night. No intermediary. No publisher. The source itself.
Further information: montvirtua.com
This article is for general information purposes and does not constitute legal advice.