Plan, apply and roll back changes to a production ontology, with a blast radius report and a proof an auditor can re-check.
Rust ai-nativedescription-logicsformal-verificationinfrastructure-as-codeisabelle-languageknowledge-graphleanlean4mcpmcp-serverontologyowlowl2reasoningrustshaclsparqltheorem-proving
feat: add EPC data mapping example — real UK energy data → IES Building RDF
FABIOTESS39eec66fce91
diff --git a/README.md b/README.mdindex 9d05f6ee..4d3f9e42 100644--- a/README.md+++ b/README.md@@ -338,9 +338,21 @@ onto_pull https://raw.githubusercontent.com/IES-Org/ont-ies/main/docs/specificatonto_shacl```+### Data Mapping: EPC → IES++The repo includes a sample of real UK Energy Performance Certificates ([benchmark/epc/epc-sample.csv](benchmark/epc/epc-sample.csv)) with a mapping config that transforms tabular EPC data into IES-shaped RDF:++```text+onto_load benchmark/generated/ies-building-extension.ttl+onto_ingest benchmark/epc/epc-sample.csv --mapping benchmark/epc/epc-ies-mapping.json+onto_reason --profile rdfs+```++This mirrors NDTP's actual pipeline: CSV → IES RDF → validate → reason → query.+### IES:Building Alignment-The repo includes an [IES Building Extension](benchmark/generated/ies-building-extension.ttl) that models buildings, dwellings, energy performance, and retrofit interventions using IES 4D patterns. Use `onto_align` to map it to other domain ontologies — this mirrors NDTP's active work transforming energy performance data into RDF aligned with IES:Building.+The repo includes an [IES Building Extension](benchmark/generated/ies-building-extension.ttl) that models buildings, dwellings, energy performance, and retrofit interventions using IES 4D patterns. Use `onto_align` to map it to other domain ontologies.### Further Readingdiff --git a/benchmark/epc/epc-ies-mapping.json b/benchmark/epc/epc-ies-mapping.jsonnew file mode 100644index 00000000..d9e50f41--- /dev/null+++ b/benchmark/epc/epc-ies-mapping.json@@ -0,0 +1,90 @@+{+ "class": "http://example.org/ontology/ies-building#Dwelling",+ "base_uri": "http://data.gov.uk/epc/",+ "id_field": "postcode",+ "fields": {+ "postcode": {+ "predicate": "http://example.org/ontology/ies-building#hasPostalCode",+ "datatype": "string"+ },+ "paon": {+ "predicate": "http://www.w3.org/2000/01/rdf-schema#label",+ "datatype": "string",+ "transform": "concat:{paon}, {street}, {towncity}"+ },+ "propertytype": {+ "predicate": "http://ies.data.gov.uk/ontology/ies4#similarEntity",+ "lookup": {+ "D": "http://example.org/ontology/ies-building#DetachedHouse",+ "S": "http://example.org/ontology/ies-building#SemiDetachedHouse",+ "T": "http://example.org/ontology/ies-building#TerracedHouse",+ "F": "http://example.org/ontology/ies-building#Flat"+ }+ },+ "BUILT_FORM": {+ "predicate": "http://example.org/ontology/ies-building#builtForm",+ "datatype": "string"+ },+ "CURRENT_ENERGY_RATING": {+ "predicate": "http://example.org/ontology/ies-building#energyRatingBand",+ "lookup": {+ "A": "http://example.org/ontology/ies-building#BandA",+ "B": "http://example.org/ontology/ies-building#BandB",+ "C": "http://example.org/ontology/ies-building#BandC",+ "D": "http://example.org/ontology/ies-building#BandD",+ "E": "http://example.org/ontology/ies-building#BandE",+ "F": "http://example.org/ontology/ies-building#BandF",+ "G": "http://example.org/ontology/ies-building#BandG"+ }+ },+ "CURRENT_ENERGY_EFFICIENCY": {+ "predicate": "http://example.org/ontology/ies-building#energyScore",+ "datatype": "integer"+ },+ "numberrooms": {+ "predicate": "http://example.org/ontology/ies-building#numberOfRooms",+ "datatype": "integer"+ },+ "MAINHEAT_DESCRIPTION": {+ "predicate": "http://example.org/ontology/ies-building#heatingDescription",+ "datatype": "string"+ },+ "MAIN_FUEL": {+ "predicate": "http://example.org/ontology/ies-building#usesFuel",+ "lookup": {+ "mains gas (not community)": "http://example.org/ontology/ies-building#MainsGas",+ "electricity (not community)": "http://example.org/ontology/ies-building#Electricity",+ "oil (not community)": "http://example.org/ontology/ies-building#Oil",+ "LPG": "http://example.org/ontology/ies-building#LPG"+ }+ },+ "WALLS_DESCRIPTION": {+ "predicate": "http://example.org/ontology/ies-building#wallsDescription",+ "datatype": "string"+ },+ "WALLS_ENERGY_EFF": {+ "predicate": "http://example.org/ontology/ies-building#wallsEfficiency",+ "datatype": "string"+ },+ "ROOF_DESCRIPTION": {+ "predicate": "http://example.org/ontology/ies-building#roofDescription",+ "datatype": "string"+ },+ "WINDOWS_DESCRIPTION": {+ "predicate": "http://example.org/ontology/ies-building#windowsDescription",+ "datatype": "string"+ },+ "FLOOR_DESCRIPTION": {+ "predicate": "http://example.org/ontology/ies-building#floorDescription",+ "datatype": "string"+ },+ "inspectiondate": {+ "predicate": "http://example.org/ontology/ies-building#inspectionDate",+ "datatype": "date"+ },+ "CO2_EMISSIONS_CURRENT": {+ "predicate": "http://example.org/ontology/ies-building#co2Emissions",+ "datatype": "decimal"+ }+ }+}diff --git a/benchmark/epc/epc-sample.csv b/benchmark/epc/epc-sample.csvnew file mode 100644index 00000000..c21aaff1--- /dev/null+++ b/benchmark/epc/epc-sample.csv@@ -0,0 +1,11 @@+postcode,paon,street,towncity,propertytype,BUILT_FORM,CURRENT_ENERGY_RATING,CURRENT_ENERGY_EFFICIENCY,POTENTIAL_ENERGY_RATING,numberrooms,MAINHEAT_DESCRIPTION,MAIN_FUEL,WALLS_DESCRIPTION,WALLS_ENERGY_EFF,ROOF_DESCRIPTION,ROOF_ENERGY_EFF,WINDOWS_DESCRIPTION,WINDOWS_ENERGY_EFF,FLOOR_DESCRIPTION,FLOOR_ENERGY_EFF,HOTWATER_DESCRIPTION,inspectiondate,CO2_EMISSIONS_CURRENT,CO2_EMISS_CURR_PER_FLOOR_AREA+KT22 7LN,BURLEIGH COURT,BELMONT ROAD,LEATHERHEAD,F,Semi-Detached,C,78,C,2,"Boiler and radiators, mains gas",mains gas (not community),"Cavity wall, as built, insulated (assumed)",Good,(another dwelling above),N/A,Fully double glazed,Good,(another dwelling below),NO DATA!,From main system,2019-05-08,1.2,26+RH4 3QR,61,BAILEY ROAD,DORKING,T,Mid-Terrace,D,60,B,5,"Boiler and radiators, mains gas",mains gas (not community),"Cavity wall, as built, no insulation (assumed)",Poor,"Pitched, 50 mm loft insulation",Poor,Fully double glazed,Average,"Suspended, no insulation (assumed)",NO DATA!,From main system,2017-03-10,3.9,50+KT21 2LJ,58,WEST FARM CLOSE,ASHTEAD,S,Semi-Detached,C,73,B,5,"Boiler and radiators, mains gas",mains gas (not community),"Cavity wall, filled cavity",Good,"Pitched, 150 mm loft insulation",Good,Fully double glazed,Average,"Solid, no insulation (assumed)",N/A,From main system,2013-03-22,3.9,28+KT22 7TQ,12,RANDALLS ROAD,LEATHERHEAD,D,Detached,D,62,B,7,"Boiler and radiators, mains gas",mains gas (not community),"Cavity wall, as built, no insulation (assumed)",Poor,"Pitched, 25 mm loft insulation",Poor,Fully double glazed,Good,"Solid, no insulation (assumed)",NO DATA!,From main system,2016-07-02,6.3,42+KT21 2DJ,WOODLODGE,WOODFIELD LANE,ASHTEAD,F,Mid-Terrace,D,68,C,4,"Boiler and radiators, mains gas",mains gas (not community),"Cavity wall, as built, no insulation (assumed)",Poor,(another dwelling above),N/A,Fully double glazed,Average,"Solid, no insulation (assumed)",NO DATA!,From main system,2017-08-07,2.5,40+KT22 7DX,HOLLY COURT,BELMONT ROAD,LEATHERHEAD,F,Mid-Terrace,B,82,B,2,Electric storage heaters,electricity (not community),"Cavity wall, as built, insulated (assumed)",Good,(another dwelling above),N/A,Fully double glazed,Average,(other premises below),N/A,"Electric immersion, off-peak",2014-11-24,1.7,39+LE3 9QA,4D,STRATHERN ROAD,LEICESTER,F,Semi-Detached,C,74,C,3,Electric storage heaters,electricity (not community),"Cavity wall, as built, insulated (assumed)",Good,(another dwelling above),N/A,Fully double glazed,Average,(other premises below),N/A,"Electric immersion, off-peak",2013-02-28,3.2,52+KT22 9TB,45,THE GLADE,LEATHERHEAD,D,Detached,E,39,C,5,"Boiler and radiators, mains gas",mains gas (not community),"Cavity wall, as built, no insulation (assumed)",Poor,"Pitched, 100 mm loft insulation",Average,Fully double glazed,Average,"Solid, no insulation (assumed)",NO DATA!,From main system,2015-05-14,8.3,72+RH4 1HH,36,CANTERBURY COURT,DORKING,F,Enclosed End-Terrace,B,84,B,3,Electric storage heaters,electricity (not community),"Cavity wall, as built, insulated (assumed)",Good,(another dwelling above),N/A,Fully double glazed,Average,(other premises below),N/A,"Electric immersion, off-peak",2011-04-20,1.6,31+RH3 7EA,BUCKLAND COURT COTTAGE,REIGATE ROAD,BETCHWORTH,D,Detached,E,44,B,4,"Boiler and radiators, mains gas",mains gas (not community),"Solid brick, as built, no insulation (assumed)",Very Poor,"Pitched, 300 mm loft insulation",Very Good,Some double glazing,Poor,"Suspended, no insulation (assumed)",NO DATA!,From main system,2018-02-15,6.4,77diff --git a/docs/ies-ecosystem.md b/docs/ies-ecosystem.mdindex 2806ae2d..04b2b64c 100644--- a/docs/ies-ecosystem.md+++ b/docs/ies-ecosystem.md@@ -54,7 +54,56 @@ onto_statsRDFS materialises **+3,094 inferred triples** (77% growth) — transitive subclass chains across 241 State subclasses, 117 ClassOfEntity subclasses, and 102 Event subclasses.-### Step 3: Explore with SPARQL+### Step 3: Ingest Real EPC Data++The repo includes a sample of 10 real UK Energy Performance Certificates from the Open Data Communities register ([benchmark/epc/epc-sample.csv](../benchmark/epc/epc-sample.csv)) with a pre-built mapping config ([benchmark/epc/epc-ies-mapping.json](../benchmark/epc/epc-ies-mapping.json)).++```text+# Load IES Building Extension as the target ontology+onto_validate benchmark/generated/ies-building-extension.ttl+onto_load benchmark/generated/ies-building-extension.ttl++# Generate or review the mapping (CSV columns → IES predicates)+onto_map benchmark/epc/epc-sample.csv++# Ingest the CSV data using the mapping+onto_ingest benchmark/epc/epc-sample.csv --mapping benchmark/epc/epc-ies-mapping.json++# Check what was created+onto_stats++# Reason to materialise inferred triples+onto_reason --profile rdfs++# Query: which dwellings have poor energy ratings?+onto_query "SELECT ?dwelling ?rating WHERE {+ ?dwelling a <http://example.org/ontology/ies-building#Dwelling> .+ ?dwelling <http://example.org/ontology/ies-building#energyRatingBand> ?rating .+ FILTER(?rating IN (+ <http://example.org/ontology/ies-building#BandE>,+ <http://example.org/ontology/ies-building#BandF>,+ <http://example.org/ontology/ies-building#BandG>+ ))+}"+```++The mapping config maps CSV columns to IES Building predicates:++| CSV Column | IES Predicate | Type |+| --- | --- | --- |+| `postcode` | `bldg:hasPostalCode` | string |+| `propertytype` | `ies:similarEntity` → ClassOfBuilding | lookup (D→Detached, S→Semi, T→Terraced, F→Flat) |+| `CURRENT_ENERGY_RATING` | `bldg:energyRatingBand` | lookup (A-G → BandA-BandG) |+| `CURRENT_ENERGY_EFFICIENCY` | `bldg:energyScore` | integer |+| `MAIN_FUEL` | `bldg:usesFuel` → FuelType | lookup (mains gas→MainsGas, etc.) |+| `MAINHEAT_DESCRIPTION` | `bldg:heatingDescription` | string |+| `WALLS_DESCRIPTION` | `bldg:wallsDescription` | string |+| `inspectiondate` | `bldg:inspectionDate` | date |+| `CO2_EMISSIONS_CURRENT` | `bldg:co2Emissions` | decimal |++This mirrors NDTP's actual pipeline: take tabular EPC data, map it to IES-shaped RDF, validate, reason, and query.++### Step 4: Explore with SPARQLSee [ies-examples.md](ies-examples.md) for 5 ready-to-use queries. Quick taste:@@ -67,7 +116,7 @@ onto_query "SELECT (COUNT(DISTINCT ?c) AS ?count) WHERE {# Result: 241```-### Step 4: Load Example Data+### Step 5: Load Example DataIES has ~42 example Turtle files across its repos. Pull them directly:@@ -98,7 +147,7 @@ onto_pull https://raw.githubusercontent.com/telicent-oss/ies-examples/main/additonto_pull https://raw.githubusercontent.com/telicent-oss/ies-examples/main/regions_of_the_world/countries.ttl```-### Step 5: SHACL Validation+### Step 6: SHACL ValidationIES provides SHACL shapes for data validation:@@ -119,7 +168,7 @@ onto_pull https://raw.githubusercontent.com/IES-Org/ies-core/main/spec/validatioonto_pull https://raw.githubusercontent.com/IES-Org/ies-core/main/spec/validation_artefacts/DeathStateShape.shacl.ttl```-### Step 6: Alignment+### Step 7: AlignmentMap IES to other domain ontologies: