Group

Adapter for NWB groups to linkml Classes

class GroupAdapter(*, TYPE: ~typing.Type = <class 'nwb_schema_language.datamodel.nwb_schema_pydantic.Group'>, cls: ~nwb_schema_language.datamodel.nwb_schema_pydantic.Group, parent: ~nwb_linkml.adapters.classes.ClassAdapter | None = None)

Adapt NWB Groups to LinkML Classes

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

TYPE: Type

The type that this adapter class handles

cls: Group
build() BuildResult

Do the translation, yielding the BuildResult

Build links specified in the links field as slots that refer to other classes, with an additional annotation specifying that they are in fact links.

Link slots can take either the object itself or the path to that object in the file hierarchy as a string.

handle_container_group(cls: Group) BuildResult

Make a special LinkML value slot that can have any number of the objects that are of neurodata_type_inc class

Examples

- name: templates
  groups:
  - neurodata_type_inc: TimeSeries
    doc: TimeSeries objects containing template data of presented stimuli.
    quantity: '*'
  - neurodata_type_inc: Images
    doc: Images objects containing images of presented stimuli.
    quantity: '*'
handle_container_slot(cls: Group) BuildResult

Handle subgroups that contain arbitrarily numbered classes,

eg. each of the groups in

Examples

  • name: trials neurodata_type_inc: TimeIntervals doc: Repeated experimental events that have a logical grouping. quantity: ‘?’

  • name: invalid_times neurodata_type_inc: TimeIntervals doc: Time intervals that should be removed from analysis. quantity: ‘?’

  • neurodata_type_inc: TimeIntervals doc: Optional additional table(s) for describing other experimental time intervals. quantity: ‘*’

build_datasets() BuildResult

Build nested groups and datasets

Create ClassDefinitions for each, but then also create SlotDefinitions that will be used as attributes linking the main class to the subclasses

Datasets are simple, they are terminal classes, and all logic for creating slots vs. classes is handled by the adapter class

build_groups() BuildResult

Build subgroups, excluding pure container subgroups

build_containers() BuildResult

Build all container types into a single value slot

build_special_cases() BuildResult

Special cases, at this point just for NWBFile, which has extra .specloc and specifications attrs

build_self_slot() SlotDefinition

If we are a child class, we make a slot so our parent can refer to us

Groups are a bit more complicated because they can also behave like range declarations: eg. a group can have multiple groups with neurodata_type_inc, no name, and quantity of *, the group can then contain any number of groups of those included types as direct children

We make sure that we’re inlined as a dict so our parent class can refer to us like:

parent.{slot_name}[{name}] = self
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'TYPE': FieldInfo(annotation=Type, required=False, default=<class 'nwb_schema_language.datamodel.nwb_schema_pydantic.Group'>), 'cls': FieldInfo(annotation=Group, required=True), 'parent': FieldInfo(annotation=Union[ClassAdapter, NoneType], required=False, default=None)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.