Semantic Layer course
Knowledge layer 25 min ConsistencyExplainability

The metric store

Stop letting the model invent the arithmetic

Section 1

A question with no wrong answer

Next section
Section 2

A registry instead of an improvisation

Next section
Section 3

Meridian's first five metrics

Next section
Section 4

The same question, five times

Next section
Section 5

How a metric gets resolved at query time

Next section
Section 6

Build the NPL ratio yourself

Next section
Section 7

When the definition changes

Hands on

Govern a metric

25 min

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.

make lab-up            # once, starts Postgres + Fuseki + Ontop
make lab lab09-metric-store

Full instructions, starter files and the solution are in labs/modules/lab09-metric-store/README.md. The lab checks its own work, so you will know if it passed.

Check yourself

Quiz

7 questions, pass mark 70%. Answers are explained either way, so a wrong guess is not wasted.

1 An agent with no metric store answers "average processing time" as 11.4 days on Tuesday and 9.2 days on Thursday, with no data change. Which ACE property failed?
2 Why does deterministic metric resolution serve ACE better than asking a capable model to compose the aggregation each time?
3 Which two properties does the guidance require of a metric definition, and why? (pick two)

Select all that apply.

4 Meridian's NPL ratio definition sets its numerator filter to "?loan a mrb:NonPerformingLoan" rather than to a days-past-due comparison. What does that buy?
5 Total Group Exposure uses SUM(DISTINCT ?outstandingBalance) over a UNION of borrowed and guaranteed loans. Why DISTINCT?
6 The regulator changes the NPL ratio definition in April 2026. What does the metric store do?
7 What does the SHACL shape for metric definitions enforce that prevents the original ambiguity returning?