mirror of
https://github.com/p2p-ld/nwb-linkml.git
synced 2024-11-10 00:34:29 +00:00
3.3 KiB
3.3 KiB
PyNWB notes
How does pynwb use the schema?
- nwb-schema is included as a git submodule within pynwb
- __get_resources encodes the location of the directory
- __TYPE_MAP eventually contains the schema information
- on import, load_namespaces populates
__TYPE_MAP
- register_class decorator is used on all pynwb classes to register with
__TYPE_MAP
- Unclear how the schema is used if the containers contain the same information
- the register_container_type method in hdmf's TypeMap class seems to overwrite the loaded schema???
__NS_CATALOG
seems to actually hold references to the schema but it doesn't seem to be used anywhere except within__TYPE_MAP
?
- NWBHDF5IO uses
TypeMap
to greate aBuildManager
- Parent class HDF5IO then reimplements a lot of basic functionality from elsehwere
- Parent-parent metaclass HDMFIO appears to be the final writing class?
BuildManager.build
then callsTypeMap.build
???
TypeMap.build
...- gets the
ObjectMapper
which does god knows what - Calls the
ObjectMapper.build
method - Which seems to ultimately create a
DatasetBuilder
object
- gets the
- The
DatasetBuilder
is returned to theBuildManager
which seems to just store it? - HDMFIO.write then calls
write_builder
to use the builder, which is unimplemented in the metaclass- HDF5IO.write_builder implements it for HDF5, which then calls
write_group
,write_dataset
,write_link
, depending on the builder types, each of which are extremely heavy methods! - eg.
write_dataset
is basically unreadable to me, but seems to implement every type of dataset writing in a single method.
- HDF5IO.write_builder implements it for HDF5, which then calls
- At this point it is entirely unclear how the schema is involved, but the file is written.