hdmf.term_set module

class hdmf.term_set.TermSet(term_schema_path: str | None = None, schemasheets_folder: str | None = None, dynamic: bool = False)

Bases: object

Class for implementing term sets from ontologies and other resources used to define the meaning and/or identify of terms.

Variables:
  • term_schema_path – The path to the LinkML YAML enumeration schema

  • sources – The prefixes for the ontologies used in the TermSet

  • view – SchemaView of the term set schema

  • schemasheets_folder – The path to the folder containing the LinkML TSV files

  • expanded_termset_path – The path to the schema with the expanded enumerations

Parameters:
  • term_schema_path – The path to the LinkML YAML enumeration schema

  • schemasheets_folder – The path to the folder containing the LinkML TSV files

  • dynamic – Boolean parameter denoting whether the schema uses Dynamic Enumerations

validate(term)

Validate term in dataset towards a termset.

Parameters:

term (str) – term to be validated

property view_set

Property method to return a view of all terms in the the LinkML YAML Schema.

__getitem__(term)

Method to retrieve a term and term information (LinkML description and LinkML meaning) from the set of terms.

class hdmf.term_set.TermSetWrapper(termset, value, field=None)

Bases: object

This class allows any HDF5 dataset or attribute to have a TermSet.

Parameters:
  • termset (TermSet) – The TermSet to be used.

  • value (list or ndarray or dict or str or tuple) – The target item that is wrapped, either data or attribute.

  • field (str) – The field within a compound array.

property value
property field
property termset
property dtype
__getitem__(val)

This is used when we want to index items.

append(arg)

This append resolves the wrapper to use the append of the container using the wrapper.

extend(arg)

This append resolves the wrapper to use the extend of the container using the wrapper.

class hdmf.term_set.TypeConfigurator(path=None)

Bases: object

This class allows users to toggle on/off a global configuration for defined data types. When toggled on, every instance of a configuration file supported data type will be validated according to the corresponding TermSet.

Parameters:

path (str) – Path to the configuration file.

get_config(data_type, namespace)

Return the config for that data type in the given namespace.

Parameters:
  • data_type (str) – The desired data type within the configuration file.

  • namespace (str) – The namespace for the data type.

load_type_config(config_path)

Load the configuration file for validation on the fields defined for the objects within the file.

Parameters:

config_path (str) – Path to the configuration file.

unload_type_config()

Remove validation according to termset configuration file.