DEV Community

Cover image for One Ontology for a Stadium's Gate HOLD Calls
Aniket Hingane
Aniket Hingane

Posted on Edited on

One Ontology for a Stadium's Gate HOLD Calls

Cover

How I Modeled Promoters, Venues, and Turnstile Queues with Apache Ossie

TL;DR

I got tired of three notebooks that each invented a different meaning for "gate hold" during a fake doors-open window. One used queue seconds. One used occupancy. One used a gut feel typed into a status cell. BowlGate is the laptop experiment I wrote so those moods had to become named concepts in an Apache Ossie (incubating) ontology, with a semantic model for the tables and a mapping document that connects the two. It is a PoC. North Rim Promotions is invented. Nobody scanned these tickets.

The three files are models/venue.ontology.yaml, models/venue.semantic_model.yaml, and models/venue.mapping.yaml. The fact grain on the ontology side is ScanEvent. The path to a promoter runs scanner -> installed_at -> run_by, or the derived shortcut operated_for. HoldScan is a derived subtype where status equals HOLD. On this sample of 6,000 scans, seed 19, the generated SQL prints North Rim Promotions at 11.45 average queue seconds with 230 HOLD scans, and Harbor Lights Events at 4.92 seconds with 12 HOLD scans. Seattle alone accounts for 186 of the HOLDs. Austin has zero. Value-type checks report zero violations. The code is at https://github.com/aniket-work/BowlGate.

I learned the three-document split from the Data for AI folder https://github.com/aniket-work/data-for-ai/tree/main/03-ontology-with-apache-ossie and the matching video https://youtu.be/TV70PHBNNPk. That lesson uses IoT telemetry. I kept the validate / verbalize / SQL loop and remapped the nouns onto sports-venue gate ops so I would stop copying the cold-chain story into every ontology drill.

Introduction

The first version of this experiment lived in a spreadsheet I opened after a concert I did not attend. I had pasted a few gate IDs, typed a queue estimate, and decided "too slow" in the header while the coffee was still hot. The next morning I opened a second sheet for section occupancy and the cutoff drifted by five seconds because I had forgotten the first sheet. Both sheets still looked official. They were two moods wearing column names.

Sports venues gave me a clean place to stop doing that without walking back into a hospital, a warehouse, or a ledger. I wanted a promoter, a venue, a gate scanner, and a scan that carries queue seconds, throughput, occupancy, and a status that means one thing. That is a small world. I can hold it in three YAML files and one CSV. I named the project BowlGate. It is my PoC. The promoters and cities are invented so the rows have a story. It is not a stadium I staff, and it is not work I did for an employer.

I had already run the IoT version of this loop once. Same Ossie documents, different nouns, cold-chain temperatures instead of queues. Copying that folder and find-replacing Sensor with Gate would have "worked" in the shallow sense. It also would have left me with relationships that still smelled like warehouses. I rewrote the ontology from the question outward instead. That took longer. It also forced me to drop ideas that only existed because the IoT example had them. Pressure in hectopascals has no seat in a turnstile brief. Backup scanners do, because a dead handheld at door four is a real ops sentence.

I started from the question I actually wanted the brief to answer. Which promoter in this sample owns the longest average queue, and how many HOLD scans sit under that name? "HOLD" had to become a rule or the question was a shrug. In the generator I set HOLD when queue_seconds is 22 or higher. Then I had to say the same rule in the ontology as a derived subtype, or the chart would invent a second definition later. From my experience, if the threshold lives only in a notebook title, I will quietly move it when the picture looks kinder.

Seattle is the boundary I care about for pressure. 186 HOLD scans out of 1,500 for that city. Average queue 13.83 seconds. If I had written HOLD as "queue at or above 30," Seattle would still lead and the rest of the map would go quiet, and the story would flatten into one angry city. I wanted Portland and Denver to keep a few HOLDs so the promoter rollup could disagree with a single-city panic.

Austin is the holdout I care about for calm. Zero HOLD scans. Average queue 3.00 seconds. A venue that runs busy-but-stable still has to show up in the average table, or I start pretending the map only contains spike cities. I kept Austin in the sample on purpose so Harbor Lights would not look like chaos just because Denver threw twelve HOLDs.

Throughput sits in the CSV even though the promoter SQL does not average it. I left it there as a temptation I refused. A chart that optimizes for scans per minute can hide a miserable wait if the lane is moving a miserable wait quickly. Occupancy is the same kind of trap. A section can be 70 percent full with a short gate line, or 55 percent full with a stuck scanner. I kept both measurements as properties on ScanEvent so I would stop collapsing them into one "busy" flag. The brief I ship in this article answers the queue question. The other columns are there so I remember what I chose not to optimize.

Title diagram

What's This Article About?

I walk through how I built the Ossie documents, in the order I wish I had used the first time. The question comes first. Then the entity types. Then the value types. Then the semantic model tables. Then the mapping. Then the validator. Then the teaching SQL that expands a derived relationship. The code under Let's Get Cooking is the same code the demo runs.

You will see why operated_for is derived instead of stored, why HoldScan extends ScanEvent instead of becoming a second fact table, and why I pinned apache/ossie to commit 74a26be. Setup is the clone path on GitHub. The run section is the promoter table, the Seattle line, and the chart. If you only want the repo, start at https://github.com/aniket-work/BowlGate. README.md has the same images and the same counts.

The teaching origin still matters. The IoT ontology diagram from the source lesson is the shape I remapped:

Source IoT ontology shape

Customer became Promoter. Site became Venue. Sensor became GateScanner. SensorReading became ScanEvent. AlertReading became HoldScan. Same arrows. Different nouns. The video that walks the original loop is here: https://youtu.be/TV70PHBNNPk.

Tech Stack

I kept the list short. An ontology experiment that needs a graph database before the first table is an experiment I will not rerun on a weeknight.

  1. Python 3.11+ is the runtime I used for the loader, the demo, and the chart.
  2. Apache Ossie (incubating) supplies the JSON Schemas, the official validator, and the Python SDK. I clone it beside the project and pin commit 74a26be.
  3. Three YAML documents under models/: ontology, semantic model, mapping.
  4. SQLite via build_db.py, loaded from data/gate_scans.csv.
  5. jsonschema and referencing for Draft 2020-12 checks against the local schemas.
  6. rich for the terminal tables the GIF mirrors.
  7. matplotlib for the HOLD-by-city bar chart.
  8. PyYAML to read the documents the validator already accepted.

I skipped a hosted language model. The brief I wanted is a table of named joins and a CASE on HOLD, and a model that paraphrases "gate hold" would be a second definition. I skipped a cloud warehouse. Six thousand rows fit in SQLite. A warehouse would have let me hide the rules inside a view, which is the habit I was trying to quit. I also skipped streaming turnstile feeds. Continuous ingest is a real next step. It is also a different failure mode, and I wanted the three documents alone first.

Prefixes and IRIs are in the stack even though the SQL never prints them. Promoter carries schema:Organization. Venue carries schema:Place. I expanded those in the concepts view once to confirm the prefix map worked. Linking out to schema.org does not make the PoC interoperable with the world. It does make me write down which public word I meant when I said organization. That is enough for this experiment.

Architecture

The picture matches the runtime. build_db.py materializes four tables. ossie_demo.py validate runs schema checks, the official validator, and an SDK load. ossie_demo.py sql walks the ontology, expands operated_for, and executes the joins. Sample rows stay in data/gate_scans.csv so the article, the README, and the GIF describe one run.

Why Read It?

Read it if you have a folder of event-day notes that each redefine the same operational word. This experiment fails in an obvious way. If the CSV says HOLD and a query invents queue_seconds > 40, the laptop brief and the ontology stop agreeing. I left that disagreement visible on purpose. The useful claim is not that Seattle is chaos. The useful claim is that I can point at one status column and one derived subtype and say "this is the HOLD I meant."

I also wrote it for the narrower case where someone already watched an ontology demo on IoT data and still does not know how to start on their own nouns. Remapping is work. The video https://youtu.be/TV70PHBNNPk teaches the loop. BowlGate is my attempt to prove the loop survives a domain change without dragging temperature and humidity into a stadium. If your domain is construction logistics or broadcast tower telemetry, the same three files still apply. Change the concepts. Keep the validate step. Do not skip the pin on the Ossie commit.

A few choices are the ones I would repeat.

  1. Keep three documents. Meaning, tables, and the bridge do not share a file. When a field name drifts, the mapping fails loudly instead of a join quietly returning empty.
  2. Derive the promoter hop. GateScanner.operated_for is not a column. It is installed_at.run_by. Storing it would have duplicated a fact the venue already owns.
  3. Put HOLD in a subtype, not a second grain. HoldScan extends ScanEvent. I did not invent a parallel fact with a different primary key.
  4. Pin the Ossie commit. Spec 0.3.0.dev0 moves. Main HEAD rejected my semantic model through the SDK the week I tried it. 74a26be matches the teaching lesson I copied the loop from.
  5. Leave a calm city in the sample. Austin at zero HOLD is the row that keeps me honest when the bar chart turns red.

I do not think this replaces a venue operations platform. I think it is a decent skeleton for a local brief when the raw scan is already a CSV. The GitHub project includes the GIF so you can see the same 230 / 12 split I am quoting here.

Let's Design

Before classes, I wrote the question and the cutoff on paper.

  1. Question. Which promoter has the highest average queue, and how many HOLD scans sit under that name?
  2. Grain. One scan event, meaning one measurement from one gate at one timestamp.
  3. HOLD. Status equals HOLD, generated when queue seconds are 22 or higher.
  4. Also show. Value-type ranges on queue, throughput, occupancy, and status so a typo cannot invent a new end of the scale.

That list kept me from adding a class every time a noun sounded important. Section, usher, and ticket tier are real words around venues. They are not in the file, because none of my questions used them. I would rather add a class when a relationship needs it than decorate the YAML.

One scan, three hops

A semantic model gets muddy when two things both claim to be the row. I made ScanEvent the measurement. GateScanner, Venue, and Promoter are the things I navigate through. I am using "ontology" here in the Ossie sense: concepts, relationships, verbalizations, and rules. I did not build a reasoner that invents new scans. Four entity types and a validator were enough.

  1. Promoter is the organizer I want the rollup over. North Rim Promotions, Harbor Lights Events. The key is promoter_id.
  2. Venue is the arena in a city. SEA-01, PDX-01, DEN-01, AUS-01. Each points at one promoter through run_by.
  3. GateScanner is the device at a gate. Twenty of them. Two are marked as backups for a primary at the same venue.
  4. ScanEvent is identified by scanner plus timestamp. Queue, throughput, occupancy, status hang off that compound key.

The derived relationship I care about is GateScanner.operated_for. It verbalizes as "GateScanner is operated for Promoter" and expands to installed_at.run_by. The shortest ontology path from ScanEvent to Promoter uses that derived edge. The teaching SQL then expands it so the joins are real tables.

Sequence

Value types are the ranges I refuse to negotiate later

On the measurement side the value types are the windows I wanted the checker to enforce.

  1. QueueSeconds is 0 through 600. A negative wait is a bug. A ten-minute typed wait is outside this sample on purpose.
  2. ThroughputPerMin is 0 through 120. I do not need a physics model. I need a typo net.
  3. OccupancyPct is 0 through 100. Same reason.
  4. StatusCode is only OK or HOLD. A third string is a schema bug, not a new mood.

Each value type carries a one-line requires expression. The demo turns those into WHERE NOT (...) counts. On this sample every count is zero. That is not proof the business rule is wise. It is proof the CSV obeyed the windows I wrote down.

Why I kept the Ossie document split

Ossie three documents

The diagram above is the same three-document picture from the teaching lesson. I kept it because the failure modes are different.

  1. Ontology alone can be beautiful and unconnected. Verbalizations do not join tables.
  2. Semantic model alone can join anything. It does not say what a HOLD is.
  3. Mapping alone is where a typo in a field name dies. JSON Schema may still pass. The official mapping validator catches a field the dataset does not declare.

I broke a mapping on purpose once during the IoT lesson by renaming ts to tz. The schema stayed happy. The validator reported the missing field three times. That is the habit I wanted in BowlGate too. Meaning stays in the ontology. Columns stay in the semantic model. The bridge is the only place they meet.

I also care about ai_context more than I expected. The ontology carries instructions, synonyms, and example questions. I wrote three examples I would actually ask: longest average queue by promoter, average queue seconds per promoter, HOLD scans per promoter. Those lines do not execute. They do stop me from inventing a fourth question that needs a class I refused to add. If a future agent reads the file, I want it to see the same three questions I designed for, not a free-for-all over every noun in a stadium.

Verbalizations are the other quiet feature. {GateScanner} is installed at {Venue} sounds obvious until you write {GateScanner} belongs to {Venue} and realize "belongs" could mean ownership, staffing, or cabling. I kept "installed at" because the scanner is hardware at a door. The backup relationship needed a named role on the second GateScanner so the sentence could say {GateScanner:primary} without ambiguity. That naming rule felt pedantic the first time. It saved me from a self-join I could not read the next morning.

Flow

Theory I actually used, not the syllabus version

I am not going to pretend BowlGate is a full enterprise ontology program. A few distinctions did earn their keep while I wrote the YAML.

A semantic model, in the Ossie core sense, is closer to "here are my datasets, fields, and joins." An ontology is closer to "here are the business things and the rules that always hold." A mapping is the bridge. People use "semantic layer" for a service that answers metric queries. I did not build that service. I built three files and a demo that generates one teaching query. Saying that out loud keeps me from claiming MetricFlow work I did not do.

Entity types versus value types also mattered. Promoter is an entity. QueueSeconds is a value type with a range. If I had made queue an entity, I would have started minting identifiers for every distinct wait estimate, which is nonsense for this sample. If I had made promoter a value type, I would have lost the place to hang run_by. The rule of thumb I used: if I need to point at it from more than one place, it is probably an entity. If it is a typed measurement with a window, it is a value type.

Multiplicity is the last theory bit I refused to hand-wave. ManyToOne on installed_at means each scanner determines at most one venue. OneToOne on identifiers means the id relationship is many-to-one both ways for that binary link. I read those sentences out of ossie_demo.py verbalize and checked they matched the sample. Twenty scanners, four venues, no scanner in two cities. The file and the CSV agree. That is the whole theory section I needed for this PoC.

Let's Get Cooking

The cooking section is the code the demo actually runs. I am not pasting the entire YAML. I am pasting the cuts that decide the brief.

Build the SQLite file

build_db.py turns the CSV into four tables. Promoters and venues are tiny reference lists. Scanners come from distinct gate IDs. Scans are the 6,000 rows.

PROMOTERS = [
    ("P-100", "North Rim Promotions"),
    ("P-200", "Harbor Lights Events"),
]
VENUES = {
    "Seattle": ("SEA-01", "P-100"),
    "Portland": ("PDX-01", "P-100"),
    "Denver": ("DEN-01", "P-200"),
    "Austin": ("AUS-01", "P-200"),
}
BACKUPS = {"gate-005": "gate-004", "gate-015": "gate-014"}
Enter fullscreen mode Exit fullscreen mode

I put both West Coast venues under North Rim on purpose. If HOLD pressure lives in Seattle and Portland, the promoter rollup should show it without me hand-writing a third aggregation. Harbor Lights gets Denver and Austin so one calm city can dilute one mild spike. That is a sample design choice, not a claim about real promoters.

Derived promoter hop

In the ontology, the scanner does not store a promoter foreign key.

- name: operated_for
  description: Derived by navigating scanner -> venue -> promoter
  roles: [concept: Promoter]
  multiplicity: ManyToOne
  verbalizes: ['{GateScanner} is operated for {Promoter}']
  derived_by: ['GateScanner.installed_at.run_by(Promoter)']
Enter fullscreen mode Exit fullscreen mode

I almost stored promoter_id on scanners. That would have worked until a venue changed promoters and half the historical scans lied. Deriving the hop keeps the venue as the owner of the relationship. The teaching SQL expands the derived edge before it emits JOINs. In my opinion that is the whole point of writing derived_by instead of another column.

HOLD as a subtype

- concept: HoldScan
  type: EntityType
  description: A scan whose status is HOLD. Its population is derived, not stored.
  extends: [ScanEvent]
  derived_by: ["ScanEvent.status == 'HOLD'"]
Enter fullscreen mode Exit fullscreen mode

HoldScan is not a second primary key. It is a filter with a name. The SQL generator turns that expression into CASE WHEN scans.status = 'HOLD' THEN 1 ELSE 0 END. If I had written the CASE with a different threshold, the ontology and the query would disagree, and I would have recreated the spreadsheet habit inside a fancier file.

Mapping a compound identifier

Scan events are identified by scanner plus time. The mapping uses referent mappings for that compound key.

- concept: ScanEvent
  object_mappings:
  - referent_mappings:
    - relationship: scanner
      referent_mappings:
      - relationship: id
        expression: scans.gate_id
    - relationship: taken_at
      expression: scans.ts
Enter fullscreen mode Exit fullscreen mode

I care about this block because a simple expression: scans.gate_id would have pretended the grain was the gate, not the scan. The compound form forces every measurement link to hang off both halves. When I came back the next day, that nesting still looked ugly. It also still matched how I think about a turnstile reading.

Walking the ontology path in code

The demo's path finder is small on purpose. It only walks binary relationships between entity types, including derived ones, then expands derived_by into concrete hops.

path = shortest_path(C, "ScanEvent", "Promoter")
# ScanEvent -> scanner -> GateScanner -> operated_for -> Promoter
hp = hops(C, path)
# expands operated_for into installed_at -> run_by
Enter fullscreen mode Exit fullscreen mode

I care about that expansion because the shortest path is not the join path. The shortest path is a sentence. The join path is three tables. If I had emitted SQL against operated_for as if it were a column, the query would have failed in a confusing way. Expanding first keeps the failure mode obvious: either the mapping names real fields, or it does not.

The generated SQL

After expansion, the demo prints a query shaped like this:

SELECT promoters.promoter_name AS promoter,
       ROUND(AVG(scans.queue_seconds), 2) AS avg_queue_seconds,
       SUM(CASE WHEN scans.status = 'HOLD' THEN 1 ELSE 0 END) AS hold_scans,
       COUNT(*) AS scans
FROM scans
JOIN scanners ON scans.gate_id = scanners.gate_id
JOIN venues ON scanners.venue_code = venues.venue_code
JOIN promoters ON venues.promoter_id = promoters.promoter_id
GROUP BY promoter
ORDER BY avg_queue_seconds DESC;
Enter fullscreen mode Exit fullscreen mode

On seed 19 that returns North Rim at 11.45 / 230 / 3000 and Harbor Lights at 4.92 / 12 / 3000. I did not type those joins by hand for the brief. I typed the ontology path and let the mapping fill the column names. The SQL helper is teaching code. It is not an Ossie runtime feature, and the README says so out loud.

I also print Mermaid to out/venue_ontology.mmd during checks. That file is a sketch of entity edges, including the derived ones and the HoldScan extension. It is not the title diagram. It is the doodle I want when I forget which way run_by points.

Value-type checks

The checker walks value types with requires, finds the mapped column, and counts violations.

QueueSeconds       (scans.queue_seconds >= 0) AND (scans.queue_seconds <= 600)   violations: 0
ThroughputPerMin   (scans.throughput_per_min >= 0) AND (... <= 120)              violations: 0
OccupancyPct       (0 <= scans.occupancy_pct) AND (scans.occupancy_pct <= 100)   violations: 0
StatusCode         (scans.status = 'OK' OR scans.status = 'HOLD')                violations: 0
Enter fullscreen mode Exit fullscreen mode

Zero is the number I wanted for this article. If I inject a status of SLOW, the StatusCode line flips. That is the failure I trust more than a green dashboard badge.

Let's Setup

Step by step details can be found at:

  1. Clone the project. git clone https://github.com/aniket-work/BowlGate.git then cd BowlGate.
  2. Clone Ossie beside it. git clone https://github.com/apache/ossie.git then cd ossie && git checkout 74a26be && cd ...
  3. Create a venv inside the project. python -m venv .venv && source .venv/bin/activate.
  4. Install. pip install -r requirements.txt ./ossie/python.
  5. Build the database. python build_db.py should print 2, 4, 20, and 6000.
  6. Validate. python ossie_demo.py validate should end with All checks passed.
  7. Ask the question. python ossie_demo.py sql prints the promoter table.
  8. Optional chart. python chart_holds.py writes images/hold-chart.png.

If validate fails on SDK load against main, you are probably not on 74a26be. I hit that the first night I tried a fresh clone. The JSON Schema checks can still pass while the SDK model shape has moved. Pinning the commit is not pedantry here. It is how the experiment stays runnable.

The teaching video for the original IoT loop is https://youtu.be/TV70PHBNNPk. The folder that ships that loop is https://github.com/aniket-work/data-for-ai/tree/main/03-ontology-with-apache-ossie. BowlGate is the venue remapping I ran after watching it.

Let's Run

I run the same path every time I change a verbalization, because verbalizations do not execute and I forget that.

python build_db.py
python ossie_demo.py all
python chart_holds.py
Enter fullscreen mode Exit fullscreen mode

all covers validate, explain, sql, and checks. The explain path prints entity types, expanded IRIs, and every relationship as a sentence. I read the operated_for line out loud once. If the sentence sounds wrong, the join path is probably wrong too.

The promoter table I trust for this sample:

  1. North Rim Promotions — average queue 11.45 seconds, 230 HOLD scans, 3,000 scans.
  2. Harbor Lights Events — average queue 4.92 seconds, 12 HOLD scans, 3,000 scans.

City detail underneath that rollup:

  1. Seattle — 186 HOLD, average queue 13.83 seconds.
  2. Portland — 44 HOLD, average queue 9.06 seconds.
  3. Denver — 12 HOLD, average queue 6.85 seconds.
  4. Austin — 0 HOLD, average queue 3.00 seconds.

HOLD chart

North Rim looks worse because Seattle and Portland both sit under P-100. Harbor Lights looks calmer because Austin dilutes Denver. If I had grouped by city only, I would have said "fix Seattle" and stopped. The ontology question forced the promoter name into the answer. That is the disagreement I wanted visible.

I also break the mapping on purpose when I want to remember the validator's voice. Rename scans.ts to scans.tz in a temp mapping copy and run the official validator with the mapping schema. JSON Schema may still smile. The validator reports that dataset scans declares no field tz. Then I delete the temp file. The real mapping stays pinned to ts.

Edge cases I checked by hand

A few rows and rules are the ones I keep coming back to.

  1. Backup scanners. gate-005 backups gate-004 at the same venue. The ontology requires GateScanner.installed_at == primary.installed_at. A cross-venue backup would be a model lie.
  2. Compound identity. Two scans can share a gate and still be different events. Dropping taken_at from the identifier would collapse the grain.
  3. Status versus queue. The generator writes HOLD from queue. The ontology derives HoldScan from status. If those ever diverge, the brief is lying. I keep them coupled on purpose for this PoC.
  4. Calm Austin. Zero HOLD is not missing data. It is a city that never crossed 22 seconds on this seed.
  5. Spec drift. A newer Ossie SDK that only accepts version on OssieDocument will reject the semantic model even when the JSON Schema still passes. That is why the README pins 74a26be.

What broke while I built it

I should say what failed, because the clean README path is a lie if I skip the dead ends.

The first CSV used seed 42 and put every HOLD in Seattle. The promoter table still "worked," but Harbor Lights sat at zero HOLD and the story became a single-city rant. I changed the seed to 19 and nudged city bias so Portland and Denver kept a few HOLDs. Austin stayed at zero on purpose. Sample design is part of the ontology experiment when the ontology is judged by a chart.

The second failure was Ossie main. JSON Schema checks passed. The official validator passed. OssieDocument.from_ossie_yaml then rejected name, datasets, and relationships as extra fields. That combination is nasty because two green lights hide a red one. I checked out 74a26be, the commit the Data for AI lesson pins, reinstalled ./ossie/python, and the SDK load came back. The article and the README both say to pin. I am repeating it because I wasted an evening assuming the schemas alone were enough.

The third failure was quieter. I stored a draft promoter_id on scanners "just for the SQL." The ontology still derived operated_for. The brief looked fine. Then I imagined moving SEA-01 from North Rim to Harbor Lights and realized half the historical scanner rows would keep the old promoter unless I rewrote history. I deleted the column. The join path got longer. The model got honest.

Ethics and honesty for a fake stadium

This is invented data. Using it to claim a real venue has a queue problem would be nonsense. I also kept money out of the model on purpose. Instructions for this series ban financial use cases, and even without that rule I did not want "HOLD" to quietly become "refund risk." Once a dollar sits next to a queue second, the brief becomes a negotiation about what a wait is worth. That is a different experiment.

I am careful about the word "alert" too. The IoT lesson used ALERT for sensor status. I used HOLD for gates so I would not smuggle cold-chain language into a stadium story. Naming is ethics when the reader is a person who will copy your status strings into a dashboard.

What I would change next

If I extend the experiment, the next change I actually want is a second fact, not a fifth value type. A staffing event, with a gate and a headcount, would let me ask whether HOLD shrank after an usher was added. That is a different grain. Bolting ushers_on_duty onto every scan would pretend headcount is a measurement the turnstile took. I have not built that file. The current one still cannot tell me whether Seattle got better after minute forty. It can tell me that, under rules I wrote down, North Rim owns the HOLD mass and Austin owns the calm.

A second roadmap item is metrics in the semantic model beyond avg_queue_seconds. Ossie core models can declare metrics on datasets. I left most of the brief logic in the teaching SQL so I could see every join. Moving average queue into a declared metric would be a good follow-up once I trust the joins. A third item is wiring the same documents into a real metric tool. That is Track B territory in the Data for AI series, and it is outside this PoC on purpose.

Closing Thoughts

The part I trust is the order of work. Write the question. Pick one measurement grain. Name a promoter hop as derived when the venue already owns it. Keep ranges in value types. Keep HOLD as a subtype. Refuse to query until the three documents validate together. Then print a table small enough to argue with.

The part I do not trust is the cutoff. Twenty-two seconds is a number I chose so this sample would have a boundary, a calm city, and a promoter that absorbs two busy venues. A different seed would make 22 look arbitrary, because it is. The useful claim is not that Seattle needs more scanners. The useful claim is that I can point at a derived subtype and a mapping field and say "this is the HOLD I meant," and a second notebook cannot quietly mean something else.

I remapped the IoT teaching loop on purpose. Watching https://youtu.be/TV70PHBNNPk with the cold-chain nouns still in my head made it too easy to copy the example without noticing which relationships were load-bearing. Changing Customer into Promoter forced me to re-read every verbalization. That friction was the point of the PoC.

If you only clone one thing, clone https://github.com/aniket-work/BowlGate, pin Ossie to 74a26be, and run python ossie_demo.py sql. You should see 230 and 12. If you see different numbers, either the CSV changed or the HOLD rule changed. Either way, the ontology is doing its job: the disagreement has a place to live.

I will keep this as a laptop PoC. No claim that a real bowl runs on three YAML files. The win for me was narrower: one HOLD definition, one join path to a promoter, and a validator that yells when those stop matching.

The code, the chart, and the GIF are in https://github.com/aniket-work/BowlGate.

Disclaimer

The views and opinions expressed here are solely my own and do not represent the views, positions, or opinions of my employer or any organization I am affiliated with. The content is based on my personal experience and experimentation and may be incomplete or incorrect. Any errors or misinterpretations are unintentional, and I apologize in advance if any statements are misunderstood or misrepresented.

Tags: python, ontology, opensource, datascience

Top comments (0)