h5rdmtoolbox.ld.shacl.validate_hdf

Contents

h5rdmtoolbox.ld.shacl.validate_hdf#

h5rdmtoolbox.ld.shacl.validate_hdf(*, hdf_data=None, hdf_source=None, shacl_data=None, shacl_source=None, hdf_file_uri='https://example.org/hdf5file#', shacl_format='turtle', hdf_data_format='turtle', ont_graph=None, ont_graph_format='turtle', merge_ont_graph_into_data=True, **pyshacl_kwargs)[source]#

Validate an HDF5 file against SHACL shapes.

Parameters:
  • hdf_data (Union[str, rdflib.Graph], optional) – The HDF5 data as a string or rdflib.Graph. If is string is provided it is assumed to be in Turtle format (you may overwrite this by passing hdf_data_format).

  • hdf_source (Union[h5py.File, pathlib.Path], optional) – The path to the HDF5 file.

  • hdf_file_uri (str, optional) – The base URI to use for the HDF5 file when generating RDF. Default is “

  • shacl_data (Union[str, rdflib.Graph], optional) – The SHACL shapes as a string or rdflib.Graph. If is string is provided it is assumed to be in Turtle format.

  • shacl_source (Union[str, pathlib.Path], optional) – The path to the SHACL shapes file.

  • shacl_format (str, optional) – The format of the SHACL shapes string. Default is ‘turtle’.

  • hdf_data_format (str, optional) – The format of the HDF5 data string. Default is ‘turtle’.

  • ont_graph (Union[str, rdflib.Graph, pathlib.Path], optional) – Ontology graph to use during validation. If merge_ont_graph_into_data is True, it is merged into the generated HDF RDF data graph before validation. Otherwise it is passed to pySHACL as ont_graph.

  • ont_graph_format (str, optional) – The format of the ontology graph string. Default is ‘turtle’.

  • merge_ont_graph_into_data (bool, optional) – If True, the ontology graph is merged into the generated HDF RDF data graph before validation. This is useful for making ontology triples visible to SHACL constraints.

  • **pyshacl_kwargs – Additional keyword arguments to pass to pyshacl.validate().

Returns:

ValidationResult – The result of the validation containing:

  • conforms: bool

  • results_graph: rdflib.Graph

  • results_text: str

  • messages: List[str]