Skip to content

Commit 356a065

Browse files
authored
Merge pull request #153 from linkml/refining-array-model
refining array model
2 parents ba95ed4 + 6690c03 commit 356a065

File tree

4 files changed

+554
-186
lines changed

4 files changed

+554
-186
lines changed
Lines changed: 260 additions & 35 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,245 @@ classes:
1936
Any:
2037
class_uri: linkml:Any
2138

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:
53+
description: >-
54+
the collection of values that make up the array. The elements have a *direct* representation which is
55+
an ordered sequence of values. The elements also have an *array interpretation*, where each
56+
element has a unique index which is determined by array_linearization_order
57+
58+
2259
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:
60+
is_a: Array
61+
description: >-
62+
An array that has one dimension
63+
aliases:
64+
- axis
65+
- 1D array
66+
- vector
67+
- series
68+
- row
69+
slots:
70+
- series_label
71+
- length
72+
# TODO: consider offset and rate
73+
slot_usage:
74+
dimensionality:
75+
equals_expression: "1"
76+
77+
TwoDimensionalArray:
78+
is_a: Array
79+
description: >-
80+
An array that has two dimensions
81+
aliases:
82+
- table
83+
- matrix
84+
- grid
85+
slots:
86+
- axis0
87+
- axis1
88+
slot_usage:
89+
dimensionality:
90+
equals_expression: "2"
91+
elements:
92+
description: >-
93+
this will be serialized as one big long list that should be interpreted as a 2D array
94+
95+
ThreeDimensionalArray:
96+
is_a: Array
97+
description: >-
98+
An array that has two dimensions
99+
aliases:
100+
- 3D array
101+
slots:
102+
- axis0
103+
- axis1
104+
- axis2
105+
slot_usage:
106+
dimensionality:
107+
equals_expression: "3"
108+
109+
OrderedArray:
110+
mixin: true
111+
description: >-
112+
A mixin that describes an array whose elements are mapped from a linear sequence to an array index
113+
via a specified mapping
114+
115+
ColumnOrderedArray:
116+
mixin: true
117+
description: >-
118+
An array ordering that is column-order
119+
slots:
120+
- array_linearization_order
121+
slot_usage:
122+
array_linearization_order:
123+
equals_string: COLUMN_MAJOR_ARRAY_ORDER
124+
125+
RowOrderedArray:
126+
mixin: true
127+
description: >-
128+
An array ordering that is row-order or generalizations thereof
129+
slots:
130+
- array_linearization_order
131+
slot_usage:
132+
array_linearization_order:
133+
equals_string: ROW_MAJOR_ARRAY_ORDER
134+
135+
MultiDimensionalArray:
136+
is_a: Array
137+
abstract: true
138+
description: >-
139+
An array that has more than two dimensions
140+
141+
ObjectAsTuple:
142+
comments:
143+
- not modeled as an array since this is used as a metaclass
144+
implements:
145+
- OneDimensionalSeries
146+
147+
ArrayIndex:
148+
is_a: ObjectAsTuple
149+
150+
Operation:
151+
abstract: true
152+
description: >-
153+
Represents the transformation of one or more inputs to one or more outputs determined by
154+
zero to many operation parameters
155+
slots:
156+
- specified_input
157+
- specified_output
158+
- operation_parameters
159+
160+
ArrayIndexOperation:
161+
description: >-
162+
An operation that takes as input an Array and is parameterized by an array index tuple and
163+
yields an array element
164+
slot_usage:
165+
specified_input:
166+
range: Array
167+
maximum_cardinality: 1
168+
specified_output:
29169
range: Any
30-
multivalued: true
31-
required: true
170+
maximum_cardinality: 1
171+
operation_parameters:
172+
range: ArrayIndex
173+
maximum_cardinality: 1
174+
175+
slots:
176+
dimensionality:
177+
description: >-
178+
The number of elements in the tuple used to access elements of an array
179+
aliases:
180+
- rank
181+
- dimension
182+
- number of axes
183+
- number of elements
184+
range: integer
185+
axis:
186+
abstract: true
187+
range: OneDimensionalSeries
188+
aliases:
189+
- dimension
190+
description: >-
191+
A one dimensional series that contains elements that form one part of a tuple used to access an array
192+
axis0:
193+
is_a: axis
194+
aliases:
195+
- x
196+
- dimension0
197+
description: >-
198+
An axis that is the zeroth index of the tuple used to access an array
199+
range: OneDimensionalSeries
200+
rank: 0
201+
required: true
202+
inlined: true
203+
inlined_as_list: true
204+
axis1:
205+
is_a: axis
206+
aliases:
207+
- y
208+
description: >-
209+
An axis that is the index after the zeroth of the tuple used to access an array
210+
range: OneDimensionalSeries
211+
rank: 1
212+
required: true
213+
inlined: true
214+
inlined_as_list: true
215+
axis2:
216+
is_a: axis
217+
aliases:
218+
- z
219+
range: OneDimensionalSeries
220+
rank: 2
221+
required: true
222+
inlined: true
223+
inlined_as_list: true
224+
elements:
225+
# this will be serialized as one big long list that should be interpreted as a 2D array
226+
range: Any
227+
aliases:
228+
- values
229+
required: true
230+
multivalued: true
231+
description: >-
232+
A collection of values that make up the contents of an array. These elements may be interpreted
233+
as a contiguous linear sequence (direct representation) or as elements to be accessed via an
234+
array index
235+
series_label: # the row label
236+
key: true
237+
description: >-
238+
A name that uniquely identifiers a series
239+
length:
240+
description: >-
241+
The number of elements in the array
242+
range: integer
243+
equals_expression: "length(elements)"
244+
array_linearization_order:
245+
range: ArrayLinearizationOrderOptions
246+
ifabsent: "string(ROW_MAJOR_ARRAY_ORDER)"
32247

33-
TwoDimensionalArray:
34-
attributes:
35-
axis0:
248+
specified_input:
249+
range: DataStructure
250+
multivalued: true
251+
specified_output:
252+
range: DataStructure
253+
multivalued: true
254+
operation_parameters:
255+
range: Any
256+
multivalued: true
257+
258+
enums:
259+
ArrayLinearizationOrderOptions:
260+
description: >-
261+
Determines how a linear contiguous representation of the elements of an array map
262+
to array indices
263+
permissible_values:
264+
COLUMN_MAJOR_ARRAY_ORDER:
265+
meaning: gom:columnMajorArray
266+
description: >-
267+
An array layout option in which the elements in each column is stored in consecutive positions,
268+
or any generalization thereof to dimensionality greater than 2
36269
aliases:
37-
- x
38-
range: OneDimensionalSeries
39-
rank: 0
40-
required: true
41-
inlined: true
42-
inlined_as_list: true
43-
axis1:
270+
- F order
271+
ROW_MAJOR_ARRAY_ORDER:
272+
meaning: gom:rowMajorArray
273+
description: >-
274+
An array layout option in which the elements in each row is stored in consecutive positions,
275+
or any generalization thereof to dimensionality greater than 2
44276
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
53-
range: Any
54-
required: true
55-
multivalued: true
277+
- C order
278+
aliases:
279+
- C order
280+

0 commit comments

Comments
 (0)