generated from linkml/linkml-template
-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First pass at native NDArray support. #181
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
f526171
First pass at native NDArray support.
cmungall e4147f6
Incorporating hackathon feedback
cmungall 84664b2
nptyping example
cmungall 240f129
Adding testing annotation
cmungall 7cde1a3
rename
cmungall 264b408
Updating example
cmungall c110bc6
rename
cmungall 96bc7f2
Change dimension info to be list, use alias rather than name.
cmungall a9aa6d8
Hackathon updates
cmungall 8c703b4
Spelling out dimensional number slors
cmungall b23d3b9
Fixing typo
cmungall caf41fd
decision: use any_of between False and int for maximum_number_dimensions
cmungall f7b5d17
temporarily removing minimum value constraints
cmungall be2e718
adding comment from @rly
cmungall afc7bfd
Adding comments from @rly
cmungall e04e027
Edits from @rly
cmungall File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -30,7 +30,6 @@ description: |- | |||
[https://w3id.org/linkml/is_a](https://w3id.org/linkml/is_a) | ||||
|
||||
license: https://creativecommons.org/publicdomain/zero/1.0/ | ||||
version: 2.0.0 | ||||
|
||||
prefixes: | ||||
linkml: https://w3id.org/linkml/ | ||||
|
@@ -1420,6 +1419,62 @@ slots: | |||
- BasicSubset | ||||
- ObjectOrientedProfile | ||||
|
||||
array: | ||||
domain: slot_definition | ||||
range: array_expression | ||||
inherited: true | ||||
description: coerces the value of the slot into an array and defines the dimensions of that array | ||||
status: testing | ||||
|
||||
dimensions: | ||||
aliases: | ||||
- axes | ||||
description: definitions of each axis in the array | ||||
domain: array_expression | ||||
range: dimension_expression | ||||
multivalued: true | ||||
list_elements_ordered: true | ||||
status: testing | ||||
|
||||
minimum_number_dimensions: | ||||
description: minimum number of dimensions in the array | ||||
domain: array_expression | ||||
range: integer | ||||
status: testing | ||||
# minimum_value: 1 | ||||
comments: | ||||
- minimum_cardinality cannot be greater than maximum_cardinality | ||||
|
||||
maximum_number_dimensions: | ||||
description: maximum number of dimensions in the array, or False if explicitly no maximum. | ||||
If this is unset, and an explicit list of dimensions are passed using dimensions, then this is interpreted | ||||
as a closed list and the maximum_number_dimensions is the length of the dimensions list, unless this | ||||
value is set to False | ||||
domain: array_expression | ||||
range: Anything | ||||
any_of: | ||||
- range: integer | ||||
# minimum_value: 1 | ||||
- range: boolean | ||||
status: testing | ||||
comments: | ||||
- maximum_number_dimensions cannot be less than minimum_number_dimensions | ||||
|
||||
exact_number_dimensions: | ||||
description: exact number of dimensions in the array | ||||
domain: array_expression | ||||
range: integer | ||||
status: testing | ||||
# minimum_value: 1 | ||||
comments: | ||||
- if exact_number_dimensions is set, then minimum_number_dimensions and maximum_number_dimensions must be unset or have the same value | ||||
|
||||
has_extra_dimensions: | ||||
description: If this is set to true | ||||
domain: array_expression | ||||
range: boolean | ||||
status: testing | ||||
|
||||
inherited: | ||||
domain: slot_definition | ||||
range: boolean | ||||
|
@@ -1521,13 +1576,26 @@ 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 | ||||
comments: | ||||
- if exact_cardinality is set, then minimum_cardinalty and maximum_cardinality must be unset or have the same value | ||||
|
||||
cmungall marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
minimum_cardinality: | ||||
is_a: list_value_specification_constant | ||||
range: integer | ||||
inherited: true | ||||
description: the minimum number of entries for a multivalued slot | ||||
in_subset: | ||||
- SpecificationSubset | ||||
# minimum_value: 0 | ||||
comments: | ||||
- minimum_cardinality cannot be greater than maximum_cardinality | ||||
|
||||
maximum_cardinality: | ||||
is_a: list_value_specification_constant | ||||
|
@@ -1536,6 +1604,9 @@ slots: | |||
description: the maximum number of entries for a multivalued slot | ||||
in_subset: | ||||
- SpecificationSubset | ||||
comments: | ||||
- maximum_cardinality cannot be less than minimum_cardinality | ||||
# minimum_value: 0 | ||||
|
||||
equals_string_in: | ||||
is_a: list_value_specification_constant | ||||
|
@@ -2715,6 +2786,7 @@ classes: | |||
- equals_string_in | ||||
- equals_number | ||||
- equals_expression | ||||
- exact_cardinality | ||||
- minimum_cardinality | ||||
- maximum_cardinality | ||||
- has_member | ||||
|
@@ -2759,6 +2831,7 @@ classes: | |||
- domain | ||||
- slot_uri | ||||
- multivalued | ||||
- array | ||||
- inherited | ||||
- readonly | ||||
- ifabsent | ||||
|
@@ -2917,6 +2990,33 @@ classes: | |||
in_subset: | ||||
- SpecificationSubset | ||||
|
||||
array_expression: | ||||
description: defines the dimensions of an array | ||||
mixins: | ||||
- extensible | ||||
- annotatable | ||||
- common_metadata | ||||
slots: | ||||
- exact_number_dimensions | ||||
- minimum_number_dimensions | ||||
- maximum_number_dimensions | ||||
- has_extra_dimensions | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
- dimensions | ||||
status: testing | ||||
|
||||
dimension_expression: | ||||
description: defines one of the dimensions of an array | ||||
mixins: | ||||
- extensible | ||||
- annotatable | ||||
- common_metadata | ||||
slots: | ||||
- alias | ||||
- maximum_cardinality | ||||
- minimum_cardinality | ||||
- exact_cardinality | ||||
status: testing | ||||
|
||||
pattern_expression: | ||||
description: a regular expression pattern used to evaluate conformance of a string | ||||
mixins: | ||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
tests/input/examples/schema_definition-native-array-1.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
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 | ||
annotations: | ||
array_data_mapping: | ||
data: temperatures_in_K | ||
dims: [x, y, t] | ||
coords: | ||
latitude_in_deg: x | ||
longitude_in_deg: y | ||
time_in_d: t | ||
attributes: | ||
name: | ||
identifier: true | ||
range: string | ||
latitude_in_deg: | ||
required: true | ||
range: float | ||
multivalued: true | ||
unit: | ||
ucum_code: deg | ||
array: | ||
exact_number_dimensions: 1 | ||
longitude_in_deg: | ||
required: true | ||
range: float | ||
multivalued: true | ||
unit: | ||
ucum_code: deg | ||
array: | ||
exact_number_dimensions: 1 | ||
time_in_d: | ||
range: float | ||
multivalued: true | ||
implements: | ||
- linkml:elements | ||
required: true | ||
unit: | ||
ucum_code: d | ||
array: | ||
exact_number_dimensions: 1 | ||
temperatures_in_K: | ||
range: float | ||
multivalued: true | ||
required: true | ||
unit: | ||
ucum_code: K | ||
array: | ||
exact_number_dimensions: 3 | ||
|
52 changes: 52 additions & 0 deletions
52
tests/input/examples/schema_definition-native-array-rgb.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
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: | ||
rgb: | ||
range: float | ||
rly marked this conversation as resolved.
Show resolved
Hide resolved
|
||
array: | ||
# NPtyping: NDArray[Shape["* x, * y, 3 rgb"] | ||
exact_number_dimensions: 3 | ||
dimensions: | ||
- alias: x | ||
- alias: y | ||
- alias: rgb | ||
exact_cardinality: 3 | ||
description: r, g, b values | ||
annotations: | ||
names: "[red, green, blue]" | ||
SquareDataset: | ||
rly marked this conversation as resolved.
Show resolved
Hide resolved
|
||
attributes: | ||
square_matrix: | ||
rly marked this conversation as resolved.
Show resolved
Hide resolved
|
||
array: | ||
exact_number_dimensions: 2 | ||
dimensions: | ||
- alias: x | ||
- alias: y | ||
|
||
UnboundedTimeSeries: | ||
attributes: | ||
my_matrix: | ||
range: float | ||
array: | ||
dimensions: | ||
- alias: time | ||
maximum_number_dimensions: False | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.