openbasement
A Python library for template-based RDF extraction from EU legislative data published through EU Cellar. It turns rdflib.Graph objects into structured Python dictionaries using declarative YAML templates that encode domain knowledge about the CDM ontology.
Why it exists
EU Cellar publishes legislative procedure data as RDF using the Common Data Model (CDM) ontology. This RDF is rich but awkward to work with directly:
- Predicate aliasing: The same fact appears under 2-3 predicates simultaneously.
- Multilingual literals: Text fields exist in up to 24 EU languages.
- Deep nesting: A procedure contains events, documents, and concept references spread across hundreds of triples.
- Subclass hierarchies: Procedure types use
rdfs:subClassOfrather than a singlerdf:type.
openbasement handles all of this through YAML templates. The templates declare which predicates to look for (with aliases), how to resolve languages, and how to traverse relations. The Python code is generic. All CDM-specific knowledge lives in the templates.
Core contract
Graph in, dicts out. No network I/O, no storage, no graph mutation, no data models.
Next steps
- Getting started: Install from GitHub, run your first extraction, inspect output.
- Templates: Write and customize YAML templates.
- API reference: Public functions and transforms.
- CDM patterns: The ontology quirks that openbasement handles for you.