H5LTfind_dataset matches strings or substrings?


#1

Dear all,

I am querying for the existence of dataset with name "fq" in a file
containing a dataset with name "fqt", but no dataset with name "fq":
H5LTfind_dataset(h5file, "fqt"); //returns 1 as expected
H5LTfind_dataset(h5file, "fq"); //returns 1, but should return 0
H5LTfind_dataset(h5file, "fq\0"); //returns 1, but should return 0

I assumed from the documentation (
https://www.hdfgroup.org/HDF5/doc/HL/RM_H5LT.html#H5LTfind_dataset)
that H5LTfind_dataset
returns 1 if and only if a dataset with exactly the same name as my query
is present in the file. From my results, it seems it returns 1 if my query
name is a prefix of an existing dataset name

Could anyone please clarify?

Best,
.Jose


#2

I ran into this same exact problem and was able to work around it by using the H5LTpath_valid() function with true as the last argument. https://support.hdfgroup.org/HDF5/doc/HL/RM_H5LT.html#H5LTpath_valid

Using your example from above, instead use:
H5LTpath_valid(h5file, "fq", 1); // returns 0 as expected!