Adapter#
Base class for adapters
- class BuildResult(schemas: List[linkml_runtime.linkml_model.meta.SchemaDefinition] = <factory>, classes: List[linkml_runtime.linkml_model.meta.ClassDefinition] = <factory>, slots: List[linkml_runtime.linkml_model.meta.SlotDefinition] = <factory>, types: List[linkml_runtime.linkml_model.meta.TypeDefinition] = <factory>, **_kwargs)#
- schemas: List[SchemaDefinition]#
- classes: List[ClassDefinition]#
- slots: List[SlotDefinition]#
- pydantic model Adapter#
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.
__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.
- abstract build() BuildResult #
Generate the corresponding linkML element for this adapter
- walk(input: BaseModel | list | dict) 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_field_values(input: BaseModel | list | dict, field: str, value: Any | None = None) Generator[BaseModel, None, None] #
Recursively walk input for models that contain a
field
as 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.BaseModel
the matching model