Skip to content

Implement the LinkML reader (base.yaml) #1489

Description

@rly

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

  • hdmf/spec/linkml reader builds Spec objects from the LinkML test namespace via SchemaView.
  • Acceptance test: the Spec read from the LinkML test namespace equals the Spec HDMF loads natively from the equivalent HDMFSL namespace (base.yaml) via the existing namespace/catalog path.
  • Tests cover the reader at HDMF's usual coverage standard.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions