Slot Arrays#
Will explain further in the morning :)
See:
https://github.com/linkml/linkml-arrays/issues/7#issuecomment-1925999203
https://github.com/linkml/linkml-arrays/issues/7#issuecomment-1926195529
Working Examples#
ExactDimension:
description: exact anonymous dimensions
attributes:
temp:
range: float
required: true
unit:
ucum_code: K
array:
dimensions: 3
class ExactDimension(ConfiguredBaseModel):
"""
exact anonymous dimensions
"""
linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True)
temp: NDArray[Shape[*, *, *], Float] = Field(...)
ExactNamedDimension:
description: Exact named dimensions
attributes:
temp:
range: float
required: true
unit:
ucum_code: K
array:
axes:
x:
rank: 0
alias: latitude
y:
rank: 1
alias: longitude
t:
rank: 2
alias: time
class ExactNamedDimension(ConfiguredBaseModel):
"""
Exact named dimensions
"""
linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True)
temp: NDArray[Shape[* latitude, * longitude, * time], Float] = Field(...)
MinDimensions:
description: Minimum anonymous dimensions
attributes:
temp:
range: float
required: true
unit:
ucum_code: K
array:
dimensions:
min: 3
class MinDimensions(ConfiguredBaseModel):
"""
Minimum anonymous dimensions
"""
linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True)
temp: NDArray[Shape[*, *, *, ...], Float] = Field(...)
MaxDimensions:
description: Maximum anonymous dimensions
attributes:
temp:
range: float
required: true
unit:
ucum_code: K
array:
dimensions:
max: 3
class MaxDimensions(ConfiguredBaseModel):
"""
Maximum anonymous dimensions
"""
linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True)
temp: Union[
NDArray[Shape["*"], Float],
NDArray[Shape["*, *"], Float],
NDArray[Shape["*, *, *"], Float]
] = Field(...)
RangeDimensions:
description: Range of anonymous dimensions
attributes:
temp:
range: float
required: true
unit:
ucum_code: K
array:
dimensions:
min: 2
max: 5
class RangeDimensions(ConfiguredBaseModel):
"""
Range of anonymous dimensions
"""
linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True)
temp: Union[
NDArray[Shape["*, *"], Float],
NDArray[Shape["*, *, *"], Float],
NDArray[Shape["*, *, *, *"], Float],
NDArray[Shape["*, *, *, *, *"], Float]
] = Field(...)
ExactCardinality:
description: An axis with a specified cardinality
attributes:
temp:
range: float
required: true
unit:
ucum_code: K
array:
axes:
x:
rank: 0
cardinality: 3
class ExactCardinality(ConfiguredBaseModel):
"""
An axis with a specified cardinality
"""
linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True)
temp: NDArray[Shape["3 x"], Float] = Field(...)
MaxCardinality:
description: An axis with a maximum cardinality
attributes:
temp:
range: float
required: true
unit:
ucum_code: K
array:
axes:
x:
rank: 0
cardinality:
max: 3
class MaxCardinality(ConfiguredBaseModel):
"""
An axis with a maximum cardinality
"""
linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True)
temp: Union[
NDArray[Shape["1 x"], Float],
NDArray[Shape["2 x"], Float],
NDArray[Shape["3 x"], Float]
] = Field(...)
RangeCardinality:
description: An axis with a min and maximum cardinality
attributes:
temp:
range: float
required: true
unit:
ucum_code: K
array:
axes:
x:
rank: 0
cardinality:
min: 2
max: 4
class RangeCardinality(ConfiguredBaseModel):
"""
An axis with a min and maximum cardinality
"""
linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True)
temp: Union[
NDArray[Shape["2 x"], Float],
NDArray[Shape["3 x"], Float],
NDArray[Shape["4 x"], Float]
] = Field(...)
ExclusiveAxes:
description: Two mutually exclusive definitions of an axis that define its different forms
attributes:
temp:
range: float
required: true
unit:
ucum_code: K
array:
axes:
x:
rank: 0
y:
rank: 1
rgb:
rank: 2
cardinality: 3
rgba:
rank: 2
cardinality: 4
class ExclusiveAxes(ConfiguredBaseModel):
"""
Two mutually exclusive definitions of an axis that define its different forms
"""
linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True)
temp: Union[
NDArray[Shape["* x, * y, 3 rgb"], Float],
NDArray[Shape["* x, * y, 4 rgba"], Float]
] = Field(...)
TODO#
Any shape array
classes:
TemperatureDataset:
attributes:
temperatures_in_K:
range: float
multivalued: true
required: true
array:
One specified, named dimension, and any number of other dimensions
array:
dimensions:
min: 1
# optionally, to be explicit:
max: null
axes:
x:
rank: 0
alias: latitude_in_deg
Two required dimensions and two optional dimensions that will generate a union of the combinatoric product of the optional dimensions. Rank must be unspecified in optional dimensions
array:
axes:
x:
rank: 0
y:
rank: 1
z:
cardinality: 3
required: false
theta:
cardinality: 4
required: false