@@ -11,19 +11,19 @@ odML Tutorial
1111:License:
1212 Creative Commons Attribution-ShareAlike 4.0 International
1313 `License <http://creativecommons.org/licenses/by-sa/4.0/ >`_
14- -------------------------------------------------------------------------------
1514
15+ -------------------------------------------------------------------------------
1616
1717odML (open metadata Markup Language)
1818====================================
1919
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
2727and facilitate the provenance tracking of your analysis projects.
2828
2929What are metadata and why are they needed?
@@ -46,62 +46,60 @@ Key features of odML
4646 - Machine- and human-readable
4747 - Interactive odML-Editor
4848 - Python-odML library
49- -------------------------------------------------------------------------------
5049
50+ -------------------------------------------------------------------------------
5151
5252Structure of this tutorial
5353==========================
5454
55- The scientific background of the possible user community of odML varies
55+ The scientific background of the possible user community of odML varies
5656enormously (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.
5959
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).
6565
6666At 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.
6969
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/).
7272
7373A 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> `_.
7675
7776-------------------------------------------------------------------------------
7877
79-
8078Download and Installation
8179=========================
8280
8381The 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
8886the project name `python-odml <https://github.com/G-Node/python-odml >`_.
8987
9088Dependencies
9189------------
9290
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.
9492
9593Additionally, the Python-odML library depends on Enum (version 0.4.4).
9694
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.
10098
101- On Ubuntu, the dependency packages are available as ``python-enum `` and
99+ On Ubuntu, the dependency packages are available as ``python-enum `` and
102100``python-lxml ``.
103101
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
105103installation of ``libxml2-dev ``, ``libxslt1-dev ``, and ``lib32z1-dev ``.
106104
107105
@@ -111,12 +109,12 @@ Installation...
111109... via pip:
112110************
113111
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
115113<https://pypi.python.org/pypi> `_ using `pip <https://pip.pypa.io/en/stable/ >`_::
116114
117115 $ pip install odml
118116
119- The appropriate Python dependencies (Enum and lxml) will be automatically
117+ The appropriate Python dependencies (Enum and lxml) will be automatically
120118downloaded and installed.
121119
122120If you are not familiar with PyPI and pip, please have a look at the available
@@ -125,14 +123,14 @@ online documentation.
125123Installation
126124------------
127125
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
129127repository from GitHub::
130128
131129 $ cd /home/usr/toolbox/
132130 $ git clone https://github.com/G-Node/python-odml.git
133131
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"
136134folder).
137135
138136To 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::
144142Bugs & Questions
145143----------------
146144
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
148146`the github bug tracker <https://github.com/G-Node/python-odml/issues >`_.
149147
150148If you have questions regarding the use of the library or the editor, ask
151149the question on `Stack Overflow <http://stackoverflow.com/ >`_, be sure to tag
152150it with `odml ` and we'll do our best to quickly solve the problem.
153151
154-
155152-------------------------------------------------------------------------------
156153
157-
158154Basic knowledge on odML
159155=======================
160156
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
164160objects.
165161
166162Document:
@@ -179,20 +175,20 @@ Property:
179175 - children: *none *
180176
181177
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
185181in an example odML file (e.g., "THGTTG.odml").
186182
187183
188184A first look
189185============
190186
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
196192python-odml module to your owns!::
197193
198194 $ cd /home/usr/.../python-odml
@@ -218,15 +214,15 @@ Second, load the example odML file with the following command lines::
218214If you open a Python shell outside of the Python-odML library directory, please
219215adapt your Python-Path and the path to the "THGTTG.odml" file accordingly.
220216
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,
224220Section, Property).
225221
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
227223them to build your own metadata odML file will be described in later chapters.
228224Further 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
230226provided via `the G-Node repository
231227<http://portal.g-node.org/odml/terminologies/v1.0/terminologies.xml> `_ can also
232228be 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::
242238 >>> print odmlEX
243239 <Doc 42 by Douglas Adams (2 sections)>
244240
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.
247243
248244The print out gives you already the follwing information about the odML file:
249245
250246- ``<...> `` indicates that you are looking at an object
251247- ``Doc `` tells you that you are looking at an odML Document
252248- ``42 `` is the user defined version of this odML file
253249- ``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
255251 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.
260256In total, a Document has the following 4 attributes:
261257
262258author
@@ -295,29 +291,29 @@ Let's check out all attributes with the following commands::
295291 >>> print(odmlEX.version)
296292 42
297293
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
300296the Document, and the parent attribute is ``None ``.
301297
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
305301following command::
306302
307303 >>> print(odmlEX.sections)
308304 [<Section TheCrew[crew] (4)>, <Section TheStarship[crew] (1)>]
309305
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
311307printout and attributes of a Section are explained in the next chapter.
312308
313309
314310The Sections
315311------------
316312
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
321317look at the first Section in the sections list attached to the Document in our
322318example odML file::
323319
@@ -330,22 +326,22 @@ example odML file::
330326 >>> print(odmlEX[0])
331327 <Section TheCrew[crew] (4)>
332328
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
334330short cut notation.
335331
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
337333already the following information:
338334
339- - ``<...>' indicates that you are looking at an object
335+ - ``<...> `` indicates that you are looking at an object
340336- ``Section `` tells you that you are looking at an odML Section
341337- ``TheCrew `` is the name of this Section
342338- ``[...] `` highlights the type of the Section (here ``crew ``)
343339- ``(4) `` states that this Section has four Sections directly attached to it
344340
345341Note 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
349345attributes:
350346
351347name
@@ -402,10 +398,10 @@ Let's have a look at the attributes for the Section 'TheCrew'::
402398 None
403399
404400As 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
406402same object, namely the our example Document.
407403
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
409405the following command::
410406
411407 >>> print(odmlEX['TheCrew'].sections)
@@ -425,7 +421,7 @@ Or, for accessing these sub-Sections::
425421 >>> print(odmlEX['TheCrew'][3])
426422 <Section Ford Prefect[crew/person] (0)>
427423
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
429425attached. Let's see which Properties are attached to the Section 'TheCrew'::
430426
431427 >>> print(odmlEX['TheCrew'].properties)
@@ -437,7 +433,7 @@ The printout and attributes of a Property are explained in the next chapter.
437433The Properties
438434--------------
439435
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
441437Section. You can then, either call a Property by name or by index::
442438
443439 >>> print(odmlEX['TheCrew'].properties['NoCrewMembers'])
@@ -447,15 +443,15 @@ Section. You can then, either call a Property by name or by index::
447443
448444In the following we will only call Properties explicitely by their name.
449445
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
451447following:
452448
453449- ``<...> `` indicates that you are looking at an object
454450- ``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
456452
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
459455defined by the following 9 attributes:
460456
461457name
@@ -533,7 +529,7 @@ Let's check which attributes were defined for the Property 'NoCrewMembers'::
533529 >>> print(odmlEX['TheCrew'].properties['NoCrewMembers'].dependency_value)
534530 None
535531
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
537533metadata when they have the same ``dtype `` and ``unit ``, as it is the case for
538534the Property 'NameCrewMembers'::
539535
@@ -546,10 +542,9 @@ the Property 'NameCrewMembers'::
546542 person
547543 >>> print(odmlEX['TheCrew'].properties['NameCrewMembers'].unit)
548544 None
549-
550545
551- -------------------------------------------------------------------------------
552546
547+ -------------------------------------------------------------------------------
553548
554549Generating an odML-file
555550=======================
0 commit comments