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
|
<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
<tname> a token with the name tname
<a> | <b> one of <a> or <b>
<a><FONT SIZE=1.7>opt</FONT> zero or one occurrence of <a>
<a>* zero or more occurrence of <a>
<a>+ one or more occurrence of <a>
TBD To Be Decided
<file> ::= hdf5 "<file_name>" { <file_boot_block><FONT SIZE=1.7>opt</FONT> <root_group> }
<file_name> ::= <identifier>
<file_boot_block> ::= boot_block { <boot_block_content> }
<boot_block_content> ::= TBD
<root_group> ::= group "/" { <nlink><FONT SIZE=1.7>opt</FONT> <group_attribute>* <group_member>* }
// nlink must appear before attributes and members.
<nlink><FONT SIZE=1.7>opt</FONT> ::= { nlink <no_of_hardlinks> }
<no_of_hardlinks> ::= an integer larger than 1
<group_attribute> ::= <attribute>
<attribute> ::= attribute "attr_name" { <datatype>
<dataspace>
<data><FONT SIZE=1.7>opt</FONT> }
// <datatype>, <dataspace> and <data> can be in any order
// as long as <data> comes the last.
<attr_name> ::= <identifier>
<datatype> ::= datatype { "<datatype_name>" } | // shared data type
datatype { <scalar_datatype> } |
datatype { <dt_definition>+ }
<datatype_name> ::= <identifier>
<scalar_datatype> ::= H5T_NATIVE_CHAR | H5T_NATIVE_INT | ... // data types supported by HDF5
<dt_definition> ::= <scalar_datatype> <field_name> ;
<field_name> ::= <identifier>
<dataspace> ::= dataspace { "<dataspace_name>" } |
dataspace { array <current_dims> <max_dims> } |
dataspace { other <ds_definition>+ }
<dataspace_name> ::= <identifier>
<current_dims> ::= 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,...
<max_dims> ::= (<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
<ds_definition> ::= TBD
<data> ::= data {TBD}
<group_member> ::= <named_datatype> | <named_dataspace> | <group> | <dataset> | <softlink>
<named_datatype> ::= datatype "<datatype_name>" { <dt_definition>+ }
<named_dataspace> ::= dataspace "<dataspace_name>" { array <current_dims> <max_dims> } |
dataspace "<dataspace_name>" { other <ds_definition>+ }
<group> ::= group "<group_name>" { <nlink><FONT SIZE=1.7>opt</FONT> <group_attribute>* <group_member>* }
<group_name> ::= <identifier>
<dataset> ::= dataset "<dataset_name>" { <nlink><FONT SIZE=1.7>opt</FONT>
<datatype>
<dataspace>
<storagelayout><FONT SIZE=1.7>opt</FONT>
<compression><FONT SIZE=1.7>opt</FONT>
<dataset_attribute>*
<data><FONT SIZE=1.7>opt</FONT> }
// Any order is ok as long as <data> and <dataset_attribute> are
// after <datatype> and <dataspace>.
// nlink must appear before others.
<dataset_name> ::= <identifier>
<storagelayout> :: = storagelayout <contiguous_layout> |
storagelayout <chunked_layout> |
storagelayout <compact_layout> |
storagelayout <external_layout>
<contiguous_layout> ::= {contiguous} // default
<chunked_layout> ::= {chunked <dims> }
<dims> ::= (<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,...
<compact_layout> ::= TBD
<external_layout> ::= {external <external_file>+ }
<external_file> ::= (<file_name> <offset> <size>)
<offset> ::= an integer
<size> ::= an integer
<compression> :: = compression { TBD }
<dataset_attribute> ::= <attribute>
<softlink> ::= softlink "<softlink_name>" { linktarget "<target>" }
<softlink_name> ::= <identifier>
<target> ::= <identifier>
<identifier> ::= string
// character "/" should be used with care.
// <dataset_name> 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)}
}
}
}
|