Skip to content

Commit fdbcf0d

Browse files
committed
refinements to array metamodel
1 parent ba95ed4 commit fdbcf0d

File tree

3 files changed

+407
-187
lines changed

3 files changed

+407
-187
lines changed
Lines changed: 256 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,31 @@
1-
id: https://w3id.org/linkml/linkml-arrays
2-
name: linkml-arrays
3-
title: linkml-arrays
1+
id: https://w3id.org/linkml/lib/arrays
2+
name: arrays
3+
title: LinkML Arrays
44
description: |-
5-
LinkML schema to store one-dimensional series and two-dimensional arrays.
5+
LinkML templates for storing one-dimensional series, two-dimensional arrays,
6+
and arrays of higher dimensionality.
7+
8+
Status: Experimental
9+
10+
Note that this model is not intended to be imported direcly. Instead,
11+
use `implements` to denote conformance.
12+
13+
status: testing
14+
#contributors:
15+
# - github:rly
16+
# - github:oruebel
17+
# - github:jmchandonia
18+
# - github:realmarcin
19+
# - github:mavaylon1
20+
# - github:ialarmedalien
21+
# - github:cmungall
622

723
prefixes:
8-
arrays: https://w3id.org/linkml/linkml-arrays
924
linkml: https://w3id.org/linkml/
25+
github: https://github.com/
26+
gom: https://w3id.org/gom#
1027

11-
default_prefix: arrays
28+
default_prefix: linkml
1229
default_range: string
1330

1431
imports:
@@ -19,37 +36,240 @@ classes:
1936
Any:
2037
class_uri: linkml:Any
2138

22-
OneDimensionalSeries:
23-
attributes:
24-
name: # the row label
25-
key: true # unique when nested (unlike identifier, which is a global identifier)
26-
length:
27-
range: integer
28-
values:
29-
range: Any
30-
multivalued: true
39+
DataStructure:
40+
abstract: true
41+
42+
Array:
43+
description: >-
44+
a data structure consisting of a collection of *elements*, each identified by at least one array index tuple.
45+
abstract: true
46+
is_a: DataStructure
47+
slots:
48+
- dimensionality
49+
- elements
50+
- array_linearization_order
51+
slot_usage:
52+
elements:
3153
required: true
54+
description: >-
55+
the collection of values that make up the array. The elements have a *direct* representation which is
56+
an ordered sequence of values. The elements also have an *array interpretation*, where each
57+
element has a unique index which is determined by array_linearization_order
3258
59+
60+
OneDimensionalSeries:
61+
is_a: Array
62+
description: >-
63+
An array that has one dimension
64+
aliases:
65+
- axis
66+
- 1D array
67+
- vector
68+
- series
69+
- row
70+
slots:
71+
- series_label
72+
- length
73+
# TODO: consider offset and rate
74+
slot_usage:
75+
dimensionality:
76+
equals_expression: "1"
77+
3378
TwoDimensionalArray:
34-
attributes:
35-
axis0:
36-
aliases:
37-
- x
38-
range: OneDimensionalSeries
39-
rank: 0
40-
required: true
41-
inlined: true
42-
inlined_as_list: true
43-
axis1:
44-
aliases:
45-
- y
46-
range: OneDimensionalSeries
47-
rank: 1
48-
required: true
49-
inlined: true
50-
inlined_as_list: true
51-
values:
52-
# this will be serialized as one big long list that should be interpreted as a 2D array
79+
is_a: Array
80+
description: >-
81+
An array that has two dimensions
82+
aliases:
83+
- table
84+
- matrix
85+
- grid
86+
slots:
87+
- axis0
88+
- axis1
89+
slot_usage:
90+
dimensionality:
91+
equals_expression: "2"
92+
elements:
93+
description: >-
94+
this will be serialized as one big long list that should be interpreted as a 2D array
95+
96+
ThreeDimensionalArray:
97+
is_a: Array
98+
description: >-
99+
An array that has two dimensions
100+
aliases:
101+
- 3D array
102+
slots:
103+
- axis0
104+
- axis1
105+
- axis2
106+
slot_usage:
107+
dimensionality:
108+
equals_expression: "3"
109+
110+
OrderedArray:
111+
mixin: true
112+
description: >-
113+
A mixin that describes an array whose elements are mapped from a linear sequence to an array index
114+
via a specified mapping
115+
116+
ColumnOrderedArray:
117+
mixin: true
118+
description: >-
119+
An array ordering that is column-order
120+
slots:
121+
- array_linearization_order
122+
slot_usage:
123+
array_linearization_order:
124+
equals_string: COLUMN_MAJOR_ARRAY_ORDER
125+
126+
RowOrderedArray:
127+
mixin: true
128+
description: >-
129+
An array ordering that is row-order or generalizations thereof
130+
slots:
131+
- array_linearization_order
132+
slot_usage:
133+
array_linearization_order:
134+
equals_string: ROW_MAJOR_ARRAY_ORDER
135+
136+
MultiDimensionalArray:
137+
is_a: Array
138+
abstract: true
139+
description: >-
140+
An array that has more than two dimensions
141+
142+
ObjectAsTuple:
143+
comments:
144+
- not modeled as an array since this is used as a metaclass
145+
implements:
146+
- OneDimensionalSeries
147+
148+
ArrayIndex:
149+
is_a: ObjectAsTuple
150+
151+
Operation:
152+
abstract: true
153+
description: >-
154+
Represents the transformation of one or more inputs to one or more outputs determined by
155+
zero to many operation parameters
156+
slots:
157+
- specified_input
158+
- specified_output
159+
- operation_parameters
160+
161+
ArrayIndexOperation:
162+
description: >-
163+
An operation that takes as input an Array and is parameterized by an array index tuple and
164+
yields an array element
165+
slot_usage:
166+
specified_input:
167+
range: Array
168+
maximum_cardinality: 1
169+
specified_output:
53170
range: Any
54-
required: true
55-
multivalued: true
171+
maximum_cardinality: 1
172+
operation_parameters:
173+
range: ArrayIndex
174+
maximum_cardinality: 1
175+
176+
slots:
177+
dimensionality:
178+
description: >-
179+
The number of elements in the tuple used to access elements of an array
180+
aliases:
181+
- rank
182+
- dimension
183+
- number of axes
184+
- number of elements
185+
range: integer
186+
axis:
187+
abstract: true
188+
range: OneDimensionalSeries
189+
aliases:
190+
- dimension
191+
description: >-
192+
A one dimensional series that contains elements that form one part of a tuple used to access an array
193+
axis0:
194+
is_a: axis
195+
aliases:
196+
- x
197+
- dimension0
198+
description: >-
199+
An axis that is the zeroth index of the tuple used to access an array
200+
range: OneDimensionalSeries
201+
rank: 0
202+
required: true
203+
inlined: true
204+
inlined_as_list: true
205+
axis1:
206+
is_a: axis
207+
aliases:
208+
- y
209+
description: >-
210+
An axis that is the index after the zeroth of the tuple used to access an array
211+
range: OneDimensionalSeries
212+
rank: 1
213+
required: true
214+
inlined: true
215+
inlined_as_list: true
216+
axis2:
217+
is_a: axis
218+
aliases:
219+
- z
220+
range: OneDimensionalSeries
221+
rank: 2
222+
required: true
223+
inlined: true
224+
inlined_as_list: true
225+
elements:
226+
# this will be serialized as one big long list that should be interpreted as a 2D array
227+
range: Any
228+
aliases:
229+
- values
230+
required: true
231+
multivalued: true
232+
description: >-
233+
A collection of values that make up the contents of an array. These elements may be interpreted
234+
as a contiguous linear sequence (direct representation) or as elements to be accessed via an
235+
array index
236+
series_label: # the row label
237+
key: true
238+
description: >-
239+
A name that uniquely identifiers a series
240+
length:
241+
description: >-
242+
The number of elements in the array
243+
range: integer
244+
equals_expression: "length(elements)"
245+
array_linearization_order:
246+
range: ArrayLinearizationOrderOptions
247+
ifabsent: "string(ROW_MAJOR_ARRAY_ORDER)"
248+
249+
specified_input:
250+
range: DataStructure
251+
multivalued: true
252+
specified_output:
253+
range: DataStructure
254+
multivalued: true
255+
operation_parameters:
256+
range: Any
257+
multivalued: true
258+
259+
enums:
260+
ArrayLinearizationOrderOptions:
261+
description: >-
262+
Determines how a linear contiguous representation of the elements of an array map
263+
to array indices
264+
permissible_values:
265+
COLUMN_MAJOR_ARRAY_ORDER:
266+
meaning: gom:columnMajorArray
267+
description: >-
268+
An array layout option in which the elements in each row are stored in consecutive positions,
269+
or any generalization thereof to dimensionality greater than 2
270+
ROW_MAJOR_ARRAY_ORDER:
271+
meaning: gom:rowMajorArray
272+
description: >-
273+
An array layout option in which the elements in each row are stored in consecutive positions,
274+
or any generalization thereof to dimensionality greater than 2
275+

0 commit comments

Comments
 (0)