QUICK START
CREATE
Create an HDF5 file named “example.h5”:
CREATE FILE example.h5
Use (i.e. open) the HDF5 file “example.h5”:
USE FILE example.h5
Create a group named “group1” (in root group “/”):
CREATE GROUP group1
Create two groups in one go named “subgroup1” and “subgroup2” (both in group “group1”):
CREATE GROUP group1/subgroup1, group1/subgroup2
Create three groups in one go named “group2” (in root group “/”), “subgroup1” (in group “group2”) and “subsubgroup1” (in group “group2/subgroup1”):
CREATE GROUP group2/subgroup1/subsubgroup1
Create a dataset named “dataset1” (in root group “/”) of data type double:
CREATE DATASET dataset1 AS DOUBLE
Create a dataset named “dataset1” (in group “group1”) of data type int of two dimensions (size 3×2):
CREATE DATASET group1/dataset1 AS INT(3, 2)
Create a chunked (size 2x2x2) dataset named “dataset2” (in group “group1”) of data type short of three dimensions (size 4x6x8):
CREATE CHUNKED(2, 2, 2) DATASET group1/dataset2 AS SMALLINT(4, 6, 8)
Create three chunked (with an automatically calculated size) datasets in one go named “dataset1”, “dataset2” and “dataset3” (all in group “group2”) of data type float of two dimensions (size 100×500) with shuffle and compression (using ZLIB) enabled:
CREATE CHUNKED DATASET group2/dataset1, group2/dataset2, group2/dataset3 AS FLOAT(100, 500) ENABLE SHUFFLE ZLIB
Create an extendible dataset named “dataset1” (in group “group2/subgroup1”) of data type char of two dimensions (size UNLIMITEDx5000) with Fletcher32 checksum error detection enabled:
CREATE DATASET group2/subgroup1/dataset1 AS TINYINT(UNLIMITED, 5000) ENABLE FLETCHER32
Create an attribute named “attribute1” (in root group “/”) of data type long long:
CREATE ATTRIBUTE attribute1 AS BIGINT
Create an attribute named “attribute2” (in root group “/”) of data type unsigned int with an initial value of 1789:
CREATE ATTRIBUTE attribute2 AS UNSIGNED INT VALUES(1789)
Create two attributes in one go that are both named “attribute1” (one in group “group1” and the other in “group2”) of data type variable-length float of one dimension (size 2):
CREATE ATTRIBUTE group1/attribute1, group2/attribute1 AS VARFLOAT(2)
Create an attribute named “attribute1” (in dataset “dataset1”) of data type variable-length char with an initial value of “Hierarchical Data Format”:
CREATE ATTRIBUTE dataset1/attribute1 AS VARCHAR VALUES("Hierarchical Data Format")
Overview of executing all of the above CREATE operations:
example.h5
|
– group1
| |
| – subgroup1
| |
| – subgroup2
| |
| – dataset1
| |
| – dataset2
| |
| – attribute1
|
– group2
| |
| – subgroup1
| | |
| | – subsubgroup1
| | |
| | – dataset1
| |
| – dataset1
| |
| – dataset2
| |
| – dataset3
| |
| – attribute1
|
– dataset1
| |
| – attribute1
|
– attribute1
|
– attribute2
|
– group1
| |
| – subgroup1
| |
| – subgroup2
| |
| – dataset1
| |
| – dataset2
| |
| – attribute1
|
– group2
| |
| – subgroup1
| | |
| | – subsubgroup1
| | |
| | – dataset1
| |
| – dataset1
| |
| – dataset2
| |
| – dataset3
| |
| – attribute1
|
– dataset1
| |
| – attribute1
|
– attribute1
|
– attribute2
INSERT
Insert (i.e. write) value 12.78 into dataset “dataset1” (in root group “/”):
INSERT INTO dataset1 VALUES(12.78)
Insert (i.e. write) values 7 and 8 into the first row, values 3 and 5 into the second row, and values 4 and 1 into the third row of dataset “dataset1” (in group “group1”):
INSERT INTO group1/dataset1 VALUES((7, 8), (3, 5), (4,1))
Insert (i.e. write) values from a text file named “input.txt” into dataset “dataset2” (in group “group1”):
INSERT INTO group1/dataset2 VALUES FROM TEXT FILE input.txt
Insert (i.e. write) values from a binary file named “input.bin” into dataset “dataset1” (in group “group2/subgroup1”):
INSERT INTO group2/subgroup1/dataset1 VALUES FROM BINARY FILE input.bin
Insert (i.e. write) values 6.72 and 8.98 into the first row, and values 3.52, 5.35 and 4.11 into the second row of attribute “attribute1” (in group “group1”):
INSERT INTO group1/attribute1 VALUES((6.72, 8.98), (3.52, 5.35, 4.11))
Insert (i.e. write) values from a user-defined variable (that was previously registered and assigned to number 0) into attribute “attribute1” (in group “group2”):
INSERT INTO group2/attribute1 VALUES FROM MEMORY 0
Insert (i.e. write) value 1789 (from attribute “attribute2” (in root group “/”)) into attribute “attribute1” (in root group “/”):
SELECT FROM attribute2 ; INSERT INTO attribute1
SELECT
Select (i.e. read) dataset “dataset1” (in root group “/”):
SELECT FROM dataset1
12.78
Select (i.e. read) attribute “attribute1” (in dataset “dataset1”):
SELECT FROM dataset1/attribute1
Hierarchical Data Format
Select (i.e. read) dataset “dataset1” (in group “group1”) and write its content into a text file named “output.txt” using a DOS-based end of line (EOL) terminator:
SELECT FROM group1/dataset1 INTO DOS TEXT FILE output.txt
Select (i.e. read) dataset “dataset1” (in group “group2”) and write its content into a user-defined variable (that was previously registered and assigned to number 3):
SELECT FROM group2/dataset1 INTO MEMORY 3
SHOW
Show (i.e. get) HDF5 file currently in use (i.e. open):
SHOW USE FILE
example.h5
Show (i.e. get) group currently in use (i.e. open):
SHOW USE GROUP
/
Show (i.e. get) all objects existing in current group (i.e. root group “/”):
SHOW
attribute1
attribute2
dataset1
group1
group2
attribute2
dataset1
group1
group2
Show (i.e. get) all attributes in current group (i.e. root group “/”):
SHOW ATTRIBUTE
attribute1
attribute2
attribute2
Check if object “group1” (in root group “/”) exists or not:
SHOW group1
group1
Show (i.e. get) all objects existing in group “group1” (in root group “/”):
SHOW group1/
attribute1
dataset1
dataset2
subgroup1
subgroup2
dataset1
dataset2
subgroup1
subgroup2
Show (i.e. get) all datasets existing in group “group2” (in root group “/”):
SHOW DATASET group2/
dataset1
dataset2
dataset3
dataset2
dataset3
Show (i.e. get) all objects recursively starting from current group (i.e. root group “/”):
SHOW LIKE **
attribute1
attribute2
dataset1
dataset1/attribute1
group1
group1/attribute1
group1/dataset1
group1/dataset2
group1/subgroup1
group1/subgroup2
group2
group2/attribute1
group2/dataset1
group2/dataset2
group2/dataset3
group2/subgroup1
group2/subgroup1/dataset1
group2/subgroup1/subsubgroup1
attribute2
dataset1
dataset1/attribute1
group1
group1/attribute1
group1/dataset1
group1/dataset2
group1/subgroup1
group1/subgroup2
group2
group2/attribute1
group2/dataset1
group2/dataset2
group2/dataset3
group2/subgroup1
group2/subgroup1/dataset1
group2/subgroup1/subsubgroup1
Show (i.e. get) all attributes recursively starting from current group (i.e. root group “/”):
SHOW ATTRIBUTE LIKE **
attribute1
attribute2
dataset1/attribute1
group1/attribute1
group2/attribute1
attribute2
dataset1/attribute1
group1/attribute1
group2/attribute1
Show (i.e. get) all datasets recursively starting from group “group2” (in root group “/”) that contain “1” or “3” in their names:
SHOW DATASET group2 LIKE **/1|3
dataset1
dataset3
subgroup1/dataset1
dataset3
subgroup1/dataset1