QUICK START

The following guide provides a quick intro to the most used operations in HDFql (CREATE, INSERT, SELECT and SHOW) via practical examples. Final results of executing the examples can be found here, and the complete reference manual is available here.

CREATE

Create an HDF file named “example.h5”:

CREATE FILE example.h5

Use (i.e. open) the HDF 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 datatype double:

CREATE DATASET dataset1 AS DOUBLE

Create a dataset named “dataset1” (in group “group1”) of datatype int of two dimensions (size 3x2):

CREATE DATASET group1/dataset1 AS INT(3, 2)

Create a chunked (size 2x2x2) dataset named “dataset2” (in group “group1”) of datatype short of three dimensions (size 4x6x8):

CREATE CHUNKED(2, 2 , 2) DATASET group1/dataset2 AS SMALLINT(4 , 6, 8)

Create a chunked (size 10x20) dataset named “dataset1” (in group “group2”) of datatype float of two dimensions (size 100x500) with compression (using ZLIB) enabled:

CREATE CHUNKED(10, 20) DATASET group2/dataset1 AS FLOAT(100, 500) ENABLE ZLIB

Create an extendible chunked (size 3x75) dataset named “dataset1” (in group “group2/subgroup1”) of datatype char of two dimensions (size UNLIMITEDx5000) with Fletcher32 checksum error detection enabled:

CREATE CHUNKED(3, 75) DATASET group2/subgroup1/dataset1 AS TINYINT(UNLIMITED, 5000) ENABLE FLETCHER32

Create an attribute named “attribute1” (in root group “/”) of datatype long long:

CREATE ATTRIBUTE attribute1 AS BIGINT

Create an attribute named “attribute2” (in root group “/”) of datatype unsigned int with a default value “1789”:

CREATE ATTRIBUTE attribute2 AS UNSIGNED INT DEFAULT 1789

Create two attributes in one go that are both named “attribute1” (one in group “group1” and the other in “group2”) of datatype variable float of one dimension (size 2):

CREATE ATTRIBUTE group1/attribute1, group2/attribute1 AS VARFLOAT(2)

Create an attribute named “attribute1” (in dataset “dataset1”) of datatype variable char with a default value “Hierarchical Data Format”:

CREATE ATTRIBUTE dataset1/attribute1 AS VARCHAR DEFAULT “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
         |         |
         |         – 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 coming 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 coming 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 coming 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” (coming 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) dataset “dataset1” (in group “group1”) and write its content to text file “output.txt” using a DOS-based end of line (EOL) terminator:

SELECT FROM group1/dataset1 INTO DOS TEXT FILE output.txt

SHOW

Show HDF file currently in use (i.e. open):

SHOW USE FILE

example.h5

Show group currently in use (i.e. open):

SHOW USE GROUP

/

Show all objects (groups, datasets, attributes, etc.) in current group (i.e. root group “/”):

SHOW

attribute1
attribute2
dataset1
group1
group2

Show only objects of type attribute in current group (i.e. root group “/”):

SHOW ATTRIBUTE

attribute1
attribute2

Check if object “group1” (in root group “/”) exists or not:

SHOW group1

group1

Show all objects (groups, datasets, attributes, etc.) in object “group1” (in root group “/”):

SHOW group1/

attribute1
dataset1
dataset2
subgroup1
subgroup2

Show only objects of type dataset in object “group1” (in root group “/”):

SHOW DATASET group1/

dataset1
dataset2

Show all objects (recursively) in 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/subgroup1
group2/subgroup1/dataset1
group2/subgroup1/subsubgroup1

(C) 2016-2017