summaryrefslogtreecommitdiffstats
path: root/doc/html/ddl.html
blob: 038bf0da2dc0b74cb0887d0c0c97394f1e44ecc3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<html>

<head>
<TITLE>DDL for HDF5</TITLE>
</head>

<body>

<B> DDL in BNF  </B> <br>

<P>
The following describes the data description language for HDF5 file. 
The description is in Backus-Naur Form.  A quick explanation
of the some symbols used.

<PRE>
	::=               defined as
	&lt;tname&gt;           a token with the name tname
	&lt;a&gt; | &lt;b&gt;         one of &lt;a&gt; or &lt;b&gt;
	&lt;a&gt;<FONT SIZE=1.7>opt</FONT>             zero or one occurrence of &lt;a&gt;
	&lt;a&gt;*              zero or more occurrence of &lt;a&gt;
	&lt;a&gt;+              one or more occurrence of &lt;a&gt;
        TBD               To Be Decided


&lt;file&gt; ::= hdf5 "&lt;file_name&gt;" { &lt;file_boot_block&gt;<FONT SIZE=1.7>opt</FONT> &lt;root_group&gt; }

&lt;file_name&gt; ::= &lt;identifier&gt;

&lt;file_boot_block&gt; ::= boot_block { &lt;boot_block_content&gt; }

&lt;boot_block_content&gt; ::= TBD

&lt;root_group&gt; ::= group "/" { &lt;group_attribute&gt;* &lt;group_member&gt;* }  
// Attributes and members can be in any order.

&lt;group_attribute&gt; ::= &lt;attribute&gt; 

&lt;attribute&gt; ::= attribute "attr_name" { &lt;datatype&gt;    
                                        &lt;dataspace&gt;   
                                        &lt;data&gt;<FONT SIZE=1.7>opt</FONT>  } 
// &lt;datatype&gt;, &lt;dataspace&gt; and &lt;data&gt; can be in any order 
// as long as &lt;data&gt; comes the last.

&lt;attr_name&gt; ::=  &lt;identifier&gt;

&lt;datatype&gt; ::= datatype { "&lt;datatype_name&gt;" } |          // shared data type
               datatype { &lt;scalar_datatype&gt; }  |         
               datatype { &lt;dt_definition&gt;+ }        

&lt;datatype_name&gt; ::= &lt;identifier&gt;

&lt;scalar_datatype&gt; ::= H5T_NATIVE_CHAR | H5T_NATIVE_INT | ...     // data types supported by HDF5

&lt;dt_definition&gt; ::= &lt;scalar_datatype&gt; &lt;field_name&gt; ;

&lt;field_name&gt; ::= &lt;identifier&gt;

&lt;dataspace&gt; ::= dataspace { "&lt;dataspace_name&gt;" } |
                dataspace { array &lt;current_dims&gt; &lt;max_dims&gt;} | 
                dataspace { other &lt;ds_definition&gt;+ } 

&lt;dataspace_name&gt; ::= &lt;identifier&gt;

&lt;current_dims&gt; ::= a list of integers represented as (<i>i<FONT SIZE=1.0>1</i></FONT>, <i>i<FONT SIZE=1.0>2</i></FONT>, ... ) where <i>i<FONT SIZE=1.0>k</i></FONT> is an integer, <i>k</i> = 1,2,...

&lt;max_dims&gt; ::= (<i>i<FONT SIZE=1.0>1</i></FONT>, <i>i<FONT SIZE=1.0>2</i></FONT>, ... ) where <i>i<FONT SIZE=1.0>k</i></FONT> is an integer or H5S_UNLIMITED

&lt;ds_definition&gt; ::= TBD

&lt;data&gt; ::= data {TBD}

&lt;group_member&gt; ::= &lt;named_datatype&gt; | &lt;named_dataspace&gt; | &lt;group&gt; | &lt;dataset&gt; | &lt;link&gt;

&lt;named_datatype&gt; ::= datatype "&lt;datatype_name&gt;" { &lt;dt_definition&gt;+ }

&lt;named_dataspace&gt; ::= dataspace "&lt;dataspace_name&gt;" {array &lt;current_dims&gt; &lt;max_dims&gt; } |
                     dataspace "&lt;dataspace_name&gt;" { other &lt;ds_definition&gt;+ }

&lt;group&gt; ::= group "&lt;group_name&gt;" { &lt;group_attribute&gt;* &lt;group_member&gt;* }  
// Attributes and members can be in any order.

&lt;group_name&gt; ::= &lt;identifier&gt;

&lt;dataset&gt; ::= dataset "&lt;dataset_name&gt;" { &lt;datatype&gt;  
                                         &lt;dataspace&gt; 
                                         &lt;storagelayout&gt;<FONT SIZE=1.7>opt</FONT>
                                         &lt;compression&gt;<FONT SIZE=1.7>opt</FONT>
                                         &lt;dataset_attribute&gt;*
                                         &lt;data&gt;<FONT SIZE=1.7>opt</FONT>  } 
// Any order is ok as long as &lt;data&gt; and &lt;dataset_attribute&gt; are 
// after &lt;datatype&gt; and &lt;dataspace&gt;.

&lt;dataset_name&gt; ::= &lt;identifier&gt;

&lt;storagelayout&gt; :: = storagelayout &lt;contiguous_layout&gt;  |  
                     storagelayout &lt;chunked_layout&gt;  | 
                     storagelayout &lt;compact_layout&gt;  | 
                     storagelayout &lt;external_layout&gt; 

&lt;contiguous_layout&gt; ::= {contiguous}    // default

&lt;chunked_layout&gt; ::=  {chunked &lt;dims&gt; }

&lt;dims&gt; ::= (<i>i<FONT SIZE=1.0>1</i></FONT>, <i>i<FONT SIZE=1.0>2</i></FONT>, ... ), <i>i<FONT SIZE=1.0>k</i></FONT> is an integer, <i>k</i> = 1,2,... 

&lt;compact_layout&gt; ::= TBD           

&lt;external_layout&gt; ::= {external &lt;external_file&gt;+ }

&lt;external_file&gt; ::= (&lt;file_name&gt; &lt;offset&gt; &lt;size&gt;) 

&lt;offset&gt; ::= an integer

&lt;size&gt; ::= an integer

&lt;compression&gt; :: = compression { TBD }  

&lt;dataset_attribute&gt; ::= &lt;attribute&gt; 

&lt;link&gt; ::= &lt;hardlink&gt; | &lt;softlink&gt;

&lt;hardlink&gt; ::= hardlink "&lt;hardlink_name&gt;" { linktarget "&lt;target&gt;" }

&lt;hardlink_name&gt; ::= &lt;identifier&gt;

&lt;target&gt; ::= &lt;identifier&gt;

&lt;softlink&gt; ::= softlink "&lt;softlink_name&gt;" { linktarget "&lt;target&gt;" }

&lt;softlink_name&gt; ::= &lt;identifier&gt;

&lt;identifier&gt; ::= string   
// character "/" should be used with care. 
// &lt;dataset_name&gt; cannot contain "/", for example.

</PRE>
<HR>
<B> An example of HDF5 File in DDL </B>
<PRE>

Consider an HDF5 file, example.h5, with the following structure:

                             /

                     /       |       \
                 group1     group3  dataset3
                 /   \       |       
           group2  dataset2 softlink
             /
      dataset1 
              


hdf5 "example" { 

group "/" {

   datatype "shared_datatype" {                    // named data type
            H5T_NATIVE_CHAR c[20];
            H5T_NATIVE_INT i; 
   }
 
   attribute "group_attribute" {                   //attribute
             datatype {H5T_NATIVE_CHAR}
             dataspace {array (20) (20)}
             data { "group attribute" }
   } 

   group "group1" {

         group "group2" {

               dataset "dataset1" {
                        dataspace {array (4) (4)}
                        datatype {"shared_datatype"}
                        attribute "dataset1_attr" {
                                   datatype {H5T_NATIVE_CHAR}
                                   dataspace {array (10) (10)}
                        }
               }
         }

         dataset "dataset2" {
               datatype {H5T_NATIVE_INT}
               dataspace {array (2,5) (H5S_UNLIMITED, 5)}
               data {0,0,0,0,0,0,0,0,0,0}
         }
   }
   
   group "group3" {
         softlink "slink" {
                  linktarget "/sometarget" 
         }
   }
      
   
   dataset "dataset3" {
           datatype {H5T_NATIVE_FLOAT}
           dataspace {array (100,100) (100,100)} 
   }
 
} 

}