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
82 Groups:
83 slots:
84 - groups
85
86 Attribute:
87 mixins:
88 - DtypeMixin
89 slots:
90 - name
91 - dims
92 - shape
93 - value
94 - default_value
95 - doc
96 - required
97 slot_usage:
98 name:
99 required: true
100
101 Link:
102 slots:
103 - name
104 - doc
105 - target_type
106 - quantity
107
108 Dataset:
109 mixins:
110 - DtypeMixin
111 slots:
112 - neurodata_type_def
113 - neurodata_type_inc
114 - name
115 - default_name
116 - dims
117 - shape
118 - value
119 - default_value
120 - doc
121 - quantity
122 - linkable
123 - attributes
124
125 Datasets:
126 slots:
127 - datasets
128
129 ReferenceDtype:
130 slots:
131 - target_type
132 - reftype
133
134 CompoundDtype:
135 slots:
136 - name
137 - doc
138 - dtype
139 slot_usage:
140 name:
141 required: true
142 dtype:
143 required: true
144 any_of:
145 - range: ReferenceDtype
146 - range: FlatDtype
147 multivalued: false
148
149 DtypeMixin:
150 mixin: true
151 slots:
152 - dtype
153 rules:
154 - preconditions:
155 slot_conditions:
156 dtype:
157 range: FlatDtype
158 postconditions:
159 slot_conditions:
160 dtype:
161 multivalued: false
162
163 AnyType:
164 class_uri: linkml:Any
165
166
167slots:
168 # namespaces
169 doc:
170 required: true
171 description: Description of corresponding object.
172 name:
173 structured_pattern:
174 syntax: "{protected_string}"
175 interpolated: true
176 full_name:
177 description: Optional string with extended full name for the namespace.
178 version:
179 required: true
180 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-]+)*))?$"
181 date:
182 range: datetime
183 slot_uri: schema:dateModified
184 description: Date that a namespace was last modified or released
185 examples:
186 - value: 2017-04-25 17:14:13
187 author:
188 multivalued: true
189 required: true
190 slot_uri: schema:author
191 description: List of strings with the names of the authors of the namespace.
192 contact:
193 multivalued: true
194 required: true
195 slot_uri: schema:email
196 structured_pattern:
197 syntax: "{email}"
198 interpolated: true
199 description: List of strings with the contact information for the authors. Ordering of the contacts should match the ordering of the authors.
200 schema:
201 multivalued: true
202 range: Schema
203 description: List of the schema to be included in this namespace.
204 inlined_as_list: true
205 alias: schema_
206
207 # schema
208 source:
209 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.
210 pattern: ".*\\.(yml|yaml|json)"
211 namespace:
212 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.
213 namespaces:
214 multivalued: true
215 range: Namespace
216 inlined_as_list: true
217 neurodata_types:
218 multivalued: true
219 any_of:
220 - range: Dataset
221 - range: Group
222 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.
223 title:
224 description: a descriptive title for a file for documentation purposes.
225
226 # groups
227 neurodata_type_def:
228 description: Used alongside neurodata_type_inc to indicate inheritance, naming, and mixins
229 structured_pattern:
230 syntax: "{protected_string}"
231 interpolated: true
232 neurodata_type_inc:
233 description: Used alongside neurodata_type_def to indicate inheritance, naming, and mixins
234 structured_pattern:
235 syntax: "{protected_string}"
236 interpolated: true
237 default_name:
238 structured_pattern:
239 syntax: "{protected_string}"
240 interpolated: true
241 quantity:
242 any_of:
243 - range: integer
244 minimum_value: 1
245 - range: QuantityEnum
246 ifabsent: int(1)
247 todos:
248 - logic to check that the corresponding class can only be implemented quantity times.
249 linkable:
250 range: boolean
251
252 # Recursive properties
253 attributes:
254 range: Attribute
255 multivalued: true
256 datasets:
257 range: Dataset
258 multivalued: true
259 inlined_as_list: true
260 groups:
261 range: Group
262 multivalued: true
263 inlined_as_list: true
264 links:
265 range: Link
266 multivalued: true
267
268 # attributes
269 dtype:
270 any_of:
271 - range: FlatDtype
272 - range: CompoundDtype
273 - range: ReferenceDtype
274 multivalued: true
275 dims:
276 multivalued: true
277 any_of:
278 - range: string
279 - range: AnyType
280 todos:
281 - Can't quite figure out how to allow an array of arrays - see https://github.com/linkml/linkml/issues/895
282 shape:
283 multivalued: true
284 any_of:
285 - range: integer
286 minimum_value: 1
287 - equals_string: "null"
288 range: string
289 - range: AnyType
290 todos:
291 - Can't quite figure out how to allow an array of arrays - see https://github.com/linkml/linkml/issues/895
292 value:
293 range: AnyType
294 description: Optional constant, fixed value for the attribute.
295 default_value:
296 range: AnyType
297 description: Optional default value for variable-valued attributes.
298 required:
299 range: boolean
300 description: Optional boolean key describing whether the attribute is required. Default value is True.
301 ifabsent: "true"
302
303 # links
304 target_type:
305 description: Describes the neurodata_type of the target that the reference points
306 to
307 required: true
308# any_of:
309# - range: Dataset
310# - range: Group
311 reftype:
312 description: describes the kind of reference
313 range: reftype_options
314
315
316
317enums:
318 reftype_options:
319 permissible_values:
320 ref: { description: Reference to another group or dataset of the given target_type }
321 reference: { description: Reference to another group or dataset of the given target_type }
322 object: { description: Reference to another group or dataset of the given target_type }
323 region: { description: Reference to a region (i.e. subset) of another dataset of the given target_type}
324 QuantityEnum:
325 permissible_values:
326 "*":
327 description: Zero or more instances, equivalent to zero_or_many
328 "?":
329 description: Zero or one instances, equivalent to zero_or_one
330 "+":
331 description: One or more instances, equivalent to one_or_many
332 "zero_or_many":
333 description: Zero or more instances, equivalent to *
334 "one_or_many":
335 description: One or more instances, equivalent to +
336 "zero_or_one":
337 description: Zero or one instances, equivalent to ?
338 FlatDtype:
339 permissible_values:
340 "float":
341 description: single precision floating point (32 bit)
342 "float32":
343 description: single precision floating point (32 bit)
344 "double":
345 description: double precision floating point (64 bit)
346 "float64":
347 description: double precision floating point (64 bit)
348 "long":
349 description: signed 64 bit integer
350 "int64":
351 description: signed 64 bit integer
352 "int":
353 description: signed 32 bit integer
354 "int32":
355 description: signed 32 bit integer
356 "int16":
357 description: signed 16 bit integer
358 "short":
359 description: signed 16 bit integer
360 "int8":
361 description: signed 8 bit integer
362 "uint":
363 description: unsigned 32 bit integer
364 "uint32":
365 description: unsigned 32 bit integer
366 "uint16":
367 description: unsigned 16 bit integer
368 "uint8":
369 description: unsigned 8 bit integer
370 "uint64":
371 description: unsigned 64 bit integer
372 "numeric":
373 description: any numeric type (i.e., any int, uint, float)
374 "text":
375 description: 8-bit Unicode
376 "utf":
377 description: 8-bit Unicode
378 "utf8":
379 description: 8-bit Unicode
380 "utf-8":
381 description: 8-bit Unicode
382 "ascii":
383 description: ASCII text
384 "bool":
385 description: 8 bit integer with valid values 0 or 1
386 "isodatetime":
387 description: ISO 8601 datetime string
388 examples:
389 - value: 2018-09-28T14:43:54.123+02:00