6.4.6CREATE [SOFT | HARD] LINK
Syntax
CREATE [TRUNCATE] [SOFT | HARD] LINK [file_name] link_name [, [file_name] link_name]* TO object_name [, object_name]*
Description
Create an HDF5 soft or hard link named link_name to a group or dataset named object_name. Multiple links can be created at once by separating their names with a comma (,). If link_name already exists, it is not overwritten, no subsequent links are created, and an error is raised. To overwrite an existing link, specify the keyword TRUNCATE. If neither the keyword SOFT nor HARD is specified, a soft link is created by default. To create a hard link, the keyword HARD must be specified.
Parameter(s)
file_name – optional string that specifies the name of the HDF5 file in which the soft or hard link is to be created. If file_name is specified, the file is opened on the fly, the soft or hard link is created within it, and the file is subsequently closed. If not specified, the file currently in use is used instead. As a general rule, in case file_name contains spaces or special characters, it should be enclosed in double quotes (“). Otherwise, if it is not enclosed in double quotes, the link is not created, and an error is raised. This rule also applies to any other HDFql operation that works with file names (e.g. RENAME FILE).
link_name – mandatory string that specifies the name of the HDF5 soft or hard link to create. As a general rule, in case link_name contains spaces or special characters, it should be enclosed in double quotes (“). Otherwise, if it is not enclosed in double quotes, the link is not created, and an error is raised. This rule also applies to any other HDFql operation that works with link names (e.g. RENAME LINK).
object_name – mandatory string that specifies the name of the HDF5 group or dataset that link_name points to. As a general rule, in case object_name contains spaces or special characters, it should be enclosed in double quotes (“). Otherwise, if it is not enclosed in double quotes, the link is not created, and an error is raised. This rule also applies to any other HDFql operation that works with link names (e.g. RENAME LINK).
Return
Nothing
Example(s)
# create an HDF5 group named "my_group0"
CREATE GROUP my_group0
# create an HDF5 dataset named "my_dataset0" of data type variable-length unsigned int
CREATE DATASET my_dataset0 AS UNSIGNED VARINT
# create an HDF5 soft link named "my_link0" to group "my_group0" (the soft link will not be overwritten if it already exists)
CREATE LINK my_link0 TO my_group0
# create an HDF5 soft link named "my_link1" to dataset "my_dataset0" (the soft link will not be overwritten if it already exists)
CREATE SOFT LINK my_link1 TO my_dataset0
# create two HDF5 soft links named "my_link2" and "my_link3" to dataset "my_dataset0" and group "my_group0", respectively (both soft links will be overwritten if they already exist)
CREATE TRUNCATE SOFT LINK my_link2, my_link3 TO my_dataset0, my_group0
# create an HDF5 soft link named "this is a long link name" to dataset "my_dataset0" (the soft link will not be overwritten if it already exists)
CREATE LINK "this is a long link name" TO my_dataset0
# create an HDF5 group named "my_group1"
CREATE GROUP my_group1
# create an HDF5 dataset named "my_dataset1" of data type variable-length unsigned int
CREATE DATASET my_dataset1 AS UNSIGNED VARINT
# create an HDF5 hard link named "my_link4" to group "my_group1" (the hard link will not be overwritten if it already exists)
CREATE HARD LINK my_link4 TO my_group1
# create an HDF5 hard link named "my_link5" to dataset "my_dataset1" (the hard link will not be overwritten if it already exists)
CREATE HARD LINK my_link5 TO my_dataset1
# create two HDF5 hard links named "my_link6" and "my_link7" to dataset "my_dataset1" and group "my_group1", respectively (both hard links will be overwritten if they already exist)
CREATE TRUNCATE HARD LINK my_link6, my_link7 TO my_dataset1, my_group1# use (i.e. open) an HDF5 file named "my_file.h5"
USE FILE my_file.h5
# create an HDF5 soft link named "my_link8" to object "my_object0" in the HDF5 file currently in use (i.e. file "my_file.h5")
CREATE LINK my_link8 TO my_object0
# close HDF5 file currently in use (i.e. file "my_file.h5")
CLOSE FILE
# create an HDF5 soft link named "my_link9" to object "my_object1" in file "my_file.h5"
CREATE LINK my_file.h5 my_link9 TO my_object1