Work / Demonstration · CSV to Ontology

Schema Alignment · RDFLib + pySHACL

CSV to Ontology: turning tables into validated BFO graphs

Most enterprise data starts in spreadsheets, not Turtle. CSV to Ontology profiles a CSV table, lets you bind classes, columns, and relations from closed BFO/CCO lists, and deterministically generates the OWL ontology, SHACL shapes, and RDF instance graph — then runs pyshacl to flag bad rows.

Constrained modeling pattern

Closed choices in, deterministic graphs out

In a production pipeline, an LLM or domain expert proposes mappings from closed vocabularies; everything after those choices is 100% deterministic code.

1. Profile & QUDT units

Infers datatypes (integer, decimal, date, boolean, string) using an 80% parse threshold so outliers become SHACL violations, and resolves known suffixes (e.g., _c → DEG_C, _w → W, _v → V, _a → A, _min → MIN) to QUDT unit IRIs.

2. BFO & CCO categories

Each class picks from 7 upper categories (material entity, material artifact, site, process, quality, role, information content entity). Relations (has input, has output, has participant, occurs in, etc.) are filtered by valid subject/object BFO kinds.

3. OWL + SHACL + RDF

Generates three separate Turtle artifacts — ontology, SHACL shapes, and row-derived RDF instances — and runs pyshacl.validate to pinpoint offending CSV row numbers and columns.

Worked synthetic table

PV module lamination & flash-test sample

The preloaded 5-row CSV contains two deliberate defects so you can immediately observe how SHACL catches bad tabular records.

module_serial,cell_batch_id,laminator_id,lamination_temp_c,lamination_time_min,pmax_w,voc_v,isc_a,test_date
M-1001,CB-17,LAM-2,148.5,14,402.1,49.2,10.31,2026-11-02
M-1002,CB-17,LAM-2,149.0,14,398.7,49.0,10.28,2026-11-02
M-1003,CB-18,LAM-1,151.2,15,n/a,48.8,10.22,2026-11-03
,CB-18,LAM-1,150.4,15,401.3,49.1,10.30,2026-11-03
M-1005,CB-19,LAM-2,147.9,14,405.0,49.4,10.35,2026-11-04
CSV row Column Defect in sample SHACL finding
Row 3 (M-1003) pmax_w Literal string n/a in a decimal column Datatype violation against xsd:decimal
Row 4 module_serial Blank identifier cell Cardinality / missing required identifier

Turn your spreadsheets into governed graphs

We build reproducible CSV/SQL-to-RDF ingestion pipelines with BFO/CCO alignment, QUDT unit normalization, and CI-ready SHACL gates.

Scope & limits

  • Closed unit dictionary: only recognized column-name suffixes resolve to QUDT IRIs so units are never invented.
  • Browser execution: CSV profiling, RDF serialization, and pyshacl run client-side in WebAssembly.
  • Human-in-the-loop choices: you select the classes, column assignments, and relations; production pipelines pair this with SME review.