1---
2id: https://w3id.org/p2p_ld/nwb-schema-language
3name: nwb-schema-language
4title: nwb-schema-language
5description: |-
6 Translation of the nwb-schema-language to LinkML
7license: GNU GPL v3.0
8see_also:
9 - https://p2p_ld.github.io/nwb-schema-language
10
11prefixes:
12 nwb_schema_language: https://w3id.org/p2p_ld/nwb-schema-language/
13 linkml: https://w3id.org/linkml/
14 schema: http://schema.org/
15
16default_prefix: nwb_schema_language
17default_range: string
18
19imports:
20 - linkml:types
21
22settings:
23 email: "\\S+@\\S+{\\.\\w}+"
24 protected_string: "^[A-Za-z_][A-Za-z0-9_]*$"
25
26classes:
27 Namespace:
28 slots:
29 - doc
30 - name
31 - full_name
32 - version
33 - date
34 - author
35 - contact
36 - schema
37 slot_usage:
38 name:
39 required: true
40
41 Namespaces:
42 slots:
43 - namespaces
44
45 Schema:
46 slots:
47 - source
48 - namespace
49 - title
50 - neurodata_types
51 attributes:
52 doc:
53 required: false
54 rules:
55 - preconditions: {slot_conditions: { namespace: { value_presence: ABSENT }}}
56 postconditions: {slot_conditions: { source: {required: true }}}
57 description: If namespace is absent, source is required
58 - preconditions: {slot_conditions: { source: { value_presence: ABSENT }}}
59 postconditions: {slot_conditions: { namespace: {required: true }}}
60 description: If source is absent, namespace is required.
61 - preconditions: { slot_conditions: { namespace: { value_presence: PRESENT }}}
62 postconditions: { slot_conditions: { source: { value_presence: ABSENT }}}
63 description: If namespace is present, source is cannot be
64 - preconditions: { slot_conditions: { source: { value_presence: PRESENT }}}
65 postconditions: { slot_conditions: { namespace: { value_presence: ABSENT }}}
66 description: If source is present, namespace cannot be.
67
68 Group:
69 slots:
70 - neurodata_type_def
71 - neurodata_type_inc
72 - name
73 - default_name
74 - doc
75 - quantity
76 - linkable
77 - attributes
78 - datasets
79 - groups
80 - links
81 - parent
82
83 Groups:
84 slots:
85 - groups
86
87 Attribute:
88 mixins:
89 - DtypeMixin
90 slots:
91 - name
92 - dims
93 - shape
94 - value
95 - default_value
96 - doc
97 - required
98 - parent
99 slot_usage:
100 name:
101 required: true
102 parent:
103 any_of:
104 - range: Group
105 - range: Dataset
106
107 Link:
108 slots:
109 - name
110 - doc
111 - target_type
112 - quantity
113
114 Dataset:
115 mixins:
116 - DtypeMixin
117 slots:
118 - neurodata_type_def
119 - neurodata_type_inc
120 - name
121 - default_name
122 - dims
123 - shape
124 - value
125 - default_value
126 - doc
127 - quantity
128 - linkable
129 - attributes
130 - parent
131
132 Datasets:
133 slots:
134 - datasets
135
136 ReferenceDtype:
137 slots:
138 - target_type
139 - reftype
140
141 CompoundDtype:
142 slots:
143 - name
144 - doc
145 - dtype
146 slot_usage:
147 name:
148 required: true
149 dtype:
150 required: true
151 any_of:
152 - range: ReferenceDtype
153 - range: FlatDtype
154 multivalued: false
155
156 DtypeMixin:
157 mixin: true
158 slots:
159 - dtype
160 rules:
161 - preconditions:
162 slot_conditions:
163 dtype:
164 range: FlatDtype
165 postconditions:
166 slot_conditions:
167 dtype:
168 multivalued: false
169
170 AnyType:
171 class_uri: linkml:Any
172
173
174slots:
175 # namespaces
176 doc:
177 required: true
178 description: Description of corresponding object.
179 name:
180 structured_pattern:
181 syntax: "{protected_string}"
182 interpolated: true
183 full_name:
184 description: Optional string with extended full name for the namespace.
185 version:
186 required: true
187# pattern: "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"
188 date:
189 range: datetime
190 slot_uri: schema:dateModified
191 description: Date that a namespace was last modified or released
192 examples:
193 - value: 2017-04-25 17:14:13
194 author:
195 multivalued: true
196 required: true
197 slot_uri: schema:author
198 description: List of strings with the names of the authors of the namespace.
199 contact:
200 multivalued: true
201 required: true
202 slot_uri: schema:email
203 structured_pattern:
204 syntax: "{email}"
205 interpolated: true
206 description: List of strings with the contact information for the authors. Ordering of the contacts should match the ordering of the authors.
207 schema:
208 multivalued: true
209 range: Schema
210 description: List of the schema to be included in this namespace.
211 inlined_as_list: true
212 alias: schema_
213
214 # schema
215 source:
216 description: describes the name of the YAML (or JSON) file with the schema specification. The schema files should be located in the same folder as the namespace file.
217 namespace:
218 description: describes a named reference to another namespace. In contrast to source, this is a reference by name to a known namespace (i.e., the namespace is resolved during the build and must point to an already existing namespace). This mechanism is used to allow, e.g., extension of a core namespace (here the NWB core namespace) without requiring hard paths to the files describing the core namespace. Either source or namespace must be specified, but not both.
219 namespaces:
220 multivalued: true
221 range: Namespace
222 inlined_as_list: true
223 neurodata_types:
224 multivalued: true
225 any_of:
226 - range: Dataset
227 - range: Group
228 description: an optional list of strings indicating which data types should be included from the given specification source or namespace. The default is null indicating that all data types should be included.
229 title:
230 description: a descriptive title for a file for documentation purposes.
231
232 # groups
233 neurodata_type_def:
234 description: Used alongside neurodata_type_inc to indicate inheritance, naming, and mixins
235 structured_pattern:
236 syntax: "{protected_string}"
237 interpolated: true
238 neurodata_type_inc:
239 description: Used alongside neurodata_type_def to indicate inheritance, naming, and mixins
240 structured_pattern:
241 syntax: "{protected_string}"
242 interpolated: true
243 default_name:
244 structured_pattern:
245 syntax: "{protected_string}"
246 interpolated: true
247 quantity:
248 any_of:
249 - range: integer
250 minimum_value: 1
251 - range: QuantityEnum
252 ifabsent: int(1)
253 todos:
254 - logic to check that the corresponding class can only be implemented quantity times.
255 linkable:
256 range: boolean
257
258 # Recursive properties
259 attributes:
260 range: Attribute
261 multivalued: true
262 datasets:
263 range: Dataset
264 multivalued: true
265 inlined_as_list: true
266 groups:
267 range: Group
268 multivalued: true
269 inlined_as_list: true
270 links:
271 range: Link
272 multivalued: true
273
274 # attributes
275 dtype:
276 any_of:
277 - range: FlatDtype
278 - range: CompoundDtype
279 - range: ReferenceDtype
280 multivalued: true
281 dims:
282 multivalued: true
283 any_of:
284 - range: string
285 - range: AnyType
286 todos:
287 - Can't quite figure out how to allow an array of arrays - see https://github.com/linkml/linkml/issues/895
288 shape:
289 multivalued: true
290 any_of:
291 - range: integer
292 minimum_value: 1
293 - equals_string: "null"
294 range: string
295 - range: AnyType
296 todos:
297 - Can't quite figure out how to allow an array of arrays - see https://github.com/linkml/linkml/issues/895
298 value:
299 range: AnyType
300 description: Optional constant, fixed value for the attribute.
301 default_value:
302 range: AnyType
303 description: Optional default value for variable-valued attributes.
304 required:
305 range: boolean
306 description: Optional boolean key describing whether the attribute is required. Default value is True.
307 ifabsent: "true"
308
309 # links
310 target_type:
311 description: Describes the neurodata_type of the target that the reference points
312 to
313 required: true
314# any_of:
315# - range: Dataset
316# - range: Group
317 reftype:
318 description: describes the kind of reference
319 range: reftype_options
320
321 # extra - not defined in nwb-schema-language but useful when working with class objects
322 parent:
323 description: The parent group that contains this dataset or group
324 range: Group
325 required: false
326
327
328enums:
329 reftype_options:
330 permissible_values:
331 ref: { description: Reference to another group or dataset of the given target_type }
332 reference: { description: Reference to another group or dataset of the given target_type }
333 object: { description: Reference to another group or dataset of the given target_type }
334 region: { description: Reference to a region (i.e. subset) of another dataset of the given target_type}
335 QuantityEnum:
336 permissible_values:
337 "*":
338 description: Zero or more instances, equivalent to zero_or_many
339 "?":
340 description: Zero or one instances, equivalent to zero_or_one
341 "+":
342 description: One or more instances, equivalent to one_or_many
343 "zero_or_many":
344 description: Zero or more instances, equivalent to *
345 "one_or_many":
346 description: One or more instances, equivalent to +
347 "zero_or_one":
348 description: Zero or one instances, equivalent to ?
349 FlatDtype:
350 permissible_values:
351 "float":
352 description: single precision floating point (32 bit)
353 "float32":
354 description: single precision floating point (32 bit)
355 "double":
356 description: double precision floating point (64 bit)
357 "float64":
358 description: double precision floating point (64 bit)
359 "long":
360 description: signed 64 bit integer
361 "int64":
362 description: signed 64 bit integer
363 "int":
364 description: signed 32 bit integer
365 "int32":
366 description: signed 32 bit integer
367 "int16":
368 description: signed 16 bit integer
369 "short":
370 description: signed 16 bit integer
371 "int8":
372 description: signed 8 bit integer
373 "uint":
374 description: unsigned 32 bit integer
375 "uint32":
376 description: unsigned 32 bit integer
377 "uint16":
378 description: unsigned 16 bit integer
379 "uint8":
380 description: unsigned 8 bit integer
381 "uint64":
382 description: unsigned 64 bit integer
383 "numeric":
384 description: any numeric type (i.e., any int, uint, float)
385 "text":
386 description: 8-bit Unicode
387 "utf":
388 description: 8-bit Unicode
389 "utf8":
390 description: 8-bit Unicode
391 "utf-8":
392 description: 8-bit Unicode
393 "ascii":
394 description: ASCII text
395 "bool":
396 description: 8 bit integer with valid values 0 or 1
397 "isodatetime":
398 description: ISO 8601 datetime string
399 examples:
400 - value: 2018-09-28T14:43:54.123+02:00