h5rdmtoolbox 2.1.0__tar.gz → 2.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/PKG-INFO +54 -36
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/README.md +1 -1
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/__init__.py +36 -28
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/convention/ontology/hdf_datatypes.py +3 -3
- h5rdmtoolbox-2.2.0/h5rdmtoolbox/ld/__init__.py +76 -0
- h5rdmtoolbox-2.2.0/h5rdmtoolbox/ld/globals.py +3 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/ld/hdf/attributes.py +8 -2
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/ld/hdf/datasets.py +26 -11
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/ld/hdf/file.py +9 -8
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/ld/hdf/groups.py +18 -4
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/ld/user/attributes.py +14 -14
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/ld/user/file.py +10 -10
- h5rdmtoolbox-2.2.0/h5rdmtoolbox/ld/utils.py +124 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/repository/interface.py +6 -36
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/wrapper/core.py +28 -20
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/wrapper/jsonld.py +0 -3
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox.egg-info/PKG-INFO +54 -36
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox.egg-info/SOURCES.txt +1 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox.egg-info/requires.txt +22 -5
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/setup.cfg +8 -6
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/conventions/test_conventions.py +1 -1
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/ld/test_ld.py +78 -34
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/ld/test_user_graph.py +1 -1
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/repository/test_zenodo.py +23 -7
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/test_version.py +7 -1
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/wrapper/test_dump.py +3 -6
- h5rdmtoolbox-2.1.0/h5rdmtoolbox/ld/__init__.py +0 -91
- h5rdmtoolbox-2.1.0/h5rdmtoolbox/ld/utils.py +0 -77
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/LICENSE +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/_cfg.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/_repr.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/_version.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/cli.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/consts.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/convention/__init__.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/convention/cfg.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/convention/consts.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/convention/core.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/convention/errors.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/convention/generate.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/convention/ontology/__init__.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/convention/ontology/h5ontocls.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/convention/references.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/convention/standard_attributes.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/convention/toolbox_validators.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/convention/utils.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/data/def_icon.png +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/data/fluid-v1.yml +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/data/h5tbx.yaml +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/data/id_icon.png +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/data/iri_icon.png +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/data/ld_icon.png +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/data/piv-v1.yml +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/data/style.css +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/data/tutorial_convention.yaml +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/data/tutorial_standard_name_table.yaml +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/data/type_icon.png +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/database/__init__.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/database/hdfdb/__init__.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/database/hdfdb/filedb.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/database/hdfdb/objdb.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/database/hdfdb/query.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/database/hdfdb/utils.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/database/interface.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/database/lazy.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/database/mongo.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/errors.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/extensions/__init__.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/extensions/magnitude.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/extensions/normalize.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/extensions/onto.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/extensions/units.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/extensions/vector.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/gui/__init__.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/gui/fairify.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/gui/src/__init__.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/gui/src/main.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/identifiers.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/layout/__init__.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/layout/core.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/ld/hdf/__init__.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/ld/rdf.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/ld/user/__init__.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/ld/user/datasets.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/ld/user/groups.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/plotting.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/protected_attributes.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/protocols.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/repository/__init__.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/repository/utils.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/repository/zenodo/__init__.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/repository/zenodo/core.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/repository/zenodo/metadata.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/repository/zenodo/tokens.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/repository/zenodo/utils.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/tutorial.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/user.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/utils.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/wrapper/__init__.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/wrapper/accessor.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/wrapper/accessors/__init__.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/wrapper/accessors/provenance.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/wrapper/ds_decoder.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/wrapper/h5attr.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/wrapper/h5ext.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/wrapper/h5utils.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/wrapper/h5yaml.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/wrapper/xr2hdf.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox.egg-info/dependency_links.txt +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox.egg-info/entry_points.txt +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox.egg-info/top_level.txt +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/pyproject.toml +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/setup.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/__init__.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/clean_zenodo_sandbox.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/conventions/__init__.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/conventions/test_convention_vfuncs.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/conventions/test_engmeta.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/conventions/test_references.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/conventions/test_toolbox_validators.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/conventions/test_utils.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/database/__init__.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/database/test_find_rdf.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/database/test_hdfDB.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/database/test_mongo.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/layouts/__init__.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/layouts/test_core.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/layouts/test_docs.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/ld/__init__.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/ld/test_rdf.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/repository/__init__.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/test_cli.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/test_config.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/test_extensions.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/test_identifiers.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/test_plotting.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/test_repr.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/test_user.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/test_utils.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/test_xarray_export.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/wrapper/__init__.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/wrapper/test_core.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/wrapper/test_file.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/wrapper/test_h5ext.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/wrapper/test_lazy.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/wrapper/test_namespaces.py +0 -0
- {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.0}/tests/wrapper/test_xr2df.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: h5rdmtoolbox
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: Supporting a FAIR Research Data lifecycle using Python and HDF5.
|
|
5
5
|
Home-page: https://h5rdmtoolbox.readthedocs.io/en/latest/
|
|
6
6
|
Author: Matthias Probst
|
|
@@ -17,18 +17,18 @@ Requires-Python: <3.13,>=3.9
|
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
18
18
|
License-File: LICENSE
|
|
19
19
|
Requires-Dist: appdirs>=1.4.4
|
|
20
|
-
Requires-Dist: importlib_resources
|
|
20
|
+
Requires-Dist: importlib_resources<7.0.0,>=6.5.2
|
|
21
21
|
Requires-Dist: numpy<2.0.0,>=1.20
|
|
22
|
-
Requires-Dist: h5py
|
|
22
|
+
Requires-Dist: h5py<4.0.0,>=3.8.0
|
|
23
23
|
Requires-Dist: matplotlib>=3.5.2
|
|
24
24
|
Requires-Dist: IPython>=7.34.0
|
|
25
|
-
Requires-Dist: pyyaml
|
|
25
|
+
Requires-Dist: pyyaml>=6.0
|
|
26
26
|
Requires-Dist: xarray>=2022.3.0
|
|
27
27
|
Requires-Dist: pint==0.21.1
|
|
28
|
-
Requires-Dist: pint_xarray
|
|
28
|
+
Requires-Dist: pint_xarray<=0.4.0,>=0.2.1
|
|
29
29
|
Requires-Dist: regex>=2020.7.9
|
|
30
30
|
Requires-Dist: packaging>=24.1
|
|
31
|
-
Requires-Dist: ontolutils
|
|
31
|
+
Requires-Dist: ontolutils<=1.0.0,>=0.13.3
|
|
32
32
|
Requires-Dist: python-forge==18.6.0
|
|
33
33
|
Requires-Dist: requests>=2.32.3
|
|
34
34
|
Requires-Dist: pydantic>=2.8.2
|
|
@@ -111,41 +111,59 @@ Requires-Dist: tabulate<=0.9.0,>=0.8.10; extra == "complete"
|
|
|
111
111
|
Requires-Dist: python-gitlab; extra == "complete"
|
|
112
112
|
Requires-Dist: pypandoc>=1.11; extra == "complete"
|
|
113
113
|
Requires-Dist: pymongo<=4.10.1,>=4.2.0; extra == "complete"
|
|
114
|
-
|
|
115
|
-
Requires-Dist:
|
|
116
|
-
Requires-Dist:
|
|
117
|
-
Requires-Dist:
|
|
118
|
-
Requires-Dist:
|
|
119
|
-
Requires-Dist:
|
|
120
|
-
Requires-Dist:
|
|
121
|
-
Requires-Dist:
|
|
122
|
-
Requires-Dist:
|
|
123
|
-
Requires-Dist:
|
|
124
|
-
Requires-Dist:
|
|
125
|
-
Requires-Dist:
|
|
126
|
-
Requires-Dist:
|
|
127
|
-
Requires-Dist:
|
|
128
|
-
Requires-Dist:
|
|
129
|
-
Requires-Dist:
|
|
130
|
-
Requires-Dist:
|
|
131
|
-
Requires-Dist:
|
|
132
|
-
Requires-Dist:
|
|
133
|
-
Requires-Dist:
|
|
134
|
-
Requires-Dist:
|
|
135
|
-
Requires-Dist:
|
|
136
|
-
Requires-Dist:
|
|
137
|
-
Requires-Dist:
|
|
138
|
-
Requires-Dist:
|
|
139
|
-
Requires-Dist:
|
|
140
|
-
Requires-Dist:
|
|
141
|
-
Requires-Dist: scikit-image
|
|
142
|
-
Requires-Dist:
|
|
114
|
+
Provides-Extra: complete-with-docs
|
|
115
|
+
Requires-Dist: tabulate<=0.9.0,>=0.8.10; extra == "complete-with-docs"
|
|
116
|
+
Requires-Dist: PyQt5==5.15.10; extra == "complete-with-docs"
|
|
117
|
+
Requires-Dist: pytest>=8.3.3; extra == "complete-with-docs"
|
|
118
|
+
Requires-Dist: pytest-cov>=5.0.0; extra == "complete-with-docs"
|
|
119
|
+
Requires-Dist: pylint; extra == "complete-with-docs"
|
|
120
|
+
Requires-Dist: scikit-image; extra == "complete-with-docs"
|
|
121
|
+
Requires-Dist: ssnolib>=1.5.1.2; extra == "complete-with-docs"
|
|
122
|
+
Requires-Dist: mongomock==4.1.2; extra == "complete-with-docs"
|
|
123
|
+
Requires-Dist: xmltodict<=0.13.0; extra == "complete-with-docs"
|
|
124
|
+
Requires-Dist: scipy>=1.10.1; extra == "complete-with-docs"
|
|
125
|
+
Requires-Dist: scikit-image>=0.21.0; extra == "complete-with-docs"
|
|
126
|
+
Requires-Dist: pandas>=1.4.3; extra == "complete-with-docs"
|
|
127
|
+
Requires-Dist: xmltodict<=0.13.0; extra == "complete-with-docs"
|
|
128
|
+
Requires-Dist: tabulate<=0.9.0,>=0.8.10; extra == "complete-with-docs"
|
|
129
|
+
Requires-Dist: python-gitlab; extra == "complete-with-docs"
|
|
130
|
+
Requires-Dist: pypandoc>=1.11; extra == "complete-with-docs"
|
|
131
|
+
Requires-Dist: pymongo<=4.10.1,>=4.2.0; extra == "complete-with-docs"
|
|
132
|
+
Requires-Dist: pandas>=1.4.3; extra == "complete-with-docs"
|
|
133
|
+
Requires-Dist: xmltodict<=0.13.0; extra == "complete-with-docs"
|
|
134
|
+
Requires-Dist: tabulate<=0.9.0,>=0.8.10; extra == "complete-with-docs"
|
|
135
|
+
Requires-Dist: python-gitlab; extra == "complete-with-docs"
|
|
136
|
+
Requires-Dist: pypandoc>=1.11; extra == "complete-with-docs"
|
|
137
|
+
Requires-Dist: pymongo<=4.10.1,>=4.2.0; extra == "complete-with-docs"
|
|
138
|
+
Requires-Dist: pytest>=8.3.3; extra == "complete-with-docs"
|
|
139
|
+
Requires-Dist: pytest-cov>=5.0.0; extra == "complete-with-docs"
|
|
140
|
+
Requires-Dist: pylint; extra == "complete-with-docs"
|
|
141
|
+
Requires-Dist: scikit-image; extra == "complete-with-docs"
|
|
142
|
+
Requires-Dist: ssnolib>=1.5.1.2; extra == "complete-with-docs"
|
|
143
|
+
Requires-Dist: mongomock==4.1.2; extra == "complete-with-docs"
|
|
144
|
+
Requires-Dist: xmltodict<=0.13.0; extra == "complete-with-docs"
|
|
145
|
+
Requires-Dist: scipy>=1.10.1; extra == "complete-with-docs"
|
|
146
|
+
Requires-Dist: scikit-image>=0.21.0; extra == "complete-with-docs"
|
|
147
|
+
Requires-Dist: pandas>=1.4.3; extra == "complete-with-docs"
|
|
148
|
+
Requires-Dist: xmltodict<=0.13.0; extra == "complete-with-docs"
|
|
149
|
+
Requires-Dist: tabulate<=0.9.0,>=0.8.10; extra == "complete-with-docs"
|
|
150
|
+
Requires-Dist: python-gitlab; extra == "complete-with-docs"
|
|
151
|
+
Requires-Dist: pypandoc>=1.11; extra == "complete-with-docs"
|
|
152
|
+
Requires-Dist: pymongo<=4.10.1,>=4.2.0; extra == "complete-with-docs"
|
|
153
|
+
Requires-Dist: Sphinx==8.0.0; extra == "complete-with-docs"
|
|
154
|
+
Requires-Dist: sphinx_book_theme==1.1.3; extra == "complete-with-docs"
|
|
155
|
+
Requires-Dist: sphinx-copybutton==0.5.2; extra == "complete-with-docs"
|
|
156
|
+
Requires-Dist: sphinx-design==0.6.1; extra == "complete-with-docs"
|
|
157
|
+
Requires-Dist: myst-nb==1.2.0; extra == "complete-with-docs"
|
|
158
|
+
Requires-Dist: sphinxcontrib-bibtex==2.6.3; extra == "complete-with-docs"
|
|
159
|
+
Requires-Dist: scikit-image>=0.21.0; extra == "complete-with-docs"
|
|
160
|
+
Requires-Dist: scikit-learn; extra == "complete-with-docs"
|
|
143
161
|
Dynamic: license-file
|
|
144
162
|
|
|
145
163
|
# HDF5 Research Data Management Toolbox
|
|
146
164
|
|
|
147
165
|

|
|
148
|
-
](https://codecov.io/gh/matthiasprobst/h5RDMtoolbox)
|
|
149
167
|
[](https://h5rdmtoolbox.readthedocs.io/en/latest/?badge=latest)
|
|
150
168
|

|
|
151
169
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# HDF5 Research Data Management Toolbox
|
|
2
2
|
|
|
3
3
|

|
|
4
|
-
](https://codecov.io/gh/matthiasprobst/h5RDMtoolbox)
|
|
5
5
|
[](https://h5rdmtoolbox.readthedocs.io/en/latest/?badge=latest)
|
|
6
6
|

|
|
7
7
|
|
|
@@ -129,44 +129,53 @@ def get_ld(
|
|
|
129
129
|
structural: bool = True,
|
|
130
130
|
contextual: bool = True,
|
|
131
131
|
skipND: int = 1,
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
file_uri: Optional[str] = None,
|
|
133
|
+
context: Optional[Dict] = None
|
|
134
|
+
) -> rdflib.Graph:
|
|
134
135
|
"""Return the HDF file content as a rdflib.Graph object."""
|
|
135
136
|
from h5rdmtoolbox.ld import get_ld
|
|
136
|
-
return get_ld(hdf_filename,
|
|
137
|
-
|
|
137
|
+
return get_ld(hdf_filename,
|
|
138
|
+
structural=structural,
|
|
139
|
+
contextual=contextual,
|
|
140
|
+
skipND=skipND,
|
|
141
|
+
file_uri=file_uri,
|
|
142
|
+
context=context)
|
|
138
143
|
|
|
139
144
|
|
|
140
145
|
def dump_jsonld(
|
|
141
146
|
hdf_filename: Union[str, pathlib.Path],
|
|
142
147
|
skipND: int = 1,
|
|
148
|
+
indent: int = 2,
|
|
143
149
|
structural: bool = True,
|
|
144
150
|
contextual: bool = True,
|
|
145
151
|
context: Optional[Dict] = None,
|
|
146
|
-
|
|
147
|
-
|
|
152
|
+
file_uri: Optional[str] = None
|
|
153
|
+
):
|
|
148
154
|
"""Return the file content as a JSON-LD string."""
|
|
149
155
|
from .ld import optimize_context
|
|
150
156
|
context = context or {}
|
|
151
157
|
graph = get_ld(hdf_filename,
|
|
152
158
|
structural=structural,
|
|
153
159
|
contextual=contextual,
|
|
154
|
-
|
|
155
|
-
skipND=skipND
|
|
156
|
-
**kwargs)
|
|
160
|
+
file_uri=file_uri,
|
|
161
|
+
skipND=skipND)
|
|
157
162
|
context = optimize_context(graph, context)
|
|
158
|
-
return graph.serialize(
|
|
159
|
-
|
|
163
|
+
return graph.serialize(
|
|
164
|
+
format="json-ld",
|
|
165
|
+
indent=indent,
|
|
166
|
+
auto_compact=True,
|
|
167
|
+
context=context
|
|
168
|
+
)
|
|
160
169
|
|
|
161
170
|
|
|
162
171
|
def dump_jsonld_depr(hdf_filename: Union[str, pathlib.Path],
|
|
163
172
|
skipND: int = 1,
|
|
164
173
|
structural: bool = True,
|
|
165
|
-
|
|
174
|
+
contextual: bool = True,
|
|
166
175
|
resolve_keys: bool = True,
|
|
167
176
|
context: Optional[Dict] = None,
|
|
168
|
-
blank_node_iri_base: Optional[str] = None
|
|
169
|
-
|
|
177
|
+
blank_node_iri_base: Optional[str] = None
|
|
178
|
+
) -> str:
|
|
170
179
|
"""Dump the JSON-LD representation of the file. With semantic=True and structural=False, the JSON-LD
|
|
171
180
|
represents the semantic content only. To get a pure structural representation, set semantic=False, which
|
|
172
181
|
will ignore any RDF content. If both are set to True, the JSON-LD will contain both structural and semantic.
|
|
@@ -198,13 +207,15 @@ def dump_jsonld_depr(hdf_filename: Union[str, pathlib.Path],
|
|
|
198
207
|
if not isinstance(blank_node_iri_base, (str, HttpUrl)):
|
|
199
208
|
raise ValueError('blank_node_iri_base must be a valid URL')
|
|
200
209
|
from .wrapper import jsonld
|
|
201
|
-
if not structural and not
|
|
202
|
-
raise ValueError('At least one of structural or
|
|
210
|
+
if not structural and not contextual:
|
|
211
|
+
raise ValueError('At least one of structural or contextual must be True.')
|
|
203
212
|
|
|
204
213
|
from h5rdmtoolbox.ld.hdf.file import get_serialized_ld
|
|
205
|
-
if structural and not
|
|
206
|
-
return get_serialized_ld(hdf_filename, blank_node_iri_base, format="json-ld", context=context,
|
|
207
|
-
|
|
214
|
+
if structural and not contextual:
|
|
215
|
+
return get_serialized_ld(hdf_filename, blank_node_iri_base, format="json-ld", context=context,
|
|
216
|
+
contextual=contextual, skipND=skipND)
|
|
217
|
+
return get_serialized_ld(hdf_filename, blank_node_iri_base, format="json-ld", context=context,
|
|
218
|
+
contextual=contextual, skipND=skipND)
|
|
208
219
|
# with File(hdf_filename) as h5:
|
|
209
220
|
# return jsonld.dumps(
|
|
210
221
|
# h5,
|
|
@@ -221,20 +232,17 @@ def serialize(hdf_filename,
|
|
|
221
232
|
fmt: str = "ttl",
|
|
222
233
|
skipND: int = 1,
|
|
223
234
|
structural: bool = True,
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
blank_node_iri_base: Optional[str] = None,
|
|
235
|
+
contextual: bool = True,
|
|
236
|
+
file_uri: Optional[str] = None,
|
|
227
237
|
**kwargs):
|
|
228
238
|
"""Alternative to json-ld but allows multiple serialization options"""
|
|
229
239
|
fmt = kwargs.pop("format", fmt)
|
|
230
240
|
with File(hdf_filename) as h5:
|
|
231
|
-
return h5.serialize(fmt,
|
|
232
|
-
skipND,
|
|
241
|
+
return h5.serialize(fmt=fmt,
|
|
242
|
+
skipND=skipND,
|
|
233
243
|
structural=structural,
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
blank_node_iri_base=blank_node_iri_base,
|
|
237
|
-
**kwargs)
|
|
244
|
+
contextual=contextual,
|
|
245
|
+
file_uri=file_uri)
|
|
238
246
|
|
|
239
247
|
|
|
240
248
|
def build_pyvis_graph(hdf_filename, output_filename="kg-graph.html", notebook=False,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import h5py
|
|
2
2
|
import numpy as np
|
|
3
|
+
import rdflib
|
|
3
4
|
from ontolutils.namespacelib.hdf5 import HDF5
|
|
4
5
|
|
|
5
6
|
# Mapping HDF5 numpy datatypes to ontology types
|
|
@@ -53,12 +54,11 @@ def _get_endianness(dtype):
|
|
|
53
54
|
return 'LE' # Default to little-endian if unknown
|
|
54
55
|
|
|
55
56
|
|
|
56
|
-
def get_datatype(dataset: h5py.Dataset):
|
|
57
|
+
def get_datatype(dataset: h5py.Dataset) -> rdflib.URIRef:
|
|
57
58
|
"""Maps an HDF5 dataset to its ontology-defined datatype."""
|
|
58
59
|
dtype = dataset.dtype
|
|
59
60
|
np_type = np.dtype(dtype).type # Get numpy type (e.g., np.float32)
|
|
60
61
|
|
|
61
62
|
endianness = _get_endianness(dtype)
|
|
62
63
|
|
|
63
|
-
|
|
64
|
-
return ontology_type
|
|
64
|
+
return HDF5_DATATYPE_MAP.get((np_type, endianness), None)
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import pathlib
|
|
2
|
+
import warnings
|
|
3
|
+
from typing import Union, Optional, Dict
|
|
4
|
+
|
|
5
|
+
import h5py
|
|
6
|
+
import rdflib
|
|
7
|
+
|
|
8
|
+
from .hdf.file import get_ld as get_hdf_ld
|
|
9
|
+
from .user.file import get_ld as get_contextual_ld
|
|
10
|
+
from .utils import optimize_context
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def get_ld(
|
|
14
|
+
hdf_filename: Union[str, pathlib.Path],
|
|
15
|
+
structural: bool = True,
|
|
16
|
+
contextual: bool = True,
|
|
17
|
+
file_uri: Optional[str] = None,
|
|
18
|
+
skipND: Optional[int] = 1,
|
|
19
|
+
context: Optional[Dict] = None) -> rdflib.Graph:
|
|
20
|
+
"""Return the HDF file content as a rdflib.Graph object."""
|
|
21
|
+
|
|
22
|
+
graph = None
|
|
23
|
+
with h5py.File(hdf_filename) as h5:
|
|
24
|
+
if contextual and structural:
|
|
25
|
+
graph1 = get_hdf_ld(h5, file_uri=file_uri, skipND=skipND)
|
|
26
|
+
graph2 = get_contextual_ld(h5, file_uri=file_uri)
|
|
27
|
+
graph = graph1 + graph2
|
|
28
|
+
else:
|
|
29
|
+
if structural:
|
|
30
|
+
graph = get_hdf_ld(hdf_filename, file_uri=file_uri, skipND=skipND)
|
|
31
|
+
|
|
32
|
+
if contextual:
|
|
33
|
+
graph = get_contextual_ld(hdf_filename, file_uri=file_uri)
|
|
34
|
+
if graph is None:
|
|
35
|
+
raise ValueError("structural and semantic cannot be both False.")
|
|
36
|
+
context = context or {}
|
|
37
|
+
for prefix, uri in context.items():
|
|
38
|
+
if not isinstance(uri, rdflib.URIRef):
|
|
39
|
+
graph.bind("ex", rdflib.URIRef(uri))
|
|
40
|
+
return graph
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def hdf2jsonld(
|
|
44
|
+
filename: Union[str, pathlib.Path],
|
|
45
|
+
metadata_filename: Optional[Union[str, pathlib.Path]] = None,
|
|
46
|
+
context: Optional[dict] = None,
|
|
47
|
+
structural: bool = True,
|
|
48
|
+
contextual: bool = True,
|
|
49
|
+
indent: int = 2,
|
|
50
|
+
file_uri: Optional[str] = None,
|
|
51
|
+
skipND: Optional[int] = 1,
|
|
52
|
+
):
|
|
53
|
+
if metadata_filename is None:
|
|
54
|
+
metadata_filename = pathlib.Path(filename).with_suffix('.jsonld') # recommended suffix for JSON-LD is .jsonld!
|
|
55
|
+
else:
|
|
56
|
+
metadata_filename = pathlib.Path(metadata_filename)
|
|
57
|
+
|
|
58
|
+
graph = get_ld(
|
|
59
|
+
hdf_filename=filename,
|
|
60
|
+
structural=structural,
|
|
61
|
+
contextual=contextual,
|
|
62
|
+
file_uri=file_uri,
|
|
63
|
+
skipND=skipND
|
|
64
|
+
)
|
|
65
|
+
context = context or {}
|
|
66
|
+
context = optimize_context(graph, context)
|
|
67
|
+
|
|
68
|
+
with open(metadata_filename, 'w', encoding='utf-8') as f:
|
|
69
|
+
f.write(
|
|
70
|
+
graph.serialize(format='json-ld',
|
|
71
|
+
indent=indent,
|
|
72
|
+
auto_compact=True,
|
|
73
|
+
context=context)
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
return metadata_filename
|
|
@@ -3,14 +3,20 @@ from ontolutils.namespacelib.hdf5 import HDF5
|
|
|
3
3
|
from rdflib import Namespace, Literal
|
|
4
4
|
from rdflib import XSD, RDF
|
|
5
5
|
|
|
6
|
+
from ..utils import get_attr_node
|
|
7
|
+
|
|
6
8
|
HDF = Namespace(str(HDF5))
|
|
7
9
|
|
|
8
10
|
|
|
9
|
-
def process_attribute(name, value, graph, parent_uri):
|
|
11
|
+
def process_attribute(*, name, value, graph, parent, parent_uri, blank_node_iri_base):
|
|
10
12
|
"""Process an HDF5 attribute, adding it to the RDF graph."""
|
|
11
13
|
if name.isupper() or name.startswith('@'):
|
|
12
14
|
return
|
|
13
|
-
attr_uri =
|
|
15
|
+
attr_uri = get_attr_node(
|
|
16
|
+
parent,
|
|
17
|
+
name,
|
|
18
|
+
blank_node_iri_base
|
|
19
|
+
)
|
|
14
20
|
|
|
15
21
|
if isinstance(value, str):
|
|
16
22
|
graph.add((attr_uri, RDF.type, HDF5.StringAttribute))
|
|
@@ -10,6 +10,7 @@ from rdflib import XSD, RDF
|
|
|
10
10
|
|
|
11
11
|
from h5rdmtoolbox.convention.ontology.hdf_datatypes import get_datatype
|
|
12
12
|
from h5rdmtoolbox.ld.hdf.attributes import process_attribute
|
|
13
|
+
from h5rdmtoolbox.ld.utils import get_property_node
|
|
13
14
|
|
|
14
15
|
HDF = Namespace(str(HDF5))
|
|
15
16
|
HDF5_FILTER_ONTOLOGY = {
|
|
@@ -71,11 +72,11 @@ def process_dataset(
|
|
|
71
72
|
else:
|
|
72
73
|
graph.add((dataset_uri, HDF5.maximumSize, rdflib.Literal(-1, datatype=XSD.integer)))
|
|
73
74
|
|
|
74
|
-
|
|
75
|
+
datatype_node = get_datatype(dataset)
|
|
75
76
|
|
|
76
|
-
if
|
|
77
|
-
graph.add((
|
|
78
|
-
graph.add((dataset_uri, HDF5.datatype,
|
|
77
|
+
if datatype_node:
|
|
78
|
+
graph.add((datatype_node, RDF.type, HDF5.Datatype))
|
|
79
|
+
graph.add((dataset_uri, HDF5.datatype, datatype_node))
|
|
79
80
|
|
|
80
81
|
is_string_dataset = False
|
|
81
82
|
if dataset.dtype.kind == 'S':
|
|
@@ -97,22 +98,36 @@ def process_dataset(
|
|
|
97
98
|
graph.add((dataset_uri, HDF5.layout, HDF5.H5D_VIRTUAL))
|
|
98
99
|
|
|
99
100
|
if dataset.chunks:
|
|
100
|
-
chunk_dimension_uri =
|
|
101
|
+
chunk_dimension_uri = get_property_node(
|
|
102
|
+
dataset,
|
|
103
|
+
name='chunk_dimensions',
|
|
104
|
+
blank_node_iri_base=blank_node_iri_base
|
|
105
|
+
)
|
|
101
106
|
graph.add((chunk_dimension_uri, RDF.type, HDF5.ChunkDimension))
|
|
102
107
|
graph.add((dataset_uri, HDF5.chunk, chunk_dimension_uri))
|
|
103
108
|
|
|
104
109
|
for ichunk, chunk in enumerate(dataset.chunks):
|
|
105
|
-
dimension_index_uri =
|
|
110
|
+
dimension_index_uri = get_property_node(
|
|
111
|
+
dataset,
|
|
112
|
+
name=f'chunk_dimension_{ichunk}',
|
|
113
|
+
blank_node_iri_base=blank_node_iri_base
|
|
114
|
+
)
|
|
106
115
|
graph.add((dimension_index_uri, RDF.type, HDF5.DataspaceDimension))
|
|
107
116
|
graph.add((chunk_dimension_uri, HDF5.dimension, dimension_index_uri))
|
|
108
117
|
graph.add((dimension_index_uri, HDF5.size, rdflib.Literal(chunk, datatype=XSD.integer)))
|
|
109
118
|
graph.add((dimension_index_uri, HDF5.dimensionIndex, rdflib.Literal(ichunk, datatype=XSD.integer)))
|
|
110
119
|
|
|
120
|
+
dataspace_uri = get_property_node(
|
|
121
|
+
obj=dataset, name='dataspace', blank_node_iri_base=blank_node_iri_base
|
|
122
|
+
)
|
|
111
123
|
if dataset.ndim > 0:
|
|
112
|
-
dataspace_uri = rdflib.BNode()
|
|
113
124
|
graph.add((dataspace_uri, RDF.type, HDF5.SimpleDataspace))
|
|
114
125
|
for idim, dim in enumerate(dataset.shape):
|
|
115
|
-
dataspace_dimension_node =
|
|
126
|
+
dataspace_dimension_node = get_property_node(
|
|
127
|
+
obj=dataset,
|
|
128
|
+
name=f'dataspace_dimension_{idim}',
|
|
129
|
+
blank_node_iri_base=blank_node_iri_base
|
|
130
|
+
)
|
|
116
131
|
graph.add((dataspace_dimension_node, RDF.type, HDF5.DataspaceDimension))
|
|
117
132
|
graph.add((dataspace_uri, HDF5.dimension, dataspace_dimension_node))
|
|
118
133
|
graph.add((dataspace_dimension_node, HDF5.size, rdflib.Literal(dim, datatype=XSD.integer)))
|
|
@@ -125,8 +140,7 @@ def process_dataset(
|
|
|
125
140
|
else:
|
|
126
141
|
graph.add((dataset_uri, HDF5.value, rdflib.Literal(data)))
|
|
127
142
|
else:
|
|
128
|
-
dataspace_uri
|
|
129
|
-
graph.add((dataspace_uri, RDF.type, HDF5.scalarDataspace))
|
|
143
|
+
graph.add((dataspace_uri, RDF.type, HDF5.ScalarDataspace))
|
|
130
144
|
|
|
131
145
|
if skipND and dataset.ndim < skipND:
|
|
132
146
|
data = dataset[()]
|
|
@@ -139,4 +153,5 @@ def process_dataset(
|
|
|
139
153
|
|
|
140
154
|
# Process attributes of the dataset
|
|
141
155
|
for attr, value in dataset.attrs.items():
|
|
142
|
-
process_attribute(attr, value, graph, dataset_uri
|
|
156
|
+
process_attribute(name=attr, value=value, graph=graph, parent=dataset, parent_uri=dataset_uri,
|
|
157
|
+
blank_node_iri_base=blank_node_iri_base)
|
|
@@ -14,29 +14,30 @@ from ..utils import optimize_context, get_obj_bnode, get_file_bnode
|
|
|
14
14
|
HDF = Namespace(str(HDF5))
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
def get_ld(source: Union[str, h5py.File],
|
|
17
|
+
def get_ld(source: Union[str, h5py.File],
|
|
18
|
+
file_uri: Optional[str] = None,
|
|
18
19
|
skipND: int = 1) -> rdflib.Graph:
|
|
19
20
|
"""Convert an HDF5 file into an RDF graph."""
|
|
20
21
|
|
|
21
22
|
if not isinstance(source, h5py.File):
|
|
22
23
|
with h5py.File(source) as h5f:
|
|
23
|
-
return get_ld(h5f,
|
|
24
|
+
return get_ld(h5f, file_uri=file_uri, skipND=skipND)
|
|
24
25
|
|
|
25
26
|
graph = Graph()
|
|
26
27
|
graph.bind("hdf", HDF)
|
|
27
28
|
|
|
28
29
|
file_frdf_manager = FileRDFManager(source.attrs)
|
|
29
30
|
if file_frdf_manager.subject:
|
|
30
|
-
|
|
31
|
+
_file_uri = rdflib.URIRef(file_frdf_manager.subject)
|
|
31
32
|
else:
|
|
32
|
-
|
|
33
|
+
_file_uri = get_file_bnode(source, file_uri=file_uri)
|
|
33
34
|
|
|
34
|
-
graph.add((
|
|
35
|
+
graph.add((_file_uri, RDF.type, HDF.File))
|
|
35
36
|
|
|
36
|
-
root_group_uri = get_obj_bnode(source["/"], blank_node_iri_base=
|
|
37
|
-
graph.add((
|
|
37
|
+
root_group_uri = get_obj_bnode(source["/"], blank_node_iri_base=file_uri)
|
|
38
|
+
graph.add((_file_uri, HDF5.rootGroup, root_group_uri))
|
|
38
39
|
|
|
39
|
-
process_group(source["/"], graph,
|
|
40
|
+
process_group(source["/"], graph, parent_uri=_file_uri, blank_node_iri_base=file_uri, skipND=skipND)
|
|
40
41
|
|
|
41
42
|
return graph
|
|
42
43
|
|
|
@@ -13,7 +13,13 @@ from h5rdmtoolbox.ld.utils import get_obj_bnode
|
|
|
13
13
|
HDF = Namespace(str(HDF5))
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
def process_group(
|
|
16
|
+
def process_group(
|
|
17
|
+
group,
|
|
18
|
+
graph,
|
|
19
|
+
parent_uri,
|
|
20
|
+
blank_node_iri_base: Optional[str] = None,
|
|
21
|
+
skipND: int = 1
|
|
22
|
+
):
|
|
17
23
|
"""Recursively process HDF5 groups and datasets, adding them to the RDF graph."""
|
|
18
24
|
group_uri = get_obj_bnode(group, blank_node_iri_base=blank_node_iri_base)
|
|
19
25
|
graph.add((group_uri, RDF.type, HDF.Group))
|
|
@@ -25,10 +31,18 @@ def process_group(group, graph, parent_uri, blank_node_iri_base: Optional[str] =
|
|
|
25
31
|
graph.add((group_uri, HDF.member, item_uri))
|
|
26
32
|
|
|
27
33
|
if isinstance(item, h5py.Group):
|
|
28
|
-
process_group(item, graph, group_uri, blank_node_iri_base=blank_node_iri_base)
|
|
34
|
+
process_group(item, graph, parent_uri=group_uri, blank_node_iri_base=blank_node_iri_base)
|
|
29
35
|
elif isinstance(item, h5py.Dataset):
|
|
30
|
-
process_dataset(
|
|
36
|
+
process_dataset(
|
|
37
|
+
item,
|
|
38
|
+
graph,
|
|
39
|
+
parent_uri=group_uri,
|
|
40
|
+
dataset_uri=item_uri,
|
|
41
|
+
blank_node_iri_base=blank_node_iri_base,
|
|
42
|
+
skipND=skipND
|
|
43
|
+
)
|
|
31
44
|
|
|
32
45
|
# Process attributes of the group
|
|
33
46
|
for attr, value in group.attrs.items():
|
|
34
|
-
process_attribute(attr, value, graph, group_uri
|
|
47
|
+
process_attribute(name=attr, value=value, graph=graph, parent=group, parent_uri=group_uri,
|
|
48
|
+
blank_node_iri_base=blank_node_iri_base)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import warnings
|
|
3
|
+
from typing import Union
|
|
3
4
|
|
|
4
5
|
import numpy as np
|
|
5
6
|
import rdflib
|
|
@@ -9,7 +10,7 @@ from h5rdmtoolbox.ld.utils import get_attr_dtype_as_XSD, get_obj_bnode
|
|
|
9
10
|
from ..rdf import FileRDFManager, RDFManager
|
|
10
11
|
|
|
11
12
|
|
|
12
|
-
def process_file_attribute(parent_obj, name, data, graph,
|
|
13
|
+
def process_file_attribute(parent_obj, name, data, graph, file_uri: Union[rdflib.URIRef, rdflib.BNode]):
|
|
13
14
|
rdf_user_type = FileRDFManager(parent_obj.attrs).type
|
|
14
15
|
if rdf_user_type is not None:
|
|
15
16
|
if isinstance(rdf_user_type, (list, np.ndarray)):
|
|
@@ -48,18 +49,18 @@ def process_file_attribute(parent_obj, name, data, graph, blank_node_iri_base, f
|
|
|
48
49
|
f"Error parsing JSON-LD object for attribute. name={name}, data={data}. Orig. Error: {e}")
|
|
49
50
|
|
|
50
51
|
elif isinstance(rdf_user_object, dict):
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
52
|
+
try:
|
|
53
|
+
obj_graph = rdflib.Graph().parse(data=json.loads(json.dumps(rdf_user_object)), format="json-ld")
|
|
54
|
+
# relate the obj_graph with the predicate:
|
|
55
|
+
_subjects = set(obj_graph.subjects())
|
|
56
|
+
if len(_subjects) != 1:
|
|
57
|
+
warnings.warn(f"Error parsing JSON-LD object for attribute. name={name}, data={data}. "
|
|
58
|
+
f"Expected exactly one subject, found {len(_subjects)}")
|
|
59
|
+
obj_graph.add((file_uri, rdflib.URIRef(rdf_user_predicate), list(_subjects)[0]))
|
|
60
|
+
graph += obj_graph
|
|
61
|
+
except Exception as e:
|
|
62
|
+
warnings.warn(
|
|
63
|
+
f"Error parsing JSON-LD object for attribute. name={name}, data={data}. Orig. Error: {e}")
|
|
63
64
|
else:
|
|
64
65
|
graph.add(
|
|
65
66
|
(file_uri,
|
|
@@ -70,7 +71,6 @@ def process_file_attribute(parent_obj, name, data, graph, blank_node_iri_base, f
|
|
|
70
71
|
|
|
71
72
|
|
|
72
73
|
def process_attribute(parent_obj, name, data, graph, blank_node_iri_base):
|
|
73
|
-
|
|
74
74
|
rdf_manager = RDFManager(parent_obj.attrs)
|
|
75
75
|
|
|
76
76
|
parent_uri = rdf_manager.subject
|
|
@@ -15,12 +15,14 @@ from ..rdf import FileRDFManager
|
|
|
15
15
|
HDF = Namespace(str(HDF5))
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
def get_ld(
|
|
18
|
+
def get_ld(
|
|
19
|
+
source: Union[str, h5py.File],
|
|
20
|
+
file_uri: Optional[str] = None) -> rdflib.Graph:
|
|
19
21
|
"""Convert an HDF5 file into an RDF graph."""
|
|
20
22
|
|
|
21
23
|
if not isinstance(source, h5py.File):
|
|
22
24
|
with h5py.File(source) as h5f:
|
|
23
|
-
return get_ld(h5f)
|
|
25
|
+
return get_ld(h5f, file_uri=file_uri)
|
|
24
26
|
|
|
25
27
|
graph = Graph()
|
|
26
28
|
graph.bind("m4i", rdflib.URIRef("http://w3id.org/nfdi4ing/metadata4ing#"))
|
|
@@ -30,27 +32,25 @@ def get_ld(source: Union[str, h5py.File], blank_node_iri_base: Optional[str] = N
|
|
|
30
32
|
file_frdf_manager = FileRDFManager(source.attrs)
|
|
31
33
|
|
|
32
34
|
if file_frdf_manager.subject:
|
|
33
|
-
|
|
35
|
+
file_node = rdflib.URIRef(file_frdf_manager.subject)
|
|
34
36
|
else:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
file_node = get_file_bnode(source, file_uri=file_uri)
|
|
37
38
|
|
|
38
39
|
if source.name == "/":
|
|
39
40
|
file_rdf = file_frdf_manager.type
|
|
40
41
|
else:
|
|
41
42
|
file_rdf = None
|
|
42
43
|
|
|
43
|
-
|
|
44
44
|
if file_rdf:
|
|
45
45
|
if isinstance(file_rdf, list):
|
|
46
46
|
for rdf_type in file_rdf:
|
|
47
|
-
graph.add((
|
|
47
|
+
graph.add((file_node, rdflib.RDF.type, rdflib.URIRef(rdf_type)))
|
|
48
48
|
else:
|
|
49
|
-
graph.add((
|
|
49
|
+
graph.add((file_node, rdflib.RDF.type, rdflib.URIRef(file_rdf)))
|
|
50
50
|
|
|
51
51
|
for ak, av in source.attrs.items():
|
|
52
|
-
process_file_attribute(source, ak, av, graph,
|
|
52
|
+
process_file_attribute(source, ak, av, graph, file_node)
|
|
53
53
|
|
|
54
|
-
process_group(source, graph, blank_node_iri_base=
|
|
54
|
+
process_group(source, graph, blank_node_iri_base=file_uri)
|
|
55
55
|
|
|
56
56
|
return graph
|