CPRMV API¶
The CPRMV API is a Python/FastAPI service that makes individual rules from Dutch and European legal publications accessible as structured, machine-readable data in real time. It implements the Core Public Rule Management Vocabulary (CPRMV) โ the RONL standard for expressing and managing public rules across analysis, formalisation, and codification methods.
What it does¶
The API accepts a Rule Set identifier (a BWB, CVDR, EU CELLAR, Operaton DMN, IOU Norms, ROO or DSO ID) and an optional path of rule identifiers, then:
- Finds the publication method whose identifier format matches the Rule Set ID.
- Downloads the publication on-the-fly from its repository.
- Transforms it to CPRMV โ with the method's XSLT stylesheet for XML, or field by field for JSON.
- Navigates the resulting rule tree to the requested rule.
- Returns the rule in the requested format โ
cprmv-json, Turtle, JSON-LD, or other RDF serialisations.
No pre-loading or batch conversion is required. For BWB and CVDR, the API resolves "latest version valid on a given date" queries via SRU search of the publication repository.
Each publication and reference method is a Python module in serve_api/methods/, configured by its RDF method definition. See Publication Repositories.
/raw returns the publication untransformed.
Ecosystem position¶
The CPRMV API is the rule-access layer of the RONL ecosystem. It bridges official legal publication repositories and the knowledge-graph-based tooling (CPSV Editor, Linked Data Explorer):
graph LR
BWB["BWB Repository<br/>officiele-overheidspublicaties.nl"] -->|XML download| API
CVDR["CVDR Repository<br/>officiele-overheidspublicaties.nl"] -->|XML download| API
CELLAR["EU CELLAR<br/>publications.europa.eu"] -->|XML download| API
OPERATON["Operaton<br/>operaton.open-regels.nl"] -->|DMN download| API
NORMS["IOU Norms API<br/>Linked Data Explorer"] -->|JSON| API
ROO["Register van Overheidsorganisaties<br/>api-organisaties.overheid.nl"] -->|JSON| API
DSO["DSO, with the caller's key<br/>service.omgevingswet.overheid.nl"] -->|STTR download| API
subgraph "CPRMV API"
API["serve.py<br/>FastAPI"]
METHODS["Method modules<br/>serve_api/methods/"]
XSLT["XSLT Transforms<br/>bwb2cprmv.xsl<br/>cvdr2cprmv.xsl<br/>fmx42cprmv.xsl<br/>dmn13operaton2cprmv.xsl<br/>sttr2cprmv.xsl"]
KG["Methods KG<br/>cprmvmethods.ttl<br/>cprmv.ttl"]
API --- METHODS
METHODS --- XSLT
METHODS --- KG
end
API -->|cprmv-json / RDF| LDE["Linked Data Explorer"]
API -->|cprmv-json / RDF| CPSV["CPSV Editor"]
API -->|cprmv-json / RDF| EXT["External consumers"]
API -->|ReSpec HTML| SPEC["CPRMV Specification<br/>/respec/"]
Environments¶
| Environment | API (interactive docs) | CPRMV Specification |
|---|---|---|
| Production | cprmv.open-regels.nl/docs | cprmv.open-regels.nl/respec/ |
| Production (alias) | cprmv.open-rules.eu/docs | cprmv.open-rules.eu/respec/ |
| Acceptance | acc.cprmv.open-regels.nl/docs | acc.cprmv.open-regels.nl/respec/ |
Production is the stable tier and runs main, on its own VM that also answers as cprmv.open-rules.eu; acceptance runs acc on another. Each reports its tier, release, commit and image at /health (Deployment, VM Deployment).
Source, issues and pull requests are at open-regels/cprmv on GitHub, default branch acc. The published specification is at https://standaarden.open-regels.nl/standards/cprmv/<version>/, which GitLab Pages serves; each release pushes it there (Releasing).
Technology stack¶
Versions are those locked in serve_api/requirements.txt; pyproject.toml lists the direct dependencies without pins.
| Component | Technology | Version |
|---|---|---|
| API framework | FastAPI | 0.142.2 |
| ASGI toolkit / server | Starlette / Uvicorn | 1.7.0 / 0.54.0 |
| MCP integration | FastMCP (MCP SDK 2.3.0) | 4.1.8 |
| RDF library | rdflib | 7.6.0 |
| XML/XSLT processing | lxml | 6.1.3 |
| Pattern matching | parse | 1.22.2 |
| Date parsing | ciso8601 | 2.3.3 |
| Runtime | Python | 3.14 |
| Container | Docker (python:3.14-bookworm, pinned by digest) |
โ |
| Image registry | GitHub Container Registry (ghcr.io/open-regels/cprmv-api) |
โ |
| CI/CD | GitHub Actions; GitLab Pages for the specification | โ |
| Deployment | An Azure VM per tier: Docker Compose, Caddy, and a reconciler on a systemd timer | โ |
The MCP server is mounted on the API at /mcp/ โ see MCP server.
Repository structure¶
cprmv/
โโโ serve_api/
โ โโโ src/
โ โ โโโ serve.py # FastAPI application โ endpoints, method loader, rule-path navigation
โ โ โโโ utils/
โ โ โโโ constants.py # RDF namespaces, Path/Query parameter definitions
โ โโโ methods/ # Method modules: RuleMethod, PublicationMethod, ReferenceMethod,
โ โ # SerialisationMethod, OrganisationRegister, ServiceRegister base classes;
โ โ # core_web, core_api, core_xml, core_json, frbr_sru;
โ โ # bwb, cvdr, fmx4, dmn13, sttr, repository_overheid_nl, eucellar,
โ โ # operaton, iou, open_regels_nl, roo, dso, cprmvapi, juriconnect, eli
โ โโโ data/ # Written by `make methods`
โ โ โโโ cprmv.ttl # CPRMV vocabulary (loaded into the Methods KG)
โ โ โโโ cprmvmethods.ttl # Method registry + all method definitions (loaded into the Methods KG)
โ โ โโโ bwb2cprmv.xsl # XSLT: BWB XML โ CPRMV Turtle
โ โ โโโ cvdr2cprmv.xsl # XSLT: CVDR XML โ CPRMV Turtle
โ โ โโโ fmx42cprmv.xsl # XSLT: Formex v4 โ CPRMV Turtle
โ โ โโโ dmn13operaton2cprmv.xsl# XSLT: DMN 1.3 (Operaton) โ CPRMV Turtle
โ โ โโโ sttr2cprmv.xsl # XSLT: STTR (DSO) โ CPRMV Turtle
โ โโโ certs/ # certSIGN Web CA intermediate for repository.officiele-overheidspublicaties.nl
โ โโโ respec/ # Static CPRMV specification per version (served at /respec/)
โ โโโ test/ # pytest suite
โ โโโ Dockerfile
โ โโโ Makefile # install, methods, deps / deps-linux, deps-upgrade, tests
โ โโโ RELEASE # The release number, vYYYY.MM.N; written only by a release
โ โโโ pip-compile.sh
โ โโโ requirements.txt / requirements-dev.txt
โ โโโ pyproject.toml
โโโ rdf/
โ โโโ 0.4.0/ โฆ 0.4.3/ # One folder per CPRMV version
โ โโโ cprmv.ttl # CPRMV OWL vocabulary
โ โโโ cprmvmethods.ttl # Method registry (acknowledged method lists)
โ โโโ cprmv.shacl.ttl # SHACL shapes for validation
โ โโโ methods/<module>/ # 0.4.2 and later: one folder per method module โ method.ttl, README.md, XSLT
โโโ html/ # ReSpec source for the CPRMV specification (shaclgen.py generates chapters)
โโโ deployment/vm/ # The two VMs: Compose stacks and Caddyfiles per tier, reconciler, provisioning
โโโ scripts/ # CI and release scripts (write-sbom.py) and their tests
โโโ .github/ # Workflows, zizmor configuration, rulesets as JSON
โโโ .claude/commands/ # bump-release.md: cuts a release
โโโ docs/ # Design specs, implementation plans, and the release SBOMs in docs/sbom/
โโโ .gitlab-ci.yml # ReSpec publication only
โโโ README.md
โโโ SECURITY-PIPELINE.md # Register of every pin, the checks and the rulesets
โโโ renovate.json
โโโ METHODS.md # How methods are defined in RDF and implemented in Python
โโโ ROADMAP.md
โโโ CHANGELOG.md
Licence¶
EUPL-1.2