Labs
Every lab runs against one shared stack, started once. The stack grows as you go: module 3 puts triples in Fuseki, module 8 adds Postgres and Ontop over it, module 10 adds a vector index. Labs are written so you can jump straight to any one of them, because each seeds whatever it needs.
Start the stack
git clone <this repo> semantic-layer-course
cd semantic-layer-course
make lab-up # Postgres 5432, Fuseki 3030, Ontop 8080
make lab-status # confirms all three answer
Needs Docker and about 3 GB of RAM. Stop it with make lab-down,
wipe it with make lab-reset.
| # | Lab | What you end up with | Time | Status |
|---|---|---|---|---|
| 01 |
Reproduce the disagreement
make lab lab01-two-answers
|
Run three defensible SQL queries against one loan book and get three different default counts. | 15 min | todo |
| 02 |
Watch consistency break
make lab lab02-ace-coinflip
|
Run one natural-language loan question through a non-deterministic scorer five times and get five answers, then run the same question through a deterministic SPARQL rule five times and get one. | 20 min | todo |
| 03 |
Load Priya's mortgage into a triple store
make lab lab03-first-triples
|
Write valid Turtle for customer C-1001 and loan L-1042, load it into Apache Jena Fuseki, and verify the triple count with a query. | 20 min | todo |
| 04 |
Answer the CRO's question three ways
make lab lab04-sparql-drills
|
Run all three default definitions as SPARQL against Fuseki and reproduce the counts 1,847, 4,102 and 1,203 from one unchanged graph. | 30 min | todo |
| 05 |
Write the Meridian T-Box
make lab lab05-build-ontology
|
Author meridian.ttl with the class hierarchy, properties with domain and range, disjointness and functional axioms; load it into Fuseki; run a SPARQL query that lists every class and its parent. | 35 min | todo |
| 06 |
Catch the bad loan data
make lab lab06-shacl-gate
|
Write shapes.ttl, run pySHACL against the Meridian graph, get violations for Tobias's missing KYC document and an out-of-range credit score, then fix the data and get sh:conforms true. | 25 min | todo |
| 07 |
Derive the default set
make lab lab07-run-reasoner
|
Run an OWL reasoner (owlrl, or ELK via Jena) over the Meridian ontology plus data, produce the inferred named graph, then query the three default classes and see L-2087 in Operational only, L-4590 in Regulatory and Operational, and L-5150 in all three. | 35 min | todo |
| 08 |
Query Postgres as a graph
make lab lab08-ontop-vkg
|
Load Meridian's loan tables into Postgres, write the R2RML mapping, start Ontop as a SPARQL endpoint over it, then run the same SPARQL query from Module 4 and get the same answer with no data having moved. | 40 min | todo |
| 09 |
Govern a metric
make lab lab09-metric-store
|
Define the non-performing loan ratio and total exposure as MetricDefinition triples, write a SHACL shape that validates metric definitions are well formed, then run a query that resolves a metric by name and returns the number plus its definition provenance. | 25 min | todo |
| 10 |
Make the credit policy queryable
make lab lab10-graphrag
|
Chunk the Meridian Credit Policy PDF, extract concepts, build a small lexical graph in Fuseki, embed the chunks into a local vector index, then run a hybrid retrieval that answers the arrears question with a page citation and links the answer to the ontology class. | 40 min | todo |
| 11 |
Induce and review
make lab lab11-induction
|
Auto-generate a candidate ontology plus R2RML mappings from Meridian's Postgres schema into a draft named graph, run ELK for consistency, diff it against your hand-written ontology, then promote the good parts and reject the bad. | 35 min | todo |
| 12 |
Wire the whole thing up
make lab lab12-qa-agent
|
Run a local Q&A agent that classifies intent against the ontology, generates SPARQL, executes against Fuseki plus Ontop, runs the reasoner, retrieves a document citation, and returns the full answer plus evidence plus citations plus reasoning_steps JSON for the default question and for Daniel's application. | 45 min | todo |
| 13 |
Ship it on your tailnet
make lab lab13-deploy
|
Run the full course stack with docker compose, verify each service is healthy, confirm the course app persists your progress across a container restart, and expose it over Tailscale. | 30 min | todo |