hdf5/doc/html/ddl.html

205 lines
6.7 KiB
HTML
Raw Normal View History

<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;nlink&gt;<FONT SIZE=1.7>opt</FONT> &lt;group_attribute&gt;* &lt;group_member&gt;* }
// nlink must appear before attributes and members.
&lt;nlink&gt;<FONT SIZE=1.7>opt</FONT> ::= { nlink &lt;no_of_hardlinks&gt; }
&lt;no_of_hardlinks&gt; ::= an integer larger than 1
&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;softlink&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;nlink&gt;<FONT SIZE=1.7>opt</FONT> &lt;group_attribute&gt;* &lt;group_member&gt;* }
&lt;group_name&gt; ::= &lt;identifier&gt;
&lt;dataset&gt; ::= dataset "&lt;dataset_name&gt;" { &lt;nlink&gt;<FONT SIZE=1.7>opt</FONT>
&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;.
// nlink must appear before others.
&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;softlink&gt; ::= softlink "&lt;softlink_name&gt;" { linktarget "&lt;target&gt;" }
&lt;softlink_name&gt; ::= &lt;identifier&gt;
&lt;target&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)}
}
}
}