Skip to content

Either Data needs shape options or the default shape should be any shape #83

Description

@rly

By default, a dataset's shape is null which means the attribute/dataset is a scalar. ref
In object-oriented programming - specifically, the Liskov substitution principle - and our type system, subtypes (subclasses) should not expand the range of allowed options from the supertype (superclass).

The dataset data type Data has no shape defined, so its shape is scalar. Pretty much all subtypes of Data define a non-scalar shape. This breaks the above principle.

This had low impact because almost all subtypes of Data that are used define a shape (except for NWB's ScratchData) but as we are now trying to improve how the API resolves and validates shapes, the base shape matters.

Option 1: Add scalar, 1D, 2D, 3D, 4D, 5D shape options to Data.

  • Problem: The schema language does not allow one to specify a dataset is either scalar or 1D.
  • Solution 1: We could add an option where shape = 0 means scalar.
  • Solution 2: We could add an option where shape = "ANY" means any shape

Option 2: Make Data a special case where the default is any shape. This is kind of hacky.

Option 3: Change the default shape to be any shape for datasets. This could break existing schema that do not specify a shape and assume it is a scalar. I think other options are better.

Metadata

Metadata

Assignees

Labels

category: enhancementimprovements of code or code behaviorpriority: mediumnon-critical problem and/or affecting only a small set of NWB users

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions