diff --git a/linkml_model/model/schema/array.yaml b/linkml_model/model/schema/array.yaml index f0ba1d96..1d5f67fd 100644 --- a/linkml_model/model/schema/array.yaml +++ b/linkml_model/model/schema/array.yaml @@ -63,6 +63,8 @@ classes: slots: - axis - array + see_also: + - https://docs.xarray.dev/en/stable/generated/xarray.DataArray.html GroupingByArrayOrder: mixin: true diff --git a/linkml_model/model/schema/meta.yaml b/linkml_model/model/schema/meta.yaml index ae28692a..7ca41c15 100644 --- a/linkml_model/model/schema/meta.yaml +++ b/linkml_model/model/schema/meta.yaml @@ -1420,6 +1420,34 @@ slots: - BasicSubset - ObjectOrientedProfile + array_shape: + domain: slot_definition + range: array_shape_expression + inherited: true + description: coerces the value of the slot into an array and defines the dimensions of that array + + array_axes: + description: definitions of each axis in the array + domain: array_shape_expression + range: array_axis_expression + multivalued: true + inlined: true + + minimum_dimensions: + description: minimum number of dimensions in the array + domain: array_shape_expression + range: integer + + maximum_dimensions: + description: maximum number of dimensions in the array + domain: array_shape_expression + range: integer + + exact_dimensions: + description: exact number of dimensions in the array + domain: array_shape_expression + range: integer + inherited: domain: slot_definition range: boolean @@ -1521,6 +1549,14 @@ slots: in_subset: - SpecificationSubset + exact_cardinality: + is_a: list_value_specification_constant + range: integer + inherited: true + description: the exact number of entries for a multivalued slot + in_subset: + - SpecificationSubset + minimum_cardinality: is_a: list_value_specification_constant range: integer @@ -2715,6 +2751,7 @@ classes: - equals_string_in - equals_number - equals_expression + - exact_cardinality - minimum_cardinality - maximum_cardinality - has_member @@ -2759,6 +2796,7 @@ classes: - domain - slot_uri - multivalued + - array_shape - inherited - readonly - ifabsent @@ -2917,6 +2955,33 @@ classes: in_subset: - SpecificationSubset + array_shape_expression: + description: defines the dimensions of an array + mixins: + - extensible + - annotatable + - common_metadata + slots: + - exact_dimensions + - minimum_dimensions + - maximum_dimensions + - array_axes + + array_axis_expression: + description: defines one of the dimensions of an array + mixins: + - extensible + - annotatable + - common_metadata + slots: + - name + - rank + - equals_expression + - alias + - maximum_cardinality + - minimum_cardinality + - exact_cardinality + pattern_expression: description: a regular expression pattern used to evaluate conformance of a string mixins: diff --git a/tests/input/examples/schema_definition-array-2.yaml b/tests/input/examples/schema_definition-array-2.yaml index a8c5346f..bfa3f9c3 100644 --- a/tests/input/examples/schema_definition-array-2.yaml +++ b/tests/input/examples/schema_definition-array-2.yaml @@ -26,7 +26,7 @@ classes: implements: - linkml:NDArray annotations: - dimensions: 1 + dimensions: "1" # TODO abstract from children IrregularlySampledTimestampSeries: @@ -47,7 +47,7 @@ classes: unit: ucum_code: s annotations: - dimensions: 1 + dimensions: "1" RegularlySampledTimestampSeries: is_a: TimestampSeries @@ -82,7 +82,7 @@ classes: unit: ucum_code: s annotations: - dimensions: 1 + dimensions: "1" Electrode: attributes: @@ -106,7 +106,7 @@ classes: implements: - linkml:elements annotations: - dimensions: 1 + dimensions: "1" ElectricalDataMatrix: description: >- diff --git a/tests/input/examples/schema_definition-native-array-1.yaml b/tests/input/examples/schema_definition-native-array-1.yaml new file mode 100644 index 00000000..98c382fb --- /dev/null +++ b/tests/input/examples/schema_definition-native-array-1.yaml @@ -0,0 +1,70 @@ +id: https://example.org/arrays +name: arrays-temperature-example +title: Array Temperature Example +description: |- + Example LinkML schema to demonstrate a 3D DataArray of temperature values with labeled axes +license: MIT + +prefixes: + linkml: https://w3id.org/linkml/ + wgs84: http://www.w3.org/2003/01/geo/wgs84_pos# + example: https://example.org/ + +default_prefix: example + +imports: + - linkml:types + +classes: + + TemperatureDataset: + tree_root: true + attributes: + name: + identifier: true + range: string + latitude_in_deg: + required: true + range: float + multivalued: true + unit: + ucum_code: deg + array_shape: + exact_dimensions: 1 + longitude_in_deg: + required: true + range: float + multivalued: true + unit: + ucum_code: deg + array_shape: + exact_dimensions: 1 + time_in_d: + range: float + multivalued: true + implements: + - linkml:elements + required: true + unit: + ucum_code: d + array_shape: + exact_dimensions: 1 + temperatures_in_K: + range: float + multivalued: true + required: true + unit: + ucum_code: K + array_shape: + exact_dimensions: 3 + array_axes: + x: + rank: 0 + alias: latitude_in_deg + y: + rank: 1 + alias: longitude_in_deg + t: + rank: 2 + alias: time_in_d + diff --git a/tests/input/examples/schema_definition-native-array-rgb.yaml b/tests/input/examples/schema_definition-native-array-rgb.yaml new file mode 100644 index 00000000..872615f7 --- /dev/null +++ b/tests/input/examples/schema_definition-native-array-rgb.yaml @@ -0,0 +1,37 @@ +id: https://example.org/arrays +name: arrays-temperature-example +title: Array Temperature Example +description: |- + Example LinkML schema to demonstrate a 3D DataArray of temperature values with labeled axes +license: MIT + +prefixes: + linkml: https://w3id.org/linkml/ + wgs84: http://www.w3.org/2003/01/geo/wgs84_pos# + example: https://example.org/ + +default_prefix: example + +imports: + - linkml:types + +classes: + + RGBImage: + attributes: + x: + range: integer + y: + range: integer + + rgb: + range: float + array_shape: + exact_dimensions: 3 + array_axes: + x: + y: + rgb: + exact_cardinality: 3 + description: r, g, b values +