@@ -11,19 +11,19 @@ odML Tutorial
11
11
:License:
12
12
Creative Commons Attribution-ShareAlike 4.0 International
13
13
`License <http://creativecommons.org/licenses/by-sa/4.0/ >`_
14
- -------------------------------------------------------------------------------
15
14
15
+ -------------------------------------------------------------------------------
16
16
17
17
odML (open metadata Markup Language)
18
18
====================================
19
19
20
- odML (open metadata Markup Language) is a framework, proposed by `Grewe et al.
21
- (2011) <http://journal.frontiersin.org/article/10.3389/fninf.2011.00016/full> `_,
22
- to organize and store experimental metadata in a human- and machine-readable,
23
- XML based format (odml). In this tutorial we will illustrate the conceptual
24
- design of the odML framework and show hands-on how you can generate your own
25
- odML metadata file collection. A well organized metadata management of your
26
- experiment is a key component to guarantee the reproducibility of your research
20
+ odML (open metadata Markup Language) is a framework, proposed by `Grewe et al.
21
+ (2011) <http://journal.frontiersin.org/article/10.3389/fninf.2011.00016/full> `_,
22
+ to organize and store experimental metadata in a human- and machine-readable,
23
+ XML based format (odml). In this tutorial we will illustrate the conceptual
24
+ design of the odML framework and show hands-on how you can generate your own
25
+ odML metadata file collection. A well organized metadata management of your
26
+ experiment is a key component to guarantee the reproducibility of your research
27
27
and facilitate the provenance tracking of your analysis projects.
28
28
29
29
What are metadata and why are they needed?
@@ -46,62 +46,60 @@ Key features of odML
46
46
- Machine- and human-readable
47
47
- Interactive odML-Editor
48
48
- Python-odML library
49
- -------------------------------------------------------------------------------
50
49
50
+ -------------------------------------------------------------------------------
51
51
52
52
Structure of this tutorial
53
53
==========================
54
54
55
- The scientific background of the possible user community of odML varies
55
+ The scientific background of the possible user community of odML varies
56
56
enormously (e.g. physics, informatics, mathematics, biology, medicine,
57
- psychology). Some users will be trained programmers, others probably have never
58
- learned a programming language.
57
+ psychology). Some users will be trained programmers, others probably have never
58
+ learned a programming language.
59
59
60
- To cover the different demands of all users, we provide a slow introduction to
61
- the odML framework that even allows programming beginners to learn the basic
62
- concepts. We will demonstrate how to generate an odML file and present more
63
- advanced possibilies of the Python-odML library (e.g., how to search for
64
- certain metadata or how to integrate existing terminologies).
60
+ To cover the different demands of all users, we provide a slow introduction to
61
+ the odML framework that even allows programming beginners to learn the basic
62
+ concepts. We will demonstrate how to generate an odML file and present more
63
+ advanced possibilies of the Python-odML library (e.g., how to search for
64
+ certain metadata or how to integrate existing terminologies).
65
65
66
66
At the end of this tutorial we will provide a few guidelines that will help you
67
- to create an odML file structure that is optimised for your individual
68
- experimental project and complements the special needs of your laboratory.
67
+ to create an odML file structure that is optimised for your individual
68
+ experimental project and complements the special needs of your laboratory.
69
69
70
- The code for the example odML files, which we use within this tutorial is part
71
- of the documentation package (see doc/example_odMLs/).
70
+ The code for the example odML files, which we use within this tutorial is part
71
+ of the documentation package (see doc/example_odMLs/).
72
72
73
73
A summary of available odML terminologies and templates can be found `here
74
- <http://portal.g-node.org/odml/terminologies/v1.0/terminologies.xml> `_.
75
-
74
+ <http://portal.g-node.org/odml/terminologies/v1.0/terminologies.xml> `_.
76
75
77
76
-------------------------------------------------------------------------------
78
77
79
-
80
78
Download and Installation
81
79
=========================
82
80
83
81
The odML framework is an open source project of the German Neuroinformatics
84
- Node (`G-Node <http://www.g-node.org/ >`_, `odML project website
85
- <http://www.g-node.org/projects/odml> `_) of the International Neuroinformatics
86
- Coordination Facility (`INCF <http://www.g-node.org/ >`_). The source code for
87
- the Python-odML library is available on `GitHub <https://github.com/ >`_ under
82
+ Node (`G-Node <http://www.g-node.org/ >`_, `odML project website
83
+ <http://www.g-node.org/projects/odml> `_) of the International Neuroinformatics
84
+ Coordination Facility (`INCF <http://www.g-node.org/ >`_). The source code for
85
+ the Python-odML library is available on `GitHub <https://github.com/ >`_ under
88
86
the project name `python-odml <https://github.com/G-Node/python-odml >`_.
89
87
90
88
Dependencies
91
89
------------
92
90
93
- The Python-odML library (version 1.3) runs under Python 2.7 or 3.5.
91
+ The Python-odML library (version 1.3) runs under Python 2.7 or 3.5.
94
92
95
93
Additionally, the Python-odML library depends on Enum (version 0.4.4).
96
94
97
- When the odML-Python library is installed via pip or the setup.py, these
98
- packages will be automatically downloaded and installed. Alternatively, they
99
- can be installed from the OS package manager.
95
+ When the odML-Python library is installed via pip or the setup.py, these
96
+ packages will be automatically downloaded and installed. Alternatively, they
97
+ can be installed from the OS package manager.
100
98
101
- On Ubuntu, the dependency packages are available as ``python-enum `` and
99
+ On Ubuntu, the dependency packages are available as ``python-enum `` and
102
100
``python-lxml ``.
103
101
104
- Note that on Ubuntu 14.04, the latter package additionally requires the
102
+ Note that on Ubuntu 14.04, the latter package additionally requires the
105
103
installation of ``libxml2-dev ``, ``libxslt1-dev ``, and ``lib32z1-dev ``.
106
104
107
105
@@ -111,12 +109,12 @@ Installation...
111
109
... via pip:
112
110
************
113
111
114
- The simplest way to install the Python-odML library is from `PyPI
112
+ The simplest way to install the Python-odML library is from `PyPI
115
113
<https://pypi.python.org/pypi> `_ using `pip <https://pip.pypa.io/en/stable/ >`_::
116
114
117
115
$ pip install odml
118
116
119
- The appropriate Python dependencies (Enum and lxml) will be automatically
117
+ The appropriate Python dependencies (Enum and lxml) will be automatically
120
118
downloaded and installed.
121
119
122
120
If you are not familiar with PyPI and pip, please have a look at the available
@@ -125,14 +123,14 @@ online documentation.
125
123
Installation
126
124
------------
127
125
128
- To download the Python-odML library please either use git and clone the
126
+ To download the Python-odML library please either use git and clone the
129
127
repository from GitHub::
130
128
131
129
$ cd /home/usr/toolbox/
132
130
$ git clone https://github.com/G-Node/python-odml.git
133
131
134
- ... or if you don't want to use git download the ZIP file also provided on
135
- GitHub to your computer (e.g. as above on your home directory under a "toolbox"
132
+ ... or if you don't want to use git download the ZIP file also provided on
133
+ GitHub to your computer (e.g. as above on your home directory under a "toolbox"
136
134
folder).
137
135
138
136
To install the Python-odML library, enter the corresponding directory and run::
@@ -144,23 +142,21 @@ To install the Python-odML library, enter the corresponding directory and run::
144
142
Bugs & Questions
145
143
----------------
146
144
147
- Should you find a behaviour that is likely a bug, please file a bug report at
145
+ Should you find a behaviour that is likely a bug, please file a bug report at
148
146
`the github bug tracker <https://github.com/G-Node/python-odml/issues >`_.
149
147
150
148
If you have questions regarding the use of the library or the editor, ask
151
149
the question on `Stack Overflow <http://stackoverflow.com/ >`_, be sure to tag
152
150
it with `odml ` and we'll do our best to quickly solve the problem.
153
151
154
-
155
152
-------------------------------------------------------------------------------
156
153
157
-
158
154
Basic knowledge on odML
159
155
=======================
160
156
161
- Before we start, it is important to know the basic structure of an odML
162
- file. Within an odML file metadata are grouped and stored in a
163
- hierarchical tree structure which consists of four different odML
157
+ Before we start, it is important to know the basic structure of an odML
158
+ file. Within an odML file metadata are grouped and stored in a
159
+ hierarchical tree structure which consists of four different odML
164
160
objects.
165
161
166
162
Document:
@@ -179,20 +175,20 @@ Property:
179
175
- children: *none *
180
176
181
177
182
- Each of these odML objects has a certain set of attributes where the
183
- user can describe the object and its contents. Which attribute belongs
184
- to which object and what the attributes are used for, is better explained
178
+ Each of these odML objects has a certain set of attributes where the
179
+ user can describe the object and its contents. Which attribute belongs
180
+ to which object and what the attributes are used for, is better explained
185
181
in an example odML file (e.g., "THGTTG.odml").
186
182
187
183
188
184
A first look
189
185
============
190
186
191
- If you want to get familiar with the concept behind the odML framework and how
192
- to handle odML files in Python, you can have a first look at the example odML
193
- file provided in the Python-odML library. For this you first need to run the
194
- python code ("thgttg.py") to generate the example odML file ("THGTTG.odml").
195
- When using the following commands, make sure you adapt the paths to the
187
+ If you want to get familiar with the concept behind the odML framework and how
188
+ to handle odML files in Python, you can have a first look at the example odML
189
+ file provided in the Python-odML library. For this you first need to run the
190
+ python code ("thgttg.py") to generate the example odML file ("THGTTG.odml").
191
+ When using the following commands, make sure you adapt the paths to the
196
192
python-odml module to your owns!::
197
193
198
194
$ cd /home/usr/.../python-odml
@@ -218,15 +214,15 @@ Second, load the example odML file with the following command lines::
218
214
If you open a Python shell outside of the Python-odML library directory, please
219
215
adapt your Python-Path and the path to the "THGTTG.odml" file accordingly.
220
216
221
- How you can access the different odML objects and their attributes once you
222
- loaded an odML file and how you can make use of the attributes is described in
223
- more detail in the following chapters for each odML object type (Document,
217
+ How you can access the different odML objects and their attributes once you
218
+ loaded an odML file and how you can make use of the attributes is described in
219
+ more detail in the following chapters for each odML object type (Document,
224
220
Section, Property).
225
221
226
- How you can create the different odML objects on your own and how to connect
222
+ How you can create the different odML objects on your own and how to connect
227
223
them to build your own metadata odML file will be described in later chapters.
228
224
Further advanced functions you can use to navigate threw your odML files, or to
229
- create an odML template file, or to make use of common odML terminologies
225
+ create an odML template file, or to make use of common odML terminologies
230
226
provided via `the G-Node repository
231
227
<http://portal.g-node.org/odml/terminologies/v1.0/terminologies.xml> `_ can also
232
228
be found later on in this tutorial.
@@ -242,21 +238,21 @@ If you loaded the example odML file, let's have a first look at the Document::
242
238
>>> print odmlEX
243
239
<Doc 42 by Douglas Adams (2 sections)>
244
240
245
- As you can see, the printout gives you a short summary of the Document of the
246
- loaded example odML file.
241
+ As you can see, the printout gives you a short summary of the Document of the
242
+ loaded example odML file.
247
243
248
244
The print out gives you already the follwing information about the odML file:
249
245
250
246
- ``<...> `` indicates that you are looking at an object
251
247
- ``Doc `` tells you that you are looking at an odML Document
252
248
- ``42 `` is the user defined version of this odML file
253
249
- ``by D. N. Adams `` states the author of the odML file
254
- - ``(2 sections) `` tells you that this odML Document has 2 Section directly
250
+ - ``(2 sections) `` tells you that this odML Document has 2 Section directly
255
251
appended
256
-
257
- Note that the Document printout tells you nothing about the depth of the
258
- complete tree structure, because it is not displaying the children of its
259
- directly attached Sections. It also does not display all Document attributes.
252
+
253
+ Note that the Document printout tells you nothing about the depth of the
254
+ complete tree structure, because it is not displaying the children of its
255
+ directly attached Sections. It also does not display all Document attributes.
260
256
In total, a Document has the following 4 attributes:
261
257
262
258
author
@@ -295,29 +291,29 @@ Let's check out all attributes with the following commands::
295
291
>>> print(odmlEX.version)
296
292
42
297
293
298
- As expected for a Document, the attributes author and version match the
299
- information given in the Document printout, the document attribute just returns
294
+ As expected for a Document, the attributes author and version match the
295
+ information given in the Document printout, the document attribute just returns
300
296
the Document, and the parent attribute is ``None ``.
301
297
302
- As you learned in the beginning, Sections can be attached to a Document. They
303
- represent the next hierarchy level of an odML file. Let's have a look which
304
- Sections were attached to the Document of our example odML file using the
298
+ As you learned in the beginning, Sections can be attached to a Document. They
299
+ represent the next hierarchy level of an odML file. Let's have a look which
300
+ Sections were attached to the Document of our example odML file using the
305
301
following command::
306
302
307
303
>>> print(odmlEX.sections)
308
304
[<Section TheCrew[crew] (4)>, <Section TheStarship[crew] (1)>]
309
305
310
- As expected from the Document printout our example contains two Sections. The
306
+ As expected from the Document printout our example contains two Sections. The
311
307
printout and attributes of a Section are explained in the next chapter.
312
308
313
309
314
310
The Sections
315
311
------------
316
312
317
- There are several ways to access Sections. You can either call them by name or
318
- by index using either explicitely the function that returns the list of
319
- Sections (see last part of `The Document `_ chapter) or using again a short cut
320
- notation. Let's test all the different ways to access a Section, by having a
313
+ There are several ways to access Sections. You can either call them by name or
314
+ by index using either explicitely the function that returns the list of
315
+ Sections (see last part of `The Document `_ chapter) or using again a short cut
316
+ notation. Let's test all the different ways to access a Section, by having a
321
317
look at the first Section in the sections list attached to the Document in our
322
318
example odML file::
323
319
@@ -330,22 +326,22 @@ example odML file::
330
326
>>> print(odmlEX[0])
331
327
<Section TheCrew[crew] (4)>
332
328
333
- In the following we will call Sections explicitely by their name using the
329
+ In the following we will call Sections explicitely by their name using the
334
330
short cut notation.
335
331
336
- The printout of a Section is similar to the Document printout and gives you
332
+ The printout of a Section is similar to the Document printout and gives you
337
333
already the following information:
338
334
339
- - ``<...>' indicates that you are looking at an object
335
+ - ``<...> `` indicates that you are looking at an object
340
336
- ``Section `` tells you that you are looking at an odML Section
341
337
- ``TheCrew `` is the name of this Section
342
338
- ``[...] `` highlights the type of the Section (here ``crew ``)
343
339
- ``(4) `` states that this Section has four Sections directly attached to it
344
340
345
341
Note that the Section printout tells you nothing about the number of attached
346
- Properties or again about the depth of a possible sub-Section tree below the
347
- directly attached ones. It also only list the type of the Section as one of the
348
- Section attributes. In total, a Section can be defined by the following 5
342
+ Properties or again about the depth of a possible sub-Section tree below the
343
+ directly attached ones. It also only list the type of the Section as one of the
344
+ Section attributes. In total, a Section can be defined by the following 5
349
345
attributes:
350
346
351
347
name
@@ -402,10 +398,10 @@ Let's have a look at the attributes for the Section 'TheCrew'::
402
398
None
403
399
404
400
As expected for this Section, the name and type attribute match the information
405
- given in the Section printout, and the document and parent attribute return the
401
+ given in the Section printout, and the document and parent attribute return the
406
402
same object, namely the our example Document.
407
403
408
- To see which Sections are directly attached to the Section 'TheCrew' use again
404
+ To see which Sections are directly attached to the Section 'TheCrew' use again
409
405
the following command::
410
406
411
407
>>> print(odmlEX['TheCrew'].sections)
@@ -425,7 +421,7 @@ Or, for accessing these sub-Sections::
425
421
>>> print(odmlEX['TheCrew'][3])
426
422
<Section Ford Prefect[crew/person] (0)>
427
423
428
- As you learned, besides sub-Sections, a Section can also have Properties
424
+ As you learned, besides sub-Sections, a Section can also have Properties
429
425
attached. Let's see which Properties are attached to the Section 'TheCrew'::
430
426
431
427
>>> print(odmlEX['TheCrew'].properties)
@@ -437,7 +433,7 @@ The printout and attributes of a Property are explained in the next chapter.
437
433
The Properties
438
434
--------------
439
435
440
- Properties need to be called explicitely via the properties function of a
436
+ Properties need to be called explicitely via the properties function of a
441
437
Section. You can then, either call a Property by name or by index::
442
438
443
439
>>> print(odmlEX['TheCrew'].properties['NoCrewMembers'])
@@ -447,15 +443,15 @@ Section. You can then, either call a Property by name or by index::
447
443
448
444
In the following we will only call Properties explicitely by their name.
449
445
450
- The Property printout is reduced and only gives you information about the
446
+ The Property printout is reduced and only gives you information about the
451
447
following:
452
448
453
449
- ``<...> `` indicates that you are looking at an object
454
450
- ``Property `` tells you that you are looking at an odML Property
455
- - ``NoCrewMembers `` is the name of this Property
451
+ - ``NoCrewMembers `` is the name of this Property
456
452
457
- Note that the Property printout tells you nothing about the number of Values,
458
- and very little about the Property attributes. In total, a Property can be
453
+ Note that the Property printout tells you nothing about the number of Values,
454
+ and very little about the Property attributes. In total, a Property can be
459
455
defined by the following 9 attributes:
460
456
461
457
name
@@ -533,7 +529,7 @@ Let's check which attributes were defined for the Property 'NoCrewMembers'::
533
529
>>> print(odmlEX['TheCrew'].properties['NoCrewMembers'].dependency_value)
534
530
None
535
531
536
- As mentioned the value attribute of a Property can only contain multiple
532
+ As mentioned the value attribute of a Property can only contain multiple
537
533
metadata when they have the same ``dtype `` and ``unit ``, as it is the case for
538
534
the Property 'NameCrewMembers'::
539
535
@@ -546,10 +542,9 @@ the Property 'NameCrewMembers'::
546
542
person
547
543
>>> print(odmlEX['TheCrew'].properties['NameCrewMembers'].unit)
548
544
None
549
-
550
545
551
- -------------------------------------------------------------------------------
552
546
547
+ -------------------------------------------------------------------------------
553
548
554
549
Generating an odML-file
555
550
=======================
0 commit comments