Skip to content

Commit acab878

Browse files
turbomamclaude
andcommitted
CLAUDE.md: propagate durable conventions from notes/memory into the repo guide
Consolidates durable knowledge that lived only in Desktop notes, Claude memory, and the old from-intel guide so anyone working in the repo sees it: - Fix a stale/contradictory line: term IRIs are bare-numeric https://w3id.org/metpo/<digits> (METPO: is prefix notation), not 'METPO_'; the main ontology IRI must be https://w3id.org/metpo/metpo.owl. - Add a Source-of-truth section: the Google Sheet is SoT for ontology content; never hand-edit committed TSVs/components; CI tests the committed snapshot; ChromaDB is retired (no new chromadb solutions); scope-narrowing relocates, not deletes. - Aristotelian definition rule (genus = parent label; enforced by metpo-proposal-lint). - Source-bound synonyms are reified and intentionally duplicated across bins; document how kg-microbe consumes METPO (main OWL + tag-pinned TSVs). - Host vs container Makefile targets. - Note the retired literature-mining ID range 1000001-1000327. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent b6e8812 commit acab878

1 file changed

Lines changed: 72 additions & 4 deletions

File tree

CLAUDE.md

Lines changed: 72 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,35 @@
11
# METPO Development Guide for Claude Code
22

3-
**Last Updated:** 2025-11-10
3+
**Last Updated:** 2026-06-05
4+
5+
---
6+
7+
## Source of truth and project constraints
8+
9+
Read these before editing ontology content or proposing architecture.
10+
11+
- **The Google Sheet is the source of truth for ontology content** (term labels,
12+
definitions, synonyms, biolink mappings, range bounds, equivalent-class
13+
formulas): sheet `1_Lr-9_5QHi8QLvRyTZFSciUhzGKD4DbUObyTpJ16_RU`
14+
("METPO - growth_condition_terms"). The TSVs under `src/templates/` and
15+
`src/ontology/components/metpo_sheet.owl` are a **build cache generated from the
16+
sheet**.
17+
- **Never hand-edit the committed `src/templates/*.tsv` or `components/metpo_sheet.owl`**,
18+
even to "fix" something a reviewer or Copilot flagged — the next sheet sync
19+
overwrites it. Fix it in the sheet (e.g. `gog sheets update ...`), then rebuild
20+
so the regenerated TSV/OWL are what you commit. (The `metpo-edit.owl` header
21+
annotations are the exception: those are edited in-repo.)
22+
- **CI tests the committed snapshot, not the live sheet.** `qc.yml` runs
23+
`make test ...` without `squeaky-clean`, so sheet edits only reach CI once
24+
someone runs `squeaky-clean && make all` locally and commits the regenerated
25+
`src/templates/*.tsv` and `src/ontology/components/*.owl`.
26+
- **ChromaDB is retired** (unpatchable critical CVE, #455/#401, removed in #498).
27+
Do not propose new ChromaDB-based solutions. Cross-ontology/embedding work uses
28+
OLS4 + local embeddings (nomic-embed-text via Ollama on the M5 GPU) +
29+
linkml-store/OAK; see `metpo/pipeline/cross_ontology_search.py`.
30+
- **Scope-narrowing means relocate, not delete** (#433). Do not delete
31+
non-ontology content (presentations, literature-mining, analysis scripts)
32+
until its long-term home is decided; extraction PRs stay drafts until then.
433

534
---
635

@@ -85,7 +114,10 @@ When cleaning up or organizing the repository:
85114
as a generated artifact — it is hand-maintained.
86115

87116
2. **Never reuse a burned ID.** An ID is burned if it appears in `deprecated.tsv`, in any
88-
BioPortal submission extract, or in any tagged release. Check before allocating.
117+
BioPortal submission extract, or in any tagged release. Check before allocating. This
118+
spans historical numbering eras (early leading-zero IDs as well as the current
119+
`1xxxxxx` classes / `2xxxxxx` properties); in particular the literature-mining range
120+
`1000001`-`1000327` was retired and must not be reused.
89121

90122
3. **The research tools were a one-time bootstrap.** `generate-deprecated-template` and
91123
`audit-id-allocation` scanned BioPortal submissions and git history in March 2026 (PR #375)
@@ -130,6 +162,15 @@ Also run a grep sanity-check: `grep "METPO:<candidate>" src/templates/*.tsv src/
130162

131163
### Build Commands
132164

165+
**Host vs container targets.** Anything that runs ROBOT needs the ODK container,
166+
invoked with the `sh run.sh make ...` wrapper from `src/ontology/`: `all`, `test`,
167+
`test_fast`, `prepare_release`, `reason_test`, `sparql_test`, `robot_reports`,
168+
`components/*.owl`. Targets that only shell out to host tools (`curl`, `uv`, git)
169+
run faster **directly with `make ...`** (no container spin-up): `clean`,
170+
`squeaky-clean`, the `../templates/*.tsv` sheet downloads, and the `diff-*`
171+
targets. If `uv` isn't on PATH inside the container, resolve sheet URLs on the
172+
host and pass/curl them in.
173+
133174
**Full build:**
134175
```bash
135176
cd src/ontology
@@ -224,12 +265,35 @@ sh run.sh make prepare_release
224265
- **Imports:** `src/ontology/imports/` - imported ontologies (bfo, obi, omp, pato, so, micro, mpo)
225266
- **Release files:** `metpo.owl`, `metpo.obo`, `metpo.json` - generated release formats
226267

268+
### IRI and namespace scheme (read before touching any IRI)
269+
270+
METPO term IRIs are **bare-numeric under w3id**: `https://w3id.org/metpo/<digits>`
271+
(e.g. `https://w3id.org/metpo/1000602`). There is **no `METPO_` infix**. The
272+
`METPO:` CURIE prefix is notation only; it expands to `https://w3id.org/metpo/`
273+
(declared in `metpo-odk.yaml` `namespaces:` and the template `--add-prefix`).
274+
275+
- w3id delegates only the `/metpo/` path, so the resolvable base, the ontology
276+
IRI, the version IRI, and all products must sit under `https://w3id.org/metpo/`.
277+
- The **main ontology IRI must be `https://w3id.org/metpo/metpo.owl`**.
278+
`https://w3id.org/metpo.owl` is outside the delegation and 404s (#435, #465).
279+
- Do not introduce `http://purl.obolibrary.org/obo/METPO_...` PURLs — obolibrary
280+
is not registered for METPO and those 404.
281+
- This is the exact scheme the QC SPARQL filters key on
282+
(`STRSTARTS(str(?term), "https://w3id.org/metpo/")`); a wrong prefix silently
283+
matches nothing (see the meta-test note above).
284+
227285
### OBO Foundry Coding Guidelines
228286

229-
1. **Follow OBO Foundry ID formats** - Use METPO:XXXXXXX format
287+
1. **Use the IRI scheme above** - bare-numeric `https://w3id.org/metpo/<digits>`,
288+
written `METPO:<digits>` in templates/sheets.
230289
2. **Include labels for all entities** - Every term must have rdfs:label
231290
3. **Use standard OWL Manchester syntax** - Follow OWL conventions
232-
4. **Document definitions** - Use IAO:0000115 for term definitions
291+
4. **Aristotelian definitions** - `IAO:0000115` definitions follow "A ⟨genus⟩ that
292+
⟨differentia⟩", where **the genus is literally the parent class's label** (not a
293+
free-text noun phrase, not a non-existent class). This is enforced
294+
deterministically by `metpo-proposal-lint` (DEF-FORM check, baseline ratchet);
295+
accepted genus/differentia connectors include `that`, `in which`, `where`,
296+
`characterized by`, `describing` (not `with`/`having`).
233297
5. **Follow naming patterns** - Consistent with existing terms in the ontology
234298
6. **Place imports appropriately** - Keep imported terms in imports directory
235299

@@ -255,6 +319,10 @@ The classes-tab template has two kinds of synonym columns; they have different e
255319

256320
The implicit contract is that downstream consumers (e.g. `kg-microbe`'s BactoTraits transformer) match on the exact source string. Normalizing breaks matching.
257321

322+
**Source-bound synonyms are reified, and duplicates across bins are intentional.** Each source-bound value is asserted as an `oboInOwl:hasRelatedSynonym` and reified on an `owl:Axiom` carrying the provenance source (`IAO:0000119` -> e.g. `https://bacdive.dsmz.de/`). The **same related synonym appearing on several classes (e.g. across temperature/pH/oxygen bins) is deliberate** - it maps distinct external-system values to METPO entities. Do **not** "de-duplicate" them. (The known *defect* is the separate `confirmed exact synonym` overload in #444, not these.)
323+
324+
**How `kg-microbe` consumes METPO (why the verbatim rule matters):** it reads (1) `metpo.owl` from `main` for ontology nodes/edges, and (2) the ROBOT-template TSVs **pinned to a git tag** for its BacDive/BactoTraits/Madin/MetaTraits synonym-to-predicate mappings. So when METPO removes or renames a property, the pinned tag in kg-microbe must be bumped or the old mapping keeps being used. Treat source-bound synonym strings and property IRIs as a downstream contract.
325+
258326
**Ontology-native columns:**
259327

260328
| Column | Holds |

0 commit comments

Comments
 (0)