Summary
Currently, all OntologyAnnotation objects are created with tsr = "" and the xxx_version field from DB views is silently dropped. This is a known limitation (see arc-building/design.md, Key Decision 5). ARCs serialize with "ontologySourceReferences": [], losing ontology version provenance.
Motivation
The DB views expose (xxx_term, xxx_uri, xxx_version) triples for every ontology field. The version refers to the ontology source version (e.g. "2024-01-01" for ENVO), not to the term itself. ARCtrl models this via OntologySourceReference objects registered on ArcInvestigation.OntologySourceReferences, back-referenced from OntologyAnnotation.tsr by name. Without this, consuming tools cannot resolve ontology source metadata.
Proposed Implementation
- After all mapper functions run, collect all distinct
(xxx_term, xxx_uri, xxx_version) combinations from the investigation's contacts, publications, and annotation tables.
- Group by ontology source name (
xxx_term) and create one OntologySourceReference(name=..., version=..., file=..., description=...) per source.
- Append these to
ArcInvestigation.OntologySourceReferences.
- Update
_make_oa() to set tsr to the matching OntologySourceReference.name instead of "".
Acceptance Criteria
References
spec/features/arc-building/design.md — Key Decision 5
spec/skills/arctrl.md — OntologySourceReference section
middleware/sql_to_arc/src/middleware/sql_to_arc/mapper.py — _make_oa()
Summary
Currently, all
OntologyAnnotationobjects are created withtsr = ""and thexxx_versionfield from DB views is silently dropped. This is a known limitation (seearc-building/design.md, Key Decision 5). ARCs serialize with"ontologySourceReferences": [], losing ontology version provenance.Motivation
The DB views expose
(xxx_term, xxx_uri, xxx_version)triples for every ontology field. The version refers to the ontology source version (e.g."2024-01-01"for ENVO), not to the term itself. ARCtrl models this viaOntologySourceReferenceobjects registered onArcInvestigation.OntologySourceReferences, back-referenced fromOntologyAnnotation.tsrby name. Without this, consuming tools cannot resolve ontology source metadata.Proposed Implementation
(xxx_term, xxx_uri, xxx_version)combinations from the investigation's contacts, publications, and annotation tables.xxx_term) and create oneOntologySourceReference(name=..., version=..., file=..., description=...)per source.ArcInvestigation.OntologySourceReferences._make_oa()to settsrto the matchingOntologySourceReference.nameinstead of"".Acceptance Criteria
ArcInvestigation.OntologySourceReferencesis non-empty when the DB provides ontology version data.OntologyAnnotation.tsrmatches the correspondingOntologySourceReference.name.ontologySourceReferencesarray._make_oa()with a non-emptytsrvalue.arc-building/design.mdis updated to reflect the new behaviour.References
spec/features/arc-building/design.md— Key Decision 5spec/skills/arctrl.md—OntologySourceReferencesectionmiddleware/sql_to_arc/src/middleware/sql_to_arc/mapper.py—_make_oa()