h5rdmtoolbox.ld.get_ld

Contents

h5rdmtoolbox.ld.get_ld#

h5rdmtoolbox.ld.get_ld(hdf_filename, structural=True, contextual=True, file_uri=None, skipND=1, context=None, rdf_mappings=None)[source]#

Return the HDF file content as an RDF graph.

Extracts metadata and structure from an HDF5 file and returns it as an rdflib.Graph object. The graph can contain structural RDF (representing the HDF5 hierarchy) and/or contextual RDF (semantic mappings from attributes to ontologies).

Parameters:
  • hdf_filename (Union[str, pathlib.Path]) – Path to the HDF5 file.

  • structural (bool, default True) – Include structural RDF representing HDF5 groups, datasets, and attributes.

  • contextual (bool, default True) – Include contextual RDF from attribute-to-ontology mappings.

  • file_uri (Optional[str], default None) – Base URI for file resources. Must end with ‘#’ or ‘/’.

  • skipND (Optional[int], default 1) – Number of dimensions to skip for nested dataset data.

  • context (Optional[Dict], default None) – Additional namespace prefixes to bind in the graph.

  • rdf_mappings (Optional[Dict[str, RDFMappingEntry]], default None) – Custom RDF mappings for attributes.

Returns:

rdflib.Graph – An RDF graph containing the HDF5 metadata.

Raises:

ValueError – If both structural and contextual are False, or if file_uri format is invalid.