Part of the "Read and write LinkML schema for HDMF (CSRMatrix / base.yaml)" epic. Depends on the mapping-conventions issue and the fixture-translation issue.
Implement a reader in a new hdmf/spec/linkml module that parses the LinkML test namespace with linkml-runtime's SchemaView, loading through HDMF's namespace/catalog path, and builds HDMF Spec objects (GroupSpec, DatasetSpec initially) following the agreed conventions. Add linkml-runtime as an optional linkml dependency group so installs that do not use LinkML are unaffected.
The reader must not add LinkML-shaped fields to Spec. Constructs that Spec cannot represent are preserved as annotations or cause a loud failure, never silently dropped.
Before building the reader
First, as a small explicit task: figure out how to compare two Spec objects for equivalence, and prove it works on a hand-built pair. The acceptance test below relies on that comparison, so it should be settled before the reader is built around it. If the oracle needs a custom comparison (rather than Spec equality working out of the box), better to learn that on day three than after the reader is written. This could be a separate PR.
Acceptance criteria
Part of the "Read and write LinkML schema for HDMF (CSRMatrix / base.yaml)" epic. Depends on the mapping-conventions issue and the fixture-translation issue.
Implement a reader in a new
hdmf/spec/linkmlmodule that parses the LinkML test namespace withlinkml-runtime'sSchemaView, loading through HDMF's namespace/catalog path, and builds HDMFSpecobjects (GroupSpec,DatasetSpecinitially) following the agreed conventions. Addlinkml-runtimeas an optionallinkmldependency group so installs that do not use LinkML are unaffected.The reader must not add LinkML-shaped fields to
Spec. Constructs thatSpeccannot represent are preserved as annotations or cause a loud failure, never silently dropped.Before building the reader
First, as a small explicit task: figure out how to compare two
Specobjects for equivalence, and prove it works on a hand-built pair. The acceptance test below relies on that comparison, so it should be settled before the reader is built around it. If the oracle needs a custom comparison (rather thanSpecequality working out of the box), better to learn that on day three than after the reader is written. This could be a separate PR.Acceptance criteria
hdmf/spec/linkmlreader buildsSpecobjects from the LinkML test namespace viaSchemaView.Specread from the LinkML test namespace equals theSpecHDMF loads natively from the equivalent HDMFSL namespace (base.yaml) via the existing namespace/catalog path.