Adapter¶
Base class for adapters
- class BuildResult(schemas: ~typing.List[~linkml_runtime.linkml_model.meta.SchemaDefinition] = <factory>, classes: ~typing.List[~linkml_runtime.linkml_model.meta.ClassDefinition] = <factory>, slots: ~typing.List[~linkml_runtime.linkml_model.meta.SlotDefinition] = <factory>, types: ~typing.List[~linkml_runtime.linkml_model.meta.TypeDefinition] = <factory>, **_kwargs)¶
Container class for propagating nested build results back up to caller
- schemas: List[SchemaDefinition]¶
- classes: List[ClassDefinition]¶
- slots: List[SlotDefinition]¶
- types: List[TypeDefinition]¶
- class Adapter¶
Abstract base class for adapters
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.
- abstract build() BuildResult¶
Generate the corresponding linkML element for this adapter
- get(name: str) Group | Dataset¶
Get the first item whose
neurodata_type_defmatchesnameConvenience wrapper around
walk_field_values()
- get_model_with_field(field: str) Generator[Group | Dataset, None, None]¶
Yield models that have a non-None value in the given field.
Useful during development to find all the ways that a given field is used.
- Parameters:
field (str) – Field to search for
- walk(input: BaseModel | dict | list) Generator[BaseModel | Any | None, None, None]¶
Iterate through all items in the given model.
Could be a staticmethod or a function, but bound to adapters to make it available to them :)
- walk_fields(input: BaseModel | dict | list, field: str | Tuple[str, ...]) Generator[Any, None, None]¶
Recursively walk input for fields that match
field- Parameters:
input (
pydantic.BaseModel) – Model to walk (or a list or dictionary to walk too)
Returns:
- 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]] = {}¶
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- walk_field_values(input: BaseModel | dict | list, field: str, value: Any | None = None) Generator[BaseModel, None, None]¶
Recursively walk input for models that contain a
fieldas a direct child with a value matchingvalue- Parameters:
input (
pydantic.BaseModel) – Model to walkfield (str) – Name of field - unlike
walk_fields(), only one field can be givenvalue (Any) – Value to match for given field. If
None, return models that have the field
- Returns:
pydantic.BaseModelthe matching model